@pixerate/editor-react 0.126.0 → 0.128.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.
@@ -2805,6 +2805,54 @@ var SelectionOptionsBar = ({
2805
2805
  ] })
2806
2806
  ] }),
2807
2807
  options.tool === "polygon" && /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
2808
+ (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ jsxs13("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
2809
+ /* @__PURE__ */ jsxs13("p", { className: "text-muted-foreground", children: [
2810
+ options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
2811
+ " Shift-click adds, Alt-click subtracts."
2812
+ ] }),
2813
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2814
+ "Text",
2815
+ /* @__PURE__ */ jsx15(
2816
+ "input",
2817
+ {
2818
+ type: "text",
2819
+ "aria-label": "Type mask text",
2820
+ value: options.typeText ?? "Type",
2821
+ onChange: (e) => set({ typeText: e.target.value }),
2822
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground"
2823
+ }
2824
+ )
2825
+ ] }),
2826
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2827
+ "Size",
2828
+ /* @__PURE__ */ jsx15(
2829
+ "input",
2830
+ {
2831
+ type: "number",
2832
+ min: 1,
2833
+ step: 1,
2834
+ "aria-label": "Type mask size",
2835
+ value: options.typeSize ?? 72,
2836
+ onChange: (e) => set({ typeSize: Math.max(1, Number(e.target.value) || 1) }),
2837
+ className: numberInput
2838
+ }
2839
+ ),
2840
+ "px"
2841
+ ] }),
2842
+ /* @__PURE__ */ jsxs13("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
2843
+ "Font",
2844
+ /* @__PURE__ */ jsx15(
2845
+ "input",
2846
+ {
2847
+ type: "text",
2848
+ "aria-label": "Type mask font",
2849
+ value: options.typeFamily ?? "sans-serif",
2850
+ onChange: (e) => set({ typeFamily: e.target.value }),
2851
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground"
2852
+ }
2853
+ )
2854
+ ] })
2855
+ ] }),
2808
2856
  options.tool === "range" && /* @__PURE__ */ jsxs13("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
2809
2857
  /* @__PURE__ */ jsx15("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
2810
2858
  /* @__PURE__ */ jsxs13("label", { className: "flex flex-col gap-1", children: [
@@ -3510,9 +3558,10 @@ var ShapeOptionsBar = ({ controller, options, onChange, className }) => {
3510
3558
 
3511
3559
  // src/image-editor/TypeOptionsBar.tsx
3512
3560
  import { useEffect as useEffect13, useState as useState16 } from "react";
3513
- import { TEXT_ALIGNS } from "@pixerate/editor/image-editor";
3561
+ import { TEXT_ALIGNS, TEXT_ORIENTATIONS } from "@pixerate/editor/image-editor";
3514
3562
  import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3515
3563
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
3564
+ var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
3516
3565
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
3517
3566
  const [, setTick] = useState16(0);
3518
3567
  useEffect13(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
@@ -3530,6 +3579,27 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3530
3579
  };
3531
3580
  const fonts = controller.listFonts();
3532
3581
  const missing = active?.type === "type" ? active.missingFonts ?? [] : [];
3582
+ const editedId = session?.alive ? session.layerId : typeId;
3583
+ const edited = editedId ? controller.getLayer(editedId) : null;
3584
+ const orientation = edited?.type === "type" ? edited.orientation ?? "horizontal" : options.orientation ?? "horizontal";
3585
+ const orient = (next) => {
3586
+ onChange({ ...options, orientation: next });
3587
+ try {
3588
+ setError(null);
3589
+ if (editedId) controller.setTextOrientation(editedId, next);
3590
+ } catch (e) {
3591
+ setError(e instanceof Error ? e.message : String(e));
3592
+ }
3593
+ };
3594
+ const upright = () => {
3595
+ try {
3596
+ setError(null);
3597
+ if (session?.alive) session.setStyle({ upright: !here.upright });
3598
+ else if (typeId) controller.setTextStyle(typeId, { upright: !(edited?.type === "type" && edited.runs[0]?.style.upright) });
3599
+ } catch (e) {
3600
+ setError(e instanceof Error ? e.message : String(e));
3601
+ }
3602
+ };
3533
3603
  const style = (change) => {
3534
3604
  onChange({ ...options, ...change });
3535
3605
  const s = {};
@@ -3585,7 +3655,21 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
3585
3655
  /* @__PURE__ */ jsx20(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
3586
3656
  ] }),
3587
3657
  /* @__PURE__ */ jsx20("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: TEXT_ALIGNS.map((a) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
3588
- /* @__PURE__ */ jsx20("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
3658
+ /* @__PURE__ */ jsxs18("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
3659
+ TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ jsx20("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
3660
+ orientation === "vertical" && editedId && /* @__PURE__ */ jsx20(
3661
+ "button",
3662
+ {
3663
+ type: "button",
3664
+ "aria-pressed": Boolean(session?.alive ? here.upright : edited?.type === "type" && edited.runs[0]?.style.upright),
3665
+ className: imageChipClass(Boolean(session?.alive ? here.upright : edited?.type === "type" && edited.runs[0]?.style.upright)),
3666
+ title: "Set Latin upright, one letter under the other (else turned sideways)",
3667
+ onClick: upright,
3668
+ children: "Upright Latin"
3669
+ }
3670
+ )
3671
+ ] }),
3672
+ /* @__PURE__ */ jsx20("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
3589
3673
  missing.length > 0 && /* @__PURE__ */ jsxs18("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
3590
3674
  "Missing ",
3591
3675
  missing.length === 1 ? "font" : "fonts",
@@ -9,8 +9,8 @@ export interface TypeOptionsBarProps {
9
9
  className?: string;
10
10
  }
11
11
  /**
12
- * The type tool's options: font family (from the editor's fonts), size, bold, italic, colour and
13
- * alignment. While text is being edited they style the selection (or the whole text); with a
12
+ * The type tool's options: font family (from the editor's fonts), size, bold, italic, colour,
13
+ * alignment and orientation (horizontal or vertical type, with upright Latin in vertical text). While text is being edited they style the selection (or the whole text); with a
14
14
  * type layer active they style all of it; otherwise they set what the next text uses.
15
15
  */
16
16
  export declare const TypeOptionsBar: React.FC<TypeOptionsBarProps>;
@@ -9,8 +9,8 @@ export interface TypeOptionsBarProps {
9
9
  className?: string;
10
10
  }
11
11
  /**
12
- * The type tool's options: font family (from the editor's fonts), size, bold, italic, colour and
13
- * alignment. While text is being edited they style the selection (or the whole text); with a
12
+ * The type tool's options: font family (from the editor's fonts), size, bold, italic, colour,
13
+ * alignment and orientation (horizontal or vertical type, with upright Latin in vertical text). While text is being edited they style the selection (or the whole text); with a
14
14
  * type layer active they style all of it; otherwise they set what the next text uses.
15
15
  */
16
16
  export declare const TypeOptionsBar: React.FC<TypeOptionsBarProps>;
@@ -4736,6 +4736,54 @@ var SelectionOptionsBar = ({
4736
4736
  ] })
4737
4737
  ] }),
4738
4738
  options.tool === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
4739
+ (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
4740
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { className: "text-muted-foreground", children: [
4741
+ options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
4742
+ " Shift-click adds, Alt-click subtracts."
4743
+ ] }),
4744
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4745
+ "Text",
4746
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4747
+ "input",
4748
+ {
4749
+ type: "text",
4750
+ "aria-label": "Type mask text",
4751
+ value: options.typeText ?? "Type",
4752
+ onChange: (e) => set({ typeText: e.target.value }),
4753
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground"
4754
+ }
4755
+ )
4756
+ ] }),
4757
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4758
+ "Size",
4759
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4760
+ "input",
4761
+ {
4762
+ type: "number",
4763
+ min: 1,
4764
+ step: 1,
4765
+ "aria-label": "Type mask size",
4766
+ value: options.typeSize ?? 72,
4767
+ onChange: (e) => set({ typeSize: Math.max(1, Number(e.target.value) || 1) }),
4768
+ className: numberInput
4769
+ }
4770
+ ),
4771
+ "px"
4772
+ ] }),
4773
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
4774
+ "Font",
4775
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4776
+ "input",
4777
+ {
4778
+ type: "text",
4779
+ "aria-label": "Type mask font",
4780
+ value: options.typeFamily ?? "sans-serif",
4781
+ onChange: (e) => set({ typeFamily: e.target.value }),
4782
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground"
4783
+ }
4784
+ )
4785
+ ] })
4786
+ ] }),
4739
4787
  options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
