react-state-custom 1.0.23 → 1.0.24

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.
Files changed (79) hide show
  1. package/.github/copilot-instructions.md +17 -2
  2. package/.github/workflows/deploy.yml +56 -0
  3. package/API_DOCUMENTATION.md +132 -3
  4. package/README.md +69 -1
  5. package/dist/dev-tool/DataViewComponent.d.ts +6 -0
  6. package/dist/dev-tool/DevTool.d.ts +5 -0
  7. package/dist/dev-tool/DevToolState.d.ts +9 -0
  8. package/dist/dev-tool/StateLabelRender.d.ts +2 -0
  9. package/dist/dev-tool/useHighlight.d.ts +11 -0
  10. package/dist/dev.d.ts +0 -1
  11. package/dist/examples/Playground.d.ts +1 -0
  12. package/dist/examples/cart/app.d.ts +1 -0
  13. package/dist/examples/cart/index.d.ts +3 -0
  14. package/dist/examples/cart/state.d.ts +23 -0
  15. package/dist/examples/cart/view.d.ts +4 -0
  16. package/dist/examples/counter/app.d.ts +1 -0
  17. package/dist/examples/counter/index.d.ts +2 -0
  18. package/dist/examples/counter/state.d.ts +6 -0
  19. package/dist/examples/counter/view.d.ts +2 -0
  20. package/dist/examples/form/app.d.ts +1 -0
  21. package/dist/examples/form/index.d.ts +3 -0
  22. package/dist/examples/form/state.d.ts +16 -0
  23. package/dist/examples/form/view.d.ts +4 -0
  24. package/dist/examples/timer/app.d.ts +1 -0
  25. package/dist/examples/timer/index.d.ts +2 -0
  26. package/dist/examples/timer/state.d.ts +11 -0
  27. package/dist/examples/timer/view.d.ts +4 -0
  28. package/dist/examples/todo/app.d.ts +1 -0
  29. package/dist/examples/todo/index.d.ts +3 -0
  30. package/dist/examples/todo/state.d.ts +17 -0
  31. package/dist/examples/todo/view.d.ts +4 -0
  32. package/dist/index.d.ts +2 -1
  33. package/dist/index.es.js +264 -408
  34. package/dist/index.es.js.map +1 -1
  35. package/dist/index.umd.js +1 -1
  36. package/dist/index.umd.js.map +1 -1
  37. package/dist/react-state-custom.css +1 -1
  38. package/dist/state-utils/ctx.d.ts +1 -1
  39. package/package.json +7 -2
  40. package/src/dev-tool/DataViewComponent.tsx +17 -0
  41. package/src/dev-tool/DevTool.css +134 -0
  42. package/src/{DevTool.tsx → dev-tool/DevTool.tsx} +3 -2
  43. package/src/dev-tool/DevToolState.tsx +78 -0
  44. package/src/dev-tool/StateLabelRender.tsx +38 -0
  45. package/src/dev-tool/useHighlight.tsx +56 -0
  46. package/src/dev.tsx +4 -11
  47. package/src/examples/Playground.tsx +180 -0
  48. package/src/examples/cart/app.tsx +16 -0
  49. package/src/examples/cart/index.ts +3 -0
  50. package/src/examples/cart/state.ts +67 -0
  51. package/src/examples/cart/view.tsx +62 -0
  52. package/src/examples/counter/app.tsx +14 -0
  53. package/src/examples/counter/index.ts +2 -0
  54. package/src/examples/counter/state.ts +22 -0
  55. package/src/examples/counter/state.tsx?raw +0 -0
  56. package/src/examples/counter/view.tsx +20 -0
  57. package/src/examples/form/app.tsx +16 -0
  58. package/src/examples/form/index.ts +3 -0
  59. package/src/examples/form/state.ts +58 -0
  60. package/src/examples/form/view.tsx +53 -0
  61. package/src/examples/timer/app.tsx +16 -0
  62. package/src/examples/timer/index.ts +2 -0
  63. package/src/examples/timer/state.ts +43 -0
  64. package/src/examples/timer/view.tsx +26 -0
  65. package/src/examples/todo/app.tsx +16 -0
  66. package/src/examples/todo/index.ts +3 -0
  67. package/src/examples/todo/state.ts +54 -0
  68. package/src/examples/todo/view.tsx +47 -0
  69. package/src/index.ts +2 -1
  70. package/src/state-utils/ctx.ts +3 -3
  71. package/src/vite-env.d.ts +6 -0
  72. package/tsconfig.json +12 -3
  73. package/vite.config.dev.ts +6 -1
  74. package/dist/DevTool.d.ts +0 -4
  75. package/dist/DevToolState.d.ts +0 -15
  76. package/dist/Test.d.ts +0 -1
  77. package/src/DevTool.css +0 -218
  78. package/src/DevToolState.tsx +0 -358
  79. package/src/Test.tsx +0 -97
