@particle-academy/fancy-slides 0.11.0 → 0.12.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/dist/index.cjs CHANGED
@@ -2214,7 +2214,8 @@ function EditorToolbar({
2214
2214
  onInsertCode,
2215
2215
  onInsertTable,
2216
2216
  onPresent,
2217
- disabled = false
2217
+ disabled = false,
2218
+ toolbarExtra
2218
2219
  }) {
2219
2220
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fs-toolbar flex items-center gap-2 border-b border-zinc-200 bg-white px-4 py-2 dark:border-zinc-800 dark:bg-zinc-950", children: [
2220
2221
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2261,7 +2262,53 @@ function EditorToolbar({
2261
2262
  ] }) }),
2262
2263
  /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Dropdown.Items, { children: Object.values(builtinThemes).map((t) => /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Dropdown.Item, { onClick: () => onApplyTheme?.(t), children: t.name }, t.name)) })
2263
2264
  ] }),
2264
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Tooltip, { content: "Present (F)", children: /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Action, { color: "violet", size: "sm", icon: "play", onClick: onPresent, children: "Present" }) }) })
2265
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex items-center gap-2", children: [
2266
+ toolbarExtra,
2267
+ /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Tooltip, { content: "Present (F)", children: /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Action, { color: "violet", size: "sm", icon: "play", onClick: onPresent, children: "Present" }) })
2268
+ ] })
2269
+ ] });
2270
+ }
2271
+ function FallbackTextarea({ value, onChange }) {
2272
+ return /* @__PURE__ */ jsxRuntime.jsx(
2273
+ "textarea",
2274
+ {
2275
+ className: "block w-full resize-y rounded-md border border-zinc-300 bg-zinc-950 p-2 font-mono text-xs text-zinc-100 dark:border-zinc-700",
2276
+ rows: 8,
2277
+ value,
2278
+ spellCheck: false,
2279
+ onChange: (e) => onChange(e.target.value)
2280
+ }
2281
+ );
2282
+ }
2283
+ var CodeInputInner = react.lazy(async () => {
2284
+ try {
2285
+ const mod = await import('@particle-academy/fancy-code');
2286
+ const CodeEditor = mod.CodeEditor;
2287
+ if (!CodeEditor) return { default: FallbackTextarea };
2288
+ return {
2289
+ default: ({ value, language, theme, onChange }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-md border border-zinc-300 dark:border-zinc-700", children: /* @__PURE__ */ jsxRuntime.jsx(
2290
+ CodeEditor,
2291
+ {
2292
+ value,
2293
+ onChange,
2294
+ language,
2295
+ theme,
2296
+ lineNumbers: true,
2297
+ wordWrap: true,
2298
+ minHeight: 140,
2299
+ maxHeight: 280,
2300
+ children: /* @__PURE__ */ jsxRuntime.jsx(CodeEditor.Panel, {})
2301
+ }
2302
+ ) })
2303
+ };
2304
+ } catch {
2305
+ return { default: FallbackTextarea };
2306
+ }
2307
+ });
2308
+ function CodeInput(props) {
2309
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
2310
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "block text-xs font-medium text-zinc-600 dark:text-zinc-400", children: "Code" }),
2311
+ /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(FallbackTextarea, { ...props }), children: /* @__PURE__ */ jsxRuntime.jsx(CodeInputInner, { ...props }) })
2265
2312
  ] });
2266
2313
  }
2267
2314
  function ElementInspector({ element, onPatch, onDelete, onLockToggle, slide, onSetTransition, onSetBackground, onSetLayout, onSetAnimation, onSetElementAnimation }) {
@@ -2821,10 +2868,41 @@ function ShapeStyleControls({ element, onPatch }) {
2821
2868
  (element.shape === "rounded-rect" || element.shape === "rect") && /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Slider, { label: "Corner radius", value: element.radius ?? 0, onValueChange: (v) => onPatch({ radius: Number(v) }), min: 0, max: 40 })
2822
2869
  ] });
2823
2870
  }
2871
+ var CODE_LANGUAGES = [
2872
+ { value: "javascript", label: "JavaScript" },
2873
+ { value: "typescript", label: "TypeScript" },
2874
+ { value: "jsx", label: "JSX" },
2875
+ { value: "tsx", label: "TSX" },
2876
+ { value: "html", label: "HTML" },
2877
+ { value: "css", label: "CSS" },
2878
+ { value: "json", label: "JSON" },
2879
+ { value: "python", label: "Python" },
2880
+ { value: "php", label: "PHP" },
2881
+ { value: "bash", label: "Bash" },
2882
+ { value: "go", label: "Go" },
2883
+ { value: "sql", label: "SQL" },
2884
+ { value: "markdown", label: "Markdown" }
2885
+ ];
2824
2886
  function CodeStyleControls({ element, onPatch }) {
2825
2887
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
2826
- /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Textarea, { label: "Code", value: element.code, onValueChange: (v) => onPatch({ code: v }), rows: 6, autoResize: true }),
2827
- /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Input, { label: "Language", value: element.language ?? "javascript", onChange: (e) => onPatch({ language: e.target.value }) }),
2888
+ /* @__PURE__ */ jsxRuntime.jsx(
2889
+ CodeInput,
2890
+ {
2891
+ value: element.code,
2892
+ language: element.language ?? "javascript",
2893
+ theme: element.codeTheme ?? "dark",
2894
+ onChange: (v) => onPatch({ code: v })
2895
+ }
2896
+ ),
2897
+ /* @__PURE__ */ jsxRuntime.jsx(
2898
+ reactFancy.Select,
2899
+ {
2900
+ label: "Language",
2901
+ list: CODE_LANGUAGES,
2902
+ value: element.language ?? "javascript",
2903
+ onValueChange: (v) => onPatch({ language: v })
2904
+ }
2905
+ ),
2828
2906
  /* @__PURE__ */ jsxRuntime.jsx(
2829
2907
  reactFancy.Select,
2830
2908
  {
@@ -3279,7 +3357,8 @@ function DeckEditor({
3279
3357
  onInsertCode: insertCode,
3280
3358
  onInsertTable: insertTable,
3281
3359
  onPresent,
3282
- disabled: !slide
3360
+ disabled: !slide,
3361
+ toolbarExtra
3283
3362
  }
3284
3363
  ),
3285
3364
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1", children: [
@@ -3350,8 +3429,7 @@ function DeckEditor({
3350
3429
  onSetElementAnimation: (eid, animation) => slide && ops.setAnimation(slide.id, eid, animation)
3351
3430
  }
3352
3431
  ) })
3353
- ] }),
3354
- toolbarExtra
3432
+ ] })
3355
3433
  ]
3356
3434
  }
3357
3435
  );