@apia/theme 0.1.0 → 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 +53 -24
- package/dist/index.js +2234 -1682
- 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,28 @@ 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;
|
|
194
|
+
};
|
|
195
|
+
type TColorDefinitionPrimitive = Pick<ThemeUICSSObject, 'color' | 'backgroundColor' | 'borderColor'>;
|
|
196
|
+
type TColorDefinition = TColorDefinitionPrimitive & {
|
|
197
|
+
active?: TColorDefinitionPrimitive;
|
|
198
|
+
checked?: TColorDefinitionPrimitive;
|
|
199
|
+
disabled?: TColorDefinitionPrimitive;
|
|
200
|
+
focus?: TColorDefinitionPrimitive;
|
|
201
|
+
hover?: TColorDefinitionPrimitive;
|
|
202
|
+
preventParse?: boolean;
|
|
203
|
+
selected?: TColorDefinitionPrimitive;
|
|
189
204
|
};
|
|
190
205
|
declare global {
|
|
191
206
|
interface Window {
|
|
@@ -195,7 +210,9 @@ declare global {
|
|
|
195
210
|
}
|
|
196
211
|
}
|
|
197
212
|
|
|
198
|
-
declare function
|
|
213
|
+
declare function parsePalette(palette: TPalette, theme: Theme): TParsedPalette;
|
|
214
|
+
|
|
215
|
+
type CustomTheme = Omit<Theme, 'palette'>;
|
|
199
216
|
|
|
200
217
|
/**
|
|
201
218
|
* Este método está pensado para usarse únicamente dentro de applyStates, si se
|
|
@@ -228,7 +245,7 @@ declare const getColorStates: TStatesRetriever;
|
|
|
228
245
|
* Esta función calcula los colores de los estados a partir de la definición
|
|
229
246
|
* pasada.
|
|
230
247
|
*/
|
|
231
|
-
declare function getColorsAndStatesByDefinition(definition: Partial<TGetColorStateDefinition>, options?: TGetColorsAndStatesOptions): ThemeUICSSObject;
|
|
248
|
+
declare function getColorsAndStatesByDefinition(definition: Partial<TGetColorStateDefinition>, theme: Theme, options?: TGetColorsAndStatesOptions): ThemeUICSSObject;
|
|
232
249
|
|
|
233
250
|
/**
|
|
234
251
|
* Esta función arma un objeto con los colores que se deben aplicar para
|
|
@@ -274,7 +291,7 @@ declare function getColorsByPath(path: string, options?: {
|
|
|
274
291
|
*/
|
|
275
292
|
declare const getOneColorState: TColorStateRetriever;
|
|
276
293
|
|
|
277
|
-
declare function useMainTheme(customTheme?:
|
|
294
|
+
declare function useMainTheme(customTheme?: CustomTheme, customPalette?: TPalette): Theme;
|
|
278
295
|
|
|
279
296
|
/**
|
|
280
297
|
* Permite crear un componente cuyos estilos pueden ser redefinidos por un
|
|
@@ -295,7 +312,7 @@ declare function useMainTheme(customTheme?: Theme): Theme;
|
|
|
295
312
|
* @param Component La definición del componente.
|
|
296
313
|
* @returns Un componente reutilizable y exportable que tiene estilos aplicados.
|
|
297
314
|
*/
|
|
298
|
-
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) & {
|
|
299
316
|
displayName: string;
|
|
300
317
|
};
|
|
301
318
|
|
|
@@ -329,5 +346,17 @@ declare function injectStyles(path: string, styles: ThemeUICSSObject): void;
|
|
|
329
346
|
*/
|
|
330
347
|
declare function injectStyles(styles: ThemeUICSSObject): void;
|
|
331
348
|
|
|
332
|
-
|
|
333
|
-
|
|
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 };
|