@design-edito/tools 0.1.16 → 0.1.18

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,12 +1,12 @@
1
- import {
2
- timeoutCall
3
- } from "../../chunks/chunk-4VC5PT5T.js";
4
1
  import {
5
2
  Transitions
6
3
  } from "../../chunks/chunk-4GDNHUCZ.js";
7
4
  import {
8
5
  wait
9
6
  } from "../../chunks/chunk-DQNJQBC6.js";
7
+ import {
8
+ timeoutCall
9
+ } from "../../chunks/chunk-4VC5PT5T.js";
10
10
 
11
11
  // src/agnostic/async/index.ts
12
12
  var Async;
@@ -1,6 +1,3 @@
1
- import {
2
- Random
3
- } from "../../chunks/chunk-WLL3FNVL.js";
4
1
  import {
5
2
  generateNiceColor,
6
3
  niceColors
@@ -12,17 +9,19 @@ import {
12
9
  classNameRegex,
13
10
  isValidClassName
14
11
  } from "../../chunks/chunk-W5A2TON3.js";
15
- import "../../chunks/chunk-QXAJXTXV.js";
16
- import "../../chunks/chunk-HC6ZOHCS.js";
12
+ import {
13
+ Random
14
+ } from "../../chunks/chunk-WLL3FNVL.js";
17
15
  import {
18
16
  register
19
- } from "../../chunks/chunk-LBOQFB4H.js";
17
+ } from "../../chunks/chunk-BG6HX6CQ.js";
20
18
  import {
21
19
  Crossenv
22
20
  } from "../../chunks/chunk-GJOU3UAL.js";
23
- import "../../chunks/chunk-4CMAH7Q4.js";
24
- import "../../chunks/chunk-HEXR23CH.js";
25
- import "../../chunks/chunk-HDPSQ7WY.js";
21
+ import "../../chunks/chunk-BC22JVVY.js";
22
+ import "../../chunks/chunk-WRS4WCFS.js";
23
+ import "../../chunks/chunk-QXAJXTXV.js";
24
+ import "../../chunks/chunk-HC6ZOHCS.js";
26
25
 
27
26
  // src/agnostic/css/styles-set/index.tsx
28
27
  import { Component } from "react";
@@ -1,8 +1,7 @@
1
1
  import {
2
2
  Errors
3
- } from "../../chunks/chunk-4CMAH7Q4.js";
4
- import "../../chunks/chunk-HEXR23CH.js";
5
- import "../../chunks/chunk-HDPSQ7WY.js";
3
+ } from "../../chunks/chunk-BC22JVVY.js";
4
+ import "../../chunks/chunk-WRS4WCFS.js";
6
5
  export {
7
6
  Errors
8
7
  };
