dogu-utils 0.0.6 → 0.0.8

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/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./react";
2
+ export * from "./types";
@@ -0,0 +1 @@
1
+ export type EmptyObject = Record<PropertyKey, never>;
@@ -0,0 +1 @@
1
+ export * from "./EmptyObject";
@@ -3,6 +3,6 @@ export declare class EarlyReturn<T> {
3
3
  returnValue: T | undefined;
4
4
  case(condition: boolean, func: Callback<T>): EarlyReturn<T>;
5
5
  default(func: Callback<T>): T;
6
- isAlreadyReturned<T>(returnValue: T | undefined): returnValue is T & ({} | null);
6
+ private isAlreadyReturned;
7
7
  }
8
8
  export {};
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "dogu-utils",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "main": "./dist/index.js",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
+ "exports": {
9
+ ".": "./dist/index.js",
10
+ "./react": "./dist/react/index.js",
11
+ "./utils": "./dist/utils/index.js"
12
+ },
8
13
  "types": "./dist/index.d.ts",
9
14
  "type": "module",
10
- "scripts": {
11
- "publish": "pnpm run build && npm publish --access=public",
12
- "build": "rollup -c",
13
- "watch": "rollup -cw",
14
- "test": "vitest"
15
- },
16
15
  "devDependencies": {
17
16
  "@babel/core": "^7.24.4",
18
17
  "@babel/preset-env": "^7.24.4",
@@ -26,5 +25,10 @@
26
25
  },
27
26
  "peerDependencies": {
28
27
  "react": "^18.2.0"
28
+ },
29
+ "scripts": {
30
+ "build": "rollup -c",
31
+ "watch": "rollup -cw",
32
+ "test": "vitest"
29
33
  }
30
- }
34
+ }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/react/hooks/useOpenCloseState.ts","../src/react/utils/createSafeContext.tsx"],"sourcesContent":["import { useCallback, useState } from \"react\"\n\nexport const useOpenCloseState = (initialState = false) => {\n const [isOpen, setIsOpen] = useState(initialState)\n\n const open = useCallback(() => setIsOpen(true), [])\n const close = useCallback(() => setIsOpen(false), [])\n\n return [isOpen, open, close] as const\n}\n","import { ReactNode, createContext, useContext } from \"react\"\n\ntype ProviderProps<Value> = {\n children: ReactNode\n value: Value\n}\n\nexport const createSafeContext = <Value,>(defaultValue?: Value) => {\n const Context = createContext<Value | null>(defaultValue ?? null)\n\n const Provider = ({ children, value }: ProviderProps<Value>) => {\n return <Context.Provider value={value}>{children}</Context.Provider>\n }\n\n const useSafeContext = () => {\n const context = useContext(Context)\n if (context === null) {\n throw new Error(\n \"useSafeContext must be used within a Provider, or give it a default value.\"\n )\n }\n return context\n }\n\n return [Provider, useSafeContext] as const\n}\n"],"names":["useOpenCloseState","initialState","_a","useState","isOpen","setIsOpen","open","useCallback","close","createSafeContext","defaultValue","Context","createContext","Provider","children","value","_jsx","useSafeContext","context","useContext","Error"],"mappings":";;;IAEaA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,YAAoB,EAAA;AAApB,EAAA,IAAAA,YAAA,KAAA,KAAA,CAAA,EAAA;AAAAA,IAAAA,YAAoB,GAAA,KAAA;AAAA;AAC9C,EAAA,IAAAC,EAAA,GAAsBC,QAAQ,CAACF,YAAY,CAAC;AAA3CG,IAAAA,MAAM,GAAAF,EAAA,CAAA,CAAA,CAAA;AAAEG,IAAAA,SAAS,GAAAH,EAAA,CAAA,CAAA,CAA0B;AAElD,EAAA,IAAMI,IAAI,GAAGC,WAAW,CAAC;IAAM,OAAAF,SAAS,CAAC,IAAI,CAAC;GAAA,EAAE,EAAE,CAAC;AACnD,EAAA,IAAMG,KAAK,GAAGD,WAAW,CAAC;IAAM,OAAAF,SAAS,CAAC,KAAK,CAAC;GAAA,EAAE,EAAE,CAAC;AAErD,EAAA,OAAO,CAACD,MAAM,EAAEE,IAAI,EAAEE,KAAK,CAAU;AACvC;;ICFaC,iBAAiB,GAAG,SAApBA,i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