@pixerate/editor-react 0.178.0 → 0.180.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.
Files changed (33) hide show
  1. package/dist/{paint-editor → brushes}/BrushEditor.d.cts +14 -5
  2. package/dist/{paint-editor → brushes}/BrushEditor.d.ts +14 -5
  3. package/dist/brushes/BrushLibraryEditor.d.cts +26 -0
  4. package/dist/brushes/BrushLibraryEditor.d.ts +26 -0
  5. package/dist/brushes/index.cjs +289 -20
  6. package/dist/brushes/index.d.cts +2 -0
  7. package/dist/brushes/index.d.ts +2 -0
  8. package/dist/brushes/index.js +6 -2
  9. package/dist/chunk-76JBZXLM.js +263 -0
  10. package/dist/chunk-QIJJCDYW.js +119 -0
  11. package/dist/{chunk-UR4KL7WE.js → chunk-XAPJMT3W.js} +26 -6
  12. package/dist/{chunk-KYMDNWSX.js → chunk-ZX7JOPBO.js} +13 -2
  13. package/dist/image-editor/BrushOptionsBar.d.cts +6 -1
  14. package/dist/image-editor/BrushOptionsBar.d.ts +6 -1
  15. package/dist/image-editor/index.cjs +1178 -894
  16. package/dist/image-editor/index.js +3 -3
  17. package/dist/index.cjs +1719 -1435
  18. package/dist/index.js +3 -3
  19. package/dist/paint-editor/index.cjs +33 -25
  20. package/dist/paint-editor/index.d.cts +1 -1
  21. package/dist/paint-editor/index.d.ts +1 -1
  22. package/dist/paint-editor/index.js +414 -610
  23. package/dist/stickers/StickerLibraryPicker.d.cts +2 -2
  24. package/dist/stickers/StickerLibraryPicker.d.ts +2 -2
  25. package/dist/stickers/index.cjs +13 -2
  26. package/dist/stickers/index.js +1 -1
  27. package/dist/vector/VectorAppearancePanel.d.cts +8 -2
  28. package/dist/vector/VectorAppearancePanel.d.ts +8 -2
  29. package/dist/vector/index.cjs +1110 -748
  30. package/dist/vector/index.js +90 -59
  31. package/package.json +3 -3
  32. package/dist/chunk-62FMEDGG.js +0 -54
  33. package/dist/chunk-PQK2UMAY.js +0 -23
@@ -14,8 +14,8 @@ export interface StickerLibraryPickerProps {
14
14
  className?: string;
15
15
  }
16
16
  /**
17
- * Stickers from a sticker library: searchable, by category and a page at a time, with each
18
- * sticker's licence in its tooltip. Clicking one calls `onPick`. The same picker serves the paint
17
+ * Stickers from a sticker library: searchable, by category or collection and a page at a time,
18
+ * with each sticker's licence in its tooltip and an AI label on AI-generated art. Clicking one calls `onPick`. The same picker serves the paint
19
19
  * editor's sticker brush and inserting stickers into the vector, image and canvas editors.
20
20
  */
21
21
  export declare const StickerLibraryPicker: React.FC<StickerLibraryPickerProps>;
@@ -14,8 +14,8 @@ export interface StickerLibraryPickerProps {
14
14
  className?: string;
15
15
  }
16
16
  /**
17
- * Stickers from a sticker library: searchable, by category and a page at a time, with each
18
- * sticker's licence in its tooltip. Clicking one calls `onPick`. The same picker serves the paint
17
+ * Stickers from a sticker library: searchable, by category or collection and a page at a time,
18
+ * with each sticker's licence in its tooltip and an AI label on AI-generated art. Clicking one calls `onPick`. The same picker serves the paint
19
19
  * editor's sticker brush and inserting stickers into the vector, image and canvas editors.
20
20
  */
21
21
  export declare const StickerLibraryPicker: React.FC<StickerLibraryPickerProps>;
@@ -29,6 +29,7 @@ module.exports = __toCommonJS(stickers_exports);
29
29
  var import_react = require("react");
30
30
  var import_stickers = require("@pixerate/editor/stickers");
31
31
  var import_jsx_runtime = require("react/jsx-runtime");
32
+ var tooltip = (it) => `${it.name} (${it.ref}) \xB7 ${it.licence.name}${it.licence.attribution ? ` \xB7 ${it.licence.attribution}` : ""}${it.aiGenerated ? " \xB7 AI-generated" : ""}${it.variants?.includes("dark") ? " \xB7 light and dark" : ""}`;
32
33
  var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers", footer, className }) => {
33
34
  const browser = (0, import_react.useMemo)(() => new import_stickers.StickerBrowser(() => provider), [provider]);
34
35
  const [, setTick] = (0, import_react.useState)(0);
@@ -44,6 +45,15 @@ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers
44
45
  s.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { "aria-label": "Sticker category", value: s.category, onChange: (e) => void browser.setCategory(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: [
45
46
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "All" }),
46
47
  s.categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: c.id, children: c.name }, c.id))
