app-studio 0.1.13 → 0.1.14
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/app-studio.cjs.development.js +124 -51
- package/dist/app-studio.cjs.development.js.map +1 -1
- package/dist/app-studio.cjs.production.min.js +1 -1
- package/dist/app-studio.cjs.production.min.js.map +1 -1
- package/dist/app-studio.esm.js +124 -51
- package/dist/app-studio.esm.js.map +1 -1
- package/dist/providers/Theme.d.ts +43 -7
- package/package.json +1 -1
|
@@ -10,6 +10,24 @@ var Color = _interopDefault(require('color-convert'));
|
|
|
10
10
|
var styled = _interopDefault(require('styled-components'));
|
|
11
11
|
var unitlessKeys = _interopDefault(require('@emotion/unitless'));
|
|
12
12
|
|
|
13
|
+
function _extends() {
|
|
14
|
+
_extends = Object.assign || function (target) {
|
|
15
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
+
var source = arguments[i];
|
|
17
|
+
|
|
18
|
+
for (var key in source) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
20
|
+
target[key] = source[key];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return target;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return _extends.apply(this, arguments);
|
|
29
|
+
}
|
|
30
|
+
|
|
13
31
|
function _inheritsLoose(subClass, superClass) {
|
|
14
32
|
subClass.prototype = Object.create(superClass.prototype);
|
|
15
33
|
subClass.prototype.constructor = subClass;
|
|
@@ -36,29 +54,29 @@ function _taggedTemplateLiteralLoose(strings, raw) {
|
|
|
36
54
|
}
|
|
37
55
|
|
|
38
56
|
var palette = {
|
|
39
|
-
|
|
57
|
+
white: {
|
|
40
58
|
50: 'rgba(255, 255, 255, 0.04)',
|
|
41
|
-
100: 'rgba(255, 255, 255, 0.
|
|
42
|
-
200: 'rgba(255, 255, 255, 0.
|
|
43
|
-
300: 'rgba(255, 255, 255, 0.
|
|
44
|
-
400: 'rgba(255, 255, 255, 0.
|
|
45
|
-
500: 'rgba(255, 255, 255, 0.
|
|
46
|
-
600: 'rgba(255, 255, 255, 0.
|
|
47
|
-
700: 'rgba(255, 255, 255, 0.
|
|
48
|
-
800: 'rgba(255, 255, 255, 0.
|
|
49
|
-
900: 'rgba(255, 255, 255,
|
|
50
|
-
},
|
|
51
|
-
|
|
59
|
+
100: 'rgba(255, 255, 255, 0.08)',
|
|
60
|
+
200: 'rgba(255, 255, 255, 0.16)',
|
|
61
|
+
300: 'rgba(255, 255, 255, 0.24)',
|
|
62
|
+
400: 'rgba(255, 255, 255, 0.36)',
|
|
63
|
+
500: 'rgba(255, 255, 255, 0.48)',
|
|
64
|
+
600: 'rgba(255, 255, 255, 0.64)',
|
|
65
|
+
700: 'rgba(255, 255, 255, 0.80)',
|
|
66
|
+
800: 'rgba(255, 255, 255, 0.92)',
|
|
67
|
+
900: 'rgba(255, 255, 255, 1)'
|
|
68
|
+
},
|
|
69
|
+
black: {
|
|
52
70
|
50: 'rgba(0, 0, 0, 0.04)',
|
|
53
|
-
100: 'rgba(0, 0, 0, 0.
|
|
54
|
-
200: 'rgba(0, 0, 0, 0.
|
|
55
|
-
300: 'rgba(0, 0, 0, 0.
|
|
56
|
-
400: 'rgba(0, 0, 0, 0.
|
|
57
|
-
500: 'rgba(0, 0, 0, 0.
|
|
58
|
-
600: 'rgba(0, 0, 0, 0.
|
|
59
|
-
700: 'rgba(0, 0, 0, 0.
|
|
60
|
-
800: 'rgba(0, 0, 0, 0.
|
|
61
|
-
900: 'rgba(0, 0, 0,
|
|
71
|
+
100: 'rgba(0, 0, 0, 0.08)',
|
|
72
|
+
200: 'rgba(0, 0, 0, 0.16)',
|
|
73
|
+
300: 'rgba(0, 0, 0, 0.24)',
|
|
74
|
+
400: 'rgba(0, 0, 0, 0.36)',
|
|
75
|
+
500: 'rgba(0, 0, 0, 0.48)',
|
|
76
|
+
600: 'rgba(0, 0, 0, 0.64)',
|
|
77
|
+
700: 'rgba(0, 0, 0, 0.80)',
|
|
78
|
+
800: 'rgba(0, 0, 0, 0.92)',
|
|
79
|
+
900: 'rgba(0, 0, 0, 1)'
|
|
62
80
|
},
|
|
63
81
|
rose: {
|
|
64
82
|
50: '#fff1f2',
|
|
@@ -338,58 +356,107 @@ var palette = {
|
|
|
338
356
|
}
|
|
339
357
|
};
|
|
340
358
|
|
|
359
|
+
var defaultThemeMain = {
|
|
360
|
+
primary: 'black',
|
|
361
|
+
secondary: 'blue',
|
|
362
|
+
success: 'green.500',
|
|
363
|
+
error: 'red.500',
|
|
364
|
+
warning: 'orange.500',
|
|
365
|
+
disabled: 'gray.500',
|
|
366
|
+
loading: 'dark.500'
|
|
367
|
+
};
|
|
341
368
|
var defaultColors = {
|
|
342
369
|
white: '#FFFFFF',
|
|
343
370
|
black: '#000000',
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
371
|
+
red: '#FF0000',
|
|
372
|
+
green: '#00FF00',
|
|
373
|
+
blue: '#0000FF',
|
|
374
|
+
yellow: '#FFFF00',
|
|
375
|
+
cyan: '#00FFFF',
|
|
376
|
+
magenta: '#FF00FF',
|
|
377
|
+
grey: '#808080',
|
|
378
|
+
orange: '#FFA500',
|
|
379
|
+
brown: '#A52A2A',
|
|
380
|
+
purple: '#800080',
|
|
381
|
+
pink: '#FFC0CB',
|
|
382
|
+
lime: '#00FF00',
|
|
383
|
+
teal: '#008080',
|
|
384
|
+
navy: '#000080',
|
|
385
|
+
olive: '#808000',
|
|
386
|
+
maroon: '#800000',
|
|
387
|
+
gold: '#FFD700',
|
|
388
|
+
silver: '#C0C0C0',
|
|
389
|
+
indigo: '#4B0082',
|
|
390
|
+
violet: '#EE82EE',
|
|
391
|
+
beige: '#F5F5DC',
|
|
392
|
+
turquoise: '#40E0D0',
|
|
393
|
+
coral: '#FF7F50',
|
|
394
|
+
chocolate: '#D2691E',
|
|
395
|
+
skyBlue: '#87CEEB',
|
|
396
|
+
plum: '#DDA0DD',
|
|
397
|
+
darkGreen: '#006400',
|
|
398
|
+
salmon: '#FA8072'
|
|
357
399
|
};
|
|
358
400
|
var ThemeContext = /*#__PURE__*/React.createContext({
|
|
359
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
360
401
|
getColor: function getColor(name) {
|
|
361
402
|
return name;
|
|
362
403
|
},
|
|
363
|
-
colors:
|
|
364
|
-
|
|
404
|
+
colors: {
|
|
405
|
+
main: defaultColors,
|
|
406
|
+
palette: palette
|
|
407
|
+
},
|
|
408
|
+
theme: {
|
|
409
|
+
main: defaultThemeMain,
|
|
410
|
+
components: {}
|
|
411
|
+
}
|
|
365
412
|
});
|
|
366
413
|
var useTheme = function useTheme() {
|
|
367
414
|
return React.useContext(ThemeContext);
|
|
368
415
|
};
|
|
369
416
|
var ThemeProvider = function ThemeProvider(_ref) {
|
|
370
|
-
var _ref$
|
|
371
|
-
|
|
417
|
+
var _ref$theme = _ref.theme,
|
|
418
|
+
theme = _ref$theme === void 0 ? {
|
|
419
|
+
main: defaultThemeMain,
|
|
420
|
+
components: {}
|
|
421
|
+
} : _ref$theme,
|
|
372
422
|
_ref$colors = _ref.colors,
|
|
373
|
-
colors = _ref$colors === void 0 ?
|
|
423
|
+
colors = _ref$colors === void 0 ? {
|
|
424
|
+
main: defaultColors,
|
|
425
|
+
palette: palette
|
|
426
|
+
} : _ref$colors,
|
|
374
427
|
children = _ref.children;
|
|
375
428
|
|
|
376
429
|
var getColor = function getColor(name) {
|
|
377
|
-
// console.log('getColor', name);
|
|
378
430
|
if (name === 'transparent') return name;
|
|
379
431
|
|
|
380
432
|
try {
|
|
381
|
-
|
|
382
|
-
|
|
433
|
+
// Si le nom commence par "theme.", nous recherchons dans les couleurs du thème
|
|
434
|
+
if (name.startsWith('theme.')) {
|
|
435
|
+
var keys = name.split('.').slice(1)[0];
|
|
436
|
+
|
|
437
|
+
if (keys[1] !== undefined && typeof theme.components[keys[0]] == 'object' && theme.components[keys[0]][keys[1]] !== undefined) {
|
|
438
|
+
return getColor(theme.components[keys[0]][keys[1]]);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
if (theme.main[keys[0]] && theme.main[keys[0]] !== undefined) {
|
|
442
|
+
return getColor(theme.main[keys[0]]);
|
|
443
|
+
}
|
|
444
|
+
} // Si le nom commence par "color.", nous recherchons dans la palette
|
|
445
|
+
else if (name.startsWith('color.')) {
|
|
446
|
+
var _keys = name.split('.').slice(1); // Retirer le préfixe "color."
|
|
447
|
+
|
|
383
448
|
|
|
384
|
-
if (palette
|
|
385
|
-
return palette
|
|
449
|
+
if (colors.palette && colors.palette[_keys[0]][_keys[1]] !== undefined) {
|
|
450
|
+
return colors.palette[_keys[0]][_keys[1]];
|
|
386
451
|
}
|
|
387
452
|
|
|
388
|
-
if (palette
|
|
389
|
-
return palette
|
|
453
|
+
if (colors.palette && colors.palette[_keys[0]][parseInt(_keys[1])] !== undefined) {
|
|
454
|
+
return colors.palette[_keys[0]][parseInt(_keys[1])];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (colors.main && colors.main[_keys[0]] !== undefined) {
|
|
458
|
+
return colors.main[_keys[0]];
|
|
390
459
|
}
|
|
391
|
-
} else if (colors && colors[name] !== undefined) {
|
|
392
|
-
return colors[name];
|
|
393
460
|
}
|
|
394
461
|
} catch (e) {
|
|
395
462
|
console.log('Color ' + name + ' not found');
|
|
@@ -401,8 +468,14 @@ var ThemeProvider = function ThemeProvider(_ref) {
|
|
|
401
468
|
return React__default.createElement(ThemeContext.Provider, {
|
|
402
469
|
value: {
|
|
403
470
|
getColor: getColor,
|
|
404
|
-
|
|
405
|
-
|
|
471
|
+
theme: {
|
|
472
|
+
main: _extends({}, defaultThemeMain, theme.main),
|
|
473
|
+
components: _extends({}, theme.components)
|
|
474
|
+
},
|
|
475
|
+
colors: {
|
|
476
|
+
main: _extends({}, defaultColors, colors.main),
|
|
477
|
+
palette: _extends({}, palette, colors.palette)
|
|
478
|
+
}
|
|
406
479
|
}
|
|
407
480
|
}, children);
|
|
408
481
|
};
|