@haklex/rich-renderer-image 0.31.1 → 0.33.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.
- package/dist/index.mjs +6 -4
- package/package.json +16 -16
package/dist/index.mjs
CHANGED
|
@@ -419,7 +419,7 @@ function snapToPreset(value) {
|
|
|
419
419
|
return value;
|
|
420
420
|
}
|
|
421
421
|
function tickLeft(preset) {
|
|
422
|
-
return `calc(6px + ${(preset - SIZE_MIN) /
|
|
422
|
+
return `calc(6px + ${(preset - SIZE_MIN) / 90} * (100% - 12px))`;
|
|
423
423
|
}
|
|
424
424
|
var LAYOUT_OPTIONS = [
|
|
425
425
|
{
|
|
@@ -481,7 +481,7 @@ function ImageSizeControl() {
|
|
|
481
481
|
if (dragValue === null || dragValue === (displayWidth ?? SIZE_MAX)) return;
|
|
482
482
|
handleSetDisplayWidth(dragValue);
|
|
483
483
|
};
|
|
484
|
-
const fill = `${(value - SIZE_MIN) /
|
|
484
|
+
const fill = `${(value - SIZE_MIN) / 90 * 100}%`;
|
|
485
485
|
return /* @__PURE__ */ jsxs(Popover, {
|
|
486
486
|
open: sizeOpen,
|
|
487
487
|
onOpenChange: setSizeOpen,
|
|
@@ -539,6 +539,7 @@ function ImageLayoutControl() {
|
|
|
539
539
|
const [layoutOpen, setLayoutOpen] = useAtom(layoutOpenAtom);
|
|
540
540
|
const layout = useAtomValue(layoutAtom);
|
|
541
541
|
const { handleSetLayout } = useImageActions();
|
|
542
|
+
const current = LAYOUT_OPTIONS.find((option) => option.value === layout) ?? LAYOUT_OPTIONS[0];
|
|
542
543
|
return /* @__PURE__ */ jsxs(Popover, {
|
|
543
544
|
open: layoutOpen,
|
|
544
545
|
onOpenChange: setLayoutOpen,
|
|
@@ -546,7 +547,7 @@ function ImageLayoutControl() {
|
|
|
546
547
|
className: toolbarButtonClass,
|
|
547
548
|
title: "Image layout",
|
|
548
549
|
onMouseDown: stopMouseDown,
|
|
549
|
-
children: /* @__PURE__ */ jsx(
|
|
550
|
+
children: /* @__PURE__ */ jsx(current.Icon, { size: 14 })
|
|
550
551
|
}), /* @__PURE__ */ jsx(PopoverPanel, {
|
|
551
552
|
className: controlPanel,
|
|
552
553
|
side: "bottom",
|
|
@@ -851,7 +852,8 @@ function useImageResize() {
|
|
|
851
852
|
if (!moved && Math.abs(rawDelta) < MOVE_THRESHOLD_PX) return;
|
|
852
853
|
moved = true;
|
|
853
854
|
const outward = side === "left" ? -rawDelta : rawDelta;
|
|
854
|
-
|
|
855
|
+
const nextWidth = startWidth + outward * factor;
|
|
856
|
+
percent = sanitizeImageDisplayWidth(nextWidth / containerWidth * 100) ?? percent;
|
|
855
857
|
if (isFloat && blockWrapper) blockWrapper.style.width = `${percent}%`;
|
|
856
858
|
else figure.style.setProperty("--rich-image-display-width", `${percent}%`);
|
|
857
859
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-renderer-image",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Image renderer with blurhash",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,29 +25,29 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@lexical/react": "^0.
|
|
29
|
-
"@types/react": "^19.2.
|
|
30
|
-
"@types/react-dom": "^19.2.
|
|
31
|
-
"@vanilla-extract/css": "^1.21.
|
|
32
|
-
"@vanilla-extract/vite-plugin": "^5.2.
|
|
28
|
+
"@lexical/react": "^0.49.0",
|
|
29
|
+
"@types/react": "^19.2.18",
|
|
30
|
+
"@types/react-dom": "^19.2.4",
|
|
31
|
+
"@vanilla-extract/css": "^1.21.2",
|
|
32
|
+
"@vanilla-extract/vite-plugin": "^5.2.6",
|
|
33
33
|
"jotai": "^2.20.2",
|
|
34
|
-
"lexical": "^0.
|
|
35
|
-
"react": "^19.2.
|
|
36
|
-
"react-dom": "^19.2.
|
|
37
|
-
"typescript": "^
|
|
34
|
+
"lexical": "^0.49.0",
|
|
35
|
+
"react": "^19.2.8",
|
|
36
|
+
"react-dom": "^19.2.8",
|
|
37
|
+
"typescript": "^7.0.2",
|
|
38
38
|
"unplugin-dts": "^1.0.3",
|
|
39
|
-
"vite": "^8.
|
|
39
|
+
"vite": "^8.2.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@lexical/react": "^0.
|
|
42
|
+
"@lexical/react": "^0.49.0",
|
|
43
43
|
"jotai": ">=2",
|
|
44
|
-
"lexical": "^0.
|
|
44
|
+
"lexical": "^0.49.0",
|
|
45
45
|
"lucide-react": "^1.0.0",
|
|
46
46
|
"react": ">=19",
|
|
47
47
|
"react-dom": ">=19",
|
|
48
|
-
"@haklex/rich-editor": "^0.
|
|
49
|
-
"@haklex/rich-editor
|
|
50
|
-
"@haklex/rich-style-token": "^0.
|
|
48
|
+
"@haklex/rich-editor-ui": "^0.33.0",
|
|
49
|
+
"@haklex/rich-editor": "^0.33.0",
|
|
50
|
+
"@haklex/rich-style-token": "^0.33.0"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|