tinywidgets 0.0.3 → 0.0.5
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/bun.lockb +0 -0
- package/index.ts +12 -11
- package/package.json +8 -8
- package/src/App/index.tsx +18 -0
- package/src/Avatar/index.tsx +1 -4
- package/src/Axis/index.tsx +3 -5
- package/src/Button/index.tsx +7 -9
- package/src/Card/index.tsx +3 -5
- package/src/Collapsible/index.tsx +16 -12
- package/src/Detail/index.tsx +3 -5
- package/src/Hr/index.tsx +1 -3
- package/src/Metric/index.tsx +5 -7
- package/src/Summary/index.tsx +5 -7
- package/src/Tag/index.tsx +4 -6
- package/src/Ui/{Layout/Header → Header}/DarkButton/index.tsx +4 -5
- package/src/Ui/{Layout/Header → Header}/SideNav/index.css.ts +3 -3
- package/src/Ui/{Layout/Header → Header}/SideNav/index.tsx +4 -6
- package/src/Ui/Header/SideNavButton/index.css.ts +4 -0
- package/src/Ui/Header/SideNavButton/index.tsx +19 -0
- package/src/Ui/{Layout/Header → Header}/Title/index.css.ts +3 -3
- package/src/Ui/{Layout/Header → Header}/Title/index.tsx +3 -4
- package/src/Ui/Header/TopNav/index.css.ts +9 -0
- package/src/Ui/{Layout/Header → Header}/TopNav/index.tsx +3 -4
- package/src/Ui/{Layout/Header → Header}/index.css.ts +2 -2
- package/src/Ui/{Layout/Header → Header}/index.tsx +8 -9
- package/src/Ui/{Layout/Main → Main}/Article/index.css.ts +2 -2
- package/src/Ui/{Layout/Main → Main}/Article/index.tsx +3 -4
- package/src/Ui/{Layout/Main → Main}/Footer/index.css.ts +2 -2
- package/src/Ui/{Layout/Main → Main}/Footer/index.tsx +3 -4
- package/src/Ui/{Layout/Main → Main}/index.css.ts +3 -3
- package/src/Ui/{Layout/Main → Main}/index.tsx +5 -7
- package/src/Ui/index.css.ts +9 -0
- package/src/Ui/index.tsx +37 -13
- package/src/index.ts +11 -0
- package/src/{Ui → stores}/LocalStore.tsx +3 -6
- package/src/Ui/Layout/Header/SideNavButton/index.css.ts +0 -4
- package/src/Ui/Layout/Header/SideNavButton/index.tsx +0 -17
- package/src/Ui/Layout/Header/TopNav/index.css.ts +0 -9
- package/src/Ui/Layout/index.css.ts +0 -9
- package/src/Ui/Layout/index.tsx +0 -52
- /package/src/{Ui → stores}/SessionStore.tsx +0 -0
package/bun.lockb
CHANGED
|
Binary file
|
package/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
1
|
+
export { App } from './src/App/index.tsx';
|
|
2
|
+
export { Avatar } from './src/Avatar/index.tsx';
|
|
3
|
+
export { Axis } from './src/Axis/index.tsx';
|
|
4
|
+
export { Button } from './src/Button/index.tsx';
|
|
5
|
+
export { Card } from './src/Card/index.tsx';
|
|
6
|
+
export { Collapsible } from './src/Collapsible/index.tsx';
|
|
7
|
+
export { Detail } from './src/Detail/index.tsx';
|
|
8
|
+
export { Hr } from './src/Hr/index.tsx';
|
|
9
|
+
export { Metric } from './src/Metric/index.tsx';
|
|
10
|
+
export { Summary } from './src/Summary/index.tsx';
|
|
11
|
+
export { Tag } from './src/Tag/index.tsx';
|
|
12
|
+
export { Ui } from './src/Ui/index.tsx';
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinywidgets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"author": "jamesgpearce",
|
|
5
5
|
"repository": "github:tinyplex/tinywidgets",
|
|
6
6
|
"module": "index.ts",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@types/react": "^18.3.
|
|
8
|
+
"@types/react": "^18.3.5",
|
|
9
9
|
"@types/react-dom": "^18.3.0",
|
|
10
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
11
|
-
"@typescript-eslint/parser": "^
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
|
11
|
+
"@typescript-eslint/parser": "^8.4.0",
|
|
12
12
|
"eslint": "^8.57.0",
|
|
13
13
|
"eslint-config-prettier": "^9.1.0",
|
|
14
|
-
"eslint-plugin-react": "^7.
|
|
14
|
+
"eslint-plugin-react": "^7.35.2",
|
|
15
15
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
16
16
|
"prettier": "^3.3.3",
|
|
17
|
-
"typescript": "^5.5.
|
|
17
|
+
"typescript": "^5.5.4",
|
|
18
18
|
"@vanilla-extract/css": "^1.15.5",
|
|
19
19
|
"react": "^18.3.1",
|
|
20
20
|
"react-dom": "^18.3.1",
|
|
21
|
-
"tinybase": "^5.
|
|
21
|
+
"tinybase": "^5.3.0-beta.1"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
".": "./index.ts",
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"description": "reserved",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"lucide-react": "^0.
|
|
31
|
+
"lucide-react": "^0.439.0"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @jsx createElement */
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { Provider } from 'tinybase/ui-react';
|
|
5
|
+
import { createElement } from '../index.ts';
|
|
6
|
+
import { LocalStore } from '../stores/LocalStore.tsx';
|
|
7
|
+
import { SessionStore } from '../stores/SessionStore.tsx';
|
|
8
|
+
|
|
9
|
+
export const App = ({ui, stores}: {ui: ReactNode; stores?: ReactNode}) => {
|
|
10
|
+
return (
|
|
11
|
+
<Provider>
|
|
12
|
+
{ui}
|
|
13
|
+
{stores}
|
|
14
|
+
<SessionStore />
|
|
15
|
+
<LocalStore />
|
|
16
|
+
</Provider>
|
|
17
|
+
);
|
|
18
|
+
};
|
package/src/Avatar/index.tsx
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {classNames} from '../index.ts';
|
|
3
|
+
import {classNames, createElement} from '../index.ts';
|
|
5
4
|
import {avatar} from './index.css.ts';
|
|
6
5
|
|
|
7
|
-
const {createElement} = React;
|
|
8
|
-
|
|
9
6
|
export const Avatar = ({
|
|
10
7
|
src,
|
|
11
8
|
title,
|
package/src/Axis/index.tsx
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {classNames} from '../';
|
|
3
|
+
import type {ReactNode} from 'react';
|
|
4
|
+
import {classNames, createElement} from '../';
|
|
5
5
|
import {axis, gapStyle, justifyStyle, verticalStyle} from './index.css';
|
|
6
6
|
|
|
7
|
-
const {createElement} = React;
|
|
8
|
-
|
|
9
7
|
export const Axis = ({
|
|
10
8
|
justify = true,
|
|
11
9
|
gap = true,
|
|
@@ -17,7 +15,7 @@ export const Axis = ({
|
|
|
17
15
|
justify?: boolean;
|
|
18
16
|
gap?: boolean;
|
|
19
17
|
vertical?: boolean;
|
|
20
|
-
children:
|
|
18
|
+
children: ReactNode;
|
|
21
19
|
className?: string;
|
|
22
20
|
title?: string;
|
|
23
21
|
}) => {
|
package/src/Button/index.tsx
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
/** @jsxFrag Fragment */
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import type {ComponentType, ReactNode, Ref} from 'react';
|
|
5
5
|
import {iconSize} from '../index.css.ts';
|
|
6
|
-
import {classNames} from '../index.ts';
|
|
6
|
+
import {classNames, createElement, forwardRef, useCallback} from '../index.ts';
|
|
7
7
|
import {button, buttonVariant, highlight, labelStyle} from './index.css.ts';
|
|
8
8
|
|
|
9
|
-
const {createElement, useCallback, forwardRef} = React;
|
|
10
|
-
|
|
11
9
|
export const Button = forwardRef(
|
|
12
10
|
(
|
|
13
11
|
{
|
|
@@ -22,10 +20,10 @@ export const Button = forwardRef(
|
|
|
22
20
|
title,
|
|
23
21
|
current,
|
|
24
22
|
}: {
|
|
25
|
-
icon?:
|
|
26
|
-
label?:
|
|
27
|
-
labelRight?:
|
|
28
|
-
iconRight?:
|
|
23
|
+
icon?: ComponentType<{className?: string}>;
|
|
24
|
+
label?: ReactNode;
|
|
25
|
+
labelRight?: ReactNode;
|
|
26
|
+
iconRight?: ComponentType<{className?: string}>;
|
|
29
27
|
onClick?: () => void;
|
|
30
28
|
variant?: keyof typeof buttonVariant;
|
|
31
29
|
className?: string;
|
|
@@ -33,7 +31,7 @@ export const Button = forwardRef(
|
|
|
33
31
|
title?: string;
|
|
34
32
|
current?: boolean;
|
|
35
33
|
},
|
|
36
|
-
ref:
|
|
34
|
+
ref: Ref<HTMLButtonElement>,
|
|
37
35
|
) => {
|
|
38
36
|
const icon = Icon ? <Icon className={iconSize} /> : null;
|
|
39
37
|
const iconRight = IconRight ? <IconRight className={iconSize} /> : null;
|
package/src/Card/index.tsx
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {classNames} from '../';
|
|
3
|
+
import type {ReactNode} from 'react';
|
|
4
|
+
import {classNames, createElement} from '../';
|
|
5
5
|
import {card} from './index.css';
|
|
6
6
|
|
|
7
|
-
const {createElement} = React;
|
|
8
|
-
|
|
9
7
|
export const Card = ({
|
|
10
8
|
children,
|
|
11
9
|
className,
|
|
12
10
|
}: {
|
|
13
|
-
children:
|
|
11
|
+
children: ReactNode;
|
|
14
12
|
className?: string;
|
|
15
13
|
}) => <div className={classNames(card, className)}>{children}</div>;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {ChevronDown, ChevronRight} from 'lucide-react';
|
|
5
|
-
import {Button} from '../Button/index.tsx';
|
|
6
|
-
import {
|
|
3
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
4
|
+
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
5
|
+
import { Button } from '../Button/index.tsx';
|
|
6
|
+
import {
|
|
7
|
+
classNames,
|
|
8
|
+
createElement,
|
|
9
|
+
useCallback,
|
|
10
|
+
useRef,
|
|
11
|
+
useState,
|
|
12
|
+
} from '../index.ts';
|
|
7
13
|
import {
|
|
8
14
|
useCollapsibleOpen,
|
|
9
15
|
useSetCollapsibleOpen,
|
|
10
|
-
} from '../
|
|
16
|
+
} from '../stores/SessionStore.tsx';
|
|
11
17
|
import {
|
|
12
18
|
button,
|
|
13
19
|
buttonOpen,
|
|
@@ -16,8 +22,6 @@ import {
|
|
|
16
22
|
content,
|
|
17
23
|
} from './index.css.ts';
|
|
18
24
|
|
|
19
|
-
const {createElement, useState, useCallback, useRef} = React;
|
|
20
|
-
|
|
21
25
|
export const Collapsible = ({
|
|
22
26
|
id = '',
|
|
23
27
|
icon: Icon,
|
|
@@ -27,11 +31,11 @@ export const Collapsible = ({
|
|
|
27
31
|
children,
|
|
28
32
|
}: {
|
|
29
33
|
id?: string;
|
|
30
|
-
icon?:
|
|
31
|
-
label?:
|
|
32
|
-
labelRight?:
|
|
34
|
+
icon?: ComponentType<{className?: string}>;
|
|
35
|
+
label?: ReactNode;
|
|
36
|
+
labelRight?: ReactNode;
|
|
33
37
|
className?: string;
|
|
34
|
-
children:
|
|
38
|
+
children: ReactNode;
|
|
35
39
|
}) => {
|
|
36
40
|
// State is in session Store if id is present, otherwise here in component.
|
|
37
41
|
const storedIsOpen = useCollapsibleOpen(id) ?? false;
|
|
@@ -42,7 +46,7 @@ export const Collapsible = ({
|
|
|
42
46
|
const setIsOpen = id ? setStoredIsOpen : setStateIsOpen;
|
|
43
47
|
|
|
44
48
|
const [render, setRender] = useState(isOpen);
|
|
45
|
-
const timer = useRef<Timer>();
|
|
49
|
+
const timer = useRef<NodeJS.Timer>();
|
|
46
50
|
|
|
47
51
|
const toggle = useCallback(() => {
|
|
48
52
|
setIsOpen(!isOpen);
|
package/src/Detail/index.tsx
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {classNames} from '../';
|
|
3
|
+
import type {ReactNode} from 'react';
|
|
4
|
+
import {classNames, createElement} from '../';
|
|
5
5
|
import {detailCell, detailRow, detailTable} from './index.css';
|
|
6
6
|
|
|
7
|
-
const {createElement} = React;
|
|
8
|
-
|
|
9
7
|
export const Detail = ({
|
|
10
8
|
data,
|
|
11
9
|
className,
|
|
12
10
|
}: {
|
|
13
|
-
data: Record<string,
|
|
11
|
+
data: Record<string, ReactNode>;
|
|
14
12
|
className?: string;
|
|
15
13
|
}) => {
|
|
16
14
|
return (
|
package/src/Hr/index.tsx
CHANGED
package/src/Metric/index.tsx
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {classNames} from '../';
|
|
3
|
+
import type {ComponentType, ReactNode} from 'react';
|
|
4
|
+
import {classNames, createElement} from '../';
|
|
5
5
|
import {iconSize} from '../index.css';
|
|
6
6
|
import {metric, metricLabel, metricNumber} from './index.css';
|
|
7
7
|
|
|
8
|
-
const {createElement} = React;
|
|
9
|
-
|
|
10
8
|
export const Metric = ({
|
|
11
9
|
icon: Icon,
|
|
12
10
|
label,
|
|
13
11
|
number,
|
|
14
12
|
className,
|
|
15
13
|
}: {
|
|
16
|
-
icon?:
|
|
17
|
-
label:
|
|
18
|
-
number:
|
|
14
|
+
icon?: ComponentType<{className?: string}>;
|
|
15
|
+
label: ReactNode;
|
|
16
|
+
number: ReactNode;
|
|
19
17
|
className?: string;
|
|
20
18
|
}) => (
|
|
21
19
|
<div className={classNames(metric, className)}>
|
package/src/Summary/index.tsx
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {classNames} from '../';
|
|
3
|
+
import type {ComponentType, ReactNode} from 'react';
|
|
4
|
+
import {classNames, createElement} from '../';
|
|
5
5
|
import {Avatar} from '../Avatar';
|
|
6
6
|
import {summary, summaryContent, summaryImage} from './index.css';
|
|
7
7
|
|
|
8
|
-
const {createElement} = React;
|
|
9
|
-
|
|
10
8
|
export const Summary = ({
|
|
11
9
|
icon: Icon,
|
|
12
10
|
src,
|
|
@@ -14,10 +12,10 @@ export const Summary = ({
|
|
|
14
12
|
children,
|
|
15
13
|
className,
|
|
16
14
|
}: {
|
|
17
|
-
icon?:
|
|
15
|
+
icon?: ComponentType<{className?: string}>;
|
|
18
16
|
src?: string;
|
|
19
|
-
label:
|
|
20
|
-
children:
|
|
17
|
+
label: ReactNode;
|
|
18
|
+
children: ReactNode;
|
|
21
19
|
className?: string;
|
|
22
20
|
}) => (
|
|
23
21
|
<div className={classNames(summary, className)}>
|
package/src/Tag/index.tsx
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {classNames} from '../';
|
|
3
|
+
import type {ComponentType, ReactNode} from 'react';
|
|
4
|
+
import {classNames, createElement} from '../';
|
|
5
5
|
import {Axis} from '../Axis';
|
|
6
6
|
import {tag, tagIcon, tagVariant} from './index.css';
|
|
7
7
|
|
|
8
|
-
const {createElement} = React;
|
|
9
|
-
|
|
10
8
|
export const Tag = ({
|
|
11
9
|
icon: Icon,
|
|
12
10
|
label,
|
|
13
11
|
title,
|
|
14
12
|
variant = 'default',
|
|
15
13
|
}: {
|
|
16
|
-
icon?:
|
|
17
|
-
label?:
|
|
14
|
+
icon?: ComponentType<{className?: string}>;
|
|
15
|
+
label?: ReactNode;
|
|
18
16
|
title?: string;
|
|
19
17
|
variant?: keyof typeof tagVariant;
|
|
20
18
|
}) => {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Moon, Sun, SunMoon } from 'lucide-react';
|
|
4
|
+
import { Button } from '../../../Button/index.tsx';
|
|
5
|
+
import { createElement } from '../../../index.ts';
|
|
6
6
|
import {
|
|
7
7
|
useDarkChoice,
|
|
8
8
|
useToggleDarkChoiceCallback,
|
|
9
|
-
} from '../../../LocalStore.tsx';
|
|
9
|
+
} from '../../../stores/LocalStore.tsx';
|
|
10
10
|
|
|
11
|
-
const {createElement} = React;
|
|
12
11
|
const icons = [Sun, Moon, SunMoon];
|
|
13
12
|
|
|
14
13
|
export const DarkButton = () => (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {style} from '@vanilla-extract/css';
|
|
2
|
-
import {dimensions, paddingLike, theme} from '
|
|
3
|
-
import {large} from '
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { dimensions, paddingLike, theme } from '../../../index.css.ts';
|
|
3
|
+
import { large } from '../../../index.ts';
|
|
4
4
|
|
|
5
5
|
export const sideNav = style([
|
|
6
6
|
paddingLike,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {classNames} from '
|
|
5
|
-
import {useSideNavOpen} from '../../../SessionStore.tsx';
|
|
6
|
-
import {open, sideNav} from './index.css.ts';
|
|
7
|
-
|
|
8
|
-
const {createElement} = React;
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import { classNames, createElement } from '../../../index.ts';
|
|
5
|
+
import { useSideNavOpen } from '../../../stores/SessionStore.tsx';
|
|
6
|
+
import { open, sideNav } from './index.css.ts';
|
|
9
7
|
|
|
10
8
|
export const SideNav = ({sideNav: sideNavComponents}: {sideNav: ReactNode}) => {
|
|
11
9
|
return (
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @jsx createElement */
|
|
2
|
+
|
|
3
|
+
import { Menu, X } from 'lucide-react';
|
|
4
|
+
import { Button } from '../../../Button/index.tsx';
|
|
5
|
+
import { createElement } from '../../../index.ts';
|
|
6
|
+
import {
|
|
7
|
+
useSideNavOpen,
|
|
8
|
+
useToggleSideNavOpen,
|
|
9
|
+
} from '../../../stores/SessionStore.tsx';
|
|
10
|
+
import { sideNavButton } from './index.css.ts';
|
|
11
|
+
|
|
12
|
+
export const SideNavButton = () => (
|
|
13
|
+
<Button
|
|
14
|
+
variant="icon"
|
|
15
|
+
onClick={useToggleSideNavOpen()}
|
|
16
|
+
icon={useSideNavOpen() ? X : Menu}
|
|
17
|
+
className={sideNavButton}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {style} from '@vanilla-extract/css';
|
|
2
|
-
import {dimensions} from '
|
|
3
|
-
import {large} from '
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { dimensions } from '../../../index.css.ts';
|
|
3
|
+
import { large } from '../../../index.ts';
|
|
4
4
|
|
|
5
5
|
export const title = style({
|
|
6
6
|
display: 'flex',
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const {createElement} = React;
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
import { createElement } from '../../../index.ts';
|
|
5
|
+
import { title } from './index.css.ts';
|
|
7
6
|
|
|
8
7
|
export const Title = ({title: titleComponents}: {title: ReactNode}) => {
|
|
9
8
|
return <nav className={title}>{titleComponents}</nav>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const {createElement} = React;
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { createElement } from '../../../index.ts';
|
|
5
|
+
import { topNav } from './index.css.ts';
|
|
7
6
|
|
|
8
7
|
export const TopNav = ({
|
|
9
8
|
topNavLeft = <div />,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {style} from '@vanilla-extract/css';
|
|
2
|
-
import {axisLike, dimensions, paddingLike, theme} from '
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { axisLike, dimensions, paddingLike, theme } from '../../index.css';
|
|
3
3
|
|
|
4
4
|
export const header = style([
|
|
5
5
|
paddingLike,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
const {createElement} = React;
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { createElement } from '../../index.ts';
|
|
5
|
+
import { DarkButton } from './DarkButton/index.tsx';
|
|
6
|
+
import { header } from './index.css.ts';
|
|
7
|
+
import { SideNav } from './SideNav/index.tsx';
|
|
8
|
+
import { SideNavButton } from './SideNavButton/index.tsx';
|
|
9
|
+
import { Title } from './Title/index.tsx';
|
|
10
|
+
import { TopNav } from './TopNav/index.tsx';
|
|
12
11
|
|
|
13
12
|
export const Header = ({
|
|
14
13
|
title,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {style} from '@vanilla-extract/css';
|
|
2
|
-
import {dimensions, paddingLike} from '
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { dimensions, paddingLike } from '../../../index.css';
|
|
3
3
|
|
|
4
4
|
export const article = style([
|
|
5
5
|
paddingLike,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const {createElement} = React;
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { createElement } from '../../../index.ts';
|
|
5
|
+
import { article } from './index.css.ts';
|
|
7
6
|
|
|
8
7
|
export const Article = ({article: articleComponents}: {article: ReactNode}) => {
|
|
9
8
|
return <article className={article}>{articleComponents}</article>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {style} from '@vanilla-extract/css';
|
|
2
|
-
import {axisLike, dimensions, paddingLike, theme} from '
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { axisLike, dimensions, paddingLike, theme } from '../../../index.css';
|
|
3
3
|
|
|
4
4
|
export const footer = style([
|
|
5
5
|
{
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const {createElement} = React;
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { createElement } from '../../../index.ts';
|
|
5
|
+
import { footer } from './index.css.ts';
|
|
7
6
|
|
|
8
7
|
export const Footer = ({footer: footerComponents}: {footer: ReactNode}) => {
|
|
9
8
|
return <footer className={footer}>{footerComponents}</footer>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {style} from '@vanilla-extract/css';
|
|
2
|
-
import {dimensions, theme} from '
|
|
3
|
-
import {large} from '
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
|
+
import { dimensions, theme } from '../../index.css.ts';
|
|
3
|
+
import { large } from '../../index.ts';
|
|
4
4
|
|
|
5
5
|
export const main = style({
|
|
6
6
|
display: 'flex',
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {classNames} from '
|
|
5
|
-
import {Article} from './Article/index.tsx';
|
|
6
|
-
import {Footer} from './Footer/index.tsx';
|
|
7
|
-
import {main, mainHasSideNav} from './index.css.ts';
|
|
8
|
-
|
|
9
|
-
const {createElement} = React;
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { classNames, createElement } from '../../index.ts';
|
|
5
|
+
import { Article } from './Article/index.tsx';
|
|
6
|
+
import { Footer } from './Footer/index.tsx';
|
|
7
|
+
import { main, mainHasSideNav } from './index.css.ts';
|
|
10
8
|
|
|
11
9
|
export const Main = ({
|
|
12
10
|
article,
|
package/src/Ui/index.tsx
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
/** @jsx createElement */
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { themeDark, themeLight } from '../index.css.ts';
|
|
5
|
+
import { classNames, createElement } from '../index.ts';
|
|
6
|
+
import { useDarkChoice, useDarkPreference } from '../stores/LocalStore.tsx';
|
|
7
|
+
import { Header } from './Header/index.tsx';
|
|
8
|
+
import { ui } from './index.css.ts';
|
|
9
|
+
import { Main } from './Main/index.tsx';
|
|
8
10
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
export const Ui = ({
|
|
12
|
+
title,
|
|
13
|
+
topNavLeft,
|
|
14
|
+
topNavRight,
|
|
15
|
+
sideNav,
|
|
16
|
+
article,
|
|
17
|
+
footer,
|
|
18
|
+
}: {
|
|
12
19
|
title: ReactNode;
|
|
13
20
|
topNavLeft?: ReactNode;
|
|
14
21
|
topNavRight?: ReactNode;
|
|
@@ -16,11 +23,28 @@ export const Ui = (props: {
|
|
|
16
23
|
article?: ReactNode;
|
|
17
24
|
footer?: ReactNode;
|
|
18
25
|
}) => {
|
|
26
|
+
const darkPreference = useDarkPreference();
|
|
27
|
+
const darkChoice = useDarkChoice();
|
|
19
28
|
return (
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
<div
|
|
30
|
+
className={classNames(
|
|
31
|
+
ui,
|
|
32
|
+
darkChoice == 1 || (darkChoice == 2 && darkPreference)
|
|
33
|
+
? themeDark
|
|
34
|
+
: themeLight,
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
<Header
|
|
38
|
+
title={title}
|
|
39
|
+
topNavLeft={topNavLeft}
|
|
40
|
+
topNavRight={topNavRight}
|
|
41
|
+
sideNav={sideNav}
|
|
42
|
+
/>
|
|
43
|
+
<Main
|
|
44
|
+
article={article}
|
|
45
|
+
footer={footer}
|
|
46
|
+
hasSideNav={sideNav ? true : false}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
25
49
|
);
|
|
26
50
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type {StyleRule} from '@vanilla-extract/css';
|
|
2
3
|
|
|
3
4
|
const LARGE = 'screen and (min-width: 1000px)';
|
|
4
5
|
|
|
6
|
+
export const {
|
|
7
|
+
createElement,
|
|
8
|
+
Fragment,
|
|
9
|
+
useEffect,
|
|
10
|
+
useRef,
|
|
11
|
+
useState,
|
|
12
|
+
useCallback,
|
|
13
|
+
forwardRef,
|
|
14
|
+
} = React;
|
|
15
|
+
|
|
5
16
|
export const large = (style: StyleRule) => ({
|
|
6
17
|
'@media': {
|
|
7
18
|
[LARGE]: style,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {createStore} from 'tinybase';
|
|
4
|
-
import {createLocalPersister} from 'tinybase/persisters/persister-browser';
|
|
1
|
+
import { createStore } from 'tinybase';
|
|
2
|
+
import { createLocalPersister } from 'tinybase/persisters/persister-browser';
|
|
5
3
|
import {
|
|
6
4
|
useCreatePersister,
|
|
7
5
|
useCreateStore,
|
|
@@ -9,8 +7,7 @@ import {
|
|
|
9
7
|
useSetValueCallback,
|
|
10
8
|
useValue,
|
|
11
9
|
} from 'tinybase/ui-react';
|
|
12
|
-
|
|
13
|
-
const {useEffect} = React;
|
|
10
|
+
import { useEffect } from '../';
|
|
14
11
|
|
|
15
12
|
const PREFERS_DARK = matchMedia?.('(prefers-color-scheme: dark)');
|
|
16
13
|
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @jsx createElement */
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {Menu, X} from 'lucide-react';
|
|
4
|
-
import {Button} from '../../../../Button/index.tsx';
|
|
5
|
-
import {useSideNavOpen, useToggleSideNavOpen} from '../../../SessionStore.tsx';
|
|
6
|
-
import {sideNavButton} from './index.css';
|
|
7
|
-
|
|
8
|
-
const {createElement} = React;
|
|
9
|
-
|
|
10
|
-
export const SideNavButton = () => (
|
|
11
|
-
<Button
|
|
12
|
-
variant="icon"
|
|
13
|
-
onClick={useToggleSideNavOpen()}
|
|
14
|
-
icon={useSideNavOpen() ? X : Menu}
|
|
15
|
-
className={sideNavButton}
|
|
16
|
-
/>
|
|
17
|
-
);
|
package/src/Ui/Layout/index.tsx
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/** @jsx createElement */
|
|
2
|
-
|
|
3
|
-
import React, {type ReactNode} from 'react';
|
|
4
|
-
import {themeDark, themeLight} from '../../index.css.ts';
|
|
5
|
-
import {classNames} from '../../index.ts';
|
|
6
|
-
import {useDarkChoice, useDarkPreference} from '../LocalStore.tsx';
|
|
7
|
-
import {Header} from './Header/index.tsx';
|
|
8
|
-
import {layout} from './index.css.ts';
|
|
9
|
-
import {Main} from './Main/index.tsx';
|
|
10
|
-
|
|
11
|
-
const {createElement} = React;
|
|
12
|
-
|
|
13
|
-
export const Layout = ({
|
|
14
|
-
title,
|
|
15
|
-
topNavLeft,
|
|
16
|
-
topNavRight,
|
|
17
|
-
sideNav,
|
|
18
|
-
article,
|
|
19
|
-
footer,
|
|
20
|
-
}: {
|
|
21
|
-
title: ReactNode;
|
|
22
|
-
topNavLeft?: ReactNode;
|
|
23
|
-
topNavRight?: ReactNode;
|
|
24
|
-
sideNav?: ReactNode;
|
|
25
|
-
article?: ReactNode;
|
|
26
|
-
footer?: ReactNode;
|
|
27
|
-
}) => {
|
|
28
|
-
const darkPreference = useDarkPreference();
|
|
29
|
-
const darkChoice = useDarkChoice();
|
|
30
|
-
return (
|
|
31
|
-
<div
|
|
32
|
-
className={classNames(
|
|
33
|
-
layout,
|
|
34
|
-
darkChoice == 1 || (darkChoice == 2 && darkPreference)
|
|
35
|
-
? themeDark
|
|
36
|
-
: themeLight,
|
|
37
|
-
)}
|
|
38
|
-
>
|
|
39
|
-
<Header
|
|
40
|
-
title={title}
|
|
41
|
-
topNavLeft={topNavLeft}
|
|
42
|
-
topNavRight={topNavRight}
|
|
43
|
-
sideNav={sideNav}
|
|
44
|
-
/>
|
|
45
|
-
<Main
|
|
46
|
-
article={article}
|
|
47
|
-
footer={footer}
|
|
48
|
-
hasSideNav={sideNav ? true : false}
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
File without changes
|