@graphysdk/geom-error-bar 0.0.0-stage → 0.1.1-beta.1792421638596

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/LICENSE.md ADDED
@@ -0,0 +1,17 @@
1
+ # License
2
+
3
+ This software is available under any of the following licenses, at your option,
4
+ depending on which one's conditions you meet:
5
+
6
+ - **PolyForm Noncommercial 1.0.0** — for noncommercial use (personal,
7
+ charitable, educational, research, government).
8
+ See [licenses/PolyForm-NonCommercial-1.0.0.md](licenses/PolyForm-NonCommercial-1.0.0.md)
9
+
10
+ - **PolyForm Small Business 1.0.0** — free commercial use for organizations
11
+ under the size thresholds defined in the license.
12
+ See [licenses/PolyForm-Small-Business-1.0.0.md](licenses/PolyForm-Small-Business-1.0.0.md)
13
+
14
+ - **PolyForm Free Trial 1.0.0** — a 32-day evaluation for anyone else.
15
+ See [licenses/PolyForm-Free-Trial-1.0.0.md](licenses/PolyForm-Free-Trial-1.0.0.md)
16
+
17
+ For commercial use beyond these terms, contact [hello@graphy.dev](mailto:hello@graphy.dev) or visit [https://graphy.dev](https://graphy.dev).
package/README.md CHANGED
@@ -1,3 +1,60 @@
1
- # Temporary Holding Version
1
+ # @graphysdk/geom-error-bar
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **Beta.** This geom is on a `0.x` version line: a minor release may change its aesthetics, params, style or look. Use a caret range (`^0.1.0`) to take only patches.
4
+
5
+ An error bar geom for the Graphy charting SDK. It draws the uncertainty around an estimate as a line from the interval's lower end to its upper, with a cap across each end, over the bars or points that show the estimates.
6
+
7
+ Learn more at [graphy.dev](https://graphy.dev).
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @graphysdk/geom-error-bar @graphysdk/react
13
+ ```
14
+
15
+ Requires React 19. Its only peer is `@graphysdk/react`.
16
+
17
+ ## Usage
18
+
19
+ Data is one row per estimate. Map the category to `x` and the estimate to `y`. Map the interval as `lower` and `upper`, or as an `error` either side of `y`. Draw it after the bars so it paints on top; a colour group dodges each error bar onto its own bar:
20
+
21
+ ```tsx
22
+ import { createGraphyKit, GraphRenderer } from '@graphysdk/react';
23
+ import { errorbar } from '@graphysdk/geom-error-bar';
24
+
25
+ const kit = createGraphyKit({ plugins: [errorbar] });
26
+
27
+ const spec = kit.pipe(
28
+ kit.createSpec({ x: 'treatment', y: 'days', color: 'age' }),
29
+ kit.geom.bar(),
30
+ kit.geom.errorbar({ aes: { lower: 'ciLow', upper: 'ciHigh' } }),
31
+ kit.scale.x.discrete(),
32
+ kit.scale.y.continuous()
33
+ );
34
+
35
+ export function Recovery({ data }) {
36
+ return (
37
+ <kit.GraphProvider spec={spec} data={data}>
38
+ <GraphRenderer />
39
+ </kit.GraphProvider>
40
+ );
41
+ }
42
+ ```
43
+
44
+ `kit.geom.errorbar({ aes: { error: 'se' } })` reaches the error either side of `y` instead. `params: { width }` sets how much of its band share each cap spans (`0.5` by default, `0` for none).
45
+
46
+ Style the line and caps with `kit.style.geom.errorbar()`.
47
+
48
+ ## Docs
49
+
50
+ - [Error bar](https://docs.graphy.dev/sdk-next/graph-types/error-bar)
51
+
52
+ ## Feedback
53
+
54
+ This geom is released early to hear what works. Tell us on [Discord](https://discord.gg/yGmYCjkSr).
55
+
56
+ ## Licence
57
+
58
+ This package is available under PolyForm Noncommercial, Small Business, or a 32-day Free Trial. Free Trial is local or internal evaluation only — it does not cover a public page. See [what you can do under the trial](https://docs.graphy.dev/licence/evaluation).
59
+
60
+ For a commercial licence, [talk to us](https://graphy.dev/license).
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The interval's ends, which `compile()` writes in `y`'s units and format so the tooltip reads them like the value
3
+ * axis. Written whether the ends were mapped or computed from `error`, so authors can name them in a `highlight` or a
4
+ * `where`: they are part of the geom's API.
5
+ */
6
+ export declare const ERRORBAR_VARIABLES: {
7
+ readonly lower: "errorbarLower";
8
+ readonly upper: "errorbarUpper";
9
+ };
@@ -0,0 +1,91 @@
1
+ import { AnchorContext, AnchorPosition, GeomCompileResult, GeomCompilerInput, GeomMappingValidationInput, GeomObservationPart, GeomStyleTarget, Observation, UserInputIssue, Geom } from '@graphysdk/react';
2
+ export interface ErrorbarGeomParams {
3
+ /** The fraction of its share of the band each cap spans, from `0` (no caps) to `1`; `0.5` by default. */
4
+ width?: number;
5
+ }
6
+ export declare const DEFAULT_CAP_WIDTH = 0.5;
7
+ /** A stem and its two caps, painted as one stroke. */
8
+ declare const LINE_VOCABULARY: {
9
+ readonly stroke: "color";
10
+ readonly alpha: "unitInterval";
11
+ readonly strokeWidth: "pixels";
12
+ readonly dashArray: "dashArray";
13
+ };
14
+ /** Named so the published types reach the observations through `@graphysdk/react`, the package's one peer. */
15
+ interface ErrorbarStyleTarget extends GeomStyleTarget {
16
+ observation: GeomObservationPart<typeof LINE_VOCABULARY> & {
17
+ sharedPaint: false;
18
+ };
19
+ }
20
+ /**
21
+ * An error bar: a line from an estimate's lower bound to its upper, capped at each end.
22
+ *
23
+ * One row per estimate: `x` the category, `y` the estimate, `color` the group. The interval is `lower` and `upper` as
24
+ * written, or `error` either side of `y`. Groups dodge across the band as grouped bars do, so an error bar over
25
+ * grouped bars stands on its own bar. Horizontal via `coord.flip()`.
26
+ */
27
+ export declare class ErrorbarGeom extends Geom<ErrorbarGeomParams> {
28
+ readonly type: "errorbar";
29
+ readonly defaultParams: ErrorbarGeomParams;
30
+ /** The computed ends drive the value axis; naming `y` as their source makes an estimate required. */
31
+ readonly positionRoles: readonly [{
32
+ readonly axis: "x";
33
+ readonly role: "point";
34
+ readonly valueKind: "value";
35
+ }, {
36
+ readonly axis: "y";
37
+ readonly role: "min";
38
+ readonly valueKind: "value";
39
+ readonly aes: "y";
40
+ }, {
41
+ readonly axis: "y";
42
+ readonly role: "max";
43
+ readonly valueKind: "value";
44
+ readonly aes: "y";
45
+ }];
46
+ readonly aesthetics: readonly [{
47
+ readonly kind: "visual";
48
+ readonly name: "color";
49
+ }, {
50
+ readonly kind: "data";
51
+ readonly name: "lower";
52
+ }, {
53
+ readonly kind: "data";
54
+ readonly name: "upper";
55
+ }, {
56
+ readonly kind: "data";
57
+ readonly name: "error";
58
+ }];
59
+ readonly defaultPosition = "dodge";
60
+ /** A stacked interval would start on the one below it, and its ends would read as lengths they are not. */
61
+ readonly supportedPositions: readonly ["identity", "dodge"];
62
+ readonly supportedCoordTypes: readonly ["cartesian", "flip"];
63
+ /** No `zeroBaseline`: an error bar encodes where an estimate may sit, not a length from zero. */
64
+ readonly scaleConstraints: {
65
+ discreteMainAxis: boolean;
66
+ };
67
+ readonly legend: {
68
+ suppressWhenSingleItem: boolean;
69
+ };
70
+ /** Hit-tests as the rect its interval spans across its band share, so each dodged error bar answers for itself. */
71
+ readonly spatialKind = "rects";
72
+ /**
73
+ * Describes the layer before it, the bars or points it stands on: it joins their hover rather than taking it, and its
74
+ * interval reads under its own group's row. Drawn alone, as a forest plot, it has no host and answers for itself.
75
+ */
76
+ readonly defaultAttachTo = "previous";
77
+ readonly highlightStrategy: "observation-rerender";
78
+ /** One `Interval` row per listed error bar, named after its `color` group so it reads as that group's range. */
79
+ readonly tooltip: readonly [{
80
+ readonly key: "Interval";
81
+ readonly range: readonly ["lower", "upper"];
82
+ }];
83
+ readonly styleTarget: ErrorbarStyleTarget;
84
+ resolveParams(options: Parameters<Geom['resolveParams']>[0]): Record<string, unknown>;
85
+ /** Requires `error`, or both `lower` and `upper`, but not both forms, each on a numeric column. */
86
+ readonly validateMapping: ({ mapping, data }: GeomMappingValidationInput) => readonly UserInputIssue[];
87
+ /** Annotations anchor at the interval's upper end on the stem, as a bar's do at its top. */
88
+ readonly resolveAnchorPosition: (observation: Observation, { coordSystem }: AnchorContext) => AnchorPosition | null;
89
+ compile({ data, mapping }: GeomCompilerInput): GeomCompileResult;
90
+ }
91
+ export {};
@@ -0,0 +1,11 @@
1
+ /** An error bar's interval in `y`'s units, `lower <= upper`. */
2
+ export interface Interval {
3
+ lower: number;
4
+ upper: number;
5
+ }
6
+ type NumericColumn = ReadonlyArray<number | null | undefined>;
7
+ /** Each row's interval; its ends may be written in either order. */
8
+ export declare const measureBoundsIntervals: (lowers: NumericColumn, uppers: NumericColumn) => Array<Interval | null>;
9
+ /** Each row's interval, `error` either side of the estimate; a negative error draws none. */
10
+ export declare const measureErrorIntervals: (estimates: NumericColumn, errors: NumericColumn) => Array<Interval | null>;
11
+ export {};
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let s=require("@graphysdk/react"),m=require("react"),u=require("react/jsx-runtime");var k=r=>(r.start+r.end)/2,T=(r,e)=>{const t=e==="x"?(0,s.getXMin)(r):(0,s.getYMin)(r),a=e==="x"?(0,s.getXMax)(r):(0,s.getYMax)(r),o=e==="x"?(0,s.getYMin)(r):(0,s.getXMin)(r),n=e==="x"?(0,s.getYMax)(r):(0,s.getXMax)(r);return t===null||a===null||o===null||n===null?null:{observation:r,start:t,end:a,low:o,high:n}},y=(r,e)=>{const t=[];for(const a of r){const o=T(a,e);o!==null&&t.push(o)}return t},b=r=>typeof r=="number"&&Number.isFinite(r)?r:null,C=(r,e)=>r.map((t,a)=>{const o=b(t),n=b(e[a]);return o===null||n===null?null:{lower:Math.min(o,n),upper:Math.max(o,n)}}),L=(r,e)=>r.map((t,a)=>{const o=b(t),n=b(e[a]);return o===null||n===null||n<0?null:{lower:o-n,upper:o+n}}),p={lower:"errorbarLower",upper:"errorbarUpper"},x=.5,$=.7,W=1.5,R={stroke:"color",alpha:"unitInterval",strokeWidth:"pixels",dashArray:"dashArray"},V=class extends s.Geom{constructor(...r){super(...r),this.type="errorbar",this.defaultParams={width:x},this.positionRoles=[{axis:"x",role:"point",valueKind:"value"},{axis:"y",role:"min",valueKind:"value",aes:"y"},{axis:"y",role:"max",valueKind:"value",aes:"y"}],this.aesthetics=[{kind:"visual",name:"color"},{kind:"data",name:"lower"},{kind:"data",name:"upper"},{kind:"data",name:"error"}],this.defaultPosition="dodge",this.supportedPositions=["identity","dodge"],this.supportedCoordTypes=["cartesian","flip"],this.scaleConstraints={discreteMainAxis:!0},this.legend={suppressWhenSingleItem:!0},this.spatialKind="rects",this.defaultAttachTo="previous",this.highlightStrategy="observation-rerender",this.tooltip=[{key:"Interval",range:["lower","upper"]}],this.styleTarget=(0,s.defineGeomStyleTarget)({observation:{vocabulary:R,sharedPaint:!1,aesthetics:{},rest:{stroke:(0,s.token)("textPrimary"),alpha:1,strokeWidth:W,dashArray:[]}}}),this.validateMapping=({mapping:e,data:t})=>{const a=e.error!==void 0,o=e.lower!==void 0,n=e.upper!==void 0;return a&&(o||n)?[{code:"CONFLICTING_STAT_MAPPING",message:"errorbar geom computes 'lower' and 'upper' from 'error'; map either 'error' or 'lower' and 'upper'"}]:a?E(t,e,["error"]):o&&n?E(t,e,["lower","upper"]):[{code:"MISSING_AESTHETIC",message:`errorbar geom requires ${o?"'upper'":n?"'lower'":"'error', or 'lower' and 'upper',"} to be mapped`}]},this.resolveAnchorPosition=(e,{coordSystem:t})=>{const a=(0,s.readMainAxis)(t),o=T(e,a);if(o===null)return null;const n=k(o);return a==="x"?{x:n,y:o.high}:{x:o.high,y:n}}}resolveParams(r){const{width:e,...t}=super.resolveParams(r);return j(e)?{...t,width:e}:(r.diagnostics?.addWarning({code:"INVALID_GEOM_PARAM",message:`Error bar width must be a fraction in [0, 1], got ${String(e)}; falling back to ${x}.`,context:{geom:this.type,param:"width",expected:"0 <= width <= 1",actual:String(e)},suggestion:"Set params.width to the fraction of its share of the band each cap spans, in [0, 1]."}),{...t,width:x})}compile({data:r,mapping:e}){const t=w(e.y),a=K(r,e);if(t===null||!r.hasVariable(t)||a===null)return{data:r,mapping:{}};const o=r.getValueFormat(t),n=a.map(d=>d?.lower??null),i=a.map(d=>d?.upper??null),l=$/2;return{data:r.addVariable(p.lower,"numeric",n,o).addVariable(p.upper,"numeric",i,o).addVariable(s.POSITION_VARIABLES.yMin,"numeric",n).addVariable(s.POSITION_VARIABLES.yMax,"numeric",i).addConstantVariable(s.POSITION_VARIABLES.xMin,"numeric",-.35).addConstantVariable(s.POSITION_VARIABLES.xMax,"numeric",l),mapping:{lower:p.lower,upper:p.upper}}}},j=r=>typeof r=="number"&&Number.isFinite(r)&&r>=0&&r<=1,w=r=>r===void 0?null:typeof r=="string"?r:"variable"in r?r.variable:null,B=r=>{if(!(r===void 0||typeof r=="string"))return"value"in r?r.value:void 0},E=(r,e,t)=>t.flatMap(a=>G(r,e[a],a)),G=(r,e,t)=>{const a=B(e);if(a!==void 0)return typeof a=="number"?[]:[{code:"INCOMPATIBLE_TYPE",message:`errorbar geom requires '${t}' to be numeric, but its constant is ${JSON.stringify(a)}`,context:{aesthetic:t,expected:"number",actual:String(a)},suggestion:`Set '${t}' to a numeric constant.`}];const o=w(e);if(r.size()===0||o===null||!r.hasVariable(o))return[];const n=r.getType(o);return n==="numeric"?[]:[{code:"INCOMPATIBLE_TYPE",message:`errorbar geom requires '${t}' to be numeric, but variable '${o}' is ${n}`,context:{aesthetic:t,variableName:o,variableType:n},suggestion:`Map '${t}' to a numeric variable.`}]},v=(r,e)=>{const t=B(e);if(typeof t=="number")return Array.from({length:r.size()},()=>t);const a=w(e);return a===null||!r.hasVariable(a)?null:r.getValues(a,{type:"numeric"})},K=(r,e)=>{const t=v(r,e.error);if(t!==null){const n=v(r,e.y);return n===null?null:L(n,t)}const a=v(r,e.lower),o=v(r,e.upper);return a===null||o===null?null:C(a,o)},h=r=>{const e="width"in r?r.width:void 0;return typeof e=="number"?e:x},_=(r,e,t)=>{const a=k(r),o=(r.end-r.start)*t/2,n={from:f(e,a,r.low),to:f(e,a,r.high)};return o===0?{stem:n,caps:[]}:{stem:n,caps:[r.low,r.high].map(i=>({from:f(e,a-o,i),to:f(e,a+o,i)}))}},f=(r,e,t)=>{const a=(0,s.composePoint)(r,{main:e,cross:t});return{x:(0,s.toViewBoxX)(a.x),y:(0,s.toViewBoxY)(a.y)}},F=({layer:r,coordSystem:e,panelRect:t,styleReaders:a})=>{const o=(0,s.readMainAxis)(e),n=h(r.params);return y(r.data,o).flatMap(i=>{const l=a.get("strokeWidth",i.observation)??0;if(l<=0)return[];const{stem:d,caps:g}=_(i,o,n);return[d,...g].map(I=>({kind:"stroke",pathData:H(I,t),width:l}))})},H=(r,e)=>{const t=S(r.from,e),a=S(r.to,e);return`M${t.x},${t.y}L${a.x},${a.y}`},S=(r,e)=>({x:r.x*e.width,y:r.y*e.height}),M=r=>{const e=(0,s.createStableKeyGenerator)(r.data,r.mapping,r.id);return t=>e(t.observation)},A=({bars:r,mainAxis:e,capWidth:t,styleReaders:a,getKey:o,isHovered:n=!1,shouldAnimateTransitions:i=!1})=>{const l=n?"hovered":void 0;return(0,u.jsx)(u.Fragment,{children:r.flatMap(d=>{const g=o(d),{stem:I,caps:O}=_(d,e,t);return[{key:`${g}-stem`,testId:"errorbar-stem",segment:I},...O.map((c,N)=>({key:`${g}-${N===0?"lower":"upper"}-cap`,testId:"errorbar-cap",segment:c}))].map(c=>(0,u.jsx)(D,{testId:c.testId,segment:c.segment,observation:d.observation,styleReaders:a,state:l,shouldAnimateTransitions:i},c.key))})})},D=({testId:r,segment:e,observation:t,styleReaders:a,state:o,shouldAnimateTransitions:n})=>{const i=a.get("strokeWidth",t,o)??0,l=a.get("stroke",t,o);return(0,u.jsx)(s.GeomLine,{"data-testid":r,x1:(0,s.toPercent)(e.from.x),y1:(0,s.toPercent)(e.from.y),x2:(0,s.toPercent)(e.to.x),y2:(0,s.toPercent)(e.to.y),stroke:l===void 0?void 0:(0,s.toPaintColor)(l),strokeOpacity:a.get("alpha",t,o),strokeWidth:i,strokeDasharray:(0,s.toStrokeDasharray)(a.get("dashArray",t,o),i),shouldAnimateTransitions:n})},Y=({layer:r,sourceLayer:e,mainAxis:t,capWidth:a,styleReaders:o})=>(0,u.jsx)(A,{bars:(0,m.useMemo)(()=>y(r.data,t),[r.data,t]),mainAxis:t,capWidth:a,styleReaders:o,getKey:(0,m.useMemo)(()=>M(e),[e])}),P=({layer:r,hit:e,mainAxis:t,capWidth:a,styleReaders:o})=>{const n=(0,m.useMemo)(()=>M(r),[r]);return(0,u.jsx)("g",{"data-testid":"hovered-errorbars",children:(0,u.jsx)(A,{bars:y([e.observation],t),mainAxis:t,capWidth:a,styleReaders:o,getKey:n,isHovered:!0})})},q=({layer:r,mainAxis:e,capWidth:t,styleReaders:a,shouldAnimateTransitions:o,intro:n})=>{const i=(0,u.jsx)(A,{bars:(0,m.useMemo)(()=>y(r.data,e),[r.data,e]),mainAxis:e,capWidth:t,styleReaders:a,getKey:(0,m.useMemo)(()=>M(r),[r]),shouldAnimateTransitions:o});return n==null?i:(0,u.jsx)(s.IntroFade,{intro:{type:"fade",layerId:n.layerId,durationSeconds:n.durationSeconds},children:i})},X=(0,s.defineGeomRenderer)(new V,{coord:"cartesian",swatchShape:"interval",guideMode:"band",render:({layer:r,coordSystem:e,styleReaders:t,shouldAnimateTransitions:a,intro:o})=>(0,u.jsx)(q,{layer:r,mainAxis:(0,s.readMainAxis)(e),capWidth:h(r.params),styleReaders:t,shouldAnimateTransitions:a,intro:o}),renderHighlight:({layer:r,sourceLayer:e,coordSystem:t,styleReaders:a})=>(0,u.jsx)(Y,{layer:r,sourceLayer:e,mainAxis:(0,s.readMainAxis)(t),capWidth:h(r.params),styleReaders:a}),renderHover:({layer:r,primary:e,coordSystem:t,styleReaders:a})=>(0,u.jsx)(P,{layer:r,hit:e,mainAxis:(0,s.readMainAxis)(t),capWidth:h(r.params),styleReaders:a}),renderHoverCompanions:({layer:r,primary:e,related:t,coordSystem:a,styleReaders:o})=>{const n=(0,s.findAttachedHit)(r,e,t);return n===void 0?null:(0,u.jsx)(P,{layer:r,hit:n,mainAxis:(0,s.readMainAxis)(a),capWidth:h(r.params),styleReaders:o})},getEditOutlineShapes:F});exports.ERRORBAR_VARIABLES=p;exports.ErrorbarGeom=V;exports.errorbar=X;
@@ -0,0 +1,3 @@
1
+ export { ErrorbarGeom } from './engine/errorbar.geom';
2
+ export { ERRORBAR_VARIABLES } from './engine/errorbar-variables';
3
+ export { errorbar } from './renderer/errorbar';
package/dist/index.mjs ADDED
@@ -0,0 +1,350 @@
1
+ import { Geom as F, GeomLine as G, IntroFade as H, POSITION_VARIABLES as v, composePoint as D, createStableKeyGenerator as R, defineGeomRenderer as Y, defineGeomStyleTarget as U, findAttachedHit as X, getXMax as A, getXMin as P, getYMax as T, getYMin as C, readMainAxis as d, toPaintColor as q, toPercent as f, toStrokeDasharray as z, toViewBoxX as j, toViewBoxY as J, token as Q } from "@graphysdk/react";
2
+ import { useMemo as h } from "react";
3
+ import { Fragment as Z, jsx as i } from "react/jsx-runtime";
4
+ var $ = (r) => (r.start + r.end) / 2, W = (r, e) => {
5
+ const t = e === "x" ? P(r) : C(r), a = e === "x" ? A(r) : T(r), o = e === "x" ? C(r) : P(r), n = e === "x" ? T(r) : A(r);
6
+ return t === null || a === null || o === null || n === null ? null : {
7
+ observation: r,
8
+ start: t,
9
+ end: a,
10
+ low: o,
11
+ high: n
12
+ };
13
+ }, I = (r, e) => {
14
+ const t = [];
15
+ for (const a of r) {
16
+ const o = W(a, e);
17
+ o !== null && t.push(o);
18
+ }
19
+ return t;
20
+ }, x = (r) => typeof r == "number" && Number.isFinite(r) ? r : null, rr = (r, e) => r.map((t, a) => {
21
+ const o = x(t), n = x(e[a]);
22
+ return o === null || n === null ? null : {
23
+ lower: Math.min(o, n),
24
+ upper: Math.max(o, n)
25
+ };
26
+ }), er = (r, e) => r.map((t, a) => {
27
+ const o = x(t), n = x(e[a]);
28
+ return o === null || n === null || n < 0 ? null : {
29
+ lower: o - n,
30
+ upper: o + n
31
+ };
32
+ }), g = {
33
+ lower: "errorbarLower",
34
+ upper: "errorbarUpper"
35
+ }, w = 0.5, tr = 0.7, ar = 1.5, or = {
36
+ stroke: "color",
37
+ alpha: "unitInterval",
38
+ strokeWidth: "pixels",
39
+ dashArray: "dashArray"
40
+ }, nr = class extends F {
41
+ constructor(...r) {
42
+ super(...r), this.type = "errorbar", this.defaultParams = { width: w }, this.positionRoles = [
43
+ {
44
+ axis: "x",
45
+ role: "point",
46
+ valueKind: "value"
47
+ },
48
+ {
49
+ axis: "y",
50
+ role: "min",
51
+ valueKind: "value",
52
+ aes: "y"
53
+ },
54
+ {
55
+ axis: "y",
56
+ role: "max",
57
+ valueKind: "value",
58
+ aes: "y"
59
+ }
60
+ ], this.aesthetics = [
61
+ {
62
+ kind: "visual",
63
+ name: "color"
64
+ },
65
+ {
66
+ kind: "data",
67
+ name: "lower"
68
+ },
69
+ {
70
+ kind: "data",
71
+ name: "upper"
72
+ },
73
+ {
74
+ kind: "data",
75
+ name: "error"
76
+ }
77
+ ], this.defaultPosition = "dodge", this.supportedPositions = ["identity", "dodge"], this.supportedCoordTypes = ["cartesian", "flip"], this.scaleConstraints = { discreteMainAxis: !0 }, this.legend = { suppressWhenSingleItem: !0 }, this.spatialKind = "rects", this.defaultAttachTo = "previous", this.highlightStrategy = "observation-rerender", this.tooltip = [{
78
+ key: "Interval",
79
+ range: ["lower", "upper"]
80
+ }], this.styleTarget = U({ observation: {
81
+ vocabulary: or,
82
+ sharedPaint: !1,
83
+ aesthetics: {},
84
+ rest: {
85
+ stroke: Q("textPrimary"),
86
+ alpha: 1,
87
+ strokeWidth: ar,
88
+ dashArray: []
89
+ }
90
+ } }), this.validateMapping = ({ mapping: e, data: t }) => {
91
+ const a = e.error !== void 0, o = e.lower !== void 0, n = e.upper !== void 0;
92
+ return a && (o || n) ? [{
93
+ code: "CONFLICTING_STAT_MAPPING",
94
+ message: "errorbar geom computes 'lower' and 'upper' from 'error'; map either 'error' or 'lower' and 'upper'"
95
+ }] : a ? V(t, e, ["error"]) : o && n ? V(t, e, ["lower", "upper"]) : [{
96
+ code: "MISSING_AESTHETIC",
97
+ message: `errorbar geom requires ${o ? "'upper'" : n ? "'lower'" : "'error', or 'lower' and 'upper',"} to be mapped`
98
+ }];
99
+ }, this.resolveAnchorPosition = (e, { coordSystem: t }) => {
100
+ const a = d(t), o = W(e, a);
101
+ if (o === null) return null;
102
+ const n = $(o);
103
+ return a === "x" ? {
104
+ x: n,
105
+ y: o.high
106
+ } : {
107
+ x: o.high,
108
+ y: n
109
+ };
110
+ };
111
+ }
112
+ resolveParams(r) {
113
+ const { width: e, ...t } = super.resolveParams(r);
114
+ return sr(e) ? {
115
+ ...t,
116
+ width: e
117
+ } : (r.diagnostics?.addWarning({
118
+ code: "INVALID_GEOM_PARAM",
119
+ message: `Error bar width must be a fraction in [0, 1], got ${String(e)}; falling back to ${w}.`,
120
+ context: {
121
+ geom: this.type,
122
+ param: "width",
123
+ expected: "0 <= width <= 1",
124
+ actual: String(e)
125
+ },
126
+ suggestion: "Set params.width to the fraction of its share of the band each cap spans, in [0, 1]."
127
+ }), {
128
+ ...t,
129
+ width: w
130
+ });
131
+ }
132
+ compile({ data: r, mapping: e }) {
133
+ const t = k(e.y), a = ur(r, e);
134
+ if (t === null || !r.hasVariable(t) || a === null) return {
135
+ data: r,
136
+ mapping: {}
137
+ };
138
+ const o = r.getValueFormat(t), n = a.map((l) => l?.lower ?? null), s = a.map((l) => l?.upper ?? null), u = tr / 2;
139
+ return {
140
+ data: r.addVariable(g.lower, "numeric", n, o).addVariable(g.upper, "numeric", s, o).addVariable(v.yMin, "numeric", n).addVariable(v.yMax, "numeric", s).addConstantVariable(v.xMin, "numeric", -0.35).addConstantVariable(v.xMax, "numeric", u),
141
+ mapping: {
142
+ lower: g.lower,
143
+ upper: g.upper
144
+ }
145
+ };
146
+ }
147
+ }, sr = (r) => typeof r == "number" && Number.isFinite(r) && r >= 0 && r <= 1, k = (r) => r === void 0 ? null : typeof r == "string" ? r : "variable" in r ? r.variable : null, _ = (r) => {
148
+ if (!(r === void 0 || typeof r == "string"))
149
+ return "value" in r ? r.value : void 0;
150
+ }, V = (r, e, t) => t.flatMap((a) => ir(r, e[a], a)), ir = (r, e, t) => {
151
+ const a = _(e);
152
+ if (a !== void 0)
153
+ return typeof a == "number" ? [] : [{
154
+ code: "INCOMPATIBLE_TYPE",
155
+ message: `errorbar geom requires '${t}' to be numeric, but its constant is ${JSON.stringify(a)}`,
156
+ context: {
157
+ aesthetic: t,
158
+ expected: "number",
159
+ actual: String(a)
160
+ },
161
+ suggestion: `Set '${t}' to a numeric constant.`
162
+ }];
163
+ const o = k(e);
164
+ if (r.size() === 0 || o === null || !r.hasVariable(o)) return [];
165
+ const n = r.getType(o);
166
+ return n === "numeric" ? [] : [{
167
+ code: "INCOMPATIBLE_TYPE",
168
+ message: `errorbar geom requires '${t}' to be numeric, but variable '${o}' is ${n}`,
169
+ context: {
170
+ aesthetic: t,
171
+ variableName: o,
172
+ variableType: n
173
+ },
174
+ suggestion: `Map '${t}' to a numeric variable.`
175
+ }];
176
+ }, b = (r, e) => {
177
+ const t = _(e);
178
+ if (typeof t == "number") return Array.from({ length: r.size() }, () => t);
179
+ const a = k(e);
180
+ return a === null || !r.hasVariable(a) ? null : r.getValues(a, { type: "numeric" });
181
+ }, ur = (r, e) => {
182
+ const t = b(r, e.error);
183
+ if (t !== null) {
184
+ const n = b(r, e.y);
185
+ return n === null ? null : er(n, t);
186
+ }
187
+ const a = b(r, e.lower), o = b(r, e.upper);
188
+ return a === null || o === null ? null : rr(a, o);
189
+ }, p = (r) => {
190
+ const e = "width" in r ? r.width : void 0;
191
+ return typeof e == "number" ? e : w;
192
+ }, L = (r, e, t) => {
193
+ const a = $(r), o = (r.end - r.start) * t / 2, n = {
194
+ from: y(e, a, r.low),
195
+ to: y(e, a, r.high)
196
+ };
197
+ return o === 0 ? {
198
+ stem: n,
199
+ caps: []
200
+ } : {
201
+ stem: n,
202
+ caps: [r.low, r.high].map((s) => ({
203
+ from: y(e, a - o, s),
204
+ to: y(e, a + o, s)
205
+ }))
206
+ };
207
+ }, y = (r, e, t) => {
208
+ const a = D(r, {
209
+ main: e,
210
+ cross: t
211
+ });
212
+ return {
213
+ x: j(a.x),
214
+ y: J(a.y)
215
+ };
216
+ }, lr = ({ layer: r, coordSystem: e, panelRect: t, styleReaders: a }) => {
217
+ const o = d(e), n = p(r.params);
218
+ return I(r.data, o).flatMap((s) => {
219
+ const u = a.get("strokeWidth", s.observation) ?? 0;
220
+ if (u <= 0) return [];
221
+ const { stem: l, caps: m } = L(s, o, n);
222
+ return [l, ...m].map((E) => ({
223
+ kind: "stroke",
224
+ pathData: dr(E, t),
225
+ width: u
226
+ }));
227
+ });
228
+ }, dr = (r, e) => {
229
+ const t = B(r.from, e), a = B(r.to, e);
230
+ return `M${t.x},${t.y}L${a.x},${a.y}`;
231
+ }, B = (r, e) => ({
232
+ x: r.x * e.width,
233
+ y: r.y * e.height
234
+ }), M = (r) => {
235
+ const e = R(r.data, r.mapping, r.id);
236
+ return (t) => e(t.observation);
237
+ }, S = ({ bars: r, mainAxis: e, capWidth: t, styleReaders: a, getKey: o, isHovered: n = !1, shouldAnimateTransitions: s = !1 }) => {
238
+ const u = n ? "hovered" : void 0;
239
+ return /* @__PURE__ */ i(Z, { children: r.flatMap((l) => {
240
+ const m = o(l), { stem: E, caps: O } = L(l, e, t);
241
+ return [{
242
+ key: `${m}-stem`,
243
+ testId: "errorbar-stem",
244
+ segment: E
245
+ }, ...O.map((c, K) => ({
246
+ key: `${m}-${K === 0 ? "lower" : "upper"}-cap`,
247
+ testId: "errorbar-cap",
248
+ segment: c
249
+ }))].map((c) => /* @__PURE__ */ i(cr, {
250
+ testId: c.testId,
251
+ segment: c.segment,
252
+ observation: l.observation,
253
+ styleReaders: a,
254
+ state: u,
255
+ shouldAnimateTransitions: s
256
+ }, c.key));
257
+ }) });
258
+ }, cr = ({ testId: r, segment: e, observation: t, styleReaders: a, state: o, shouldAnimateTransitions: n }) => {
259
+ const s = a.get("strokeWidth", t, o) ?? 0, u = a.get("stroke", t, o);
260
+ return /* @__PURE__ */ i(G, {
261
+ "data-testid": r,
262
+ x1: f(e.from.x),
263
+ y1: f(e.from.y),
264
+ x2: f(e.to.x),
265
+ y2: f(e.to.y),
266
+ stroke: u === void 0 ? void 0 : q(u),
267
+ strokeOpacity: a.get("alpha", t, o),
268
+ strokeWidth: s,
269
+ strokeDasharray: z(a.get("dashArray", t, o), s),
270
+ shouldAnimateTransitions: n
271
+ });
272
+ }, pr = ({ layer: r, sourceLayer: e, mainAxis: t, capWidth: a, styleReaders: o }) => /* @__PURE__ */ i(S, {
273
+ bars: h(() => I(r.data, t), [r.data, t]),
274
+ mainAxis: t,
275
+ capWidth: a,
276
+ styleReaders: o,
277
+ getKey: h(() => M(e), [e])
278
+ }), N = ({ layer: r, hit: e, mainAxis: t, capWidth: a, styleReaders: o }) => {
279
+ const n = h(() => M(r), [r]);
280
+ return /* @__PURE__ */ i("g", {
281
+ "data-testid": "hovered-errorbars",
282
+ children: /* @__PURE__ */ i(S, {
283
+ bars: I([e.observation], t),
284
+ mainAxis: t,
285
+ capWidth: a,
286
+ styleReaders: o,
287
+ getKey: n,
288
+ isHovered: !0
289
+ })
290
+ });
291
+ }, hr = ({ layer: r, mainAxis: e, capWidth: t, styleReaders: a, shouldAnimateTransitions: o, intro: n }) => {
292
+ const s = /* @__PURE__ */ i(S, {
293
+ bars: h(() => I(r.data, e), [r.data, e]),
294
+ mainAxis: e,
295
+ capWidth: t,
296
+ styleReaders: a,
297
+ getKey: h(() => M(r), [r]),
298
+ shouldAnimateTransitions: o
299
+ });
300
+ return n == null ? s : /* @__PURE__ */ i(H, {
301
+ intro: {
302
+ type: "fade",
303
+ layerId: n.layerId,
304
+ durationSeconds: n.durationSeconds
305
+ },
306
+ children: s
307
+ });
308
+ }, gr = Y(new nr(), {
309
+ coord: "cartesian",
310
+ swatchShape: "interval",
311
+ guideMode: "band",
312
+ render: ({ layer: r, coordSystem: e, styleReaders: t, shouldAnimateTransitions: a, intro: o }) => /* @__PURE__ */ i(hr, {
313
+ layer: r,
314
+ mainAxis: d(e),
315
+ capWidth: p(r.params),
316
+ styleReaders: t,
317
+ shouldAnimateTransitions: a,
318
+ intro: o
319
+ }),
320
+ renderHighlight: ({ layer: r, sourceLayer: e, coordSystem: t, styleReaders: a }) => /* @__PURE__ */ i(pr, {
321
+ layer: r,
322
+ sourceLayer: e,
323
+ mainAxis: d(t),
324
+ capWidth: p(r.params),
325
+ styleReaders: a
326
+ }),
327
+ renderHover: ({ layer: r, primary: e, coordSystem: t, styleReaders: a }) => /* @__PURE__ */ i(N, {
328
+ layer: r,
329
+ hit: e,
330
+ mainAxis: d(t),
331
+ capWidth: p(r.params),
332
+ styleReaders: a
333
+ }),
334
+ renderHoverCompanions: ({ layer: r, primary: e, related: t, coordSystem: a, styleReaders: o }) => {
335
+ const n = X(r, e, t);
336
+ return n === void 0 ? null : /* @__PURE__ */ i(N, {
337
+ layer: r,
338
+ hit: n,
339
+ mainAxis: d(a),
340
+ capWidth: p(r.params),
341
+ styleReaders: o
342
+ });
343
+ },
344
+ getEditOutlineShapes: lr
345
+ });
346
+ export {
347
+ g as ERRORBAR_VARIABLES,
348
+ nr as ErrorbarGeom,
349
+ gr as errorbar
350
+ };
@@ -0,0 +1,3 @@
1
+ import { EditOutlineShape, GeomEditOutlineShapesRendererInput } from '@graphysdk/react';
2
+ /** Outlines each stem and cap as the stroke it is painted; an error bar painted at no width has none. */
3
+ export declare const getErrorbarEditOutlineShapes: ({ layer, coordSystem, panelRect, styleReaders, }: GeomEditOutlineShapesRendererInput) => EditOutlineShape[];
@@ -0,0 +1,12 @@
1
+ import { GeomStyleReaders, MainAxis, SceneLayer } from '@graphysdk/react';
2
+ interface HighlightedErrorBarsProps {
3
+ layer: SceneLayer;
4
+ /** The whole layer the matched observations were taken from. */
5
+ sourceLayer: SceneLayer;
6
+ mainAxis: MainAxis;
7
+ capWidth: number;
8
+ styleReaders: GeomStyleReaders;
9
+ }
10
+ /** Repaints the matched error bars above the dimmed layer. */
11
+ export declare const HighlightedErrorBars: ({ layer, sourceLayer, mainAxis, capWidth, styleReaders, }: HighlightedErrorBarsProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,11 @@
1
+ import { GeomStyleReaders, HoverHit, MainAxis, SceneLayer } from '@graphysdk/react';
2
+ interface HoveredErrorBarsProps {
3
+ layer: SceneLayer;
4
+ hit: HoverHit;
5
+ mainAxis: MainAxis;
6
+ capWidth: number;
7
+ styleReaders: GeomStyleReaders;
8
+ }
9
+ /** Repaints the hovered error bar, or the one on the hovered observation it describes, above the dimmed layer. */
10
+ export declare const HoveredErrorBars: ({ layer, hit, mainAxis, capWidth, styleReaders }: HoveredErrorBarsProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,15 @@
1
+ import { GeomStyleReaders, LayerIntroPlan, MainAxis, SceneLayer } from '@graphysdk/react';
2
+ interface ErrorbarLayerProps {
3
+ layer: SceneLayer;
4
+ mainAxis: MainAxis;
5
+ capWidth: number;
6
+ styleReaders: GeomStyleReaders;
7
+ shouldAnimateTransitions: boolean;
8
+ intro: LayerIntroPlan | null | undefined;
9
+ }
10
+ /**
11
+ * Fades the layer in rather than taking a `rects` layer's grow-from-axis entrance, which would read each interval as
12
+ * a length from zero. The fade rides the group, so it plays even when `shouldAnimateTransitions` is off.
13
+ */
14
+ export declare const ErrorbarLayer: ({ layer, mainAxis, capWidth, styleReaders, shouldAnimateTransitions, intro, }: ErrorbarLayerProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,14 @@
1
+ import { GeomStyleReaders, MainAxis } from '@graphysdk/react';
2
+ import { ErrorBar } from '../utils/read-errorbar';
3
+ export interface ErrorbarPaintProps {
4
+ bars: readonly ErrorBar[];
5
+ mainAxis: MainAxis;
6
+ capWidth: number;
7
+ styleReaders: GeomStyleReaders;
8
+ /** Stable across data changes, so a mark springs rather than remounts. */
9
+ getKey: (bar: ErrorBar) => string;
10
+ isHovered?: boolean;
11
+ /** Only the layer's own paint springs; hover and highlight repaints mount with the interaction. */
12
+ shouldAnimateTransitions?: boolean;
13
+ }
14
+ export declare const ErrorbarPaint: ({ bars, mainAxis, capWidth, styleReaders, getKey, isHovered, shouldAnimateTransitions, }: ErrorbarPaintProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { BoundGeomRendererDefinition } from '@graphysdk/react';
2
+ import { ErrorbarGeom } from '../engine/errorbar.geom';
3
+ /**
4
+ * The error bar plugin: pass it to `createGraphyKit({ plugins: [errorbar] })` for `kit.geom.errorbar()`.
5
+ *
6
+ * @example
7
+ * const kit = createGraphyKit({ plugins: [errorbar] });
8
+ * const spec = kit.pipe(
9
+ * kit.createSpec({ x: 'treatment', y: 'mean' }),
10
+ * kit.geom.bar(),
11
+ * kit.geom.errorbar({ aes: { lower: 'ciLow', upper: 'ciHigh' } }),
12
+ * kit.scale.x.discrete(),
13
+ * kit.scale.y.continuous()
14
+ * );
15
+ */
16
+ export declare const errorbar: BoundGeomRendererDefinition<ErrorbarGeom>;
@@ -0,0 +1,13 @@
1
+ import { MainAxis, XYPoint } from '@graphysdk/react';
2
+ import { ErrorBar } from '../../utils/read-errorbar';
3
+ /** A straight line in the `[0, 1]` view box. */
4
+ export interface ViewBoxSegment {
5
+ from: XYPoint;
6
+ to: XYPoint;
7
+ }
8
+ /** `caps` is empty when the cap width is `0`. */
9
+ export interface ErrorBarSegments {
10
+ stem: ViewBoxSegment;
11
+ caps: ViewBoxSegment[];
12
+ }
13
+ export declare const readErrorBarSegments: (bar: ErrorBar, mainAxis: MainAxis, capWidth: number) => ErrorBarSegments;
@@ -0,0 +1,7 @@
1
+ import { SceneLayer } from '@graphysdk/react';
2
+ import { ErrorBar } from '../../utils/read-errorbar';
3
+ /**
4
+ * Keys on the raw category and group rather than the band position: the band moves with the domain, which a mark
5
+ * should spring through, not remount on.
6
+ */
7
+ export declare const createErrorbarKeys: (layer: SceneLayer) => ((bar: ErrorBar) => string);
@@ -0,0 +1,2 @@
1
+ /** The cap width a layer resolved to. `resolveParams` has already replaced an unreadable one with the default. */
2
+ export declare const readCapWidth: (params: object) => number;
@@ -0,0 +1,13 @@
1
+ import { MainAxis, Observation } from '@graphysdk/react';
2
+ /** An error bar's position in `[0, 1]` fractions: its dodged band share on the main axis, its interval on the other. */
3
+ export interface ErrorBar {
4
+ observation: Observation;
5
+ start: number;
6
+ end: number;
7
+ low: number;
8
+ high: number;
9
+ }
10
+ export declare const readErrorBarCentre: (bar: Pick<ErrorBar, "start" | "end">) => number;
11
+ /** Columns are already flipped: under `coord.flip()` the band share is `yMin`/`yMax`, the interval `xMin`/`xMax`. */
12
+ export declare const readErrorBar: (observation: Observation, mainAxis: MainAxis) => ErrorBar | null;
13
+ export declare const readErrorBars: (observations: Iterable<Observation>, mainAxis: MainAxis) => ErrorBar[];
@@ -0,0 +1,93 @@
1
+ # PolyForm Free Trial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/free-trial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the software
14
+ to do everything you might do with the software that would
15
+ otherwise infringe the licensor's copyright in it for any
16
+ permitted purpose. However, you may only make changes or
17
+ new works based on the software according to [Changes and New
18
+ Works License](#changes-and-new-works-license), and you may
19
+ not distribute copies of the software.
20
+
21
+ ## Changes and New Works License
22
+
23
+ The licensor grants you an additional copyright license to
24
+ make changes and new works based on the software for any
25
+ permitted purpose.
26
+
27
+ ## Patent License
28
+
29
+ The licensor grants you a patent license for the software that
30
+ covers patent claims the licensor can license, or becomes able
31
+ to license, that you would infringe by using the software.
32
+
33
+ ## Fair Use
34
+
35
+ You may have "fair use" rights for the software under the
36
+ law. These terms do not limit them.
37
+
38
+ ## Free Trial
39
+
40
+ Use to evaluate whether the software suits a particular
41
+ application for less than 32 consecutive calendar days, on
42
+ behalf of you or your company, is use for a permitted purpose.
43
+
44
+ ## No Other Rights
45
+
46
+ These terms do not allow you to sublicense or transfer any of
47
+ your licenses to anyone else, or prevent the licensor from
48
+ granting licenses to anyone else. These terms do not imply
49
+ any other licenses.
50
+
51
+ ## Patent Defense
52
+
53
+ If you make any written claim that the software infringes or
54
+ contributes to infringement of any patent, your patent license
55
+ for the software granted under these terms ends immediately. If
56
+ your company makes such a claim, your patent license ends
57
+ immediately for work on behalf of your company.
58
+
59
+ ## Violations
60
+
61
+ If you violate any of these terms, or do anything with the
62
+ software not covered by your licenses, all your licenses
63
+ end immediately.
64
+
65
+ ## No Liability
66
+
67
+ _**As far as the law allows, the software comes as is, without
68
+ any warranty or condition, and the licensor will not be liable
69
+ to you for any damages arising out of these terms or the use
70
+ or nature of the software, under any kind of legal claim.**_
71
+
72
+ ## Definitions
73
+
74
+ The **licensor** is the individual or entity offering these
75
+ terms, and the **software** is the software the licensor makes
76
+ available under these terms.
77
+
78
+ **You** refers to the individual or entity agreeing to these
79
+ terms.
80
+
81
+ **Your company** is any legal entity, sole proprietorship,
82
+ or other kind of organization that you work for, plus all
83
+ organizations that have control over, are under the control of,
84
+ or are under common control with that organization. **Control**
85
+ means ownership of substantially all the assets of an entity,
86
+ or the power to direct its management and policies by vote,
87
+ contract, or otherwise. Control can be direct or indirect.
88
+
89
+ **Your licenses** are all the licenses granted to you for the
90
+ software under these terms.
91
+
92
+ **Use** means anything you do with the software requiring one
93
+ of your licenses.
@@ -0,0 +1,131 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Graphy Technologies Ltd. (https://graphy.dev)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or done anything with the software
97
+ not covered by your licenses, your licenses can nonetheless
98
+ continue if you come into full compliance with these terms,
99
+ and take practical steps to correct past violations, within
100
+ 32 days of receiving notice. Otherwise, all your licenses
101
+ end immediately.
102
+
103
+ ## No Liability
104
+
105
+ _**As far as the law allows, the software comes as is, without
106
+ any warranty or condition, and the licensor will not be liable
107
+ to you for any damages arising out of these terms or the use
108
+ or nature of the software, under any kind of legal claim.**_
109
+
110
+ ## Definitions
111
+
112
+ The **licensor** is the individual or entity offering these
113
+ terms, and the **software** is the software the licensor makes
114
+ available under these terms.
115
+
116
+ **You** refers to the individual or entity agreeing to these
117
+ terms.
118
+
119
+ **Your company** is any legal entity, sole proprietorship,
120
+ or other kind of organization that you work for, plus all
121
+ organizations that have control over, are under the control of,
122
+ or are under common control with that organization. **Control**
123
+ means ownership of substantially all the assets of an entity,
124
+ or the power to direct its management and policies by vote,
125
+ contract, or otherwise. Control can be direct or indirect.
126
+
127
+ **Your licenses** are all the licenses granted to you for the
128
+ software under these terms.
129
+
130
+ **Use** means anything you do with the software requiring one
131
+ of your licenses.
@@ -0,0 +1,121 @@
1
+ # PolyForm Small Business License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/small-business/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Graphy Technologies Ltd. (https://graphy.dev)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Fair Use
53
+
54
+ You may have "fair use" rights for the software under the
55
+ law. These terms do not limit them.
56
+
57
+ ## Small Business
58
+
59
+ Use of the software for the benefit of your company is use for
60
+ a permitted purpose if your company has fewer than 100 total
61
+ individuals working as employees and independent contractors,
62
+ and less than 1,000,000 USD (2019) total revenue in the prior
63
+ tax year. Adjust this revenue threshold for inflation according
64
+ to the United States Bureau of Labor Statistics' consumer price
65
+ index for all urban consumers, U.S. city average, for all items,
66
+ not seasonally adjusted, with 1982–1984=100 reference base.
67
+
68
+ ## No Other Rights
69
+
70
+ These terms do not allow you to sublicense or transfer any of
71
+ your licenses to anyone else, or prevent the licensor from
72
+ granting licenses to anyone else. These terms do not imply
73
+ any other licenses.
74
+
75
+ ## Patent Defense
76
+
77
+ If you make any written claim that the software infringes or
78
+ contributes to infringement of any patent, your patent license
79
+ for the software granted under these terms ends immediately. If
80
+ your company makes such a claim, your patent license ends
81
+ immediately for work on behalf of your company.
82
+
83
+ ## Violations
84
+
85
+ The first time you are notified in writing that you have
86
+ violated any of these terms, or done anything with the software
87
+ not covered by your licenses, your licenses can nonetheless
88
+ continue if you come into full compliance with these terms,
89
+ and take practical steps to correct past violations, within
90
+ 32 days of receiving notice. Otherwise, all your licenses
91
+ end immediately.
92
+
93
+ ## No Liability
94
+
95
+ _**As far as the law allows, the software comes as is, without
96
+ any warranty or condition, and the licensor will not be liable
97
+ to you for any damages arising out of these terms or the use
98
+ or nature of the software, under any kind of legal claim.**_
99
+
100
+ ## Definitions
101
+
102
+ The **licensor** is the individual or entity offering these
103
+ terms, and the **software** is the software the licensor makes
104
+ available under these terms.
105
+
106
+ **You** refers to the individual or entity agreeing to these
107
+ terms.
108
+
109
+ **Your company** is any legal entity, sole proprietorship,
110
+ or other kind of organization that you work for, plus all
111
+ organizations that have control over, are under the control of,
112
+ or are under common control with that organization. **Control**
113
+ means ownership of substantially all the assets of an entity,
114
+ or the power to direct its management and policies by vote,
115
+ contract, or otherwise. Control can be direct or indirect.
116
+
117
+ **Your licenses** are all the licenses granted to you for the
118
+ software under these terms.
119
+
120
+ **Use** means anything you do with the software requiring one
121
+ of your licenses.
package/package.json CHANGED
@@ -1,6 +1,75 @@
1
1
  {
2
2
  "name": "@graphysdk/geom-error-bar",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "author": "Graphy",
4
+ "description": "Error bar geom for the Graphy charting SDK (beta)",
5
+ "homepage": "https://docs.graphy.dev/sdk-next/graph-types/error-bar",
6
+ "license": "SEE LICENSE IN LICENSE.md",
7
+ "keywords": [
8
+ "graphy",
9
+ "chart",
10
+ "react",
11
+ "visualization",
12
+ "grammar-of-graphics",
13
+ "errorbar",
14
+ "error-bar",
15
+ "confidence-interval"
16
+ ],
17
+ "version": "0.1.1-beta.1792421638596",
18
+ "type": "module",
19
+ "sideEffects": false,
20
+ "types": "./dist/index.d.ts",
21
+ "files": [
22
+ "dist",
23
+ "LICENSE.md",
24
+ "licenses",
25
+ "README.md"
26
+ ],
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.mjs",
31
+ "require": "./dist/index.cjs"
32
+ }
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^19.0.0",
36
+ "@graphysdk/react": "^1.9.0-beta.1792421638596"
37
+ },
38
+ "devDependencies": {
39
+ "@testing-library/react": "^16.3.1",
40
+ "@types/react": "^19.2.14",
41
+ "@types/react-dom": "^19.2.3",
42
+ "react": "^19.2.4",
43
+ "react-dom": "^19.2.4",
44
+ "rollup-plugin-node-externals": "^8.1.1",
45
+ "vite": "^8.1.5",
46
+ "vite-plugin-dts": "^4.5.4",
47
+ "vitest": "^4.1.11",
48
+ "@graphytools/eslint-config": "0.0.1",
49
+ "@graphytools/typescript-config": "0.0.1",
50
+ "@graphysdk/react": "1.9.0-beta.1792421638596",
51
+ "@graphysdk/viz-engine": "1.9.0-beta.1792421638596",
52
+ "@graphytools/vitest-config": "1.0.0"
53
+ },
54
+ "publishConfig": {
55
+ "access": "public"
56
+ },
57
+ "lint-staged": {
58
+ "*.{ts,tsx,js,jsx,json,css,md}": [
59
+ "prettier --write"
60
+ ],
61
+ "*.{ts,tsx}": [
62
+ "eslint --max-warnings=0 --fix"
63
+ ]
64
+ },
65
+ "scripts": {
66
+ "build": "vite build",
67
+ "test": "vitest run",
68
+ "test:watch": "TZ=utc vitest",
69
+ "lint": "eslint . --max-warnings 0",
70
+ "lint:fix": "eslint . --fix",
71
+ "format": "prettier --write .",
72
+ "format:check": "prettier --check .",
73
+ "typecheck": "tsc --noEmit"
74
+ }
6
75
  }