@@ -1,4 +1,3 @@
1
- import { Outcome } from '~/agnostic/misc/outcome';
2
1
  export declare namespace Register {
3
2
  type RegisterEntry = {
4
3
  message: string;
@@ -19,15 +18,20 @@ export declare namespace Register {
19
18
  type Details<Source extends {
20
19
  [k: string]: RegisterEntry;
21
20
  }, Code extends RegisterKeys<Source>> = ReturnType<DetailsMaker<Source, Code>>;
22
- type FailureOutcome<Source extends {
21
+ type ErrorData<Source extends {
23
22
  [k: string]: RegisterEntry;
24
- }, Code extends RegisterKeys<Source>> = Outcome.Failure<Code, Message<Source, Code>, Details<Source, Code>>;
23
+ }, Code extends RegisterKeys<Source>> = {
24
+ code: Code;
25
+ message: Message<Source, Code>;
26
+ details: Details<Source, Code>;
27
+ };
25
28
  function from<Source extends {
26
29
  [k: string]: RegisterEntry;
27
30
  }>(source: Source): {
28
31
  getMessage: <Code extends RegisterKeys<Source>>(code: Code) => Message<Source, Code>;
29
32
  getDetailsMaker: <Code extends RegisterKeys<Source>>(code: Code) => DetailsMaker<Source, Code>;
30
33
  getDetails: <Code extends RegisterKeys<Source>>(code: Code, ...params: DetailsMakerParams<Source, Code>) => Details<Source, Code>;
34
+ getErrorData: <Code extends RegisterKeys<Source>>(code: Code, ...params: DetailsMakerParams<Source, Code>) => ErrorData<Source, Code>;
31
35
  getError: <Code extends RegisterKeys<Source>>(code: Code, ...params: DetailsMakerParams<Source, Code>) => {
32
36
  code: Code;
33
37
  details: ReturnType<DetailsMaker<Source, Code>>;
@@ -35,19 +39,6 @@ export declare namespace Register {
35
39
  message: string;
36
40
  stack?: string;
37
41
  };
38
- getFailureOutcome: <Code extends RegisterKeys<Source>>(code: Code, ...params: DetailsMakerParams<Source, Code>) => FailureOutcome<Source, Code>;
39
- CustomError: {
40
- new <Code extends RegisterKeys<Source>>(code: Code, ...params: DetailsMakerParams<Source, Code>): {
41
- code: Code;
42
- details: Details<Source, Code>;
43
- name: string;
44
- message: string;
45
- stack?: string;
46
- };
47
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
48
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
49
- stackTraceLimit: number;
50
- };
51
42
  source: Source;
52
43
  };
53
44
  }
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  Register
3
- } from "../../../chunks/chunk-HEXR23CH.js";
4
- import "../../../chunks/chunk-HDPSQ7WY.js";
3
+ } from "../../../chunks/chunk-WRS4WCFS.js";
5
4
  export {
6
5
  Register
7
6
  };
@@ -1,29 +1,28 @@
1
1
  import {
2
- getPositionInsideParent
3
- } from "../../chunks/chunk-VTPRO4NJ.js";
2
+ stringToNodes
3
+ } from "../../chunks/chunk-FMGKTQK4.js";
4
4
  import {
5
- Placeholders
6
- } from "../../chunks/chunk-VYW4IADX.js";
5
+ Sanitize
6
+ } from "../../chunks/chunk-WQI4RK2W.js";
7
7
  import {
8
8
  getNodeAncestors
9
9
  } from "../../chunks/chunk-SQZGZ3VT.js";
10
10
  import {
11
- stringToNodes
12
- } from "../../chunks/chunk-YJOEYNCI.js";
13
- import {
14
- Sanitize
15
- } from "../../chunks/chunk-O2VE3J4K.js";
11
+ getPositionInsideParent
12
+ } from "../../chunks/chunk-VTPRO4NJ.js";
16
13
  import {
17
14
  selectorToElement
18
- } from "../../chunks/chunk-TSMHOSST.js";
19
- import "../../chunks/chunk-LBOQFB4H.js";
15
+ } from "../../chunks/chunk-2ZQYNOGG.js";
16
+ import "../../chunks/chunk-BG6HX6CQ.js";
20
17
  import "../../chunks/chunk-GJOU3UAL.js";
18
+ import "../../chunks/chunk-BC22JVVY.js";
19
+ import "../../chunks/chunk-WRS4WCFS.js";
21
20
  import {
22
21
  insertNode
23
22
  } from "../../chunks/chunk-XA4HVHJ4.js";
24
- import "../../chunks/chunk-4CMAH7Q4.js";
25
- import "../../chunks/chunk-HEXR23CH.js";
26
- import "../../chunks/chunk-HDPSQ7WY.js";
23
+ import {
24
+ Placeholders
25
+ } from "../../chunks/chunk-VYW4IADX.js";
27
26
 
28
27
  // src/agnostic/html/index.ts
29
28
  var Html;
