@yogiswara/honcho-editor-ui 3.2.2 → 3.2.4

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.
@@ -69,6 +69,7 @@ export default function HImageEditorMobile(props) {
69
69
  height: 'calc(100% - 30px)',
70
70
  overflowY: 'auto',
71
71
  scrollbarWidth: 'none',
72
+ userSelect: 'none',
72
73
  '&::-webkit-scrollbar': { display: 'none' },
73
74
  }, children: renderPanelContent() })] })), currentSubTabs && (_jsx(Paper, { sx: {
74
75
  backgroundColor: colors.onBackground,
@@ -109,7 +109,7 @@ export default function HSliderColorMobile(props) {
109
109
  borderBottom: 'none',
110
110
  pl: '2px',
111
111
  };
112
- return (_jsx(_Fragment, { children: _jsxs(Stack, { spacing: 0, direction: "column", sx: { width: '100%', paddingX: 1, m: "0px" }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: '10px', pb: '0px', '&:focus-within .MuiFilledInput-input': focusedInputStyle }, children: [_jsx(Typography, { sx: { ...typography.bodyMedium, color: colors.surface, userSelect: 'none' }, onDoubleClick: tempInput.handleDoubleClick, children: "Temperature" }), _jsx(Typography, { sx: {
112
+ return (_jsx(_Fragment, { children: _jsxs(Stack, { spacing: 0, direction: "column", sx: { width: '100%', paddingX: 1, m: "0px", userSelect: 'none' }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: '10px', pb: '0px', '&:focus-within .MuiFilledInput-input': focusedInputStyle }, children: [_jsx(Typography, { sx: { ...typography.bodyMedium, color: colors.surface, userSelect: 'none' }, onDoubleClick: tempInput.handleDoubleClick, children: "Temperature" }), _jsx(Typography, { sx: {
113
113
  ...typography.bodyMedium, // Use your standard typography
114
114
  color: colors.surface,
115
115
  width: "40px", // Keep the fixed width for alignment
@@ -91,7 +91,7 @@ export default function HSliderLightMobile(props) {
91
91
  const shadowsInput = useAdjustmentField(props.shadowScore, (val) => props.onShadowsChange("shadowsScore", val), props.onDragStart, props.onDragEnd, props.isBatchMode);
92
92
  const whitesInput = useAdjustmentField(props.whiteScore, (val) => props.onWhitesChange("whitesScore", val), props.onDragStart, props.onDragEnd, props.isBatchMode);
93
93
  const blacksInput = useAdjustmentField(props.blackScore, (val) => props.onBlacksChange("blacksScore", val), props.onDragStart, props.onDragEnd, props.isBatchMode);
94
- return (_jsx(_Fragment, { children: _jsxs(Stack, { spacing: 0, direction: "column", sx: { width: '100%', paddingX: 1 }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: '10px', pb: '0px' }, children: [_jsx(Typography, { sx: { ...typography.bodyMedium, color: colors.surface, userSelect: 'none' }, onDoubleClick: exposureInput.handleDoubleClick, children: "Exposure" }), _jsx(Typography, { sx: {
94
+ return (_jsx(_Fragment, { children: _jsxs(Stack, { spacing: 0, direction: "column", sx: { width: '100%', paddingX: 1, userSelect: 'none' }, children: [_jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pt: '10px', pb: '0px' }, children: [_jsx(Typography, { sx: { ...typography.bodyMedium, color: colors.surface, userSelect: 'none' }, onDoubleClick: exposureInput.handleDoubleClick, children: "Exposure" }), _jsx(Typography, { sx: {
95
95
  ...typography.bodyMedium, // Use your standard typography
96
96
  color: colors.surface,
97
97
  width: "40px", // Keep the fixed width for alignment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yogiswara/honcho-editor-ui",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "description": "A complete UI component library for the Honcho photo editor.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -1,57 +0,0 @@
1
- import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
2
- import { Observable } from "rxjs/internal/Observable";
3
- export declare const api: any;
4
- export interface ResponseData<T> {
5
- code?: number;
6
- message?: string;
7
- data?: T;
8
- error_message?: string;
9
- }
10
- export declare class ResponseError extends Error {
11
- code: number;
12
- error_message: string;
13
- isEmptyData: boolean;
14
- constructor(code: number, error_message: string, originalError?: Error, isEmptyData?: boolean);
15
- }
16
- export declare class EmptyDataError extends Error {
17
- constructor();
18
- }
19
- export declare function handleResponse<T>(res: AxiosResponse<ResponseData<T>>): T;
20
- export declare function handleError(error: any): Observable<any>;
21
- export declare function isResponseError(error: any): Boolean;
22
- /**
23
- * @deprecated use axiosGetObservable, axiosPostObservable, axiosPutObservable, axiosDeleteObservable instead
24
- * @param promise
25
- */
26
- export declare function fromAxiosToObservable<T>(promise: Promise<AxiosResponse<ResponseData<T>>>): Observable<T>;
27
- export declare const apiV3: any;
28
- export declare class BaseServices {
29
- protected axios: AxiosInstance;
30
- protected constructor(axios: AxiosInstance);
31
- protected axiosGetObservable<T>(url: string, params?: AxiosRequestConfig<any> | undefined): Observable<T>;
32
- protected axiosPostObservable<T>(url: string, data: any, params?: AxiosRequestConfig<any> | undefined): Observable<T>;
33
- protected axiosPutObservable<T>(url: string, data: any, params?: AxiosRequestConfig<any> | undefined): Observable<T>;
34
- protected axiosDeleteObservable<T>(url: string, params?: AxiosRequestConfig<any> | undefined): Observable<T>;
35
- }
36
- export interface Result<T> {
37
- getStatus(): "loading" | "success" | "error" | "not-found" | "idle";
38
- getData(): T;
39
- getDataOrNull(): T | null | undefined;
40
- getError(): any;
41
- }
42
- export declare class ResultImpl<T> implements Result<T> {
43
- private readonly status;
44
- private readonly data;
45
- private readonly error;
46
- getStatus(): "loading" | "success" | "error" | "not-found" | "idle";
47
- getData(): T;
48
- getError(): any;
49
- getDataOrNull(): T | null | undefined;
50
- private constructor();
51
- static success<T>(data: T): Result<T>;
52
- static loading<T>(): Result<T>;
53
- static error<T>(err: any): Result<T>;
54
- static notFound<T>(): Result<T>;
55
- static idle<T>(): Result<T>;
56
- }
57
- export declare function fromPromise<T>(promise: Promise<T>): Observable<T>;
@@ -1,243 +0,0 @@
1
- import axios from "axios";
2
- import axiosRetry from 'axios-retry';
3
- import { Observable } from "rxjs/internal/Observable";
4
- import { catchError, from, map } from "rxjs";
5
- const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:8080";
6
- const apiConfig = (version) => {
7
- return axios.create({
8
- baseURL: `${BASE_URL}/${version}/`,
9
- timeout: 60000 * 2,
10
- });
11
- };
12
- export const api = axios.create({
13
- baseURL: `${BASE_URL}`,
14
- timeout: 60000 * 2,
15
- });
16
- axiosRetry(api, { retries: 3, retryDelay: axiosRetry.linearDelay() });
17
- export class ResponseError extends Error {
18
- constructor(code, error_message, originalError, isEmptyData = false) {
19
- super(`${code}: ${error_message}`);
20
- this.isEmptyData = false;
21
- this.code = code;
22
- this.error_message = error_message;
23
- this.isEmptyData = isEmptyData;
24
- if (originalError && originalError.stack) {
25
- this.stack += `\nCaused by: ${originalError.stack}`;
26
- }
27
- // we need to set prototype to make this object can check by
28
- // instanceof ResponseError
29
- Object.setPrototypeOf(this, ResponseError.prototype);
30
- }
31
- }
32
- export class EmptyDataError extends Error {
33
- constructor() {
34
- super("Data Empty, server not send any data in response");
35
- // we need to set prototype to make this object can check by
36
- // instanceof EmptyDataError
37
- Object.setPrototypeOf(this, EmptyDataError.prototype);
38
- }
39
- }
40
- // get data from response
41
- export function handleResponse(res) {
42
- if (!res.data.data) {
43
- throw new EmptyDataError();
44
- }
45
- return res.data.data;
46
- }
47
- function mapError(error) {
48
- if (error.isAxiosError) {
49
- if (error.response) {
50
- if (typeof error.response.data === "string") {
51
- return {
52
- code: error.response.status,
53
- message: `${error.response.status}: ${error.response.statusText}`,
54
- data: undefined,
55
- error_message: error.response.data,
56
- };
57
- }
58
- else {
59
- return error.response?.data;
60
- }
61
- }
62
- else if (error.request) {
63
- return {
64
- code: 400,
65
- message: "`${error.name}: failed connect to server check your connection`",
66
- data: undefined,
67
- error_message: "failed connect to server",
68
- };
69
- }
70
- else {
71
- return {
72
- code: 400,
73
- message: error.message,
74
- data: undefined,
75
- error_message: error.message,
76
- };
77
- }
78
- }
79
- else {
80
- return {
81
- code: 500,
82
- message: String(error),
83
- data: undefined,
84
- error_message: String(error),
85
- };
86
- }
87
- }
88
- // handle error from response convert it and throw it as ResponseError
89
- export function handleError(error) {
90
- if (error instanceof EmptyDataError) {
91
- // if data is empty just throw error
92
- throw new ResponseError(204, "Data Empty, server not send any data in response", error, true);
93
- }
94
- let response = mapError(error);
95
- throw new ResponseError(response.code || 500, response.error_message || "Unknown error", error);
96
- }
97
- export function isResponseError(error) {
98
- return !!((error.code) && (error.error_message));
99
- }
100
- /**
101
- * @deprecated use axiosGetObservable, axiosPostObservable, axiosPutObservable, axiosDeleteObservable instead
102
- * @param promise
103
- */
104
- export function fromAxiosToObservable(promise) {
105
- return from(promise).pipe(map(handleResponse), catchError(handleError));
106
- }
107
- export const apiV3 = apiConfig('v3');
108
- export class BaseServices {
109
- constructor(axios) {
110
- this.axios = axios;
111
- }
112
- axiosGetObservable(url, params) {
113
- return new Observable(subscriber => {
114
- const controller = new AbortController();
115
- const paramsData = { signal: controller.signal, ...params };
116
- this.axios.get(url, paramsData)
117
- .then(res => {
118
- console.debug({ res, url, params }, "success GET request");
119
- subscriber.next(res);
120
- subscriber.complete();
121
- })
122
- .catch((error) => {
123
- console.error({ error, url, params }, "Failed GET request");
124
- subscriber.error(error);
125
- });
126
- return () => {
127
- console.debug({ url, params, method: "GET" }, "Abort request");
128
- controller.abort();
129
- };
130
- }).pipe(map(handleResponse), catchError(handleError));
131
- }
132
- axiosPostObservable(url, data, params) {
133
- return new Observable(subscriber => {
134
- const controller = new AbortController();
135
- const paramsData = { signal: controller.signal, ...params };
136
- this.axios.post(url, data, paramsData)
137
- .then(res => {
138
- console.debug({ res, url, params }, "success POST request");
139
- subscriber.next(res);
140
- subscriber.complete();
141
- })
142
- .catch((error) => {
143
- console.error({ error, url, params }, "Failed POST request");
144
- subscriber.error(error);
145
- });
146
- return () => {
147
- console.debug({ url, params, method: "POST" }, "Abort request");
148
- controller.abort();
149
- };
150
- }).pipe(map(handleResponse), catchError(handleError));
151
- }
152
- axiosPutObservable(url, data, params) {
153
- return new Observable(subscriber => {
154
- const controller = new AbortController();
155
- const paramsData = { signal: controller.signal, ...params };
156
- this.axios.put(url, data, paramsData)
157
- .then(res => {
158
- console.debug({ res, url, params }, "success PUT request");
159
- subscriber.next(res);
160
- subscriber.complete();
161
- })
162
- .catch((error) => {
163
- console.error({ error, url, params }, "Failed PUT request");
164
- subscriber.error(error);
165
- });
166
- return () => {
167
- console.debug({ url, params, method: "PUT" }, "Abort request");
168
- controller.abort();
169
- };
170
- }).pipe(map(handleResponse), catchError(handleError));
171
- }
172
- axiosDeleteObservable(url, params) {
173
- return new Observable(subscriber => {
174
- const controller = new AbortController();
175
- const paramsData = { signal: controller.signal, ...params };
176
- this.axios.delete(url, paramsData)
177
- .then(res => {
178
- console.debug({ res, url, params }, "success DELETE request");
179
- subscriber.next(res);
180
- subscriber.complete();
181
- })
182
- .catch((error) => {
183
- console.error({ error, url, params }, "Failed DELETE request");
184
- subscriber.error(error);
185
- });
186
- return () => {
187
- console.debug({ url, params, method: "DELETE" }, "Abort request");
188
- controller.abort();
189
- };
190
- }).pipe(map(handleResponse), catchError(handleError));
191
- }
192
- }
193
- export class ResultImpl {
194
- getStatus() {
195
- return this.status;
196
- }
197
- getData() {
198
- if (this.data)
199
- return this.data;
200
- throw new Error("Data is not available");
201
- }
202
- getError() {
203
- if (this.error)
204
- return this.error;
205
- throw new Error("Error is not available");
206
- }
207
- getDataOrNull() {
208
- return this.data;
209
- }
210
- constructor(status, data, error) {
211
- this.status = "idle";
212
- this.status = status;
213
- this.data = data;
214
- this.error = error;
215
- }
216
- static success(data) {
217
- return new ResultImpl("success", data, null);
218
- }
219
- static loading() {
220
- return new ResultImpl("loading");
221
- }
222
- static error(err) {
223
- return new ResultImpl("error", null, err);
224
- }
225
- static notFound() {
226
- return new ResultImpl("not-found");
227
- }
228
- static idle() {
229
- return new ResultImpl("idle");
230
- }
231
- }
232
- export function fromPromise(promise) {
233
- return new Observable(subscriber => {
234
- promise.then(value => {
235
- console.debug({ value }, "Promise success");
236
- subscriber.next(value);
237
- subscriber.complete();
238
- }).catch(err => {
239
- console.error({ err }, "Promise error");
240
- subscriber.error(err);
241
- });
242
- });
243
- }