@apia/theme 0.1.3 → 0.2.2
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/LICENSE.md +20 -20
- package/dist/apia-theme-0.1.3.tgz +0 -0
- package/dist/index.d.ts +47 -49
- package/dist/index.js +3827 -1
- package/dist/index.js.map +1 -1
- package/dist/package.json +50 -0
- package/dist/watchChanges.js +10 -0
- package/package.json +6 -5
- package/cleanDist.json +0 -3
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) [year] [fullname]
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ResponsiveStyleValue, ThemeUICSSObject, Theme } from 'theme-ui';
|
|
2
|
+
export { Alert, AlertProps, AspectImage, AspectImageProps, AspectRatio, AspectRatioProps, Avatar, AvatarProps, Badge, BadgeProps, BaseStyles, Box, BoxOwnProps, BoxProps, Button, ButtonProps, CSSObject, CSSProperties, CSSPseudoSelectorProps, Card, CardProps, Checkbox, CheckboxProps, Close, CloseIcon, CloseProps, ColorMode, ColorModesScale, Container, ContainerProps, Divider, DividerProps, Donut, DonutProps, Embed, EmbedProps, Field, FieldOwnProps, FieldProps, Flex, FlexOwnProps, FlexProps, Global, Grid, GridProps, Heading, HeadingProps, IconButton, IconButtonProps, Image, ImageProps, InitializeColorMode, Input, InputProps, Label, LabelProps, Link, LinkProps, MenuButton, MenuButtonProps, MenuIcon, Message, MessageProps, NavLink, NavLinkProps, Paragraph, ParagraphProps, Progress, ProgressProps, Radio, RadioProps, ResponsiveStyleValue, Select, SelectProps, Slider, SliderProps, Spinner, SpinnerProps, StylePropertyValue, Switch, SwitchProps, SxProp, TLengthStyledSystem, Text, TextProps, Textarea, TextareaProps, Theme, ThemeStyles, ThemeUICSSObject, ThemeUICSSProperties, ThemeUIContextValue, ThemeUIStyleObject, createElement, css, get, jsx, merge, useColorMode, useThemeUI } from 'theme-ui';
|
|
3
|
+
export * from '@theme-ui/match-media';
|
|
2
4
|
import * as react from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { Theme, ResponsiveStyleValue, ThemeUICSSObject } from 'theme-ui';
|
|
5
|
-
|
|
6
|
-
interface TThemeProvider {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
customTheme?: Theme;
|
|
9
|
-
}
|
|
10
|
-
declare const ThemeProviderContext: react.Context<Theme>;
|
|
11
|
-
declare const ThemeProvider: ({ children, customTheme }: TThemeProvider) => theme_ui_jsx_runtime.JSX.Element;
|
|
5
|
+
import { FC, ReactNode } from 'react';
|
|
12
6
|
|
|
13
7
|
/**
|
|
14
8
|
* Esta función devuelve un array de valores para los distintos breakpoints.
|
|
@@ -63,6 +57,7 @@ interface TGetColorsAndStatesOptions {
|
|
|
63
57
|
focus?: boolean;
|
|
64
58
|
hover?: boolean;
|
|
65
59
|
readonly?: boolean;
|
|
60
|
+
path?: boolean;
|
|
66
61
|
selected?: boolean;
|
|
67
62
|
};
|
|
68
63
|
}
|
|
@@ -71,7 +66,7 @@ interface TGetColorsAndStatesOptions {
|
|
|
71
66
|
* dentro del objeto colors de ThemeUI. Si se desea calcular los estados en
|
|
72
67
|
* base a un color, se debe utilizar el método getColorsAndStatesByColor.
|
|
73
68
|
*/
|
|
74
|
-
declare function getColorsAndStatesByPath(
|
|
69
|
+
declare function getColorsAndStatesByPath(incomingPath: string, options?: TGetColorsAndStatesOptions): Record<string, ThemeUICSSObject>;
|
|
75
70
|
|
|
76
71
|
interface IColorDefinition {
|
|
77
72
|
main: string;
|
|
@@ -94,9 +89,14 @@ interface TStates {
|
|
|
94
89
|
selected?: boolean;
|
|
95
90
|
}
|
|
96
91
|
type TGetColorStateDefinition = Pick<ThemeUICSSObject, 'backgroundColor' | 'borderColor' | 'borderLeftColor' | 'borderRightColor' | 'borderBottomColor' | 'borderTopColor' | 'color'>;
|
|
97
|
-
type
|
|
98
|
-
type
|
|
99
|
-
type
|
|
92
|
+
type TParsedPaletteColorStateRetriever = (color: string, state: keyof TStates) => string;
|
|
93
|
+
type TColorStateRetriever = (color: string, state: keyof TStates, theme: Theme) => string;
|
|
94
|
+
type TParsedPaletteStateRetriever = (definition: Partial<TGetColorStateDefinition>, state: keyof TStates) => TGetColorStateDefinition;
|
|
95
|
+
type TStateRetriever = (definition: Partial<TGetColorStateDefinition>, state: keyof TStates, theme: Theme) => TGetColorStateDefinition;
|
|
96
|
+
type TParsedPaletteStatesRetriever = (definition: Partial<TGetColorStateDefinition>, states?: TStates) => ThemeUICSSObject;
|
|
97
|
+
type TStatesRetriever = (definition: Partial<TGetColorStateDefinition>, theme: Theme, states?: TStates) => ThemeUICSSObject;
|
|
98
|
+
type TParsedPaletteStatesByDefinition = (definition: Partial<TGetColorStateDefinition>, options?: TGetColorsAndStatesOptions) => ThemeUICSSObject;
|
|
99
|
+
type TApplyStates = (properties: Record<string, TColorDefinition | string | Record<string, unknown>>[], theme: Theme, states?: TStates) => void;
|
|
100
100
|
interface TActionDefinition<OpacityColor = undefined | string | IActionOpacity> {
|
|
101
101
|
active: OpacityColor;
|
|
102
102
|
activeOpacity: number;
|
|
@@ -179,13 +179,18 @@ interface TPalette<ColorDefinition = IColorDefinition, ColorModifier = TColorMod
|
|
|
179
179
|
queryColumnsMultiplier?: number;
|
|
180
180
|
}
|
|
181
181
|
type TBuildStateObject = <T extends Partial<ThemeUICSSObject>>(props: T, state: keyof Required<TStates> | 'checked') => ThemeUICSSObject;
|
|
182
|
+
type TBuildColorsObject = (definition: Partial<TGetColorStateDefinition>) => TGetColorStateDefinition;
|
|
182
183
|
type TParsedPalette = Required<TPalette<Required<IColorDefinition>, TColorModifier, Required<TActionDefinition<IActionOpacity>>>> & {
|
|
184
|
+
applyStates: TApplyStates;
|
|
185
|
+
buildColorsObject: TBuildColorsObject;
|
|
183
186
|
buildStateObject: TBuildStateObject;
|
|
184
|
-
getColor:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
187
|
+
getColor: TParsedPaletteColorStateRetriever;
|
|
188
|
+
getColorStates: TParsedPaletteStatesRetriever;
|
|
189
|
+
getOneState: TParsedPaletteStateRetriever;
|
|
190
|
+
getStatesForColors: TParsedPaletteStatesRetriever;
|
|
191
|
+
getStatesFromDefinition: TParsedPaletteStatesByDefinition;
|
|
188
192
|
getStatesFromPath: typeof getColorsAndStatesByPath;
|
|
193
|
+
getSelectedColors: () => ThemeUICSSObject;
|
|
189
194
|
};
|
|
190
195
|
type TColorDefinitionPrimitive = Pick<ThemeUICSSObject, 'color' | 'backgroundColor' | 'borderColor'>;
|
|
191
196
|
type TColorDefinition = TColorDefinitionPrimitive & {
|
|
@@ -205,35 +210,9 @@ declare global {
|
|
|
205
210
|
}
|
|
206
211
|
}
|
|
207
212
|
|
|
208
|
-
|
|
209
|
-
* Esta función está pensada para ser utilizada dentro del objeto colors del
|
|
210
|
-
* tema. Aplica recursivamente los distintos estados a todos los elementos
|
|
211
|
-
* contenidos dentro de los objetos pasados como parámetro en properties.
|
|
212
|
-
*
|
|
213
|
-
* Es posible elegir cuáles estados se aplican y cuáles no mediante el segundo
|
|
214
|
-
* parámetro, que es un objeto cuyas propiedades serán tomadas en cuenta
|
|
215
|
-
* únicamente cuando tienen valor false, en cuyo caso no se aplicará el estado
|
|
216
|
-
* correspondiente.
|
|
217
|
-
*
|
|
218
|
-
* @param properties
|
|
219
|
-
* @param states
|
|
220
|
-
*/
|
|
221
|
-
declare function applyStates(properties: Record<string, TColorDefinition | string | Record<string, unknown>>[], states?: TStates): void;
|
|
213
|
+
declare function parsePalette(palette: TPalette, theme: Theme): TParsedPalette;
|
|
222
214
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Básicamente agrega la definición de borderLeftColor, borderRightColor, etc.
|
|
227
|
-
*/
|
|
228
|
-
declare function buildColorsObject(definition: Partial<TGetColorStateDefinition>): TGetColorStateDefinition;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Esta función calcula los colores de los estados a partir de la definición
|
|
232
|
-
* pasada.
|
|
233
|
-
*/
|
|
234
|
-
declare function getColorsAndStatesByDefinition(definition: Partial<TGetColorStateDefinition>, options?: TGetColorsAndStatesOptions): ThemeUICSSObject;
|
|
235
|
-
|
|
236
|
-
declare function getPalette(arg?: TPalette | boolean): TParsedPalette;
|
|
215
|
+
type CustomTheme = Omit<Theme, 'palette'>;
|
|
237
216
|
|
|
238
217
|
/**
|
|
239
218
|
* Este método está pensado para usarse únicamente dentro de applyStates, si se
|
|
@@ -262,6 +241,12 @@ declare const getColorState: TStateRetriever;
|
|
|
262
241
|
*/
|
|
263
242
|
declare const getColorStates: TStatesRetriever;
|
|
264
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Esta función calcula los colores de los estados a partir de la definición
|
|
246
|
+
* pasada.
|
|
247
|
+
*/
|
|
248
|
+
declare function getColorsAndStatesByDefinition(definition: Partial<TGetColorStateDefinition>, theme: Theme, options?: TGetColorsAndStatesOptions): ThemeUICSSObject;
|
|
249
|
+
|
|
265
250
|
/**
|
|
266
251
|
* Esta función arma un objeto con los colores que se deben aplicar para
|
|
267
252
|
* garantizar que el resultado sea el esperado, por ejemplo, al aplicar un
|
|
@@ -306,7 +291,7 @@ declare function getColorsByPath(path: string, options?: {
|
|
|
306
291
|
*/
|
|
307
292
|
declare const getOneColorState: TColorStateRetriever;
|
|
308
293
|
|
|
309
|
-
declare function useMainTheme(customTheme?:
|
|
294
|
+
declare function useMainTheme(customTheme?: CustomTheme, customPalette?: TPalette): Theme;
|
|
310
295
|
|
|
311
296
|
/**
|
|
312
297
|
* Permite crear un componente cuyos estilos pueden ser redefinidos por un
|
|
@@ -327,7 +312,7 @@ declare function useMainTheme(customTheme?: Theme): Theme;
|
|
|
327
312
|
* @param Component La definición del componente.
|
|
328
313
|
* @returns Un componente reutilizable y exportable que tiene estilos aplicados.
|
|
329
314
|
*/
|
|
330
|
-
declare function makeStyledComponent<T extends object>(displayName: string, stylesPath: string, styles: ThemeUICSSObject, Component: FC<T>, unwraped?: boolean): ((props: T) =>
|
|
315
|
+
declare function makeStyledComponent<T extends object>(displayName: string, stylesPath: string, styles: ThemeUICSSObject, Component: FC<T>, unwraped?: boolean): ((props: T) => react.JSX.Element) & {
|
|
331
316
|
displayName: string;
|
|
332
317
|
};
|
|
333
318
|
|
|
@@ -361,4 +346,17 @@ declare function injectStyles(path: string, styles: ThemeUICSSObject): void;
|
|
|
361
346
|
*/
|
|
362
347
|
declare function injectStyles(styles: ThemeUICSSObject): void;
|
|
363
348
|
|
|
364
|
-
|
|
349
|
+
interface TThemeProvider {
|
|
350
|
+
children: ReactNode;
|
|
351
|
+
customTheme?: Omit<Theme, 'palette'>;
|
|
352
|
+
customPalette?: TPalette;
|
|
353
|
+
}
|
|
354
|
+
declare const ApiaThemeProvider: ({ children, customTheme, customPalette, }: TThemeProvider) => react.JSX.Element;
|
|
355
|
+
|
|
356
|
+
declare module 'theme-ui' {
|
|
357
|
+
interface Theme {
|
|
358
|
+
palette: TParsedPalette;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export { ApiaThemeProvider, CustomTheme, TColorDefinition, TPalette, TParsedPalette, applyStatesGetColor, focusOutline, getColorState, getColorStates, getColorsAndStatesByDefinition, getColorsAndStatesByPath, getColorsByDefinition, getColorsByPath, getOneColorState, getVariant, injectStyles, makeStyledComponent, parsePalette, responsive, smallButton, spacing, useMainTheme };
|