@live-favicon/react 0.1.0
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 +61 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @live-favicon/react
|
|
2
|
+
|
|
3
|
+
React hooks for [live-favicon](https://www.npmjs.com/package/@live-favicon/core) — turn the browser tab into a live status indicator.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @live-favicon/core @live-favicon/react
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## `useFaviconState`
|
|
12
|
+
|
|
13
|
+
Drives the favicon from a piece of React state. Resets on unmount by default.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { useFaviconState } from "@live-favicon/react";
|
|
17
|
+
|
|
18
|
+
function GenerationStatus({ status }: { status: "pending" | "done" | "failed" }) {
|
|
19
|
+
useFaviconState(status === "pending" ? "thinking" : status === "done" ? "success" : "error");
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## `useFaviconTask`
|
|
25
|
+
|
|
26
|
+
Runs an async factory whenever `deps` change, driving the favicon through its
|
|
27
|
+
task lifecycle automatically, and returns `{ data, error, status }`.
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { useFaviconTask } from "@live-favicon/react";
|
|
31
|
+
|
|
32
|
+
function SearchResults({ query }: { query: string }) {
|
|
33
|
+
const { status, data, error } = useFaviconTask(
|
|
34
|
+
() => (query ? fetchResults(query) : null),
|
|
35
|
+
[query],
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
if (status === "pending") return <p>Loading...</p>;
|
|
39
|
+
if (status === "error") return <p>Failed: {String(error)}</p>;
|
|
40
|
+
return <ResultsList results={data} />;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Imperative escape hatch
|
|
45
|
+
|
|
46
|
+
The underlying singleton and all of core's types are re-exported, for anything
|
|
47
|
+
outside a component (event handlers, non-React code):
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { favicon } from "@live-favicon/react";
|
|
51
|
+
|
|
52
|
+
async function onExport() {
|
|
53
|
+
await favicon.task(exportReport());
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
See the [live-favicon README](https://github.com/cridorainfo/live-favicon#readme) for the full state list and API.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
MIT
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var U=Object.create;var i=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var E=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of O(t))!R.call(e,o)&&o!==n&&i(e,o,{get:()=>t[o],enumerable:!(s=x(t,o))||s.enumerable});return e};var p=(e,t,n)=>(n=e!=null?U(y(e)):{},l(t||!e||!e.__esModule?i(n,"default",{value:e,enumerable:!0}):n,e)),g=e=>l(i({},"__esModule",{value:!0}),e);var h={};E(h,{FAVICON_SIZE:()=>c.FAVICON_SIZE,favicon:()=>c.default,useFaviconState:()=>T,useFaviconTask:()=>S});module.exports=g(h);var c=p(require("@live-favicon/core"),1);var a=require("react"),d=p(require("@live-favicon/core"),1);function T(e,t={}){let{resetOnUnmount:n=!0}=t,s=(0,a.useRef)(n);s.current=n,(0,a.useEffect)(()=>{e&&d.default.state(e)},[e]),(0,a.useEffect)(()=>()=>{s.current&&d.default.reset()},[])}var r=require("react"),k=p(require("@live-favicon/core"),1);function S(e,t,n){let[s,o]=(0,r.useState)({data:void 0,error:void 0,status:"idle"}),v=(0,r.useRef)(e);v.current=e;let m=(0,r.useRef)(n);return m.current=n,(0,r.useEffect)(()=>{let F=v.current();if(!F)return;let u=!1;return o({data:void 0,error:void 0,status:"pending"}),k.default.task(F,m.current).then(f=>{u||o({data:f,error:void 0,status:"success"})}).catch(f=>{u||o({data:void 0,error:f,status:"error"})}),()=>{u=!0}},t),s}0&&(module.exports={FAVICON_SIZE,favicon,useFaviconState,useFaviconTask});
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/useFaviconState.ts","../src/useFaviconTask.ts"],"sourcesContent":["export { default as favicon, FAVICON_SIZE } from \"@live-favicon/core\";\nexport type { FaviconState, TaskOptions } from \"@live-favicon/core\";\n\nexport { useFaviconState } from \"./useFaviconState\";\nexport type { UseFaviconStateOptions } from \"./useFaviconState\";\n\nexport { useFaviconTask } from \"./useFaviconTask\";\nexport type { UseFaviconTaskResult, UseFaviconTaskStatus } from \"./useFaviconTask\";\n","import { useEffect, useRef } from \"react\";\nimport favicon from \"@live-favicon/core\";\nimport type { FaviconState } from \"@live-favicon/core\";\n\nexport interface UseFaviconStateOptions {\n /**\n * Restore the page's original favicon and title when this component\n * unmounts. Default: true. Since the favicon is a single, page-wide\n * singleton, only set this to false if another part of the app is\n * responsible for resetting it.\n */\n resetOnUnmount?: boolean;\n}\n\n/**\n * Drives the shared favicon singleton from a piece of React state.\n * Pass `null`/`undefined` to leave the favicon untouched — useful before a\n * state is known yet.\n *\n * @example\n * function GenerationStatus({ status }: { status: \"pending\" | \"done\" | \"failed\" }) {\n * useFaviconState(\n * status === \"pending\" ? \"thinking\" : status === \"done\" ? \"success\" : \"error\"\n * );\n * return null;\n * }\n */\nexport function useFaviconState(\n state: FaviconState | null | undefined,\n options: UseFaviconStateOptions = {},\n): void {\n const { resetOnUnmount = true } = options;\n const resetOnUnmountRef = useRef(resetOnUnmount);\n resetOnUnmountRef.current = resetOnUnmount;\n\n useEffect(() => {\n if (state) favicon.state(state);\n }, [state]);\n\n useEffect(() => {\n return () => {\n if (resetOnUnmountRef.current) favicon.reset();\n };\n }, []);\n}\n","import { useEffect, useRef, useState, type DependencyList } from \"react\";\nimport favicon from \"@live-favicon/core\";\nimport type { TaskOptions } from \"@live-favicon/core\";\n\nexport type UseFaviconTaskStatus = \"idle\" | \"pending\" | \"success\" | \"error\";\n\nexport interface UseFaviconTaskResult<T> {\n data: T | undefined;\n error: unknown;\n status: UseFaviconTaskStatus;\n}\n\n/**\n * Runs `factory()` whenever `deps` change, driving the favicon through its\n * task lifecycle (start -> success/error) for the duration. Returning `null`\n * from `factory` skips the run — e.g. while required inputs aren't ready.\n *\n * @example\n * const { status, data } = useFaviconTask(\n * () => (query ? fetchResults(query) : null),\n * [query]\n * );\n */\nexport function useFaviconTask<T>(\n factory: () => Promise<T> | null,\n deps: DependencyList,\n options?: TaskOptions,\n): UseFaviconTaskResult<T> {\n const [state, setState] = useState<UseFaviconTaskResult<T>>({\n data: undefined,\n error: undefined,\n status: \"idle\",\n });\n\n const factoryRef = useRef(factory);\n factoryRef.current = factory;\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n useEffect(() => {\n const promise = factoryRef.current();\n if (!promise) return;\n\n let cancelled = false;\n setState({ data: undefined, error: undefined, status: \"pending\" });\n\n favicon\n .task(promise, optionsRef.current)\n .then((data) => {\n if (!cancelled) setState({ data, error: undefined, status: \"success\" });\n })\n .catch((error: unknown) => {\n if (!cancelled) setState({ data: undefined, error, status: \"error\" });\n });\n\n return () => {\n cancelled = true;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n return state;\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,2EAAAE,EAAA,mBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAiD,mCCAjD,IAAAC,EAAkC,iBAClCC,EAAoB,mCA0Bb,SAASC,EACdC,EACAC,EAAkC,CAAC,EAC7B,CACN,GAAM,CAAE,eAAAC,EAAiB,EAAK,EAAID,EAC5BE,KAAoB,UAAOD,CAAc,EAC/CC,EAAkB,QAAUD,KAE5B,aAAU,IAAM,CACVF,GAAO,EAAAI,QAAQ,MAAMJ,CAAK,CAChC,EAAG,CAACA,CAAK,CAAC,KAEV,aAAU,IACD,IAAM,CACPG,EAAkB,SAAS,EAAAC,QAAQ,MAAM,CAC/C,EACC,CAAC,CAAC,CACP,CC5CA,IAAAC,EAAiE,iBACjEC,EAAoB,mCAsBb,SAASC,EACdC,EACAC,EACAC,EACyB,CACzB,GAAM,CAACC,EAAOC,CAAQ,KAAI,YAAkC,CAC1D,KAAM,OACN,MAAO,OACP,OAAQ,MACV,CAAC,EAEKC,KAAa,UAAOL,CAAO,EACjCK,EAAW,QAAUL,EACrB,IAAMM,KAAa,UAAOJ,CAAO,EACjC,OAAAI,EAAW,QAAUJ,KAErB,aAAU,IAAM,CACd,IAAMK,EAAUF,EAAW,QAAQ,EACnC,GAAI,CAACE,EAAS,OAEd,IAAIC,EAAY,GAChB,OAAAJ,EAAS,CAAE,KAAM,OAAW,MAAO,OAAW,OAAQ,SAAU,CAAC,EAEjE,EAAAK,QACG,KAAKF,EAASD,EAAW,OAAO,EAChC,KAAMI,GAAS,CACTF,GAAWJ,EAAS,CAAE,KAAAM,EAAM,MAAO,OAAW,OAAQ,SAAU,CAAC,CACxE,CAAC,EACA,MAAOC,GAAmB,CACpBH,GAAWJ,EAAS,CAAE,KAAM,OAAW,MAAAO,EAAO,OAAQ,OAAQ,CAAC,CACtE,CAAC,EAEI,IAAM,CACXH,EAAY,EACd,CAEF,EAAGP,CAAI,EAEAE,CACT","names":["src_exports","__export","useFaviconState","useFaviconTask","__toCommonJS","import_core","import_react","import_core","useFaviconState","state","options","resetOnUnmount","resetOnUnmountRef","favicon","import_react","import_core","useFaviconTask","factory","deps","options","state","setState","factoryRef","optionsRef","promise","cancelled","favicon","data","error"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FaviconState, TaskOptions } from '@live-favicon/core';
|
|
2
|
+
export { FAVICON_SIZE, FaviconState, TaskOptions, default as favicon } from '@live-favicon/core';
|
|
3
|
+
import { DependencyList } from 'react';
|
|
4
|
+
|
|
5
|
+
interface UseFaviconStateOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Restore the page's original favicon and title when this component
|
|
8
|
+
* unmounts. Default: true. Since the favicon is a single, page-wide
|
|
9
|
+
* singleton, only set this to false if another part of the app is
|
|
10
|
+
* responsible for resetting it.
|
|
11
|
+
*/
|
|
12
|
+
resetOnUnmount?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Drives the shared favicon singleton from a piece of React state.
|
|
16
|
+
* Pass `null`/`undefined` to leave the favicon untouched — useful before a
|
|
17
|
+
* state is known yet.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* function GenerationStatus({ status }: { status: "pending" | "done" | "failed" }) {
|
|
21
|
+
* useFaviconState(
|
|
22
|
+
* status === "pending" ? "thinking" : status === "done" ? "success" : "error"
|
|
23
|
+
* );
|
|
24
|
+
* return null;
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
27
|
+
declare function useFaviconState(state: FaviconState | null | undefined, options?: UseFaviconStateOptions): void;
|
|
28
|
+
|
|
29
|
+
type UseFaviconTaskStatus = "idle" | "pending" | "success" | "error";
|
|
30
|
+
interface UseFaviconTaskResult<T> {
|
|
31
|
+
data: T | undefined;
|
|
32
|
+
error: unknown;
|
|
33
|
+
status: UseFaviconTaskStatus;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Runs `factory()` whenever `deps` change, driving the favicon through its
|
|
37
|
+
* task lifecycle (start -> success/error) for the duration. Returning `null`
|
|
38
|
+
* from `factory` skips the run — e.g. while required inputs aren't ready.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const { status, data } = useFaviconTask(
|
|
42
|
+
* () => (query ? fetchResults(query) : null),
|
|
43
|
+
* [query]
|
|
44
|
+
* );
|
|
45
|
+
*/
|
|
46
|
+
declare function useFaviconTask<T>(factory: () => Promise<T> | null, deps: DependencyList, options?: TaskOptions): UseFaviconTaskResult<T>;
|
|
47
|
+
|
|
48
|
+
export { type UseFaviconStateOptions, type UseFaviconTaskResult, type UseFaviconTaskStatus, useFaviconState, useFaviconTask };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FaviconState, TaskOptions } from '@live-favicon/core';
|
|
2
|
+
export { FAVICON_SIZE, FaviconState, TaskOptions, default as favicon } from '@live-favicon/core';
|
|
3
|
+
import { DependencyList } from 'react';
|
|
4
|
+
|
|
5
|
+
interface UseFaviconStateOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Restore the page's original favicon and title when this component
|
|
8
|
+
* unmounts. Default: true. Since the favicon is a single, page-wide
|
|
9
|
+
* singleton, only set this to false if another part of the app is
|
|
10
|
+
* responsible for resetting it.
|
|
11
|
+
*/
|
|
12
|
+
resetOnUnmount?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Drives the shared favicon singleton from a piece of React state.
|
|
16
|
+
* Pass `null`/`undefined` to leave the favicon untouched — useful before a
|
|
17
|
+
* state is known yet.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* function GenerationStatus({ status }: { status: "pending" | "done" | "failed" }) {
|
|
21
|
+
* useFaviconState(
|
|
22
|
+
* status === "pending" ? "thinking" : status === "done" ? "success" : "error"
|
|
23
|
+
* );
|
|
24
|
+
* return null;
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
27
|
+
declare function useFaviconState(state: FaviconState | null | undefined, options?: UseFaviconStateOptions): void;
|
|
28
|
+
|
|
29
|
+
type UseFaviconTaskStatus = "idle" | "pending" | "success" | "error";
|
|
30
|
+
interface UseFaviconTaskResult<T> {
|
|
31
|
+
data: T | undefined;
|
|
32
|
+
error: unknown;
|
|
33
|
+
status: UseFaviconTaskStatus;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Runs `factory()` whenever `deps` change, driving the favicon through its
|
|
37
|
+
* task lifecycle (start -> success/error) for the duration. Returning `null`
|
|
38
|
+
* from `factory` skips the run — e.g. while required inputs aren't ready.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const { status, data } = useFaviconTask(
|
|
42
|
+
* () => (query ? fetchResults(query) : null),
|
|
43
|
+
* [query]
|
|
44
|
+
* );
|
|
45
|
+
*/
|
|
46
|
+
declare function useFaviconTask<T>(factory: () => Promise<T> | null, deps: DependencyList, options?: TaskOptions): UseFaviconTaskResult<T>;
|
|
47
|
+
|
|
48
|
+
export { type UseFaviconStateOptions, type UseFaviconTaskResult, type UseFaviconTaskStatus, useFaviconState, useFaviconTask };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{default as h,FAVICON_SIZE as w}from"@live-favicon/core";import{useEffect as f,useRef as v}from"react";import p from"@live-favicon/core";function m(e,o={}){let{resetOnUnmount:t=!0}=o,n=v(t);n.current=t,f(()=>{e&&p.state(e)},[e]),f(()=>()=>{n.current&&p.reset()},[])}import{useEffect as F,useRef as d,useState as l}from"react";import T from"@live-favicon/core";function k(e,o,t){let[n,s]=l({data:void 0,error:void 0,status:"idle"}),i=d(e);i.current=e;let c=d(t);return c.current=t,F(()=>{let u=i.current();if(!u)return;let r=!1;return s({data:void 0,error:void 0,status:"pending"}),T.task(u,c.current).then(a=>{r||s({data:a,error:void 0,status:"success"})}).catch(a=>{r||s({data:void 0,error:a,status:"error"})}),()=>{r=!0}},o),n}export{w as FAVICON_SIZE,h as favicon,m as useFaviconState,k as useFaviconTask};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/useFaviconState.ts","../src/useFaviconTask.ts"],"sourcesContent":["export { default as favicon, FAVICON_SIZE } from \"@live-favicon/core\";\nexport type { FaviconState, TaskOptions } from \"@live-favicon/core\";\n\nexport { useFaviconState } from \"./useFaviconState\";\nexport type { UseFaviconStateOptions } from \"./useFaviconState\";\n\nexport { useFaviconTask } from \"./useFaviconTask\";\nexport type { UseFaviconTaskResult, UseFaviconTaskStatus } from \"./useFaviconTask\";\n","import { useEffect, useRef } from \"react\";\nimport favicon from \"@live-favicon/core\";\nimport type { FaviconState } from \"@live-favicon/core\";\n\nexport interface UseFaviconStateOptions {\n /**\n * Restore the page's original favicon and title when this component\n * unmounts. Default: true. Since the favicon is a single, page-wide\n * singleton, only set this to false if another part of the app is\n * responsible for resetting it.\n */\n resetOnUnmount?: boolean;\n}\n\n/**\n * Drives the shared favicon singleton from a piece of React state.\n * Pass `null`/`undefined` to leave the favicon untouched — useful before a\n * state is known yet.\n *\n * @example\n * function GenerationStatus({ status }: { status: \"pending\" | \"done\" | \"failed\" }) {\n * useFaviconState(\n * status === \"pending\" ? \"thinking\" : status === \"done\" ? \"success\" : \"error\"\n * );\n * return null;\n * }\n */\nexport function useFaviconState(\n state: FaviconState | null | undefined,\n options: UseFaviconStateOptions = {},\n): void {\n const { resetOnUnmount = true } = options;\n const resetOnUnmountRef = useRef(resetOnUnmount);\n resetOnUnmountRef.current = resetOnUnmount;\n\n useEffect(() => {\n if (state) favicon.state(state);\n }, [state]);\n\n useEffect(() => {\n return () => {\n if (resetOnUnmountRef.current) favicon.reset();\n };\n }, []);\n}\n","import { useEffect, useRef, useState, type DependencyList } from \"react\";\nimport favicon from \"@live-favicon/core\";\nimport type { TaskOptions } from \"@live-favicon/core\";\n\nexport type UseFaviconTaskStatus = \"idle\" | \"pending\" | \"success\" | \"error\";\n\nexport interface UseFaviconTaskResult<T> {\n data: T | undefined;\n error: unknown;\n status: UseFaviconTaskStatus;\n}\n\n/**\n * Runs `factory()` whenever `deps` change, driving the favicon through its\n * task lifecycle (start -> success/error) for the duration. Returning `null`\n * from `factory` skips the run — e.g. while required inputs aren't ready.\n *\n * @example\n * const { status, data } = useFaviconTask(\n * () => (query ? fetchResults(query) : null),\n * [query]\n * );\n */\nexport function useFaviconTask<T>(\n factory: () => Promise<T> | null,\n deps: DependencyList,\n options?: TaskOptions,\n): UseFaviconTaskResult<T> {\n const [state, setState] = useState<UseFaviconTaskResult<T>>({\n data: undefined,\n error: undefined,\n status: \"idle\",\n });\n\n const factoryRef = useRef(factory);\n factoryRef.current = factory;\n const optionsRef = useRef(options);\n optionsRef.current = options;\n\n useEffect(() => {\n const promise = factoryRef.current();\n if (!promise) return;\n\n let cancelled = false;\n setState({ data: undefined, error: undefined, status: \"pending\" });\n\n favicon\n .task(promise, optionsRef.current)\n .then((data) => {\n if (!cancelled) setState({ data, error: undefined, status: \"success\" });\n })\n .catch((error: unknown) => {\n if (!cancelled) setState({ data: undefined, error, status: \"error\" });\n });\n\n return () => {\n cancelled = true;\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, deps);\n\n return state;\n}\n"],"mappings":"AAAA,OAAoB,WAAXA,EAAoB,gBAAAC,MAAoB,qBCAjD,OAAS,aAAAC,EAAW,UAAAC,MAAc,QAClC,OAAOC,MAAa,qBA0Bb,SAASC,EACdC,EACAC,EAAkC,CAAC,EAC7B,CACN,GAAM,CAAE,eAAAC,EAAiB,EAAK,EAAID,EAC5BE,EAAoBN,EAAOK,CAAc,EAC/CC,EAAkB,QAAUD,EAE5BN,EAAU,IAAM,CACVI,GAAOF,EAAQ,MAAME,CAAK,CAChC,EAAG,CAACA,CAAK,CAAC,EAEVJ,EAAU,IACD,IAAM,CACPO,EAAkB,SAASL,EAAQ,MAAM,CAC/C,EACC,CAAC,CAAC,CACP,CC5CA,OAAS,aAAAM,EAAW,UAAAC,EAAQ,YAAAC,MAAqC,QACjE,OAAOC,MAAa,qBAsBb,SAASC,EACdC,EACAC,EACAC,EACyB,CACzB,GAAM,CAACC,EAAOC,CAAQ,EAAIP,EAAkC,CAC1D,KAAM,OACN,MAAO,OACP,OAAQ,MACV,CAAC,EAEKQ,EAAaT,EAAOI,CAAO,EACjCK,EAAW,QAAUL,EACrB,IAAMM,EAAaV,EAAOM,CAAO,EACjC,OAAAI,EAAW,QAAUJ,EAErBP,EAAU,IAAM,CACd,IAAMY,EAAUF,EAAW,QAAQ,EACnC,GAAI,CAACE,EAAS,OAEd,IAAIC,EAAY,GAChB,OAAAJ,EAAS,CAAE,KAAM,OAAW,MAAO,OAAW,OAAQ,SAAU,CAAC,EAEjEN,EACG,KAAKS,EAASD,EAAW,OAAO,EAChC,KAAMG,GAAS,CACTD,GAAWJ,EAAS,CAAE,KAAAK,EAAM,MAAO,OAAW,OAAQ,SAAU,CAAC,CACxE,CAAC,EACA,MAAOC,GAAmB,CACpBF,GAAWJ,EAAS,CAAE,KAAM,OAAW,MAAAM,EAAO,OAAQ,OAAQ,CAAC,CACtE,CAAC,EAEI,IAAM,CACXF,EAAY,EACd,CAEF,EAAGP,CAAI,EAEAE,CACT","names":["default","FAVICON_SIZE","useEffect","useRef","favicon","useFaviconState","state","options","resetOnUnmount","resetOnUnmountRef","useEffect","useRef","useState","favicon","useFaviconTask","factory","deps","options","state","setState","factoryRef","optionsRef","promise","cancelled","data","error"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@live-favicon/react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React hooks for live-favicon.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.cjs",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"dev": "tsup --watch",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"typecheck": "tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"favicon",
|
|
32
|
+
"react",
|
|
33
|
+
"hooks",
|
|
34
|
+
"browser-tab",
|
|
35
|
+
"status"
|
|
36
|
+
],
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/cridorainfo/live-favicon.git",
|
|
41
|
+
"directory": "packages/react"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react": ">=17"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@live-favicon/core": "^0.1.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@testing-library/react": "^16.0.1",
|
|
51
|
+
"@types/react": "^18.3.12",
|
|
52
|
+
"jsdom": "^25.0.1",
|
|
53
|
+
"react": "^18.3.1",
|
|
54
|
+
"react-dom": "^18.3.1",
|
|
55
|
+
"tsup": "^8.3.5",
|
|
56
|
+
"typescript": "^5.7.2",
|
|
57
|
+
"vitest": "^2.1.8"
|
|
58
|
+
}
|
|
59
|
+
}
|