48
+ ] }),
49
+ s.collections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { "aria-label": "Sticker collection", value: s.collection, onChange: (e) => void browser.setCollection(e.target.value), className: "rounded bg-slate-800 px-1 py-0.5", children: [
50
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "All collections" }),
51
+ s.collections.map((c) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("option", { value: c.id, title: c.description, children: [
52
+ c.name,
53
+ " (",
54
+ c.count,
55
+ ")"
56
+ ] }, c.id))
47
57
  ] })
48
58
  ] }),
49
59
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex max-h-32 flex-wrap gap-1 overflow-y-auto", role: "group", "aria-label": label, children: s.items.map((it) => {
@@ -53,12 +63,13 @@ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers
53
63
  {
54
64
  type: "button",
55
65
  "aria-pressed": on,
56
- title: `${it.name} (${it.ref}) \xB7 ${it.licence.name}${it.licence.attribution ? ` \xB7 ${it.licence.attribution}` : ""}`,
66
+ title: tooltip(it),
57
67
  className: `flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] ${on ? "bg-indigo-600 text-white" : "bg-slate-800 text-slate-300"}`,
58
68
  onClick: () => onPick(it),
59
69
  children: [
60
70
  it.thumbnail && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: it.thumbnail, alt: "", className: "h-4 w-4" }),
61
- it.name
71
+ it.name,
72
+ it.aiGenerated && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "rounded bg-slate-700 px-0.5 text-[8px] text-slate-200", "aria-label": "AI-generated", children: "AI" })
62
73
  ]
63
74
  },
64
75
  it.ref
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StickerLibraryPicker
3
- } from "../chunk-KYMDNWSX.js";
3
+ } from "../chunk-ZX7JOPBO.js";
4
4
 
5
5
  // src/stickers/StickerInsertPanel.tsx
6
6
  import { useState } from "react";
@@ -1,14 +1,20 @@
1
1
  import React from 'react';
2
+ import { type BrushPreviewRenderer } from '@pixerate/editor/brushes';
2
3
  import { type VectorEditorController } from '@pixerate/editor/vector';
3
4
  export interface VectorAppearancePanelProps {
4
5
  controller: VectorEditorController;
6
+ /** The brush editor's preview stroke (default: the controller's `brushPreview` option). */
7
+ renderBrushPreview?: BrushPreviewRenderer;
5
8
  className?: string;
6
9
  }
7
10
  /**
8
11
  * The appearance of the selection: its fill and stroke stacks (listed top first; add, remove,
9
12
  * reorder, show / hide, paint, opacity and blend mode per layer, width and alignment per
10
13
  * stroke), the node blend mode, and for one selected node its filters (drop and inner shadows,
11
- * glows, blurs, feather). The pencil on a layer points the gradient editor and tool at it.
14
+ * glows, blurs, feather). The pencil on a layer points the gradient editor and tool at it. With
15
+ * the controller's `brushLibrary`, a brushstroke's "Brush…" picks from the library
16
+ * (`BrushLibraryBrowser`, `VECTOR_PROFILE`) and "Edit brush…" edits it (`BrushLibraryEditor`):
17
+ * saves go to the library and the stroke takes the saved brush.
12
18
  * Slider drags and typing are one undo step each.
13
19
  */
14
- export declare function VectorAppearancePanel({ controller, className }: VectorAppearancePanelProps): React.JSX.Element | null;
20
+ export declare function VectorAppearancePanel({ controller, renderBrushPreview, className }: VectorAppearancePanelProps): React.JSX.Element | null;
@@ -1,14 +1,20 @@
1
1
  import React from 'react';
2
+ import { type BrushPreviewRenderer } from '@pixerate/editor/brushes';
2
3
  import { type VectorEditorController } from '@pixerate/editor/vector';
3
4
  export interface VectorAppearancePanelProps {
4
5
  controller: VectorEditorController;
6
+ /** The brush editor's preview stroke (default: the controller's `brushPreview` option). */
7
+ renderBrushPreview?: BrushPreviewRenderer;
5
8
  className?: string;
6
9
  }
7
10
  /**
8
11
  * The appearance of the selection: its fill and stroke stacks (listed top first; add, remove,
9
12
  * reorder, show / hide, paint, opacity and blend mode per layer, width and alignment per
10
13
  * stroke), the node blend mode, and for one selected node its filters (drop and inner shadows,
11
- * glows, blurs, feather). The pencil on a layer points the gradient editor and tool at it.
14
+ * glows, blurs, feather). The pencil on a layer points the gradient editor and tool at it. With
15
+ * the controller's `brushLibrary`, a brushstroke's "Brush…" picks from the library
16
+ * (`BrushLibraryBrowser`, `VECTOR_PROFILE`) and "Edit brush…" edits it (`BrushLibraryEditor`):
17
+ * saves go to the library and the stroke takes the saved brush.
12
18
  * Slider drags and typing are one undo step each.
13
19
  */
14
- export declare function VectorAppearancePanel({ controller, className }: VectorAppearancePanelProps): React.JSX.Element | null;
20
+ export declare function VectorAppearancePanel({ controller, renderBrushPreview, className }: VectorAppearancePanelProps): React.JSX.Element | null;