@panneau/media 0.0.0-stage → 5.0.0-alpha.10

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 (84) hide show
  1. package/README.md +134 -2
  2. package/dist/ImageItem.d.ts +23 -0
  3. package/dist/ImageItem.d.ts.map +1 -0
  4. package/dist/ImageItem.js +292 -0
  5. package/dist/ImageItem.js.map +1 -0
  6. package/dist/MediaField.css +195 -0
  7. package/dist/MediaField.d.ts +121 -0
  8. package/dist/MediaField.d.ts.map +1 -0
  9. package/dist/MediaField.js +896 -0
  10. package/dist/MediaField.js.map +1 -0
  11. package/dist/MediaField.module.js +50 -0
  12. package/dist/MediaField.module.js.map +1 -0
  13. package/dist/editor/ImageEditor.css +369 -0
  14. package/dist/editor/ImageEditor.d.ts +13 -0
  15. package/dist/editor/ImageEditor.d.ts.map +1 -0
  16. package/dist/editor/ImageEditor.js +692 -0
  17. package/dist/editor/ImageEditor.js.map +1 -0
  18. package/dist/editor/ImageEditor.module.js +86 -0
  19. package/dist/editor/ImageEditor.module.js.map +1 -0
  20. package/dist/editor/draw.d.ts +37 -0
  21. package/dist/editor/draw.d.ts.map +1 -0
  22. package/dist/editor/draw.js +130 -0
  23. package/dist/editor/draw.js.map +1 -0
  24. package/dist/editor/geometry.d.ts +54 -0
  25. package/dist/editor/geometry.d.ts.map +1 -0
  26. package/dist/editor/geometry.js +227 -0
  27. package/dist/editor/geometry.js.map +1 -0
  28. package/dist/editor/index.d.ts +5 -0
  29. package/dist/editor/index.d.ts.map +1 -0
  30. package/dist/editor/index.js +3 -0
  31. package/dist/editor/tools.d.ts +11 -0
  32. package/dist/editor/tools.d.ts.map +1 -0
  33. package/dist/editor/tools.js +1199 -0
  34. package/dist/editor/tools.js.map +1 -0
  35. package/dist/editor/types.d.ts +111 -0
  36. package/dist/editor/types.d.ts.map +1 -0
  37. package/dist/index.d.ts +5 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +4 -0
  40. package/dist/picker/MediaDetails.d.ts +22 -0
  41. package/dist/picker/MediaDetails.d.ts.map +1 -0
  42. package/dist/picker/MediaDetails.js +368 -0
  43. package/dist/picker/MediaDetails.js.map +1 -0
  44. package/dist/picker/MediaGrid.d.ts +30 -0
  45. package/dist/picker/MediaGrid.d.ts.map +1 -0
  46. package/dist/picker/MediaGrid.js +302 -0
  47. package/dist/picker/MediaGrid.js.map +1 -0
  48. package/dist/picker/MediaPicker.css +597 -0
  49. package/dist/picker/MediaPicker.d.ts +9 -0
  50. package/dist/picker/MediaPicker.d.ts.map +1 -0
  51. package/dist/picker/MediaPicker.js +1118 -0
  52. package/dist/picker/MediaPicker.js.map +1 -0
  53. package/dist/picker/MediaPicker.module.js +122 -0
  54. package/dist/picker/MediaPicker.module.js.map +1 -0
  55. package/dist/picker/PickerToolbar.d.ts +19 -0
  56. package/dist/picker/PickerToolbar.d.ts.map +1 -0
  57. package/dist/picker/PickerToolbar.js +266 -0
  58. package/dist/picker/PickerToolbar.js.map +1 -0
  59. package/dist/picker/UploadPanel.d.ts +22 -0
  60. package/dist/picker/UploadPanel.d.ts.map +1 -0
  61. package/dist/picker/UploadPanel.js +186 -0
  62. package/dist/picker/UploadPanel.js.map +1 -0
  63. package/dist/picker/format.d.ts +18 -0
  64. package/dist/picker/format.d.ts.map +1 -0
  65. package/dist/picker/format.js +64 -0
  66. package/dist/picker/format.js.map +1 -0
  67. package/dist/picker/index.d.ts +3 -0
  68. package/dist/picker/index.d.ts.map +1 -0
  69. package/dist/picker/index.js +1 -0
  70. package/dist/picker/types.d.ts +119 -0
  71. package/dist/picker/types.d.ts.map +1 -0
  72. package/dist/picker/useMediaBrowser.d.ts +50 -0
  73. package/dist/picker/useMediaBrowser.d.ts.map +1 -0
  74. package/dist/picker/useMediaBrowser.js +314 -0
  75. package/dist/picker/useMediaBrowser.js.map +1 -0
  76. package/dist/plugin.d.ts +11 -0
  77. package/dist/plugin.d.ts.map +1 -0
  78. package/dist/plugin.js +18 -0
  79. package/dist/plugin.js.map +1 -0
  80. package/dist/resourceSource.d.ts +21 -0
  81. package/dist/resourceSource.d.ts.map +1 -0
  82. package/dist/resourceSource.js +108 -0
  83. package/dist/resourceSource.js.map +1 -0
  84. package/package.json +58 -5
