@purr-react-styled-components/services.styled-theme 0.0.7 → 0.0.9

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/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("react"),l=require("styled-components"),x={light:{id:"T_001",name:"Light",colors:{body:"#FFFFFF",text:"#222222",button:{text:"#FFFFFF",background:"#000000"},link:{text:"teal",opacity:1}},font:"Tinos"},dark:{id:"T_007",name:"Dark",colors:{body:"#222222",text:"#c5cbce",button:{text:"#ffffff",background:"#0d47a1"},link:{text:"#0d47a1",opacity:.8}},font:"Ubuntu"}},F={data:x},u=n.createContext({theme:"dark",setTheme:()=>""}),T=({schema:t=F,defaultTheme:e="dark",children:s})=>{const[o,a]=n.useState(e),c=n.useMemo(()=>{var r,d;return o?(r=t==null?void 0:t.data)==null?void 0:r[o]:(d=t==null?void 0:t.data)==null?void 0:d[e]},[e,t==null?void 0:t.data,o]);return i.jsxs(u.Provider,{value:{theme:o,setTheme:a},children:[i.jsx(l.ThemeProvider,{theme:c,children:s}),";"]})},b=()=>{const{setTheme:t,theme:e}=n.useContext(u);return{setTheme:t,theme:e}};exports.ThemesProvider=T;exports.useTheme=b;
1
+ 'use strict';var m=require('react'),styledComponents=require('styled-components');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var m__default=/*#__PURE__*/_interopDefault(m);var r={data:{light:{id:"T_001",name:"Light",colors:{body:"#FFFFFF",text:"#222222",button:{text:"#FFFFFF",background:"#000000"},link:{text:"teal",opacity:1}},font:"Tinos"},dark:{id:"T_007",name:"Dark",colors:{body:"#222222",text:"#c5cbce",button:{text:"#ffffff",background:"#0d47a1"},link:{text:"#0d47a1",opacity:.8}},font:"Ubuntu"}}};var d=m.createContext({theme:"dark",setTheme:()=>""}),y=({schema:e=r,defaultTheme:t="dark",children:n})=>{let[o,a]=m.useState(t),T=m.useMemo(()=>o?e?.data?.[o]:e?.data?.[t],[t,e?.data,o]);return m__default.default.createElement(d.Provider,{value:{theme:o,setTheme:a}},m__default.default.createElement(styledComponents.ThemeProvider,{theme:T},n),";")},S=()=>{let{setTheme:e,theme:t}=m.useContext(d);return {setTheme:e,theme:t}};exports.ThemesProvider=y;exports.useTheme=S;
@@ -0,0 +1,21 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { TAny } from '@purr-core/utils.definitions';
3
+
4
+ type TStyledTheme = "light" | "dark";
5
+ type TStyledThemeContext = {
6
+ theme: TStyledTheme;
7
+ setTheme: (theme: TStyledTheme) => void;
8
+ };
9
+ interface IStyledThemeProps {
10
+ schema?: TAny;
11
+ defaultTheme?: TStyledTheme;
12
+ children?: ReactNode;
13
+ }
14
+
15
+ declare const ThemesProvider: ({ schema, defaultTheme, children, }: IStyledThemeProps) => React.JSX.Element;
16
+ declare const useTheme: () => {
17
+ setTheme: (theme: TStyledTheme) => void;
18
+ theme: TStyledTheme;
19
+ };
20
+
21
+ export { type IStyledThemeProps, type TStyledTheme, type TStyledThemeContext, ThemesProvider, useTheme };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,21 @@
1
- export * from './_components';
2
- export * from './_types';
1
+ import React, { ReactNode } from 'react';
2
+ import { TAny } from '@purr-core/utils.definitions';
3
+
4
+ type TStyledTheme = "light" | "dark";
5
+ type TStyledThemeContext = {
6
+ theme: TStyledTheme;
7
+ setTheme: (theme: TStyledTheme) => void;
8
+ };
9
+ interface IStyledThemeProps {
10
+ schema?: TAny;
11
+ defaultTheme?: TStyledTheme;
12
+ children?: ReactNode;
13
+ }
14
+
15
+ declare const ThemesProvider: ({ schema, defaultTheme, children, }: IStyledThemeProps) => React.JSX.Element;
16
+ declare const useTheme: () => {
17
+ setTheme: (theme: TStyledTheme) => void;
18
+ theme: TStyledTheme;
19
+ };
20
+
21
+ export { type IStyledThemeProps, type TStyledTheme, type TStyledThemeContext, ThemesProvider, useTheme };
package/dist/index.js CHANGED
@@ -1,67 +1 @@
1
- import { jsxs as x, jsx as F } from "react/jsx-runtime";
2
- import { createContext as f, useState as s, useMemo as b, useContext as c } from "react";
3
- import { ThemeProvider as k } from "styled-components";
4
- const l = {
5
- light: {
6
- id: "T_001",
7
- name: "Light",
8
- colors: {
9
- body: "#FFFFFF",
10
- text: "#222222",
11
- button: {
12
- text: "#FFFFFF",
13
- background: "#000000"
14
- },
15
- link: {
16
- text: "teal",
17
- opacity: 1
18
- }
19
- },
20
- font: "Tinos"
21
- },
22
- dark: {
23
- id: "T_007",
24
- name: "Dark",
25
- colors: {
26
- body: "#222222",
27
- text: "#c5cbce",
28
- button: {
29
- text: "#ffffff",
30
- background: "#0d47a1"
31
- },
32
- link: {
33
- text: "#0d47a1",
34
- opacity: 0.8
35
- }
36
- },
37
- font: "Ubuntu"
38
- }
39
- }, T = {
40
- data: l
41
- }, d = f({
42
- theme: "dark",
43
- setTheme: () => ""
44
- }), v = ({
45
- schema: t = T,
46
- defaultTheme: e = "dark",
47
- children: i
48
- }) => {
49
- const [o, a] = s(e), u = b(
50
- () => {
51
- var r, n;
52
- return o ? (r = t == null ? void 0 : t.data) == null ? void 0 : r[o] : (n = t == null ? void 0 : t.data) == null ? void 0 : n[e];
53
- },
54
- [e, t == null ? void 0 : t.data, o]
55
- );
56
- return /* @__PURE__ */ x(d.Provider, { value: { theme: o, setTheme: a }, children: [
57
- /* @__PURE__ */ F(k, { theme: u, children: i }),
58
- ";"
59
- ] });
60
- }, y = () => {
61
- const { setTheme: t, theme: e } = c(d);
62
- return { setTheme: t, theme: e };
63
- };
64
- export {
65
- v as ThemesProvider,
66
- y as useTheme
67
- };
1
+ import m,{createContext,useState,useMemo,useContext}from'react';import {ThemeProvider}from'styled-components';var r={data:{light:{id:"T_001",name:"Light",colors:{body:"#FFFFFF",text:"#222222",button:{text:"#FFFFFF",background:"#000000"},link:{text:"teal",opacity:1}},font:"Tinos"},dark:{id:"T_007",name:"Dark",colors:{body:"#222222",text:"#c5cbce",button:{text:"#ffffff",background:"#0d47a1"},link:{text:"#0d47a1",opacity:.8}},font:"Ubuntu"}}};var d=createContext({theme:"dark",setTheme:()=>""}),y=({schema:e=r,defaultTheme:t="dark",children:n})=>{let[o,a]=useState(t),T=useMemo(()=>o?e?.data?.[o]:e?.data?.[t],[t,e?.data,o]);return m.createElement(d.Provider,{value:{theme:o,setTheme:a}},m.createElement(ThemeProvider,{theme:T},n),";")},S=()=>{let{setTheme:e,theme:t}=useContext(d);return {setTheme:e,theme:t}};export{y as ThemesProvider,S as useTheme};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purr-react-styled-components/services.styled-theme",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "typescript": "*",
25
25
  "react": "*",