4740
4788
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
4741
4789
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "flex flex-col gap-1", children: [
@@ -5439,6 +5487,7 @@ var import_react30 = require("react");
5439
5487
  var import_image_editor19 = require("@pixerate/editor/image-editor");
5440
5488
  var import_jsx_runtime30 = require("react/jsx-runtime");
5441
5489
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
5490
+ var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
5442
5491
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
5443
5492
  const [, setTick] = (0, import_react30.useState)(0);
5444
5493
  (0, import_react30.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
@@ -5456,6 +5505,27 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
5456
5505
  };
5457
5506
  const fonts = controller.listFonts();
5458
5507
  const missing = active?.type === "type" ? active.missingFonts ?? [] : [];
5508
+ const editedId = session?.alive ? session.layerId : typeId;
5509
+ const edited = editedId ? controller.getLayer(editedId) : null;
5510
+ const orientation = edited?.type === "type" ? edited.orientation ?? "horizontal" : options.orientation ?? "horizontal";
5511
+ const orient = (next) => {
5512
+ onChange({ ...options, orientation: next });
5513
+ try {
5514
+ setError(null);
5515
+ if (editedId) controller.setTextOrientation(editedId, next);
5516
+ } catch (e) {
5517
+ setError(e instanceof Error ? e.message : String(e));
5518
+ }
5519
+ };
5520
+ const upright = () => {
5521
+ try {
5522
+ setError(null);
5523
+ if (session?.alive) session.setStyle({ upright: !here.upright });
5524
+ else if (typeId) controller.setTextStyle(typeId, { upright: !(edited?.type === "type" && edited.runs[0]?.style.upright) });
5525
+ } catch (e) {
5526
+ setError(e instanceof Error ? e.message : String(e));
5527
+ }
5528
+ };
5459
5529
  const style = (change) => {
5460
5530
  onChange({ ...options, ...change });
5461
5531
  const s = {};
@@ -5511,7 +5581,21 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
5511
5581
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
5512
5582
  ] }),