@@ -1,11 +1,10 @@
1
1
  import {
2
2
  Sanitize
3
- } from "../../../chunks/chunk-O2VE3J4K.js";
4
- import "../../../chunks/chunk-LBOQFB4H.js";
3
+ } from "../../../chunks/chunk-WQI4RK2W.js";
4
+ import "../../../chunks/chunk-BG6HX6CQ.js";
5
5
  import "../../../chunks/chunk-GJOU3UAL.js";
6
- import "../../../chunks/chunk-4CMAH7Q4.js";
7
- import "../../../chunks/chunk-HEXR23CH.js";
8
- import "../../../chunks/chunk-HDPSQ7WY.js";
6
+ import "../../../chunks/chunk-BC22JVVY.js";
7
+ import "../../../chunks/chunk-WRS4WCFS.js";
9
8
  export {
10
9
  Sanitize
11
10
  };
@@ -1,11 +1,10 @@
1
1
  import {
2
2
  selectorToElement
3
- } from "../../../chunks/chunk-TSMHOSST.js";
4
- import "../../../chunks/chunk-LBOQFB4H.js";
3
+ } from "../../../chunks/chunk-2ZQYNOGG.js";
4
+ import "../../../chunks/chunk-BG6HX6CQ.js";
5
5
  import "../../../chunks/chunk-GJOU3UAL.js";
6
- import "../../../chunks/chunk-4CMAH7Q4.js";
7
- import "../../../chunks/chunk-HEXR23CH.js";
8
- import "../../../chunks/chunk-HDPSQ7WY.js";
6
+ import "../../../chunks/chunk-BC22JVVY.js";
7
+ import "../../../chunks/chunk-WRS4WCFS.js";
9
8
  export {
10
9
  selectorToElement
11
10
  };
@@ -1,12 +1,11 @@
1
1
  import {
2
2
  stringToNodes
3
- } from "../../../chunks/chunk-YJOEYNCI.js";
4
- import "../../../chunks/chunk-O2VE3J4K.js";
5
- import "../../../chunks/chunk-LBOQFB4H.js";
3
+ } from "../../../chunks/chunk-FMGKTQK4.js";
4
+ import "../../../chunks/chunk-WQI4RK2W.js";
5
+ import "../../../chunks/chunk-BG6HX6CQ.js";
6
6
  import "../../../chunks/chunk-GJOU3UAL.js";
7
- import "../../../chunks/chunk-4CMAH7Q4.js";
8
- import "../../../chunks/chunk-HEXR23CH.js";
9
- import "../../../chunks/chunk-HDPSQ7WY.js";
7
+ import "../../../chunks/chunk-BC22JVVY.js";
8
+ import "../../../chunks/chunk-WRS4WCFS.js";
10
9
  export {
11
10
  stringToNodes
12
11
  };
@@ -7,21 +7,21 @@ import {
7
7
  import {
8
8
  Logs
9
9
  } from "../../chunks/chunk-HEJV6JIO.js";
10
+ import {
11
+ Random
12
+ } from "../../chunks/chunk-WLL3FNVL.js";
10
13
  import {
11
14
  Cast
12
15
  } from "../../chunks/chunk-4QQBKBYH.js";
13
16
  import {
14
- Random
15
- } from "../../chunks/chunk-WLL3FNVL.js";
17
+ Crossenv
18
+ } from "../../chunks/chunk-GJOU3UAL.js";
16
19
  import "../../chunks/chunk-QXAJXTXV.js";
17
20
  import {
18
21
  isNotNullish,
19
22
  isNullish,
20
23
  nullishValues
21
24
  } from "../../chunks/chunk-HC6ZOHCS.js";
22
- import {
23
- Crossenv
24
- } from "../../chunks/chunk-GJOU3UAL.js";
25
25
  import {
26
26
  isConstructorFunction
27
27
  } from "../../chunks/chunk-RCO57B6F.js";
@@ -3,15 +3,13 @@ export declare namespace Outcome {
3
3
  success: true;
4
4
  payload: Payload;
5
5
  };
