tinywidgets 1.1.2 → 1.1.4

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/README.md CHANGED
@@ -15,6 +15,35 @@ TinyWidgets uses [React](https://react.dev/) for DOM manipulation, [Vanilla-Extr
15
15
 
16
16
  But, just to be clear - that doesn't mean you need to use Vanilla-Extract, Lucide, or Tinybase in the apps you build with these widgets. You can set arbitrary class names (from Tailwind, for example!) on all components if you like.
17
17
 
18
+ ## Meet the family
19
+
20
+ TinyTick is part of a group of small libraries designed to help make rich client and local-first apps easier to build. Check out the others!
21
+
22
+ <p>
23
+ <a href='https://tinybase.org' target='_blank'>
24
+ <img width="48" src="https://tinybase.org/favicon.svg" />
25
+ <br/>
26
+ <b>TinyBase</b>
27
+ </a>
28
+ <br />The reactive data store for local-first apps.<br />
29
+ </p>
30
+
31
+ <p>
32
+ <img width="48" src="https://tinywidgets.org/favicon.svg" />
33
+ <br/>
34
+ <b>TinyWidgets</b>
35
+ <br />A collection of tiny, reusable, UI components.<br />
36
+ </p>
37
+
38
+ <p>
39
+ <a href='https://tinytick.org' target='_blank'>
40
+ <img width="48" src="https://tinytick.org/favicon.svg" />
41
+ <br />
42
+ <b>TinyTick</b>
43
+ </a>
44
+ <br />A tiny but very useful task orchestrator.<br />
45
+ </p>
46
+
18
47
  ## Help out!
19
48
 
20
49
  This project was created because [I](https://github.com/jamesgpearce) want to be able to build lots of local-first apps quickly and without the overhead of all the app boilerplate each time.
package/bun.lockb CHANGED
Binary file
@@ -0,0 +1,186 @@
1
+ import jsLint from '@eslint/js';
2
+ import importLint from 'eslint-plugin-import';
3
+ import reactLint from 'eslint-plugin-react';
4
+ import hooksLint from 'eslint-plugin-react-hooks';
5
+ import {globalIgnores} from 'eslint/config';
6
+ import globals from 'globals';
7
+ import tsLint from 'typescript-eslint';
8
+
9
+ export default tsLint.config(
10
+ globalIgnores([
11
+ 'eslint.config.js',
12
+ 'docs/**/*',
13
+ 'dist/**/*',
14
+ 'tmp/**/*',
15
+ 'site/extras/*',
16
+ '**/node_modules/**/*',
17
+ ]),
18
+
19
+ jsLint.configs.recommended,
20
+ importLint.flatConfigs.recommended,
21
+ reactLint.configs.flat.recommended,
22
+ reactLint.configs.flat['jsx-runtime'],
23
+ hooksLint.configs['recommended-latest'],
24
+ tsLint.configs.recommended,
25
+
26
+ {
27
+ settings: {
28
+ react: {version: 'detect'},
29
+ 'import/resolver': {node: {extensions: ['.js', '.jsx', '.ts', '.tsx']}},
30
+ 'import/core-modules': ['expo-sqlite'],
31
+ },
32
+
33
+ languageOptions: {globals: {...globals.node, ...globals.browser}},
34
+
35
+ rules: {
36
+ 'no-var': 2,
37
+ 'no-console': 2,
38
+ 'object-curly-spacing': [2, 'never'],
39
+ indent: 0,
40
+ 'no-empty': [2, {allowEmptyCatch: true}],
41
+ 'linebreak-style': [2, 'unix'],
42
+ 'space-infix-ops': 2,
43
+ quotes: [2, 'single', {allowTemplateLiterals: true}],
44
+ semi: [2, 'always'],
45
+ 'sort-keys': 0,
46
+ 'no-multiple-empty-lines': [2, {max: 1}],
47
+ 'sort-imports': 0,
48
+ 'max-len': [
49
+ 2,
50
+ {
51
+ code: 80,
52
+ ignorePattern:
53
+ '^(\\s+\\* )?(imports?|exports?|\\} from|(.+ as .+))\\W.*',
54
+ ignoreUrls: true,
55
+ },
56
+ ],
57
+ 'comma-dangle': [
58
+ 2,
59
+ {
60
+ arrays: 'always-multiline',
61
+ objects: 'always-multiline',
62
+ imports: 'always-multiline',
63
+ exports: 'always-multiline',
64
+ functions: 'always-multiline',
65
+ },
66
+ ],
67
+ 'import/no-unresolved': [
68
+ 2,
69
+ {
70
+ ignore: [
71
+ '^\\./generated/client$',
72
+ '^custom-remote-handlers$',
73
+ '^electric-sql/(client/model|notifiers|wa-sqlite)$',
74
+ '^cloudflare:workers$',
75
+ 'eslint/config',
76
+ 'typescript-eslint',
77
+ ],
78
+ },
79
+ ],
80
+
81
+ // --
82
+
83
+ '@typescript-eslint/unified-signatures': 0,
84
+ '@typescript-eslint/no-invalid-void-type': 0,
85
+ '@typescript-eslint/no-dynamic-delete': 0,
86
+ '@typescript-eslint/no-var-requires': 0,
87
+ '@typescript-eslint/no-explicit-any': 0,
88
+ '@typescript-eslint/no-unused-vars': [
89
+ 2,
90
+ {argsIgnorePattern: '^_.*', varsIgnorePattern: '^(_.*|React)'},
91
+ ],
92
+
93
+ // --
94
+
95
+ 'jsx-quotes': [2, 'prefer-double'],
96
+
97
+ 'react/button-has-type': 0,
98
+ 'react/destructuring-assignment': 0,
99
+ 'react/display-name': 0,
100
+ 'react/forbid-component-props': 0,
101
+ 'react/jsx-boolean-value': 0,
102
+ 'react/jsx-filename-extension': 0,
103
+ 'react/jsx-first-prop-new-line': [2, 'multiline'],
104
+ 'react/jsx-indent-props': [2, 2],
105
+ 'react/jsx-indent': 0,
106
+ 'react/jsx-max-depth': [2, {max: 5}],
107
+ 'react/jsx-max-props-per-line': [2, {maximum: 1, when: 'multiline'}],
108
+ 'react/jsx-newline': 0,
109
+ 'react/jsx-no-literals': 0,
110
+ 'react/jsx-one-expression-per-line': 0,
111
+ 'react/jsx-props-no-spreading': 0,
112
+ 'react/jsx-sort-props': 0,
113
+ 'react/no-arrow-function-lifecycle': 2,
114
+ 'react/no-find-dom-node': 0,
115
+ 'react/no-multi-comp': [2, {ignoreStateless: true}],
116
+ 'react/no-set-state': 0,
117
+ 'react/no-unsafe': 2,
118
+ 'react/prop-types': 2,
119
+ 'react/require-default-props': 0,
120
+ 'react/sort-comp': 0,
121
+ 'react/jsx-handler-names': [
122
+ 2,
123
+ {eventHandlerPrefix: '_handle', eventHandlerPropPrefix: 'on'},
124
+ ],
125
+ 'react/function-component-definition': [
126
+ 2,
127
+ {
128
+ namedComponents: 'arrow-function',
129
+ unnamedComponents: 'arrow-function',
130
+ },
131
+ ],
132
+ 'react/jsx-no-useless-fragment': 2,
133
+
134
+ // --
135
+
136
+ 'react-hooks/exhaustive-deps': 2,
137
+ 'react-hooks/rules-of-hooks': 2,
138
+ },
139
+ },
140
+
141
+ {
142
+ files: ['src/@types/**/*.js'],
143
+ settings: {jsdoc: {mode: 'typescript', contexts: ['any']}},
144
+ rules: {
145
+ 'jsdoc/check-tag-names': [
146
+ 2,
147
+ {definedTags: ['category', 'packageDocumentation']},
148
+ ],
149
+ 'jsdoc/no-restricted-syntax': [
150
+ 2,
151
+ {
152
+ contexts: [
153
+ {
154
+ comment:
155
+ // eslint-disable-next-line max-len
156
+ 'JsdocBlock:not(:has(JsdocTag[tag=/category|packageDocumentation/]))',
157
+ message: 'Every non-module block requires a @category tag',
158
+ },
159
+ {
160
+ comment: 'JsdocBlock:not(:has(JsdocTag[tag=since]))',
161
+ message: 'Every block requires a @since tag',
162
+ },
163
+ {
164
+ comment:
165
+ 'JsdocBlock:has(JsdocTag[tag=since] ~ JsdocTag[tag=since])',
166
+ message: 'Every block must have only one @since tag',
167
+ },
168
+ ],
169
+ },
170
+ ],
171
+ 'jsdoc/require-jsdoc': 2,
172
+ 'jsdoc/require-description': 2,
173
+ 'jsdoc/require-description-complete-sentence': 2,
174
+ 'jsdoc/require-returns-description': 2,
175
+ 'jsdoc/no-blank-blocks': 2,
176
+ 'jsdoc/require-param-type': 0,
177
+ 'jsdoc/require-returns-type': 0,
178
+ 'jsdoc/check-param-names': 0,
179
+ },
180
+ },
181
+
182
+ {
183
+ files: ['eslint.config.js'],
184
+ extends: [tsLint.configs.disableTypeChecked],
185
+ },
186
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinywidgets",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "author": "jamesgpearce",
5
5
  "repository": "github:tinyplex/tinywidgets",
6
6
  "license": "MIT",
@@ -16,31 +16,31 @@
16
16
  ],
17
17
  "type": "module",
18
18
  "scripts": {
19
- "prePublishPackage": "eslint . && cspell --quiet . && tsc && cp ../README.md ./README.md"
19
+ "prePublishPackage": "prettier -l . && eslint . && cspell --quiet . && tsc && cp ../README.md ./README.md"
20
20
  },
21
21
  "devDependencies": {
22
- "@types/react": "^18.3.11",
23
- "@types/react-dom": "^18.3.0",
24
- "@typescript-eslint/eslint-plugin": "^8.17.0",
25
- "@typescript-eslint/parser": "^8.17.0",
26
- "cspell": "^8.16.1",
27
- "eslint": "^8.57.0",
28
- "eslint-config-prettier": "^9.1.0",
29
- "eslint-plugin-react": "^7.37.2",
30
- "eslint-plugin-react-hooks": "^5.1.0",
31
- "eslint-plugin-react-refresh": "^0.4.16",
32
- "prettier": "^3.4.2",
33
- "typescript": "^5.7.2"
22
+ "@types/react": "^19.0.12",
23
+ "cspell": "^8.18.1",
24
+ "eslint": "^9.23.0",
25
+ "eslint-plugin-react": "^7.37.4",
26
+ "eslint-plugin-react-hooks": "^5.2.0",
27
+ "prettier": "^3.5.3",
28
+ "typescript": "^5.8.2"
34
29
  },
35
30
  "exports": {
36
31
  ".": "./src/index.ts",
37
32
  "./css": "./src/index.css.ts"
38
33
  },
39
34
  "dependencies": {
40
- "@vanilla-extract/css": "^1.16.1",
41
- "lucide-react": "^0.468.0",
42
- "react": "^18.3.1",
43
- "react-dom": "^18.3.1",
44
- "tinybase": "^5.4.2"
35
+ "@eslint/js": "^9.23.0",
36
+ "@trivago/prettier-plugin-sort-imports": "^5.2.2",
37
+ "@vanilla-extract/css": "^1.17.1",
38
+ "eslint-plugin-import": "^2.31.0",
39
+ "globals": "^16.0.0",
40
+ "lucide-react": "^0.485.0",
41
+ "react": "^19.1.0",
42
+ "react-dom": "^19.1.0",
43
+ "tinybase": "^6.0.0",
44
+ "typescript-eslint": "^8.28.0"
45
45
  }
46
- }
46
+ }
@@ -1,6 +1,6 @@
1
- import React, {type ComponentType, type ReactNode} from 'react';
2
- import type {StyleRule} from '@vanilla-extract/css';
3
1
  import {screens} from '../css/screens';