5513
5583
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor19.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
5514
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
5584
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
5585
+ import_image_editor19.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
5586
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5587
+ "button",
5588
+ {
5589
+ type: "button",
5590
+ "aria-pressed": Boolean(session?.alive ? here.upright : edited?.type === "type" && edited.runs[0]?.style.upright),
5591
+ className: imageChipClass(Boolean(session?.alive ? here.upright : edited?.type === "type" && edited.runs[0]?.style.upright)),
5592
+ title: "Set Latin upright, one letter under the other (else turned sideways)",
5593
+ onClick: upright,
5594
+ children: "Upright Latin"
5595
+ }
5596
+ )
5597
+ ] }),
5598
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
5515
5599
  missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
5516
5600
  "Missing ",
5517
5601
  missing.length === 1 ? "font" : "fonts",
@@ -27,7 +27,7 @@ import {
27
27
  useImageEditorControls,
28
28
  useImageEffectsTools,
29
29
  useImageHistogram
30
- } from "../chunk-FS5J4CY3.js";
30
+ } from "../chunk-EEF44DJ6.js";
31
31
  import "../chunk-AJCWF6SN.js";
32
32
  import "../chunk-6BWTJ3EE.js";
33
33
  import "../chunk-5RPB4WGT.js";
package/dist/index.cjs CHANGED
@@ -8450,6 +8450,54 @@ var SelectionOptionsBar = ({
8450
8450
  ] })
8451
8451
  ] }),
8452
8452
  options.tool === "polygon" && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-muted-foreground", children: "Click to add corners (Shift for 45\xB0), drag for a free-hand stretch; double-click, Enter or a click on the first corner closes it, Backspace removes a corner, Escape cancels." }),
