@drawbridge/drawbridge-utils 0.0.57 → 0.0.59
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/ai.cjs +3 -1
- package/dist/ai.d.cts +9 -1
- package/dist/ai.d.ts +9 -1
- package/dist/ai.js +3 -1
- package/dist/color.cjs +69 -0
- package/dist/color.d.cts +45 -0
- package/dist/color.d.ts +45 -0
- package/dist/color.js +34 -0
- package/dist/index.cjs +65 -4
- package/dist/index.d.cts +33 -4
- package/dist/index.d.ts +33 -4
- package/dist/index.js +55 -4
- package/dist/plans.cjs +73 -0
- package/dist/plans.d.cts +2 -0
- package/dist/plans.d.ts +2 -0
- package/dist/plans.js +63 -0
- package/package.json +12 -3
package/dist/ai.cjs
CHANGED
|
@@ -302,18 +302,20 @@ var google = {
|
|
|
302
302
|
},
|
|
303
303
|
text: async ({
|
|
304
304
|
config = {},
|
|
305
|
+
images = [],
|
|
305
306
|
prompt = []
|
|
306
307
|
}, {
|
|
307
308
|
db,
|
|
308
309
|
user
|
|
309
310
|
}) => {
|
|
310
311
|
const model = models.text;
|
|
312
|
+
const contents = images.length ? { parts: [...images.map((image) => ({ inlineData: { data: image.data, mimeType: image.mimeType } })), { text: prompt.join("\n") }] } : prompt.join("\n");
|
|
311
313
|
const response = await googleCircuit(() => google_client.models.generateContent({
|
|
312
314
|
config: {
|
|
313
315
|
...config,
|
|
314
316
|
responseModalities: ["Text"]
|
|
315
317
|
},
|
|
316
|
-
contents
|
|
318
|
+
contents,
|
|
317
319
|
model
|
|
318
320
|
}));
|
|
319
321
|
const content = response == null ? void 0 : response.text;
|
package/dist/ai.d.cts
CHANGED
|
@@ -265,6 +265,7 @@ const google = {
|
|
|
265
265
|
text : async (
|
|
266
266
|
{
|
|
267
267
|
config = {},
|
|
268
|
+
images = [],
|
|
268
269
|
prompt = []
|
|
269
270
|
},
|
|
270
271
|
{
|
|
@@ -275,12 +276,19 @@ const google = {
|
|
|
275
276
|
|
|
276
277
|
const model = models.text;
|
|
277
278
|
|
|
279
|
+
// When images are supplied (e.g. a page screenshot), send a multimodal
|
|
280
|
+
// parts payload so the model can SEE them alongside the text prompt;
|
|
281
|
+
// otherwise keep the plain-string contents for text-only calls.
|
|
282
|
+
const contents = images.length
|
|
283
|
+
? { parts : [ ...images.map( ( image ) => ({ inlineData : { data : image.data, mimeType : image.mimeType } }) ), { text : prompt.join( '\n' ) } ] }
|
|
284
|
+
: prompt.join( '\n' );
|
|
285
|
+
|
|
278
286
|
const response = await googleCircuit( () => google_client.models.generateContent({
|
|
279
287
|
config : {
|
|
280
288
|
...config,
|
|
281
289
|
responseModalities : [ 'Text' ]
|
|
282
290
|
},
|
|
283
|
-
contents
|
|
291
|
+
contents,
|
|
284
292
|
model
|
|
285
293
|
}) );
|
|
286
294
|
|
package/dist/ai.d.ts
CHANGED
|
@@ -265,6 +265,7 @@ const google = {
|
|
|
265
265
|
text : async (
|
|
266
266
|
{
|
|
267
267
|
config = {},
|
|
268
|
+
images = [],
|
|
268
269
|
prompt = []
|
|
269
270
|
},
|
|
270
271
|
{
|
|
@@ -275,12 +276,19 @@ const google = {
|
|
|
275
276
|
|
|
276
277
|
const model = models.text;
|
|
277
278
|
|
|
279
|
+
// When images are supplied (e.g. a page screenshot), send a multimodal
|
|
280
|
+
// parts payload so the model can SEE them alongside the text prompt;
|
|
281
|
+
// otherwise keep the plain-string contents for text-only calls.
|
|
282
|
+
const contents = images.length
|
|
283
|
+
? { parts : [ ...images.map( ( image ) => ({ inlineData : { data : image.data, mimeType : image.mimeType } }) ), { text : prompt.join( '\n' ) } ] }
|
|
284
|
+
: prompt.join( '\n' );
|
|
285
|
+
|
|
278
286
|
const response = await googleCircuit( () => google_client.models.generateContent({
|
|
279
287
|
config : {
|
|
280
288
|
...config,
|
|
281
289
|
responseModalities : [ 'Text' ]
|
|
282
290
|
},
|
|
283
|
-
contents
|
|
291
|
+
contents,
|
|
284
292
|
model
|
|
285
293
|
}) );
|
|
286
294
|
|
package/dist/ai.js
CHANGED
|
@@ -272,18 +272,20 @@ var google = {
|
|
|
272
272
|
},
|
|
273
273
|
text: async ({
|
|
274
274
|
config = {},
|
|
275
|
+
images = [],
|
|
275
276
|
prompt = []
|
|
276
277
|
}, {
|
|
277
278
|
db,
|
|
278
279
|
user
|
|
279
280
|
}) => {
|
|
280
281
|
const model = models.text;
|
|
282
|
+
const contents = images.length ? { parts: [...images.map((image) => ({ inlineData: { data: image.data, mimeType: image.mimeType } })), { text: prompt.join("\n") }] } : prompt.join("\n");
|
|
281
283
|
const response = await googleCircuit(() => google_client.models.generateContent({
|
|
282
284
|
config: {
|
|
283
285
|
...config,
|
|
284
286
|
responseModalities: ["Text"]
|
|
285
287
|
},
|
|
286
|
-
contents
|
|
288
|
+
contents,
|
|
287
289
|
model
|
|
288
290
|
}));
|
|
289
291
|
const content = response == null ? void 0 : response.text;
|
package/dist/color.cjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// lib/color.js
|
|
30
|
+
var color_exports = {};
|
|
31
|
+
__export(color_exports, {
|
|
32
|
+
colorAccessible: () => colorAccessible,
|
|
33
|
+
colorFormatted: () => colorFormatted
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(color_exports);
|
|
36
|
+
var import_tinycolor2 = __toESM(require("tinycolor2"), 1);
|
|
37
|
+
var colorFormatted = (value) => {
|
|
38
|
+
const color = (0, import_tinycolor2.default)(value);
|
|
39
|
+
const attributes = {
|
|
40
|
+
brightness: color.getBrightness(),
|
|
41
|
+
dark: color.isDark(),
|
|
42
|
+
light: color.isLight(),
|
|
43
|
+
luminance: color.getLuminance()
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
attributes,
|
|
47
|
+
hex: color.toHexString(),
|
|
48
|
+
hsl: color.toHsl(),
|
|
49
|
+
hsv: color.toHsv(),
|
|
50
|
+
rgb: color.toRgbString()
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
var colorAccessible = (background) => {
|
|
54
|
+
const white = "#ffffff";
|
|
55
|
+
const black = "#000000";
|
|
56
|
+
return import_tinycolor2.default.isReadable(
|
|
57
|
+
background,
|
|
58
|
+
white,
|
|
59
|
+
{
|
|
60
|
+
level: "AA",
|
|
61
|
+
size: "normal"
|
|
62
|
+
}
|
|
63
|
+
) ? white : black;
|
|
64
|
+
};
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
colorAccessible,
|
|
68
|
+
colorFormatted
|
|
69
|
+
});
|
package/dist/color.d.cts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import tinycolor from 'tinycolor2';
|
|
2
|
+
|
|
3
|
+
// Color helpers shared across the Drawbridge stack (api seeding, sync
|
|
4
|
+
// generation pipeline, campaign defaults). `colorFormatted` emits the full
|
|
5
|
+
// shape the DB `style` blocks store and `extend.js` reads
|
|
6
|
+
// ( style.*.color.attributes.luminance ); `colorAccessible` picks black/white
|
|
7
|
+
// for AA-readable text over a background.
|
|
8
|
+
const colorFormatted = ( value ) => {
|
|
9
|
+
|
|
10
|
+
const color = tinycolor( value );
|
|
11
|
+
|
|
12
|
+
const attributes = {
|
|
13
|
+
brightness : color.getBrightness(),
|
|
14
|
+
dark : color.isDark(),
|
|
15
|
+
light : color.isLight(),
|
|
16
|
+
luminance : color.getLuminance()
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
attributes,
|
|
21
|
+
hex : color.toHexString(),
|
|
22
|
+
hsl : color.toHsl(),
|
|
23
|
+
hsv : color.toHsv(),
|
|
24
|
+
rgb : color.toRgbString()
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const colorAccessible = ( background ) => {
|
|
30
|
+
|
|
31
|
+
const white = '#ffffff';
|
|
32
|
+
const black = '#000000';
|
|
33
|
+
|
|
34
|
+
return tinycolor.isReadable(
|
|
35
|
+
background,
|
|
36
|
+
white,
|
|
37
|
+
{
|
|
38
|
+
level : 'AA',
|
|
39
|
+
size : 'normal'
|
|
40
|
+
}
|
|
41
|
+
) ? white : black;
|
|
42
|
+
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { colorAccessible, colorFormatted };
|
package/dist/color.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import tinycolor from 'tinycolor2';
|
|
2
|
+
|
|
3
|
+
// Color helpers shared across the Drawbridge stack (api seeding, sync
|
|
4
|
+
// generation pipeline, campaign defaults). `colorFormatted` emits the full
|
|
5
|
+
// shape the DB `style` blocks store and `extend.js` reads
|
|
6
|
+
// ( style.*.color.attributes.luminance ); `colorAccessible` picks black/white
|
|
7
|
+
// for AA-readable text over a background.
|
|
8
|
+
const colorFormatted = ( value ) => {
|
|
9
|
+
|
|
10
|
+
const color = tinycolor( value );
|
|
11
|
+
|
|
12
|
+
const attributes = {
|
|
13
|
+
brightness : color.getBrightness(),
|
|
14
|
+
dark : color.isDark(),
|
|
15
|
+
light : color.isLight(),
|
|
16
|
+
luminance : color.getLuminance()
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
attributes,
|
|
21
|
+
hex : color.toHexString(),
|
|
22
|
+
hsl : color.toHsl(),
|
|
23
|
+
hsv : color.toHsv(),
|
|
24
|
+
rgb : color.toRgbString()
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const colorAccessible = ( background ) => {
|
|
30
|
+
|
|
31
|
+
const white = '#ffffff';
|
|
32
|
+
const black = '#000000';
|
|
33
|
+
|
|
34
|
+
return tinycolor.isReadable(
|
|
35
|
+
background,
|
|
36
|
+
white,
|
|
37
|
+
{
|
|
38
|
+
level : 'AA',
|
|
39
|
+
size : 'normal'
|
|
40
|
+
}
|
|
41
|
+
) ? white : black;
|
|
42
|
+
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export { colorAccessible, colorFormatted };
|
package/dist/color.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// lib/color.js
|
|
2
|
+
import tinycolor from "tinycolor2";
|
|
3
|
+
var colorFormatted = (value) => {
|
|
4
|
+
const color = tinycolor(value);
|
|
5
|
+
const attributes = {
|
|
6
|
+
brightness: color.getBrightness(),
|
|
7
|
+
dark: color.isDark(),
|
|
8
|
+
light: color.isLight(),
|
|
9
|
+
luminance: color.getLuminance()
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
attributes,
|
|
13
|
+
hex: color.toHexString(),
|
|
14
|
+
hsl: color.toHsl(),
|
|
15
|
+
hsv: color.toHsv(),
|
|
16
|
+
rgb: color.toRgbString()
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
var colorAccessible = (background) => {
|
|
20
|
+
const white = "#ffffff";
|
|
21
|
+
const black = "#000000";
|
|
22
|
+
return tinycolor.isReadable(
|
|
23
|
+
background,
|
|
24
|
+
white,
|
|
25
|
+
{
|
|
26
|
+
level: "AA",
|
|
27
|
+
size: "normal"
|
|
28
|
+
}
|
|
29
|
+
) ? white : black;
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
colorAccessible,
|
|
33
|
+
colorFormatted
|
|
34
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all) => {
|
|
6
8
|
for (var name in all)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// index.js
|
|
@@ -46,18 +56,69 @@ module.exports = __toCommonJS(index_exports);
|
|
|
46
56
|
var import_currency_codes = require("currency-codes");
|
|
47
57
|
var import_nanoid = require("nanoid");
|
|
48
58
|
|
|
59
|
+
// lib/color.js
|
|
60
|
+
var import_tinycolor2 = __toESM(require("tinycolor2"), 1);
|
|
61
|
+
var colorFormatted = (value) => {
|
|
62
|
+
const color = (0, import_tinycolor2.default)(value);
|
|
63
|
+
const attributes = {
|
|
64
|
+
brightness: color.getBrightness(),
|
|
65
|
+
dark: color.isDark(),
|
|
66
|
+
light: color.isLight(),
|
|
67
|
+
luminance: color.getLuminance()
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
attributes,
|
|
71
|
+
hex: color.toHexString(),
|
|
72
|
+
hsl: color.toHsl(),
|
|
73
|
+
hsv: color.toHsv(),
|
|
74
|
+
rgb: color.toRgbString()
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
var colorAccessible = (background2) => {
|
|
78
|
+
const white = "#ffffff";
|
|
79
|
+
const black = "#000000";
|
|
80
|
+
return import_tinycolor2.default.isReadable(
|
|
81
|
+
background2,
|
|
82
|
+
white,
|
|
83
|
+
{
|
|
84
|
+
level: "AA",
|
|
85
|
+
size: "normal"
|
|
86
|
+
}
|
|
87
|
+
) ? white : black;
|
|
88
|
+
};
|
|
89
|
+
|
|
49
90
|
// lib/constants.js
|
|
50
91
|
var font = {
|
|
51
92
|
family: "Roboto Flex",
|
|
52
93
|
transform: "none",
|
|
53
94
|
weight: "regular"
|
|
54
95
|
};
|
|
96
|
+
var background = "#ffffff";
|
|
97
|
+
var style = {
|
|
98
|
+
background: {
|
|
99
|
+
color: colorFormatted(background)
|
|
100
|
+
},
|
|
101
|
+
body: font,
|
|
102
|
+
button: {
|
|
103
|
+
background: {
|
|
104
|
+
color: colorFormatted(background)
|
|
105
|
+
},
|
|
106
|
+
radius: 0,
|
|
107
|
+
text: {
|
|
108
|
+
color: colorFormatted(colorAccessible(background))
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
heading: font,
|
|
112
|
+
input: {
|
|
113
|
+
radius: 0
|
|
114
|
+
},
|
|
115
|
+
text: {
|
|
116
|
+
color: colorFormatted(colorAccessible(background))
|
|
117
|
+
}
|
|
118
|
+
};
|
|
55
119
|
var constants_default = {
|
|
56
120
|
brand: {
|
|
57
|
-
style
|
|
58
|
-
body: font,
|
|
59
|
-
heading: font
|
|
60
|
-
},
|
|
121
|
+
style,
|
|
61
122
|
totals: {
|
|
62
123
|
campaigns: 0
|
|
63
124
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { data, code } from 'currency-codes';
|
|
2
2
|
import { customAlphabet } from 'nanoid';
|
|
3
|
+
import { colorFormatted, colorAccessible } from './color.cjs';
|
|
4
|
+
import 'tinycolor2';
|
|
3
5
|
|
|
4
6
|
const font = {
|
|
5
7
|
family : 'Roboto Flex',
|
|
@@ -7,12 +9,39 @@ const font = {
|
|
|
7
9
|
weight : 'regular'
|
|
8
10
|
};
|
|
9
11
|
|
|
12
|
+
// Canonical default brand/page style. Complete on purpose: every color is built
|
|
13
|
+
// through colorFormatted so the stored shape always carries
|
|
14
|
+
// `color.attributes.luminance` ( extend.js reads it directly ). White
|
|
15
|
+
// background with accessible ( black ) text + default fonts. Used to seed
|
|
16
|
+
// pending AI records and any other place needing a valid default style.
|
|
17
|
+
const background = '#ffffff';
|
|
18
|
+
|
|
19
|
+
const style = {
|
|
20
|
+
background : {
|
|
21
|
+
color : colorFormatted( background )
|
|
22
|
+
},
|
|
23
|
+
body : font,
|
|
24
|
+
button : {
|
|
25
|
+
background : {
|
|
26
|
+
color : colorFormatted( background )
|
|
27
|
+
},
|
|
28
|
+
radius : 0,
|
|
29
|
+
text : {
|
|
30
|
+
color : colorFormatted( colorAccessible( background ) )
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
heading : font,
|
|
34
|
+
input : {
|
|
35
|
+
radius : 0
|
|
36
|
+
},
|
|
37
|
+
text : {
|
|
38
|
+
color : colorFormatted( colorAccessible( background ) )
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
10
42
|
var constantsData = {
|
|
11
43
|
brand : {
|
|
12
|
-
style
|
|
13
|
-
body : font,
|
|
14
|
-
heading : font
|
|
15
|
-
},
|
|
44
|
+
style,
|
|
16
45
|
totals : {
|
|
17
46
|
campaigns : 0
|
|
18
47
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { data, code } from 'currency-codes';
|
|
2
2
|
import { customAlphabet } from 'nanoid';
|
|
3
|
+
import { colorFormatted, colorAccessible } from './color.js';
|
|
4
|
+
import 'tinycolor2';
|
|
3
5
|
|
|
4
6
|
const font = {
|
|
5
7
|
family : 'Roboto Flex',
|
|
@@ -7,12 +9,39 @@ const font = {
|
|
|
7
9
|
weight : 'regular'
|
|
8
10
|
};
|
|
9
11
|
|
|
12
|
+
// Canonical default brand/page style. Complete on purpose: every color is built
|
|
13
|
+
// through colorFormatted so the stored shape always carries
|
|
14
|
+
// `color.attributes.luminance` ( extend.js reads it directly ). White
|
|
15
|
+
// background with accessible ( black ) text + default fonts. Used to seed
|
|
16
|
+
// pending AI records and any other place needing a valid default style.
|
|
17
|
+
const background = '#ffffff';
|
|
18
|
+
|
|
19
|
+
const style = {
|
|
20
|
+
background : {
|
|
21
|
+
color : colorFormatted( background )
|
|
22
|
+
},
|
|
23
|
+
body : font,
|
|
24
|
+
button : {
|
|
25
|
+
background : {
|
|
26
|
+
color : colorFormatted( background )
|
|
27
|
+
},
|
|
28
|
+
radius : 0,
|
|
29
|
+
text : {
|
|
30
|
+
color : colorFormatted( colorAccessible( background ) )
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
heading : font,
|
|
34
|
+
input : {
|
|
35
|
+
radius : 0
|
|
36
|
+
},
|
|
37
|
+
text : {
|
|
38
|
+
color : colorFormatted( colorAccessible( background ) )
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
10
42
|
var constantsData = {
|
|
11
43
|
brand : {
|
|
12
|
-
style
|
|
13
|
-
body : font,
|
|
14
|
-
heading : font
|
|
15
|
-
},
|
|
44
|
+
style,
|
|
16
45
|
totals : {
|
|
17
46
|
campaigns : 0
|
|
18
47
|
}
|
package/dist/index.js
CHANGED
|
@@ -2,18 +2,69 @@
|
|
|
2
2
|
import { code, data } from "currency-codes";
|
|
3
3
|
import { customAlphabet } from "nanoid";
|
|
4
4
|
|
|
5
|
+
// lib/color.js
|
|
6
|
+
import tinycolor from "tinycolor2";
|
|
7
|
+
var colorFormatted = (value) => {
|
|
8
|
+
const color = tinycolor(value);
|
|
9
|
+
const attributes = {
|
|
10
|
+
brightness: color.getBrightness(),
|
|
11
|
+
dark: color.isDark(),
|
|
12
|
+
light: color.isLight(),
|
|
13
|
+
luminance: color.getLuminance()
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
attributes,
|
|
17
|
+
hex: color.toHexString(),
|
|
18
|
+
hsl: color.toHsl(),
|
|
19
|
+
hsv: color.toHsv(),
|
|
20
|
+
rgb: color.toRgbString()
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
var colorAccessible = (background2) => {
|
|
24
|
+
const white = "#ffffff";
|
|
25
|
+
const black = "#000000";
|
|
26
|
+
return tinycolor.isReadable(
|
|
27
|
+
background2,
|
|
28
|
+
white,
|
|
29
|
+
{
|
|
30
|
+
level: "AA",
|
|
31
|
+
size: "normal"
|
|
32
|
+
}
|
|
33
|
+
) ? white : black;
|
|
34
|
+
};
|
|
35
|
+
|
|
5
36
|
// lib/constants.js
|
|
6
37
|
var font = {
|
|
7
38
|
family: "Roboto Flex",
|
|
8
39
|
transform: "none",
|
|
9
40
|
weight: "regular"
|
|
10
41
|
};
|
|
42
|
+
var background = "#ffffff";
|
|
43
|
+
var style = {
|
|
44
|
+
background: {
|
|
45
|
+
color: colorFormatted(background)
|
|
46
|
+
},
|
|
47
|
+
body: font,
|
|
48
|
+
button: {
|
|
49
|
+
background: {
|
|
50
|
+
color: colorFormatted(background)
|
|
51
|
+
},
|
|
52
|
+
radius: 0,
|
|
53
|
+
text: {
|
|
54
|
+
color: colorFormatted(colorAccessible(background))
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
heading: font,
|
|
58
|
+
input: {
|
|
59
|
+
radius: 0
|
|
60
|
+
},
|
|
61
|
+
text: {
|
|
62
|
+
color: colorFormatted(colorAccessible(background))
|
|
63
|
+
}
|
|
64
|
+
};
|
|
11
65
|
var constants_default = {
|
|
12
66
|
brand: {
|
|
13
|
-
style
|
|
14
|
-
body: font,
|
|
15
|
-
heading: font
|
|
16
|
-
},
|
|
67
|
+
style,
|
|
17
68
|
totals: {
|
|
18
69
|
campaigns: 0
|
|
19
70
|
}
|
package/dist/plans.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
7
|
var __export = (target, all2) => {
|
|
6
8
|
for (var name in all2)
|
|
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
14
16
|
}
|
|
15
17
|
return to;
|
|
16
18
|
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
17
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
28
|
|
|
19
29
|
// lib/plans.js
|
|
@@ -160,6 +170,69 @@ var organization = {
|
|
|
160
170
|
// index.js
|
|
161
171
|
var import_currency_codes = require("currency-codes");
|
|
162
172
|
var import_nanoid = require("nanoid");
|
|
173
|
+
|
|
174
|
+
// lib/color.js
|
|
175
|
+
var import_tinycolor2 = __toESM(require("tinycolor2"), 1);
|
|
176
|
+
var colorFormatted = (value) => {
|
|
177
|
+
const color = (0, import_tinycolor2.default)(value);
|
|
178
|
+
const attributes = {
|
|
179
|
+
brightness: color.getBrightness(),
|
|
180
|
+
dark: color.isDark(),
|
|
181
|
+
light: color.isLight(),
|
|
182
|
+
luminance: color.getLuminance()
|
|
183
|
+
};
|
|
184
|
+
return {
|
|
185
|
+
attributes,
|
|
186
|
+
hex: color.toHexString(),
|
|
187
|
+
hsl: color.toHsl(),
|
|
188
|
+
hsv: color.toHsv(),
|
|
189
|
+
rgb: color.toRgbString()
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
var colorAccessible = (background2) => {
|
|
193
|
+
const white = "#ffffff";
|
|
194
|
+
const black = "#000000";
|
|
195
|
+
return import_tinycolor2.default.isReadable(
|
|
196
|
+
background2,
|
|
197
|
+
white,
|
|
198
|
+
{
|
|
199
|
+
level: "AA",
|
|
200
|
+
size: "normal"
|
|
201
|
+
}
|
|
202
|
+
) ? white : black;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// lib/constants.js
|
|
206
|
+
var font = {
|
|
207
|
+
family: "Roboto Flex",
|
|
208
|
+
transform: "none",
|
|
209
|
+
weight: "regular"
|
|
210
|
+
};
|
|
211
|
+
var background = "#ffffff";
|
|
212
|
+
var style = {
|
|
213
|
+
background: {
|
|
214
|
+
color: colorFormatted(background)
|
|
215
|
+
},
|
|
216
|
+
body: font,
|
|
217
|
+
button: {
|
|
218
|
+
background: {
|
|
219
|
+
color: colorFormatted(background)
|
|
220
|
+
},
|
|
221
|
+
radius: 0,
|
|
222
|
+
text: {
|
|
223
|
+
color: colorFormatted(colorAccessible(background))
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
heading: font,
|
|
227
|
+
input: {
|
|
228
|
+
radius: 0
|
|
229
|
+
},
|
|
230
|
+
text: {
|
|
231
|
+
color: colorFormatted(colorAccessible(background))
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// index.js
|
|
163
236
|
var nanoid = (0, import_nanoid.customAlphabet)("0123456789abcdefghijklmnopqrstuvwxyz", 8);
|
|
164
237
|
var infinite = 1e300;
|
|
165
238
|
var megabyte = 1024 * 1024;
|
package/dist/plans.d.cts
CHANGED
|
@@ -2,6 +2,8 @@ import { organization, page, connection, fields, field } from './features.cjs';
|
|
|
2
2
|
import { infinite, gigabyte } from './index.cjs';
|
|
3
3
|
import 'currency-codes';
|
|
4
4
|
import 'nanoid';
|
|
5
|
+
import './color.cjs';
|
|
6
|
+
import 'tinycolor2';
|
|
5
7
|
|
|
6
8
|
const featuresFor = ( array = [] ) => Object.values({
|
|
7
9
|
...connection,
|
package/dist/plans.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { organization, page, connection, fields, field } from './features.js';
|
|
|
2
2
|
import { infinite, gigabyte } from './index.js';
|
|
3
3
|
import 'currency-codes';
|
|
4
4
|
import 'nanoid';
|
|
5
|
+
import './color.js';
|
|
6
|
+
import 'tinycolor2';
|
|
5
7
|
|
|
6
8
|
const featuresFor = ( array = [] ) => Object.values({
|
|
7
9
|
...connection,
|
package/dist/plans.js
CHANGED
|
@@ -133,6 +133,69 @@ var organization = {
|
|
|
133
133
|
// index.js
|
|
134
134
|
import { code, data } from "currency-codes";
|
|
135
135
|
import { customAlphabet } from "nanoid";
|
|
136
|
+
|
|
137
|
+
// lib/color.js
|
|
138
|
+
import tinycolor from "tinycolor2";
|
|
139
|
+
var colorFormatted = (value) => {
|
|
140
|
+
const color = tinycolor(value);
|
|
141
|
+
const attributes = {
|
|
142
|
+
brightness: color.getBrightness(),
|
|
143
|
+
dark: color.isDark(),
|
|
144
|
+
light: color.isLight(),
|
|
145
|
+
luminance: color.getLuminance()
|
|
146
|
+
};
|
|
147
|
+
return {
|
|
148
|
+
attributes,
|
|
149
|
+
hex: color.toHexString(),
|
|
150
|
+
hsl: color.toHsl(),
|
|
151
|
+
hsv: color.toHsv(),
|
|
152
|
+
rgb: color.toRgbString()
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
var colorAccessible = (background2) => {
|
|
156
|
+
const white = "#ffffff";
|
|
157
|
+
const black = "#000000";
|
|
158
|
+
return tinycolor.isReadable(
|
|
159
|
+
background2,
|
|
160
|
+
white,
|
|
161
|
+
{
|
|
162
|
+
level: "AA",
|
|
163
|
+
size: "normal"
|
|
164
|
+
}
|
|
165
|
+
) ? white : black;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// lib/constants.js
|
|
169
|
+
var font = {
|
|
170
|
+
family: "Roboto Flex",
|
|
171
|
+
transform: "none",
|
|
172
|
+
weight: "regular"
|
|
173
|
+
};
|
|
174
|
+
var background = "#ffffff";
|
|
175
|
+
var style = {
|
|
176
|
+
background: {
|
|
177
|
+
color: colorFormatted(background)
|
|
178
|
+
},
|
|
179
|
+
body: font,
|
|
180
|
+
button: {
|
|
181
|
+
background: {
|
|
182
|
+
color: colorFormatted(background)
|
|
183
|
+
},
|
|
184
|
+
radius: 0,
|
|
185
|
+
text: {
|
|
186
|
+
color: colorFormatted(colorAccessible(background))
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
heading: font,
|
|
190
|
+
input: {
|
|
191
|
+
radius: 0
|
|
192
|
+
},
|
|
193
|
+
text: {
|
|
194
|
+
color: colorFormatted(colorAccessible(background))
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
// index.js
|
|
136
199
|
var nanoid = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz", 8);
|
|
137
200
|
var infinite = 1e300;
|
|
138
201
|
var megabyte = 1024 * 1024;
|
package/package.json
CHANGED
|
@@ -9,11 +9,15 @@
|
|
|
9
9
|
"nanoid": "3.3.8",
|
|
10
10
|
"qs": "6.15.2",
|
|
11
11
|
"slugify": "1.6.6",
|
|
12
|
+
"tinycolor2": "1.6.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@node-oauth/oauth2-server": "5.3.0",
|
|
12
16
|
"tsup": "8.5.1",
|
|
13
17
|
"typescript": "5.9.3"
|
|
14
18
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
19
|
+
"overrides": {
|
|
20
|
+
"esbuild": "0.28.1"
|
|
17
21
|
},
|
|
18
22
|
"peerDependencies": {
|
|
19
23
|
"@node-oauth/oauth2-server": "^5.3.0"
|
|
@@ -34,6 +38,11 @@
|
|
|
34
38
|
"import": "./dist/ai.js",
|
|
35
39
|
"require": "./dist/ai.cjs"
|
|
36
40
|
},
|
|
41
|
+
"./color": {
|
|
42
|
+
"types": "./dist/color.d.ts",
|
|
43
|
+
"import": "./dist/color.js",
|
|
44
|
+
"require": "./dist/color.cjs"
|
|
45
|
+
},
|
|
37
46
|
"./encrypt": {
|
|
38
47
|
"types": "./dist/encrypt.d.ts",
|
|
39
48
|
"import": "./dist/encrypt.js",
|
|
@@ -145,5 +154,5 @@
|
|
|
145
154
|
"build": "tsup && npm publish"
|
|
146
155
|
},
|
|
147
156
|
"types": "dist/index.d.ts",
|
|
148
|
-
"version": "0.0.
|
|
157
|
+
"version": "0.0.59"
|
|
149
158
|
}
|