@particle-academy/fancy-slides 0.8.0 → 0.9.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
@@ -940,7 +940,18 @@ function SlideElementHost({
940
940
  touchAction: canMove ? "none" : void 0,
941
941
  ...buildAnimation ? buildEnterStyle(buildAnimation, buildDelay) : null
942
942
  };
943
- const inner = renderInner({ element, theme, slideWidthPx, editing, selected, onContentChange, paraReveal }) ?? renderElement?.(element, slideWidthPx) ?? elementPlaceholder(element);
943
+ const rendered = renderInner({ element, theme, slideWidthPx, editing, selected, onContentChange, paraReveal }) ?? renderElement?.(element, slideWidthPx) ?? elementPlaceholder(element);
944
+ const inner = element.href && !editing ? /* @__PURE__ */ jsxRuntime.jsx(
945
+ "a",
946
+ {
947
+ href: element.href,
948
+ target: "_blank",
949
+ rel: "noreferrer",
950
+ style: { display: "block", width: "100%", height: "100%", color: "inherit", textDecoration: "inherit" },
951
+ "data-fancy-slides-href": "",
952
+ children: rendered
953
+ }
954
+ ) : rendered;
944
955
  return /* @__PURE__ */ jsxRuntime.jsxs(
945
956
  "div",
946
957
  {
@@ -2284,7 +2295,7 @@ function ElementInspector({ element, onPatch, onDelete, onLockToggle, slide, onS
2284
2295
  /* @__PURE__ */ jsxRuntime.jsxs(reactFancy.Tabs.Panels, { children: [
2285
2296
  /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Tabs.Panel, { value: "style", children: /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsxRuntime.jsx(StyleSection, { element, onPatch }) }) }),
2286
2297
  /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Tabs.Panel, { value: "build", children: /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsxRuntime.jsx(AnimateSection, { animation: element.animation, onSetAnimation, isText: element.type === "text" }) }) }),
2287
- /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Tabs.Panel, { value: "layout", children: /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsxRuntime.jsx(LayoutSection, { element, onPatch }) }) }),
2298
+ /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Tabs.Panel, { value: "layout", children: /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsxRuntime.jsx(LayoutSection, { element, onPatch, siblings: slide?.elements ?? [] }) }) }),
2288
2299
  /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Tabs.Panel, { value: "advanced", children: /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Card, { padding: "md", className: "!bg-white dark:!bg-zinc-950", children: /* @__PURE__ */ jsxRuntime.jsx(AdvancedSection, { element, onPatch }) }) })
2289
2300
  ] })
2290
2301
  ] }) })
@@ -2489,7 +2500,10 @@ function buildLabel(element) {
2489
2500
  }
2490
2501
  return `${element.type} #${element.id.slice(-6)}`;
2491
2502
  }
2492
- function LayoutSection({ element, onPatch }) {
2503
+ function LayoutSection({ element, onPatch, siblings }) {
2504
+ const zs = siblings.map((e) => e.z ?? 0);
2505
+ const bringToFront = () => onPatch({ z: (zs.length ? Math.max(...zs) : 0) + 1 });
2506
+ const sendToBack = () => onPatch({ z: (zs.length ? Math.min(...zs) : 0) - 1 });
2493
2507
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
2494
2508
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
2495
2509
  /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Input, { label: "X", type: "number", value: String(roundFrac(element.x)), onChange: (e) => onPatch({ x: clamp2(parseFloat(e.target.value), 0, 1) }) }),
@@ -2499,7 +2513,26 @@ function LayoutSection({ element, onPatch }) {
2499
2513
  ] }),
2500
2514
  /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Separator, {}),
2501
2515
  /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Slider, { label: "Rotation", value: element.rotation ?? 0, onValueChange: (v) => onPatch({ rotation: Number(v) }), min: -180, max: 180 }),
2502
- /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Input, { label: "Z-index", type: "number", value: String(element.z ?? 0), onChange: (e) => onPatch({ z: parseInt(e.target.value, 10) || 0 }) })
2516
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-2", children: [
2517
+ /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Input, { label: "Z-index", type: "number", value: String(element.z ?? 0), onChange: (e) => onPatch({ z: parseInt(e.target.value, 10) || 0 }), className: "flex-1" }),
2518
+ /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Action, { size: "sm", variant: "ghost", onClick: bringToFront, "aria-label": "Bring to front", children: "Front" }),
2519
+ /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Action, { size: "sm", variant: "ghost", onClick: sendToBack, "aria-label": "Send to back", children: "Back" })
2520
+ ] }),
2521
+ /* @__PURE__ */ jsxRuntime.jsx(reactFancy.Separator, {}),
2522
+ /* @__PURE__ */ jsxRuntime.jsx(
2523
+ reactFancy.Input,
2524
+ {
2525
+ label: "Link (href)",
2526
+ value: element.href ?? "",
2527
+ placeholder: "https://\u2026",
2528
+ onChange: (e) => onPatch({ href: e.target.value || void 0 })
2529
+ }
2530
+ ),
2531
+ /* @__PURE__ */ jsxRuntime.jsxs(reactFancy.Text, { size: "xs", className: "!text-zinc-500", children: [
2532
+ "Makes the whole element a click target in the viewer (opens a new tab) and exports as a pptx hyperlink. For links inside text, use markdown ",
2533
+ /* @__PURE__ */ jsxRuntime.jsx("code", { children: "[label](url)" }),
2534
+ "."
2535
+ ] })
2503
2536
  ] });
2504
2537
  }
2505
2538
  function AdvancedSection({ element, onPatch }) {
@@ -3321,12 +3354,16 @@ function DeckEditor({
3321
3354
  );
3322
3355
  }
3323
3356
 
3357
+ // src/types.ts
3358
+ var SCHEMA_VERSION = 1;
3359
+
3324
3360
  exports.DeckEditor = DeckEditor;
3325
3361
  exports.EditorToolbar = EditorToolbar;
3326
3362
  exports.ElementInspector = ElementInspector;
3327
3363
  exports.ImageElementRenderer = ImageElementRenderer;
3328
3364
  exports.PRESENTATION_EDITOR_ACTIONS = PRESENTATION_EDITOR_ACTIONS;
3329
3365
  exports.PresenterView = PresenterView;
3366
+ exports.SCHEMA_VERSION = SCHEMA_VERSION;
3330
3367
  exports.ShapeElementRenderer = ShapeElementRenderer;
3331
3368
  exports.Slide = Slide;
3332
3369
  exports.SlideRail = SlideRail;