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