6
- type Failure<Code extends any = any, Msg extends string = string, Details extends any = any> = {
6
+ type Failure<Error extends any = any> = {
7
7
  success: false;
8
- code: Code;
9
- message: Msg;
10
- details?: Details;
8
+ error: Error;
11
9
  };
12
- type Either<Payload extends any = any, Code extends any = any, Msg extends string = string, Details extends any = any> = Success<Payload> | Failure<Code, Msg, Details>;
10
+ type Either<Payload extends any = any, Error extends any = any> = Success<Payload> | Failure<Error>;
13
11
  function makeSuccess<Payload extends any>(payload: Payload): Success<Payload>;
14
- function makeFailure<Code extends any = any, Msg extends string = string, Details extends any | undefined = undefined>(code: Code, message: Msg, details?: Details): Failure<Code, Msg, Details>;
12
+ function makeFailure<Error extends any>(error: Error): Failure<Error>;
15
13
  function make<Payload extends any>(success: true, payload: Payload): Success<Payload>;
16
- function make<Code extends any = any, Msg extends string = string, Details extends any | undefined = undefined>(success: false, code: Code, message: Msg, details?: Details): Failure<Code, Msg, Details>;
14
+ function make<Error extends any>(success: false, error: Error): Failure<Error>;
17
15
  }
@@ -1,6 +1,19 @@
1
- import {
2
- Outcome
3
- } from "../../../chunks/chunk-HDPSQ7WY.js";
1
+ // src/agnostic/misc/outcome/index.ts
2
+ var Outcome;
3
+ ((Outcome2) => {
4
+ function makeSuccess(payload) {
5
+ return { success: true, payload };
6
+ }
7
+ Outcome2.makeSuccess = makeSuccess;
8
+ function makeFailure(error) {
9
+ return { success: false, error };
10
+ }
11
+ Outcome2.makeFailure = makeFailure;
12
+ function make(success, payloadOrError) {
13
+ return success ? makeSuccess(payloadOrError) : makeFailure(payloadOrError);
14
+ }
15
+ Outcome2.make = make;
16
+ })(Outcome || (Outcome = {}));
4
17
  export {
5
18
  Outcome
6
19
  };
@@ -2,18 +2,18 @@ import {
2
2
  clamp
3
3
  } from "../../chunks/chunk-OSAXBA7G.js";
4
4
  import {
5
- interpolate
6
- } from "../../chunks/chunk-EW46EXFB.js";
5
+ absoluteModulo
6
+ } from "../../chunks/chunk-DNIOWD7K.js";
7
7
  import {
8
8
  createScale,
9
9
  getHarmonic
10
10
  } from "../../chunks/chunk-UYTXXUU7.js";
11
- import {
12
- absoluteModulo
13
- } from "../../chunks/chunk-DNIOWD7K.js";
14
11
  import {
15
12
  round
16
13
  } from "../../chunks/chunk-32IRF4OP.js";
14
+ import {
15
+ interpolate
16
+ } from "../../chunks/chunk-EW46EXFB.js";
17
17
 
18
18
  // src/agnostic/numbers/index.ts
19
19
  var Numbers;
@@ -1,10 +1,10 @@
1
+ import {
2
+ flattenGetters
3
+ } from "../../chunks/chunk-PO3V3I57.js";
1
4
  import {
2
5
  isNonNullObject,
3
6
  isObject
4
7
  } from "../../chunks/chunk-HQLRJ7XW.js";
5
- import {
6
- flattenGetters
7
- } from "../../chunks/chunk-PO3V3I57.js";
8
8
  import {
9
9
  isRecord
10
10
  } from "../../chunks/chunk-YDIBNEGA.js";
