@remember-web/mixin 0.1.12 → 0.1.13

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.
@@ -33,7 +33,7 @@ function RUIProvider(_ref) {
33
33
  function useRUI() {
34
34
  var ruiContextValue = react.useContext(RUIContext);
35
35
  if (ruiContextValue === null) {
36
- throw new Error('useRUI must be used within RUIProvider');
36
+ throw new Error('useRUI must be used within RUIProvider!');
37
37
  }
38
38
  return ruiContextValue;
39
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../../src/provider/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\n\nimport type { ColorThemeType, ThemeType } from '@/colors';\nimport { getBrowserTheme } from '@/colors';\n\nimport { RUIGlobalStyle } from './styles';\n\nexport interface RUIContentProps {\n customMixins?: ColorThemeType;\n forceTheme?: ThemeType;\n setTheme?: (theme: ThemeType) => void;\n}\n\nexport interface RUIContextValue {\n currentTheme: ThemeType;\n setTheme: RUIContentProps['setTheme'];\n}\n\nconst RUIContext = createContext<RUIContextValue | null>(null);\n\n/** theme과 setTheme은 사용하는 곳에서 주입,\n * 기본적으로는 브라우저의 미디어쿼리를 통해서 light, dark를 결정 */\nexport function RUIProvider({\n children,\n customMixins,\n forceTheme,\n setTheme,\n}: { children: ReactNode } & RUIContentProps) {\n const currentTheme: ThemeType = forceTheme ?? getBrowserTheme();\n const ruiContextValue: RUIContextValue = useMemo(\n () => ({ currentTheme, setTheme }),\n [currentTheme, setTheme]\n );\n\n return (\n <RUIContext.Provider value={ruiContextValue}>\n <RUIGlobalStyle customMixins={customMixins} forceTheme={forceTheme} />\n {children}\n </RUIContext.Provider>\n );\n}\n\nexport function useRUI() {\n const ruiContextValue = useContext(RUIContext);\n\n if (ruiContextValue === null) {\n throw new Error('useRUI must be used within RUIProvider');\n }\n\n return ruiContextValue;\n}\n"],"names":["currentTheme","setTheme","value","customMixins","forceTheme"],"mappings":";;;;;;;;AAqBA;;AAEA;AACA;AACO;AAKuC;;;;;;;AAGjCA;AAAcC;;AAAU;AAInC;AACuBC;;AACHC;AAA4BC;;AACnC;AAGf;AAEO;AACL;;AAGE;AACF;AAEA;AACF;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../../src/provider/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\n\nimport type { ColorThemeType, ThemeType } from '@/colors';\nimport { getBrowserTheme } from '@/colors';\n\nimport { RUIGlobalStyle } from './styles';\n\nexport interface RUIContentProps {\n customMixins?: ColorThemeType;\n forceTheme?: ThemeType;\n setTheme?: (theme: ThemeType) => void;\n}\n\nexport interface RUIContextValue {\n currentTheme: ThemeType;\n setTheme: RUIContentProps['setTheme'];\n}\n\nconst RUIContext = createContext<RUIContextValue | null>(null);\n\n/** theme과 setTheme은 사용하는 곳에서 주입,\n * 기본적으로는 브라우저의 미디어쿼리를 통해서 light, dark를 결정 */\nexport function RUIProvider({\n children,\n customMixins,\n forceTheme,\n setTheme,\n}: { children: ReactNode } & RUIContentProps) {\n const currentTheme: ThemeType = forceTheme ?? getBrowserTheme();\n const ruiContextValue: RUIContextValue = useMemo(\n () => ({ currentTheme, setTheme }),\n [currentTheme, setTheme]\n );\n\n return (\n <RUIContext.Provider value={ruiContextValue}>\n <RUIGlobalStyle customMixins={customMixins} forceTheme={forceTheme} />\n {children}\n </RUIContext.Provider>\n );\n}\n\nexport function useRUI() {\n const ruiContextValue = useContext(RUIContext);\n\n if (ruiContextValue === null) {\n throw new Error('useRUI must be used within RUIProvider!');\n }\n\n return ruiContextValue;\n}\n"],"names":["currentTheme","setTheme","value","customMixins","forceTheme"],"mappings":";;;;;;;;AAqBA;;AAEA;AACA;AACO;AAKuC;;;;;;;AAGjCA;AAAcC;;AAAU;AAInC;AACuBC;;AACHC;AAA4BC;;AACnC;AAGf;AAEO;AACL;;AAGE;AACF;AAEA;AACF;;;"}
@@ -31,7 +31,7 @@ function RUIProvider(_ref) {
31
31
  function useRUI() {
32
32
  var ruiContextValue = useContext(RUIContext);
33
33
  if (ruiContextValue === null) {
34
- throw new Error('useRUI must be used within RUIProvider');
34
+ throw new Error('useRUI must be used within RUIProvider!');
35
35
  }
36
36
  return ruiContextValue;
37
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../../src/provider/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\n\nimport type { ColorThemeType, ThemeType } from '@/colors';\nimport { getBrowserTheme } from '@/colors';\n\nimport { RUIGlobalStyle } from './styles';\n\nexport interface RUIContentProps {\n customMixins?: ColorThemeType;\n forceTheme?: ThemeType;\n setTheme?: (theme: ThemeType) => void;\n}\n\nexport interface RUIContextValue {\n currentTheme: ThemeType;\n setTheme: RUIContentProps['setTheme'];\n}\n\nconst RUIContext = createContext<RUIContextValue | null>(null);\n\n/** theme과 setTheme은 사용하는 곳에서 주입,\n * 기본적으로는 브라우저의 미디어쿼리를 통해서 light, dark를 결정 */\nexport function RUIProvider({\n children,\n customMixins,\n forceTheme,\n setTheme,\n}: { children: ReactNode } & RUIContentProps) {\n const currentTheme: ThemeType = forceTheme ?? getBrowserTheme();\n const ruiContextValue: RUIContextValue = useMemo(\n () => ({ currentTheme, setTheme }),\n [currentTheme, setTheme]\n );\n\n return (\n <RUIContext.Provider value={ruiContextValue}>\n <RUIGlobalStyle customMixins={customMixins} forceTheme={forceTheme} />\n {children}\n </RUIContext.Provider>\n );\n}\n\nexport function useRUI() {\n const ruiContextValue = useContext(RUIContext);\n\n if (ruiContextValue === null) {\n throw new Error('useRUI must be used within RUIProvider');\n }\n\n return ruiContextValue;\n}\n"],"names":["currentTheme","setTheme","value","customMixins","forceTheme"],"mappings":";;;;;;AAqBA;;AAEA;AACA;AACO;AAKuC;;;;;;;AAGjCA;AAAcC;;AAAU;AAInC;AACuBC;;AACHC;AAA4BC;;AACnC;AAGf;AAEO;AACL;;AAGE;AACF;AAEA;AACF;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../../../../src/provider/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport { createContext, useContext, useMemo } from 'react';\n\nimport type { ColorThemeType, ThemeType } from '@/colors';\nimport { getBrowserTheme } from '@/colors';\n\nimport { RUIGlobalStyle } from './styles';\n\nexport interface RUIContentProps {\n customMixins?: ColorThemeType;\n forceTheme?: ThemeType;\n setTheme?: (theme: ThemeType) => void;\n}\n\nexport interface RUIContextValue {\n currentTheme: ThemeType;\n setTheme: RUIContentProps['setTheme'];\n}\n\nconst RUIContext = createContext<RUIContextValue | null>(null);\n\n/** theme과 setTheme은 사용하는 곳에서 주입,\n * 기본적으로는 브라우저의 미디어쿼리를 통해서 light, dark를 결정 */\nexport function RUIProvider({\n children,\n customMixins,\n forceTheme,\n setTheme,\n}: { children: ReactNode } & RUIContentProps) {\n const currentTheme: ThemeType = forceTheme ?? getBrowserTheme();\n const ruiContextValue: RUIContextValue = useMemo(\n () => ({ currentTheme, setTheme }),\n [currentTheme, setTheme]\n );\n\n return (\n <RUIContext.Provider value={ruiContextValue}>\n <RUIGlobalStyle customMixins={customMixins} forceTheme={forceTheme} />\n {children}\n </RUIContext.Provider>\n );\n}\n\nexport function useRUI() {\n const ruiContextValue = useContext(RUIContext);\n\n if (ruiContextValue === null) {\n throw new Error('useRUI must be used within RUIProvider!');\n }\n\n return ruiContextValue;\n}\n"],"names":["currentTheme","setTheme","value","customMixins","forceTheme"],"mappings":";;;;;;AAqBA;;AAEA;AACA;AACO;AAKuC;;;;;;;AAGjCA;AAAcC;;AAAU;AAInC;AACuBC;;AACHC;AAA4BC;;AACnC;AAGf;AAEO;AACL;;AAGE;AACF;AAEA;AACF;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remember-web/mixin",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Remember Web Mixins",
5
5
  "homepage": "https://dramancompany.github.io/remember-web-packages/",
6
6
  "author": "Remember",
@@ -16,9 +16,8 @@
16
16
  "scripts": {
17
17
  "build": "rollup -c && yarn fix:dts-alias",
18
18
  "fix:dts-alias": "yarn tsc-alias -p tsconfig.alias.json",
19
- "type-check": "tsc -p ./tsconfig.json",
20
- "lint": "eslint src --fix --ext .js,.jsx,.ts,.tsx --cache",
21
- "release": "yarn build && npm publish"
19
+ "type-check": "tsc -p ./tsconfig.cli.json",
20
+ "lint": "eslint src --fix --ext .js,.jsx,.ts,.tsx --cache"
22
21
  },
23
22
  "files": [
24
23
  "dist",
@@ -0,0 +1,67 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import { useRUI } from '@remember-web/mixin';
3
+ import { Grid, Typography } from '@remember-web/primitive';
4
+
5
+ import type { RUIColorVariable, ThemeType } from './types';
6
+ import * as colors from './variables';
7
+ import { getHexFromRuiCssVariable, getRgba } from './utils';
8
+
9
+ const meta = {
10
+ title: 'Mixins/Colors',
11
+ } satisfies Meta;
12
+
13
+ const ColorChip = ({
14
+ colorName,
15
+ color,
16
+ theme,
17
+ }: {
18
+ colorName: string;
19
+ color: string;
20
+ theme: ThemeType;
21
+ }) => (
22
+ <div
23
+ style={{
24
+ borderRadius: 4,
25
+ overflow: 'hidden',
26
+ boxShadow: `0 3px 12px 0px ${getRgba(colors.contents000, 0.1)}`,
27
+ }}
28
+ >
29
+ <div style={{ backgroundColor: color, width: '100%', height: '100px' }} />
30
+ <div
31
+ style={{ padding: 8, display: 'flex', justifyContent: 'space-between' }}
32
+ >
33
+ <Typography variant="Title1">{colorName}</Typography>
34
+ <Typography variant="Body1" color={colors.contents100}>
35
+ {getHexFromRuiCssVariable({
36
+ colorVariable: color as RUIColorVariable,
37
+ theme,
38
+ })}
39
+ </Typography>
40
+ </div>
41
+ </div>
42
+ );
43
+
44
+ export const Overview = {
45
+ render: () => {
46
+ // eslint-disable-next-line react-hooks/rules-of-hooks
47
+ const { currentTheme } = useRUI();
48
+
49
+ return (
50
+ <div>
51
+ <Typography variant="Headline">Colors</Typography>
52
+ <Grid columns={2} columnGap="16px" rowGap="16px">
53
+ {Object.entries(colors).map(([key, value]) => (
54
+ <ColorChip
55
+ key={value}
56
+ colorName={key}
57
+ color={value}
58
+ theme={currentTheme}
59
+ />
60
+ ))}
61
+ </Grid>
62
+ </div>
63
+ );
64
+ },
65
+ };
66
+
67
+ export default meta;
@@ -47,7 +47,7 @@ export function useRUI() {
47
47
  const ruiContextValue = useContext(RUIContext);
48
48
 
49
49
  if (ruiContextValue === null) {
50
- throw new Error('useRUI must be used within RUIProvider');
50
+ throw new Error('useRUI must be used within RUIProvider!');
51
51
  }
52
52
 
53
53
  return ruiContextValue;