@moyarich/console-addon-resizable 0.1.0 → 0.2.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/README.md CHANGED
@@ -2,12 +2,18 @@
2
2
 
3
3
  Resize the Console panel. Add configurable resize handles, sizing limits, and resize callbacks without changing output behavior.
4
4
 
5
+ [Documentation and live examples](https://moyarich.github.io/console/)
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
8
- npm install @moyarich/console @moyarich/console-addon-resizable
10
+ npm install @moyarich/console @moyarich/console-addon-resizable react
9
11
  ```
10
12
 
13
+ Configure the `@moyarich` scope and authenticate with GitHub Packages as described in the [installation guide](../../../README.md#installation).
14
+
15
+ Required peer dependencies: `@moyarich/console-core@^0.2.0`, `react@>=18`.
16
+
11
17
  ## Quick start
12
18
 
13
19
  ```tsx
@@ -0,0 +1,50 @@
1
+ import { type AddonTranslations } from "../../localization.cjs";
2
+
3
+ import { type CSSProperties, type ReactNode } from "react";
4
+ import type { ConsoleMode } from "@moyarich/console-core";
5
+ export type ConsoleResizeDirection = "vertical" | "horizontal" | "both" | "block" | "inline";
6
+ export type ConsoleResizeEdge = "start" | "end";
7
+ export interface ConsoleResizeSize {
8
+ width: number;
9
+ height: number;
10
+ }
11
+ export interface ResizableConsoleAddonOptions {
12
+ locale?: string;
13
+ translations?: AddonTranslations;
14
+ /** Resize axis. Logical block/inline map to vertical/horizontal in the default writing mode. @default "both" */
15
+ direction?: ConsoleResizeDirection;
16
+ /** Initial width used when horizontal resizing is active. @default 720 */
17
+ defaultWidth?: number | string;
18
+ /** Initial height used when vertical resizing is active. @default 300 */
19
+ defaultHeight?: number | string;
20
+ /** Minimum width while dragging. @default 320 */
21
+ minWidth?: number;
22
+ /** Minimum height while dragging. @default 180 */
23
+ minHeight?: number;
24
+ /** Optional maximum width while dragging. The parent width is always respected. */
25
+ maxWidth?: number;
26
+ /** Optional maximum height while dragging. */
27
+ maxHeight?: number;
28
+ /** Physical edge that owns the horizontal resize handle. @default "end" */
29
+ horizontalEdge?: ConsoleResizeEdge;
30
+ /** Physical edge that owns the vertical resize handle. @default "end" */
31
+ verticalEdge?: ConsoleResizeEdge;
32
+ /** Additional class name applied to the addon-owned frame. */
33
+ className?: string;
34
+ /** Additional inline styles and CSS custom-property overrides applied to the addon-owned frame. */
35
+ style?: CSSProperties;
36
+ /** Called whenever a drag updates the rendered frame size. */
37
+ onResize?: (size: ConsoleResizeSize) => void;
38
+ }
39
+ interface ResizeAxes {
40
+ horizontal: boolean;
41
+ vertical: boolean;
42
+ }
43
+ interface ResizableConsoleFrameProps {
44
+ mode: ConsoleMode;
45
+ options: ResizableConsoleAddonOptions;
46
+ children: ReactNode;
47
+ }
48
+ export declare function resolveConsoleResizeAxes(direction: ConsoleResizeDirection): ResizeAxes;
49
+ export declare function ResizableConsoleFrame({ mode, options, children, }: ResizableConsoleFrameProps): import("react").JSX.Element;
50
+ export {};
@@ -1,4 +1,5 @@
1
- import "./ResizableConsoleFrame.css";
1
+ import { type AddonTranslations } from "../../localization.js";
2
+
2
3
  import { type CSSProperties, type ReactNode } from "react";
3
4
  import type { ConsoleMode } from "@moyarich/console-core";
4
5
  export type ConsoleResizeDirection = "vertical" | "horizontal" | "both" | "block" | "inline";
@@ -8,6 +9,8 @@ export interface ConsoleResizeSize {
8
9
  height: number;
9
10
  }
10
11
  export interface ResizableConsoleAddonOptions {
12
+ locale?: string;
13
+ translations?: AddonTranslations;
11
14
  /** Resize axis. Logical block/inline map to vertical/horizontal in the default writing mode. @default "both" */
12
15
  direction?: ConsoleResizeDirection;
13
16
  /** Initial width used when horizontal resizing is active. @default 720 */
@@ -71,16 +71,16 @@
71
71
  .console-resizable-frame[data-console-resize-direction="inline"],
72
72
  .console-resizable-frame[data-console-resize-direction="both"] {
73
73
  width: var(--_console-resizable-width);
74
- min-width: var(--_console-resizable-min-width);
75
- max-width: var(--_console-resizable-max-width);
74
+ min-width: min(100%, var(--_console-resizable-min-width));
75
+ max-width: min(100%, var(--_console-resizable-max-width));
76
76
  }
77
77
 
78
78
  .console-resizable-frame[data-console-resize-direction="vertical"],
79
79
  .console-resizable-frame[data-console-resize-direction="block"],
80
80
  .console-resizable-frame[data-console-resize-direction="both"] {
81
81
  height: var(--_console-resizable-height);
82
- min-height: var(--_console-resizable-min-height);
83
- max-height: var(--_console-resizable-max-height);
82
+ min-height: min(100%, var(--_console-resizable-min-height));
83
+ max-height: min(100%, var(--_console-resizable-max-height));
84
84
  }
85
85
 
86
86
  .console-resizable-frame-content {
package/dist/index.cjs CHANGED
@@ -4,6 +4,71 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const lucideReact = require("lucide-react");
5
5
  const react = require("react");
6
6
  const consoleCore = require("@moyarich/console-core");
7
+ const horizontal$3 = "Resize console horizontally";
8
+ const horizontalTitle$3 = "Drag to resize horizontally";
9
+ const vertical$3 = "Resize console vertically";
10
+ const verticalTitle$3 = "Drag to resize vertically";
11
+ const both$3 = "Resize console in both directions";
12
+ const bothTitle$3 = "Drag to resize width and height";
13
+ const en = {
14
+ horizontal: horizontal$3,
15
+ horizontalTitle: horizontalTitle$3,
16
+ vertical: vertical$3,
17
+ verticalTitle: verticalTitle$3,
18
+ both: both$3,
19
+ bothTitle: bothTitle$3
20
+ };
21
+ const horizontal$2 = "Redimensionar horizontalmente";
22
+ const horizontalTitle$2 = "Arrastrar para cambiar el ancho";
23
+ const vertical$2 = "Redimensionar verticalmente";
24
+ const verticalTitle$2 = "Arrastrar para cambiar la altura";
25
+ const both$2 = "Redimensionar en ambas direcciones";
26
+ const bothTitle$2 = "Arrastrar para cambiar ancho y altura";
27
+ const es = {
28
+ horizontal: horizontal$2,
29
+ horizontalTitle: horizontalTitle$2,
30
+ vertical: vertical$2,
31
+ verticalTitle: verticalTitle$2,
32
+ both: both$2,
33
+ bothTitle: bothTitle$2
34
+ };
35
+ const horizontal$1 = "Redimensionner horizontalement";
36
+ const horizontalTitle$1 = "Glisser pour modifier la largeur";
37
+ const vertical$1 = "Redimensionner verticalement";
38
+ const verticalTitle$1 = "Glisser pour modifier la hauteur";
39
+ const both$1 = "Redimensionner dans les deux sens";
40
+ const bothTitle$1 = "Glisser pour modifier largeur et hauteur";
41
+ const fr = {
42
+ horizontal: horizontal$1,
43
+ horizontalTitle: horizontalTitle$1,
44
+ vertical: vertical$1,
45
+ verticalTitle: verticalTitle$1,
46
+ both: both$1,
47
+ bothTitle: bothTitle$1
48
+ };
49
+ const horizontal = "Redimensionar o console horizontalmente";
50
+ const horizontalTitle = "Arraste para redimensionar horizontalmente";
51
+ const vertical = "Redimensionar o console verticalmente";
52
+ const verticalTitle = "Arraste para redimensionar verticalmente";
53
+ const both = "Redimensionar o console nas duas direções";
54
+ const bothTitle = "Arraste para alterar a largura e a altura";
55
+ const pt = {
56
+ horizontal,
57
+ horizontalTitle,
58
+ vertical,
59
+ verticalTitle,
60
+ both,
61
+ bothTitle
62
+ };
63
+ const locales = { en, es, fr, pt };
64
+ function resolveAddonMessages(locale = "en", overrides) {
65
+ const tag = locale.replace(/_/g, "-").toLowerCase();
66
+ return {
67
+ ...en,
68
+ ...locales[tag] ?? locales[tag.split("-")[0]] ?? {},
69
+ ...overrides
70
+ };
71
+ }
7
72
  function resolveConsoleResizeAxes(direction) {
8
73
  return {
9
74
  horizontal: direction === "horizontal" || direction === "both" || direction === "inline",
@@ -36,8 +101,11 @@ function ResizableConsoleFrame({
36
101
  verticalEdge = "end",
37
102
  className = "",
38
103
  style,
39
- onResize
104
+ onResize,
105
+ locale = "en",
106
+ translations
40
107
  } = options;
108
+ const labels = resolveAddonMessages(locale, translations);
41
109
  const axes = resolveConsoleResizeAxes(direction);
42
110
  const frameRef = react.useRef(null);
43
111
  const dragRef = react.useRef(null);
@@ -148,6 +216,38 @@ function ResizableConsoleFrame({
148
216
  height: nextHeight
149
217
  });
150
218
  };
219
+ const resizeWithKeyboard = (event, axis) => {
220
+ const horizontal2 = axis !== "vertical" && (event.key === "ArrowLeft" || event.key === "ArrowRight");
221
+ const vertical2 = axis !== "horizontal" && (event.key === "ArrowUp" || event.key === "ArrowDown");
222
+ const frame = frameRef.current;
223
+ if (!frame || !horizontal2 && !vertical2) return;
224
+ event.preventDefault();
225
+ event.stopPropagation();
226
+ const bounds = frame.getBoundingClientRect();
227
+ const parentWidth = frame.parentElement?.getBoundingClientRect().width ?? Infinity;
228
+ const step = event.shiftKey ? 50 : 10;
229
+ let nextWidth = bounds.width;
230
+ let nextHeight = bounds.height;
231
+ if (horizontal2) {
232
+ const sign = (event.key === "ArrowRight" ? 1 : -1) * (horizontalEdge === "end" ? 1 : -1);
233
+ nextWidth = clamp(
234
+ bounds.width + sign * step,
235
+ minWidth,
236
+ Math.min(maxWidth ?? parentWidth, parentWidth)
237
+ );
238
+ setWidth(nextWidth);
239
+ }
240
+ if (vertical2) {
241
+ const sign = (event.key === "ArrowDown" ? 1 : -1) * (verticalEdge === "end" ? 1 : -1);
242
+ nextHeight = clamp(
243
+ bounds.height + sign * step,
244
+ minHeight,
245
+ maxHeight ?? Infinity
246
+ );
247
+ setHeight(nextHeight);
248
+ }
249
+ onResize?.({ width: nextWidth, height: nextHeight });
250
+ };
151
251
  const renderHorizontalHandle = () => {
152
252
  if (!axes.horizontal) {
153
253
  return null;
@@ -158,10 +258,14 @@ function ResizableConsoleFrame({
158
258
  className: "console-resize-handle",
159
259
  role: "separator",
160
260
  "aria-orientation": "vertical",
161
- "aria-label": "Resize console horizontally",
162
- title: "Drag to resize horizontally",
261
+ "aria-valuemin": minWidth,
262
+ "aria-valuemax": maxWidth,
263
+ "aria-valuenow": typeof width === "number" ? width : void 0,
264
+ "aria-label": labels.horizontal,
265
+ title: labels.horizontalTitle,
163
266
  tabIndex: 0,
164
267
  "data-console-resize-axis": "horizontal",
268
+ onKeyDown: (event) => resizeWithKeyboard(event, "horizontal"),
165
269
  "data-active": activeAxis === "horizontal" || void 0,
166
270
  onPointerDown: (event) => startResize(event, "horizontal"),
167
271
  onPointerMove: moveResize,
@@ -181,10 +285,14 @@ function ResizableConsoleFrame({
181
285
  className: "console-resize-handle",
182
286
  role: "separator",
183
287
  "aria-orientation": "horizontal",
184
- "aria-label": "Resize console vertically",
185
- title: "Drag to resize vertically",
288
+ "aria-valuemin": minHeight,
289
+ "aria-valuemax": maxHeight,
290
+ "aria-valuenow": typeof height === "number" ? height : void 0,
291
+ "aria-label": labels.vertical,
292
+ title: labels.verticalTitle,
186
293
  tabIndex: 0,
187
294
  "data-console-resize-axis": "vertical",
295
+ onKeyDown: (event) => resizeWithKeyboard(event, "vertical"),
188
296
  "data-active": activeAxis === "vertical" || void 0,
189
297
  onPointerDown: (event) => startResize(event, "vertical"),
190
298
  onPointerMove: moveResize,
@@ -203,10 +311,11 @@ function ResizableConsoleFrame({
203
311
  {
204
312
  className: "console-resize-corner-handle",
205
313
  role: "separator",
206
- "aria-label": "Resize console in both directions",
207
- title: "Drag to resize width and height",
314
+ "aria-label": labels.both,
315
+ title: labels.bothTitle,
208
316
  tabIndex: 0,
209
317
  "data-console-resize-axis": "both",
318
+ onKeyDown: (event) => resizeWithKeyboard(event, "both"),
210
319
  "data-active": activeAxis === "both" || void 0,
211
320
  onPointerDown: (event) => startResize(event, "both"),
212
321
  onPointerMove: moveResize,
@@ -0,0 +1,13 @@
1
+ /** Stable package-qualified identity for the resizable frame addon. */
2
+ export declare const RESIZABLE_CONSOLE_ADDON_ID = "@moyarich/console-addon-resizable";
3
+ export { resolveConsoleResizeAxes } from "./components/ResizableConsoleFrame/ResizableConsoleFrame.cjs";
4
+ export type { ConsoleResizeDirection, ConsoleResizeEdge, ConsoleResizeSize, ResizableConsoleAddonOptions, } from "./components/ResizableConsoleFrame/ResizableConsoleFrame.cjs";
5
+ import type { ResizableConsoleAddonOptions } from "./components/ResizableConsoleFrame/ResizableConsoleFrame.cjs";
6
+ import { type ConsoleAddon } from "@moyarich/console-core";
7
+ /**
8
+ * Creates a first-party frame-resizing addon.
9
+ *
10
+ * The addon contributes a generic frame decorator and leaves message/output
11
+ * rendering, viewport state, and host layout ownership unchanged.
12
+ */
13
+ export declare function createResizableConsoleAddon(options?: ResizableConsoleAddonOptions): ConsoleAddon;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /** Stable package-qualified identity for the resizable frame addon. */
2
2
  export declare const RESIZABLE_CONSOLE_ADDON_ID = "@moyarich/console-addon-resizable";
3
- export { resolveConsoleResizeAxes } from "./components/ResizableConsoleFrame/ResizableConsoleFrame";
4
- export type { ConsoleResizeDirection, ConsoleResizeEdge, ConsoleResizeSize, ResizableConsoleAddonOptions, } from "./components/ResizableConsoleFrame/ResizableConsoleFrame";
5
- import type { ResizableConsoleAddonOptions } from "./components/ResizableConsoleFrame/ResizableConsoleFrame";
3
+ export { resolveConsoleResizeAxes } from "./components/ResizableConsoleFrame/ResizableConsoleFrame.js";
4
+ export type { ConsoleResizeDirection, ConsoleResizeEdge, ConsoleResizeSize, ResizableConsoleAddonOptions, } from "./components/ResizableConsoleFrame/ResizableConsoleFrame.js";
5
+ import type { ResizableConsoleAddonOptions } from "./components/ResizableConsoleFrame/ResizableConsoleFrame.js";
6
6
  import { type ConsoleAddon } from "@moyarich/console-core";
7
7
  /**
8
8
  * Creates a first-party frame-resizing addon.
package/dist/index.js CHANGED
@@ -2,6 +2,71 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { GripVertical, GripHorizontal, MoveDiagonal2 } from "lucide-react";
3
3
  import { useRef, useState, useCallback, useEffect } from "react";
4
4
  import { consoleExtensionPoints } from "@moyarich/console-core";
5
+ const horizontal$3 = "Resize console horizontally";
6
+ const horizontalTitle$3 = "Drag to resize horizontally";
7
+ const vertical$3 = "Resize console vertically";
8
+ const verticalTitle$3 = "Drag to resize vertically";
9
+ const both$3 = "Resize console in both directions";
10
+ const bothTitle$3 = "Drag to resize width and height";
11
+ const en = {
12
+ horizontal: horizontal$3,
13
+ horizontalTitle: horizontalTitle$3,
14
+ vertical: vertical$3,
15
+ verticalTitle: verticalTitle$3,
16
+ both: both$3,
17
+ bothTitle: bothTitle$3
18
+ };
19
+ const horizontal$2 = "Redimensionar horizontalmente";
20
+ const horizontalTitle$2 = "Arrastrar para cambiar el ancho";
21
+ const vertical$2 = "Redimensionar verticalmente";
22
+ const verticalTitle$2 = "Arrastrar para cambiar la altura";
23
+ const both$2 = "Redimensionar en ambas direcciones";
24
+ const bothTitle$2 = "Arrastrar para cambiar ancho y altura";
25
+ const es = {
26
+ horizontal: horizontal$2,
27
+ horizontalTitle: horizontalTitle$2,
28
+ vertical: vertical$2,
29
+ verticalTitle: verticalTitle$2,
30
+ both: both$2,
31
+ bothTitle: bothTitle$2
32
+ };
33
+ const horizontal$1 = "Redimensionner horizontalement";
34
+ const horizontalTitle$1 = "Glisser pour modifier la largeur";
35
+ const vertical$1 = "Redimensionner verticalement";
36
+ const verticalTitle$1 = "Glisser pour modifier la hauteur";
37
+ const both$1 = "Redimensionner dans les deux sens";
38
+ const bothTitle$1 = "Glisser pour modifier largeur et hauteur";
39
+ const fr = {
40
+ horizontal: horizontal$1,
41
+ horizontalTitle: horizontalTitle$1,
42
+ vertical: vertical$1,
43
+ verticalTitle: verticalTitle$1,
44
+ both: both$1,
45
+ bothTitle: bothTitle$1
46
+ };
47
+ const horizontal = "Redimensionar o console horizontalmente";
48
+ const horizontalTitle = "Arraste para redimensionar horizontalmente";
49
+ const vertical = "Redimensionar o console verticalmente";
50
+ const verticalTitle = "Arraste para redimensionar verticalmente";
51
+ const both = "Redimensionar o console nas duas direções";
52
+ const bothTitle = "Arraste para alterar a largura e a altura";
53
+ const pt = {
54
+ horizontal,
55
+ horizontalTitle,
56
+ vertical,
57
+ verticalTitle,
58
+ both,
59
+ bothTitle
60
+ };
61
+ const locales = { en, es, fr, pt };
62
+ function resolveAddonMessages(locale = "en", overrides) {
63
+ const tag = locale.replace(/_/g, "-").toLowerCase();
64
+ return {
65
+ ...en,
66
+ ...locales[tag] ?? locales[tag.split("-")[0]] ?? {},
67
+ ...overrides
68
+ };
69
+ }
5
70
  function resolveConsoleResizeAxes(direction) {
6
71
  return {
7
72
  horizontal: direction === "horizontal" || direction === "both" || direction === "inline",
@@ -34,8 +99,11 @@ function ResizableConsoleFrame({
34
99
  verticalEdge = "end",
35
100
  className = "",
36
101
  style,
37
- onResize
102
+ onResize,
103
+ locale = "en",
104
+ translations
38
105
  } = options;
106
+ const labels = resolveAddonMessages(locale, translations);
39
107
  const axes = resolveConsoleResizeAxes(direction);
40
108
  const frameRef = useRef(null);
41
109
  const dragRef = useRef(null);
@@ -146,6 +214,38 @@ function ResizableConsoleFrame({
146
214
  height: nextHeight
147
215
  });
148
216
  };
217
+ const resizeWithKeyboard = (event, axis) => {
218
+ const horizontal2 = axis !== "vertical" && (event.key === "ArrowLeft" || event.key === "ArrowRight");
219
+ const vertical2 = axis !== "horizontal" && (event.key === "ArrowUp" || event.key === "ArrowDown");
220
+ const frame = frameRef.current;
221
+ if (!frame || !horizontal2 && !vertical2) return;
222
+ event.preventDefault();
223
+ event.stopPropagation();
224
+ const bounds = frame.getBoundingClientRect();
225
+ const parentWidth = frame.parentElement?.getBoundingClientRect().width ?? Infinity;
226
+ const step = event.shiftKey ? 50 : 10;
227
+ let nextWidth = bounds.width;
228
+ let nextHeight = bounds.height;
229
+ if (horizontal2) {
230
+ const sign = (event.key === "ArrowRight" ? 1 : -1) * (horizontalEdge === "end" ? 1 : -1);
231
+ nextWidth = clamp(
232
+ bounds.width + sign * step,
233
+ minWidth,
234
+ Math.min(maxWidth ?? parentWidth, parentWidth)
235
+ );
236
+ setWidth(nextWidth);
237
+ }
238
+ if (vertical2) {
239
+ const sign = (event.key === "ArrowDown" ? 1 : -1) * (verticalEdge === "end" ? 1 : -1);
240
+ nextHeight = clamp(
241
+ bounds.height + sign * step,
242
+ minHeight,
243
+ maxHeight ?? Infinity
244
+ );
245
+ setHeight(nextHeight);
246
+ }
247
+ onResize?.({ width: nextWidth, height: nextHeight });
248
+ };
149
249
  const renderHorizontalHandle = () => {
150
250
  if (!axes.horizontal) {
151
251
  return null;
@@ -156,10 +256,14 @@ function ResizableConsoleFrame({
156
256
  className: "console-resize-handle",
157
257
  role: "separator",
158
258
  "aria-orientation": "vertical",
159
- "aria-label": "Resize console horizontally",
160
- title: "Drag to resize horizontally",
259
+ "aria-valuemin": minWidth,
260
+ "aria-valuemax": maxWidth,
261
+ "aria-valuenow": typeof width === "number" ? width : void 0,
262
+ "aria-label": labels.horizontal,
263
+ title: labels.horizontalTitle,
161
264
  tabIndex: 0,
162
265
  "data-console-resize-axis": "horizontal",
266
+ onKeyDown: (event) => resizeWithKeyboard(event, "horizontal"),
163
267
  "data-active": activeAxis === "horizontal" || void 0,
164
268
  onPointerDown: (event) => startResize(event, "horizontal"),
165
269
  onPointerMove: moveResize,
@@ -179,10 +283,14 @@ function ResizableConsoleFrame({
179
283
  className: "console-resize-handle",
180
284
  role: "separator",
181
285
  "aria-orientation": "horizontal",
182
- "aria-label": "Resize console vertically",
183
- title: "Drag to resize vertically",
286
+ "aria-valuemin": minHeight,
287
+ "aria-valuemax": maxHeight,
288
+ "aria-valuenow": typeof height === "number" ? height : void 0,
289
+ "aria-label": labels.vertical,
290
+ title: labels.verticalTitle,
184
291
  tabIndex: 0,
185
292
  "data-console-resize-axis": "vertical",
293
+ onKeyDown: (event) => resizeWithKeyboard(event, "vertical"),
186
294
  "data-active": activeAxis === "vertical" || void 0,
187
295
  onPointerDown: (event) => startResize(event, "vertical"),
188
296
  onPointerMove: moveResize,
@@ -201,10 +309,11 @@ function ResizableConsoleFrame({
201
309
  {
202
310
  className: "console-resize-corner-handle",
203
311
  role: "separator",
204
- "aria-label": "Resize console in both directions",
205
- title: "Drag to resize width and height",
312
+ "aria-label": labels.both,
313
+ title: labels.bothTitle,
206
314
  tabIndex: 0,
207
315
  "data-console-resize-axis": "both",
316
+ onKeyDown: (event) => resizeWithKeyboard(event, "both"),
208
317
  "data-active": activeAxis === "both" || void 0,
209
318
  onPointerDown: (event) => startResize(event, "both"),
210
319
  onPointerMove: moveResize,
@@ -0,0 +1,8 @@
1
+ {
2
+ "horizontal": "Resize console horizontally",
3
+ "horizontalTitle": "Drag to resize horizontally",
4
+ "vertical": "Resize console vertically",
5
+ "verticalTitle": "Drag to resize vertically",
6
+ "both": "Resize console in both directions",
7
+ "bothTitle": "Drag to resize width and height"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "horizontal": "Redimensionar horizontalmente",
3
+ "horizontalTitle": "Arrastrar para cambiar el ancho",
4
+ "vertical": "Redimensionar verticalmente",
5
+ "verticalTitle": "Arrastrar para cambiar la altura",
6
+ "both": "Redimensionar en ambas direcciones",
7
+ "bothTitle": "Arrastrar para cambiar ancho y altura"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "horizontal": "Redimensionner horizontalement",
3
+ "horizontalTitle": "Glisser pour modifier la largeur",
4
+ "vertical": "Redimensionner verticalement",
5
+ "verticalTitle": "Glisser pour modifier la hauteur",
6
+ "both": "Redimensionner dans les deux sens",
7
+ "bothTitle": "Glisser pour modifier largeur et hauteur"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "horizontal": "Redimensionar o console horizontalmente",
3
+ "horizontalTitle": "Arraste para redimensionar horizontalmente",
4
+ "vertical": "Redimensionar o console verticalmente",
5
+ "verticalTitle": "Arraste para redimensionar verticalmente",
6
+ "both": "Redimensionar o console nas duas direções",
7
+ "bothTitle": "Arraste para alterar a largura e a altura"
8
+ }
@@ -0,0 +1,3 @@
1
+ import en from "./locales/en.json";
2
+ export type AddonTranslations = Partial<typeof en>;
3
+ export declare function resolveAddonMessages(locale?: string, overrides?: AddonTranslations): typeof en;
@@ -0,0 +1,3 @@
1
+ import en from "./locales/en.json";
2
+ export type AddonTranslations = Partial<typeof en>;
3
+ export declare function resolveAddonMessages(locale?: string, overrides?: AddonTranslations): typeof en;
@@ -0,0 +1,294 @@
1
+ /* src/components/ResizableConsoleFrame/ResizableConsoleFrame.css */
2
+ /* ==========================================================================
3
+ Resizable console addon
4
+ ========================================================================== */
5
+
6
+ .console-resizable-frame,
7
+ .console-resizable-frame *,
8
+ .console-resizable-frame *::before,
9
+ .console-resizable-frame *::after {
10
+ box-sizing: border-box;
11
+ }
12
+
13
+ .console-resizable-frame {
14
+ --_console-resize-color-scheme: var(
15
+ --console-resize-color-scheme,
16
+ var(--console-panel-color-scheme, var(--console-color-scheme, inherit))
17
+ );
18
+ --_console-resize-separator-line-background-color: var(
19
+ --console-resize-separator-line-background-color,
20
+ color-mix(in oklab, currentColor 18%, transparent)
21
+ );
22
+ --_console-resize-separator-hover-line-background-color: var(
23
+ --console-resize-separator-hover-line-background-color,
24
+ color-mix(in oklab, currentColor 38%, transparent)
25
+ );
26
+ --_console-resize-separator-active-line-background-color: var(
27
+ --console-resize-separator-active-line-background-color,
28
+ light-dark(#635bff, #8b83ff)
29
+ );
30
+ --_console-resize-separator-grip-color: var(
31
+ --console-resize-separator-grip-color,
32
+ color-mix(in oklab, currentColor 58%, transparent)
33
+ );
34
+ --_console-resize-separator-active-grip-color: var(
35
+ --console-resize-separator-active-grip-color,
36
+ light-dark(#635bff, #8b83ff)
37
+ );
38
+ --_console-resize-separator-grip-border: var(
39
+ --console-resize-separator-grip-border,
40
+ 1px solid color-mix(in oklab, currentColor 18%, transparent)
41
+ );
42
+ --_console-resize-separator-grip-background-color: var(
43
+ --console-resize-separator-grip-background-color,
44
+ light-dark(
45
+ color-mix(in oklab, white 96%, currentColor 4%),
46
+ color-mix(in oklab, #111113 94%, currentColor 6%)
47
+ )
48
+ );
49
+ --_console-resize-separator-grip-border-radius: var(
50
+ --console-resize-separator-grip-border-radius,
51
+ 999px
52
+ );
53
+ --_console-resize-separator-grip-box-shadow: var(
54
+ --console-resize-separator-grip-box-shadow,
55
+ 0 4px 14px color-mix(in oklab, currentColor 14%, transparent)
56
+ );
57
+ --_console-resize-handle-size: var(--console-resize-handle-size, 10px);
58
+ --_console-resize-corner-size: var(--console-resize-corner-size, 28px);
59
+
60
+ color-scheme: var(--_console-resize-color-scheme);
61
+ position: relative;
62
+ display: flex;
63
+ width: 100%;
64
+ max-width: 100%;
65
+ min-width: 0;
66
+ height: 100%;
67
+ max-height: 100%;
68
+ min-height: 0;
69
+ }
70
+
71
+ .console-resizable-frame[data-console-resize-direction="horizontal"],
72
+ .console-resizable-frame[data-console-resize-direction="inline"],
73
+ .console-resizable-frame[data-console-resize-direction="both"] {
74
+ width: var(--_console-resizable-width);
75
+ min-width: min(100%, var(--_console-resizable-min-width));
76
+ max-width: min(100%, var(--_console-resizable-max-width));
77
+ }
78
+
79
+ .console-resizable-frame[data-console-resize-direction="vertical"],
80
+ .console-resizable-frame[data-console-resize-direction="block"],
81
+ .console-resizable-frame[data-console-resize-direction="both"] {
82
+ height: var(--_console-resizable-height);
83
+ min-height: min(100%, var(--_console-resizable-min-height));
84
+ max-height: min(100%, var(--_console-resizable-max-height));
85
+ }
86
+
87
+ .console-resizable-frame-content {
88
+ display: flex;
89
+ width: 100%;
90
+ min-width: 0;
91
+ height: 100%;
92
+ min-height: 0;
93
+ overflow: hidden;
94
+ }
95
+
96
+ .console-resize-handle {
97
+ position: absolute;
98
+ z-index: 3;
99
+ display: flex;
100
+ align-items: center;
101
+ justify-content: center;
102
+ color: var(--_console-resize-separator-grip-color);
103
+ outline: none;
104
+ touch-action: none;
105
+ }
106
+
107
+ .console-resize-handle[data-console-resize-axis="horizontal"] {
108
+ top: 0;
109
+ width: var(--_console-resize-handle-size);
110
+ height: 100%;
111
+ cursor: col-resize;
112
+ }
113
+
114
+ .console-resizable-frame[data-console-resize-horizontal-edge="end"]
115
+ > .console-resize-handle[data-console-resize-axis="horizontal"] {
116
+ right: calc(var(--_console-resize-handle-size) / -2);
117
+ }
118
+
119
+ .console-resizable-frame[data-console-resize-horizontal-edge="start"]
120
+ > .console-resize-handle[data-console-resize-axis="horizontal"] {
121
+ left: calc(var(--_console-resize-handle-size) / -2);
122
+ }
123
+
124
+ .console-resize-handle[data-console-resize-axis="vertical"] {
125
+ left: 0;
126
+ width: 100%;
127
+ height: var(--_console-resize-handle-size);
128
+ cursor: row-resize;
129
+ }
130
+
131
+ .console-resizable-frame[data-console-resize-vertical-edge="end"]
132
+ > .console-resize-handle[data-console-resize-axis="vertical"] {
133
+ bottom: calc(var(--_console-resize-handle-size) / -2);
134
+ }
135
+
136
+ .console-resizable-frame[data-console-resize-vertical-edge="start"]
137
+ > .console-resize-handle[data-console-resize-axis="vertical"] {
138
+ top: calc(var(--_console-resize-handle-size) / -2);
139
+ }
140
+
141
+ .console-resize-handle::before {
142
+ position: absolute;
143
+ background: var(--_console-resize-separator-line-background-color);
144
+ content: "";
145
+ pointer-events: none;
146
+ transition: background 120ms ease;
147
+ margin-top: -1px;
148
+ border-radius: 6px;
149
+ opacity: 0;
150
+ }
151
+
152
+ .console-resize-handle[data-console-resize-axis="horizontal"]::before {
153
+ width: 5px;
154
+ height: 90%;
155
+ }
156
+
157
+ .console-resize-handle[data-console-resize-axis="vertical"]::before {
158
+ width: 90%;
159
+ height: 5px;
160
+ }
161
+
162
+ .console-resize-handle:hover::before,
163
+ .console-resize-handle:focus-visible::before {
164
+ background: var(--_console-resize-separator-hover-line-background-color);
165
+ opacity: 1;
166
+ }
167
+
168
+ .console-resize-handle[data-active="true"]::before {
169
+ background: var(--_console-resize-separator-active-line-background-color);
170
+ }
171
+
172
+ .console-resize-grip {
173
+ position: relative;
174
+ display: inline-flex;
175
+ align-items: center;
176
+ justify-content: center;
177
+ border: 1px solid transparent;
178
+ border-radius: var(--_console-resize-separator-grip-border-radius);
179
+ background: transparent;
180
+ box-shadow: none;
181
+ color: inherit;
182
+ opacity: 0.55;
183
+ pointer-events: none;
184
+ transition:
185
+ opacity 120ms ease,
186
+ background 120ms ease,
187
+ border-color 120ms ease,
188
+ box-shadow 120ms ease,
189
+ color 120ms ease;
190
+ }
191
+
192
+ .console-resize-handle[data-console-resize-axis="horizontal"]
193
+ > .console-resize-grip {
194
+ width: 22px;
195
+ height: 34px;
196
+ }
197
+
198
+ .console-resize-handle[data-console-resize-axis="vertical"]
199
+ > .console-resize-grip {
200
+ width: 34px;
201
+ height: 22px;
202
+ }
203
+
204
+ .console-resize-handle:hover > .console-resize-grip,
205
+ .console-resize-handle:focus-visible > .console-resize-grip,
206
+ .console-resize-handle[data-active="true"] > .console-resize-grip {
207
+ border: var(--_console-resize-separator-grip-border);
208
+ background: var(--_console-resize-separator-grip-background-color);
209
+ box-shadow: var(--_console-resize-separator-grip-box-shadow);
210
+ opacity: 1;
211
+ }
212
+
213
+ .console-resize-handle[data-active="true"] > .console-resize-grip {
214
+ color: var(--_console-resize-separator-active-grip-color);
215
+ }
216
+
217
+ .console-resize-corner-handle {
218
+ position: absolute;
219
+ z-index: 4;
220
+ display: flex;
221
+ width: var(--_console-resize-corner-size);
222
+ height: var(--_console-resize-corner-size);
223
+ align-items: center;
224
+ justify-content: center;
225
+ border: 1px solid transparent;
226
+ border-radius: 8px;
227
+ background: transparent;
228
+ box-shadow: none;
229
+ color: var(--_console-resize-separator-grip-color);
230
+ opacity: 0.65;
231
+ outline: none;
232
+ touch-action: none;
233
+ transition:
234
+ opacity 120ms ease,
235
+ background 120ms ease,
236
+ border-color 120ms ease,
237
+ box-shadow 120ms ease,
238
+ color 120ms ease;
239
+ }
240
+
241
+ .console-resizable-frame[data-console-resize-horizontal-edge="end"]
242
+ > .console-resize-corner-handle {
243
+ right: -4px;
244
+ }
245
+
246
+ .console-resizable-frame[data-console-resize-horizontal-edge="start"]
247
+ > .console-resize-corner-handle {
248
+ left: -4px;
249
+ }
250
+
251
+ .console-resizable-frame[data-console-resize-vertical-edge="end"]
252
+ > .console-resize-corner-handle {
253
+ bottom: -4px;
254
+ }
255
+
256
+ .console-resizable-frame[data-console-resize-vertical-edge="start"]
257
+ > .console-resize-corner-handle {
258
+ top: -4px;
259
+ }
260
+
261
+ .console-resizable-frame[data-console-resize-horizontal-edge="end"][data-console-resize-vertical-edge="end"]
262
+ > .console-resize-corner-handle,
263
+ .console-resizable-frame[data-console-resize-horizontal-edge="start"][data-console-resize-vertical-edge="start"]
264
+ > .console-resize-corner-handle {
265
+ cursor: nwse-resize;
266
+ }
267
+
268
+ .console-resizable-frame[data-console-resize-horizontal-edge="end"][data-console-resize-vertical-edge="start"]
269
+ > .console-resize-corner-handle,
270
+ .console-resizable-frame[data-console-resize-horizontal-edge="start"][data-console-resize-vertical-edge="end"]
271
+ > .console-resize-corner-handle {
272
+ cursor: nesw-resize;
273
+ }
274
+
275
+ .console-resize-corner-handle:hover,
276
+ .console-resize-corner-handle:focus-visible,
277
+ .console-resize-corner-handle[data-active="true"] {
278
+ border: var(--_console-resize-separator-grip-border);
279
+ background: var(--_console-resize-separator-grip-background-color);
280
+ box-shadow: var(--_console-resize-separator-grip-box-shadow);
281
+ opacity: 1;
282
+ }
283
+
284
+ .console-resize-corner-handle[data-active="true"] {
285
+ color: var(--_console-resize-separator-active-grip-color);
286
+ }
287
+
288
+ @media (prefers-reduced-motion: reduce) {
289
+ .console-resize-handle::before,
290
+ .console-resize-grip,
291
+ .console-resize-corner-handle {
292
+ transition: none;
293
+ }
294
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moyarich/console-addon-resizable",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "First-party resizable frame addon for @moyarich/console hosts.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,33 +9,36 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
- "development": "./src/index.tsx",
13
- "types": "./dist/index.d.ts",
14
- "import": "./dist/index.js",
15
- "require": "./dist/index.cjs"
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
16
20
  },
17
- "./styles.css": "./src/styles.css"
21
+ "./styles.css": "./dist/styles.css"
18
22
  },
19
23
  "files": [
20
- "dist",
21
- "src/styles.css"
24
+ "dist"
22
25
  ],
23
26
  "publishConfig": {
24
27
  "registry": "https://npm.pkg.github.com"
25
28
  },
26
29
  "scripts": {
27
- "build": "vite build && tsc -p tsconfig.build.json",
30
+ "build": "vite build && tsc -p tsconfig.build.json && node ../../../scripts/prepare-cjs-types.mjs && node ../../../scripts/prepare-addon-styles.mjs",
28
31
  "typecheck": "tsc --noEmit"
29
32
  },
30
33
  "dependencies": {
31
34
  "lucide-react": "^1.47.0"
32
35
  },
33
36
  "peerDependencies": {
34
- "@moyarich/console-core": "^0.1.0",
37
+ "@moyarich/console-core": "^0.2.0",
35
38
  "react": ">=18"
36
39
  },
37
40
  "devDependencies": {
38
- "@moyarich/console-core": "0.1.0",
41
+ "@moyarich/console-core": "0.2.0",
39
42
  "@types/react": "^19.1.12",
40
43
  "react": "^19.2.7",
41
44
  "typescript": "^5.9.2",
@@ -60,9 +63,13 @@
60
63
  "./src/index.tsx",
61
64
  "./src/components/ResizableConsoleFrame/ResizableConsoleFrame.css",
62
65
  "./dist/index.js",
63
- "./dist/index.cjs"
66
+ "./dist/index.cjs",
67
+ "./dist/styles.css"
64
68
  ],
65
69
  "publisher": "moyarich",
66
70
  "author": "Moya Richards",
71
+ "engines": {
72
+ "node": ">=24"
73
+ },
67
74
  "private": false
68
75
  }