@@ -2,6 +2,7 @@
2
2
  - `react-state-custom` is a hook-first state management library; entrypoint `src/index.ts` re-exports context factories and subscription hooks.
3
3
  - TypeScript only; consumers are expected to be React 19 apps (see `package.json` peerDependencies).
4
4
  - Library build artifacts live in `dist/`; all source utilities reside under `src/state-utils/`.
5
+ - Live demo at https://vothanhdat.github.io/react-state-custom/ showcases interactive examples.
5
6
 
6
7
  ## Context Core
7
8
  - `Context` (`src/state-utils/ctx.ts`) extends `EventTarget`; `data` stores the latest values and `publish` fires per-key DOM events when a loose `!=` comparison detects change.
@@ -20,6 +21,12 @@
20
21
  - `createAutoCtx(rootCtx, unmountTime?)` returns `useCtxState(params)` that subscribes through `'auto-ctx'` and hands back `useDataContext` for the resolved name.
21
22
  - Multiple callers with identical params share a single `Root`; `unmountTime` delays teardown to absorb rapid mount/unmount cycles.
22
23
 
24
+ ## Developer Tools
25
+ - `DevToolContainer` (`src/dev-tool/DevTool.tsx`) provides a debugging UI for inspecting all context data; mount it alongside `<AutoRootCtx />`.
26
+ - Accepts optional `Component` prop (type `DataViewComponent`) for custom data rendering; defaults to JSON stringify.
27
+ - Import styles with `import 'react-state-custom/dist/react-state-custom.css'` when using DevTool.
28
+ - Used in demo (`src/dev.tsx`, `src/examples/`) with `react-obj-view` for rich object inspection.
29
+
23
30
  ## Subscription Patterns
24
31
  - `useDataSourceMultiple(ctx, ...entries)` expects stable `[key, value]` tuples; internal `useArrayHash` hashes length and reference equality only.
25
32
  - Use `useDataSubscribe(ctx, key, debounceMs)` or `useDataSubscribeMultiple(ctx, ...keys)` for keyed reads; debounce variants batch updates when values bounce.
@@ -31,12 +38,20 @@
31
38
  - `useArrayHash`/`useObjectHash` generate random hashes when array/object shape changes; they do not deep-compare nested content.
32
39
  - The reserved `'auto-ctx'` namespace powers `AutoRootCtx`; do not manually reuse this context name.
33
40
 
41
+ ## Examples
42
+ - Five complete examples in `src/examples/`: counter, todo, form, timer, cart.
43
+ - `Playground.tsx` uses `@codesandbox/sandpack-react` to render interactive examples with live editing.
44
+ - Each example has `state.ts` (hook), `view.tsx` (components), `app.tsx` (root), and `index.ts` (exports).
45
+ - Demo uses `?raw` imports to show source code in Sandpack editor.
46
+
34
47
  ## Build and Tooling
