@pixerate/editor-react 0.178.0 → 0.179.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.
@@ -2,6 +2,7 @@
2
2
  import { useEffect, useMemo, useState } from "react";
3
3
  import { StickerBrowser } from "@pixerate/editor/stickers";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ 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" : ""}`;
5
6
  var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers", footer, className }) => {
6
7
  const browser = useMemo(() => new StickerBrowser(() => provider), [provider]);
7
8
  const [, setTick] = useState(0);
@@ -17,6 +18,15 @@ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers
17
18
  s.categories.length > 1 && /* @__PURE__ */ 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: [
18
19
  /* @__PURE__ */ jsx("option", { value: "", children: "All" }),
19
20
  s.categories.map((c) => /* @__PURE__ */ jsx("option", { value: c.id, children: c.name }, c.id))
21
+ ] }),
22
+ s.collections.length > 0 && /* @__PURE__ */ 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: [
23
+ /* @__PURE__ */ jsx("option", { value: "", children: "All collections" }),
24
+ s.collections.map((c) => /* @__PURE__ */ jsxs("option", { value: c.id, title: c.description, children: [
25
+ c.name,
26
+ " (",
27
+ c.count,
28
+ ")"
29
+ ] }, c.id))
20
30
  ] })
21
31
  ] }),
22
32
  /* @__PURE__ */ jsx("div", { className: "flex max-h-32 flex-wrap gap-1 overflow-y-auto", role: "group", "aria-label": label, children: s.items.map((it) => {
@@ -26,12 +36,13 @@ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers
26
36
  {
27
37
  type: "button",
28
38
  "aria-pressed": on,
29
- title: `${it.name} (${it.ref}) \xB7 ${it.licence.name}${it.licence.attribution ? ` \xB7 ${it.licence.attribution}` : ""}`,
39
+ title: tooltip(it),
30
40
  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"}`,
31
41
  onClick: () => onPick(it),
32
42
  children: [
33
43
  it.thumbnail && /* @__PURE__ */ jsx("img", { src: it.thumbnail, alt: "", className: "h-4 w-4" }),
34
- it.name
44
+ it.name,
45
+ it.aiGenerated && /* @__PURE__ */ jsx("span", { className: "rounded bg-slate-700 px-0.5 text-[8px] text-slate-200", "aria-label": "AI-generated", children: "AI" })
35
46
  ]
36
47
  },
37
48
  it.ref
@@ -963,6 +963,7 @@ var import_react9 = require("react");
963
963
  var import_react8 = require("react");
964
964
  var import_stickers = require("@pixerate/editor/stickers");
965
965
  var import_jsx_runtime8 = require("react/jsx-runtime");
966
+ 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" : ""}`;
966
967
  var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers", footer, className }) => {
967
968
  const browser = (0, import_react8.useMemo)(() => new import_stickers.StickerBrowser(() => provider), [provider]);
968
969
  const [, setTick] = (0, import_react8.useState)(0);
@@ -978,6 +979,15 @@ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers
978
979
  s.categories.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime8.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: [
979
980
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "All" }),
980
981
  s.categories.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: c.id, children: c.name }, c.id))
982
+ ] }),
983
+ s.collections.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.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: [
984
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "All collections" }),
985
+ s.collections.map((c) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("option", { value: c.id, title: c.description, children: [
986
+ c.name,
987
+ " (",
988
+ c.count,
989
+ ")"
990
+ ] }, c.id))
981
991
  ] })
982
992
  ] }),
983
993
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex max-h-32 flex-wrap gap-1 overflow-y-auto", role: "group", "aria-label": label, children: s.items.map((it) => {
@@ -987,12 +997,13 @@ var StickerLibraryPicker = ({ provider, selected = [], onPick, label = "Stickers
987
997
  {
988
998
  type: "button",
989
999
  "aria-pressed": on,
990
- title: `${it.name} (${it.ref}) \xB7 ${it.licence.name}${it.licence.attribution ? ` \xB7 ${it.licence.attribution}` : ""}`,
1000
+ title: tooltip(it),
991
1001
  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"}`,
992
1002
  onClick: () => onPick(it),
993
1003
  children: [
994
1004
  it.thumbnail && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: it.thumbnail, alt: "", className: "h-4 w-4" }),
995
- it.name
1005
+ it.name,
1006
+ it.aiGenerated && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "rounded bg-slate-700 px-0.5 text-[8px] text-slate-200", "aria-label": "AI-generated", children: "AI" })
996
1007
  ]
997
1008
  },
998
1009
  it.ref
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StickerLibraryPicker
3
- } from "../chunk-KYMDNWSX.js";
3
+ } from "../chunk-ZX7JOPBO.js";
4
4
  import {
5
5
  LayerEffectsPanel,
6
6
  PaintGradientEditorView
@@ -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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.178.0",
3
+ "version": "0.179.0",
4
4
  "description": "React bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -277,7 +277,7 @@
277
277
  "dependencies": {},
278
278
  "peerDependencies": {
279
279
  "@dagrejs/dagre": "^1.1.8",
280
- "@pixerate/editor": ">=0.262.0 <1.0.0-0",
280
+ "@pixerate/editor": ">=0.263.0 <1.0.0-0",
281
281
  "@tiptap/core": "^2.27.3",
282
282
  "@tiptap/extension-bubble-menu": "^2.27.3",
283
283
  "@tiptap/extension-placeholder": "^2.27.3",
@@ -328,7 +328,7 @@
328
328
  "tsup": "^9.0.0",
329
329
  "typescript": "^5.7.3",
330
330
  "vitest": "^5.0.5",
331
- "@pixerate/editor": "0.262.0"
331
+ "@pixerate/editor": "0.263.0"
332
332
  },
333
333
  "scripts": {
334
334
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",