@graphysdk/geom-mekko 0.0.0-stage → 0.1.0
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 +17 -0
- package/README.md +54 -2
- package/dist/engine/mekko-columns.d.ts +9 -0
- package/dist/engine/mekko-data-labels.d.ts +6 -0
- package/dist/engine/mekko-params.d.ts +11 -0
- package/dist/engine/mekko.geom.d.ts +86 -0
- package/dist/engine/mekko.stat.d.ts +12 -0
- package/dist/engine/utils/measure-cells.d.ts +23 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +374 -0
- package/dist/renderer/mekko-edit-outline.d.ts +3 -0
- package/dist/renderer/mekko-highlight.d.ts +11 -0
- package/dist/renderer/mekko-hover.d.ts +10 -0
- package/dist/renderer/mekko-layer.d.ts +14 -0
- package/dist/renderer/mekko-paint.d.ts +13 -0
- package/dist/renderer/mekko.d.ts +15 -0
- package/dist/renderer/utils/mekko-keys.d.ts +4 -0
- package/dist/utils/cell-geometry.d.ts +16 -0
- package/dist/utils/read-mekko.d.ts +18 -0
- package/licenses/PolyForm-Free-Trial-1.0.0.md +93 -0
- package/licenses/PolyForm-NonCommercial-1.0.0.md +131 -0
- package/licenses/PolyForm-Small-Business-1.0.0.md +121 -0
- package/package.json +72 -3
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,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @graphysdk/geom-mekko
|
|
2
2
|
|
|
3
|
-
This
|
|
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
|
+
A Marimekko geom for the Graphy charting SDK. It draws a 100% stacked column chart whose columns are as wide as their totals, so each cell's area is its share of the whole: a market's size across, each company's share of it up.
|
|
6
|
+
|
|
7
|
+
Learn more at [graphy.dev](https://graphy.dev).
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @graphysdk/geom-mekko @graphysdk/react
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires React 19. Its only peer is `@graphysdk/react`.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Data is one row per cell. Map the column to `x`, the cell's amount to `y` and its group to `color`. The share axis is continuous, so declare `scale.x.continuous()`; it is ticked with each column's name at its center:
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { createGraphyKit, GraphRenderer } from '@graphysdk/react';
|
|
23
|
+
import { mekko } from '@graphysdk/geom-mekko';
|
|
24
|
+
|
|
25
|
+
const kit = createGraphyKit({ plugins: [mekko] });
|
|
26
|
+
|
|
27
|
+
const spec = kit.pipe(
|
|
28
|
+
kit.createSpec({ x: 'market', y: 'revenue', color: 'company' }),
|
|
29
|
+
kit.geom.mekko(),
|
|
30
|
+
kit.scale.x.continuous(),
|
|
31
|
+
kit.scale.y.continuous()
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
export function Markets({ data }) {
|
|
35
|
+
return (
|
|
36
|
+
<kit.GraphProvider spec={spec} data={data}>
|
|
37
|
+
<GraphRenderer />
|
|
38
|
+
</kit.GraphProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Add `kit.coord.flip()` for a horizontal mekko. Style the cells with `kit.style.geom.mekko()`.
|
|
44
|
+
|
|
45
|
+
## Docs
|
|
46
|
+
|
|
47
|
+
- [Mekko](https://docs.graphy.dev/sdk-next/graph-types/mekko)
|
|
48
|
+
|
|
49
|
+
## Feedback
|
|
50
|
+
|
|
51
|
+
This geom is released early to hear what works. Tell us on [Discord](https://discord.gg/yGmYCjkSr).
|
|
52
|
+
|
|
53
|
+
## Licence
|
|
54
|
+
|
|
55
|
+
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).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Columns the stat writes, as `percentage` fractions. Public: authors name them in a `label`, `highlight` or `where`.
|
|
3
|
+
*/
|
|
4
|
+
export declare const MEKKO_COLUMNS: {
|
|
5
|
+
/** A cell's share of its column: what its height encodes, and what the value axis reads. */
|
|
6
|
+
readonly shareOfColumn: "mekkoShareOfColumn";
|
|
7
|
+
/** The cell's column's share of the grand total: what the column's width encodes. */
|
|
8
|
+
readonly columnShare: "mekkoColumnShare";
|
|
9
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PlacementResult, PluginPlacementContext } from '@graphysdk/react';
|
|
2
|
+
/**
|
|
3
|
+
* A label per cell. Cells tile the panel, so under `'auto'` a label that does not fit centered inside its cell is
|
|
4
|
+
* dropped rather than moved onto a neighbour. An explicit position is honoured as written.
|
|
5
|
+
*/
|
|
6
|
+
export declare const placeMekkoDataLabels: (context: PluginPlacementContext) => PlacementResult;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** A column's key as an author names it in `sort`. */
|
|
2
|
+
export type MekkoColumnKey = string | number;
|
|
3
|
+
/** Column order: by first row, by total, or as listed. Unlisted columns follow the listed ones, in data order. */
|
|
4
|
+
export type MekkoColumnSort = 'data' | 'ascending' | 'descending' | readonly MekkoColumnKey[];
|
|
5
|
+
/** Read by the stat, since they decide where a cell sits. */
|
|
6
|
+
export interface MekkoGeomParams {
|
|
7
|
+
/** The order the columns run in. Defaults to `'data'`. */
|
|
8
|
+
sort?: MekkoColumnSort;
|
|
9
|
+
}
|
|
10
|
+
export declare const isColumnSort: (value: unknown) => value is MekkoColumnSort;
|
|
11
|
+
export declare const readColumnSort: (params: Readonly<Record<string, unknown>> | undefined) => MekkoColumnSort;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { AnchorContext, AnchorPosition, GeomCompileResult, GeomCompilerInput, GeomMappingValidationInput, GeomObservationPart, GeomStyleTarget, Observation, PlacementResult, PluginPlacementContext, UserInputIssue, Geom } from '@graphysdk/react';
|
|
2
|
+
import { MekkoStat } from './mekko.stat';
|
|
3
|
+
import { MekkoGeomParams } from './mekko-params';
|
|
4
|
+
/** Adds the width of the border that parts one cell from the next. */
|
|
5
|
+
declare const CELL_VOCABULARY: {
|
|
6
|
+
readonly strokeWidth: "pixels";
|
|
7
|
+
};
|
|
8
|
+
/** Named so the published types reach the observations through `@graphysdk/react`, the package's one peer. */
|
|
9
|
+
interface MekkoStyleTarget extends GeomStyleTarget {
|
|
10
|
+
observation: GeomObservationPart<typeof CELL_VOCABULARY>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A Marimekko chart: a 100% stacked column chart whose columns are as wide as their totals, so each cell's area is
|
|
14
|
+
* its share of the whole. One row per cell: `x` the column, `y` its amount, `color` its group. Both axes run 0 to
|
|
15
|
+
* 100%; the main axis is ticked at each column's center with its name. Horizontal is `coord.flip()`.
|
|
16
|
+
*/
|
|
17
|
+
export declare class MekkoGeom extends Geom<MekkoGeomParams> {
|
|
18
|
+
readonly type: "mekko";
|
|
19
|
+
readonly defaultParams: MekkoGeomParams;
|
|
20
|
+
readonly defaultStat: MekkoStat;
|
|
21
|
+
/** A cell is an `x` interval spanning one category by a `y` interval; its share of the column stands in for `y`. */
|
|
22
|
+
readonly positionRoles: readonly [{
|
|
23
|
+
readonly axis: "x";
|
|
24
|
+
readonly role: "min";
|
|
25
|
+
readonly valueKind: "value";
|
|
26
|
+
}, {
|
|
27
|
+
readonly axis: "x";
|
|
28
|
+
readonly role: "max";
|
|
29
|
+
readonly valueKind: "value";
|
|
30
|
+
}, {
|
|
31
|
+
readonly axis: "y";
|
|
32
|
+
readonly role: "min";
|
|
33
|
+
readonly valueKind: "value";
|
|
34
|
+
}, {
|
|
35
|
+
readonly axis: "y";
|
|
36
|
+
readonly role: "max";
|
|
37
|
+
readonly valueKind: "value";
|
|
38
|
+
readonly aes: "y";
|
|
39
|
+
}];
|
|
40
|
+
readonly aesthetics: readonly [{
|
|
41
|
+
readonly kind: "visual";
|
|
42
|
+
readonly name: "color";
|
|
43
|
+
}, {
|
|
44
|
+
readonly kind: "visual";
|
|
45
|
+
readonly name: "alpha";
|
|
46
|
+
}, {
|
|
47
|
+
readonly kind: "data";
|
|
48
|
+
readonly name: "value";
|
|
49
|
+
}, {
|
|
50
|
+
readonly kind: "data";
|
|
51
|
+
readonly name: "columnShare";
|
|
52
|
+
}];
|
|
53
|
+
readonly derivedVariables: ("mekkoShareOfColumn" | "mekkoColumnShare")[];
|
|
54
|
+
/** The stat already places every cell; there is nothing to stack or dodge. */
|
|
55
|
+
readonly supportedPositions: readonly ["identity"];
|
|
56
|
+
readonly supportedCoordTypes: readonly ["cartesian", "flip"];
|
|
57
|
+
/** Each `x` interval spans one column, so the main axis names its columns at their centers rather than printing percentages. */
|
|
58
|
+
readonly categorySpanAxes: readonly ["x"];
|
|
59
|
+
/** A grid line at each column's center would cut through the column it names. */
|
|
60
|
+
readonly grid: {
|
|
61
|
+
cartesian: {
|
|
62
|
+
hideGridX: boolean;
|
|
63
|
+
};
|
|
64
|
+
flip: {
|
|
65
|
+
hideGridX: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
readonly legend: {
|
|
69
|
+
suppressWhenSingleItem: boolean;
|
|
70
|
+
};
|
|
71
|
+
readonly dataLabelCoordTypes: readonly ["cartesian", "flip"];
|
|
72
|
+
readonly getDataLabelPlacements: (context: PluginPlacementContext) => PlacementResult;
|
|
73
|
+
/** Each cell hovers as one unit, like a stacked bar's segment. */
|
|
74
|
+
readonly spatialKind = "rects";
|
|
75
|
+
readonly highlightStrategy: "observation-rerender";
|
|
76
|
+
readonly styleTarget: MekkoStyleTarget;
|
|
77
|
+
/** Only the `mekko` stat lays cells out, and it computes `value` and `columnShare`, overwriting any mapping. */
|
|
78
|
+
readonly validateMapping: ({ mapping, computedVariables, }: GeomMappingValidationInput) => readonly UserInputIssue[];
|
|
79
|
+
/** Drops a `sort` the stat cannot read and reports it, so the columns fall back to data order. */
|
|
80
|
+
resolveParams(options: Parameters<Geom['resolveParams']>[0]): Record<string, unknown>;
|
|
81
|
+
/** Anchors annotations at the cell's center: a mekko is read by area, not by an end. */
|
|
82
|
+
readonly resolveAnchorPosition: (observation: Observation, { coordSystem }: AnchorContext) => AnchorPosition | null;
|
|
83
|
+
/** The stat has laid the cells out; nothing is left to compute. */
|
|
84
|
+
compile({ data }: GeomCompilerInput): GeomCompileResult;
|
|
85
|
+
}
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StatCompileResult, StatCompilerInput, Stat } from '@graphysdk/react';
|
|
2
|
+
/** Every aesthetic the layout provides from `x` and `y`, so a layer under this stat maps none of them itself. */
|
|
3
|
+
export declare const MEKKO_STAT_AESTHETICS: ReadonlySet<string>;
|
|
4
|
+
/**
|
|
5
|
+
* Sums `y` per column and group, then lays the cells out. `y` becomes the share of the column, which the value
|
|
6
|
+
* axis reads; the summed amount moves to `value`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MekkoStat extends Stat {
|
|
9
|
+
readonly type: "mekko";
|
|
10
|
+
readonly computedVariables: ReadonlySet<string>;
|
|
11
|
+
protected computeStat({ data, mapping, params }: StatCompilerInput): StatCompileResult;
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MekkoColumnSort } from '../mekko-params';
|
|
2
|
+
/** Where one cell sits in the unit square, and the two shares that place it, all as fractions of `1`. */
|
|
3
|
+
export interface Cell {
|
|
4
|
+
/** The column's two edges along the main axis. */
|
|
5
|
+
columnStart: number;
|
|
6
|
+
columnEnd: number;
|
|
7
|
+
/** The cell's two ends within its column, lower first. */
|
|
8
|
+
cellStart: number;
|
|
9
|
+
cellEnd: number;
|
|
10
|
+
shareOfColumn: number;
|
|
11
|
+
columnShare: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reads a cell's value as what it draws: a positive amount, so a missing, zero, negative or non-finite value draws
|
|
15
|
+
* nothing and adds nothing to its column's width. A zero would draw a cell with no height that hover still finds.
|
|
16
|
+
*/
|
|
17
|
+
export declare const readCellValue: (value: number | null) => number | null;
|
|
18
|
+
/**
|
|
19
|
+
* Each column is as wide as its total's share of the grand total, in `sort` order; each cell as tall as its share
|
|
20
|
+
* of its column. Cells stack by their group's first appearance in the data, so a group keeps its place in every
|
|
21
|
+
* column and matches the legend. `null` for a cell with no value or a zero total.
|
|
22
|
+
*/
|
|
23
|
+
export declare const measureCells: (columnKeys: readonly unknown[], groupKeys: readonly unknown[], values: ReadonlyArray<number | null>, sort?: MekkoColumnSort) => Array<Cell | null>;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let n=require("@graphysdk/react"),x=require("react"),f=require("react/jsx-runtime");var V=(e,t)=>{const a=t==="x"?(0,n.getXMin)(e):(0,n.getYMin)(e),o=t==="x"?(0,n.getXMax)(e):(0,n.getYMax)(e),r=t==="x"?(0,n.getYMin)(e):(0,n.getXMin)(e),s=t==="x"?(0,n.getYMax)(e):(0,n.getXMax)(e);return a===null||o===null||r===null||s===null?null:{observation:e,columnStart:a,columnEnd:o,low:r,high:s}},S=(e,t)=>{const a=[];for(const o of e){const r=V(o,t);r!==null&&a.push(r)}return a},w=e=>e===null||!Number.isFinite(e)||e<=0?null:e,B=(e,t,a,o="data")=>{const r=a.map(w),s=I(t),l=e.map((d,c)=>c).sort((d,c)=>(s.get(t[d])??0)-(s.get(t[c])??0)),u=new Map;for(const d of l){const c=e[d],m=r[d];c===null||m===null||m===void 0||u.set(c,(u.get(c)??0)+m)}const v=new Map;let h=0;for(const[d,c]of j([...u],o)){const m=h;h+=c,v.set(d,{start:m,end:h})}const i=h;if(i===0)return r.map(()=>null);const g=r.map(()=>null),p=new Map;for(const d of l){const c=e[d],m=r[d],k=u.get(c),b=v.get(c);if(m==null||k===void 0||k===0||b===void 0)continue;const M=p.get(c)??0;p.set(c,M+m),g[d]={columnStart:b.start/i,columnEnd:b.end/i,cellStart:M/k,cellEnd:(M+m)/k,shareOfColumn:m/k,columnShare:k/i}}return g},I=e=>{const t=new Map;for(const a of e)t.has(a)||t.set(a,t.size);return t},j=(e,t)=>{if(t==="data")return e;if(t==="ascending")return[...e].sort(([,r],[,s])=>r-s);if(t==="descending")return[...e].sort(([,r],[,s])=>s-r);const a=I(t),o=r=>a.get(r)??a.size;return[...e].sort(([r],[s])=>o(r)-o(s))},y={shareOfColumn:"mekkoShareOfColumn",columnShare:"mekkoColumnShare"},G=["data","ascending","descending"],P=e=>G.includes(e)||Array.isArray(e)&&e.every(t=>typeof t=="string"||typeof t=="number"),D=e=>{const t=e?.sort;return P(t)?t:"data"},E=new Set(["value","columnShare"]),O="mekkoAmount",K=class extends n.Stat{constructor(...e){super(...e),this.type="mekko",this.computedVariables=E}computeStat({data:e,mapping:t,params:a}){const o=(0,n.readVariableName)(t.x),r=(0,n.readVariableName)(t.y);if(o===null||r===null||!e.hasVariable(o)||!e.hasVariable(r))return{data:e,mapping:{}};if(e.size()>0&&e.getType(r)!=="numeric"){const u=e.getType(r);throw new n.UserInputError({code:"INCOMPATIBLE_TYPE",message:`'mekko' stat requires a numeric 'y' (got '${u}' for variable '${r}')`,context:{aesthetic:"y",variableName:r,variableType:u},suggestion:"Map each cell's amount to 'y'."})}const s=(0,n.getGroupVariables)(e,t).filter(u=>u!==o),l=H(e,o,r,s);return{data:R(l,o,r,s,D(a)),mapping:{y:y.shareOfColumn,value:r,columnShare:y.columnShare}}}},H=(e,t,a,o)=>{const r=e.getValues(a,{type:"numeric"}).map(w);return e.addVariable(O,"numeric",r,e.getValueFormat(a)).groupBy(t,...o).rollup({[a]:{variableName:O,aggregation:"sum"}})},R=(e,t,a,o,r)=>{const s=o.map(i=>e.getValues(i)),l=Array.from({length:e.size()},(i,g)=>JSON.stringify(s.map(p=>p[g]))),u=B(e.getValues(t).map(X),l,e.getValues(a,{type:"numeric"}),r),v={type:"percentage"},h=i=>u.map(g=>g===null?null:i(g));return e.addVariable(y.shareOfColumn,"numeric",h(i=>i.shareOfColumn),v).addVariable(y.columnShare,"numeric",h(i=>i.columnShare),v).addVariable(n.POSITION_VARIABLES.xMin,"numeric",h(i=>i.columnStart)).addVariable(n.POSITION_VARIABLES.xMax,"numeric",h(i=>i.columnEnd)).addVariable(n.POSITION_VARIABLES.yMin,"numeric",h(i=>i.cellStart)).addVariable(n.POSITION_VARIABLES.yMax,"numeric",h(i=>i.cellEnd))},X=e=>e instanceof Date?e.getTime():e,_=(e,t)=>{const a=(0,n.composePoint)(t,{main:e.columnStart,cross:e.low}),o=(0,n.composePoint)(t,{main:e.columnEnd,cross:e.high}),[r,s]=T((0,n.toViewBoxX)(a.x),(0,n.toViewBoxX)(o.x)),[l,u]=T((0,n.toViewBoxY)(a.y),(0,n.toViewBoxY)(o.y));return{x:r,y:l,width:s-r,height:u-l}},L=(e,t,a)=>{const o=_(e,t);return{x:o.x*a.width,y:o.y*a.height,width:o.width*a.width,height:o.height*a.height}},T=(e,t)=>e<=t?[e,t]:[t,e],$=e=>{const t=[];if(!e.layer.dataLabels.showDataLabels)return{labels:t,droppedCount:0};const{position:a,justify:o,align:r,offset:s}=e.layer.dataLabels,l=a==="auto",u=l?"inside":a,v=(0,n.readMainAxis)(e.coordSystem),h=(0,n.buildPanelAnchorBox)(e.panelRect);let i=0;for(const g of S(e.layer.data,v)){const p=e.formatLabel(g.observation);if(p==="")continue;const{width:d,height:c}=e.measureDataLabel("observation",u,p),m=(0,n.resolveAnchoredLabelCenter)({box:L(g,v,e.panelRect),panel:h,orientation:v==="x"?{valueAxis:"y",valueDirectionSign:-1}:{valueAxis:"x",valueDirectionSign:1},placement:u,justify:l?"center":o,align:l?"center":r,offset:s,labelWidth:d,labelHeight:c});if(l&&m.position!=="inside"){i+=1;continue}t.push({layerId:e.layer.id,x:m.x,y:m.y,text:p,width:d,height:c,isRotated:!1,role:"observation",position:m.position,backdropColor:m.position==="inside"?(0,n.readBackdropColor)(e.styleReaders,g.observation):void 0})}return{labels:t,droppedCount:i}},W=1,Y={strokeWidth:"pixels"},N=class extends n.Geom{constructor(...e){super(...e),this.type="mekko",this.defaultParams={},this.defaultStat=new K,this.positionRoles=[{axis:"x",role:"min",valueKind:"value"},{axis:"x",role:"max",valueKind:"value"},{axis:"y",role:"min",valueKind:"value"},{axis:"y",role:"max",valueKind:"value",aes:"y"}],this.aesthetics=[{kind:"visual",name:"color"},{kind:"visual",name:"alpha"},{kind:"data",name:"value"},{kind:"data",name:"columnShare"}],this.derivedVariables=[y.shareOfColumn,y.columnShare],this.supportedPositions=["identity"],this.supportedCoordTypes=["cartesian","flip"],this.categorySpanAxes=["x"],this.grid={cartesian:{hideGridX:!0},flip:{hideGridX:!0}},this.legend={suppressWhenSingleItem:!0},this.dataLabelCoordTypes=["cartesian","flip"],this.getDataLabelPlacements=$,this.spatialKind="rects",this.highlightStrategy="observation-rerender",this.styleTarget=(0,n.defineGeomStyleTarget)({observation:{vocabulary:Y,aesthetics:{fill:"color",alpha:"alpha"},rest:{fill:(0,n.token)("geom"),fillAlpha:1,stroke:(0,n.token)("graphBackground"),strokeWidth:W}}}),this.validateMapping=({mapping:t,computedVariables:a})=>a.has("columnShare")?[...E].filter(o=>t[o]!==void 0).map(o=>({code:"CONFLICTING_STAT_MAPPING",message:`mekko stat computes '${o}' from 'x' and 'y'; remove its mapping`})):[{code:"MISSING_STAT_OUTPUT",message:"mekko geom lays its cells out in the 'mekko' stat; remove the layer's stat"}],this.resolveAnchorPosition=(t,{coordSystem:a})=>{const o=(0,n.readMainAxis)(a),r=V(t,o);if(r===null)return null;const s=(r.columnStart+r.columnEnd)/2,l=(r.low+r.high)/2;return o==="x"?{x:s,y:l}:{x:l,y:s}}}resolveParams(e){const{sort:t,...a}=super.resolveParams(e);return t===void 0||P(t)?t===void 0?a:{...a,sort:t}:(e.diagnostics?.addWarning({code:"INVALID_GEOM_PARAM",message:`Mekko sort must be 'data', 'ascending', 'descending' or a list of columns, got ${JSON.stringify(t)}; falling back to 'data'.`,context:{geom:"mekko",param:"sort",expected:"'data' | 'ascending' | 'descending' | columns[]"},suggestion:"Set params.sort to 'descending' to run the columns largest first, or list them in order."}),a)}compile({data:e}){return{data:e,mapping:{}}}},F=({layer:e,coordSystem:t,panelRect:a})=>{const o=(0,n.readMainAxis)(t);return S(e.data,o).map(r=>{const s=L(r,o,a),l=s.x+s.width,u=s.y+s.height;return{kind:"region",pathData:`M${s.x},${s.y}H${l}V${u}H${s.x}Z`}})},C=e=>{const t=(0,n.createStableKeyGenerator)(e.data,e.mapping,e.id);return a=>t(a.observation)},A=({cells:e,mainAxis:t,styleReaders:a,getKey:o,isHovered:r=!1,shouldAnimateTransitions:s=!1})=>{const l=r?"hovered":void 0,u=(0,x.useMemo)(()=>e.map(i=>a.get("fill",i.observation,l)??"transparent"),[e,a,l]),{fillFor:v,defs:h}=(0,n.usePaintDefs)({paints:u});return(0,f.jsxs)(f.Fragment,{children:[h,e.map((i,g)=>{const p=_(i,t),d=u[g],c=a.get("stroke",i.observation,l);return(0,f.jsx)(n.GeomRect,{"data-testid":"mekko-cell",x:(0,n.toPercent)(p.x),y:(0,n.toPercent)(p.y),width:(0,n.toPercent)(p.width),height:(0,n.toPercent)(p.height),fill:d===void 0?void 0:v(d),opacity:a.get("alpha",i.observation,l),fillOpacity:a.get("fillAlpha",i.observation,l),stroke:c===void 0?void 0:(0,n.toPaintColor)(c),strokeWidth:a.get("strokeWidth",i.observation,l),shouldAnimateTransitions:s},o(i))})]})},U=({layer:e,sourceLayer:t,mainAxis:a,styleReaders:o})=>(0,f.jsx)(A,{cells:(0,x.useMemo)(()=>S(e.data,a),[e.data,a]),mainAxis:a,styleReaders:o,getKey:(0,x.useMemo)(()=>C(t),[t])}),q=({layer:e,primary:t,mainAxis:a,styleReaders:o})=>(0,f.jsx)("g",{"data-testid":"hovered-cells",children:(0,f.jsx)(A,{cells:S([t.observation],a),mainAxis:a,styleReaders:o,getKey:(0,x.useMemo)(()=>C(e),[e]),isHovered:!0})}),z=({layer:e,mainAxis:t,styleReaders:a,shouldAnimateTransitions:o,intro:r})=>{const s=(0,f.jsx)(A,{cells:(0,x.useMemo)(()=>S(e.data,t),[e.data,t]),mainAxis:t,styleReaders:a,getKey:(0,x.useMemo)(()=>C(e),[e]),shouldAnimateTransitions:o});return r==null?s:(0,f.jsx)(n.IntroFade,{intro:{type:"fade",layerId:r.layerId,durationSeconds:r.durationSeconds},children:s})},J=(0,n.defineGeomRenderer)(new N,{coord:"cartesian",swatchShape:"square",render:({layer:e,coordSystem:t,styleReaders:a,shouldAnimateTransitions:o,intro:r})=>(0,f.jsx)(z,{layer:e,mainAxis:(0,n.readMainAxis)(t),styleReaders:a,shouldAnimateTransitions:o,intro:r}),renderHighlight:({layer:e,sourceLayer:t,coordSystem:a,styleReaders:o})=>(0,f.jsx)(U,{layer:e,sourceLayer:t,mainAxis:(0,n.readMainAxis)(a),styleReaders:o}),renderHover:({layer:e,primary:t,coordSystem:a,styleReaders:o})=>(0,f.jsx)(q,{layer:e,primary:t,mainAxis:(0,n.readMainAxis)(a),styleReaders:o}),renderHoverCompanions:()=>null,getEditOutlineShapes:F});exports.MekkoGeom=N;exports.mekko=J;
|
package/dist/index.d.ts
ADDED
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { Geom as X, GeomRect as Y, IntroFade as j, POSITION_VARIABLES as b, Stat as z, UserInputError as q, buildPanelAnchorBox as J, composePoint as O, createStableKeyGenerator as Z, defineGeomRenderer as Q, defineGeomStyleTarget as ee, getGroupVariables as te, getXMax as V, getXMin as E, getYMax as P, getYMin as I, readBackdropColor as re, readMainAxis as k, readVariableName as L, resolveAnchoredLabelCenter as ae, toPaintColor as oe, toPercent as C, toViewBoxX as _, toViewBoxY as N, token as B, usePaintDefs as ne } from "@graphysdk/react";
|
|
2
|
+
import { useMemo as y } from "react";
|
|
3
|
+
import { Fragment as se, jsx as f, jsxs as ie } from "react/jsx-runtime";
|
|
4
|
+
var K = (e, t) => {
|
|
5
|
+
const r = t === "x" ? E(e) : I(e), o = t === "x" ? V(e) : P(e), a = t === "x" ? I(e) : E(e), n = t === "x" ? P(e) : V(e);
|
|
6
|
+
return r === null || o === null || a === null || n === null ? null : {
|
|
7
|
+
observation: e,
|
|
8
|
+
columnStart: r,
|
|
9
|
+
columnEnd: o,
|
|
10
|
+
low: a,
|
|
11
|
+
high: n
|
|
12
|
+
};
|
|
13
|
+
}, x = (e, t) => {
|
|
14
|
+
const r = [];
|
|
15
|
+
for (const o of e) {
|
|
16
|
+
const a = K(o, t);
|
|
17
|
+
a !== null && r.push(a);
|
|
18
|
+
}
|
|
19
|
+
return r;
|
|
20
|
+
}, H = (e) => e === null || !Number.isFinite(e) || e <= 0 ? null : e, le = (e, t, r, o = "data") => {
|
|
21
|
+
const a = r.map(H), n = $(t), i = e.map((c, u) => u).sort((c, u) => (n.get(t[c]) ?? 0) - (n.get(t[u]) ?? 0)), l = /* @__PURE__ */ new Map();
|
|
22
|
+
for (const c of i) {
|
|
23
|
+
const u = e[c], d = a[c];
|
|
24
|
+
u === null || d === null || d === void 0 || l.set(u, (l.get(u) ?? 0) + d);
|
|
25
|
+
}
|
|
26
|
+
const p = /* @__PURE__ */ new Map();
|
|
27
|
+
let m = 0;
|
|
28
|
+
for (const [c, u] of ue([...l], o)) {
|
|
29
|
+
const d = m;
|
|
30
|
+
m += u, p.set(c, {
|
|
31
|
+
start: d,
|
|
32
|
+
end: m
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const s = m;
|
|
36
|
+
if (s === 0) return a.map(() => null);
|
|
37
|
+
const h = a.map(() => null), g = /* @__PURE__ */ new Map();
|
|
38
|
+
for (const c of i) {
|
|
39
|
+
const u = e[c], d = a[c], v = l.get(u), M = p.get(u);
|
|
40
|
+
if (d == null || v === void 0 || v === 0 || M === void 0) continue;
|
|
41
|
+
const T = g.get(u) ?? 0;
|
|
42
|
+
g.set(u, T + d), h[c] = {
|
|
43
|
+
columnStart: M.start / s,
|
|
44
|
+
columnEnd: M.end / s,
|
|
45
|
+
cellStart: T / v,
|
|
46
|
+
cellEnd: (T + d) / v,
|
|
47
|
+
shareOfColumn: d / v,
|
|
48
|
+
columnShare: v / s
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return h;
|
|
52
|
+
}, $ = (e) => {
|
|
53
|
+
const t = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const r of e) t.has(r) || t.set(r, t.size);
|
|
55
|
+
return t;
|
|
56
|
+
}, ue = (e, t) => {
|
|
57
|
+
if (t === "data") return e;
|
|
58
|
+
if (t === "ascending") return [...e].sort(([, a], [, n]) => a - n);
|
|
59
|
+
if (t === "descending") return [...e].sort(([, a], [, n]) => n - a);
|
|
60
|
+
const r = $(t), o = (a) => r.get(a) ?? r.size;
|
|
61
|
+
return [...e].sort(([a], [n]) => o(a) - o(n));
|
|
62
|
+
}, S = {
|
|
63
|
+
shareOfColumn: "mekkoShareOfColumn",
|
|
64
|
+
columnShare: "mekkoColumnShare"
|
|
65
|
+
}, ce = [
|
|
66
|
+
"data",
|
|
67
|
+
"ascending",
|
|
68
|
+
"descending"
|
|
69
|
+
], W = (e) => ce.includes(e) || Array.isArray(e) && e.every((t) => typeof t == "string" || typeof t == "number"), de = (e) => {
|
|
70
|
+
const t = e?.sort;
|
|
71
|
+
return W(t) ? t : "data";
|
|
72
|
+
}, F = /* @__PURE__ */ new Set(["value", "columnShare"]), D = "mekkoAmount", me = class extends z {
|
|
73
|
+
constructor(...e) {
|
|
74
|
+
super(...e), this.type = "mekko", this.computedVariables = F;
|
|
75
|
+
}
|
|
76
|
+
computeStat({ data: e, mapping: t, params: r }) {
|
|
77
|
+
const o = L(t.x), a = L(t.y);
|
|
78
|
+
if (o === null || a === null || !e.hasVariable(o) || !e.hasVariable(a)) return {
|
|
79
|
+
data: e,
|
|
80
|
+
mapping: {}
|
|
81
|
+
};
|
|
82
|
+
if (e.size() > 0 && e.getType(a) !== "numeric") {
|
|
83
|
+
const l = e.getType(a);
|
|
84
|
+
throw new q({
|
|
85
|
+
code: "INCOMPATIBLE_TYPE",
|
|
86
|
+
message: `'mekko' stat requires a numeric 'y' (got '${l}' for variable '${a}')`,
|
|
87
|
+
context: {
|
|
88
|
+
aesthetic: "y",
|
|
89
|
+
variableName: a,
|
|
90
|
+
variableType: l
|
|
91
|
+
},
|
|
92
|
+
suggestion: "Map each cell's amount to 'y'."
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const n = te(e, t).filter((l) => l !== o), i = he(e, o, a, n);
|
|
96
|
+
return {
|
|
97
|
+
data: ge(i, o, a, n, de(r)),
|
|
98
|
+
mapping: {
|
|
99
|
+
y: S.shareOfColumn,
|
|
100
|
+
value: a,
|
|
101
|
+
columnShare: S.columnShare
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}, he = (e, t, r, o) => {
|
|
106
|
+
const a = e.getValues(r, { type: "numeric" }).map(H);
|
|
107
|
+
return e.addVariable(D, "numeric", a, e.getValueFormat(r)).groupBy(t, ...o).rollup({ [r]: {
|
|
108
|
+
variableName: D,
|
|
109
|
+
aggregation: "sum"
|
|
110
|
+
} });
|
|
111
|
+
}, ge = (e, t, r, o, a) => {
|
|
112
|
+
const n = o.map((s) => e.getValues(s)), i = Array.from({ length: e.size() }, (s, h) => JSON.stringify(n.map((g) => g[h]))), l = le(e.getValues(t).map(pe), i, e.getValues(r, { type: "numeric" }), a), p = { type: "percentage" }, m = (s) => l.map((h) => h === null ? null : s(h));
|
|
113
|
+
return e.addVariable(S.shareOfColumn, "numeric", m((s) => s.shareOfColumn), p).addVariable(S.columnShare, "numeric", m((s) => s.columnShare), p).addVariable(b.xMin, "numeric", m((s) => s.columnStart)).addVariable(b.xMax, "numeric", m((s) => s.columnEnd)).addVariable(b.yMin, "numeric", m((s) => s.cellStart)).addVariable(b.yMax, "numeric", m((s) => s.cellEnd));
|
|
114
|
+
}, pe = (e) => e instanceof Date ? e.getTime() : e, R = (e, t) => {
|
|
115
|
+
const r = O(t, {
|
|
116
|
+
main: e.columnStart,
|
|
117
|
+
cross: e.low
|
|
118
|
+
}), o = O(t, {
|
|
119
|
+
main: e.columnEnd,
|
|
120
|
+
cross: e.high
|
|
121
|
+
}), [a, n] = G(_(r.x), _(o.x)), [i, l] = G(N(r.y), N(o.y));
|
|
122
|
+
return {
|
|
123
|
+
x: a,
|
|
124
|
+
y: i,
|
|
125
|
+
width: n - a,
|
|
126
|
+
height: l - i
|
|
127
|
+
};
|
|
128
|
+
}, U = (e, t, r) => {
|
|
129
|
+
const o = R(e, t);
|
|
130
|
+
return {
|
|
131
|
+
x: o.x * r.width,
|
|
132
|
+
y: o.y * r.height,
|
|
133
|
+
width: o.width * r.width,
|
|
134
|
+
height: o.height * r.height
|
|
135
|
+
};
|
|
136
|
+
}, G = (e, t) => e <= t ? [e, t] : [t, e], fe = (e) => {
|
|
137
|
+
const t = [];
|
|
138
|
+
if (!e.layer.dataLabels.showDataLabels) return {
|
|
139
|
+
labels: t,
|
|
140
|
+
droppedCount: 0
|
|
141
|
+
};
|
|
142
|
+
const { position: r, justify: o, align: a, offset: n } = e.layer.dataLabels, i = r === "auto", l = i ? "inside" : r, p = k(e.coordSystem), m = J(e.panelRect);
|
|
143
|
+
let s = 0;
|
|
144
|
+
for (const h of x(e.layer.data, p)) {
|
|
145
|
+
const g = e.formatLabel(h.observation);
|
|
146
|
+
if (g === "") continue;
|
|
147
|
+
const { width: c, height: u } = e.measureDataLabel("observation", l, g), d = ae({
|
|
148
|
+
box: U(h, p, e.panelRect),
|
|
149
|
+
panel: m,
|
|
150
|
+
orientation: p === "x" ? {
|
|
151
|
+
valueAxis: "y",
|
|
152
|
+
valueDirectionSign: -1
|
|
153
|
+
} : {
|
|
154
|
+
valueAxis: "x",
|
|
155
|
+
valueDirectionSign: 1
|
|
156
|
+
},
|
|
157
|
+
placement: l,
|
|
158
|
+
justify: i ? "center" : o,
|
|
159
|
+
align: i ? "center" : a,
|
|
160
|
+
offset: n,
|
|
161
|
+
labelWidth: c,
|
|
162
|
+
labelHeight: u
|
|
163
|
+
});
|
|
164
|
+
if (i && d.position !== "inside") {
|
|
165
|
+
s += 1;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
t.push({
|
|
169
|
+
layerId: e.layer.id,
|
|
170
|
+
x: d.x,
|
|
171
|
+
y: d.y,
|
|
172
|
+
text: g,
|
|
173
|
+
width: c,
|
|
174
|
+
height: u,
|
|
175
|
+
isRotated: !1,
|
|
176
|
+
role: "observation",
|
|
177
|
+
position: d.position,
|
|
178
|
+
backdropColor: d.position === "inside" ? re(e.styleReaders, h.observation) : void 0
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
labels: t,
|
|
183
|
+
droppedCount: s
|
|
184
|
+
};
|
|
185
|
+
}, ve = 1, ke = { strokeWidth: "pixels" }, ye = class extends X {
|
|
186
|
+
constructor(...e) {
|
|
187
|
+
super(...e), this.type = "mekko", this.defaultParams = {}, this.defaultStat = new me(), this.positionRoles = [
|
|
188
|
+
{
|
|
189
|
+
axis: "x",
|
|
190
|
+
role: "min",
|
|
191
|
+
valueKind: "value"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
axis: "x",
|
|
195
|
+
role: "max",
|
|
196
|
+
valueKind: "value"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
axis: "y",
|
|
200
|
+
role: "min",
|
|
201
|
+
valueKind: "value"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
axis: "y",
|
|
205
|
+
role: "max",
|
|
206
|
+
valueKind: "value",
|
|
207
|
+
aes: "y"
|
|
208
|
+
}
|
|
209
|
+
], this.aesthetics = [
|
|
210
|
+
{
|
|
211
|
+
kind: "visual",
|
|
212
|
+
name: "color"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
kind: "visual",
|
|
216
|
+
name: "alpha"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
kind: "data",
|
|
220
|
+
name: "value"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
kind: "data",
|
|
224
|
+
name: "columnShare"
|
|
225
|
+
}
|
|
226
|
+
], this.derivedVariables = [S.shareOfColumn, S.columnShare], this.supportedPositions = ["identity"], this.supportedCoordTypes = ["cartesian", "flip"], this.categorySpanAxes = ["x"], this.grid = {
|
|
227
|
+
cartesian: { hideGridX: !0 },
|
|
228
|
+
flip: { hideGridX: !0 }
|
|
229
|
+
}, this.legend = { suppressWhenSingleItem: !0 }, this.dataLabelCoordTypes = ["cartesian", "flip"], this.getDataLabelPlacements = fe, this.spatialKind = "rects", this.highlightStrategy = "observation-rerender", this.styleTarget = ee({ observation: {
|
|
230
|
+
vocabulary: ke,
|
|
231
|
+
aesthetics: {
|
|
232
|
+
fill: "color",
|
|
233
|
+
alpha: "alpha"
|
|
234
|
+
},
|
|
235
|
+
rest: {
|
|
236
|
+
fill: B("geom"),
|
|
237
|
+
fillAlpha: 1,
|
|
238
|
+
stroke: B("graphBackground"),
|
|
239
|
+
strokeWidth: ve
|
|
240
|
+
}
|
|
241
|
+
} }), this.validateMapping = ({ mapping: t, computedVariables: r }) => r.has("columnShare") ? [...F].filter((o) => t[o] !== void 0).map((o) => ({
|
|
242
|
+
code: "CONFLICTING_STAT_MAPPING",
|
|
243
|
+
message: `mekko stat computes '${o}' from 'x' and 'y'; remove its mapping`
|
|
244
|
+
})) : [{
|
|
245
|
+
code: "MISSING_STAT_OUTPUT",
|
|
246
|
+
message: "mekko geom lays its cells out in the 'mekko' stat; remove the layer's stat"
|
|
247
|
+
}], this.resolveAnchorPosition = (t, { coordSystem: r }) => {
|
|
248
|
+
const o = k(r), a = K(t, o);
|
|
249
|
+
if (a === null) return null;
|
|
250
|
+
const n = (a.columnStart + a.columnEnd) / 2, i = (a.low + a.high) / 2;
|
|
251
|
+
return o === "x" ? {
|
|
252
|
+
x: n,
|
|
253
|
+
y: i
|
|
254
|
+
} : {
|
|
255
|
+
x: i,
|
|
256
|
+
y: n
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
resolveParams(e) {
|
|
261
|
+
const { sort: t, ...r } = super.resolveParams(e);
|
|
262
|
+
return t === void 0 || W(t) ? t === void 0 ? r : {
|
|
263
|
+
...r,
|
|
264
|
+
sort: t
|
|
265
|
+
} : (e.diagnostics?.addWarning({
|
|
266
|
+
code: "INVALID_GEOM_PARAM",
|
|
267
|
+
message: `Mekko sort must be 'data', 'ascending', 'descending' or a list of columns, got ${JSON.stringify(t)}; falling back to 'data'.`,
|
|
268
|
+
context: {
|
|
269
|
+
geom: "mekko",
|
|
270
|
+
param: "sort",
|
|
271
|
+
expected: "'data' | 'ascending' | 'descending' | columns[]"
|
|
272
|
+
},
|
|
273
|
+
suggestion: "Set params.sort to 'descending' to run the columns largest first, or list them in order."
|
|
274
|
+
}), r);
|
|
275
|
+
}
|
|
276
|
+
compile({ data: e }) {
|
|
277
|
+
return {
|
|
278
|
+
data: e,
|
|
279
|
+
mapping: {}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}, Se = ({ layer: e, coordSystem: t, panelRect: r }) => {
|
|
283
|
+
const o = k(t);
|
|
284
|
+
return x(e.data, o).map((a) => {
|
|
285
|
+
const n = U(a, o, r), i = n.x + n.width, l = n.y + n.height;
|
|
286
|
+
return {
|
|
287
|
+
kind: "region",
|
|
288
|
+
pathData: `M${n.x},${n.y}H${i}V${l}H${n.x}Z`
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
}, w = (e) => {
|
|
292
|
+
const t = Z(e.data, e.mapping, e.id);
|
|
293
|
+
return (r) => t(r.observation);
|
|
294
|
+
}, A = ({ cells: e, mainAxis: t, styleReaders: r, getKey: o, isHovered: a = !1, shouldAnimateTransitions: n = !1 }) => {
|
|
295
|
+
const i = a ? "hovered" : void 0, l = y(() => e.map((s) => r.get("fill", s.observation, i) ?? "transparent"), [
|
|
296
|
+
e,
|
|
297
|
+
r,
|
|
298
|
+
i
|
|
299
|
+
]), { fillFor: p, defs: m } = ne({ paints: l });
|
|
300
|
+
return /* @__PURE__ */ ie(se, { children: [m, e.map((s, h) => {
|
|
301
|
+
const g = R(s, t), c = l[h], u = r.get("stroke", s.observation, i);
|
|
302
|
+
return /* @__PURE__ */ f(Y, {
|
|
303
|
+
"data-testid": "mekko-cell",
|
|
304
|
+
x: C(g.x),
|
|
305
|
+
y: C(g.y),
|
|
306
|
+
width: C(g.width),
|
|
307
|
+
height: C(g.height),
|
|
308
|
+
fill: c === void 0 ? void 0 : p(c),
|
|
309
|
+
opacity: r.get("alpha", s.observation, i),
|
|
310
|
+
fillOpacity: r.get("fillAlpha", s.observation, i),
|
|
311
|
+
stroke: u === void 0 ? void 0 : oe(u),
|
|
312
|
+
strokeWidth: r.get("strokeWidth", s.observation, i),
|
|
313
|
+
shouldAnimateTransitions: n
|
|
314
|
+
}, o(s));
|
|
315
|
+
})] });
|
|
316
|
+
}, xe = ({ layer: e, sourceLayer: t, mainAxis: r, styleReaders: o }) => /* @__PURE__ */ f(A, {
|
|
317
|
+
cells: y(() => x(e.data, r), [e.data, r]),
|
|
318
|
+
mainAxis: r,
|
|
319
|
+
styleReaders: o,
|
|
320
|
+
getKey: y(() => w(t), [t])
|
|
321
|
+
}), be = ({ layer: e, primary: t, mainAxis: r, styleReaders: o }) => /* @__PURE__ */ f("g", {
|
|
322
|
+
"data-testid": "hovered-cells",
|
|
323
|
+
children: /* @__PURE__ */ f(A, {
|
|
324
|
+
cells: x([t.observation], r),
|
|
325
|
+
mainAxis: r,
|
|
326
|
+
styleReaders: o,
|
|
327
|
+
getKey: y(() => w(e), [e]),
|
|
328
|
+
isHovered: !0
|
|
329
|
+
})
|
|
330
|
+
}), Ce = ({ layer: e, mainAxis: t, styleReaders: r, shouldAnimateTransitions: o, intro: a }) => {
|
|
331
|
+
const n = /* @__PURE__ */ f(A, {
|
|
332
|
+
cells: y(() => x(e.data, t), [e.data, t]),
|
|
333
|
+
mainAxis: t,
|
|
334
|
+
styleReaders: r,
|
|
335
|
+
getKey: y(() => w(e), [e]),
|
|
336
|
+
shouldAnimateTransitions: o
|
|
337
|
+
});
|
|
338
|
+
return a == null ? n : /* @__PURE__ */ f(j, {
|
|
339
|
+
intro: {
|
|
340
|
+
type: "fade",
|
|
341
|
+
layerId: a.layerId,
|
|
342
|
+
durationSeconds: a.durationSeconds
|
|
343
|
+
},
|
|
344
|
+
children: n
|
|
345
|
+
});
|
|
346
|
+
}, Ae = Q(new ye(), {
|
|
347
|
+
coord: "cartesian",
|
|
348
|
+
swatchShape: "square",
|
|
349
|
+
render: ({ layer: e, coordSystem: t, styleReaders: r, shouldAnimateTransitions: o, intro: a }) => /* @__PURE__ */ f(Ce, {
|
|
350
|
+
layer: e,
|
|
351
|
+
mainAxis: k(t),
|
|
352
|
+
styleReaders: r,
|
|
353
|
+
shouldAnimateTransitions: o,
|
|
354
|
+
intro: a
|
|
355
|
+
}),
|
|
356
|
+
renderHighlight: ({ layer: e, sourceLayer: t, coordSystem: r, styleReaders: o }) => /* @__PURE__ */ f(xe, {
|
|
357
|
+
layer: e,
|
|
358
|
+
sourceLayer: t,
|
|
359
|
+
mainAxis: k(r),
|
|
360
|
+
styleReaders: o
|
|
361
|
+
}),
|
|
362
|
+
renderHover: ({ layer: e, primary: t, coordSystem: r, styleReaders: o }) => /* @__PURE__ */ f(be, {
|
|
363
|
+
layer: e,
|
|
364
|
+
primary: t,
|
|
365
|
+
mainAxis: k(r),
|
|
366
|
+
styleReaders: o
|
|
367
|
+
}),
|
|
368
|
+
renderHoverCompanions: () => null,
|
|
369
|
+
getEditOutlineShapes: Se
|
|
370
|
+
});
|
|
371
|
+
export {
|
|
372
|
+
ye as MekkoGeom,
|
|
373
|
+
Ae as mekko
|
|
374
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EditOutlineShape, GeomEditOutlineShapesRendererInput } from '@graphysdk/react';
|
|
2
|
+
/** Each cell's box as an outline region. */
|
|
3
|
+
export declare const getMekkoEditOutlineShapes: ({ layer, coordSystem, panelRect, }: GeomEditOutlineShapesRendererInput) => EditOutlineShape[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GeomStyleReaders, MainAxis, SceneLayer } from '@graphysdk/react';
|
|
2
|
+
interface HighlightedCellsProps {
|
|
3
|
+
layer: SceneLayer;
|
|
4
|
+
/** The whole layer the matched observations were taken from. */
|
|
5
|
+
sourceLayer: SceneLayer;
|
|
6
|
+
mainAxis: MainAxis;
|
|
7
|
+
styleReaders: GeomStyleReaders;
|
|
8
|
+
}
|
|
9
|
+
/** Repaints the matched cells above the dimmed layer. */
|
|
10
|
+
export declare const HighlightedCells: ({ layer, sourceLayer, mainAxis, styleReaders }: HighlightedCellsProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GeomStyleReaders, HoverHit, MainAxis, SceneLayer } from '@graphysdk/react';
|
|
2
|
+
interface HoveredCellsProps {
|
|
3
|
+
layer: SceneLayer;
|
|
4
|
+
primary: HoverHit;
|
|
5
|
+
mainAxis: MainAxis;
|
|
6
|
+
styleReaders: GeomStyleReaders;
|
|
7
|
+
}
|
|
8
|
+
/** The hovered cell, repainted above the dimmed layer. */
|
|
9
|
+
export declare const HoveredCells: ({ layer, primary, mainAxis, styleReaders }: HoveredCellsProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GeomStyleReaders, LayerIntroPlan, MainAxis, SceneLayer } from '@graphysdk/react';
|
|
2
|
+
interface MekkoLayerProps {
|
|
3
|
+
layer: SceneLayer;
|
|
4
|
+
mainAxis: MainAxis;
|
|
5
|
+
styleReaders: GeomStyleReaders;
|
|
6
|
+
shouldAnimateTransitions: boolean;
|
|
7
|
+
intro: LayerIntroPlan | null | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Fades the layer up whole: the `rects` grow-from-axis entrance would raise every cell from its column's foot. The
|
|
11
|
+
* fade rides the group, so it plays even when data changes snap.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MekkoLayer: ({ layer, mainAxis, styleReaders, shouldAnimateTransitions, intro }: MekkoLayerProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeomStyleReaders, MainAxis } from '@graphysdk/react';
|
|
2
|
+
import { MekkoCell } from '../utils/read-mekko';
|
|
3
|
+
export interface MekkoPaintProps {
|
|
4
|
+
cells: readonly MekkoCell[];
|
|
5
|
+
mainAxis: MainAxis;
|
|
6
|
+
styleReaders: GeomStyleReaders;
|
|
7
|
+
/** What identifies each cell across a data change, so a spring moves a mark rather than swapping it. */
|
|
8
|
+
getKey: (cell: MekkoCell) => string;
|
|
9
|
+
isHovered?: boolean;
|
|
10
|
+
/** Springs cells to new boxes on a data change. Only the layer's paint sets it; repaints mount per interaction. */
|
|
11
|
+
shouldAnimateTransitions?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const MekkoPaint: ({ cells, mainAxis, styleReaders, getKey, isHovered, shouldAnimateTransitions, }: MekkoPaintProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BoundGeomRendererDefinition } from '@graphysdk/react';
|
|
2
|
+
import { MekkoGeom } from '../engine/mekko.geom';
|
|
3
|
+
/**
|
|
4
|
+
* The mekko plugin.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const kit = createGraphyKit({ plugins: [mekko] });
|
|
8
|
+
* const spec = kit.pipe(
|
|
9
|
+
* kit.createSpec({ x: 'market', y: 'revenue', color: 'company' }),
|
|
10
|
+
* kit.geom.mekko(),
|
|
11
|
+
* kit.scale.x.continuous(),
|
|
12
|
+
* kit.scale.y.continuous()
|
|
13
|
+
* );
|
|
14
|
+
*/
|
|
15
|
+
export declare const mekko: BoundGeomRendererDefinition<MekkoGeom>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SceneLayer } from '@graphysdk/react';
|
|
2
|
+
import { MekkoCell } from '../../utils/read-mekko';
|
|
3
|
+
/** Keys a cell by its column and group, not its place: a data change moves every cell, which should spring. */
|
|
4
|
+
export declare const createMekkoKeys: (layer: SceneLayer) => ((cell: MekkoCell) => string);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MainAxis } from '@graphysdk/react';
|
|
2
|
+
import { MekkoCell } from './read-mekko';
|
|
3
|
+
/** A box in the `[0, 1]` view box, from its top left, y growing downward. */
|
|
4
|
+
export interface ViewBoxRect {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
/** A cell's box: its column's extent on the main axis, its own extent across it. */
|
|
11
|
+
export declare const readCellBox: (cell: MekkoCell, mainAxis: MainAxis) => ViewBoxRect;
|
|
12
|
+
/** A cell's box in panel pixels, from the panel's top left. */
|
|
13
|
+
export declare const readCellPanelBox: (cell: MekkoCell, mainAxis: MainAxis, panelRect: {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
}) => ViewBoxRect;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MainAxis, Observation } from '@graphysdk/react';
|
|
2
|
+
/** A cell's column extent on the main axis and its own extent across it, as `[0, 1]` fractions. */
|
|
3
|
+
export interface MekkoCell {
|
|
4
|
+
observation: Observation;
|
|
5
|
+
/** The column's two edges. */
|
|
6
|
+
columnStart: number;
|
|
7
|
+
columnEnd: number;
|
|
8
|
+
/** The cell's two ends within its column, lower first. */
|
|
9
|
+
low: number;
|
|
10
|
+
high: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Reads where a cell sits. The flip is already baked into the position columns, so under `coord.flip()` the
|
|
14
|
+
* column runs `yMin` to `yMax` and the cell `xMin` to `xMax`. `null` for a row that draws no cell.
|
|
15
|
+
*/
|
|
16
|
+
export declare const readCell: (observation: Observation, mainAxis: MainAxis) => MekkoCell | null;
|
|
17
|
+
/** Reads every cell of a layer, skipping a row that draws none. */
|
|
18
|
+
export declare const readCells: (observations: Iterable<Observation>, mainAxis: MainAxis) => MekkoCell[];
|
|
@@ -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-mekko",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"author": "Graphy",
|
|
4
|
+
"description": "Marimekko geom for the Graphy charting SDK (beta)",
|
|
5
|
+
"homepage": "https://docs.graphy.dev/sdk-next/graph-types/mekko",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"graphy",
|
|
9
|
+
"chart",
|
|
10
|
+
"react",
|
|
11
|
+
"visualization",
|
|
12
|
+
"grammar-of-graphics",
|
|
13
|
+
"mekko",
|
|
14
|
+
"marimekko",
|
|
15
|
+
"mosaic"
|
|
16
|
+
],
|
|
17
|
+
"version": "0.1.0",
|
|
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.1791968387850"
|
|
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
|
+
"@graphysdk/react": "1.9.0-beta.1791968387850",
|
|
49
|
+
"@graphysdk/viz-engine": "1.8.0",
|
|
50
|
+
"@graphytools/typescript-config": "0.0.1",
|
|
51
|
+
"@graphytools/eslint-config": "0.0.1",
|
|
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
|
}
|