Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
51001fd
Linting/formatting
camdecoster Jan 2, 2026
cef04d2
Initial TS set up
camdecoster Dec 30, 2025
412d4b1
Convert a few small files to TS
camdecoster Jan 2, 2026
f704542
Update requires to handle esbuild ESM/CJS interoperability
camdecoster Jan 2, 2026
5f72cf8
Use ts-node for scripts using TS that run outside of esbuild
camdecoster Jan 2, 2026
5ed7da0
Run test script with ts-node
camdecoster Jan 2, 2026
f2622c5
Add additional types and type generation script
camdecoster May 6, 2026
a131cfe
Convert modebar attributes to TS
camdecoster May 6, 2026
de168ca
Add type generation npm scripts
camdecoster May 6, 2026
5f8654c
Add type check steps to CI
camdecoster May 6, 2026
eebf71e
Update TS docs
camdecoster May 6, 2026
c11bca1
Add entry point to types
camdecoster May 6, 2026
04261b2
Update file name case check
camdecoster May 6, 2026
e69463a
Linting/formatting
camdecoster May 7, 2026
134e84f
Remove obsolete types
camdecoster May 8, 2026
6b2a096
Add additional internal props to FullData
camdecoster May 8, 2026
402658c
Refactor type imports
camdecoster May 8, 2026
7ffdd9a
Use better types in CalcData
camdecoster May 8, 2026
07a066c
Change types to Map*, add aliases for Mapbox*, fix typo
camdecoster May 8, 2026
ed5b958
Update description
camdecoster May 8, 2026
3335828
Add type# property key patterns, add additional properties to `FullLa…
camdecoster May 8, 2026
a1cd236
Add reference to CalcData
camdecoster May 8, 2026
0c771d2
Update type documentation
camdecoster May 8, 2026
7acbd19
Make TS config more strict
camdecoster May 11, 2026
27c6acb
Move TemplateFigure type
camdecoster May 11, 2026
dadd651
Fix internal property naming
camdecoster May 11, 2026
b9b2d41
Update type references
camdecoster May 11, 2026
7bbd311
Don't add redundant `| undefined` to generated types
camdecoster May 11, 2026
155bf28
Convert image trace attributes to TS
camdecoster May 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,26 @@ jobs:
- name: Run syntax tests on source files
run: .github/scripts/test.sh source-syntax

typecheck:
needs: install-and-cibuild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-workspace

- name: Type-check TypeScript sources
run: npm run typecheck

generated-types-drift:
needs: install-and-cibuild
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: ./.github/actions/setup-workspace

- name: Verify generated types are in sync with attribute sources
run: npm run gen:types:check

# ============================================================
# Standalone jobs (no dependencies on install-and-cibuild)
# ============================================================
Expand Down
289 changes: 289 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,289 @@
/**
* TypeScript type definitions for plotly.js.
*
* Public API surface for consumers installing plotly.js as a dependency.
*
* Usage:
*
* import Plotly from 'plotly.js';
* // or
* import * as Plotly from 'plotly.js';
* // or
* import { newPlot, Layout, Data } from 'plotly.js';
*
* const data: Data[] = [{ type: 'scatter', x: [1, 2, 3], y: [4, 5, 6] }];
* const layout: Partial<Layout> = { title: { text: 'Demo' } };
* await Plotly.newPlot(div, data, layout);
*
* Internal types (FullLayout, GraphDiv internals, the AttrsToType machinery,
* etc.) live alongside the source under src/types/ but are intentionally not
* re-exported from this entry point.
*/

export as namespace Plotly;

// ---------------------------------------------------------------------------
// Primitives & utility types
// ---------------------------------------------------------------------------

export type {
AxisType,
Calendar,
Color,
ColorScale,
Dash,
Datum,
DTickValue,
ErrorBar,
ErrorOptions,
MarkerSymbol,
Pattern,
PatternShape,
TypedArray,
XAnchor,
XRef,
YAnchor,
YRef,
} from '../src/types/lib/common';

// ---------------------------------------------------------------------------
// Layout, axes, components, and supporting shapes
// ---------------------------------------------------------------------------

export type {
Annotations,
AutoRangeOptions,
Axis,
AxisName,
ButtonClickEvent,
Camera,
DataTitle,
Delta,
Domain,
Font,
Gauge,
GaugeBar,
GaugeLine,
HoverLabel,
Icon,
Image,
Label,
Layout,
LayoutAxis,
Legend,
LegendTitle,
MapLayout,
Mapbox,
MapBounds,
MapboxBounds,
MapCenter,
MapboxCenter,
MapLayers,
MapboxLayers,
MapSymbol,
MapboxSymbol,
Margin,
MinorAxisLayout,
ModeBar,
ModeBarButton,
ModeBarButtonAny,
ModeBarDefaultButtons,
Padding,
PlotNumber,
Point,
PolarLayout,
RangeBreak,
RangeSlider,
Scene,
SceneAxis,
Shape,
ShapeLabel,
ShapeLine,
Template,
Threshold,
XAxisName,
YAxisName,
} from '../src/types/core/layout';