8453
+ (options.tool === "type" || options.tool === "type-vertical") && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { "data-testid": "type-mask-options", className: "flex flex-col gap-2", children: [
8454
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "text-muted-foreground", children: [
8455
+ options.tool === "type-vertical" ? "Click where the column starts: the letters are stacked down from there, centred on the click." : "Click where the text starts (its baseline).",
8456
+ " Shift-click adds, Alt-click subtracts."
8457
+ ] }),
8458
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
8459
+ "Text",
8460
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8461
+ "input",
8462
+ {
8463
+ type: "text",
8464
+ "aria-label": "Type mask text",
8465
+ value: options.typeText ?? "Type",
8466
+ onChange: (e) => set({ typeText: e.target.value }),
8467
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground"
8468
+ }
8469
+ )
8470
+ ] }),
8471
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
8472
+ "Size",
8473
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8474
+ "input",
8475
+ {
8476
+ type: "number",
8477
+ min: 1,
8478
+ step: 1,
8479
+ "aria-label": "Type mask size",
8480
+ value: options.typeSize ?? 72,
8481
+ onChange: (e) => set({ typeSize: Math.max(1, Number(e.target.value) || 1) }),
8482
+ className: numberInput
8483
+ }
8484
+ ),
8485
+ "px"
8486
+ ] }),
8487
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex items-center gap-1 text-muted-foreground", children: [
8488
+ "Font",
8489
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
8490
+ "input",
8491
+ {
8492
+ type: "text",
8493
+ "aria-label": "Type mask font",
8494
+ value: options.typeFamily ?? "sans-serif",
8495
+ onChange: (e) => set({ typeFamily: e.target.value }),
8496
+ className: "min-w-0 flex-1 bg-background border border-border rounded px-1 py-0.5 text-foreground"
8497
+ }
8498
+ )
8499
+ ] })
8500
+ ] }),
8453
8501
  options.tool === "range" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { "data-testid": "color-range-options", className: "flex flex-col gap-2", children: [
8454
8502
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { className: "text-muted-foreground", children: "Click a colour to select it; Shift-click adds a colour, Alt-click removes one." }),
8455
8503
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("label", { className: "flex flex-col gap-1", children: [
@@ -9153,6 +9201,7 @@ var import_react66 = require("react");
9153
9201
  var import_image_editor19 = require("@pixerate/editor/image-editor");
9154
9202
  var import_jsx_runtime46 = require("react/jsx-runtime");
9155
9203
  var ALIGN_LABELS = { left: "Left", center: "Centre", right: "Right", justify: "Justify" };
9204
+ var ORIENTATION_LABELS = { horizontal: "Horizontal", vertical: "Vertical" };
9156
9205
  var TypeOptionsBar = ({ controller, options, onChange, session, className }) => {
9157
9206
  const [, setTick] = (0, import_react66.useState)(0);
9158
9207
  (0, import_react66.useEffect)(() => controller.subscribe(() => setTick((n) => n + 1)), [controller]);
@@ -9170,6 +9219,27 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
9170
9219
  };
9171
9220
  const fonts = controller.listFonts();
9172
9221
  const missing = active?.type === "type" ? active.missingFonts ?? [] : [];
9222
+ const editedId = session?.alive ? session.layerId : typeId;
9223
+ const edited = editedId ? controller.getLayer(editedId) : null;
9224
+ const orientation = edited?.type === "type" ? edited.orientation ?? "horizontal" : options.orientation ?? "horizontal";
9225
+ const orient = (next) => {
9226
+ onChange({ ...options, orientation: next });
9227
+ try {
9228
+ setError(null);
9229
+ if (editedId) controller.setTextOrientation(editedId, next);
9230
+ } catch (e) {
9231
+ setError(e instanceof Error ? e.message : String(e));
9232
+ }
9233
+ };
9234
+ const upright = () => {
9235
+ try {
9236
+ setError(null);
9237
+ if (session?.alive) session.setStyle({ upright: !here.upright });
9238
+ else if (typeId) controller.setTextStyle(typeId, { upright: !(edited?.type === "type" && edited.runs[0]?.style.upright) });
9239
+ } catch (e) {
9240
+ setError(e instanceof Error ? e.message : String(e));
9241
+ }
9242
+ };
9173
9243
  const style = (change) => {
9174
9244
  onChange({ ...options, ...change });
9175
9245
  const s = {};
@@ -9225,7 +9295,21 @@ var TypeOptionsBar = ({ controller, options, onChange, session, className }) =>
9225
9295
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ImageColor, { label: "Text colour", value: shown.color, onChange: (color) => style({ color }) })
9226
9296
  ] }),
9227
9297
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Alignment", children: import_image_editor19.TEXT_ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-pressed": options.align === a, className: imageChipClass(options.align === a), onClick: () => style({ align: a }), children: ALIGN_LABELS[a] }, a)) }),
9228
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text, drag for a paragraph box, click text to edit it. Esc finishes." }),
9298
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex gap-1", role: "toolbar", "aria-label": "Orientation", children: [
9299
+ import_image_editor19.TEXT_ORIENTATIONS.map((o) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("button", { type: "button", "aria-pressed": orientation === o, className: imageChipClass(orientation === o), onClick: () => orient(o), children: ORIENTATION_LABELS[o] }, o)),
9300
+ orientation === "vertical" && editedId && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
9301
+ "button",
9302
+ {
9303
+ type: "button",
9304
+ "aria-pressed": Boolean(session?.alive ? here.upright : edited?.type === "type" && edited.runs[0]?.style.upright),
9305
+ className: imageChipClass(Boolean(session?.alive ? here.upright : edited?.type === "type" && edited.runs[0]?.style.upright)),
9306
+ title: "Set Latin upright, one letter under the other (else turned sideways)",
9307
+ onClick: upright,
9308
+ children: "Upright Latin"
9309
+ }
9310
+ )
9311
+ ] }),
9312
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { className: "text-[10px] text-muted-foreground", children: "Click to type point text (vertical: a column down from the click), drag for a paragraph box, click text to edit it. Esc finishes." }),
9229
9313
  missing.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { role: "status", className: "text-amber-600", "data-testid": "type-missing-fonts", children: [
9230
9314
  "Missing ",
9231
9315
  missing.length === 1 ? "font" : "fonts",
package/dist/index.js CHANGED
@@ -51,7 +51,7 @@ import {
51
51
  useImageEditorControls,
52
52
  useImageEffectsTools,
53
53
  useImageHistogram
54
- } from "./chunk-FS5J4CY3.js";
54
+ } from "./chunk-EEF44DJ6.js";
55
55
  import "./chunk-AJCWF6SN.js";
56
56
  import "./chunk-6BWTJ3EE.js";
57
57
  import "./chunk-5RPB4WGT.js";
@@ -6,7 +6,8 @@ export interface VectorTextPanelProps {
6
6
  }
7
7
  /**
8
8
  * Character and paragraph style of text: family, weight, size, italic, underline, strike-through,
9
- * tracking, leading, alignment and point / area text. It edits the selected characters while text
9
+ * tracking, leading, alignment, horizontal / vertical orientation (with upright Latin in vertical
10
+ * text) and point / area text. It edits the selected characters while text
10
11
  * is being edited, else the selected text, else the defaults for new text. Type on a Path turns a
11
12
  * selected path into path text, and Create Outlines turns text into paths (with an outline
12
13
  * shaper). Each change is one undo step.
@@ -6,7 +6,8 @@ export interface VectorTextPanelProps {
6
6
  }
7
7
  /**
8
8
  * Character and paragraph style of text: family, weight, size, italic, underline, strike-through,
9
- * tracking, leading, alignment and point / area text. It edits the selected characters while text
9
+ * tracking, leading, alignment, horizontal / vertical orientation (with upright Latin in vertical
10
+ * text) and point / area text. It edits the selected characters while text
10
11
  * is being edited, else the selected text, else the defaults for new text. Type on a Path turns a
11
12
  * selected path into path text, and Create Outlines turns text into paths (with an outline
12
13
  * shaper). Each change is one undo step.
@@ -1699,6 +1699,42 @@ function VectorTextPanel({ controller, className }) {
1699
1699
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Underline", "aria-pressed": f.underline === true, onClick: () => style({ underline: !f.underline }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("u", { children: "U" }) }),
1700
1700
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: buttonClass5, "aria-label": "Strike through", "aria-pressed": f.strikethrough === true, onClick: () => style({ strikethrough: !f.strikethrough }), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("s", { children: "S" }) })
1701
1701
  ] }),
1702
+ panel.target !== "defaults" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Orientation", children: [
1703
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1704
+ "button",
1705
+ {
1706
+ type: "button",
1707
+ className: buttonClass5,
1708
+ "aria-pressed": panel.orientation === "horizontal",
1709
+ title: "Horizontal text: lines left to right",
1710
+ onClick: () => (0, import_vector8.applyVectorTextOrientation)(controller, "horizontal"),
1711
+ children: "Horizontal"
1712
+ }
1713
+ ),
1714
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1715
+ "button",
1716
+ {
1717
+ type: "button",
1718
+ className: buttonClass5,
1719
+ "aria-pressed": panel.orientation === "vertical",
1720
+ disabled: !panel.canOrient,
1721
+ title: panel.canOrient ? "Vertical text: columns top to bottom, right to left" : "Text on a path cannot be vertical",
1722
+ onClick: () => (0, import_vector8.applyVectorTextOrientation)(controller, "vertical"),
1723
+ children: "Vertical"
1724
+ }
1725
+ ),
1726
+ panel.orientation === "vertical" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1727
+ "button",
1728
+ {
1729
+ type: "button",
1730
+ className: buttonClass5,
1731
+ "aria-pressed": f.upright === true,
1732
+ title: "Set Latin upright, one letter under the other (else turned sideways)",
1733
+ onClick: () => style({ upright: !f.upright }),
1734
+ children: "Upright Latin"
1735
+ }
1736
+ )
1737
+ ] }),
1702
1738
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-1", children: [
1703
1739
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "flex flex-1 items-center gap-1 text-xs text-foreground", title: "Tracking (1/1000 em)", children: [
1704
1740
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-[11px] text-muted-foreground", children: "VA" }),
@@ -1536,6 +1536,7 @@ import {
1536
1536
  VECTOR_FONT_WEIGHTS,
1537
1537
  VECTOR_TEXT_ALIGN_OPTIONS,
1538
1538
  applyVectorParagraphStyle,
1539
+ applyVectorTextOrientation,
1539
1540
  applyVectorTextStyle,
1540
1541
  getVectorTextPanel
1541
1542
  } from "@pixerate/editor/vector";
@@ -1612,6 +1613,42 @@ function VectorTextPanel({ controller, className }) {
1612
1613
  /* @__PURE__ */ jsx7("button", { type: "button", className: buttonClass5, "aria-label": "Underline", "aria-pressed": f.underline === true, onClick: () => style({ underline: !f.underline }), children: /* @__PURE__ */ jsx7("u", { children: "U" }) }),
1613
1614
  /* @__PURE__ */ jsx7("button", { type: "button", className: buttonClass5, "aria-label": "Strike through", "aria-pressed": f.strikethrough === true, onClick: () => style({ strikethrough: !f.strikethrough }), children: /* @__PURE__ */ jsx7("s", { children: "S" }) })
1614
1615
  ] }),
