@design-edito/tools 0.1.11 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,9 @@
1
- import {
2
- Transitions
3
- } from "../../chunks/chunk-4GDNHUCZ.js";
4
1
  import {
5
2
  timeoutCall
6
3
  } from "../../chunks/chunk-4VC5PT5T.js";
4
+ import {
5
+ Transitions
6
+ } from "../../chunks/chunk-4GDNHUCZ.js";
7
7
  import {
8
8
  wait
9
9
  } from "../../chunks/chunk-DQNJQBC6.js";
@@ -2,24 +2,25 @@ import {
2
2
  Random
3
3
  } from "../../chunks/chunk-WLL3FNVL.js";
4
4
  import {
5
- Bem
6
- } from "../../chunks/chunk-KIONYWA7.js";
5
+ register
6
+ } from "../../chunks/chunk-DRXZ4YUW.js";
7
7
  import {
8
- classNameRegex,
9
- isValidClassName
10
- } from "../../chunks/chunk-W5A2TON3.js";
8
+ Crossenv
9
+ } from "../../chunks/chunk-GJOU3UAL.js";
10
+ import "../../chunks/chunk-4CMAH7Q4.js";
11
+ import "../../chunks/chunk-HEXR23CH.js";
12
+ import "../../chunks/chunk-HDPSQ7WY.js";
11
13
  import {
12
14
  generateNiceColor,
13
15
  niceColors
14
16
  } from "../../chunks/chunk-EDVNAV3G.js";
15
17
  import {
16
- register
17
- } from "../../chunks/chunk-UAND5PYN.js";
18
- import "../../chunks/chunk-SI3URYBN.js";
19
- import "../../chunks/chunk-JJFS2I7N.js";
18
+ Bem
19
+ } from "../../chunks/chunk-KIONYWA7.js";
20
20
  import {
21
- Crossenv
22
- } from "../../chunks/chunk-GJOU3UAL.js";
21
+ classNameRegex,
22
+ isValidClassName
23
+ } from "../../chunks/chunk-W5A2TON3.js";
23
24
  import "../../chunks/chunk-QXAJXTXV.js";
24
25
  import "../../chunks/chunk-HC6ZOHCS.js";
25
26
 
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  Errors
3
- } from "../../chunks/chunk-SI3URYBN.js";
4
- import "../../chunks/chunk-JJFS2I7N.js";
3
+ } from "../../chunks/chunk-4CMAH7Q4.js";
4
+ import "../../chunks/chunk-HEXR23CH.js";
5
+ import "../../chunks/chunk-HDPSQ7WY.js";
5
6
  export {
6
7
  Errors
7
8
  };
@@ -1,3 +1,4 @@
1
+ import { Outcome } from "~/agnostic/misc/outcome";
1
2
  export declare namespace Register {
2
3
  type RegisterEntry = {
3
4
  message: string;
@@ -16,6 +17,7 @@ export declare namespace Register {
16
17
  message: string;
17
18
  stack?: string;
18
19
  };
20
+ getFailureOutcome: <Code extends keyof Source>(code: Code, ...params: (Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined) extends (...params: infer P) => any ? P : []) => Outcome.Failure<Code, Source[Code]["message"], (Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined) extends (...params: any[]) => infer R ? R : never>;
19
21
  CustomError: {
20
22
  new <Code extends keyof Source>(code: Code, ...params: (Source[Code]["detailsMaker"] extends (...params: any[]) => any ? Source[Code]["detailsMaker"] : undefined) extends (...params: infer P) => any ? P : []): {
21
23
  code: Code;
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Register
3
- } from "../../../chunks/chunk-JJFS2I7N.js";
3
+ } from "../../../chunks/chunk-HEXR23CH.js";
4
+ import "../../../chunks/chunk-HDPSQ7WY.js";
4
5
  export {
5
6
  Register
6
7
  };
@@ -1,19 +1,15 @@
1
1
  import {
2
- selectorToElement
3
- } from "../../chunks/chunk-XVAGFNRL.js";
4
- import {
5
- stringToNodes
6
- } from "../../chunks/chunk-BIVZM5DE.js";
7
- import {
8
- Sanitize
9
- } from "../../chunks/chunk-T4WHRHA3.js";
2
+ insertNode
3
+ } from "../../chunks/chunk-XA4HVHJ4.js";
10
4
  import {
11
5
  Placeholders
12
6
  } from "../../chunks/chunk-VYW4IADX.js";
13
- import "../../chunks/chunk-UAND5PYN.js";
14
- import "../../chunks/chunk-SI3URYBN.js";
15
- import "../../chunks/chunk-JJFS2I7N.js";
16
- import "../../chunks/chunk-GJOU3UAL.js";
7
+ import {
8
+ selectorToElement
9
+ } from "../../chunks/chunk-R6W6KA2P.js";
10
+ import {
11
+ stringToNodes
12
+ } from "../../chunks/chunk-NGL6BHCM.js";
17
13
  import {
18
14
  getNodeAncestors
19
15
  } from "../../chunks/chunk-SQZGZ3VT.js";
@@ -21,8 +17,13 @@ import {
21
17
  getPositionInsideParent
22
18
  } from "../../chunks/chunk-VTPRO4NJ.js";
23
19
  import {
24
- insertNode
25
- } from "../../chunks/chunk-XA4HVHJ4.js";
20
+ Sanitize
21
+ } from "../../chunks/chunk-4S4UJG5A.js";
22
+ import "../../chunks/chunk-DRXZ4YUW.js";
23
+ import "../../chunks/chunk-GJOU3UAL.js";
24
+ import "../../chunks/chunk-4CMAH7Q4.js";
25
+ import "../../chunks/chunk-HEXR23CH.js";
26
+ import "../../chunks/chunk-HDPSQ7WY.js";
26
27
 
