@opengrid-ui/plugin-charts 0.1.25 → 0.1.37

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.
@@ -25,6 +25,7 @@ export declare function chartRange(options: {
25
25
  columns: readonly string[];
26
26
  read(range: RangeBounds): Promise<readonly (readonly CellValue[])[]>;
27
27
  categoryColumn?: number;
28
+ rowIndices?: readonly number[];
28
29
  }): Promise<ChartRange>;
29
30
  export declare function attachChart(container: HTMLElement, adapter: ChartAdapter, data: ChartRange): () => void;
30
31
  export declare function chartMenuItem(options: ChartMenuOptions): SheetMenuItem;
@@ -4,6 +4,7 @@ export interface DataBarRule {
4
4
  min: number;
5
5
  max: number;
6
6
  color: string;
7
+ negativeColor?: string;
7
8
  }
8
9
  export interface ColorScaleRule {
9
10
  kind: 'scale';
@@ -20,7 +21,7 @@ export interface HighlightRule {
20
21
  color?: string;
21
22
  }
22
23
  export type ConditionalRule = DataBarRule | ColorScaleRule | HighlightRule;
23
- export declare function conditionalStyle(value: number, rule: ConditionalRule): {
24
+ export declare function conditionalStyle(value: number | null | undefined, rule: ConditionalRule): {
24
25
  background?: string;
25
26
  color?: string;
26
27
  };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import c from"react";function C(e){let n=1/0,t=-1/0;for(let i of e)i===null||!Number.isFinite(i)||(n=Math.min(n,i),t=Math.max(t,i));return Number.isFinite(n)?{min:n,max:t}:null}function b(e,n,t,i){let r=C(e);if(!r)return{line:"",area:"",bars:[]};let a=i==="line"?r.min:Math.min(0,r.min),o=i==="line"?r.max:Math.max(0,r.max),l=s=>o===a?t/2:t-2-(s-a)/(o-a)*(t-4),m=l(Math.max(a,Math.min(o,0))),g=n/e.length,f=[],y=[],u=[];function x(){let s=u[0],d=u[u.length-1];if(!s||!d)return;let p=u.map(({x:h,y:k})=>`${h},${k}`).join(" L");f.push("M"+p),y.push(`M${p} L${d.x},${m} L${s.x},${m} Z`),u=[]}let R=e.flatMap((s,d)=>{if(s===null||!Number.isFinite(s))return x(),[];let p=2+(n-4)*(e.length===1?.5:d/(e.length-1)),h=l(s);return u.push({x:p,y:h}),[{x:g*d+g*.15,y:Math.min(h,m),width:g*.7,height:Math.max(1,Math.abs(h-m)),negative:s<0}]});return x(),{line:f.join(" "),area:y.join(" "),bars:R}}function S({values:e,kind:n="line",label:t,width:i=104,height:r=28,color:a="var(--og-primary, #305fd2)",negativeColor:o="#bb4556"}){let l=b(e,i,r,n);return c.createElement("svg",{viewBox:`0 0 ${i} ${r}`,width:i,height:r,role:"img","aria-label":t},n==="bar"?l.bars.map((m,g)=>c.createElement("rect",{key:g,x:m.x,y:m.y,width:m.width,height:m.height,fill:m.negative?o:a})):c.createElement(c.Fragment,null,n==="area"&&c.createElement("path",{d:l.area,fill:a,opacity:.16}),c.createElement("path",{d:l.line,fill:"none",stroke:a,strokeWidth:1.8,strokeLinejoin:"round"})))}function $(e,n){if(!Number.isFinite(e))return{};if(n.kind==="highlight")return n.when(e)?{background:n.background,...n.color&&{color:n.color}}:{};let t=n.max===n.min?.5:Math.max(0,Math.min(1,(e-n.min)/(n.max-n.min)));if(n.kind==="bar")return{background:`linear-gradient(to right, ${n.color} ${t*100}%, transparent ${t*100}%)`};let i=n.mid&&t>=.5?n.mid:n.low,r=n.mid&&t<.5?n.mid:n.high,a=n.mid?t<.5?t*2:(t-.5)*2:t;return{background:`rgb(${i.map((o,l)=>Math.round(o+(r[l]-o)*a)).join(", ")})`}}async function M(e){let n=await e.read(e.range),t=n.map((r,a)=>{let o=e.categoryColumn===void 0?e.range.top+a+1:r[e.categoryColumn];return String(o??"")}),i=e.columns.flatMap((r,a)=>a===e.categoryColumn?[]:[{name:r,values:n.map(o=>typeof o[a]=="number"&&Number.isFinite(o[a])?o[a]:null)}]);return{label:e.label,categories:t,series:i}}function B(e,n,t){return n.mount(e,t)}function v(e){return{id:e.id??"chart-selection",label:e.label,async action(n,t,i){let r=await i?.readSelection();if(!r)return;let a=e.categoryColumn===void 0?-1:r.columnIds.indexOf(e.categoryColumn),o=await M({label:e.chartLabel??e.label,range:r.range,columns:r.columnIds.map(l=>e.columns?.[l]??l),read:async()=>r.values,...a>=0&&{categoryColumn:a}});await e.onChart({...o,series:o.series.filter(l=>l.values.some(m=>m!==null))})}}}export{S as Sparkline,B as attachChart,v as chartMenuItem,M as chartRange,$ as conditionalStyle,C as numericExtent,b as sparklineGeometry};
1
+ import d from"react";function R(e){let n=1/0,r=-1/0;for(let i of e)i===null||!Number.isFinite(i)||(n=Math.min(n,i),r=Math.max(r,i));return Number.isFinite(n)?{min:n,max:r}:null}function f(e,n,r,i){let t=R(e);if(!t)return{line:"",area:"",bars:[]};let a=i==="line"?t.min:Math.min(0,t.min),o=i==="line"?t.max:Math.max(0,t.max),l=s=>o===a?r/2:r-2-(s-a)/(o-a)*(r-4),m=l(Math.max(a,Math.min(o,0))),h=n/e.length,x=[],C=[],c=[];function M(){let s=c[0],u=c[c.length-1];if(!s||!u)return;let g=c.map(({x:p,y:b})=>`${p},${b}`).join(" L");x.push(s===u?`M${g} L${g}`:`M${g}`),C.push(`M${g} L${u.x},${m} L${s.x},${m} Z`),c=[]}let $=e.flatMap((s,u)=>{if(s===null||!Number.isFinite(s))return M(),[];let g=2+(n-4)*(e.length===1?.5:u/(e.length-1)),p=l(s);c.push({x:g,y:p});let b=s===0?0:Math.max(1,Math.abs(p-m));return[{x:h*u+h*.15,y:Math.min(p,m),width:h*.7,height:b,negative:s<0}]});return M(),{line:x.join(" "),area:C.join(" "),bars:$}}function S({values:e,kind:n="line",label:r,width:i=104,height:t=28,color:a="var(--og-primary, #305fd2)",negativeColor:o="#bb4556"}){let l=f(e,i,t,n);return d.createElement("svg",{viewBox:`0 0 ${i} ${t}`,width:i,height:t,role:"img","aria-label":r},n==="bar"?l.bars.map((m,h)=>d.createElement("rect",{key:h,x:m.x,y:m.y,width:m.width,height:m.height,fill:m.negative?o:a})):d.createElement(d.Fragment,null,n==="area"&&d.createElement("path",{d:l.area,fill:a,opacity:.16}),d.createElement("path",{d:l.line,fill:"none",stroke:a,strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round"})))}function y(e,n,r){return r===n?.5:Math.max(0,Math.min(1,(e-n)/(r-n)))}function w(e,n){let r=Math.max(0,n.max),i=n.min<0?y(0,n.min,r):0,t=y(e,n.min,r);if(e===0||t===i)return{};let a=Math.min(t,i)*100,o=Math.max(t,i)*100,l=e<0?n.negativeColor??n.color:n.color;return{background:`linear-gradient(to right, transparent ${a}%, ${l} ${a}%, ${l} ${o}%, transparent ${o}%)`}}function B(e,n){if(typeof e!="number"||!Number.isFinite(e))return{};if(n.kind==="highlight")return n.when(e)?{background:n.background,...n.color&&{color:n.color}}:{};if(n.kind==="bar")return w(e,n);let r=y(e,n.min,n.max),i=n.mid&&r>=.5?n.mid:n.low,t=n.mid&&r<.5?n.mid:n.high,a=n.mid?r<.5?r*2:(r-.5)*2:r;return{background:`rgb(${i.map((o,l)=>Math.round(o+(t[l]-o)*a)).join(", ")})`}}async function k(e){let n=await e.read(e.range),r=n.map((t,a)=>{let o=e.categoryColumn===void 0?(e.rowIndices?.[a]??e.range.top+a)+1:t[e.categoryColumn];return String(o??"")}),i=e.columns.flatMap((t,a)=>a===e.categoryColumn?[]:[{name:t,values:n.map(o=>typeof o[a]=="number"&&Number.isFinite(o[a])?o[a]:null)}]);return{label:e.label,categories:r,series:i}}function I(e,n,r){return n.mount(e,r)}function L(e){return{id:e.id??"chart-selection",label:e.label,async action(n,r,i){let t=await i?.readSelection();if(!t)return;let a=e.categoryColumn===void 0?-1:t.columnIds.indexOf(e.categoryColumn),o=await k({label:e.chartLabel??e.label,range:t.range,columns:t.columnIds.map(l=>e.columns?.[l]??l),read:async()=>t.values,...t.rowIndices&&{rowIndices:t.rowIndices},...a>=0&&{categoryColumn:a}});await e.onChart({...o,series:o.series.filter(l=>l.values.some(m=>m!==null))})}}}export{S as Sparkline,I as attachChart,L as chartMenuItem,k as chartRange,B as conditionalStyle,R as numericExtent,f as sparklineGeometry};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/react/sparkline.tsx", "../src/engine/series.ts", "../src/engine/conditional.ts", "../src/engine/bridge.ts"],
4
- "sourcesContent": ["import React from 'react';\nimport { sparklineGeometry } from '../engine/series';\nimport type { SparklineKind } from '../engine/series';\n\nexport function Sparkline({ values, kind = 'line', label, width = 104, height = 28, color = 'var(--og-primary, #305fd2)', negativeColor = '#bb4556' }: {\n values: readonly (number | null)[];\n kind?: SparklineKind;\n label: string;\n width?: number;\n height?: number;\n color?: string;\n negativeColor?: string;\n}) {\n const geometry = sparklineGeometry(values, width, height, kind);\n return <svg viewBox={`0 0 ${width} ${height}`} width={width} height={height} role=\"img\" aria-label={label}>\n {kind === 'bar' ? geometry.bars.map((bar, index) => <rect key={index} x={bar.x} y={bar.y} width={bar.width} height={bar.height}\n fill={bar.negative ? negativeColor : color} />) : <>\n {kind === 'area' && <path d={geometry.area} fill={color} opacity={0.16} />}\n <path d={geometry.line} fill=\"none\" stroke={color} strokeWidth={1.8} strokeLinejoin=\"round\" />\n </>}\n </svg>;\n}\n", "export type SparklineKind = 'line' | 'bar' | 'area';\n\nexport function numericExtent(values: readonly (number | null)[]) {\n let min = Infinity;\n let max = -Infinity;\n for (const value of values) {\n if (value === null || !Number.isFinite(value)) continue;\n min = Math.min(min, value);\n max = Math.max(max, value);\n }\n return Number.isFinite(min) ? { min, max } : null;\n}\n\nexport function sparklineGeometry(values: readonly (number | null)[], width: number, height: number, kind: SparklineKind) {\n const extent = numericExtent(values);\n if (!extent) return { line: '', area: '', bars: [] };\n const min = kind === 'line' ? extent.min : Math.min(0, extent.min);\n const max = kind === 'line' ? extent.max : Math.max(0, extent.max);\n const scaleY = (value: number) => max === min ? height / 2 : height - 2 - (value - min) / (max - min) * (height - 4);\n const baseline = scaleY(Math.max(min, Math.min(max, 0)));\n const step = width / values.length;\n const line: string[] = [];\n const area: string[] = [];\n let segment: { x: number; y: number }[] = [];\n function finish() {\n const first = segment[0];\n const last = segment[segment.length - 1];\n if (!first || !last) return;\n const points = segment.map(({ x, y }) => `${x},${y}`).join(' L');\n line.push('M' + points);\n area.push(`M${points} L${last.x},${baseline} L${first.x},${baseline} Z`);\n segment = [];\n }\n const bars = values.flatMap((value, index) => {\n if (value === null || !Number.isFinite(value)) { finish(); return []; }\n const x = 2 + (width - 4) * (values.length === 1 ? .5 : index / (values.length - 1));\n const y = scaleY(value);\n segment.push({ x, y });\n return [{ x: step * index + step * .15, y: Math.min(y, baseline), width: step * .7, height: Math.max(1, Math.abs(y - baseline)), negative: value < 0 }];\n });\n finish();\n return { line: line.join(' '), area: area.join(' '), bars };\n}\n", "export type RGB = readonly [number, number, number];\nexport interface DataBarRule {\n kind: 'bar'; min: number; max: number; color: string;\n}\nexport interface ColorScaleRule {\n kind: 'scale'; min: number; max: number; low: RGB; high: RGB; mid?: RGB;\n}\nexport interface HighlightRule {\n kind: 'highlight'; when(value: number): boolean; background: string; color?: string;\n}\nexport type ConditionalRule = DataBarRule | ColorScaleRule | HighlightRule;\n\nexport function conditionalStyle(value: number, rule: ConditionalRule): { background?: string; color?: string } {\n if (!Number.isFinite(value)) return {};\n if (rule.kind === 'highlight') {\n return rule.when(value) ? { background: rule.background, ...(rule.color && { color: rule.color }) } : {};\n }\n const position = rule.max === rule.min ? .5 : Math.max(0, Math.min(1, (value - rule.min) / (rule.max - rule.min)));\n if (rule.kind === 'bar') return { background: `linear-gradient(to right, ${rule.color} ${position * 100}%, transparent ${position * 100}%)` };\n const from = rule.mid && position >= .5 ? rule.mid : rule.low;\n const to = rule.mid && position < .5 ? rule.mid : rule.high;\n const t = rule.mid ? position < .5 ? position * 2 : (position - .5) * 2 : position;\n return { background: `rgb(${from.map((channel, index) => Math.round(channel + (to[index]! - channel) * t)).join(', ')})` };\n}\n", "import type { CellValue, RangeBounds } from '@opengrid-ui/core/engine';\nimport type { SheetMenuItem } from '@opengrid-ui/core';\n\nexport interface ChartRange {\n label: string;\n categories: readonly string[];\n series: readonly { name: string; values: readonly (number | null)[] }[];\n}\n\nexport interface ChartAdapter {\n mount(container: HTMLElement, data: ChartRange): () => void;\n}\n\nexport interface ChartMenuOptions {\n id?: string;\n label: string;\n chartLabel?: string;\n columns?: Readonly<Record<string, string>>;\n categoryColumn?: string;\n onChart(data: ChartRange): void | Promise<void>;\n}\n\nexport async function chartRange(options: {\n label: string;\n range: RangeBounds;\n columns: readonly string[];\n read(range: RangeBounds): Promise<readonly (readonly CellValue[])[]>;\n categoryColumn?: number;\n}): Promise<ChartRange> {\n const rows = await options.read(options.range);\n const categories = rows.map((row, index) => {\n const value = options.categoryColumn === undefined ? options.range.top + index + 1 : row[options.categoryColumn];\n return String(value ?? '');\n });\n const series = options.columns.flatMap((name, index) => index === options.categoryColumn ? [] : [{\n name,\n values: rows.map(row => typeof row[index] === 'number' && Number.isFinite(row[index]) ? row[index] as number : null),\n }]);\n return { label: options.label, categories, series };\n}\n\nexport function attachChart(container: HTMLElement, adapter: ChartAdapter, data: ChartRange): () => void {\n return adapter.mount(container, data);\n}\n\nexport function chartMenuItem(options: ChartMenuOptions): SheetMenuItem {\n return {\n id: options.id ?? 'chart-selection',\n label: options.label,\n async action(_point, _selections, context) {\n const selected = await context?.readSelection();\n if (!selected) return;\n const category = options.categoryColumn === undefined ? -1 : selected.columnIds.indexOf(options.categoryColumn);\n const data = await chartRange({\n label: options.chartLabel ?? options.label,\n range: selected.range,\n columns: selected.columnIds.map(id => options.columns?.[id] ?? id),\n read: async () => selected.values,\n ...(category >= 0 && { categoryColumn: category }),\n });\n await options.onChart({ ...data, series: data.series.filter(series => series.values.some(value => value !== null)) });\n },\n };\n}\n"],
5
- "mappings": "AAAA,OAAOA,MAAW,QCEX,SAASC,EAAcC,EAAoC,CAChE,IAAIC,EAAM,IACNC,EAAM,KACV,QAAWC,KAASH,EACdG,IAAU,MAAQ,CAAC,OAAO,SAASA,C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EAAE,CAC3B,CAAC,EACKC,EAASN,EAAQ,QAAQ,QAAQ,CAACO,EAAMH,IAAUA,IAAUJ,EAAQ,eAAiB,CAAC,EAAI,CAAC,CAC/F,KAAAO,EACA,OAAQN,EAAK,IAAIE,GAAO,OAAOA,EAAIC,CAAK,GAAM,UAAY,OAAO,SAASD,EAAIC,CAAK,CAAC,EAAID,EAAIC,CAAK,EAAc,IAAI,CACrH,CAAC,CAAC,EACF,MAAO,CAAE,MAAOJ,EAAQ,MAAO,WAAAE,EAAY,OAAAI,CAAO,CACpD,CAEO,SAASE,EAAYC,EAAwBC,EAAuBC,EAA8B,CACvG,OAAOD,EAAQ,MAAMD,EAAWE,CAAI,CACtC,CAEO,SAASC,EAAcZ,EAA0C,CACtE,MAAO,CACL,GAAIA,EAAQ,IAAM,kBAClB,MAAOA,EAAQ,MACf,MAAM,OAAOa,EAAQC,EAAaC,EAAS,CACzC,IAAMC,EAAW,MAAMD,GAAS,cAAc,EAC9C,GAAI,CAACC,EAAU,OACf,IAAMC,EAAWjB,EAAQ,iBAAmB,OAAY,GAAKgB,EAAS,UAAU,QAAQhB,EAAQ,cAAc,EACxGW,EAAO,MAAMZ,EAAW,CAC5B,MAAOC,EAAQ,YAAcA,EAAQ,MACrC,MAAOgB,EAAS,MAChB,QAASA,EAAS,UAAU,IAAIE,GAAMlB,EAAQ,UAAUkB,CAAE,GAAKA,CAAE,EACjE,KAAM,SAAYF,EAAS,OAC3B,GAAIC,GAAY,GAAK,CAAE,eAAgBA,CAAS,CAClD,CAAC,EACD,MAAMjB,EAAQ,QAAQ,CAAE,GAAGW,EAAM,OAAQA,EAAK,OAAO,OAAOL,GAAUA,EAAO,OAAO,KAAKD,GAASA,IAAU,IAAI,CAAC,CAAE,CAAC,CACtH,CACF,CACF",
6
- "names": ["React", "numericExtent", "values", "min", "max", "value", "sparklineGeometry", "width", "height", "kind", "extent", "scaleY", "baseline", "step", "line", "area", "segment", "finish", "first", "last", "points", "x", "y", "bars", "index", "Sparkline", "values", "kind", "label", "width", "height", "color", "negativeColor", "geometry", "sparklineGeometry", "React", "bar", "index", "conditionalStyle", "value", "rule", "position", "from", "to", "t", "channel", "index", "chartRange", "options", "rows", "categories", "row", "index", "value", "series", "name", "attachChart", "container", "adapter", "data", "chartMenuItem", "_point", "_selections", "context", "selected", "category", "id"]
4
+ "sourcesContent": ["import React from 'react';\nimport { sparklineGeometry } from '../engine/series';\nimport type { SparklineKind } from '../engine/series';\n\nexport function Sparkline({ values, kind = 'line', label, width = 104, height = 28, color = 'var(--og-primary, #305fd2)', negativeColor = '#bb4556' }: {\n values: readonly (number | null)[];\n kind?: SparklineKind;\n label: string;\n width?: number;\n height?: number;\n color?: string;\n negativeColor?: string;\n}) {\n const geometry = sparklineGeometry(values, width, height, kind);\n return <svg viewBox={`0 0 ${width} ${height}`} width={width} height={height} role=\"img\" aria-label={label}>\n {kind === 'bar' ? geometry.bars.map((bar, index) => <rect key={index} x={bar.x} y={bar.y} width={bar.width} height={bar.height}\n fill={bar.negative ? negativeColor : color} />) : <>\n {kind === 'area' && <path d={geometry.area} fill={color} opacity={0.16} />}\n <path d={geometry.line} fill=\"none\" stroke={color} strokeWidth={1.8} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </>}\n </svg>;\n}\n", "export type SparklineKind = 'line' | 'bar' | 'area';\n\nexport function numericExtent(values: readonly (number | null)[]) {\n let min = Infinity;\n let max = -Infinity;\n for (const value of values) {\n if (value === null || !Number.isFinite(value)) continue;\n min = Math.min(min, value);\n max = Math.max(max, value);\n }\n return Number.isFinite(min) ? { min, max } : null;\n}\n\nexport function sparklineGeometry(values: readonly (number | null)[], width: number, height: number, kind: SparklineKind) {\n const extent = numericExtent(values);\n if (!extent) return { line: '', area: '', bars: [] };\n const min = kind === 'line' ? extent.min : Math.min(0, extent.min);\n const max = kind === 'line' ? extent.max : Math.max(0, extent.max);\n const scaleY = (value: number) => max === min ? height / 2 : height - 2 - (value - min) / (max - min) * (height - 4);\n const baseline = scaleY(Math.max(min, Math.min(max, 0)));\n const step = width / values.length;\n const line: string[] = [];\n const area: string[] = [];\n let segment: { x: number; y: number }[] = [];\n function finish() {\n const first = segment[0];\n const last = segment[segment.length - 1];\n if (!first || !last) return;\n const points = segment.map(({ x, y }) => `${x},${y}`).join(' L');\n line.push(first === last ? `M${points} L${points}` : `M${points}`);\n area.push(`M${points} L${last.x},${baseline} L${first.x},${baseline} Z`);\n segment = [];\n }\n const bars = values.flatMap((value, index) => {\n if (value === null || !Number.isFinite(value)) { finish(); return []; }\n const x = 2 + (width - 4) * (values.length === 1 ? .5 : index / (values.length - 1));\n const y = scaleY(value);\n segment.push({ x, y });\n const barHeight = value === 0 ? 0 : Math.max(1, Math.abs(y - baseline));\n return [{ x: step * index + step * .15, y: Math.min(y, baseline), width: step * .7, height: barHeight, negative: value < 0 }];\n });\n finish();\n return { line: line.join(' '), area: area.join(' '), bars };\n}\n", "export type RGB = readonly [number, number, number];\nexport interface DataBarRule {\n kind: 'bar'; min: number; max: number; color: string; negativeColor?: string;\n}\nexport interface ColorScaleRule {\n kind: 'scale'; min: number; max: number; low: RGB; high: RGB; mid?: RGB;\n}\nexport interface HighlightRule {\n kind: 'highlight'; when(value: number): boolean; background: string; color?: string;\n}\nexport type ConditionalRule = DataBarRule | ColorScaleRule | HighlightRule;\n\nfunction fraction(value: number, min: number, max: number) {\n return max === min ? .5 : Math.max(0, Math.min(1, (value - min) / (max - min)));\n}\n\nfunction dataBar(value: number, rule: DataBarRule): { background?: string } {\n const max = Math.max(0, rule.max);\n const zero = rule.min < 0 ? fraction(0, rule.min, max) : 0;\n const position = fraction(value, rule.min, max);\n if (value === 0 || position === zero) return {};\n const start = Math.min(position, zero) * 100;\n const end = Math.max(position, zero) * 100;\n const color = value < 0 ? rule.negativeColor ?? rule.color : rule.color;\n return { background: `linear-gradient(to right, transparent ${start}%, ${color} ${start}%, ${color} ${end}%, transparent ${end}%)` };\n}\n\nexport function conditionalStyle(value: number | null | undefined, rule: ConditionalRule): { background?: string; color?: string } {\n if (typeof value !== 'number' || !Number.isFinite(value)) return {};\n if (rule.kind === 'highlight') {\n return rule.when(value) ? { background: rule.background, ...(rule.color && { color: rule.color }) } : {};\n }\n if (rule.kind === 'bar') return dataBar(value, rule);\n const position = fraction(value, rule.min, rule.max);\n const from = rule.mid && position >= .5 ? rule.mid : rule.low;\n const to = rule.mid && position < .5 ? rule.mid : rule.high;\n const t = rule.mid ? position < .5 ? position * 2 : (position - .5) * 2 : position;\n return { background: `rgb(${from.map((channel, index) => Math.round(channel + (to[index]! - channel) * t)).join(', ')})` };\n}\n", "import type { CellValue, RangeBounds } from '@opengrid-ui/core/engine';\nimport type { SheetMenuItem } from '@opengrid-ui/core';\n\nexport interface ChartRange {\n label: string;\n categories: readonly string[];\n series: readonly { name: string; values: readonly (number | null)[] }[];\n}\n\nexport interface ChartAdapter {\n mount(container: HTMLElement, data: ChartRange): () => void;\n}\n\nexport interface ChartMenuOptions {\n id?: string;\n label: string;\n chartLabel?: string;\n columns?: Readonly<Record<string, string>>;\n categoryColumn?: string;\n onChart(data: ChartRange): void | Promise<void>;\n}\n\nexport async function chartRange(options: {\n label: string;\n range: RangeBounds;\n columns: readonly string[];\n read(range: RangeBounds): Promise<readonly (readonly CellValue[])[]>;\n categoryColumn?: number;\n rowIndices?: readonly number[];\n}): Promise<ChartRange> {\n const rows = await options.read(options.range);\n const categories = rows.map((row, index) => {\n const value = options.categoryColumn === undefined ? (options.rowIndices?.[index] ?? options.range.top + index) + 1\n : row[options.categoryColumn];\n return String(value ?? '');\n });\n const series = options.columns.flatMap((name, index) => index === options.categoryColumn ? [] : [{\n name,\n values: rows.map(row => typeof row[index] === 'number' && Number.isFinite(row[index]) ? row[index] as number : null),\n }]);\n return { label: options.label, categories, series };\n}\n\nexport function attachChart(container: HTMLElement, adapter: ChartAdapter, data: ChartRange): () => void {\n return adapter.mount(container, data);\n}\n\nexport function chartMenuItem(options: ChartMenuOptions): SheetMenuItem {\n return {\n id: options.id ?? 'chart-selection',\n label: options.label,\n async action(_point, _selections, context) {\n const selected = await context?.readSelection();\n if (!selected) return;\n const category = options.categoryColumn === undefined ? -1 : selected.columnIds.indexOf(options.categoryColumn);\n const data = await chartRange({\n label: options.chartLabel ?? options.label,\n range: selected.range,\n columns: selected.columnIds.map(id => options.columns?.[id] ?? id),\n read: async () => selected.values,\n ...(selected.rowIndices && { rowIndices: selected.rowIndices }),\n ...(category >= 0 && { categoryColumn: category }),\n });\n await options.onChart({ ...data, series: data.series.filter(series => series.values.some(value => value !== null)) });\n },\n };\n}\n"],
5
+ "mappings": "AAAA,OAAOA,MAAW,QCEX,SAASC,EAAcC,EAAoC,CAChE,IAAIC,EAAM,IACNC,EAAM,KACV,QAAWC,KAASH,EACdG,IAAU,MAAQ,CAAC,OAAO,SAASA,CAAK,IAC5CF,EAAM,KAAK,IAAIA,EAAKE,CAAK,EACzBD,EAAM,KAAK,IAAIA,EAAKC,CAAK,GAE3B,OAAO,OAAO,SAASF,CAAG,EAAI,CAAE,IAAAA,EAAK,IAAAC,CAAI,EAAI,IAC/C,CAEO,SAASE,EAAkBJ,EAAoCK,EAAeC,EAAgBC,EAAqB,CACxH,IAAMC,EAAST,EAAcC,CAAM,EACnC,GAAI,CAACQ,EAAQ,MAAO,CAAE,KAAM,GAAI,KAAM,GAAI,KAAM,CAAC,CAAE,EACnD,IAAMP,EAAMM,IAAS,OAASC,EAAO,IAAM,KAAK,IAAI,EAAGA,EAAO,GAAG,EAC3DN,EAAMK,IAAS,OAASC,EAAO,IAAM,KAAK,IAAI,EAAGA,EAAO,GAAG,EAC3DC,EAAUN,GAAkBD,IAAQD,EAAMK,EAAS,EAAIA,EAAS,GAAKH,EAAQF,IAAQC,EAAMD,IAAQK,EAAS,GAC5GI,EAAWD,EAAO,KAAK,IAAIR,EAAK,KAAK,IAAIC,EAAK,CAAC,CAAC,CAAC,EACjDS,EAAON,EAAQL,EAAO,OACtBY,EAAiB,CAAC,EAClBC,EAAiB,CAAC,EACpBC,EAA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QAAQ,CAACO,EAAMH,IAAUA,IAAUJ,EAAQ,eAAiB,CAAC,EAAI,CAAC,CAC/F,KAAAO,EACA,OAAQN,EAAK,IAAIE,GAAO,OAAOA,EAAIC,CAAK,GAAM,UAAY,OAAO,SAASD,EAAIC,CAAK,CAAC,EAAID,EAAIC,CAAK,EAAc,IAAI,CACrH,CAAC,CAAC,EACF,MAAO,CAAE,MAAOJ,EAAQ,MAAO,WAAAE,EAAY,OAAAI,CAAO,CACpD,CAEO,SAASE,EAAYC,EAAwBC,EAAuBC,EAA8B,CACvG,OAAOD,EAAQ,MAAMD,EAAWE,CAAI,CACtC,CAEO,SAASC,EAAcZ,EAA0C,CACtE,MAAO,CACL,GAAIA,EAAQ,IAAM,kBAClB,MAAOA,EAAQ,MACf,MAAM,OAAOa,EAAQC,EAAaC,EAAS,CACzC,IAAMC,EAAW,MAAMD,GAAS,cAAc,EAC9C,GAAI,CAACC,EAAU,OACf,IAAMC,EAAWjB,EAAQ,iBAAmB,OAAY,GAAKgB,EAAS,UAAU,QAAQhB,EAAQ,cAAc,EACxGW,EAAO,MAAMZ,EAAW,CAC5B,MAAOC,EAAQ,YAAcA,EAAQ,MACrC,MAAOgB,EAAS,MAChB,QAASA,EAAS,UAAU,IAAIE,GAAMlB,EAAQ,UAAUkB,CAAE,GAAKA,CAAE,EACjE,KAAM,SAAYF,EAAS,OAC3B,GAAIA,EAAS,YAAc,CAAE,WAAYA,EAAS,UAAW,EAC7D,GAAIC,GAAY,GAAK,CAAE,eAAgBA,CAAS,CAClD,CAAC,EACD,MAAMjB,EAAQ,QAAQ,CAAE,GAAGW,EAAM,OAAQA,EAAK,OAAO,OAAOL,GAAUA,EAAO,OAAO,KAAKD,GAASA,IAAU,IAAI,CAAC,CAAE,CAAC,CACtH,CACF,CACF",
6
+ "names": ["React", "numericExtent", "values", "min", "max", "value", "sparklineGeometry", "width", "height", "kind", "extent", "scaleY", "baseline", "step", "line", "area", "segment", "finish", "first", "last", "points", "x", "y", "bars", "index", "barHeight", "Sparkline", "values", "kind", "label", "width", "height", "color", "negativeColor", "geometry", "sparklineGeometry", "React", "bar", "index", "fraction", "value", "min", "max", "dataBar", "rule", "zero", "position", "start", "end", "color", "conditionalStyle", "from", "to", "t", "channel", "index", "chartRange", "options", "rows", "categories", "row", "index", "value", "series", "name", "attachChart", "container", "adapter", "data", "chartMenuItem", "_point", "_selections", "context", "selected", "category", "id"]
7
7
  }
package/dist/llms.txt CHANGED
@@ -6,11 +6,17 @@ OpenGrid is an MIT-licensed React data grid for CRUD, large local datasets, and
6
6
 
7
7
  ## Install
8
8
 
9
- Releases are distributed as npm-compatible tarballs on GitHub. Install Core and Pro together so the package manager can resolve both packages from the same release.
9
+ Install the Core and Pro packages from npm.
10
10
 
11
11
  ```sh
12
- release=https://github.com/Han-wangyu/opengrid-ui/releases/download/v0.1.25
13
- npm install "$release/opengrid-ui-core-0.1.25.tgz" "$release/opengrid-ui-pro-0.1.25.tgz"
12
+ npm install @opengrid-ui/core @opengrid-ui/pro
13
+ ```
14
+
15
+ GitHub Releases also provides versioned tarballs with SHA-256 checksums.
16
+
17
+ ```sh
18
+ release=https://github.com/Han-wangyu/opengrid-ui/releases/download/v0.1.37
19
+ npm install "$release/opengrid-ui-core-0.1.37.tgz" "$release/opengrid-ui-pro-0.1.37.tgz"
14
20
  ```
15
21
 
16
22
  ```tsx
@@ -35,7 +41,7 @@ export function Invoices() {
35
41
  }
36
42
  ```
37
43
 
38
- For native tokens and scoped tooltips, add the Arco or Ant Design adapter tarball and import its `ProGrid`. Check the [packed React and TypeScript compatibility matrix](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/compat-matrix.spec.md) for peer versions and React 19 setup.
44
+ For native tokens and scoped tooltips, install `@opengrid-ui/arco` or `@opengrid-ui/antd` and import its `ProGrid`. Check the peer versions and React 19 setup in the [packed React and TypeScript compatibility matrix](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/compat-matrix.spec.md).
39
45
 
40
46
  ProGrid automatically sorts and filters local datasets above 5,000 rows in a Worker. Plain pages slice the supplied data directly. The [local query contract](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/pro-crud.spec.md#local-datasets) describes refresh and data ownership.
41
47
 
@@ -96,14 +102,28 @@ The [milestones](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/ROADMA
96
102
 
97
103
  The first virtualizer uses an eight-million-pixel physical scroll track and arithmetic row coordinates. It measures its live viewport and keeps an overscanned window plus a prefetched worker chunk. The reference benchmark runs one engine at a time in Chromium against the production build. The 500,000-row scroll gate captures the sampled renderer JavaScript heap peak in the same trace window as the frame measurements. The public comparison starts both engines on identical datasets and displays each panel's ingestion, paint and sort timings while the two engines share the browser.
98
104
 
105
+ Spreadsheet keyboard navigation reveals the target row within the visible body. Core computes the nearest logical offset from the row's bounds and projects it onto the physical track, accounting for sticky headers and pinned rows.
106
+
107
+ Spreadsheet focus uses the current selection, the last selected position, or the first mounted cell in the visible window. Focus entry can remount a virtualized cell on both axes. Active descendant IDs refer to mounted cells, and pointer focus follows the cell being clicked.
108
+
109
+ Keyboard shortcuts for selecting an entire sheet, row or column preserve the active cell independently of the range endpoints. The focus owner associates the retained cell with the accepted range by its coordinates, including for host-controlled selections.
110
+
111
+ Clipboard copy captures the selected ranges and reads them in bounded windows. Each completed window is encoded as TSV; the browser consumes the text as a single clipboard item. A promised payload lets the clipboard write start during the original user gesture.
112
+
113
+ For master/detail layouts, the virtualizer retains visual row positions. The spreadsheet indexes the expanded detail positions to move between data rows and to apply clipboard and fill operations in data order.
114
+
99
115
  Core's opt-in column reordering applies sibling preferences to the definitions passed to TanStack. A pointer drag resolves the destination against logical column boxes and holds capture on the header while center columns virtualize. The same sibling rules serve keyboard moves and successive grip activation.
100
116
 
101
117
  The horizontal virtualizer stores column offsets and pin boundaries with the layout. A binary search locates the first visible center column. The mounted leaves identify the grouped headers using a per-pane ancestry index, so horizontal scroll work follows the visible columns, pinned columns and header depth.
102
118
 
119
+ Local [merged cells](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/core-engine.spec.md#merged-cells) use a rectangle index over logical rows and columns. The viewport mounts each intersecting merge once, preserves the anchor used for accessibility and edits, and clips its paint to the scaled track beneath pinned columns.
120
+
103
121
  Pro's committed query is distinct from form drafts and asynchronously restored column preferences. An opt-in saved query read waits up to its configured deadline. The first commit combines the resulting fields with the current URL and controlled props, replaces the history entry, and starts rows and category counts. A single query slot tracks active requests by normalized key, aborts superseded work and checks each generation. A separate slot handles category counts. A pending query intent can receive controlled acknowledgements across renders. The controller keeps its staged fields out of the accepted query until they are all confirmed. Export consumers receive the query corresponding to the last accepted batch of rows. For full-query Excel export, Pro opens a host-provided revision and passes ordered, validated blocks to the workbook handler. The Excel plugin owns file encoding. Migration converters preserve native field paths and emit diagnostics for callbacks with different semantics.
104
122
 
105
123
  Category tabs track keyboard focus within each visible list. The committed query supplies the selected path and labels the shared grid panel. Host changes to the query view and a Pro-owned page reset use a single query commit.
106
124
 
125
+ Each URL-synchronized grid tracks its own decoded query in browser history. Only navigation that changes that query enters the controller's replay path, preserving pending input in other grids on the page.
126
+
107
127
  The query form and the header filter dialog share schema inputs. Header filter edits stay local until an explicit column change. The accepted column value is copied into the query form while its other drafts are preserved. The header dialog mounts in the owning theme container.
108
128
 
109
129
  Pro feeds Core header moves into the same column preference as the toolbar. It reconciles the visible heading tree with the schema's hidden leaves and uses the current visible pin panes for export order.
@@ -118,11 +138,11 @@ The [compute protocol](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/
118
138
 
119
139
  [Selection summaries](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/core-engine.spec.md#selection-summaries) run against Worker views when the spreadsheet uses raw source values. Sheets with custom value projections read bounded blocks and yield between batches of main-thread work.
120
140
 
121
- Enterprise features are explicit imports. Core supports pinned rows, dynamic heights, local cell spans, row drag, trees and nested details. The pivot plugin owns grouping, aggregation, filters and server-side blocks. The Excel plugin owns streamed file IO. The Charts plugin maps a Core spreadsheet selection to a chart adapter's series and categories. The Rust worker shares the JS transaction and viewport contract while providing native numeric sorting, filters and aggregates.
141
+ Enterprise features are explicit imports. Core supports pinned rows, dynamic heights, local cell spans, row drag, trees and nested details. Each nested grid handles its own spreadsheet input. The pivot plugin owns grouping, aggregation, filters and server-side blocks. The Excel plugin indexes the ZIP directory and streams worksheet parts in workbook tab order. Its writer flushes compressed batches against sink backpressure and observes cancellation while waiting on rows or writes. The Charts plugin renders inline sparklines and conditional formats and maps a Core spreadsheet selection to a chart adapter's series and categories. The Rust worker shares the JS transaction and viewport contract while providing native numeric sorting, filters and aggregates.
122
142
 
123
143
  The [server-side tree](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/ssrm.spec.md) keeps a sparse list of spans for the expanded hierarchy. Core reads the requested window through its tree source capability and renders loaded siblings while child blocks resolve. New windows release abandoned requests and reuse in-flight blocks where both windows overlap.
124
144
 
125
- [Pivot and formula sessions](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/analytics.spec.md) use dedicated Workers when their workflows become active. Large pivot views batch numeric reducers through a lazily loaded Rust kernel. JavaScript retains the layout and source-order semantics, the Worker reuses projected columns, and the host applies custom reducers. Formula sessions keep the dependency graph off the main thread and use acknowledged raw values for recovery.
145
+ [Pivot and formula sessions](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/specs/analytics.spec.md) use dedicated Workers when their workflows become active. Large pivot views batch numeric reducers through a lazily loaded Rust kernel. JavaScript retains the layout and source-order semantics, the Worker reuses projected columns, and the host applies custom reducers. Formula sessions keep the dependency graph off the main thread, resume formulas as their references resolve, and use acknowledged raw values for recovery.
126
146
 
127
147
  The pivot session applies filters against its cached projections before aggregation. Sidebar filter drafts stay in the UI until the host applies them. Report-column visibility and order change the rendered columns without a pivot computation.
128
148
 
@@ -141,4 +161,4 @@ The two first-release scenarios are a production-style Pro migration and a 500,0
141
161
 
142
162
  ## First delivery
143
163
 
144
- The published GitHub release supplies the nine installable tarballs and public documentation. The registry publish and an internal rollout are follow-up activities. The [status board](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/progress/STATUS.md) records the evidence for the GitHub gate and the current rollout boundary.
164
+ The nine packages are available from npm and as versioned GitHub release tarballs. The M5 gate checks the deployed documentation and both distribution channels. An internal rollout remains pending. See the [status board](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/progress/STATUS.md) and [publishing workflow](https://github.com/Han-wangyu/opengrid-ui/blob/main/docs/releasing.md).
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@opengrid-ui/plugin-charts","version":"0.1.25","license":"MIT","type":"module","repository":{"type":"git","url":"git+https://github.com/Han-wangyu/opengrid-ui.git","directory":"packages/plugin-charts"},"files":["dist","LICENSE"],"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"sideEffects":false,"publishConfig":{"access":"public"},"scripts":{"build":"node ../../scripts/build-package.mjs"},"peerDependencies":{"react":"^17.0.2 || ^18.0.0 || ^19.0.0"},"devDependencies":{"@opengrid-ui/core":"workspace:^"}}
1
+ {"name":"@opengrid-ui/plugin-charts","version":"0.1.37","license":"MIT","type":"module","repository":{"type":"git","url":"git+https://github.com/Han-wangyu/opengrid-ui.git","directory":"packages/plugin-charts"},"files":["dist","LICENSE"],"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"sideEffects":false,"publishConfig":{"access":"public"},"scripts":{"build":"node ../../scripts/build-package.mjs"},"peerDependencies":{"react":"^17.0.2 || ^18.0.0 || ^19.0.0"},"devDependencies":{"@opengrid-ui/core":"workspace:^"}}