package/README.md CHANGED
@@ -1,3 +1,135 @@
1
- # Temporary Holding Version
1
+ # @panneau/media
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The media of Panneau: the media field, which references media of a library, makes media of uploads and follows their processing, the media picker, which browses libraries and uploads to them, and the image editor, which crops, turns and sets the focal point of an image.
4
+
5
+ ```bash
6
+ npm install @panneau/media@^5.0.0-alpha.0 @tanstack/react-query react-aria-components react-intl
7
+ ```
8
+
9
+ | Export | Content |
10
+ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | `@panneau/media` | `MediaField`, `ImageField`, `MediaFieldEntry`, `mediaPlugin`, `getImageOptions()`, `createResourceMediaSource()`, `getLibrary()`, `toMediaReference()`, `toMediaReferences()`, `isProcessing()` |
12
+ | `@panneau/media/picker` | `MediaPicker`, and the types of its sources: `MediaSource`, `MediaQuery`, `MediaPage`, `PickerMedia`, `MediaSort` |
13
+ | `@panneau/media/editor` | `ImageEditor`, `ImageEditorDialog`, `useImageEditorTools()`, and the types of the editor and its tools: `EditedImage`, `ImageEditorTool`, `ImageEditorToolContext` |
14
+
15
+ ## The media field
16
+
17
+ `MediaField` (the `media` type) references media of libraries: resources of kind `media` ([decision 0026](../../docs/decisions/0026-media-libraries.md)). Its value is a reference, `{ id, resource, label, media, transform }`, or a list of them. "Choose media" ("Add media" with `multiple`) opens [the media picker](#the-media-picker) on its `sources`: the media picked replaces the field's media, or is added to its list once. A file chosen or dropped becomes a media of the library through the adapter (`create(resource, { file })` of `@panneau/data`): sent to storage first when there is an upload source, then made a media from its upload (`{ upload }`), or sent in `multipart/form-data` without one. The field shows each media with its thumbnail and its status (`pending`, `processing`, `failed`), and reads it again (`get()`) until its file is processed.
18
+
19
+ - `resource` is the library the field uploads to. A `media` field can allow several libraries ([decision 0027](../../docs/decisions/0027-media-picker.md)): `MediaFieldEntry` uploads to the first one (`getLibrary()`: the field's `resource`, the first it lists, or the first library of the definition), with its `itemTitle` for the labels. The references the field makes carry their library (`resource`), and it reads each media in its own library. Without a library, the field shows its media and can't add any.
20
+ - `sources` are the libraries the picker browses (`MediaSource`), and `stateKey` keeps what the user browsed between openings. Without sources, the field only uploads. `MediaFieldEntry` gives the sources of every library the field allows (`createResourceMediaSource()`, with the adapter of `DataAdapterProvider`), and a `stateKey` by libraries.
21
+
22
+ - `adapter` defaults to the adapter of `DataAdapterProvider` (`useOptionalDataAdapter()` of `@panneau/data/query`). Without one, the field is read-only, and says so.
23
+ - `uploadSource` defaults to the one of the fields context (`FieldsProvider`, or `FormView` of `@panneau/forms`). The upload core, the file field and the Uppy source are in [`@panneau/fields`](../fields): this package doesn't import Uppy.
24
+ - `accept` and `maxSize` (the field's `accept`, its `accept` rule and its `maxSize` rule) refuse files before they are sent.
25
+
26
+ ```tsx
27
+ import { FieldsProvider, builtInFields } from '@panneau/fields';
28
+ import { createUppyUploadSource } from '@panneau/fields/uppy';
29
+ import { mediaPlugin } from '@panneau/media';
30
+
31
+ const uploadSource =
32
+ definition.uploads?.mode === 'presigned' && adapter.presignedUploads !== undefined
33
+ ? createUppyUploadSource(
34
+ adapter.presignedUploads({ endpoint: definition.uploads.endpoint }),
35
+ )
36
+ : null;
37
+
38
+ <DataAdapterProvider adapter={adapter}>
39
+ <FieldsProvider
40
+ components={{ ...builtInFields, ...mediaPlugin.fields }}
41
+ uploadSource={uploadSource}
42
+ >
43
+ …
44
+ </FieldsProvider>
45
+ </DataAdapterProvider>;
46
+ ```
47
+
48
+ ## The media picker
49
+
50
+ `MediaPicker` (`@panneau/media/picker`, [decision 0027](../../docs/decisions/0027-media-picker.md)) is a dialog to browse libraries, upload to them, and pick one media, or several with `multiple`. It reads `MediaSource`s, one per library, and returns references with their library (`{ id, resource, label, media }`). This entry point only imports `@panneau/ui`, `@panneau/fields`, `@panneau/intl` and the runtime of `@panneau/protocol`: a product opens the picker from its own screens without loading `@panneau/data` or `@panneau/core`.
51
+
52
+ - **Library tab:** search, the type filter, the sorts and filters of the source and of the opener, infinite scroll, and the details of the last media selected, which edit the source's `fields` with `update()`.
53
+ - **Upload tab:** files become media of the library shown (`create()`), and are selected. With `confirmOnUpload` and a single media, the picker confirms as soon as the media exists.
54
+ - **What the opener chooses:**
55
+ - `sources`: the libraries;
56
+ - `accept` and `maxSize`: media that don't match are greyed out, with the reason;
57
+ - `filter`: filters the user can't change, shown as locked;
58
+ - `filters` and `sorts`: more of them;
59
+ - `value`: the current media;
60
+ - `title` and `confirmLabel`;
61
+ - `stateKey`: keeps the query, the pages and the scroll position of each library across openings.
62
+ - While a library loads, the grid shows the cards of its skeleton.
63
+ - Media being processed can be picked, and are read again (`get()`) until they are ready. A media whose processing failed can't be picked.
64
+
65
+ `createResourceMediaSource(adapter, library)` gives the source of a library resource: `GET /resources/{library}` with `q`, `filter`, `sort` and the page as the cursor, `POST` from an upload, and `PATCH` for the details. A product implements `MediaSource` on its own API.
66
+
67
+ ```tsx
68
+ import { createResourceMediaSource } from '@panneau/media';
69
+ import { MediaPicker } from '@panneau/media/picker';
70
+
71
+ const sources = definition.resources
72
+ .filter((resource) => resource.kind === 'media')
73
+ .map((library) => createResourceMediaSource(adapter, library));
74
+
75
+ <MediaPicker
76
+ isOpen={isOpen}
77
+ onOpenChange={setOpen}
78
+ sources={sources}
79
+ accept={['image/*']}
80
+ confirmLabel="Insert"
81
+ onSelect={([media]) => insertImage(media)}
82
+ />;
83
+ ```
84
+
85
+ ## The image editor
86
+
87
+ `ImageEditor` (`@panneau/media/editor`, [decision 0031](../../docs/decisions/0031-image-editor-and-image-field.md)) edits a transform of an image (the protocol's `MediaTransform`): the image as it will be rendered, the overlay of a tool over it, the tool's options on the side, and the result. This entry point only imports `@panneau/ui`, `@panneau/intl` and the runtime of `@panneau/protocol`.
88
+
89
+ - **Tools.** Crop (a frame with handles and thirds, ratios, and numbers), rotate (with flips) and focal point (with the automatic crops it gives), from `useImageEditorTools()`. A product adds its own: a panel, an overlay drawn in the coordinates of the view, and a `validate()` that says why the edits can't be applied yet. Tools can add their own keys to the transform.
90
+ - **Keyboard.** The crop frame and the focal point can be focused: arrow keys move them, and Shift + arrow keys resize the frame.
91
+ - **The field's rules.** `ratios` are offered, or enforced with `enforceRatios`. With `cropRequired`, the editor proposes the largest crop of the first ratio around the focal point, or waits for a crop.
92
+ - **The base of a transform for one use.** When the image has its own transform (`mediaTransform`, from its library), the edits apply over it by default, and the editor returns `{ base: "media", baseTransform, … }`. From the original file, it returns the edits alone. `canChooseBase` lets the user choose. When the media's transform is no longer the `baseTransform` of the value, the editor moves the crop inside the new version and says so.
93
+ - **In a page or in a dialog.** `ImageEditor` fits where it is placed, at the height its `className` gives it (40rem by default), and lays itself out for its own width: in a narrow panel, the image is on top and the tools under it. It shows Cancel when it gets `onCancel`. Its edits start from `value` when it mounts: give it a new `key` to start again from another one. `ImageEditorDialog` opens it in a large dialog, and a full-screen sheet on phones, with `isOpen`, `onOpenChange` and a `title`: Apply and Cancel close it, and each time it opens, the edits start from the value again.
94
+ - It returns null when there is nothing to apply. `--panneau-image-editor-stage` and `--panneau-image-editor-stage-pattern` set the colors of the stage, which stays dark.
95
+
96
+ ```tsx
97
+ import { ImageEditor, ImageEditorDialog, useImageEditorTools } from '@panneau/media/editor';
98
+
99
+ const tools = useImageEditorTools();
100
+
101
+ // In a page.
102
+ <ImageEditor
103
+ key={reference.id}
104
+ image={image}
105
+ value={reference.transform ?? null}
106
+ onApply={(transform) => onChange({ ...reference, transform })}
107
+ />;
108
+
109
+ // In a dialog.
110
+ <ImageEditorDialog
111
+ isOpen={isOpen}
112
+ onOpenChange={setOpen}
113
+ image={{ label: 'Cover', url, width: 4000, height: 3000, mediaTransform: media.transform }}
114
+ value={reference.transform ?? null}
115
+ tools={[tools.crop, tools.focalPoint]}
116
+ ratios={['16:9', '1:1']}
117
+ enforceRatios
118
+ cropRequired
119
+ onApply={(transform) => onChange({ ...reference, transform })}
120
+ />;
121
+ ```
122
+
123
+ ## The image field
124
+
125
+ `ImageField` (the `image` type, [decision 0031](../../docs/decisions/0031-image-editor-and-image-field.md)) is a `media` field for images, with the image editor. Its value, libraries, picker and uploads are those of `MediaField`, and it accepts `image/*` by default.
126
+
127
+ - Each image shows as it is rendered for this use, computed in the browser from the original, the media's own transform and the transform for this use. Edit opens the editor on that transform.
128
+ - Badges say whether an image is cropped for this use, needs a crop the field requires, or was cropped over a version of the library that changed since.
129
+ - **Options:** `ratios`, offered or enforced with `enforceRatios`; `cropRequired`; `rotate` and `focalPoint`, which offer those tools; and `transformBase` (`media`, `original` or `choose`). They show next to the description.
130
+ - When a crop is required, the editor is the step right after the pick of one image ("Next: crop", then "Use this crop"), with "Back to the library". It doesn't open after an upload.
131
+ - `MediaFieldEntry` renders the `image` type with `getImageOptions()`: the field's `crop` rule (enforced ratios, a required crop), its suggested `ratios`, `rotate`, `focalPoint` and `transformBase`.
132
+
133
+ `mediaPlugin` gives the `media` and `image` types to `@panneau/core`: pass it after `fieldsPlugin`. The `file` type is built into `@panneau/fields`.
134
+
135
+ The package layout, scripts and API reports are explained in [`docs/packages.md`](../../docs/packages.md).
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { MediaReference } from '@panneau/protocol';
3
+ import type { EditedImage } from './editor/types.js';
4
+ /** The image of a reference, as the editor reads it, or null when its media can't be edited. */
5
+ export declare function editedImageOf(reference: MediaReference): EditedImage | null;
6
+ /**
7
+ * Whether the media's own transform changed since the transform for this use was made over it
8
+ * (decision 0031).
9
+ */
10
+ export declare function libraryChanged(reference: MediaReference): boolean;
11
+ export interface ImageItemProps {
12
+ reference: MediaReference;
13
+ /** A gallery tile, or the card of a single image. */
14
+ tile: boolean;
15
+ cropRequired: boolean;
16
+ /** The status badge of a media being processed. */
17
+ status: ReactNode;
18
+ onEdit: (() => void) | null;
19
+ onRemove: (() => void) | null;
20
+ }
21
+ /** An image of an `image` field: as it is rendered for this use, with its crop and its actions. */
22
+ export declare function ImageItem({ reference, tile, cropRequired, status, onEdit, onRemove, }: ImageItemProps): import("react").JSX.Element;
23
+ //# sourceMappingURL=ImageItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageItem.d.ts","sourceRoot":"","sources":["../src/ImageItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,gGAAgG;AAChG,wBAAgB,aAAa,CAAC,SAAS,EAAE,cAAc,GAAG,WAAW,GAAG,IAAI,CAkB3E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,cAAc,GAAG,OAAO,CAOjE;AAED,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,cAAc,CAAC;IAC1B,qDAAqD;IACrD,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,mDAAmD;IACnD,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;CACjC;AAED,mGAAmG;AACnG,wBAAgB,SAAS,CAAC,EACtB,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,MAAM,EACN,QAAQ,GACX,EAAE,cAAc,+BA4HhB"}
@@ -0,0 +1,292 @@
1
+ import MediaField_module_default from "./MediaField.module.js";
2
+ import { sameEdits } from "./editor/geometry.js";
3
+ import { TransformedImage, ratioLabel, renderedImage } from "./editor/draw.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { Crop, FileImage, Trash2 } from "lucide-react";
6
+ import { fieldsMessages, mediaMessages } from "@panneau/intl";
7
+ import { Badge, Button, IconButton, Text, usePanneauIntl } from "@panneau/ui";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ //#region src/ImageItem.tsx
10
+ /** The image of a reference, as the editor reads it, or null when its media can't be edited. */
11
+ function editedImageOf(reference) {
12
+ const media = reference.media;
13
+ const url = media?.url ?? media?.thumbnailUrl;
14
+ if (media?.type !== "image" || typeof url !== "string" || typeof media.width !== "number" || typeof media.height !== "number") return null;
15
+ return {
16
+ label: reference.label ?? reference.id,
17
+ url,
18
+ width: media.width,
19
+ height: media.height,
20
+ mediaTransform: media.transform ?? null
21
+ };
22
+ }
23
+ /**
24
+ * Whether the media's own transform changed since the transform for this use was made over it
25
+ * (decision 0031).
26
+ */
27
+ function libraryChanged(reference) {
28
+ const transform = reference.transform;
29
+ return transform?.base === "media" && transform.baseTransform !== void 0 && !sameEdits(transform.baseTransform, reference.media?.transform ?? {});
30
+ }
31
+ /** An image of an `image` field: as it is rendered for this use, with its crop and its actions. */
32
+ function ImageItem(t0) {
33
+ const $ = c(68);
34
+ const { reference, tile, cropRequired, status, onEdit, onRemove } = t0;
35
+ const intl = usePanneauIntl();
36
+ const name = reference.label ?? reference.id;
37
+ let changed;
38
+ let cropped;
39
+ let image;
40
+ let needsCrop;
41
+ let size;
42
+ if ($[0] !== cropRequired || $[1] !== intl || $[2] !== reference) {
43
+ image = editedImageOf(reference);
44
+ cropped = reference.transform?.crop !== void 0;
45
+ let t1;
46
+ if ($[8] !== reference) {
47
+ t1 = libraryChanged(reference);
48
+ $[8] = reference;
49
+ $[9] = t1;
50
+ } else t1 = $[9];
51
+ changed = t1;
52
+ needsCrop = cropRequired && !cropped;
53
+ size = null;
54
+ if (image !== null) {
55
+ const { crop } = renderedImage(image, reference.transform);
56
+ size = intl.formatMessage(mediaMessages.editorResultSize, {
57
+ width: Math.round(crop.width),
58
+ height: Math.round(crop.height),
59
+ ratio: ratioLabel(crop.width, crop.height)
60
+ });
61
+ }
62
+ $[0] = cropRequired;
63
+ $[1] = intl;
64
+ $[2] = reference;
65
+ $[3] = changed;
66
+ $[4] = cropped;
67
+ $[5] = image;
68
+ $[6] = needsCrop;
69
+ $[7] = size;
70
+ } else {
71
+ changed = $[3];
72
+ cropped = $[4];
73
+ image = $[5];
74
+ needsCrop = $[6];
75
+ size = $[7];
76
+ }
77
+ let t1;
78
+ if ($[10] !== image || $[11] !== reference.media || $[12] !== reference.transform || $[13] !== tile) {
79
+ t1 = image !== null ? /* @__PURE__ */ jsx(TransformedImage, {
80
+ image,
81
+ transform: reference.transform,
82
+ alt: "",
83
+ fit: tile ? "slice" : "meet",
84
+ className: tile ? MediaField_module_default.tilePreview : MediaField_module_default.preview
85
+ }) : typeof reference.media?.thumbnailUrl === "string" ? /* @__PURE__ */ jsx("img", {
86
+ src: reference.media.thumbnailUrl,
87
+ alt: "",
88
+ className: tile ? MediaField_module_default.tilePreview : MediaField_module_default.preview
89
+ }) : /* @__PURE__ */ jsx("span", {
90
+ className: tile ? MediaField_module_default.tilePreview : MediaField_module_default.preview,
91
+ children: /* @__PURE__ */ jsx(FileImage, { "aria-hidden": true })
92
+ });
93
+ $[10] = image;
94
+ $[11] = reference.media;
95
+ $[12] = reference.transform;
96
+ $[13] = tile;
97
+ $[14] = t1;
98
+ } else t1 = $[14];
99
+ const preview = t1;
100
+ let t2;
101
+ if ($[15] !== cropped || $[16] !== intl || $[17] !== needsCrop) {
102
+ t2 = cropped ? /* @__PURE__ */ jsx(Badge, {
103
+ tone: "info",
104
+ children: intl.formatMessage(mediaMessages.imageCropped)
105
+ }) : needsCrop ? /* @__PURE__ */ jsx(Badge, {
106
+ tone: "warning",
107
+ children: intl.formatMessage(mediaMessages.imageNeedsCrop)
108
+ }) : null;
109
+ $[15] = cropped;
110
+ $[16] = intl;
111
+ $[17] = needsCrop;
112
+ $[18] = t2;
113
+ } else t2 = $[18];
114
+ let t3;
115
+ if ($[19] !== changed || $[20] !== intl) {
116
+ t3 = changed ? /* @__PURE__ */ jsx(Badge, {
117
+ tone: "warning",
118
+ children: intl.formatMessage(mediaMessages.imageLibraryChanged)
119
+ }) : null;
120
+ $[19] = changed;
121
+ $[20] = intl;
122
+ $[21] = t3;
123
+ } else t3 = $[21];
124
+ let t4;
125
+ if ($[22] !== changed || $[23] !== intl || $[24] !== reference.transform?.base) {
126
+ t4 = reference.transform?.base === "media" && !changed ? /* @__PURE__ */ jsx(Badge, { children: intl.formatMessage(mediaMessages.imageOverLibrary) }) : null;
127
+ $[22] = changed;
128
+ $[23] = intl;
129
+ $[24] = reference.transform?.base;
130
+ $[25] = t4;
131
+ } else t4 = $[25];
132
+ let t5;
133
+ if ($[26] !== status || $[27] !== t2 || $[28] !== t3 || $[29] !== t4) {
134
+ t5 = /* @__PURE__ */ jsxs("span", {
135
+ className: MediaField_module_default.badges,
136
+ children: [
137
+ t2,
138
+ t3,
139
+ t4,
140
+ status
141
+ ]
142
+ });
143
+ $[26] = status;
144
+ $[27] = t2;
145
+ $[28] = t3;
146
+ $[29] = t4;
147
+ $[30] = t5;
148
+ } else t5 = $[30];
149
+ const badges = t5;
150
+ let t6;
151
+ if ($[31] !== changed || $[32] !== image || $[33] !== intl || $[34] !== name || $[35] !== needsCrop || $[36] !== onEdit || $[37] !== tile) {
152
+ t6 = onEdit !== null && image !== null ? tile ? /* @__PURE__ */ jsx(IconButton, {
153
+ icon: Crop,
154
+ size: "sm",
155
+ label: intl.formatMessage(mediaMessages.imageEditOf, { name }),
156
+ onPress: onEdit
157
+ }) : /* @__PURE__ */ jsx(Button, {
158
+ size: "sm",
159
+ icon: Crop,
160
+ variant: needsCrop || changed ? "primary" : void 0,
161
+ "aria-label": intl.formatMessage(mediaMessages.imageEditOf, { name }),
162
+ onPress: onEdit,
163
+ children: intl.formatMessage(mediaMessages.imageEdit)
164
+ }) : null;
165
+ $[31] = changed;
166
+ $[32] = image;
167
+ $[33] = intl;
168
+ $[34] = name;
169
+ $[35] = needsCrop;
170
+ $[36] = onEdit;
171
+ $[37] = tile;
172
+ $[38] = t6;
173
+ } else t6 = $[38];
174
+ const edit = t6;
175
+ let t7;
176
+ if ($[39] !== intl || $[40] !== name || $[41] !== onRemove) {
177
+ t7 = onRemove !== null ? /* @__PURE__ */ jsx(IconButton, {
178
+ icon: Trash2,
179
+ size: "sm",
180
+ variant: "ghost",
181
+ label: intl.formatMessage(fieldsMessages.removeFile, { name }),
182
+ onPress: onRemove
183
+ }) : null;
184
+ $[39] = intl;
185
+ $[40] = name;
186
+ $[41] = onRemove;
187
+ $[42] = t7;
188
+ } else t7 = $[42];
189
+ const remove = t7;
190
+ if (tile) {
191
+ let t8;
192
+ if ($[43] !== name) {
193
+ t8 = /* @__PURE__ */ jsx("span", {
194
+ className: MediaField_module_default.name,
195
+ children: name
196
+ });
197
+ $[43] = name;
198
+ $[44] = t8;
199
+ } else t8 = $[44];
200
+ let t9;
201
+ if ($[45] !== edit || $[46] !== remove) {
202
+ t9 = edit !== null || remove !== null ? /* @__PURE__ */ jsxs("span", {
203
+ className: MediaField_module_default.tileActions,
204
+ children: [edit, remove]
205
+ }) : null;
206
+ $[45] = edit;
207
+ $[46] = remove;
208
+ $[47] = t9;
209
+ } else t9 = $[47];
210
+ let t10;
211
+ if ($[48] !== badges || $[49] !== preview || $[50] !== t8 || $[51] !== t9) {
212
+ t10 = /* @__PURE__ */ jsxs("li", {
213
+ className: MediaField_module_default.tile,
214
+ children: [
215
+ preview,
216
+ t8,
217
+ badges,
218
+ t9
219
+ ]
220
+ });
221
+ $[48] = badges;
222
+ $[49] = preview;
223
+ $[50] = t8;
224
+ $[51] = t9;
225
+ $[52] = t10;
226
+ } else t10 = $[52];
227
+ return t10;
228
+ }
229
+ let t8;
230
+ if ($[53] !== name) {
231
+ t8 = /* @__PURE__ */ jsx("span", {
232
+ className: MediaField_module_default.name,
233
+ children: name
234
+ });
235
+ $[53] = name;
236
+ $[54] = t8;
237
+ } else t8 = $[54];
238
+ let t9;
239
+ if ($[55] !== size) {
240
+ t9 = size !== null ? /* @__PURE__ */ jsx(Text, {
241
+ as: "span",
242
+ size: "sm",
243
+ muted: true,
244
+ numeric: true,
245
+ children: size
246
+ }) : null;
247
+ $[55] = size;
248
+ $[56] = t9;
249
+ } else t9 = $[56];
250
+ let t10;
251
+ if ($[57] !== edit || $[58] !== remove) {
252
+ t10 = edit !== null || remove !== null ? /* @__PURE__ */ jsxs("span", {
253
+ className: MediaField_module_default.imageActions,
254
+ children: [edit, remove]
255
+ }) : null;
256
+ $[57] = edit;
257
+ $[58] = remove;
258
+ $[59] = t10;
259
+ } else t10 = $[59];
260
+ let t11;
261
+ if ($[60] !== badges || $[61] !== t10 || $[62] !== t8 || $[63] !== t9) {
262
+ t11 = /* @__PURE__ */ jsxs("span", {
263
+ className: MediaField_module_default.details,
264
+ children: [
265
+ t8,
266
+ t9,
267
+ badges,
268
+ t10
269
+ ]
270
+ });
271
+ $[60] = badges;
272
+ $[61] = t10;
273
+ $[62] = t8;
274
+ $[63] = t9;
275
+ $[64] = t11;
276
+ } else t11 = $[64];
277
+ let t12;
278
+ if ($[65] !== preview || $[66] !== t11) {
279
+ t12 = /* @__PURE__ */ jsxs("li", {
280
+ className: MediaField_module_default.imageCard,
281
+ children: [preview, t11]
282
+ });
283
+ $[65] = preview;
284
+ $[66] = t11;
285
+ $[67] = t12;
286
+ } else t12 = $[67];
287
+ return t12;
288
+ }
289
+ //#endregion
290
+ export { ImageItem, editedImageOf, libraryChanged };
291
+
292
+ //# sourceMappingURL=ImageItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImageItem.js","names":["Crop","FileImage","Trash2","ReactNode","fieldsMessages","mediaMessages","messages","MediaReference","Badge","Button","IconButton","Text","usePanneauIntl","styles","TransformedImage","ratioLabel","renderedImage","sameEdits","EditedImage","editedImageOf","reference","media","url","thumbnailUrl","type","width","height","label","id","mediaTransform","transform","libraryChanged","base","baseTransform","undefined","ImageItemProps","tile","cropRequired","status","onEdit","onRemove","ImageItem","t0","$","_c","intl","name","changed","cropped","image","needsCrop","size","crop","t1","formatMessage","editorResultSize","Math","round","ratio","tilePreview","preview","t2","imageCropped","imageNeedsCrop","t3","imageLibraryChanged","t4","imageOverLibrary","t5","badges","t6","imageEditOf","imageEdit","edit","t7","removeFile","remove","t8","t9","tileActions","t10","imageActions","t11","details","t12","imageCard","_c","messages","styles"],"sources":["../src/ImageItem.tsx"],"sourcesContent":["import { Crop, FileImage, Trash2 } from 'lucide-react';\nimport type { ReactNode } from 'react';\n\nimport { fieldsMessages, mediaMessages as messages } from '@panneau/intl';\nimport type { MediaReference } from '@panneau/protocol';\nimport { Badge, Button, IconButton, Text, usePanneauIntl } from '@panneau/ui';\n\nimport styles from './MediaField.module.css';\nimport { TransformedImage, ratioLabel, renderedImage } from './editor/draw';\nimport { sameEdits } from './editor/geometry';\nimport type { EditedImage } from './editor/types';\n\n/** The image of a reference, as the editor reads it, or null when its media can't be edited. */\nexport function editedImageOf(reference: MediaReference): EditedImage | null {\n const media = reference.media;\n const url = media?.url ?? media?.thumbnailUrl;\n if (\n media?.type !== 'image' ||\n typeof url !== 'string' ||\n typeof media.width !== 'number' ||\n typeof media.height !== 'number'\n ) {\n return null;\n }\n return {\n label: reference.label ?? reference.id,\n url,\n width: media.width,\n height: media.height,\n mediaTransform: media.transform ?? null,\n };\n}\n\n/**\n * Whether the media's own transform changed since the transform for this use was made over it\n * (decision 0031).\n */\nexport function libraryChanged(reference: MediaReference): boolean {\n const transform = reference.transform;\n return (\n transform?.base === 'media' &&\n transform.baseTransform !== undefined &&\n !sameEdits(transform.baseTransform, reference.media?.transform ?? {})\n );\n}\n\nexport interface ImageItemProps {\n reference: MediaReference;\n /** A gallery tile, or the card of a single image. */\n tile: boolean;\n cropRequired: boolean;\n /** The status badge of a media being processed. */\n status: ReactNode;\n onEdit: (() => void) | null;\n onRemove: (() => void) | null;\n}\n\n/** An image of an `image` field: as it is rendered for this use, with its crop and its actions. */\nexport function ImageItem({\n reference,\n tile,\n cropRequired,\n status,\n onEdit,\n onRemove,\n}: ImageItemProps) {\n const intl = usePanneauIntl();\n const name = reference.label ?? reference.id;\n const image = editedImageOf(reference);\n const cropped = reference.transform?.crop !== undefined;\n const changed = libraryChanged(reference);\n const needsCrop = cropRequired && !cropped;\n\n let size: string | null = null;\n if (image !== null) {\n // The crop is in the coordinates of the image as rendered.\n const { crop } = renderedImage(image, reference.transform);\n size = intl.formatMessage(messages.editorResultSize, {\n width: Math.round(crop.width),\n height: Math.round(crop.height),\n ratio: ratioLabel(crop.width, crop.height),\n });\n }\n\n const preview =\n image !== null ? (\n <TransformedImage\n image={image}\n transform={reference.transform}\n alt=\"\"\n fit={tile ? 'slice' : 'meet'}\n className={tile ? styles.tilePreview : styles.preview}\n />\n ) : typeof reference.media?.thumbnailUrl === 'string' ? (\n <img\n src={reference.media.thumbnailUrl}\n alt=\"\"\n className={tile ? styles.tilePreview : styles.preview}\n />\n ) : (\n <span className={tile ? styles.tilePreview : styles.preview}>\n <FileImage aria-hidden />\n </span>\n );\n\n const badges = (\n <span className={styles.badges}>\n {cropped ? (\n <Badge tone=\"info\">{intl.formatMessage(messages.imageCropped)}</Badge>\n ) : needsCrop ? (\n <Badge tone=\"warning\">{intl.formatMessage(messages.imageNeedsCrop)}</Badge>\n ) : null}\n {changed ? (\n <Badge tone=\"warning\">{intl.formatMessage(messages.imageLibraryChanged)}</Badge>\n ) : null}\n {reference.transform?.base === 'media' && !changed ? (\n <Badge>{intl.formatMessage(messages.imageOverLibrary)}</Badge>\n ) : null}\n {status}\n </span>\n );\n\n const edit =\n onEdit !== null && image !== null ? (\n tile ? (\n <IconButton\n icon={Crop}\n size=\"sm\"\n label={intl.formatMessage(messages.imageEditOf, { name })}\n onPress={onEdit}\n />\n ) : (\n <Button\n size=\"sm\"\n icon={Crop}\n variant={needsCrop || changed ? 'primary' : undefined}\n aria-label={intl.formatMessage(messages.imageEditOf, { name })}\n onPress={onEdit}\n >\n {intl.formatMessage(messages.imageEdit)}\n </Button>\n )\n ) : null;\n const remove =\n onRemove !== null ? (\n <IconButton\n icon={Trash2}\n size=\"sm\"\n variant=\"ghost\"\n label={intl.formatMessage(fieldsMessages.removeFile, { name })}\n onPress={onRemove}\n />\n ) : null;\n\n if (tile) {\n return (\n <li className={styles.tile}>\n {preview}\n <span className={styles.name}>{name}</span>\n {badges}\n {edit !== null || remove !== null ? (\n <span className={styles.tileActions}>\n {edit}\n {remove}\n </span>\n ) : null}\n </li>\n );\n }\n return (\n <li className={styles.imageCard}>\n {preview}\n <span className={styles.details}>\n <span className={styles.name}>{name}</span>\n {size !== null ? (\n <Text as=\"span\" size=\"sm\" muted numeric>\n {size}\n </Text>\n ) : null}\n {badges}\n {edit !== null || remove !== null ? (\n <span className={styles.imageActions}>\n {edit}\n {remove}\n </span>\n ) : null}\n </span>\n </li>\n );\n}\n"],"mappings":";;;;;;;;;;AAaA,SAAgBmB,cAAcC,WAA+C;CACzE,MAAMC,QAAQD,UAAUC;CACxB,MAAMC,MAAMD,OAAOC,OAAOD,OAAOE;CACjC,IACIF,OAAOG,SAAS,WAChB,OAAOF,QAAQ,YACf,OAAOD,MAAMI,UAAU,YACvB,OAAOJ,MAAMK,WAAW,UAExB,OAAO;CAEX,OAAO;EACHC,OAAOP,UAAUO,SAASP,UAAUQ;EACpCN;EACAG,OAAOJ,MAAMI;EACbC,QAAQL,MAAMK;EACdG,gBAAgBR,MAAMS,aAAa;CACvC;AACJ;;;;;AAMA,SAAgBC,eAAeX,WAAoC;CAC/D,MAAMU,YAAYV,UAAUU;CAC5B,OACIA,WAAWE,SAAS,WACpBF,UAAUG,kBAAkBC,KAAAA,KAC5B,CAACjB,UAAUa,UAAUG,eAAeb,UAAUC,OAAOS,aAAa,CAAC,CAAC;AAE5E;;AAcA,SAAOW,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAmB,MAAA,EAAAxB,WAAAgB,MAAAC,cAAAC,QAAAC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