27
28
  // src/agnostic/html/index.ts
28
29
  var Html;
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  Sanitize
3
- } from "../../../chunks/chunk-T4WHRHA3.js";
4
- import "../../../chunks/chunk-UAND5PYN.js";
5
- import "../../../chunks/chunk-SI3URYBN.js";
6
- import "../../../chunks/chunk-JJFS2I7N.js";
3
+ } from "../../../chunks/chunk-4S4UJG5A.js";
4
+ import "../../../chunks/chunk-DRXZ4YUW.js";
7
5
  import "../../../chunks/chunk-GJOU3UAL.js";
6
+ import "../../../chunks/chunk-4CMAH7Q4.js";
7
+ import "../../../chunks/chunk-HEXR23CH.js";
8
+ import "../../../chunks/chunk-HDPSQ7WY.js";
8
9
  export {
9
10
  Sanitize
10
11
  };
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  selectorToElement
3
- } from "../../../chunks/chunk-XVAGFNRL.js";
4
- import "../../../chunks/chunk-UAND5PYN.js";
5
- import "../../../chunks/chunk-SI3URYBN.js";
6
- import "../../../chunks/chunk-JJFS2I7N.js";
3
+ } from "../../../chunks/chunk-R6W6KA2P.js";
4
+ import "../../../chunks/chunk-DRXZ4YUW.js";
7
5
  import "../../../chunks/chunk-GJOU3UAL.js";
6
+ import "../../../chunks/chunk-4CMAH7Q4.js";
7
+ import "../../../chunks/chunk-HEXR23CH.js";
8
+ import "../../../chunks/chunk-HDPSQ7WY.js";
8
9
  export {
9
10
  selectorToElement
10
11
  };
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  stringToNodes
3
- } from "../../../chunks/chunk-BIVZM5DE.js";
4
- import "../../../chunks/chunk-T4WHRHA3.js";
5
- import "../../../chunks/chunk-UAND5PYN.js";
6
- import "../../../chunks/chunk-SI3URYBN.js";
7
- import "../../../chunks/chunk-JJFS2I7N.js";
3
+ } from "../../../chunks/chunk-NGL6BHCM.js";
4
+ import "../../../chunks/chunk-4S4UJG5A.js";
5
+ import "../../../chunks/chunk-DRXZ4YUW.js";
8
6
  import "../../../chunks/chunk-GJOU3UAL.js";
7
+ import "../../../chunks/chunk-4CMAH7Q4.js";
8
+ import "../../../chunks/chunk-HEXR23CH.js";
9
+ import "../../../chunks/chunk-HDPSQ7WY.js";
9
10
  export {
10
11
  stringToNodes
11
12
  };
@@ -1,3 +1,9 @@
1
+ import {
2
+ getCurrentDownlink
3
+ } from "../../chunks/chunk-7AWTHZLY.js";
4
+ import {
5
+ Logs
6
+ } from "../../chunks/chunk-HEJV6JIO.js";
1
7
  import {
2
8
  Assert
3
9
  } from "../../chunks/chunk-W7YBGJ4H.js";
@@ -5,20 +11,14 @@ import {
5
11
  Cast
6
12
  } from "../../chunks/chunk-4QQBKBYH.js";
7
13
  import {
8
- Logs
9
- } from "../../chunks/chunk-HEJV6JIO.js";
10
- import {
11
- getCurrentDownlink
12
- } from "../../chunks/chunk-7AWTHZLY.js";
14
+ isConstructorFunction
15
+ } from "../../chunks/chunk-RCO57B6F.js";
13
16
  import {
14
17
  Random
15
18
  } from "../../chunks/chunk-WLL3FNVL.js";