1616
+ panel.target !== "defaults" && /* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Orientation", children: [
1617
+ /* @__PURE__ */ jsx7(
1618
+ "button",
1619
+ {
1620
+ type: "button",
1621
+ className: buttonClass5,
1622
+ "aria-pressed": panel.orientation === "horizontal",
1623
+ title: "Horizontal text: lines left to right",
1624
+ onClick: () => applyVectorTextOrientation(controller, "horizontal"),
1625
+ children: "Horizontal"
1626
+ }
1627
+ ),
1628
+ /* @__PURE__ */ jsx7(
1629
+ "button",
1630
+ {
1631
+ type: "button",
1632
+ className: buttonClass5,
1633
+ "aria-pressed": panel.orientation === "vertical",
1634
+ disabled: !panel.canOrient,
1635
+ title: panel.canOrient ? "Vertical text: columns top to bottom, right to left" : "Text on a path cannot be vertical",
1636
+ onClick: () => applyVectorTextOrientation(controller, "vertical"),
1637
+ children: "Vertical"
1638
+ }
1639
+ ),
1640
+ panel.orientation === "vertical" && /* @__PURE__ */ jsx7(
1641
+ "button",
1642
+ {
1643
+ type: "button",
1644
+ className: buttonClass5,
1645
+ "aria-pressed": f.upright === true,
1646
+ title: "Set Latin upright, one letter under the other (else turned sideways)",
1647
+ onClick: () => style({ upright: !f.upright }),
1648
+ children: "Upright Latin"
1649
+ }
1650
+ )
1651
+ ] }),
1615
1652
  /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1", children: [