35
48
  - `yarn build` runs Vite with `@vitejs/plugin-react`, `vite-plugin-dts`, and `vite-bundle-analyzer`; the analyzer spins up a server after builds—stop it in CI if unused.
36
- - `yarn dev` starts the Vite dev server on port 3000; useful for manual inspection of bundle output.
49
+ - `yarn dev` starts the Vite dev server on port 3000 with demo examples; `yarn build:demo` creates GitHub Pages build.
50
+ - `yarn preview` previews demo build locally with correct base path (`/react-state-custom/`).
37
51
  - Tests are stubbed (`yarn test` exits 0 after printing "No tests specified"); add coverage before depending on test gates.
38
52
  - Repo is Yarn 4 (PnP); if editors struggle with module resolution, run `./fix-vscode-yarn-pnp.sh`.
53
+ - GitHub Actions workflow (`.github/workflows/deploy.yml`) auto-deploys demo to GitHub Pages on push to master.
39
54
 
40
55
  ## Reference Docs
41
- - README (`README.md`) offers narrative examples and positioning.
56
+ - README (`README.md`) offers narrative examples and positioning; includes live demo link.
42
57
  - API reference (`API_DOCUMENTATION.md`) documents every export; update alongside code changes.
@@ -0,0 +1,56 @@
1
+ name: Deploy Demo to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ concurrency:
15
+ group: "pages"
16
+ cancel-in-progress: false
17
+
18
+ jobs:
19
+ build:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@v4
24
+
25
+ - name: Setup Node
26
+ uses: actions/setup-node@v4
27
+ with:
28
+ node-version: '20'
29
+
30
+ - name: Enable Corepack
31
+ run: corepack enable
32
+
33
+ - name: Install dependencies
34
+ run: yarn install --immutable
35
+
36
+ - name: Build demo
37
+ run: yarn build:demo
38
+
39
+ - name: Setup Pages
40
+ uses: actions/configure-pages@v4
41
+
42
+ - name: Upload artifact
43
+ uses: actions/upload-pages-artifact@v3
44
+ with:
45
+ path: './demo-dist'
46
+
47
+ deploy:
48
+ environment:
49
+ name: github-pages
50
+ url: ${{ steps.deployment.outputs.page_url }}
51
+ runs-on: ubuntu-latest
52
+ needs: build
53
+ steps:
54
+ - name: Deploy to GitHub Pages
55
+ id: deployment
56
+ uses: actions/deploy-pages@v4
@@ -2,6 +2,8 @@
2
2
 
3
3
  A powerful React library for managing shared state and context with TypeScript support, built with Vite.
4
4
 