16
19
  import {
17
20
  Crossenv
18
21
  } from "../../chunks/chunk-GJOU3UAL.js";
19
- import {
20
- isConstructorFunction
21
- } from "../../chunks/chunk-RCO57B6F.js";
22
22
  import "../../chunks/chunk-QXAJXTXV.js";
23
23
  import {
24
24
  isNotNullish,
@@ -3,15 +3,15 @@ export declare namespace Outcome {
3
3
  success: true;
4
4
  payload: Payload;
5
5
  };
6
- type Failure<Code extends string = string, Msg extends string = string, Details extends any = any> = {
6
+ type Failure<Code extends any = any, Msg extends string = string, Details extends any = any> = {
7
7
  success: false;
8
8
  code: Code;
9
9
  message: Msg;
10
10
  details?: Details;
11
11
  };
12
- type Either<Payload extends any = any, Code extends string = string, Msg extends string = string, Details extends any = any> = Success<Payload> | Failure<Code, Msg, Details>;
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>;
13
13
  function makeSuccess<Payload extends any>(payload: Payload): Success<Payload>;
14
- function makeFailure<Code extends string = string, Msg extends string = string, Details extends any | undefined = undefined>(code: Code, message: Msg, details?: Details): Failure<Code, Msg, Details>;
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>;
15
15
  function make<Payload extends any>(success: true, payload: Payload): Success<Payload>;
16
- function make<Code extends string = string, Msg extends string = string, Details extends any | undefined = undefined>(success: false, code: Code, message: Msg, details?: Details): Failure<Code, Msg, Details>;
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>;
17
17
  }
@@ -1,28 +1,6 @@
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 = {}));
1
+ import {
2
+ Outcome
3
+ } from "../../../chunks/chunk-HDPSQ7WY.js";
26
4
  export {
27
5
  Outcome
28
6
  };
@@ -1,16 +1,16 @@
1
- import {
2
- absoluteModulo
3
- } from "../../chunks/chunk-DNIOWD7K.js";
4
1
  import {
5
2
  interpolate
6
3
  } from "../../chunks/chunk-EW46EXFB.js";
7
- import {
8
- clamp
9
- } from "../../chunks/chunk-OSAXBA7G.js";
10
4
  import {
11
5
  createScale,
12
6
  getHarmonic
13
7
  } from "../../chunks/chunk-UYTXXUU7.js";
8
+ import {
9
+ absoluteModulo
10
+ } from "../../chunks/chunk-DNIOWD7K.js";
11
+ import {
12
+ clamp
13
+ } from "../../chunks/chunk-OSAXBA7G.js";
14
14
  import {
15
15
  round
16
16
  } from "../../chunks/chunk-32IRF4OP.js";
@@ -5,12 +5,12 @@ import {
5
5
  isNonNullObject,
6
6
  isObject
7
7
  } from "../../chunks/chunk-HQLRJ7XW.js";
8
- import {
9
- isRecord
10
- } from "../../chunks/chunk-YDIBNEGA.js";
11
8
  import {
12
9
  Validation
13
10
  } from "../../chunks/chunk-FPEW3A27.js";
11
+ import {
12
+ isRecord
13
+ } from "../../chunks/chunk-YDIBNEGA.js";
14
14
  import {
15
15
  Enums
16
16
  } from "../../chunks/chunk-WOAYU6LB.js";
@@ -1,17 +1,17 @@
1
+ import {
2
+ CharCodes
3
+ } from "../../chunks/chunk-34U4HX4V.js";
1
4
  import {
2
5
  matches,
3
6
  matchesEvery,
4
7
  matchesSome
5
8
  } from "../../chunks/chunk-LQFKUNVQ.js";
6
9
  import {
7
- CharCodes
8
- } from "../../chunks/chunk-34U4HX4V.js";
10
+ replaceAll
11
+ } from "../../chunks/chunk-MF56TTC5.js";
9
12
  import {
10
13
  normalizeIndent
11
14
  } from "../../chunks/chunk-JQXNEJAP.js";
12
- import {
13
- replaceAll
14
- } from "../../chunks/chunk-MF56TTC5.js";
15
15
  import {
16
16
  toAlphanum
17
17
  } from "../../chunks/chunk-COVPTTAD.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Register
3
- } from "./chunk-JJFS2I7N.js";
3
+ } from "./chunk-HEXR23CH.js";
4
4
 
5
5
  // src/agnostic/errors/index.ts
6
6
  var Errors;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  register