@@ -4,9 +4,6 @@ import {
4
4
  import {
5
5
  normalizeIndent
6
6
  } from "../../chunks/chunk-JQXNEJAP.js";
7
- import {
8
- replaceAll
9
- } from "../../chunks/chunk-MF56TTC5.js";
10
7
  import {
11
8
  toAlphanum
12
9
  } from "../../chunks/chunk-COVPTTAD.js";
@@ -15,6 +12,9 @@ import {
15
12
  matchesEvery,
16
13
  matchesSome
17
14
  } from "../../chunks/chunk-LQFKUNVQ.js";
15
+ import {
16
+ replaceAll
17
+ } from "../../chunks/chunk-MF56TTC5.js";
18
18
 
19
19
  // src/agnostic/strings/index.ts
20
20
  var Strings;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  register
3
- } from "./chunk-LBOQFB4H.js";
3
+ } from "./chunk-BG6HX6CQ.js";
4
4
  import {
5
5
  Crossenv
6
6
  } from "./chunk-GJOU3UAL.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Register
3
- } from "./chunk-HEXR23CH.js";
3
+ } from "./chunk-WRS4WCFS.js";
4
4
 
5
5
  // src/agnostic/errors/index.ts
6
6
  var Errors;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GJOU3UAL.js";
4
4
  import {
5
5
  Errors
6
- } from "./chunk-4CMAH7Q4.js";
6
+ } from "./chunk-BC22JVVY.js";
7
7
 
8
8
  // src/shared/errors/index.ts
9
9
  var register = Errors.Register.from({
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Sanitize
3
- } from "./chunk-O2VE3J4K.js";
3
+ } from "./chunk-WQI4RK2W.js";
4
4
  import {
5
5
  register
6
- } from "./chunk-LBOQFB4H.js";
6
+ } from "./chunk-BG6HX6CQ.js";
7
7
  import {
8
8
  Crossenv
9
9
  } from "./chunk-GJOU3UAL.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  register
3
- } from "./chunk-LBOQFB4H.js";
3
+ } from "./chunk-BG6HX6CQ.js";
4
4
  import {
5
5
  Crossenv
6
6
  } from "./chunk-GJOU3UAL.js";
@@ -1,7 +1,3 @@
1
- import {
2
- Outcome
3
- } from "./chunk-HDPSQ7WY.js";
4
-
5
1
  // src/agnostic/errors/register/index.ts
6
2
  var Register;