2
+ import type {StyleRule} from '@vanilla-extract/css';
3
+ import React, {type ComponentType, type ReactNode} from 'react';
4
4
 
5
5
  /**
6
6
  * The `classNames` function returns a concatenated list of class names,
@@ -1,6 +1,6 @@
1
- import {dimensions, dimensionsClass} from '../../css/dimensions.css.ts';
2
- import {colors} from '../../css/colors.css.ts';
3
1
  import {large} from '../../common/functions.tsx';
2
+ import {colors} from '../../css/colors.css.ts';
3
+ import {dimensions, dimensionsClass} from '../../css/dimensions.css.ts';
4
4
  import {style} from '@vanilla-extract/css';
5
5
 
6
6
  export const app = style([dimensionsClass, {color: colors.foreground}]);
@@ -1,5 +1,6 @@
1
- import * as UiReact from 'tinybase/ui-react/with-schemas';
2
- import type {ComponentType, ReactNode} from 'react';
1
+ import {classNames, renderComponentOrNode} from '../../common/functions.tsx';
2
+ import {codeDark, codeLight} from '../../css/code.css.ts';
3
+ import {colorsDark, colorsLight} from '../../css/colors.css.ts';
3
4
  import {
4
5
  LocalStore,
5
6
  useDark,
@@ -7,7 +8,6 @@ import {
7
8
  useLocalStoreIsReady,
8
9
  useToggleDarkChoiceCallback,
9
10
  } from '../../stores/LocalStore.tsx';
10
- import {Menu, Moon, Sun, SunMoon, X} from 'lucide-react';
11
11
  import {RouteStore, useRouteStoreIsReady} from '../../stores/RouteStore.tsx';
12
12
  import {
13
13
  SessionStore,
@@ -15,6 +15,7 @@ import {
15
15
  useSideNavIsOpen,
16
16
  useToggleSideNavIsOpenCallback,
17
17
  } from '../../stores/SessionStore.tsx';
18
+ import {Button} from '../Button/index.tsx';
18
19
  import {
19
20
  app,
20
21
  appLayout,
@@ -27,12 +28,11 @@ import {
27
28
  title,
28
29
  topNav,
29
30
  } from './index.css.ts';
30
- import {classNames, renderComponentOrNode} from '../../common/functions.tsx';
31
- import {codeDark, codeLight} from '../../css/code.css.ts';
32
- import {colorsDark, colorsLight} from '../../css/colors.css.ts';
33
- import {Button} from '../Button/index.tsx';
34
- import {OptionalSchemas} from 'tinybase/with-schemas';
31
+ import {Menu, Moon, Sun, SunMoon, X} from 'lucide-react';
32
+ import type {ComponentType, ReactNode} from 'react';
35
33
  import React from 'react';
34
+ import * as UiReact from 'tinybase/ui-react/with-schemas';
35
+ import type {OptionalSchemas} from 'tinybase/with-schemas';
36
36
 
37
37
  const {Provider} = UiReact as UiReact.WithSchemas<OptionalSchemas>;
38
38
 
@@ -1,6 +1,6 @@
1
- import {style, styleVariants} from '@vanilla-extract/css';
2
1
  import {colors} from '../../css/colors.css';
3
2
  import {dimensions} from '../../css/dimensions.css';
3
+ import {style, styleVariants} from '@vanilla-extract/css';
4
4
 
5
5
  export const button = style({
6
6
  display: 'inline-flex',
@@ -1,5 +1,5 @@
1
- import type {ComponentType, ReactNode, Ref} from 'react';
2
- import React, {forwardRef, useCallback} from 'react';
1
+ import {classNames, renderComponentOrNode} from '../../common/functions.tsx';
2
+ import {iconSize} from '../../css/dimensions.css.ts';
3
3
  import {
4
4
  button,
5
5
  buttonVariants,
@@ -7,8 +7,8 @@ import {
7
7
  titleStyle,
8
8
  titleStyleRight,
9
9
  } from './index.css.ts';
10
- import {classNames, renderComponentOrNode} from '../../common/functions.tsx';
11
- import {iconSize} from '../../css/dimensions.css.ts';
10
+ import type {ComponentType, ReactNode, Ref} from 'react';
11
+ import React, {forwardRef, useCallback} from 'react';
12
12
 
13
13
  /**
14
14
  * The `Button` component displays an button, with a number of common variants.
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import type {ReactNode} from 'react';
3
- import {card} from './index.css';
4
1
  import {classNames} from '../../common/functions';
2
+ import {card} from './index.css';
3
+ import type {ReactNode} from 'react';
4
+ import React from 'react';
5
5
 
6
6
  /**
7
7
  * The `Card` component displays a simple rectangular container.
@@ -1,7 +1,7 @@
1
- import {globalStyle, style} from '@vanilla-extract/css';
2
1
  import {code} from '../../css/code.css';
3
2
  import {colors} from '../../css/colors.css';
4
3
  import {dimensions} from '../../css/dimensions.css';
4
+ import {globalStyle, style} from '@vanilla-extract/css';
5
5
 
6
6
  export const pre = style({
7
7
  padding: dimensions.padding,
@@ -1,7 +1,6 @@
1
- /* eslint-disable max-len */
2
- import React from 'react';
3
1
  import {classNames} from '../../common/functions.tsx';