3
- } from "./chunk-UAND5PYN.js";
3
+ } from "./chunk-DRXZ4YUW.js";
4
4
  import {
5
5
  Crossenv
6
6
  } from "./chunk-GJOU3UAL.js";
@@ -1,9 +1,9 @@
1
- import {
2
- Errors
3
- } from "./chunk-SI3URYBN.js";
4
1
  import {
5
2
  Crossenv
6
3
  } from "./chunk-GJOU3UAL.js";
4
+ import {
5
+ Errors
6
+ } from "./chunk-4CMAH7Q4.js";
7
7
 
8
8
  // src/shared/errors/index.ts
9
9
  var register = Errors.Register.from({
@@ -0,0 +1,29 @@
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
+ };
@@ -1,3 +1,7 @@
1
+ import {
2
+ Outcome
3
+ } from "./chunk-HDPSQ7WY.js";
4
+
1
5
  // src/agnostic/errors/register/index.ts
2
6
  var Register;
3
7
  ((Register2) => {
@@ -15,6 +19,11 @@ var Register;
15
19
  const details = maker?.(...params);
16
20
  return details;
17
21
  }
22
+ function getFailureOutcome(code, ...params) {
23
+ const message = getMessage(code);
24
+ const details = getDetails(code, ...params);
25
+ return Outcome.makeFailure(code, message, details);
26
+ }
18
27
  class CustomError extends Error {
19
28
  code;
20
29
  details;
@@ -33,6 +42,7 @@ var Register;
33
42
  getDetailsMaker,
34
43
  getDetails,
35
44
  getError,
45
+ getFailureOutcome,
36
46
  CustomError,
37
47
  source
38
48
  };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Sanitize
3
- } from "./chunk-T4WHRHA3.js";
3
+ } from "./chunk-4S4UJG5A.js";
4
4
  import {
5
5
  register
6
- } from "./chunk-UAND5PYN.js";
6
+ } from "./chunk-DRXZ4YUW.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-UAND5PYN.js";
3
+ } from "./chunk-DRXZ4YUW.js";
4
4
  import {
5
5
  Crossenv
6
6
  } from "./chunk-GJOU3UAL.js";
@@ -1,9 +1,9 @@
1
- import {
2
- isInDirectory
3
- } from "../../chunks/chunk-NRITRUZW.js";
4
1
  import {
5
2
  readWrite
6
3
  } from "../../chunks/chunk-7DBNMU6N.js";
4
+ import {
5
+ isInDirectory
6
+ } from "../../chunks/chunk-NRITRUZW.js";
7
7
  import {
8
8
  Subpaths
9
9
  } from "../../chunks/chunk-HGCG2J77.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/tools",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -101,6 +101,47 @@ export declare const register: {
101
101
  message: string;
102
102
  stack?: string;
103
103
  };
104
+ getFailureOutcome: <Code extends Codes>(code: Code, ...params: ({
105
+ "no-window-document-on-runtime": {
106
+ message: string;
107
+ };
108
+ "no-window-document-on-runtime-please-provide": {
109
+ message: string;
110
+ detailsMaker: (tips?: string) => string | undefined;
111
+ };
112
+ }[Code]["detailsMaker"] extends (...params: any[]) => any ? {
113
+ "no-window-document-on-runtime": {
114
+ message: string;
115
+ };
116
+ "no-window-document-on-runtime-please-provide": {
117
+ message: string;
118
+ detailsMaker: (tips?: string) => string | undefined;
119
+ };
120
+ }[Code]["detailsMaker"] : undefined) extends (...params: infer P) => any ? P : []) => import("../../agnostic/misc/outcome").Outcome.Failure<Code, {
121
+ "no-window-document-on-runtime": {
122
+ message: string;
123
+ };
124
+ "no-window-document-on-runtime-please-provide": {
125
+ message: string;
126
+ detailsMaker: (tips?: string) => string | undefined;
127
+ };
128
+ }[Code]["message"], ({
129
+ "no-window-document-on-runtime": {
130
+ message: string;
131
+ };
132
+ "no-window-document-on-runtime-please-provide": {
133
+ message: string;
134
+ detailsMaker: (tips?: string) => string | undefined;
135
+ };
136
+ }[Code]["detailsMaker"] extends (...params: any[]) => any ? {
137
+ "no-window-document-on-runtime": {
138
+ message: string;
139
+ };
140
+ "no-window-document-on-runtime-please-provide": {
141
+ message: string;
142
+ detailsMaker: (tips?: string) => string | undefined;
143
+ };
144
+ }[Code]["detailsMaker"] : undefined) extends (...params: any[]) => infer R ? R : never>;
104
145
  CustomError: {
105
146
  new <Code extends Codes>(code: Code, ...params: ({
106
147
  "no-window-document-on-runtime": {