wdwh 1.12.12-dev.0 → 1.12.13-dev.1

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
@@ -14,6 +14,25 @@ For development you need the Bun runtime.
14
14
  bunx wdwh@latest init
15
15
  ```
16
16
 
17
+ ## Usage
18
+
19
+ ```tsx
20
+ import { createSignal } from "wdwh";
21
+
22
+ const countSignal = createSignal(0);
23
+
24
+ function Counter() {
25
+ const count = countSignal.use();
26
+
27
+ return (
28
+ <>
29
+ <h2>{count}</h2>
30
+ <button onClick={() => countSignal.set((prev) => prev + 1)}>Increment</button>
31
+ </>
32
+ );
33
+ }
34
+ ```
35
+
17
36
  ## Adding to project
18
37
 
19
38
  ### 1. Install `wdwh`
package/hooks.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Signal } from ".";
1
2
  export declare function useRefresh(): () => void;
2
3
  export declare function useConst<T>(value: T): T;
3
4
  export declare function useHover(): (boolean | {
@@ -5,3 +6,4 @@ export declare function useHover(): (boolean | {
5
6
  onMouseLeave: () => void;
6
7
  })[];
7
8
  export declare function useSearchParam(key: string, defaultValue: string): [string, import("react").Dispatch<import("react").SetStateAction<string>>];
9
+ export declare function useSignal<T>(signal: Signal<T>): T;
package/hooks.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{useState as n}from"react";function c(){let r=n(!1)[1];return()=>r((t)=>!t)}function u(r){return n(r)[0]}function i(){let[r,t]=n(!1);return[r,{onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1)}]}function f(r,t){let e=n(s(r,t));return a(r,e[0]),e}function s(r,t){let e=new URLSearchParams(location.search);return e.has(r)?decodeURI(e.get(r)):t}function a(r,t){let e=new URLSearchParams(location.search);e.set(r,t),history.pushState(null,"",`?${e.toString()}`)}export{f as useSearchParam,c as useRefresh,i as useHover,u as useConst};
2
+ import{useState as n,useSyncExternalStore as s}from"react";function c(){let r=n(!1)[1];return()=>r((e)=>!e)}function i(r){return n(r)[0]}function f(){let[r,e]=n(!1);return[r,{onMouseEnter:()=>e(!0),onMouseLeave:()=>e(!1)}]}function g(r,e){let t=n(o(r,e));return a(r,t[0]),t}function o(r,e){let t=new URLSearchParams(location.search);return t.has(r)?decodeURI(t.get(r)):e}function a(r,e){let t=new URLSearchParams(location.search);t.set(r,e),history.pushState(null,"",`?${t.toString()}`)}function S(r){return s(r.subscribe,r.get)}export{S as useSignal,g as useSearchParam,c as useRefresh,f as useHover,i as useConst};
@@ -6,5 +6,7 @@ export type Signal<T> = {
6
6
  use(): T;
7
7
  };
8
8
  export declare function createSignal<T>(initial: T): Signal<T>;
9
- export declare function useSignal<T>(signal: Signal<T>): T;
9
+ export type ClassValue = ClassArray | string | number | null | boolean | undefined;
10
+ export type ClassArray = ClassValue[];
11
+ export declare function clsx(...inputs: ClassValue[]): string;
10
12
  export {};
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{useSyncExternalStore as l}from"react";function c(n){let e=n,t=new Set;function s(){return e}function i(r){return t.add(r),()=>t.delete(r)}return{get:s,set(r){let o=typeof r==="function"?r(e):r;if(Object.is(e,o))return;e=o,t.forEach((u)=>u())},subscribe:i,use(){return l(i,s)}}}function f(...n){let e="";for(let t of n.flat()){if(!t)continue;if(typeof t==="string")e&&(e+=" "),e+=t}return e}export{c as createSignal,f as clsx};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdwh",
3
- "version": "1.12.12-dev.0",
3
+ "version": "1.12.13-dev.1",
4
4
  "author": "kubashh",
5
5
  "description": "The Bun Frontend Framework.",
6
6
  "license": "MIT",
@@ -17,10 +17,11 @@
17
17
  "files": [
18
18
  "LICENSE",
19
19
  "README.md",
20
+ "index.js",
21
+ "index.d.ts",
20
22
  "hooks.js",
21
23
  "hooks.d.ts",
22
- "signal.js",
23
- "signal.d.ts"
24
+ "wdwh.js"
24
25
  ],
25
26
  "scripts": {
26
27
  "dev": "clear && bun dev/dev.ts",
@@ -35,9 +36,9 @@
35
36
  "bun-plugin-tailwind": "latest"
36
37
  },
37
38
  "devDependencies": {
38
- "@types/bun": "^1.3.10",
39
+ "@types/bun": "^1.3.11",
39
40
  "@types/react": "^19.2.14",
40
- "tailwindcss": "^4.2.1",
41
+ "tailwindcss": "^4.2.2",
41
42
  "typescript": "^5.9.3",
42
43
  "react": "^19.2.4",
43
44
  "react-dom": "^19.2.4"
package/signal.js DELETED
@@ -1,2 +0,0 @@
1
- // @bun
2
- import{useSyncExternalStore as o}from"react";function a(t){let r=t,n=new Set;function i(){return r}function s(e){return n.add(e),()=>n.delete(e)}return{get:i,set(e){let u=typeof e==="function"?e(r):e;if(Object.is(r,u))return;r=u,n.forEach((c)=>c())},subscribe:s,use(){return o(s,i)}}}function f(t){return o(t.subscribe,t.get)}export{f as useSignal,a as createSignal};