@particle-academy/fancy-slides 0.1.4 → 0.1.5

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/dist/index.js CHANGED
@@ -1113,6 +1113,90 @@ function reduce(deck, op) {
1113
1113
  };
1114
1114
  }
1115
1115
  }
1116
+
1117
+ // src/utils/chart-presets.ts
1118
+ var QUARTERS = ["Q1", "Q2", "Q3", "Q4"];
1119
+ var REVENUE = [24e3, 38e3, 31e3, 47e3];
1120
+ function chartStarterOption(kind) {
1121
+ switch (kind) {
1122
+ case "bar":
1123
+ return {
1124
+ grid: { top: 24, left: 56, right: 16, bottom: 32 },
1125
+ tooltip: { trigger: "axis" },
1126
+ xAxis: { type: "category", data: [...QUARTERS] },
1127
+ yAxis: { type: "value" },
1128
+ series: [{ type: "bar", name: "Revenue", data: [...REVENUE] }]
1129
+ };
1130
+ case "line":
1131
+ return {
1132
+ grid: { top: 24, left: 56, right: 16, bottom: 32 },
1133
+ tooltip: { trigger: "axis" },
1134
+ xAxis: { type: "category", data: [...QUARTERS] },
1135
+ yAxis: { type: "value" },
1136
+ series: [{ type: "line", name: "Revenue", smooth: true, data: [...REVENUE] }]
1137
+ };
1138
+ case "area":
1139
+ return {
1140
+ grid: { top: 24, left: 56, right: 16, bottom: 32 },
1141
+ tooltip: { trigger: "axis" },
1142
+ xAxis: { type: "category", data: [...QUARTERS] },
1143
+ yAxis: { type: "value" },
1144
+ series: [
1145
+ {
1146
+ type: "line",
1147
+ name: "Revenue",
1148
+ smooth: true,
1149
+ areaStyle: {},
1150
+ data: [...REVENUE]
1151
+ }
1152
+ ]
1153
+ };
1154
+ case "pie":
1155
+ return {
1156
+ tooltip: { trigger: "item" },
1157
+ legend: { bottom: 0 },
1158
+ series: [
1159
+ {
1160
+ type: "pie",
1161
+ radius: ["40%", "70%"],
1162
+ name: "Segment",
1163
+ data: [
1164
+ { value: 1048, name: "Direct" },
1165
+ { value: 735, name: "Search" },
1166
+ { value: 580, name: "Email" }
1167
+ ]
1168
+ }
1169
+ ]
1170
+ };
1171
+ case "scatter":
1172
+ return {
1173
+ grid: { top: 24, left: 48, right: 16, bottom: 32 },
1174
+ tooltip: { trigger: "item" },
1175
+ xAxis: { type: "value" },
1176
+ yAxis: { type: "value" },
1177
+ series: [
1178
+ {
1179
+ type: "scatter",
1180
+ name: "Points",
1181
+ symbolSize: 12,
1182
+ data: [
1183
+ [10, 8.04],
1184
+ [8, 6.95],
1185
+ [13, 7.58],
1186
+ [9, 8.81],
1187
+ [11, 8.33],
1188
+ [14, 9.96],
1189
+ [6, 7.24],
1190
+ [4, 4.26],
1191
+ [12, 10.84],
1192
+ [7, 4.82],
1193
+ [5, 5.68]
1194
+ ]
1195
+ }
1196
+ ]
1197
+ };
1198
+ }
1199
+ }
1116
1200
  function SlideRail({
1117
1201
  slides,
1118
1202
  selectedId,
@@ -1238,7 +1322,16 @@ function EditorToolbar({
1238
1322
  /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onInsertShape?.("arrow"), children: "Arrow" })
1239
1323
  ] })
1240
1324
  ] }),
1241
- /* @__PURE__ */ jsx(Tooltip, { content: "Insert chart", children: /* @__PURE__ */ jsx(Action, { variant: "ghost", size: "sm", icon: "bar-chart", onClick: onInsertChart, disabled, "aria-label": "Insert chart" }) }),
1325
+ /* @__PURE__ */ jsxs(Dropdown, { children: [
1326
+ /* @__PURE__ */ jsx(Dropdown.Trigger, { children: /* @__PURE__ */ jsx(Action, { variant: "ghost", size: "sm", icon: "bar-chart", iconTrailing: "chevron-down", disabled, "aria-label": "Insert chart" }) }),
1327
+ /* @__PURE__ */ jsxs(Dropdown.Items, { children: [
1328
+ /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onInsertChart?.("bar"), children: "Bar chart" }),
1329
+ /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onInsertChart?.("line"), children: "Line chart" }),
1330
+ /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onInsertChart?.("area"), children: "Area chart" }),
1331
+ /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onInsertChart?.("pie"), children: "Pie chart" }),
1332
+ /* @__PURE__ */ jsx(Dropdown.Item, { onClick: () => onInsertChart?.("scatter"), children: "Scatter" })
1333
+ ] })
1334
+ ] }),
1242
1335
  /* @__PURE__ */ jsx(Tooltip, { content: "Insert code", children: /* @__PURE__ */ jsx(Action, { variant: "ghost", size: "sm", icon: "code", onClick: onInsertCode, disabled, "aria-label": "Insert code" }) }),
1243
1336
  /* @__PURE__ */ jsx(Tooltip, { content: "Insert table", children: /* @__PURE__ */ jsx(Action, { variant: "ghost", size: "sm", icon: "table", onClick: onInsertTable, disabled, "aria-label": "Insert table" }) }),
1244
1337
  /* @__PURE__ */ jsx(Separator, { orientation: "vertical" }),
@@ -1618,17 +1711,13 @@ function DeckEditor({
1618
1711
  [insert]
1619
1712
  );
1620
1713
  const insertChart = useCallback(
1621
- () => insert({
1714
+ (kind = "bar") => insert({
1622
1715
  type: "chart",
1623
1716
  x: 0.1,
1624
1717
  y: 0.2,
1625
1718
  w: 0.8,
1626
1719
  h: 0.6,
1627
- option: {
1628
- xAxis: { type: "category", data: ["Q1", "Q2", "Q3", "Q4"] },
1629
- yAxis: { type: "value" },
1630
- series: [{ type: "bar", data: [24, 38, 31, 47] }]
1631
- }
1720
+ option: chartStarterOption(kind)
1632
1721
  }),
1633
1722
  [insert]
1634
1723
  );
@@ -1756,6 +1845,6 @@ function DeckEditor({
1756
1845
  );
1757
1846
  }
1758
1847
 
1759
- export { DeckEditor, EditorToolbar, ElementInspector, ImageElementRenderer, PresenterView, ShapeElementRenderer, Slide, SlideRail, SlideThumbnail, SlideViewer, SpeakerNotes, TextElementRenderer, builtinThemes, darkTheme, deckId, defaultTheme, defineTheme, elementId, nextId, reduce as reduceDeck, resolveTheme, slideId, useDeckState, useSlideKeyboard, vividTheme };
1848
+ export { DeckEditor, EditorToolbar, ElementInspector, ImageElementRenderer, PresenterView, ShapeElementRenderer, Slide, SlideRail, SlideThumbnail, SlideViewer, SpeakerNotes, TextElementRenderer, builtinThemes, chartStarterOption, darkTheme, deckId, defaultTheme, defineTheme, elementId, nextId, reduce as reduceDeck, resolveTheme, slideId, useDeckState, useSlideKeyboard, vividTheme };
1760
1849
  //# sourceMappingURL=index.js.map
1761
1850
  //# sourceMappingURL=index.js.map