// ---------------------------------------------------------------------------
// Trace data
// ---------------------------------------------------------------------------

export type {
Data,
PlotData,
PlotMarker,
PlotType,
ScatterData,
ScatterLine,
ScatterMarker,
ScatterMarkerLine,
} from '../src/types/core/data';

// ---------------------------------------------------------------------------
// Specialized trace types
// ---------------------------------------------------------------------------

export type { BoxPlotData, BoxPlotMarker } from '../src/types/traces/box';
export type { CandlestickData } from '../src/types/traces/candlestick';
export type { OhlcData } from '../src/types/traces/ohlc';
export type {
PieData,
PieDataTitle,
PieDomain,
PieFont,
PieHoverInfo,
PieHoverLabel,
PieInsideTextOrientation,
PieLine,
PieMarker,
PieTextPosition,
} from '../src/types/traces/pie';
export type {
SankeyData,
SankeyColorscale,
SankeyDataTitle,
SankeyDomain,
SankeyFont,
SankeyHoverLabel,
SankeyLink,
SankeyNode,
SankeyOrientation,
} from '../src/types/traces/sankey';
export type { ViolinData } from '../src/types/traces/violin';

// ---------------------------------------------------------------------------
// Components
// ---------------------------------------------------------------------------

export type {
ColorBar,
ColorBarTitle,
ExponentFormat,
LengthMode,
ShowTickLabel,
TickFormatStop,
TickLabelOverflow,
TickLabelPosition,
} from '../src/types/components/colorbar';

export type { CurrentValue, Slider, SliderStep } from '../src/types/components/slider';

export type {
UpdateMenu,
UpdateMenuButton,
UpdateMenuDirection,
UpdateMenuType,
} from '../src/types/components/updatemenu';

export type {
RangeSelector,
RangeSelectorButton,
RangeSelectorStep,
} from '../src/types/components/rangeselector';

// ---------------------------------------------------------------------------
// Animation & template
// ---------------------------------------------------------------------------

export type {
AnimationFrameOpts,
AnimationOpts,
Frame,
Transition,
TransitionEasing,
} from '../src/types/core/animation';

// ---------------------------------------------------------------------------
// Configuration
// ---------------------------------------------------------------------------

export type {
Config,
DownloadImgopts,
Edits,
ToImageButtonOptions,
ToImgopts,
} from '../src/types/core/config';

// ---------------------------------------------------------------------------
// Events & runtime DOM types
// ---------------------------------------------------------------------------

export type {
BeforePlotEvent,
ClickAnnotationEvent,
FrameAnimationEvent,
LegendClickEvent,
PlotCoordinate,
PlotDatum,
PlotHoverEvent,
PlotlyEventName,
PlotlyHTMLElement,
PlotMouseEvent,
PlotRelayoutEvent,
PlotRestyleEvent,
PlotRestyleEventUpdate,
PlotScatterDataPoint,
PlotScene,
PlotSelectedData,
PlotSelectionEvent,
SelectionRange,
SliderChangeEvent,
SliderEndEvent,
SliderStartEvent,
SunburstClickEvent,
SunburstPlotDatum,
} from '../src/types/core/events';

// ---------------------------------------------------------------------------
// Public API functions
// ---------------------------------------------------------------------------

export {
addFrames,
addTraces,
animate,
deleteFrames,
deleteTraces,
downloadImage,
extendTraces,
Icons,
makeTemplate,
moveTraces,
newPlot,
Plots,
prependTraces,
purge,
react,
redraw,
register,
relayout,
restyle,
setPlotConfig,
toImage,
update,
validate,
validateTemplate,
} from '../src/types/core/api';

export type {
DefaultIcons,
IconsMap,
PlotlyDataLayoutConfig,
PlotlyModule,
Root,
RootOrData,
StaticPlots,
TemplateFigure,
ValidateResult,
ValidateTemplateResult,
} from '../src/types/core/api';

// ---------------------------------------------------------------------------
// Default export — matches the runtime CommonJS shape
// ---------------------------------------------------------------------------

import * as PlotlyAPI from '../src/types/core/api';
declare const Plotly: typeof PlotlyAPI;
export default Plotly;
Loading
Loading