4
2
  import {pre} from './index.css.ts';
3
+ import React from 'react';
5
4
 
6
5
  /**
7
6
  * The `Code` component displays a block of pre-formatted code, and uses PrismJS
@@ -81,11 +80,10 @@ export const Code = ({
81
80
  */
82
81
  readonly className?: string;
83
82
  }) => {
84
- const prism = globalThis.Prism;
83
+ const prism = (globalThis as any).Prism;
85
84
  return (
86
85
  <pre className={classNames(pre, className)}>
87
86
  <code
88
- // eslint-disable-next-line react/no-danger
89
87
  dangerouslySetInnerHTML={{
90
88
  __html: (prism
91
89
  ? prism.highlight(code, prism.languages?.[language], language)
@@ -1,6 +1,9 @@
1
- import {ChevronDown, ChevronRight} from 'lucide-react';
2
- import type {ComponentType, ReactNode} from 'react';
3
- import React, {useCallback, useRef, useState} from 'react';
1
+ import {classNames} from '../../common/functions.tsx';
2
+ import {
3
+ useCollapsibleIsOpen,
4
+ useSetCollapsibleIsOpenCallback,
5
+ } from '../../stores/SessionStore.tsx';
6
+ import {Button} from '../Button/index.tsx';
4
7
  import {
5
8
  button,
6
9
  buttonOpen,
@@ -8,12 +11,9 @@ import {
8
11
  collapsibleOpen,
9
12
  content,
10
13
  } from './index.css.ts';
11
- import {
12
- useCollapsibleIsOpen,
13
- useSetCollapsibleIsOpenCallback,
14
- } from '../../stores/SessionStore.tsx';
15
- import {Button} from '../Button/index.tsx';
16
- import {classNames} from '../../common/functions.tsx';
14
+ import {ChevronDown, ChevronRight} from 'lucide-react';
15
+ import type {ComponentType, ReactNode} from 'react';
16
+ import React, {useCallback, useRef, useState} from 'react';
17
17
 
18
18
  /**
19
19
  * The `Collapsible` component displays a titled box that can be expanded or
@@ -105,7 +105,7 @@ export const Collapsible = ({
105
105
  const setIsOpen = id ? setStoredIsOpen : setStateIsOpen;
106
106
 
107
107
  const [render, setRender] = useState(isOpen);
108
- const timer = useRef<ReturnType<typeof setTimeout>>();
108
+ const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
109
109
 
110
110
  const toggle = useCallback(() => {
111
111
  setIsOpen(!isOpen);
@@ -1,7 +1,7 @@
1
+ import {classNames} from '../../common/functions';
1
2
  import {detailCell, detailRow, detailTable} from './index.css';
2
- import React from 'react';
3
3
  import type {ReactNode} from 'react';
4
- import {classNames} from '../../common/functions';
4
+ import React from 'react';
5
5
 
6
6
  /**
7
7
  * The `Detail` component displays a set of key-value pairs in a two-column
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
1
  import {classNames} from '../../common/functions';
3
2
  import {hr} from './index.css';
3
+ import React from 'react';
4
4
 
5
5
  /**
6
6
  * The `Hr` component displays a styled horizontal rule.
@@ -21,6 +21,4 @@ export const Hr = ({
21
21
  * An extra CSS class name for the component.
22
22
  */
23
23
  readonly className?: string;
24
- }) => {
25
- return <hr className={classNames(hr, className)} />;
26
- };
24
+ }) => <hr className={classNames(hr, className)} />;
@@ -1,6 +1,6 @@
1
- import {style, styleVariants} from '@vanilla-extract/css';
2
1
  import {colors} from '../../css/colors.css';
3
2
  import {dimensions} from '../../css/dimensions.css';
3
+ import {style, styleVariants} from '@vanilla-extract/css';
4
4
 
5
5
  export const image = style({
6
6
  display: 'inline-block',
@@ -1,6 +1,6 @@
1
- import React, {useCallback} from 'react';
2
- import {clickable, image, imageVariants} from './index.css.ts';
3
1
  import {classNames} from '../../common/functions.tsx';
2
+ import {clickable, image, imageVariants} from './index.css.ts';
3
+ import React, {useCallback} from 'react';
4
4
 
5
5
  /**
6
6
  * The `Image` component displays an image, with a number of common variants.
@@ -1,8 +1,8 @@
1
- import type {ComponentType, ReactNode} from 'react';
2
1
  import {classNames, renderComponentOrNode} from '../../common/functions';
2
+ import {iconSize} from '../../css/dimensions.css';
3
3
  import {metric, metricLabel, metricNumber} from './index.css';
4
+ import type {ComponentType, ReactNode} from 'react';
4
5
  import React from 'react';
5
- import {iconSize} from '../../css/dimensions.css';
6
6
 
7
7
  /**
8
8
  * The `Metric` component displays a metric as a prominent numerical value with
@@ -1,6 +1,6 @@
1
- import {style, styleVariants} from '@vanilla-extract/css';
2
- import {dimensions} from '../../css/dimensions.css.ts';
3
1
  import {notLarge} from '../../common/functions.tsx';
2
+ import {dimensions} from '../../css/dimensions.css.ts';
3
+ import {style, styleVariants} from '@vanilla-extract/css';
4
4
 
5
5
  export const row = style({
6
6
  display: 'grid',
@@ -1,7 +1,7 @@
1
+ import {classNames} from '../../common/functions';
1
2
  import {row, rowVariants} from './index.css';
2
- import React from 'react';
3
3
  import type {ReactNode} from 'react';
4
- import {classNames} from '../../common/functions';
4
+ import React from 'react';
5
5
 
6
6
  /**
7
7
  * The `Row` component displays a row of 'cell' components, with a number of
@@ -1,5 +1,5 @@
1
- import {dimensions} from '../../css/dimensions.css.ts';
2
1
  import {notLarge} from '../../common/functions.tsx';
2
+ import {dimensions} from '../../css/dimensions.css.ts';
3
3
  import {style} from '@vanilla-extract/css';
4
4
 
5
5
  export const summary = style({
@@ -1,8 +1,8 @@
1
- import type {ComponentType, ReactNode} from 'react';
2
- import {image, summary} from './index.css';
1
+ import {classNames} from '../../common/functions';
3
2
  import {Image} from '../Image';
3
+ import {image, summary} from './index.css';
4
+ import type {ComponentType, ReactNode} from 'react';
4
5
  import React from 'react';
5
- import {classNames} from '../../common/functions';
6
6
 
7
7
  /**
8
8
  * The `Summary` component displays an image on the left, and other content
@@ -1,5 +1,5 @@
1
- import {style, styleVariants} from '@vanilla-extract/css';
2
1
  import {colors} from '../../css/colors.css';
2
+ import {style, styleVariants} from '@vanilla-extract/css';
3
3
 
4
4
  export const tag = style({
5
5
  display: 'flex',
@@ -1,6 +1,6 @@
1
- import type {ComponentType, ReactNode} from 'react';
2
1
  import {classNames, renderComponentOrNode} from '../../common/functions';
3
2
  import {tag, tagIcon, tagVariants} from './index.css';
3
+ import type {ComponentType, ReactNode} from 'react';
4
4
  import React from 'react';
5
5
 
6
6
  /**
@@ -1,9 +1,3 @@
1
- import * as UiReact from 'tinybase/ui-react/with-schemas';
2
- import {
3
- Id,
4
- Store as StoreWithSchemas,
5
- createStore,
6
- } from 'tinybase/with-schemas';
7
1
  import React, {
8
2
  ReactNode,
9
3
  createContext,
@@ -12,14 +6,17 @@ import React, {
12
6
  useEffect,
13
7
  useRef,
14
8
  } from 'react';
9
+ import type {Store} from 'tinybase';
10
+ import {createLocalPersister} from 'tinybase/persisters/persister-browser/with-schemas';
11
+ import type {Persister} from 'tinybase/persisters/with-schemas';
15
12
  import {
16
13
  Provider as UiReactProvider,
17
14
  useStore,
18
15
  useStores,
19
16
  } from 'tinybase/ui-react';
20
- import {Persister} from 'tinybase/persisters/with-schemas';
21
- import {Store} from 'tinybase';
22
- import {createLocalPersister} from 'tinybase/persisters/persister-browser/with-schemas';
17
+ import * as UiReact from 'tinybase/ui-react/with-schemas';
18
+ import type {Id, Store as StoreWithSchemas} from 'tinybase/with-schemas';
19
+ import {createStore} from 'tinybase/with-schemas';
23
20
 
24
21
  export type Task =
25
22
  | ((
@@ -261,7 +258,7 @@ export const TasksProvider = ({
261
258
  const pendingAddedJobs = useRef<
262
259
  [taskId: string, arg?: string, storeId?: string][]
263
260
  >([]);
264
- const activePersister = useRef<Persister<Schemas> | undefined>();
261
+ const activePersister = useRef<Persister<Schemas> | undefined>(undefined);
265
262
 
266
263
  const tasksStore = useCreateStore(() =>
267
264
  createStore().setSchema(TABLES_SCHEMA, VALUES_SCHEMA),
@@ -1,4 +1,3 @@
1
- /* eslint-disable max-len */
2
1
  import {createTheme, createThemeContract} from '@vanilla-extract/css';
3
2
 
4
3
  /**
@@ -1,5 +1,5 @@
1
- import {globalStyle} from '@vanilla-extract/css';
2
1
  import {small} from '../common/functions';
2
+ import {globalStyle} from '@vanilla-extract/css';
3
3
 
4
4
  globalStyle('*', {
5
5
  margin: 0,
@@ -1,8 +1,8 @@
1
- import * as UiReact from 'tinybase/ui-react/with-schemas';
2
1
  import {CHANGE, READY, READY_SCHEMA} from './common';
3
- import {type NoTablesSchema, createStore} from 'tinybase/with-schemas';
4
2
  import {useCallback, useEffect} from 'react';
5
3
  import {createLocalPersister} from 'tinybase/persisters/persister-browser/with-schemas';
4
+ import * as UiReact from 'tinybase/ui-react/with-schemas';
5
+ import {type NoTablesSchema, createStore} from 'tinybase/with-schemas';
6
6
 
7
7
  const PREFERS_DARK = matchMedia?.('(prefers-color-scheme: dark)');
8
8
 
@@ -1,7 +1,7 @@
1
- import * as UiReact from 'tinybase/ui-react/with-schemas';
2
- import {type NoTablesSchema, createStore} from 'tinybase/with-schemas';
3
1
  import {READY, READY_SCHEMA} from './common';
4
2
  import {createCustomPersister} from 'tinybase/persisters/with-schemas';
3
+ import * as UiReact from 'tinybase/ui-react/with-schemas';
4
+ import {type NoTablesSchema, createStore} from 'tinybase/with-schemas';
5
5
 
6
6
  const ROUTE_STORE = 'tinywidgets/Route';
7
7
  const ROUTE = 'route';
@@ -1,6 +1,6 @@
1
- import * as UiReact from 'tinybase/ui-react/with-schemas';
2
1
  import {READY, READY_SCHEMA} from './common';
3
2
  import {createSessionPersister} from 'tinybase/persisters/persister-browser/with-schemas';
3
+ import * as UiReact from 'tinybase/ui-react/with-schemas';
4
4
  import {createStore} from 'tinybase/with-schemas';
5
5
 
6
6
  const SESSION_STORE = 'tinywidgets/Session';
package/.eslintrc.json DELETED
@@ -1,92 +0,0 @@
1
- {
2
- "parser": "@typescript-eslint/parser",
3
- "plugins": ["@typescript-eslint", "react", "react-hooks", "react-refresh"],
4
- "extends": [
5
- "eslint:recommended",
6
- "plugin:react/all",
7
- "plugin:react-hooks/recommended",
8
- "plugin:@typescript-eslint/eslint-recommended",
9
- "plugin:@typescript-eslint/recommended",
10
- "prettier"
11
- ],
12
- "env": {"browser": true, "es6": true, "node": true},
13
- "globals": {"page": true, "browser": true, "context": true},
14
- "parserOptions": {
15
- "ecmaVersion": 7,
16
- "ecmaFeatures": {
17
- "experimentalObjectRestSpread": true,
18
- "globalReturn": true,
19
- "jsx": true
20
- },
21
- "sourceType": "module"
22
- },
23
- "settings": {"react": {"version": "18.3.0"}},
24
- "rules": {
25
- "@typescript-eslint/no-explicit-any": 0,
26
- "@typescript-eslint/no-var-requires": 0,
27
- "@typescript-eslint/no-unused-vars": [
28
- 2,
29
- {"argsIgnorePattern": "^_.*", "varsIgnorePattern": "^_.*"}
30
- ],
31
- "max-len": [2, {"code": 80, "ignorePattern": "^(im|ex)ports?\\W.*"}],
32
- "no-var": 2,
33
- "no-console": 2,
34
- "object-curly-spacing": [2, "never"],
35
- "comma-dangle": [
36
- 2,
37
- {
38
- "arrays": "always-multiline",
39
- "objects": "always-multiline",
40
- "imports": "always-multiline",
41
- "exports": "always-multiline",
42
- "functions": "always-multiline"
43
- }
44
- ],
45
- "indent": 0,
46
- "no-empty": [2, {"allowEmptyCatch": true}],
47
- "linebreak-style": [2, "unix"],
48
- "space-infix-ops": 2,
49
- "quotes": [2, "single", {"allowTemplateLiterals": true}],
50
- "semi": [2, "always"],
51
- "sort-keys": 0,
52
- "sort-imports": 2,
53
- "no-multiple-empty-lines": [2, {"max": 1}],
54
- "react/function-component-definition": [
55
- 2,
56
- {
57
- "namedComponents": "arrow-function",
58
- "unnamedComponents": "arrow-function"
59
- }
60
- ],
61
- "react/no-multi-comp": [2, {"ignoreStateless": true}],
62
- "react/no-find-dom-node": 0,
63
- "react/no-set-state": 0,
64
- "react/no-unsafe": 2,
65
- "jsx-quotes": [2, "prefer-double"],
66
- "react-hooks/exhaustive-deps": 2,
67
- "react-hooks/rules-of-hooks": 2,
68
- "react/destructuring-assignment": 0,
69
- "react/display-name": 0,
70
- "react/jsx-boolean-value": 0,
71
- "react/jsx-filename-extension": 0,
72
- "react/jsx-first-prop-new-line": [2, "multiline"],
73
- "react/jsx-handler-names": [
74
- 2,
75
- {"eventHandlerPrefix": "_handle", "eventHandlerPropPrefix": "on"}
76
- ],
77
- "react/jsx-indent": 0,
78
- "react/jsx-indent-props": [2, 2],
79
- "react/jsx-max-depth": [2, {"max": 5}],
80
- "react/jsx-max-props-per-line": [2, {"maximum": 1, "when": "multiline"}],
81
- "react/jsx-newline": 0,
82
- "react/jsx-no-literals": 0,
83
- "react/jsx-one-expression-per-line": 0,
84
- "react/jsx-props-no-spreading": 0,
85
- "react/jsx-sort-props": 0,
86
- "react/require-default-props": 0,
87
- "react/sort-comp": 0,
88
- "react/forbid-component-props": 0,
89
- "react/button-has-type": 0,
90
- "react/no-array-index-key": 0
91
- }
92
- }