@ai-matrx/records-ui 0.116.30 → 0.116.32
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/CHANGELOG.md +25 -1
- package/dist/{SaveToTable-P3MPRSCW.js → SaveToTable-T2CMF2SK.js} +3 -3
- package/dist/{chunk-7RSMA3NK.js → chunk-5IHVQ5MS.js} +1 -1
- package/dist/chunk-5IHVQ5MS.js.map +1 -0
- package/dist/{chunk-2SI7LSP3.js → chunk-ECUJDR3W.js} +6 -6
- package/dist/chunk-ECUJDR3W.js.map +1 -0
- package/dist/{chunk-W7GR64CB.js → chunk-GT27AGOI.js} +22 -1
- package/dist/chunk-GT27AGOI.js.map +1 -0
- package/dist/{chunk-FLIERNH7.js → chunk-U7SHCLTY.js} +18 -6
- package/dist/chunk-U7SHCLTY.js.map +1 -0
- package/dist/helpers.d.cts +0 -2
- package/dist/helpers.d.ts +0 -2
- package/dist/html-frame.cjs +21 -0
- package/dist/html-frame.cjs.map +1 -1
- package/dist/html-frame.js +1 -1
- package/dist/index.cjs +81 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +39 -39
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +21 -0
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-2SI7LSP3.js.map +0 -1
- package/dist/chunk-7RSMA3NK.js.map +0 -1
- package/dist/chunk-FLIERNH7.js.map +0 -1
- package/dist/chunk-W7GR64CB.js.map +0 -1
- /package/dist/{SaveToTable-P3MPRSCW.js.map → SaveToTable-T2CMF2SK.js.map} +0 -0
package/dist/helpers.d.cts
CHANGED
|
@@ -466,8 +466,6 @@ interface TableAskAgentAnswer {
|
|
|
466
466
|
type TableAskOutcome = {
|
|
467
467
|
ok: true;
|
|
468
468
|
answer: TableAskAgentAnswer;
|
|
469
|
-
/** What the run cost, in whole points at the viewer's rate. Absent or null = not measured; nothing is drawn (never dollars). */
|
|
470
|
-
costPoints?: number | null | undefined;
|
|
471
469
|
}
|
|
472
470
|
/** A refusal says the real reason (`message`) and, when the host knows one, what to do (`hint`); no hint, none is invented. */
|
|
473
471
|
| {
|
package/dist/helpers.d.ts
CHANGED
|
@@ -466,8 +466,6 @@ interface TableAskAgentAnswer {
|
|
|
466
466
|
type TableAskOutcome = {
|
|
467
467
|
ok: true;
|
|
468
468
|
answer: TableAskAgentAnswer;
|
|
469
|
-
/** What the run cost, in whole points at the viewer's rate. Absent or null = not measured; nothing is drawn (never dollars). */
|
|
470
|
-
costPoints?: number | null | undefined;
|
|
471
469
|
}
|
|
472
470
|
/** A refusal says the real reason (`message`) and, when the host knows one, what to do (`hint`); no hint, none is invented. */
|
|
473
471
|
| {
|
package/dist/html-frame.cjs
CHANGED
|
@@ -103,6 +103,26 @@ function sampleStyle(tokens, theme, font) {
|
|
|
103
103
|
function sampleDocument(html, tokens, theme, font, fonts) {
|
|
104
104
|
return `<!doctype html><html class="${theme}" style="color-scheme:${theme}"><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${HTML_SAMPLE_CSP}">` + fontLink(fonts) + `<meta name="color-scheme" content="${theme}"><style id="matrx-sample-tokens">${sampleStyle(tokens, theme, font)}</style></head><body><div id="matrx-sample">${html}</div></body></html>`;
|
|
105
105
|
}
|
|
106
|
+
function forwardWheel(target, e) {
|
|
107
|
+
if (!target) return;
|
|
108
|
+
const r = target.getBoundingClientRect();
|
|
109
|
+
target.dispatchEvent(
|
|
110
|
+
new WheelEvent("wheel", {
|
|
111
|
+
bubbles: true,
|
|
112
|
+
cancelable: true,
|
|
113
|
+
deltaX: e.deltaX,
|
|
114
|
+
deltaY: e.deltaY,
|
|
115
|
+
deltaZ: e.deltaZ,
|
|
116
|
+
deltaMode: e.deltaMode,
|
|
117
|
+
clientX: r.left + e.clientX,
|
|
118
|
+
clientY: r.top + e.clientY,
|
|
119
|
+
ctrlKey: e.ctrlKey,
|
|
120
|
+
metaKey: e.metaKey,
|
|
121
|
+
shiftKey: e.shiftKey,
|
|
122
|
+
altKey: e.altKey
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}
|
|
106
126
|
function sampleHeight(doc) {
|
|
107
127
|
const box = doc?.getElementById("matrx-sample");
|
|
108
128
|
if (!box) return 0;
|
|
@@ -160,6 +180,7 @@ function HtmlSampleFrame({ html, title = "Sample", className, initialHeight = 24
|
|
|
160
180
|
const box = inner.getElementById("matrx-sample");
|
|
161
181
|
const View = inner.defaultView;
|
|
162
182
|
if (box && View?.ResizeObserver) new View.ResizeObserver(() => measure()).observe(box);
|
|
183
|
+
inner.addEventListener("wheel", (e) => forwardWheel(frame.current, e), { passive: true });
|
|
163
184
|
};
|
|
164
185
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
165
186
|
"iframe",
|
package/dist/html-frame.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/htmlFrameEntry.ts","../src/looks/htmlFrame.tsx"],"sourcesContent":["// src/htmlFrameEntry.ts — @ai-matrx/records-ui/html-frame · the seamless, sandboxed, auto-height HTML\n// frame alone (react + cn), for a host that draws written HTML without loading a screen.\nexport {\n HTML_SAMPLE_CSP,\n HTML_SAMPLE_SANDBOX,\n SAMPLE_TOKEN_NAMES,\n HtmlSampleFrame,\n HtmlSampleTokensProvider,\n hostTheme,\n hostTokens,\n sampleDocument,\n sampleHeight,\n sampleStyle,\n tokenValue,\n type HtmlSampleFrameProps,\n type SampleTheme,\n type SampleTokenSet,\n type SampleTokens,\n} from \"./looks/htmlFrame\";\n","\"use client\";\n\n// src/looks/htmlFrame.tsx — @ai-matrx/records-ui · THE SEAMLESS HTML FRAME (light: react + cn only)\n//\n// Shipped alone as `@ai-matrx/records-ui/html-frame`, so a host draws written HTML (the board's\n// Cover hero) without loading a screen. The html_sample look (htmlLook.tsx) draws its samples in it.\n// What the frame allows and why: see htmlLook.tsx's header.\n\nimport { createContext, useContext, useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"@ai-matrx/design-system/cn\";\n/** The sandbox the frame wears. Markup and CSS only: never `allow-scripts` (see the header). */\nexport const HTML_SAMPLE_SANDBOX = \"allow-same-origin\";\n\n/** What a sample may load: inline styles, and images and fonts from data or https. Nothing else. */\nexport const HTML_SAMPLE_CSP =\n \"default-src 'none'; style-src 'unsafe-inline' https://fonts.googleapis.com; img-src data: blob: https:; font-src data: https:; media-src data: https:; script-src 'none'; connect-src 'none'; form-action 'none'\";\n\n/** The token names every sample can use as `var(--name)`. The agent skill names the same list. */\nexport const SAMPLE_TOKEN_NAMES = [\n \"background\",\n \"foreground\",\n \"card\",\n \"card-foreground\",\n \"popover\",\n \"popover-foreground\",\n \"muted\",\n \"muted-foreground\",\n \"primary\",\n \"primary-foreground\",\n \"secondary\",\n \"secondary-foreground\",\n \"accent\",\n \"accent-foreground\",\n \"destructive\",\n \"destructive-foreground\",\n \"success\",\n \"warning\",\n \"border\",\n \"input\",\n \"ring\",\n \"radius\",\n] as const;\n\nexport type SampleTheme = \"light\" | \"dark\";\n/** Token values by name, without the leading dashes: `{ primary: \"#1f4fe0\", radius: \"8px\" }`. */\nexport type SampleTokens = Readonly<Record<string, string>>;\nexport interface SampleTokenSet {\n light?: SampleTokens;\n dark?: SampleTokens;\n /** Web font families the samples name (a board's type styles); loaded from Google Fonts. */\n fonts?: readonly string[];\n}\n\n/** Families that are the system's own and need no loading. */\nconst SYSTEM_FAMILY = /^(system-ui|ui-[a-z-]+|-apple-system|blinkmacsystemfont|serif|sans-serif|monospace|cursive|fantasy|georgia|arial|helvetica|helvetica neue|times|times new roman|courier|courier new|verdana|tahoma|segoe ui|roboto mono|sf pro.*|menlo|monaco|consolas)$/i;\n\n/** The one stylesheet link that loads these families, or \"\" when none needs loading. */\nexport function fontLink(fonts: readonly string[] | undefined): string {\n const families = [...new Set((fonts ?? []).map((f) => f.trim()).filter((f) => /^[A-Za-z0-9 ]{2,40}$/.test(f) && !SYSTEM_FAMILY.test(f)))].slice(0, 8);\n if (families.length === 0) return \"\";\n const q = families.map((f) => `family=${f.replace(/ /g, \"+\")}:ital,wght@0,300..800;1,300..800`).join(\"&\");\n return `<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?${q}&display=swap\">`;\n}\n\nconst TokensContext = createContext<SampleTokenSet | null>(null);\n\n/** A host's own token values for every sample under it (a board's design-system tables). */\nexport function HtmlSampleTokensProvider({ tokens, children }: { tokens: SampleTokenSet | null; children: ReactNode }) {\n return <TokensContext.Provider value={tokens}>{children}</TokensContext.Provider>;\n}\n\n/** A bare HSL triplet (\"240 5% 96%\", how the app keeps its colors) becomes a color a sample can use. */\nexport function tokenValue(raw: string): string {\n const v = raw.trim();\n return /^-?\\d+(\\.\\d+)?(deg)?\\s+\\d+(\\.\\d+)?%\\s+\\d+(\\.\\d+)?%(\\s*\\/\\s*[\\d.]+%?)?$/.test(v) ? `hsl(${v})` : v;\n}\n\n/** The host page's theme: `dark` when its root wears the `dark` class or `data-theme=\"dark\"`. */\nexport function hostTheme(doc: Document | undefined = typeof document === \"undefined\" ? undefined : document): SampleTheme {\n const root = doc?.documentElement;\n if (!root) return \"light\";\n return root.classList.contains(\"dark\") || root.dataset.theme === \"dark\" ? \"dark\" : \"light\";\n}\n\n/** The host page's own token values, read from where the frame sits (so a themed region counts). */\nexport function hostTokens(at: Element | null): Record<string, string> {\n const out: Record<string, string> = {};\n if (!at || typeof getComputedStyle === \"undefined\") return out;\n const style = getComputedStyle(at);\n for (const name of SAMPLE_TOKEN_NAMES) {\n const raw = style.getPropertyValue(`--${name}`);\n if (raw && raw.trim()) out[name] = tokenValue(raw);\n }\n return out;\n}\n\n/** The `:root` block a sample reads its tokens from, plus the frame's own seamless reset. */\nexport function sampleStyle(tokens: SampleTokens, theme: SampleTheme, font?: string): string {\n const vars = Object.entries(tokens)\n .filter(([name, value]) => /^[a-z][a-z0-9-]*$/.test(name) && !/[;{}<>]/.test(value))\n .map(([name, value]) => `--${name}:${value};`)\n .join(\"\");\n const family = font && !/[;{}<>]/.test(font) ? font : \"system-ui, sans-serif\";\n return (\n `:root{${vars}color-scheme:${theme};}` +\n `html,body{margin:0;padding:0;background:transparent;overflow:hidden;}` +\n `body{color:var(--foreground,${theme === \"dark\" ? \"#e8ebf1\" : \"#111827\"});font-family:${family};font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;}` +\n `*,*::before,*::after{box-sizing:border-box;}` +\n `#matrx-sample{display:flow-root;}`\n );\n}\n\n/** The whole document the frame draws: CSP, tokens, the reset, and the sample inside one measured box. */\nexport function sampleDocument(html: string, tokens: SampleTokens, theme: SampleTheme, font?: string, fonts?: readonly string[]): string {\n return (\n `<!doctype html><html class=\"${theme}\" style=\"color-scheme:${theme}\"><head><meta charset=\"utf-8\">` +\n `<meta http-equiv=\"Content-Security-Policy\" content=\"${HTML_SAMPLE_CSP}\">` +\n fontLink(fonts) +\n `<meta name=\"color-scheme\" content=\"${theme}\">` +\n `<style id=\"matrx-sample-tokens\">${sampleStyle(tokens, theme, font)}</style>` +\n `</head><body><div id=\"matrx-sample\">${html}</div></body></html>`\n );\n}\n\n/** The sample's drawn height in px, from its one measured box (margins included: it is a flow root). */\nexport function sampleHeight(doc: Document | null | undefined): number {\n const box = doc?.getElementById(\"matrx-sample\");\n if (!box) return 0;\n return Math.ceil(box.getBoundingClientRect().height || box.scrollHeight || 0);\n}\n\nexport interface HtmlSampleFrameProps {\n html: string;\n /** What a screen reader calls the frame. */\n title?: string;\n className?: string;\n /** Height before the sample has been measured, so the page does not jump when it loads. Default 24. */\n initialHeight?: number;\n}\n\n/**\n * THE SEAMLESS SAMPLE FRAME — markup and CSS only, transparent, borderless, as tall as its content,\n * with the host's tokens and theme. See the file header for what the sandbox allows.\n */\nexport function HtmlSampleFrame({ html, title = \"Sample\", className, initialHeight = 24 }: HtmlSampleFrameProps) {\n const frame = useRef<HTMLIFrameElement | null>(null);\n const given = useContext(TokensContext);\n const [height, setHeight] = useState(initialHeight);\n const [theme, setTheme] = useState<SampleTheme>(() => hostTheme());\n // The document is built once per html; a theme or token change after that is written into the\n // live frame (`paint`), never a reload.\n const fontsKey = (given?.fonts ?? []).join(\"|\");\n const [doc, setDoc] = useState(() => sampleDocument(html, given?.[theme] ?? {}, theme, undefined, given?.fonts));\n const built = useRef(`${html}\\u0000${fontsKey}`);\n\n const tokensFor = (t: SampleTheme): Record<string, string> => ({ ...hostTokens(frame.current), ...(given?.[t] ?? {}) });\n const fontOf = () => (frame.current && typeof getComputedStyle !== \"undefined\" ? getComputedStyle(frame.current).fontFamily : undefined);\n\n // A new html: a new document, opened in today's theme with today's tokens.\n // New fonts to load also rebuild (a stylesheet link is part of the document head).\n useEffect(() => {\n const key = `${html}\\u0000${fontsKey}`;\n if (built.current === key) return;\n built.current = key;\n setDoc(sampleDocument(html, tokensFor(theme), theme, fontOf(), given?.fonts));\n // eslint-disable-next-line react-hooks/exhaustive-deps -- the theme and tokens are written live below\n }, [html, fontsKey]);\n\n // The host's theme, followed as it changes.\n useEffect(() => {\n if (typeof MutationObserver === \"undefined\" || typeof document === \"undefined\") return;\n const watch = new MutationObserver(() => setTheme(hostTheme()));\n watch.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\", \"data-theme\"] });\n return () => watch.disconnect();\n }, []);\n\n const measure = () => {\n const h = sampleHeight(frame.current?.contentDocument);\n if (h > 0) setHeight(h);\n };\n\n // Write the theme and tokens into the live document (same origin, no script inside it).\n const paint = () => {\n const inner = frame.current?.contentDocument;\n if (!inner?.documentElement) return;\n const style = inner.getElementById(\"matrx-sample-tokens\");\n if (style) style.textContent = sampleStyle(tokensFor(theme), theme, fontOf());\n inner.documentElement.className = theme;\n inner.documentElement.style.colorScheme = theme;\n measure();\n };\n\n useEffect(paint, [theme, given]); // eslint-disable-line react-hooks/exhaustive-deps\n\n // The width the frame is given changes the sample's height (text wraps): measure again.\n useEffect(() => {\n const el = frame.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(() => measure());\n ro.observe(el);\n return () => ro.disconnect();\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n const onLoad = () => {\n paint();\n const inner = frame.current?.contentDocument;\n if (!inner) return;\n // Late images and fonts change the height after load.\n inner.addEventListener(\"load\", measure, true);\n void inner.fonts?.ready.then(measure).catch(() => undefined);\n const box = inner.getElementById(\"matrx-sample\");\n const View = inner.defaultView as (Window & { ResizeObserver?: typeof ResizeObserver }) | null;\n if (box && View?.ResizeObserver) new View.ResizeObserver(() => measure()).observe(box);\n };\n\n return (\n <iframe\n ref={frame}\n title={title}\n aria-label={title}\n data-records-html-sample=\"\"\n sandbox={HTML_SAMPLE_SANDBOX}\n referrerPolicy=\"no-referrer\"\n srcDoc={doc}\n onLoad={onLoad}\n scrolling=\"no\"\n className={cn(\"block w-full border-0 bg-transparent\", className)}\n style={{ height: `${height}px`, colorScheme: theme, overflow: \"hidden\" }}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQA,mBAAuF;AACvF,gBAAmB;AA2DV;AAzDF,IAAM,sBAAsB;AAG5B,IAAM,kBACX;AAGK,IAAM,qBAAqB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAaA,IAAM,gBAAgB;AAGf,SAAS,SAAS,OAA8C;AACrE,QAAM,WAAW,CAAC,GAAG,IAAI,KAAK,SAAS,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAA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AA,EAC7B,GAAG,CAAC,CAAC;AAEL,QAAM,SAAS,MAAM;AACnB,UAAM;AACN,UAAM,QAAQ,MAAM,SAAS;AAC7B,QAAI,CAAC,MAAO;AAEZ,UAAM,iBAAiB,QAAQ,SAAS,IAAI;AAC5C,SAAK,MAAM,OAAO,MAAM,KAAK,OAAO,EAAE,MAAM,MAAM,MAAS;AAC3D,UAAM,MAAM,MAAM,eAAe,cAAc;AAC/C,UAAM,OAAO,MAAM;AACnB,QAAI,OAAO,MAAM,eAAgB,KAAI,KAAK,eAAe,MAAM,QAAQ,CAAC,EAAE,QAAQ,GAAG;AAAA,EACvF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,cAAY;AAAA,MACZ,4BAAyB;AAAA,MACzB,SAAS;AAAA,MACT,gBAAe;AAAA,MACf,QAAQ;AAAA,MACR;AAAA,MACA,WAAU;AAAA,MACV,eAAW,cAAG,wCAAwC,SAAS;AAAA,MAC/D,OAAO,EAAE,QAAQ,GAAG,MAAM,MAAM,aAAa,OAAO,UAAU,SAAS;AAAA;AAAA,EACzE;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/htmlFrameEntry.ts","../src/looks/htmlFrame.tsx"],"sourcesContent":["// src/htmlFrameEntry.ts — @ai-matrx/records-ui/html-frame · the seamless, sandboxed, auto-height HTML\n// frame alone (react + cn), for a host that draws written HTML without loading a screen.\nexport {\n HTML_SAMPLE_CSP,\n HTML_SAMPLE_SANDBOX,\n SAMPLE_TOKEN_NAMES,\n HtmlSampleFrame,\n HtmlSampleTokensProvider,\n hostTheme,\n hostTokens,\n sampleDocument,\n sampleHeight,\n sampleStyle,\n tokenValue,\n type HtmlSampleFrameProps,\n type SampleTheme,\n type SampleTokenSet,\n type SampleTokens,\n} from \"./looks/htmlFrame\";\n","\"use client\";\n\n// src/looks/htmlFrame.tsx — @ai-matrx/records-ui · THE SEAMLESS HTML FRAME (light: react + cn only)\n//\n// Shipped alone as `@ai-matrx/records-ui/html-frame`, so a host draws written HTML (the board's\n// Cover hero) without loading a screen. The html_sample look (htmlLook.tsx) draws its samples in it.\n// What the frame allows and why: see htmlLook.tsx's header.\n\nimport { createContext, useContext, useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"@ai-matrx/design-system/cn\";\n/** The sandbox the frame wears. Markup and CSS only: never `allow-scripts` (see the header). */\nexport const HTML_SAMPLE_SANDBOX = \"allow-same-origin\";\n\n/** What a sample may load: inline styles, and images and fonts from data or https. Nothing else. */\nexport const HTML_SAMPLE_CSP =\n \"default-src 'none'; style-src 'unsafe-inline' https://fonts.googleapis.com; img-src data: blob: https:; font-src data: https:; media-src data: https:; script-src 'none'; connect-src 'none'; form-action 'none'\";\n\n/** The token names every sample can use as `var(--name)`. The agent skill names the same list. */\nexport const SAMPLE_TOKEN_NAMES = [\n \"background\",\n \"foreground\",\n \"card\",\n \"card-foreground\",\n \"popover\",\n \"popover-foreground\",\n \"muted\",\n \"muted-foreground\",\n \"primary\",\n \"primary-foreground\",\n \"secondary\",\n \"secondary-foreground\",\n \"accent\",\n \"accent-foreground\",\n \"destructive\",\n \"destructive-foreground\",\n \"success\",\n \"warning\",\n \"border\",\n \"input\",\n \"ring\",\n \"radius\",\n] as const;\n\nexport type SampleTheme = \"light\" | \"dark\";\n/** Token values by name, without the leading dashes: `{ primary: \"#1f4fe0\", radius: \"8px\" }`. */\nexport type SampleTokens = Readonly<Record<string, string>>;\nexport interface SampleTokenSet {\n light?: SampleTokens;\n dark?: SampleTokens;\n /** Web font families the samples name (a board's type styles); loaded from Google Fonts. */\n fonts?: readonly string[];\n}\n\n/** Families that are the system's own and need no loading. */\nconst SYSTEM_FAMILY = /^(system-ui|ui-[a-z-]+|-apple-system|blinkmacsystemfont|serif|sans-serif|monospace|cursive|fantasy|georgia|arial|helvetica|helvetica neue|times|times new roman|courier|courier new|verdana|tahoma|segoe ui|roboto mono|sf pro.*|menlo|monaco|consolas)$/i;\n\n/** The one stylesheet link that loads these families, or \"\" when none needs loading. */\nexport function fontLink(fonts: readonly string[] | undefined): string {\n const families = [...new Set((fonts ?? []).map((f) => f.trim()).filter((f) => /^[A-Za-z0-9 ]{2,40}$/.test(f) && !SYSTEM_FAMILY.test(f)))].slice(0, 8);\n if (families.length === 0) return \"\";\n const q = families.map((f) => `family=${f.replace(/ /g, \"+\")}:ital,wght@0,300..800;1,300..800`).join(\"&\");\n return `<link rel=\"stylesheet\" href=\"https://fonts.googleapis.com/css2?${q}&display=swap\">`;\n}\n\nconst TokensContext = createContext<SampleTokenSet | null>(null);\n\n/** A host's own token values for every sample under it (a board's design-system tables). */\nexport function HtmlSampleTokensProvider({ tokens, children }: { tokens: SampleTokenSet | null; children: ReactNode }) {\n return <TokensContext.Provider value={tokens}>{children}</TokensContext.Provider>;\n}\n\n/** A bare HSL triplet (\"240 5% 96%\", how the app keeps its colors) becomes a color a sample can use. */\nexport function tokenValue(raw: string): string {\n const v = raw.trim();\n return /^-?\\d+(\\.\\d+)?(deg)?\\s+\\d+(\\.\\d+)?%\\s+\\d+(\\.\\d+)?%(\\s*\\/\\s*[\\d.]+%?)?$/.test(v) ? `hsl(${v})` : v;\n}\n\n/** The host page's theme: `dark` when its root wears the `dark` class or `data-theme=\"dark\"`. */\nexport function hostTheme(doc: Document | undefined = typeof document === \"undefined\" ? undefined : document): SampleTheme {\n const root = doc?.documentElement;\n if (!root) return \"light\";\n return root.classList.contains(\"dark\") || root.dataset.theme === \"dark\" ? \"dark\" : \"light\";\n}\n\n/** The host page's own token values, read from where the frame sits (so a themed region counts). */\nexport function hostTokens(at: Element | null): Record<string, string> {\n const out: Record<string, string> = {};\n if (!at || typeof getComputedStyle === \"undefined\") return out;\n const style = getComputedStyle(at);\n for (const name of SAMPLE_TOKEN_NAMES) {\n const raw = style.getPropertyValue(`--${name}`);\n if (raw && raw.trim()) out[name] = tokenValue(raw);\n }\n return out;\n}\n\n/** The `:root` block a sample reads its tokens from, plus the frame's own seamless reset. */\nexport function sampleStyle(tokens: SampleTokens, theme: SampleTheme, font?: string): string {\n const vars = Object.entries(tokens)\n .filter(([name, value]) => /^[a-z][a-z0-9-]*$/.test(name) && !/[;{}<>]/.test(value))\n .map(([name, value]) => `--${name}:${value};`)\n .join(\"\");\n const family = font && !/[;{}<>]/.test(font) ? font : \"system-ui, sans-serif\";\n return (\n `:root{${vars}color-scheme:${theme};}` +\n `html,body{margin:0;padding:0;background:transparent;overflow:hidden;}` +\n `body{color:var(--foreground,${theme === \"dark\" ? \"#e8ebf1\" : \"#111827\"});font-family:${family};font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;}` +\n `*,*::before,*::after{box-sizing:border-box;}` +\n `#matrx-sample{display:flow-root;}`\n );\n}\n\n/** The whole document the frame draws: CSP, tokens, the reset, and the sample inside one measured box. */\nexport function sampleDocument(html: string, tokens: SampleTokens, theme: SampleTheme, font?: string, fonts?: readonly string[]): string {\n return (\n `<!doctype html><html class=\"${theme}\" style=\"color-scheme:${theme}\"><head><meta charset=\"utf-8\">` +\n `<meta http-equiv=\"Content-Security-Policy\" content=\"${HTML_SAMPLE_CSP}\">` +\n fontLink(fonts) +\n `<meta name=\"color-scheme\" content=\"${theme}\">` +\n `<style id=\"matrx-sample-tokens\">${sampleStyle(tokens, theme, font)}</style>` +\n `</head><body><div id=\"matrx-sample\">${html}</div></body></html>`\n );\n}\n\n/** A wheel inside a sample, re-dispatched on the frame element so the page or board around it scrolls. */\nexport function forwardWheel(target: HTMLIFrameElement | null, e: WheelEvent): void {\n if (!target) return;\n const r = target.getBoundingClientRect();\n target.dispatchEvent(\n new WheelEvent(\"wheel\", {\n bubbles: true,\n cancelable: true,\n deltaX: e.deltaX,\n deltaY: e.deltaY,\n deltaZ: e.deltaZ,\n deltaMode: e.deltaMode,\n clientX: r.left + e.clientX,\n clientY: r.top + e.clientY,\n ctrlKey: e.ctrlKey,\n metaKey: e.metaKey,\n shiftKey: e.shiftKey,\n altKey: e.altKey,\n }),\n );\n}\n\n/** The sample's drawn height in px, from its one measured box (margins included: it is a flow root). */\nexport function sampleHeight(doc: Document | null | undefined): number {\n const box = doc?.getElementById(\"matrx-sample\");\n if (!box) return 0;\n return Math.ceil(box.getBoundingClientRect().height || box.scrollHeight || 0);\n}\n\nexport interface HtmlSampleFrameProps {\n html: string;\n /** What a screen reader calls the frame. */\n title?: string;\n className?: string;\n /** Height before the sample has been measured, so the page does not jump when it loads. Default 24. */\n initialHeight?: number;\n}\n\n/**\n * THE SEAMLESS SAMPLE FRAME — markup and CSS only, transparent, borderless, as tall as its content,\n * with the host's tokens and theme. See the file header for what the sandbox allows.\n */\nexport function HtmlSampleFrame({ html, title = \"Sample\", className, initialHeight = 24 }: HtmlSampleFrameProps) {\n const frame = useRef<HTMLIFrameElement | null>(null);\n const given = useContext(TokensContext);\n const [height, setHeight] = useState(initialHeight);\n const [theme, setTheme] = useState<SampleTheme>(() => hostTheme());\n // The document is built once per html; a theme or token change after that is written into the\n // live frame (`paint`), never a reload.\n const fontsKey = (given?.fonts ?? []).join(\"|\");\n const [doc, setDoc] = useState(() => sampleDocument(html, given?.[theme] ?? {}, theme, undefined, given?.fonts));\n const built = useRef(`${html}\\u0000${fontsKey}`);\n\n const tokensFor = (t: SampleTheme): Record<string, string> => ({ ...hostTokens(frame.current), ...(given?.[t] ?? {}) });\n const fontOf = () => (frame.current && typeof getComputedStyle !== \"undefined\" ? getComputedStyle(frame.current).fontFamily : undefined);\n\n // A new html: a new document, opened in today's theme with today's tokens.\n // New fonts to load also rebuild (a stylesheet link is part of the document head).\n useEffect(() => {\n const key = `${html}\\u0000${fontsKey}`;\n if (built.current === key) return;\n built.current = key;\n setDoc(sampleDocument(html, tokensFor(theme), theme, fontOf(), given?.fonts));\n // eslint-disable-next-line react-hooks/exhaustive-deps -- the theme and tokens are written live below\n }, [html, fontsKey]);\n\n // The host's theme, followed as it changes.\n useEffect(() => {\n if (typeof MutationObserver === \"undefined\" || typeof document === \"undefined\") return;\n const watch = new MutationObserver(() => setTheme(hostTheme()));\n watch.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\", \"data-theme\"] });\n return () => watch.disconnect();\n }, []);\n\n const measure = () => {\n const h = sampleHeight(frame.current?.contentDocument);\n if (h > 0) setHeight(h);\n };\n\n // Write the theme and tokens into the live document (same origin, no script inside it).\n const paint = () => {\n const inner = frame.current?.contentDocument;\n if (!inner?.documentElement) return;\n const style = inner.getElementById(\"matrx-sample-tokens\");\n if (style) style.textContent = sampleStyle(tokensFor(theme), theme, fontOf());\n inner.documentElement.className = theme;\n inner.documentElement.style.colorScheme = theme;\n measure();\n };\n\n useEffect(paint, [theme, given]); // eslint-disable-line react-hooks/exhaustive-deps\n\n // The width the frame is given changes the sample's height (text wraps): measure again.\n useEffect(() => {\n const el = frame.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver(() => measure());\n ro.observe(el);\n return () => ro.disconnect();\n }, []); // eslint-disable-line react-hooks/exhaustive-deps\n\n const onLoad = () => {\n paint();\n const inner = frame.current?.contentDocument;\n if (!inner) return;\n // Late images and fonts change the height after load.\n inner.addEventListener(\"load\", measure, true);\n void inner.fonts?.ready.then(measure).catch(() => undefined);\n const box = inner.getElementById(\"matrx-sample\");\n const View = inner.defaultView as (Window & { ResizeObserver?: typeof ResizeObserver }) | null;\n if (box && View?.ResizeObserver) new View.ResizeObserver(() => measure()).observe(box);\n // The sample never scrolls (it is as tall as its content), so a wheel over it belongs to the page or\n // board around it: hand it on to the frame element, where the host's own wheel handling sees it.\n inner.addEventListener(\"wheel\", (e) => forwardWheel(frame.current, e), { passive: true });\n };\n\n return (\n <iframe\n ref={frame}\n title={title}\n aria-label={title}\n data-records-html-sample=\"\"\n sandbox={HTML_SAMPLE_SANDBOX}\n referrerPolicy=\"no-referrer\"\n srcDoc={doc}\n onLoad={onLoad}\n scrolling=\"no\"\n className={cn(\"block w-full border-0 bg-transparent\", className)}\n style={{ height: `${height}px`, colorScheme: theme, overflow: \"hidden\" }}\n />\n );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AS,IAAI;AAC5C,SAAK,MAAM,OAAO,MAAM,KAAK,OAAO,EAAE,MAAM,MAAM,MAAS;AAC3D,UAAM,MAAM,MAAM,eAAe,cAAc;AAC/C,UAAM,OAAO,MAAM;AACnB,QAAI,OAAO,MAAM,eAAgB,KAAI,KAAK,eAAe,MAAM,QAAQ,CAAC,EAAE,QAAQ,GAAG;AAGrF,UAAM,iBAAiB,SAAS,CAAC,MAAM,aAAa,MAAM,SAAS,CAAC,GAAG,EAAE,SAAS,KAAK,CAAC;AAAA,EAC1F;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL;AAAA,MACA,cAAY;AAAA,MACZ,4BAAyB;AAAA,MACzB,SAAS;AAAA,MACT,gBAAe;AAAA,MACf,QAAQ;AAAA,MACR;AAAA,MACA,WAAU;AAAA,MACV,eAAW,cAAG,wCAAwC,SAAS;AAAA,MAC/D,OAAO,EAAE,QAAQ,GAAG,MAAM,MAAM,aAAa,OAAO,UAAU,SAAS;AAAA;AAAA,EACzE;AAEJ;","names":[]}
|
package/dist/html-frame.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -7241,10 +7241,22 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
7241
7241
|
) }, board.dashboard_id)) })
|
|
7242
7242
|
] }) : null,
|
|
7243
7243
|
!makingOnly && tables.data && !sectionsKnown ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-xs text-muted-foreground", children: SECTIONS_UNKNOWN }) : null,
|
|
7244
|
-
!makingOnly && tables.data && keptCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7244
|
+
!makingOnly && tables.data && keptCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { "data-tables-show-everything": showEverything ? "on" : "off", className: "flex items-center text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
7245
|
+
import_design_system41.Button,
|
|
7246
|
+
{
|
|
7247
|
+
size: "sm",
|
|
7248
|
+
variant: "ghost",
|
|
7249
|
+
className: "h-6 px-2 text-xs",
|
|
7250
|
+
"aria-pressed": showEverything,
|
|
7251
|
+
onClick: () => setShowEverything((on) => !on),
|
|
7252
|
+
children: [
|
|
7253
|
+
showEverything ? "\u2713 " : "",
|
|
7254
|
+
"Include system tables (",
|
|
7255
|
+
keptCount,
|
|
7256
|
+
")"
|
|
7257
|
+
]
|
|
7258
|
+
}
|
|
7259
|
+
) }) : null,
|
|
7248
7260
|
!makingOnly && tables.data ? TABLE_LANES.filter((lane) => lane !== "app" || showEverything).map((lane) => {
|
|
7249
7261
|
const rows = listed.filter(
|
|
7250
7262
|
(t) => lane === "mine" ? laneFor(t) === "mine" || isMine(t) : laneFor(t) === lane
|
|
@@ -9879,6 +9891,26 @@ function sampleStyle(tokens, theme, font) {
|
|
|
9879
9891
|
function sampleDocument(html, tokens, theme, font, fonts) {
|
|
9880
9892
|
return `<!doctype html><html class="${theme}" style="color-scheme:${theme}"><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="${HTML_SAMPLE_CSP}">` + fontLink(fonts) + `<meta name="color-scheme" content="${theme}"><style id="matrx-sample-tokens">${sampleStyle(tokens, theme, font)}</style></head><body><div id="matrx-sample">${html}</div></body></html>`;
|
|
9881
9893
|
}
|
|
9894
|
+
function forwardWheel(target, e) {
|
|
9895
|
+
if (!target) return;
|
|
9896
|
+
const r = target.getBoundingClientRect();
|
|
9897
|
+
target.dispatchEvent(
|
|
9898
|
+
new WheelEvent("wheel", {
|
|
9899
|
+
bubbles: true,
|
|
9900
|
+
cancelable: true,
|
|
9901
|
+
deltaX: e.deltaX,
|
|
9902
|
+
deltaY: e.deltaY,
|
|
9903
|
+
deltaZ: e.deltaZ,
|
|
9904
|
+
deltaMode: e.deltaMode,
|
|
9905
|
+
clientX: r.left + e.clientX,
|
|
9906
|
+
clientY: r.top + e.clientY,
|
|
9907
|
+
ctrlKey: e.ctrlKey,
|
|
9908
|
+
metaKey: e.metaKey,
|
|
9909
|
+
shiftKey: e.shiftKey,
|
|
9910
|
+
altKey: e.altKey
|
|
9911
|
+
})
|
|
9912
|
+
);
|
|
9913
|
+
}
|
|
9882
9914
|
function sampleHeight(doc) {
|
|
9883
9915
|
const box = doc?.getElementById("matrx-sample");
|
|
9884
9916
|
if (!box) return 0;
|
|
@@ -9936,6 +9968,7 @@ function HtmlSampleFrame({ html, title = "Sample", className, initialHeight = 24
|
|
|
9936
9968
|
const box = inner2.getElementById("matrx-sample");
|
|
9937
9969
|
const View = inner2.defaultView;
|
|
9938
9970
|
if (box && View?.ResizeObserver) new View.ResizeObserver(() => measure()).observe(box);
|
|
9971
|
+
inner2.addEventListener("wheel", (e) => forwardWheel(frame.current, e), { passive: true });
|
|
9939
9972
|
};
|
|
9940
9973
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
9941
9974
|
"iframe",
|
|
@@ -14077,7 +14110,7 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
|
|
|
14077
14110
|
"data-records-open-record": row.id,
|
|
14078
14111
|
"aria-label": openRecordLabel(nameOf3(row)),
|
|
14079
14112
|
title: `${openRecordLabel(nameOf3(row))} (Space) \xB7 \u2318-click: new tab`,
|
|
14080
|
-
className: "absolute right-0 top-1/2 z-10 inline-flex h-6 -translate-y-1/2 items-center gap-1 rounded border border-border bg-card px-1.5 text-xs font-medium leading-none text-foreground no-underline opacity-0 shadow-sm hover:bg-muted focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/matrx-row:opacity-100 [@media(hover:none)]:opacity-100",
|
|
14113
|
+
className: "absolute right-0 top-1/2 z-10 inline-flex h-6 -translate-y-1/2 items-center gap-1 rounded border border-border bg-card px-1.5 text-xs font-medium leading-none text-foreground no-underline opacity-0 shadow-sm hover:bg-muted focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/matrx-row:opacity-100 [@media(hover:none)]:static [@media(hover:none)]:-my-2.5 [@media(hover:none)]:h-11 [@media(hover:none)]:w-11 [@media(hover:none)]:shrink-0 [@media(hover:none)]:translate-y-0 [@media(hover:none)]:justify-center [@media(hover:none)]:border-0 [@media(hover:none)]:bg-transparent [@media(hover:none)]:px-0 [@media(hover:none)]:text-muted-foreground [@media(hover:none)]:opacity-100 [@media(hover:none)]:shadow-none",
|
|
14081
14114
|
onClick: (event) => {
|
|
14082
14115
|
event.stopPropagation();
|
|
14083
14116
|
openFrom(row, event);
|
|
@@ -14085,7 +14118,7 @@ function withOpenRecord(columns, onOpen, nameOf3, place = "end", hrefOf, openOnl
|
|
|
14085
14118
|
onDoubleClick: (event) => event.stopPropagation(),
|
|
14086
14119
|
children: [
|
|
14087
14120
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { "aria-hidden": "true", viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { d: "M9.5 2.5h4v4M13.5 2.5 8.5 7.5M6.5 3.5h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-3" }) }),
|
|
14088
|
-
"Open"
|
|
14121
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "[@media(hover:none)]:sr-only", children: "Open" })
|
|
14089
14122
|
]
|
|
14090
14123
|
}
|
|
14091
14124
|
);
|
|
@@ -29626,7 +29659,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
29626
29659
|
] })
|
|
29627
29660
|
] }),
|
|
29628
29661
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
29629
|
-
row.runs === 0 ? "It has not run yet
|
|
29662
|
+
row.runs === 0 ? "It has not run yet." : `${row.runs} run${row.runs === 1 ? "" : "s"}` + (costInPoints(Number(row.cost_cents), host.pointsRate) !== null ? ` \xB7 ${costInPoints(Number(row.cost_cents), host.pointsRate)} so far` : "") + (row.cost_per_row_cents !== null && costInPoints(Number(row.cost_per_row_cents), host.pointsRate) !== null ? ` \xB7 ${costInPoints(Number(row.cost_per_row_cents), host.pointsRate)} a row` : "") + (row.last_run_at ? ` \xB7 last ran ${ago(row.last_run_at)}` : ""),
|
|
29630
29663
|
row.enrichment?.model ? ` \xB7 ${row.enrichment.model}` : ""
|
|
29631
29664
|
] }),
|
|
29632
29665
|
rights.admin ? /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
|
|
@@ -29707,10 +29740,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
29707
29740
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "truncate text-muted-foreground", children: preview?.find((p) => p.record_id === w.record_id)?.title ?? w.record_id.slice(0, 8) }),
|
|
29708
29741
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-0 truncate text-right", children: w.absent ? w.absent === "conflicting" ? "Sources disagree" : "Nothing found" : String(w.value ?? "") })
|
|
29709
29742
|
] }, w.record_id)) }) : null,
|
|
29710
|
-
outcome && (outcome.fieldId === void 0 || outcome.fieldId === row.field_id) ? outcome.ok ? /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
29711
|
-
outcome.message,
|
|
29712
|
-
costInPoints(outcome.costCents, host.pointsRate) !== null ? ` \xB7 ${costInPoints(outcome.costCents, host.pointsRate)}` : ""
|
|
29713
|
-
] }) : (
|
|
29743
|
+
outcome && (outcome.fieldId === void 0 || outcome.fieldId === row.field_id) ? outcome.ok ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "enrich-outcome", children: outcome.message }) : (
|
|
29714
29744
|
// A run that did not happen is a refusal, with a heading and a remedy,
|
|
29715
29745
|
// never the host's words in red (lane REFUSAL-SWEEP).
|
|
29716
29746
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
@@ -41425,7 +41455,7 @@ function useRowColorBy(all, colorKey, style) {
|
|
|
41425
41455
|
// src/workedOutDate.ts
|
|
41426
41456
|
var import_records55 = require("@ai-matrx/records");
|
|
41427
41457
|
var WORKED_OUT_DATE_LOCK = "Worked out \xB7 can't move";
|
|
41428
|
-
var
|
|
41458
|
+
var FORMULA_TYPING_ROUNDS = 9;
|
|
41429
41459
|
var configOf = (field2) => field2?.config ?? {};
|
|
41430
41460
|
function isStoredDate(field2) {
|
|
41431
41461
|
if (!field2 || field2.type !== "range") return false;
|
|
@@ -41439,27 +41469,36 @@ function ownExpression(field2) {
|
|
|
41439
41469
|
const expr = config["expr"];
|
|
41440
41470
|
return !("via" in config) && expr && typeof expr === "object" && !Array.isArray(expr) ? expr : null;
|
|
41441
41471
|
}
|
|
41442
|
-
function
|
|
41443
|
-
if (
|
|
41444
|
-
|
|
41445
|
-
if ("
|
|
41446
|
-
|
|
41447
|
-
|
|
41448
|
-
|
|
41449
|
-
|
|
41450
|
-
|
|
41451
|
-
|
|
41472
|
+
function typedAs(field2, kind2) {
|
|
41473
|
+
if (kind2 === "date") return { ...field2, type: "range", config: { kind: "date", _typed: true } };
|
|
41474
|
+
if (kind2 === "number") return { ...field2, type: "range", config: { _typed: true } };
|
|
41475
|
+
if (kind2 === "text") return { ...field2, type: "text" };
|
|
41476
|
+
if (kind2 === "boolean") return { ...field2, type: "boolean" };
|
|
41477
|
+
return field2;
|
|
41478
|
+
}
|
|
41479
|
+
var typedRounds = /* @__PURE__ */ new WeakMap();
|
|
41480
|
+
function typedFormulaFields(all, rounds = FORMULA_TYPING_ROUNDS) {
|
|
41481
|
+
let byRounds = typedRounds.get(all);
|
|
41482
|
+
const hit = byRounds?.get(rounds);
|
|
41483
|
+
if (hit) return hit;
|
|
41484
|
+
let cur = all;
|
|
41485
|
+
for (let i = 0; i < rounds; i++) {
|
|
41486
|
+
const prev = cur;
|
|
41487
|
+
cur = all.map((f) => {
|
|
41488
|
+
const expr = ownExpression(f);
|
|
41489
|
+
return expr ? typedAs(f, formulaResultKind(expr, prev)) : f;
|
|
41490
|
+
});
|
|
41452
41491
|
}
|
|
41453
|
-
if (
|
|
41454
|
-
|
|
41455
|
-
|
|
41456
|
-
const r = inlineFormulas(a, all, seen);
|
|
41457
|
-
if (r === null) return null;
|
|
41458
|
-
args.push(r);
|
|
41459
|
-
}
|
|
41460
|
-
return { ...n, args };
|
|
41492
|
+
if (!byRounds) {
|
|
41493
|
+
byRounds = /* @__PURE__ */ new Map();
|
|
41494
|
+
typedRounds.set(all, byRounds);
|
|
41461
41495
|
}
|
|
41462
|
-
|
|
41496
|
+
byRounds.set(rounds, cur);
|
|
41497
|
+
return cur;
|
|
41498
|
+
}
|
|
41499
|
+
function formulaTypeOf(targetId, all, rounds = FORMULA_TYPING_ROUNDS) {
|
|
41500
|
+
const expr = ownExpression(all.find((f) => f.id === targetId));
|
|
41501
|
+
return expr ? formulaResultKind(expr, typedFormulaFields(all, rounds)) : "unknown";
|
|
41463
41502
|
}
|
|
41464
41503
|
function formulaResultKind(node, all) {
|
|
41465
41504
|
if (!node || typeof node !== "object" || Array.isArray(node)) return "unknown";
|
|
@@ -41498,10 +41537,7 @@ function formulaResultKind(node, all) {
|
|
|
41498
41537
|
return import_records55.FORMULA_NODE_RESULTS[op2] ?? "unknown";
|
|
41499
41538
|
}
|
|
41500
41539
|
function isDateFormula(field2, all) {
|
|
41501
|
-
|
|
41502
|
-
if (!expr || !field2) return false;
|
|
41503
|
-
const inlined = inlineFormulas(expr, all, [field2.id]);
|
|
41504
|
-
return inlined !== null && formulaResultKind(inlined, all) === "date";
|
|
41540
|
+
return !!field2 && formulaTypeOf(field2.id, all) === "date";
|
|
41505
41541
|
}
|
|
41506
41542
|
function isComputedField(field2) {
|
|
41507
41543
|
return field2?.type === "formula";
|
|
@@ -56363,7 +56399,6 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
56363
56399
|
|
|
56364
56400
|
// src/TableAsk.tsx
|
|
56365
56401
|
var import_react315 = require("react");
|
|
56366
|
-
var import_format14 = require("@ai-matrx/kit/format");
|
|
56367
56402
|
var import_design_system157 = require("@ai-matrx/design-system");
|
|
56368
56403
|
var import_records68 = require("@ai-matrx/records");
|
|
56369
56404
|
var import_react316 = require("@ai-matrx/records/react");
|
|
@@ -56604,7 +56639,7 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
|
|
|
56604
56639
|
setSaid({ kind: "asking", reads: words2.trim() });
|
|
56605
56640
|
const got = await askTable({ tableId, question: words2.trim(), viewId: viewId ?? "" });
|
|
56606
56641
|
setSaid(
|
|
56607
|
-
got.ok ? { kind: "agent-answer", answer: got.answer
|
|
56642
|
+
got.ok ? { kind: "agent-answer", answer: got.answer } : { kind: "agent-failed", error: (0, refusals_exports.refusal)("door", got.message, got.hint ?? null) }
|
|
56608
56643
|
);
|
|
56609
56644
|
return;
|
|
56610
56645
|
}
|
|
@@ -56657,7 +56692,7 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
|
|
|
56657
56692
|
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_design_system157.Skeleton, { className: "h-24 w-full", "data-table-ask-pending": "" })
|
|
56658
56693
|
] }) : null,
|
|
56659
56694
|
said2.kind === "agent-failed" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("div", { "data-table-ask-failed": "", children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(RefusalNotice, { error: said2.error }) }) : null,
|
|
56660
|
-
said2.kind === "agent-answer" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(AgentAnswer, { tableId, answer: said2.answer, fields: all
|
|
56695
|
+
said2.kind === "agent-answer" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(AgentAnswer, { tableId, answer: said2.answer, fields: all }) : null,
|
|
56661
56696
|
said2.kind === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(RefusalNotice, { error: said2.error }) : null,
|
|
56662
56697
|
said2.kind === "answer" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(import_jsx_runtime180.Fragment, { children: [
|
|
56663
56698
|
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)("p", { className: "truncate text-muted-foreground", title: said2.reads, "data-table-ask-reads": "", children: said2.reads }),
|
|
@@ -56706,8 +56741,7 @@ function useNames(tableId, ids) {
|
|
|
56706
56741
|
function AgentAnswer({
|
|
56707
56742
|
tableId,
|
|
56708
56743
|
answer,
|
|
56709
|
-
fields
|
|
56710
|
-
costPoints = null
|
|
56744
|
+
fields
|
|
56711
56745
|
}) {
|
|
56712
56746
|
const client = (0, import_react316.useRecordsClient)();
|
|
56713
56747
|
const ui = useRecordsUi();
|
|
@@ -56773,7 +56807,6 @@ function AgentAnswer({
|
|
|
56773
56807
|
] }, `${c.record_id}:${c.field_key}:${i}`)) }) : null,
|
|
56774
56808
|
open.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_design_system157.Button, { size: "sm", className: "w-fit self-end", disabled: busy, onClick: () => void apply(open), "data-table-ask-apply-all": "", children: "Apply all" }) : null,
|
|
56775
56809
|
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(RefusalNotice, { error: refusal3 }) : null,
|
|
56776
|
-
costPoints !== null ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("p", { className: "text-muted-foreground", "data-table-ask-cost": "", children: (0, import_format14.formatPoints)(costPoints) }) : null,
|
|
56777
56810
|
answer.could_not.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("ul", { className: "text-muted-foreground", "data-table-ask-could-not": "", children: answer.could_not.map((w) => /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("li", { children: w }, w)) }) : null
|
|
56778
56811
|
] });
|
|
56779
56812
|
}
|
|
@@ -56791,7 +56824,7 @@ var import_react317 = require("react");
|
|
|
56791
56824
|
var import_react318 = require("@ai-matrx/records/react");
|
|
56792
56825
|
var import_core25 = require("@ai-matrx/records/core");
|
|
56793
56826
|
var import_download3 = require("@ai-matrx/kit/download");
|
|
56794
|
-
var
|
|
56827
|
+
var import_format14 = require("@ai-matrx/kit/format");
|
|
56795
56828
|
var import_design_system158 = require("@ai-matrx/design-system");
|
|
56796
56829
|
init_parity();
|
|
56797
56830
|
var import_forms4 = require("@ai-matrx/records/forms");
|
|
@@ -57295,7 +57328,7 @@ function NumberBlockView({ block, viewerUserId, extra }) {
|
|
|
57295
57328
|
const read = useElementRows(block, viewerUserId, extra, false);
|
|
57296
57329
|
if (read.error) return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(RefusalLine, { error: read.error });
|
|
57297
57330
|
if (read.waiting || read.total === null) return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_design_system158.Skeleton, { className: "h-12 w-24" });
|
|
57298
|
-
return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-3xl font-semibold tabular-nums", "data-records-page-number": block.id, children: (0,
|
|
57331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-3xl font-semibold tabular-nums", "data-records-page-number": block.id, children: (0, import_format14.formatCount)(read.total) });
|
|
57299
57332
|
}
|
|
57300
57333
|
function LayoutBlockView({ block, viewerUserId, extra }) {
|
|
57301
57334
|
const door = useInterfaceDoor();
|
|
@@ -60085,7 +60118,7 @@ function TableReferenceDialog({
|
|
|
60085
60118
|
}
|
|
60086
60119
|
|
|
60087
60120
|
// src/TableDuplicate.tsx
|
|
60088
|
-
var
|
|
60121
|
+
var import_format15 = require("@ai-matrx/kit/format");
|
|
60089
60122
|
var import_react340 = require("react");
|
|
60090
60123
|
var import_react341 = require("@ai-matrx/records/react");
|
|
60091
60124
|
var import_design_system171 = require("@ai-matrx/design-system");
|
|
@@ -60096,7 +60129,7 @@ function copyNameFor(name) {
|
|
|
60096
60129
|
return `${name.trim() || "Table"} (copy)`;
|
|
60097
60130
|
}
|
|
60098
60131
|
function duplicateProgressWords(p) {
|
|
60099
|
-
if (p.records && p.records.total > 0) return `Copying records \xB7 ${(0,
|
|
60132
|
+
if (p.records && p.records.total > 0) return `Copying records \xB7 ${(0, import_format15.formatCount)(p.records.done)} of ${(0, import_format15.formatCount)(p.records.total)}`;
|
|
60100
60133
|
if (p.views.total > 0 && p.step === "views") return `Copying views \xB7 ${p.views.done} of ${p.views.total}`;
|
|
60101
60134
|
return "Copying columns\u2026";
|
|
60102
60135
|
}
|
|
@@ -60153,7 +60186,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
|
|
|
60153
60186
|
" columns, ",
|
|
60154
60187
|
phase.copy.copied.views,
|
|
60155
60188
|
" views",
|
|
60156
|
-
phase.copy.copied.withRecords ? `, ${(0,
|
|
60189
|
+
phase.copy.copied.withRecords ? `, ${(0, import_format15.formatCount)(phase.copy.copied.records)} records` : "",
|
|
60157
60190
|
"."
|
|
60158
60191
|
] }),
|
|
60159
60192
|
phase.copy.notCopied.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
@@ -62283,7 +62316,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
62283
62316
|
}
|
|
62284
62317
|
|
|
62285
62318
|
// src/entityViews.tsx
|
|
62286
|
-
var
|
|
62319
|
+
var import_format16 = require("@ai-matrx/kit/format");
|
|
62287
62320
|
var import_design_system175 = require("@ai-matrx/design-system");
|
|
62288
62321
|
var import_data_table26 = require("@ai-matrx/design-system/data-table");
|
|
62289
62322
|
var import_react348 = require("react");
|
|
@@ -62478,7 +62511,7 @@ function EntityTablePageBody({
|
|
|
62478
62511
|
return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: (0, import_design_system176.cn)("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
|
|
62479
62512
|
presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
62480
62513
|
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
|
|
62481
|
-
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : (0,
|
|
62514
|
+
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : (0, import_format16.formatCount)(entity.total) }) : null,
|
|
62482
62515
|
/* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
62483
62516
|
boardable ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_jsx_runtime199.Fragment, { children: [
|
|
62484
62517
|
/* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system176.Button, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
|