@haklex/rich-renderer-image 0.0.4 → 0.0.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ImageEditRenderer.d.ts","sourceRoot":"","sources":["../src/ImageEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AAErB,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,qBAAqB,CAAA;AAqB5B,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,2CAQ1D"}
1
+ {"version":3,"file":"ImageEditRenderer.d.ts","sourceRoot":"","sources":["../src/ImageEditRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,qBAAqB,CAAA;AA4B5B,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,kBAAkB,2CAQ1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"ImageRenderer.d.ts","sourceRoot":"","sources":["../src/ImageRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAA;AACnD,OAAO,cAAc,CAAA;AAErB,OAAO,EAAmB,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,OAAO,CAAA;AAezD,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,kBAAkB,CA4E3D,CAAA"}
1
+ {"version":3,"file":"ImageRenderer.d.ts","sourceRoot":"","sources":["../src/ImageRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAA;AAEnD,OAAO,EAAmB,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,OAAO,CAAA;AAuBzD,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,kBAAkB,CAwF3D,CAAA"}
package/dist/index.mjs CHANGED
@@ -7,8 +7,31 @@ import { ImageIcon, Type, ExternalLink, Trash2 } from "lucide-react";
7
7
  import { useState, useMemo, useRef, useEffect, useCallback } from "react";
8
8
  import "react-photo-view/dist/react-photo-view.css";
9
9
  import { PhotoProvider, PhotoView } from "react-photo-view";
10
- function getCaptionText$1(altText, caption) {
11
- if (caption) return caption;
10
+ var semanticClassNames = { root: "rr-image-root", frame: "rr-image-frame", frameLoading: "rr-image-loading", frameLoaded: "rr-image-loaded", frameError: "rr-image-error", image: "rr-image-img", loader: "rr-image-loader", errorBadge: "rr-image-error", caption: "rr-image-caption", editTrigger: "rr-image-edit-trigger", editPlaceholder: "rr-image-edit-placeholder", editPanel: "rr-image-edit-panel", editField: "rr-image-edit-field", editFieldIcon: "rr-image-edit-field-icon", editInput: "rr-image-edit-input", editActions: "rr-image-edit-actions", editActionButton: "rr-image-edit-action-btn", editActionButtonEnd: "rr-image-edit-action-btn--end" };
11
+ var root = "_1n94osf0";
12
+ var image = "_1n94osf2";
13
+ var imageState = { loading: "_1n94osf3", loaded: "_1n94osf4", error: "_1n94osf5" };
14
+ var frame = "_1n94osf6";
15
+ var frameEditMode = "_1n94osf7";
16
+ var loader = "_1n94osf9";
17
+ var errorBadge = "_1n94osfa";
18
+ var caption = "_1n94osfb";
19
+ var editTrigger = "_1n94osfj";
20
+ var editPlaceholder = "_1n94osfk";
21
+ var editPanel = "_1n94osfl";
22
+ var editField = "_1n94osfm";
23
+ var editFieldIcon = "_1n94osfn";
24
+ var editInput = "_1n94osfo";
25
+ var editActions = "_1n94osfp";
26
+ var editActionButton = "_1n94osfq";
27
+ var editActionButtonEnd = "_1n94osfr";
28
+ const frameStateSemanticClass$1 = {
29
+ loading: semanticClassNames.frameLoading,
30
+ loaded: semanticClassNames.frameLoaded,
31
+ error: semanticClassNames.frameError
32
+ };
33
+ function getCaptionText$1(altText, caption2) {
34
+ if (caption2) return caption2;
12
35
  if (!altText) return void 0;
13
36
  if (altText.startsWith("!") || altText.startsWith("¡")) {
14
37
  return altText.slice(1);
@@ -20,14 +43,14 @@ const ImageRenderer = ({
20
43
  altText,
21
44
  width,
22
45
  height,
23
- caption,
46
+ caption: caption$1,
24
47
  thumbhash,
25
48
  accent
26
49
  }) => {
27
50
  const [state, setState] = useState("loading");
28
51
  const captionText = useMemo(
29
- () => getCaptionText$1(altText, caption),
30
- [altText, caption]
52
+ () => getCaptionText$1(altText, caption$1),
53
+ [altText, caption$1]
31
54
  );
32
55
  const placeholderUrl = useMemo(
33
56
  () => thumbhash ? decodeThumbHash(thumbhash) : void 0,
@@ -42,11 +65,11 @@ const ImageRenderer = ({
42
65
  maxWidth: "100%",
43
66
  ...width && height ? { aspectRatio: `${width} / ${height}` } : {}
44
67
  };
45
- return /* @__PURE__ */ jsxs("figure", { className: "rr-image-root", children: [
68
+ return /* @__PURE__ */ jsxs("figure", { className: `${root} ${semanticClassNames.root}`, children: [
46
69
  /* @__PURE__ */ jsx(PhotoProvider, { photoClosable: true, children: /* @__PURE__ */ jsx(PhotoView, { src, children: /* @__PURE__ */ jsxs(
47
70
  "div",
48
71
  {
49
- className: `rr-image-frame rr-image-${state}`,
72
+ className: `${frame} ${semanticClassNames.frame} ${imageState[state]} ${frameStateSemanticClass$1[state]}`.trim(),
50
73
  style: frameStyle,
51
74
  role: "button",
52
75
  tabIndex: 0,
@@ -65,21 +88,43 @@ const ImageRenderer = ({
65
88
  width,
66
89
  height,
67
90
  loading: "lazy",
68
- className: "rr-image-img",
91
+ className: `${image} ${semanticClassNames.image}`,
69
92
  onLoad: () => setState("loaded"),
70
93
  onError: () => setState("error")
71
94
  }
72
95
  ),
73
- state === "loading" && /* @__PURE__ */ jsx("span", { className: "rr-image-loader" }),
74
- state === "error" && /* @__PURE__ */ jsx("span", { className: "rr-image-error", children: "Image failed to load" })
96
+ state === "loading" && /* @__PURE__ */ jsx(
97
+ "span",
98
+ {
99
+ className: `${loader} ${semanticClassNames.loader}`
100
+ }
101
+ ),
102
+ state === "error" && /* @__PURE__ */ jsx(
103
+ "span",
104
+ {
105
+ className: `${errorBadge} ${semanticClassNames.errorBadge}`,
106
+ children: "Image failed to load"
107
+ }
108
+ )
75
109
  ]
76
110
  }
77
111
  ) }) }),
78
- captionText && /* @__PURE__ */ jsx("figcaption", { className: "rr-image-caption", children: captionText })
112
+ captionText && /* @__PURE__ */ jsx(
113
+ "figcaption",
114
+ {
115
+ className: `${caption} ${semanticClassNames.caption}`,
116
+ children: captionText
117
+ }
118
+ )
79
119
  ] });
80
120
  };
81
- function getCaptionText(altText, caption) {
82
- if (caption) return caption;
121
+ const frameStateSemanticClass = {
122
+ loading: semanticClassNames.frameLoading,
123
+ loaded: semanticClassNames.frameLoaded,
124
+ error: semanticClassNames.frameError
125
+ };
126
+ function getCaptionText(altText, caption2) {
127
+ if (caption2) return caption2;
83
128
  if (!altText) return void 0;
84
129
  if (altText.startsWith("!") || altText.startsWith("¡")) {
85
130
  return altText.slice(1);
@@ -98,7 +143,7 @@ function ImageEditRendererInner({
98
143
  altText,
99
144
  width,
100
145
  height,
101
- caption,
146
+ caption: caption$1,
102
147
  thumbhash,
103
148
  accent
104
149
  }) {
@@ -109,13 +154,13 @@ function ImageEditRendererInner({
109
154
  const [open, setOpen] = useState(!src);
110
155
  const [editSrc, setEditSrc] = useState(src);
111
156
  const [editAltText, setEditAltText] = useState(altText);
112
- const [editCaption, setEditCaption] = useState(caption || "");
157
+ const [editCaption, setEditCaption] = useState(caption$1 || "");
113
158
  const [state, setState] = useState("loading");
114
159
  useEffect(() => {
115
160
  setEditSrc(src);
116
161
  setEditAltText(altText);
117
- setEditCaption(caption || "");
118
- }, [src, altText, caption]);
162
+ setEditCaption(caption$1 || "");
163
+ }, [src, altText, caption$1]);
119
164
  useEffect(() => {
120
165
  if (!src) setOpen(true);
121
166
  }, [src]);
@@ -129,8 +174,8 @@ function ImageEditRendererInner({
129
174
  [thumbhash]
130
175
  );
131
176
  const captionText = useMemo(
132
- () => getCaptionText(altText, caption),
133
- [altText, caption]
177
+ () => getCaptionText(altText, caption$1),
178
+ [altText, caption$1]
134
179
  );
135
180
  const commitChanges = useCallback(() => {
136
181
  const trimmedSrc = editSrc.trim();
@@ -168,11 +213,11 @@ function ImageEditRendererInner({
168
213
  e.preventDefault();
169
214
  setEditSrc(src);
170
215
  setEditAltText(altText);
171
- setEditCaption(caption || "");
216
+ setEditCaption(caption$1 || "");
172
217
  setOpen(false);
173
218
  }
174
219
  },
175
- [commitChanges, src, altText, caption]
220
+ [commitChanges, src, altText, caption$1]
176
221
  );
177
222
  if (!editable) {
178
223
  return /* @__PURE__ */ jsx(
@@ -182,7 +227,7 @@ function ImageEditRendererInner({
182
227
  altText,
183
228
  width,
184
229
  height,
185
- caption,
230
+ caption: caption$1,
186
231
  thumbhash,
187
232
  accent
188
233
  }
@@ -205,123 +250,200 @@ function ImageEditRendererInner({
205
250
  if (!nextOpen) {
206
251
  setEditSrc(src);
207
252
  setEditAltText(altText);
208
- setEditCaption(caption || "");
253
+ setEditCaption(caption$1 || "");
209
254
  }
210
255
  },
211
256
  children: [
212
257
  /* @__PURE__ */ jsx(
213
258
  PopoverTrigger,
214
259
  {
215
- render: /* @__PURE__ */ jsx("div", { ref: wrapperRef, className: "rr-image-edit-trigger" }),
216
- children: src ? /* @__PURE__ */ jsxs("figure", { className: "rr-image-root", children: [
260
+ render: /* @__PURE__ */ jsx(
261
+ "div",
262
+ {
263
+ ref: wrapperRef,
264
+ className: `${editTrigger} ${semanticClassNames.editTrigger}`
265
+ }
266
+ ),
267
+ children: src ? /* @__PURE__ */ jsxs(
268
+ "figure",
269
+ {
270
+ className: `${root} ${semanticClassNames.root}`,
271
+ children: [
272
+ /* @__PURE__ */ jsxs(
273
+ "div",
274
+ {
275
+ className: `${frame} ${semanticClassNames.frame} ${frameEditMode} ${imageState[state]} ${frameStateSemanticClass[state]}`.trim(),
276
+ style: frameStyle,
277
+ children: [
278
+ /* @__PURE__ */ jsx(
279
+ "img",
280
+ {
281
+ src,
282
+ alt: altText,
283
+ width,
284
+ height,
285
+ loading: "lazy",
286
+ className: `${image} ${semanticClassNames.image}`,
287
+ onLoad: () => setState("loaded"),
288
+ onError: () => setState("error")
289
+ }
290
+ ),
291
+ state === "loading" && /* @__PURE__ */ jsx(
292
+ "span",
293
+ {
294
+ className: `${loader} ${semanticClassNames.loader}`
295
+ }
296
+ ),
297
+ state === "error" && /* @__PURE__ */ jsx(
298
+ "span",
299
+ {
300
+ className: `${errorBadge} ${semanticClassNames.errorBadge}`,
301
+ children: "Image failed to load"
302
+ }
303
+ )
304
+ ]
305
+ }
306
+ ),
307
+ captionText && /* @__PURE__ */ jsx(
308
+ "figcaption",
309
+ {
310
+ className: `${caption} ${semanticClassNames.caption}`,
311
+ children: captionText
312
+ }
313
+ )
314
+ ]
315
+ }
316
+ ) : /* @__PURE__ */ jsxs(
317
+ "div",
318
+ {
319
+ className: `${editPlaceholder} ${semanticClassNames.editPlaceholder}`,
320
+ children: [
321
+ /* @__PURE__ */ jsx(ImageIcon, { size: 24 }),
322
+ /* @__PURE__ */ jsx("span", { children: "Click to add image" })
323
+ ]
324
+ }
325
+ )
326
+ }
327
+ ),
328
+ /* @__PURE__ */ jsxs(
329
+ PopoverPanel,
330
+ {
331
+ side: "bottom",
332
+ sideOffset: 8,
333
+ className: `${editPanel} ${semanticClassNames.editPanel}`,
334
+ children: [
217
335
  /* @__PURE__ */ jsxs(
218
336
  "div",
219
337
  {
220
- className: `rr-image-frame rr-image-${state}`,
221
- style: frameStyle,
338
+ className: `${editField} ${semanticClassNames.editField}`,
222
339
  children: [
223
340
  /* @__PURE__ */ jsx(
224
- "img",
341
+ ImageIcon,
225
342
  {
226
- src,
227
- alt: altText,
228
- width,
229
- height,
230
- loading: "lazy",
231
- className: "rr-image-img",
232
- onLoad: () => setState("loaded"),
233
- onError: () => setState("error")
343
+ className: `${editFieldIcon} ${semanticClassNames.editFieldIcon}`,
344
+ size: 14
234
345
  }
235
346
  ),
236
- state === "loading" && /* @__PURE__ */ jsx("span", { className: "rr-image-loader" }),
237
- state === "error" && /* @__PURE__ */ jsx("span", { className: "rr-image-error", children: "Image failed to load" })
347
+ /* @__PURE__ */ jsx(
348
+ "input",
349
+ {
350
+ ref: srcInputRef,
351
+ className: `${editInput} ${semanticClassNames.editInput}`,
352
+ type: "url",
353
+ value: editSrc,
354
+ onChange: (e) => setEditSrc(e.target.value),
355
+ onKeyDown: handleKeyDown,
356
+ placeholder: "Image URL"
357
+ }
358
+ )
238
359
  ]
239
360
  }
240
361
  ),
241
- captionText && /* @__PURE__ */ jsx("figcaption", { className: "rr-image-caption", children: captionText })
242
- ] }) : /* @__PURE__ */ jsxs("div", { className: "rr-image-edit-placeholder", children: [
243
- /* @__PURE__ */ jsx(ImageIcon, { size: 24 }),
244
- /* @__PURE__ */ jsx("span", { children: "Click to add image" })
245
- ] })
246
- }
247
- ),
248
- /* @__PURE__ */ jsxs(
249
- PopoverPanel,
250
- {
251
- side: "bottom",
252
- sideOffset: 8,
253
- className: "rr-image-edit-panel",
254
- children: [
255
- /* @__PURE__ */ jsxs("div", { className: "rr-image-edit-field", children: [
256
- /* @__PURE__ */ jsx(ImageIcon, { className: "rr-image-edit-field-icon", size: 14 }),
257
- /* @__PURE__ */ jsx(
258
- "input",
259
- {
260
- ref: srcInputRef,
261
- className: "rr-image-edit-input",
262
- type: "url",
263
- value: editSrc,
264
- onChange: (e) => setEditSrc(e.target.value),
265
- onKeyDown: handleKeyDown,
266
- placeholder: "Image URL"
267
- }
268
- )
269
- ] }),
270
- /* @__PURE__ */ jsxs("div", { className: "rr-image-edit-field", children: [
271
- /* @__PURE__ */ jsx(Type, { className: "rr-image-edit-field-icon", size: 14 }),
272
- /* @__PURE__ */ jsx(
273
- "input",
274
- {
275
- className: "rr-image-edit-input",
276
- type: "text",
277
- value: editAltText,
278
- onChange: (e) => setEditAltText(e.target.value),
279
- onKeyDown: handleKeyDown,
280
- placeholder: "Alt text"
281
- }
282
- )
283
- ] }),
284
- /* @__PURE__ */ jsxs("div", { className: "rr-image-edit-field", children: [
285
- /* @__PURE__ */ jsx(Type, { className: "rr-image-edit-field-icon", size: 14 }),
286
- /* @__PURE__ */ jsx(
287
- "input",
288
- {
289
- className: "rr-image-edit-input",
290
- type: "text",
291
- value: editCaption,
292
- onChange: (e) => setEditCaption(e.target.value),
293
- onBlur: commitChanges,
294
- onKeyDown: handleKeyDown,
295
- placeholder: "Caption (optional)"
296
- }
297
- )
298
- ] }),
299
- /* @__PURE__ */ jsxs("div", { className: "rr-image-edit-actions", children: [
300
- /* @__PURE__ */ jsxs(
301
- "button",
302
- {
303
- className: "rr-image-edit-action-btn",
304
- type: "button",
305
- onClick: handleOpen,
306
- children: [
307
- /* @__PURE__ */ jsx(ExternalLink, { size: 14 }),
308
- "Open"
309
- ]
310
- }
311
- ),
312
- /* @__PURE__ */ jsxs(
313
- "button",
314
- {
315
- className: "rr-image-edit-action-btn rr-image-edit-action-btn--end",
316
- type: "button",
317
- onClick: handleDelete,
318
- children: [
319
- /* @__PURE__ */ jsx(Trash2, { size: 14 }),
320
- "Remove"
321
- ]
322
- }
323
- )
324
- ] })
362
+ /* @__PURE__ */ jsxs(
363
+ "div",
364
+ {
365
+ className: `${editField} ${semanticClassNames.editField}`,
366
+ children: [
367
+ /* @__PURE__ */ jsx(
368
+ Type,
369
+ {
370
+ className: `${editFieldIcon} ${semanticClassNames.editFieldIcon}`,
371
+ size: 14
372
+ }
373
+ ),
374
+ /* @__PURE__ */ jsx(
375
+ "input",
376
+ {
377
+ className: `${editInput} ${semanticClassNames.editInput}`,
378
+ type: "text",
379
+ value: editAltText,
380
+ onChange: (e) => setEditAltText(e.target.value),
381
+ onKeyDown: handleKeyDown,
382
+ placeholder: "Alt text"
383
+ }
384
+ )
385
+ ]
386
+ }
387
+ ),
388
+ /* @__PURE__ */ jsxs(
389
+ "div",
390
+ {
391
+ className: `${editField} ${semanticClassNames.editField}`,
392
+ children: [
393
+ /* @__PURE__ */ jsx(
394
+ Type,
395
+ {
396
+ className: `${editFieldIcon} ${semanticClassNames.editFieldIcon}`,
397
+ size: 14
398
+ }
399
+ ),
400
+ /* @__PURE__ */ jsx(
401
+ "input",
402
+ {
403
+ className: `${editInput} ${semanticClassNames.editInput}`,
404
+ type: "text",
405
+ value: editCaption,
406
+ onChange: (e) => setEditCaption(e.target.value),
407
+ onBlur: commitChanges,
408
+ onKeyDown: handleKeyDown,
409
+ placeholder: "Caption (optional)"
410
+ }
411
+ )
412
+ ]
413
+ }
414
+ ),
415
+ /* @__PURE__ */ jsxs(
416
+ "div",
417
+ {
418
+ className: `${editActions} ${semanticClassNames.editActions}`,
419
+ children: [
420
+ /* @__PURE__ */ jsxs(
421
+ "button",
422
+ {
423
+ className: `${editActionButton} ${semanticClassNames.editActionButton}`,
424
+ type: "button",
425
+ onClick: handleOpen,
426
+ children: [
427
+ /* @__PURE__ */ jsx(ExternalLink, { size: 14 }),
428
+ "Open"
429
+ ]
430
+ }
431
+ ),
432
+ /* @__PURE__ */ jsxs(
433
+ "button",
434
+ {
435
+ className: `${editActionButton} ${semanticClassNames.editActionButton} ${editActionButtonEnd} ${semanticClassNames.editActionButtonEnd}`,
436
+ type: "button",
437
+ onClick: handleDelete,
438
+ children: [
439
+ /* @__PURE__ */ jsx(Trash2, { size: 14 }),
440
+ "Remove"
441
+ ]
442
+ }
443
+ )
444
+ ]
445
+ }
446
+ )
325
447
  ]
326
448
  }
327
449
  )
@@ -1,4 +1,4 @@
1
- @keyframes _1n94osf0 {
1
+ @keyframes _1n94osf1 {
2
2
  0% {
3
3
  mask: linear-gradient(90deg, #000 25%, #000000e6 50%, #00000000) 150% 0 / 400% no-repeat;
4
4
  opacity: 0.16;
@@ -8,12 +8,12 @@
8
8
  opacity: 1;
9
9
  }
10
10
  }
11
- @keyframes _1n94osf1 {
11
+ @keyframes _1n94osf8 {
12
12
  to {
13
13
  transform: rotate(360deg);
14
14
  }
15
15
  }
16
- @keyframes _1n94osf2 {
16
+ @keyframes _1n94osfg {
17
17
  from {
18
18
  opacity: 0;
19
19
  }
@@ -21,11 +21,27 @@
21
21
  opacity: 1;
22
22
  }
23
23
  }
24
- .rr-image-root {
24
+ ._1n94osf0 {
25
25
  margin: 1.25rem 0;
26
26
  text-align: center;
27
27
  }
28
- .rr-image-frame {
28
+ ._1n94osf2 {
29
+ display: block;
30
+ width: 100%;
31
+ height: auto;
32
+ max-width: 100%;
33
+ opacity: 0;
34
+ transition: opacity 280ms ease;
35
+ border-radius: 0px !important;
36
+ }
37
+ ._1n94osf4 {
38
+ opacity: 1;
39
+ animation: _1n94osf1 420ms ease;
40
+ }
41
+ ._1n94osf5 {
42
+ display: none;
43
+ }
44
+ ._1n94osf6 {
29
45
  position: relative;
30
46
  display: inline-flex;
31
47
  align-items: center;
@@ -36,47 +52,73 @@
36
52
  min-height: 3rem;
37
53
  transition: transform 0.25s ease;
38
54
  }
39
- .rr-image-frame:hover {
55
+ ._1n94osf6:hover {
40
56
  transform: translateY(-1px);
41
57
  }
42
- .rr-image-img {
43
- display: block;
44
- width: 100%;
45
- height: auto;
46
- max-width: 100%;
47
- opacity: 0;
48
- transition: opacity 280ms ease;
49
- border-radius: 0px !important;
50
- }
51
- .rr-image-loaded .rr-image-img {
52
- opacity: 1;
53
- animation: _1n94osf0 420ms ease;
58
+ ._1n94osf7 {
59
+ cursor: pointer;
54
60
  }
55
- .rr-image-error .rr-image-img {
56
- display: none;
61
+ ._1n94osf7:hover {
62
+ transform: none;
57
63
  }
58
- .rr-image-loader {
64
+ ._1n94osf9 {
59
65
  position: absolute;
60
66
  width: 1.65rem;
61
67
  height: 1.65rem;
62
68
  border: 2px solid color-mix(in srgb, var(--rc-text-secondary) 45%, transparent);
63
69
  border-top-color: color-mix(in srgb, var(--rc-text) 65%, transparent);
64
70
  border-radius: 50%;
65
- animation: _1n94osf1 0.75s linear infinite;
71
+ animation: _1n94osf8 0.75s linear infinite;
66
72
  }
67
- .rr-image-error {
73
+ ._1n94osfa {
68
74
  font-size: 0.8rem;
69
75
  color: var(--rc-alert-caution);
70
76
  background: color-mix(in srgb, var(--rc-bg) 86%, transparent);
71
77
  border-radius: 999px;
72
78
  padding: 0.15rem 0.6rem;
73
79
  }
74
- .rr-image-caption {
80
+ ._1n94osfb {
75
81
  margin-top: 0.5rem;
76
82
  color: var(--rc-text-secondary);
77
83
  font-size: 0.86rem;
78
84
  line-height: 1.5;
79
85
  }
86
+ ._1n94osfc {
87
+ margin: var(--rc-space-md) 0;
88
+ text-align: center;
89
+ }
90
+ ._1n94osfd {
91
+ position: relative;
92
+ display: inline-block;
93
+ overflow: hidden;
94
+ border-radius: var(--rc-radius-md);
95
+ transition: background-color 0.3s ease;
96
+ }
97
+ ._1n94osfe {
98
+ opacity: 0;
99
+ transition: opacity 0.3s ease;
100
+ }
101
+ ._1n94osff {
102
+ opacity: 1;
103
+ transition: opacity 0.3s ease;
104
+ }
105
+ ._1n94osfh {
106
+ position: fixed;
107
+ inset: 0;
108
+ z-index: 9999;
109
+ display: flex;
110
+ align-items: center;
111
+ justify-content: center;
112
+ background-color: rgba(0, 0, 0, 0.85);
113
+ cursor: zoom-out;
114
+ animation: _1n94osfg 0.2s ease;
115
+ }
116
+ ._1n94osfi {
117
+ max-width: 90vw;
118
+ max-height: 90vh;
119
+ object-fit: contain;
120
+ border-radius: 0;
121
+ }
80
122
  .rich-image {
81
123
  margin: var(--rc-space-md) 0;
82
124
  text-align: center;
@@ -111,7 +153,7 @@
111
153
  justify-content: center;
112
154
  background-color: rgba(0, 0, 0, 0.85);
113
155
  cursor: zoom-out;
114
- animation: _1n94osf2 0.2s ease;
156
+ animation: _1n94osfg 0.2s ease;
115
157
  }
116
158
  .rich-image-zoom-img {
117
159
  max-width: 90vw;
@@ -119,17 +161,11 @@
119
161
  object-fit: contain;
120
162
  border-radius: 0;
121
163
  }
122
- .rr-image-edit-trigger {
164
+ ._1n94osfj {
123
165
  display: block;
124
166
  cursor: pointer;
125
167
  }
126
- .rr-image-edit-trigger .rr-image-frame {
127
- cursor: pointer;
128
- }
129
- .rr-image-edit-trigger .rr-image-frame:hover {
130
- transform: none;
131
- }
132
- .rr-image-edit-placeholder {
168
+ ._1n94osfk {
133
169
  display: flex;
134
170
  align-items: center;
135
171
  justify-content: center;
@@ -142,11 +178,11 @@
142
178
  cursor: pointer;
143
179
  transition: border-color 0.2s, color 0.2s;
144
180
  }
145
- .rr-image-edit-placeholder:hover {
181
+ ._1n94osfk:hover {
146
182
  border-color: var(--rc-accent);
147
183
  color: var(--rc-text);
148
184
  }
149
- .rr-image-edit-panel {
185
+ ._1n94osfl {
150
186
  display: flex;
151
187
  flex-direction: column;
152
188
  gap: 8px;
@@ -155,7 +191,7 @@
155
191
  font-size: 13px;
156
192
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
157
193
  }
158
- .rr-image-edit-field {
194
+ ._1n94osfm {
159
195
  display: flex;
160
196
  align-items: center;
161
197
  gap: 8px;
@@ -164,11 +200,11 @@
164
200
  border-radius: 6px;
165
201
  min-width: 0;
166
202
  }
167
- .rr-image-edit-field-icon {
203
+ ._1n94osfn {
168
204
  flex-shrink: 0;
169
205
  color: var(--rc-text-secondary);
170
206
  }
171
- .rr-image-edit-input {
207
+ ._1n94osfo {
172
208
  flex: 1;
173
209
  appearance: none;
174
210
  border: none;
@@ -179,15 +215,15 @@
179
215
  outline: none;
180
216
  min-width: 0;
181
217
  }
182
- .rr-image-edit-input::placeholder {
218
+ ._1n94osfo::placeholder {
183
219
  color: var(--rc-text-secondary);
184
220
  }
185
- .rr-image-edit-actions {
221
+ ._1n94osfp {
186
222
  display: flex;
187
223
  align-items: center;
188
224
  gap: 4px;
189
225
  }
190
- .rr-image-edit-action-btn {
226
+ ._1n94osfq {
191
227
  display: inline-flex;
192
228
  align-items: center;
193
229
  gap: 6px;
@@ -203,9 +239,9 @@
203
239
  transition: color 0.15s ease, background-color 0.15s ease;
204
240
  white-space: nowrap;
205
241
  }
206
- .rr-image-edit-action-btn:hover {
242
+ ._1n94osfq:hover {
207
243
  background-color: var(--rc-bg-secondary);
208
244
  }
209
- .rr-image-edit-action-btn--end {
245
+ ._1n94osfr {
210
246
  margin-left: auto;
211
247
  }
@@ -1,2 +1,52 @@
1
- export {};
1
+ export declare const semanticClassNames: {
2
+ readonly root: "rr-image-root";
3
+ readonly frame: "rr-image-frame";
4
+ readonly frameLoading: "rr-image-loading";
5
+ readonly frameLoaded: "rr-image-loaded";
6
+ readonly frameError: "rr-image-error";
7
+ readonly image: "rr-image-img";
8
+ readonly loader: "rr-image-loader";
9
+ readonly errorBadge: "rr-image-error";
10
+ readonly caption: "rr-image-caption";
11
+ readonly editTrigger: "rr-image-edit-trigger";
12
+ readonly editPlaceholder: "rr-image-edit-placeholder";
13
+ readonly editPanel: "rr-image-edit-panel";
14
+ readonly editField: "rr-image-edit-field";
15
+ readonly editFieldIcon: "rr-image-edit-field-icon";
16
+ readonly editInput: "rr-image-edit-input";
17
+ readonly editActions: "rr-image-edit-actions";
18
+ readonly editActionButton: "rr-image-edit-action-btn";
19
+ readonly editActionButtonEnd: "rr-image-edit-action-btn--end";
20
+ };
21
+ export declare const root: string;
22
+ export declare const image: string;
23
+ export declare const imageState: Record<"error" | "loaded" | "loading", string>;
24
+ export declare const frame: string;
25
+ export declare const frameEditMode: string;
26
+ export declare const loader: string;
27
+ export declare const errorBadge: string;
28
+ export declare const caption: string;
29
+ export declare const contentSemanticClassNames: {
30
+ readonly root: "rich-image";
31
+ readonly container: "rich-image-container";
32
+ readonly hidden: "rich-image-hidden";
33
+ readonly visible: "rich-image-visible";
34
+ readonly zoomOverlay: "rich-image-zoom-overlay";
35
+ readonly zoomImage: "rich-image-zoom-img";
36
+ };
37
+ export declare const contentRoot: string;
38
+ export declare const contentContainer: string;
39
+ export declare const contentHidden: string;
40
+ export declare const contentVisible: string;
41
+ export declare const contentZoomOverlay: string;
42
+ export declare const contentZoomImage: string;
43
+ export declare const editTrigger: string;
44
+ export declare const editPlaceholder: string;
45
+ export declare const editPanel: string;
46
+ export declare const editField: string;
47
+ export declare const editFieldIcon: string;
48
+ export declare const editInput: string;
49
+ export declare const editActions: string;
50
+ export declare const editActionButton: string;
51
+ export declare const editActionButtonEnd: string;
2
52
  //# sourceMappingURL=styles.css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../src/styles.css.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../src/styles.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;CAmBrB,CAAA;AAEV,eAAO,MAAM,IAAI,QAGf,CAAA;AAaF,eAAO,MAAM,KAAK,QAQhB,CAAA;AAEF,eAAO,MAAM,UAAU,gDASrB,CAAA;AAEF,eAAO,MAAM,KAAK,QAehB,CAAA;AAEF,eAAO,MAAM,aAAa,QAOxB,CAAA;AAIF,eAAO,MAAM,MAAM,QAQjB,CAAA;AAEF,eAAO,MAAM,UAAU,QAMrB,CAAA;AAEF,eAAO,MAAM,OAAO,QAKlB,CAAA;AAEF,eAAO,MAAM,yBAAyB;;;;;;;CAO5B,CAAA;AAgCV,eAAO,MAAM,WAAW,QAA2B,CAAA;AACnD,eAAO,MAAM,gBAAgB,QAAgC,CAAA;AAC7D,eAAO,MAAM,aAAa,QAA6B,CAAA;AACvD,eAAO,MAAM,cAAc,QAA8B,CAAA;AA0BzD,eAAO,MAAM,kBAAkB,QAAkC,CAAA;AACjE,eAAO,MAAM,gBAAgB,QAAgC,CAAA;AAiB7D,eAAO,MAAM,WAAW,QAGtB,CAAA;AAEF,eAAO,MAAM,eAAe,QAkB1B,CAAA;AAEF,eAAO,MAAM,SAAS,QASpB,CAAA;AAEF,eAAO,MAAM,SAAS,QAQpB,CAAA;AAEF,eAAO,MAAM,aAAa,QAGxB,CAAA;AAEF,eAAO,MAAM,SAAS,QAepB,CAAA;AAEF,eAAO,MAAM,WAAW,QAItB,CAAA;AAEF,eAAO,MAAM,gBAAgB,QAoB3B,CAAA;AAEF,eAAO,MAAM,mBAAmB,QAE9B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-renderer-image",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Image renderer with blurhash and lightbox",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,9 +19,9 @@
19
19
  "lucide-react": "^0.574.0",
20
20
  "react-photo-view": "^1.2.6",
21
21
  "thumbhash": "^0.1.1",
22
- "@haklex/rich-editor": "0.0.4",
23
- "@haklex/rich-editor-ui": "0.0.4",
24
- "@haklex/rich-style-token": "0.0.4"
22
+ "@haklex/rich-editor": "0.0.5",
23
+ "@haklex/rich-editor-ui": "0.0.5",
24
+ "@haklex/rich-style-token": "0.0.5"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@lexical/react": "^0.39.0",