7
3
  ((Register2) => {
@@ -19,31 +15,30 @@ var Register;
19
15
  const details = maker?.(...params);
20
16
  return details;
21
17
  }
22
- function getFailureOutcome(code, ...params) {
18
+ function getErrorData(code, ...params) {
23
19
  const message = getMessage(code);
24
20
  const details = getDetails(code, ...params);
25
- return Outcome.makeFailure(code, message, details);
21
+ return { code, message, details };
26
22
  }
27
- class CustomError extends Error {
23
+ class RegisteredError extends Error {
28
24
  code;
29
25
  details;
30
26
  constructor(code, ...params) {
31
- super(getMessage(code));
32
- const details = getDetails(code, ...params);
33
- this.code = code;
34
- this.details = details;
27
+ const data = getErrorData(code, ...params);
28
+ super(data.message);
29
+ this.code = data.code;
30
+ this.details = data.details;
35
31
  }
36
32
  }
37
33
  function getError(code, ...params) {
38
- return new CustomError(code, ...params);
34
+ return new RegisteredError(code, ...params);
39
35
  }
40
36
  return {
41
37
  getMessage,
42
38
  getDetailsMaker,
43
39
  getDetails,
40
+ getErrorData,
44
41
  getError,
45
- getFailureOutcome,
46
- CustomError,
47
42
  source
48
43
  };
49
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/tools",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -43,7 +43,7 @@ export declare const register: {
43
43
  detailsMaker: (tips?: string) => string | undefined;
44
44
  };
45
45
  }, Code>>;
46
- getError: <Code extends Codes>(code: Code, ...params: Parameters<Errors.Register.DetailsMaker<{
46
+ getErrorData: <Code extends Codes>(code: Code, ...params: Parameters<Errors.Register.DetailsMaker<{
47
47
  "no-window-document-on-runtime": {
48
48
  message: string;
49
49
  detailsMaker: () => undefined;
@@ -52,23 +52,7 @@ export declare const register: {
52
52
  message: string;
53
53
  detailsMaker: (tips?: string) => string | undefined;
54
54
  };
55
- }, Code>>) => {
56
- code: Code;
57
- details: ReturnType<Errors.Register.DetailsMaker<{
58
- "no-window-document-on-runtime": {
59
- message: string;
60
- detailsMaker: () => undefined;
61
- };
62
- "no-window-document-on-runtime-please-provide": {
63
- message: string;
64
- detailsMaker: (tips?: string) => string | undefined;
65
- };
66
- }, Code>>;
67
- name: string;
68
- message: string;
69
- stack?: string;
70
- };
71
- getFailureOutcome: <Code extends Codes>(code: Code, ...params: Parameters<Errors.Register.DetailsMaker<{
55
+ }, Code>>) => Errors.Register.ErrorData<{
72
56
  "no-window-document-on-runtime": {
73
57
  message: string;
74
58
  detailsMaker: () => undefined;
@@ -77,7 +61,8 @@ export declare const register: {
77
61
  message: string;
78
62
  detailsMaker: (tips?: string) => string | undefined;
79
63
  };
80
- }, Code>>) => Errors.Register.FailureOutcome<{
64
+ }, Code>;
65
+ getError: <Code extends Codes>(code: Code, ...params: Parameters<Errors.Register.DetailsMaker<{
81
66
  "no-window-document-on-runtime": {
82
67
  message: string;
83
68
  detailsMaker: () => undefined;
@@ -86,9 +71,9 @@ export declare const register: {
86
71
  message: string;
87
72
  detailsMaker: (tips?: string) => string | undefined;
88
73
  };
89
- }, Code>;
90
- CustomError: {
91
- new <Code extends Codes>(code: Code, ...params: Parameters<Errors.Register.DetailsMaker<{
74
+ }, Code>>) => {
75
+ code: Code;
76
+ details: ReturnType<Errors.Register.DetailsMaker<{
92
77
  "no-window-document-on-runtime": {
93
78
  message: string;
94
79
  detailsMaker: () => undefined;
@@ -97,25 +82,10 @@ export declare const register: {
97
82
  message: string;
98
83
  detailsMaker: (tips?: string) => string | undefined;
99
84
  };
100
- }, Code>>): {
101
- code: Code;
102
- details: ReturnType<Errors.Register.DetailsMaker<{
103
- "no-window-document-on-runtime": {
104
- message: string;
105
- detailsMaker: () => undefined;
106
- };
107
- "no-window-document-on-runtime-please-provide": {
108
- message: string;
109
- detailsMaker: (tips?: string) => string | undefined;
110
- };
111
- }, Code>>;
112
- name: string;
113
- message: string;
114
- stack?: string;
115
- };
116
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
117
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
118
- stackTraceLimit: number;
85
+ }, Code>>;
86
+ name: string;
87
+ message: string;
88
+ stack?: string;
119
89
  };
120
90
  source: {
121
91
  "no-window-document-on-runtime": {
@@ -1,29 +0,0 @@
1
- // src/agnostic/misc/outcome/index.ts
2
- var Outcome;
3
- ((Outcome2) => {
4
- function makeSuccess(payload) {
5
- return {
6
- success: true,
7
- payload
8
- };
9
- }
10
- Outcome2.makeSuccess = makeSuccess;
11
- function makeFailure(code, message, details) {
12
- return {
13
- success: false,
14
- code,
15
- message,
16
- details
17
- };
18
- }
19
- Outcome2.makeFailure = makeFailure;
20
- function make(success, payloadOrCode, message, details) {
21
- if (success) return makeSuccess(payloadOrCode);
22
- return makeFailure(payloadOrCode, message, details);
23
- }
24
- Outcome2.make = make;
25
- })(Outcome || (Outcome = {}));
26
-
27
- export {
28
- Outcome
29
- };