Revert build commits from master
Build output lives on the built-1.7.1 branch instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
6eedd89984
commit
47bfa45449
Vendored
-13
@@ -1,13 +0,0 @@
|
||||
export * from "./types";
|
||||
declare const ChartPluginStacked100: {
|
||||
id: string;
|
||||
beforeInit: (chart: import("chart.js").Chart<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint)[], unknown>, args: import("chart.js/dist/types/basic").EmptyObject, options: import("./types").PluginOptions) => void;
|
||||
beforeUpdate: (chart: import("chart.js").Chart<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint)[], unknown>, args: {
|
||||
mode: import("chart.js").UpdateMode;
|
||||
cancelable: true;
|
||||
}, options: import("./types").PluginOptions) => boolean | void;
|
||||
afterUpdate: (chart: import("chart.js").Chart<keyof import("chart.js").ChartTypeRegistry, (number | [number, number] | import("chart.js").Point | import("chart.js").BubbleDataPoint)[], unknown>, args: {
|
||||
mode: import("chart.js").UpdateMode;
|
||||
}, options: import("./types").PluginOptions) => void;
|
||||
};
|
||||
export default ChartPluginStacked100;
|
||||
Vendored
-1
@@ -1 +0,0 @@
|
||||
(function(b,k){typeof exports=="object"&&typeof module<"u"?module.exports=k():typeof define=="function"&&define.amd?define(k):(b=typeof globalThis<"u"?globalThis:b||self,b.ChartjsPluginStacked100=k())})(this,function(){"use strict";const b=t=>typeof t==="object"&&!!t,k=(t,n)=>t&&t[`${n}AxisKey`]||n,D=(t,n,e)=>{if(b(t)){const a=k(e,n?"x":"y");return t[a]}return t},j=t=>[...t],K=t=>{t.originalData=t.datasets.map(n=>j(n.data))},U=(t,n)=>{const e=Math.pow(10,n);return Math.round(t*100*e)/e},V=(t,n)=>{const e=Math.pow(10,n);return Math.floor(t*100*e)/e},C=(t,n)=>{const e=Math.pow(10,n);return Math.ceil(t*100*e)/e},E=t=>{if(!("precision"in t)||typeof t.precision!="number")return 1;const e=Math.floor(t.precision);return e<0||e>16?1:e},w=Symbol(),v=(t,n,e,a,s)=>{if(!b(n))return s;const o=e&&e[`${a?"y":"x"}AxisKey`];if(!o)return s;const r=n[o];if(!r)return s;const l=t.findIndex(u=>u===r);return l<0?s:l},L=(t,n,e,a,s,c)=>{var p;const{labels:o,datasets:r}=t,l=o.length,u=(p=r==null?void 0:r[0])==null?void 0:p.stack,i=[...new Array(l)].map((f,y)=>r.filter(d=>A(d,s)).reduce((d,g,m)=>{const h=g.parsing||c,x=g.stack||w,M=g.data.find((R,q)=>v(o,R,h,e,q)==y);d[x]||(d[x]=0);const S=Math.abs(D(M,e,h)||0)*n[m];return a&&!u?d[x]<S&&(d[x]=S):d[x]+=S,d},{}));return!u||!a?i:i.map(f=>{const y=Math.max(...Object.values(f));return Object.keys(f).forEach(d=>f[d]=y),f})},A=(t,n)=>n?(t.xAxisID||t.yAxisID)===n:!0,N=(t,n,e,a,s,c="off",o,r)=>{const l=L(t,n,e,s,o,r),u=c==="off"?U:c==="down"?V:C;return t.datasets.map(i=>{const p=A(i,o),f=new Array(t.labels.length);return i.data.forEach((y,d)=>{const g=i.parsing||r,m=D(y,e,g),h=v(t.labels,y,g,e,d);if(p){const x=i.stack||w,M=l[h][x];f[h]=m&&M?u(m/M,a):0}else f[h]=m}),f})},O=(t,n)=>e=>{const a=e.chart.data,s=e.datasetIndex,c=e.dataIndex,o=a.datasets[s].label||"",r=a.datasets[s].parsing||e.chart.options.parsing,l=a.originalData[s].find((p,f)=>v(a.labels,p,r,t,f)==c),u=a.calculatedData[s][c],i=D(l,t,r);return A(a.datasets[s],n)?`${o}: ${u}% (${i})`:`${o}: ${u}`},P=(t,n)=>{t&&t.forEach((e,a)=>{n[a].data=e})},$=t=>t.options.indexAxis==="y",_=(t,n)=>{const e={max:100};return t?n?{min:-100,...e}:e:{min:0,...e}},T=(t,n,e,a)=>{const s={stacked:e,...a,...t.options.scales[n]};t.options.scales[n]=s};return{id:"stacked100",beforeInit:(t,n,e)=>{if(!e.enable)return;const{replaceTooltipLabel:a=!0,fixNegativeScale:s=!0,individual:c=!1}=e,o=$(t),r=o?"x":"y",l=t.data.datasets.some(i=>i.data.some(p=>(D(p,o,i.parsing||t.options.parsing)||0)<0)),u=_(l,s);e.axisId?T(t,e.axisId,!c,u):["x","y"].forEach(i=>{T(t,i,!c,i===r?u:{})}),a&&(t.options.plugins.tooltip.callbacks.label=O(o,e.axisId))},beforeUpdate:(t,n,e)=>{if(!e.enable)return;const a=t.data;K(a);const s=a.datasets.map((o,r)=>{var l;return((l=t.getDatasetMeta(r))==null?void 0:l.hidden)??o.hidden?0:1}),c=E(e);a.calculatedData=N(a,s,$(t),c,e.individual,e.roundOption,e.axisId,t.options.parsing),P(a.calculatedData,a.datasets)},afterUpdate:(t,n,e)=>{if(!e.enable)return;const a=t.data;P(a.originalData,a.datasets)}}});
|
||||
Vendored
-10
@@ -1,10 +0,0 @@
|
||||
import { ChartData, ParsingOptions } from "chart.js";
|
||||
import { ExtendedPlugin } from "./types";
|
||||
export declare const defaultStackKey: unique symbol;
|
||||
export declare const summarizeValues: (chartData: ChartData, visibles: number[], isHorizontal: boolean, individual: boolean, targetAxisId?: string, parsing?: ParsingOptions["parsing"]) => {
|
||||
[key: string]: number;
|
||||
[key: symbol]: number;
|
||||
}[];
|
||||
export declare const beforeInit: ExtendedPlugin["beforeInit"];
|
||||
export declare const beforeUpdate: ExtendedPlugin["beforeUpdate"];
|
||||
export declare const afterUpdate: ExtendedPlugin["afterUpdate"];
|
||||
Vendored
-23
@@ -1,23 +0,0 @@
|
||||
import { Plugin, ChartType, ChartData, DefaultDataPoint } from "chart.js";
|
||||
type PluginDataPoint = ChartData["datasets"][0]["data"];
|
||||
export type ExtendedPlugin = Plugin<ChartType, PluginOptions>;
|
||||
export interface PluginOptions {
|
||||
enable: boolean;
|
||||
replaceTooltipLabel?: boolean;
|
||||
fixNegativeScale?: boolean;
|
||||
individual?: boolean;
|
||||
roundOption?: "off" | "down" | "up";
|
||||
precision?: number;
|
||||
axisId?: string;
|
||||
}
|
||||
declare module "chart.js" {
|
||||
interface ChartData<TType extends ChartType = ChartType, TData = DefaultDataPoint<TType>, TLabel = unknown> {
|
||||
calculatedData?: number[][];
|
||||
originalData?: PluginDataPoint[];
|
||||
}
|
||||
interface PluginOptionsByType<TType extends ChartType> {
|
||||
stacked100?: PluginOptions;
|
||||
}
|
||||
}
|
||||
export type ExtendedChartData = ChartData;
|
||||
export {};
|
||||
Vendored
-9
@@ -1,9 +0,0 @@
|
||||
import { ParsingOptions } from "chart.js";
|
||||
import { ExtendedChartData, PluginOptions } from "./types";
|
||||
export declare const isObject: (obj: any) => obj is Record<string, any>;
|
||||
export declare const dataValue: (dataPoint: any, isHorizontal: boolean, parsing: ParsingOptions["parsing"]) => any;
|
||||
export declare const setOriginalData: (data: ExtendedChartData) => void;
|
||||
export declare const roundOff: (value: number, precision: number) => number;
|
||||
export declare const roundDown: (value: number, precision: number) => number;
|
||||
export declare const roundUp: (value: number, precision: number) => number;
|
||||
export declare const getPrecision: (pluginOptions: PluginOptions) => number;
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"name": "chartjs-plugin-stacked100",
|
||||
"version": "1.7.0",
|
||||
"description": "This plugin for Chart.js that makes your bar chart to 100% stacked bar chart",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"scripts": {
|
||||
"start": "storybook dev -p 6006",
|
||||
"build:demo": "webpack --mode production --config ./webpack/demo.config.js",
|
||||
|
||||
Reference in New Issue
Block a user