1616
1653
  /* @__PURE__ */ jsxs7("label", { className: "flex flex-1 items-center gap-1 text-xs text-foreground", title: "Tracking (1/1000 em)", children: [
1617
1654
  /* @__PURE__ */ jsx7("span", { className: "text-[11px] text-muted-foreground", children: "VA" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor-react",
3
- "version": "0.126.0",
3
+ "version": "0.128.0",
4
4
  "description": "React bindings and prompt/rich-text components for @pixerate/editor",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -254,7 +254,7 @@
254
254
  "dependencies": {},
255
255
  "peerDependencies": {
256
256
  "@dagrejs/dagre": "^1.1.8",
257
- "@pixerate/editor": ">=0.191.0 <1.0.0-0",
257
+ "@pixerate/editor": ">=0.193.0 <1.0.0-0",
258
258
  "@tiptap/core": "^2.27.3",
259
259
  "@tiptap/extension-bubble-menu": "^2.27.3",
260
260
  "@tiptap/extension-placeholder": "^2.27.3",
@@ -305,7 +305,7 @@
305
305
  "tsup": "^9.0.0",
306
306
  "typescript": "^5.7.3",
307
307
  "vitest": "^5.0.5",
308
- "@pixerate/editor": "0.191.0"
308
+ "@pixerate/editor": "0.193.0"
309
309
  },
310
310
  "scripts": {
311
311
  "build": "tsup && tsc -p tsconfig.build.json && node ../../scripts/finalize-declarations.mjs dist",