26
26
  "styled-components": "*",
27
- "@purr-core/utils.definitions": "0.0.10"
27
+ "@purr-core/utils.definitions": "0.0.12"
28
28
  },
29
29
  "author": "@DinhThienPhuc",
30
30
  "license": "ISC",
@@ -33,6 +33,8 @@
33
33
  "scripts": {
34
34
  "dev": "vite build --watch",
35
35
  "build": "tsc && vite build",
36
+ "build:vite": "tsc && vite build",
37
+ "build:tsup": "tsup",
36
38
  "lint": "eslint . --ext ts,tsx --max-warnings 0"
37
39
  }
38
40
  }
@@ -1,8 +0,0 @@
1
- import { default as React } from 'react';
2
- import { IStyledThemeProps, TStyledTheme } from './_types';
3
-
4
- export declare const ThemesProvider: ({ schema, defaultTheme, children, }: IStyledThemeProps) => React.JSX.Element;
5
- export declare const useTheme: () => {
6
- setTheme: (theme: TStyledTheme) => void;
7
- theme: TStyledTheme;
8
- };
@@ -1,41 +0,0 @@
1
- declare const _default: {
2
- "data": {
3
- "light": {
4
- "id": "T_001",
5
- "name": "Light",
6
- "colors": {
7
- "body": "#FFFFFF",
8
- "text": "#222222",
9
- "button": {
10
- "text": "#FFFFFF",
11
- "background": "#000000"
12
- },
13
- "link": {
14
- "text": "teal",
15
- "opacity": 1
16
- }
17
- },
18
- "font": "Tinos"
19
- },
20
- "dark": {
21
- "id": "T_007",
22
- "name": "Dark",
23
- "colors": {
24
- "body": "#222222",
25
- "text": "#c5cbce",
26
- "button": {
27
- "text": "#ffffff",
28
- "background": "#0d47a1"
29
- },
30
- "link": {
31
- "text": "#0d47a1",
32
- "opacity": 0.8
33
- }
34
- },
35
- "font": "Ubuntu"
36
- }
37
- }
38
- }
39
- ;
40
-
41
- export default _default;
package/dist/_types.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { TAny } from '@purr-core/utils.definitions';
3
-
4
- export type TStyledTheme = "light" | "dark";
5
- export type TStyledThemeContext = {
6
- theme: TStyledTheme;
7
- setTheme: (theme: TStyledTheme) => void;
8
- };
9
- export interface IStyledThemeProps {
10
- schema?: TAny;
11
- defaultTheme?: TStyledTheme;
12
- children?: ReactNode;
13
- }