5
+ 🎮 **[Try the Live Demo →](https://vothanhdat.github.io/react-state-custom/)**
6
+
5
7
  ## Table of Contents
6
8
 
7
9
  1. [Core Context System](#core-context-system)
@@ -21,11 +23,14 @@ A powerful React library for managing shared state and context with TypeScript s
21
23
  5. [Auto Context System](#auto-context-system)
22
24
  - [AutoRootCtx](#autorootctx)
23
25
  - [createAutoCtx](#createautoctx)
24
- 6. [Utility Hooks](#utility-hooks)
26
+ 6. [Developer Tools](#developer-tools)
27
+ - [DevToolContainer](#devtoolcontainer)
28
+ - [DataViewComponent](#dataviewcomponent)
29
+ 7. [Utility Hooks](#utility-hooks)
25
30
  - [useArrayHash](#usearrayhash)
26
31
  - [useQuickSubscribe](#usequicksubscribe)
27
- 7. [Usage Patterns](#usage-patterns)
28
- 8. [Examples](#examples)
32
+ 8. [Usage Patterns](#usage-patterns)
33
+ 9. [Examples](#examples)
29
34
 
30
35
  ---
31
36
 
@@ -560,6 +565,105 @@ function UserProfile({ userId }: { userId: string }) {
560
565
 
561
566
  ---
562
567
 
568
+ ## Developer Tools
569
+
570
+ ### DevToolContainer
571
+
572
+ A debugging component that displays all context data in your application. Provides a visual interface for inspecting state values across all contexts.
573
+
574
+ **Type Definition:**
575
+ ```typescript
576
+ function DevToolContainer(props: {
577
+ toggleButton?: string;
578
+ Component?: DataViewComponent;
579
+ style?: React.CSSProperties;
580
+ children?: React.ReactNode;
581
+ }): JSX.Element
582
+ ```
583
+
584
+ **Parameters:**
585
+ - `toggleButton` - Optional text for the toggle button (default: "[x]")
586
+ - `Component` - Optional custom component for rendering data (default: `DataViewDefault`)
587
+ - `style` - Optional inline styles for the toggle button
588
+ - `children` - Optional custom content for the toggle button (default: "Toggle Dev Tool")
589
+
590
+ **Returns:**
591
+ - A JSX element containing the dev tool UI
592
+
593
+ **Example:**
594
+ ```typescript
595
+ import { DevToolContainer } from 'react-state-custom';
596
+ import 'react-state-custom/dist/react-state-custom.css'; // Import styles
597
+
598
+ function App() {
599
+ return (
600
+ <>
601
+ <AutoRootCtx />
602
+ <YourAppContent />
603
+ <DevToolContainer />
604
+ </>
605
+ );
606
+ }
607
+ ```
608
+
609
+ **With Custom Component:**
610
+ ```typescript
611
+ import { DevToolContainer, DataViewComponent } from 'react-state-custom';
612
+ import { ObjectView } from 'react-obj-view';
613
+ import 'react-obj-view/dist/react-obj-view.css';
614
+
615
+ const CustomDataView: DataViewComponent = ({ name, value }) => {
616
+ return <ObjectView name={name} value={value} expandLevel={2} />;
617
+ };
618
+
619
+ function App() {
620
+ return (
621
+ <>
622
+ <AutoRootCtx />
623
+ <YourAppContent />
624
+ <DevToolContainer
625
+ Component={CustomDataView}
626
+ style={{ left: "20px", bottom: "10px" }}
627
+ />
628
+ </>
629
+ );
630
+ }
631
+ ```
632
+
633
+ ---
634
+
635
+ ### DataViewComponent
636
+
637
+ Type definition for custom data view components used by `DevToolContainer`.
638
+
639
+ **Type Definition:**
640
+ ```typescript
641
+ type DataViewComponent = React.FC<{
642
+ value: any;
643
+ name: string;
644
+ }>;
645
+ ```
646
+
647
+ **Parameters:**
648
+ - `value` - The data value to display
649
+ - `name` - The context name
650
+
651
+ **Example:**
652
+ ```typescript
653
+ import { DataViewComponent } from 'react-state-custom';
654
+
655
+ const CustomDataView: DataViewComponent = ({ name, value }) => {
656
+ return (
657
+ <div className="custom-view">
658
+ <h3>{name}</h3>
659
+ <pre>{JSON.stringify(value, null, 2)}</pre>
660
+ </div>
661
+ );
662
+ };
663
+ ```
664
+
665
+ ---
666
+
563
667
  ## Utility Hooks
564
668
 
565
669
  ### useArrayHash
@@ -880,4 +984,29 @@ function TodoFilters() {
880
984
  }
881
985
  ```
882
986
 
987
+ ---
988
+
989
+ ## Live Examples
990
+
991
+ For interactive examples with live editing, visit the **[Live Demo](https://vothanhdat.github.io/react-state-custom/)**.
992
+
993
+ The demo includes the following examples:
994
+
995
+ ### Counter Example
996
+ A simple counter demonstrating basic state management with increment, decrement, and reset operations.
997
+
998
+ ### Todo List Example
999
+ Multiple independent todo lists showing how contexts can be scoped by parameters. Each list maintains its own state.
1000
+
1001
+ ### Form Example
1002
+ Form validation example with multiple independent form instances. Shows real-time validation and error handling.
1003
+
1004
+ ### Timer Example
1005
+ Multiple independent timers with millisecond precision demonstrating side effects and cleanup patterns.
1006
+
1007
+ ### Shopping Cart Example
1008
+ Shopping cart with product selection and quantity management. Shows how to handle derived state (total, itemCount) and complex state updates.
1009
+
1010
+ ---
1011
+
883
1012
  This comprehensive documentation covers all exported APIs from the react-state-custom library with detailed descriptions, type information, and practical examples.
package/README.md CHANGED
@@ -4,10 +4,16 @@
4
4
 
5
5
  A lightweight React state management library that combines the simplicity of React hooks with the power of event-driven subscriptions. No boilerplate, no complexity—just pure, performant state management.
6
6
 
7
+ [![Demo](https://img.shields.io/badge/Demo-Live-blue?style=flat-square)](https://vothanhdat.github.io/react-state-custom/)
8
+ [![npm version](https://img.shields.io/npm/v/react-state-custom?style=flat-square)](https://www.npmjs.com/package/react-state-custom)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
10
+
7
11
  ```bash
8
12
  npm install react-state-custom
9
13
  ```
10
14
 
15
+ 🎮 **[Try the Live Demo →](https://vothanhdat.github.io/react-state-custom/)**
16
+
11
17
  ## Why React State Custom?
12
18
 
13
19
  **Zero Boilerplate** • **Type-Safe** • **Selective Re-renders** • **Hook-Based** • **~10KB Bundle**
@@ -105,7 +111,7 @@ Full type inference and type safety throughout. Your IDE knows exactly what's in
105
111
  | **Boilerplate** | ✅ None | ❌ Heavy | ✅ Minimal |
106
112
  | **Type Safety** | ✅ Full inference | ⚠️ Requires setup | ✅ Good |
107
113
  | **Selective Re-renders** | ✅ Built-in | ⚠️ Requires selectors | ✅ Built-in |
108
- | **DevTools** | ⚠️ Console logging | ✅ Redux DevTools | ✅ DevTools support |
114
+ | **DevTools** | Built-in UI | ✅ Redux DevTools | ✅ DevTools support |
109
115
  | **Async Support** | ✅ Native (hooks) | ⚠️ Requires middleware | ✅ Native |
110
116
  | **Context Composition** | ✅ Automatic | ❌ Manual | ⚠️ Manual store combination |
111
117
 
@@ -243,6 +249,36 @@ const { useCtxState } = createAutoCtx(rootContext);
243
249
 
244
250
  ## 🚀 Advanced Features
245
251
 
252
+ ### Developer Tools
253
+ Visual debugging component to inspect all your context data in real-time:
254
+
255
+ ```typescript
256
+ import { DevToolContainer } from 'react-state-custom';
257
+ import 'react-state-custom/dist/react-state-custom.css';
258
+
259
+ function App() {
260
+ return (
261
+ <>
262
+ <AutoRootCtx />
263
+ <YourAppContent />
264
+ <DevToolContainer />
265
+ </>
266
+ );
267
+ }
268
+ ```
269
+
270
+ **Custom data viewer with rich object visualization:**
271
+ ```typescript
272
+ import { DataViewComponent } from 'react-state-custom';
273
+ import { ObjectView } from 'react-obj-view';
274
+
275
+ const CustomDataView: DataViewComponent = ({ name, value }) => {
276
+ return <ObjectView name={name} value={value} expandLevel={2} />;
277
+ };
278
+
279
+ <DevToolContainer Component={CustomDataView} />
280
+ ```
281
+
246
282
  ### Parameterized Contexts
247
283
  Create multiple instances of the same state with different parameters:
248
284
 
@@ -285,10 +321,42 @@ const userStats = useDataSubscribeWithTransform(
285
321
  );
286
322
  ```
287
323
 
324
+ ## 🎮 Live Examples
325
+
326
+ Explore interactive examples in the **[Live Demo](https://vothanhdat.github.io/react-state-custom/)**:
327
+
328
+ - **Counter** - Basic state management with increment, decrement, and reset
329
+ - **Todo List** - Multiple independent lists with scoped contexts
330
+ - **Form Validation** - Real-time validation with error handling
331
+ - **Timer** - Side effects and cleanup with millisecond precision
332
+ - **Shopping Cart** - Complex state with derived values (total, itemCount)
333
+
334
+ Each example includes live code editing with syntax highlighting, powered by Sandpack!
335
+
288
336
  ## 📖 Documentation
289
337
 
290
338
  For complete API documentation, examples, and advanced patterns, see:
291
339
  - **[API_DOCUMENTATION.md](./API_DOCUMENTATION.md)** - Complete API reference
340
+ - **[Live Demo](https://vothanhdat.github.io/react-state-custom/)** - Interactive examples
341
+
342
+ ## 🛠️ Development
343
+
344
+ ```bash
345
+ # Install dependencies
346
+ yarn install
347
+
348
+ # Run dev server with examples
349
+ yarn dev
350
+
351
+ # Build library
352
+ yarn build
353
+
354
+ # Build demo site
355
+ yarn build:demo
356
+
357
+ # Preview demo locally
358
+ yarn preview
359
+ ```
292
360
 
293
361
  ## 🎓 Learning Path
294
362
 
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export type DataViewComponent = React.FC<{
3
+ value: any;
4
+ name: string;
5
+ }>;
6
+ export declare const DataViewDefault: DataViewComponent;
@@ -0,0 +1,5 @@
1
+ export declare const DevToolContainer: ({ toggleButton, Component, ...props }: {
2
+ [x: string]: any;
3
+ toggleButton?: string | undefined;
4
+ Component?: import('./DataViewComponent').DataViewComponent | undefined;
5
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ import { DataViewComponent } from './DataViewComponent';
3
+ export declare const DevToolState: React.FC<{
4
+ Component: DataViewComponent;
5
+ }>;
6
+ export declare const StateView: React.FC<{
7
+ dataKey: string;
8
+ Component: DataViewComponent;
9
+ }>;
@@ -0,0 +1,2 @@
1
+ import { default as React } from 'react';
2
+ export declare const StateLabelRender: React.FC<any>;
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ export declare function useHighlight(filterString: string): {
3
+ highlight: RegExp;
4
+ };
5
+ export declare const HightlightWrapper: React.FC<{
6
+ highlight: string;
7
+ children: any;
8
+ }>;
9
+ export declare const HighlightString: React.FC<{
10
+ text: string;
11
+ }>;
package/dist/dev.d.ts CHANGED
@@ -1 +0,0 @@
1
- export {};
@@ -0,0 +1 @@
1
+ export declare const Playground: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function App(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { CartExample, CartExample as default } from './view';
2
+ export { useCartCtx, PRODUCTS } from './state';
3
+ export type { CartItem } from './state';
@@ -0,0 +1,23 @@
1
+ export interface CartItem {
2
+ id: string;
3
+ name: string;
4
+ price: number;
5
+ quantity: number;
6
+ }
7
+ export declare const PRODUCTS: {
8
+ id: string;
9
+ name: string;
10
+ price: number;
11
+ }[];
12
+ export declare const useCartCtx: (e: {
13
+ userId: string;
14
+ }) => import('../../index').Context<{
15
+ userId: string;
16
+ items: CartItem[];
17
+ total: string;
18
+ itemCount: number;
19
+ addItem: (product: (typeof PRODUCTS)[0]) => void;
20
+ removeItem: (id: string) => void;
21
+ updateQuantity: (id: string, quantity: number) => void;
22
+ clear: () => void;
23
+ }>;
@@ -0,0 +1,4 @@
1
+ export declare const CartExample: ({ userId }: {
2
+ userId?: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export default CartExample;
@@ -0,0 +1 @@
1
+ export default function App(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { CounterExample, CounterExample as default } from './view';
2
+ export { useCounterCtx } from './state';
@@ -0,0 +1,6 @@
1
+ export declare const useCounterCtx: (e: object) => import('../../index').Context<{
2
+ count: number;
3
+ increment: () => void;
4
+ decrement: () => void;
5
+ reset: () => void;
6
+ }>;
@@ -0,0 +1,2 @@
1
+ export declare const CounterExample: () => import("react/jsx-runtime").JSX.Element;
2
+ export default CounterExample;
@@ -0,0 +1 @@
1
+ export default function App(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { FormExample, FormExample as default } from './view';
2
+ export { useFormCtx } from './state';
3
+ export type { FormData } from './state';
@@ -0,0 +1,16 @@
1
+ export interface FormData {
2
+ name: string;
3
+ email: string;
4
+ age: string;
5
+ }
6
+ export declare const useFormCtx: (e: {
7
+ formId: string;
8
+ }) => import('../../index').Context<{
9
+ formId: string;
10
+ data: FormData;
11
+ errors: Partial<FormData>;
12
+ submitted: boolean;
13
+ updateField: (field: keyof FormData, value: string) => void;
14
+ submit: () => void;
15
+ reset: () => void;
16
+ }>;
@@ -0,0 +1,4 @@
1
+ export declare const FormExample: ({ formId }: {
2
+ formId?: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export default FormExample;
@@ -0,0 +1 @@
1
+ export default function App(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { TimerExample, TimerExample as default } from './view';
2
+ export { useTimerCtx } from './state';
@@ -0,0 +1,11 @@
1
+ export declare const useTimerCtx: (e: {
2
+ timerId: string;
3
+ }) => import('../../index').Context<{
4
+ timerId: string;
5
+ milliseconds: number;
6
+ isRunning: boolean;
7
+ formattedTime: string;
8
+ start: () => void;
9
+ pause: () => void;
10
+ reset: () => void;
11
+ }>;
@@ -0,0 +1,4 @@
1
+ export declare const TimerExample: ({ timerId }: {
2
+ timerId?: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export default TimerExample;
@@ -0,0 +1 @@
1
+ export default function App(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export { TodoExample, TodoExample as default } from './view';
2
+ export { useTodoCtx } from './state';
3
+ export type { Todo } from './state';
@@ -0,0 +1,17 @@
1
+ export interface Todo {
2
+ id: string;
3
+ text: string;
4
+ completed: boolean;
5
+ }
6
+ export declare const useTodoCtx: (e: {
7
+ listId: string;
8
+ }) => import('../../index').Context<{
9
+ listId: string;
10
+ todos: Todo[];
11
+ input: string;
12
+ setInput: import('react').Dispatch<import('react').SetStateAction<string>>;
13
+ addTodo: () => void;
14
+ toggleTodo: (id: string) => void;
15
+ removeTodo: (id: string) => void;
16
+ clearCompleted: () => void;
17
+ }>;
@@ -0,0 +1,4 @@
1
+ export declare const TodoExample: ({ listId }: {
2
+ listId?: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export default TodoExample;
package/dist/index.d.ts CHANGED
@@ -3,4 +3,5 @@ export { createRootCtx } from './state-utils/createRootCtx';
3
3
  export { AutoRootCtx, createAutoCtx } from './state-utils/createAutoCtx';
4
4
  export { useArrayHash } from './state-utils/useArrayHash';
5
5
  export { useQuickSubscribe } from './state-utils/useQuickSubscribe';
6
- export { DevToolContainer } from './DevTool';
6
+ export { DevToolContainer } from './dev-tool/DevTool';
7
+ export type { DataViewComponent } from './dev-tool/DataViewComponent';