kotori 0.1.4 → 0.1.6

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
@@ -162,7 +162,7 @@ export const Page2 = () => {
162
162
 
163
163
  ## How It Works
164
164
 
165
- ![how kotori works](image.png)
165
+ ![how kotori works](image.webp)
166
166
 
167
167
  ### One `kotori` instance per app
168
168
 
package/dist/index.cjs CHANGED
@@ -17,6 +17,12 @@ const kotori = (props) => {
17
17
  listener();
18
18
  });
19
19
  };
20
+ const subscribe = (listener) => {
21
+ listeners.add(listener);
22
+ return () => {
23
+ listeners.delete(listener);
24
+ };
25
+ };
20
26
  return {
21
27
  setLanguage,
22
28
  dict: (translation) => () => ({ translation }),
@@ -32,12 +38,7 @@ const kotori = (props) => {
32
38
  }
33
39
  };
34
40
  snapshots.set(s, snapshot);
35
- return { useTranslations: () => (0, react.useSyncExternalStore)((listener) => {
36
- listeners.add(listener);
37
- return () => {
38
- listeners.delete(listener);
39
- };
40
- }, () => snapshots.get(s), () => snapshot) };
41
+ return { useTranslations: () => (0, react.useSyncExternalStore)(subscribe, () => snapshots.get(s), () => snapshot) };
41
42
  }
42
43
  };
43
44
  };
package/dist/index.mjs CHANGED
@@ -16,6 +16,12 @@ const kotori = (props) => {
16
16
  listener();
17
17
  });
18
18
  };
19
+ const subscribe = (listener) => {
20
+ listeners.add(listener);
21
+ return () => {
22
+ listeners.delete(listener);
23
+ };
24
+ };
19
25
  return {
20
26
  setLanguage,
21
27
  dict: (translation) => () => ({ translation }),
@@ -31,12 +37,7 @@ const kotori = (props) => {
31
37
  }
32
38
  };
33
39
  snapshots.set(s, snapshot);
34
- return { useTranslations: () => useSyncExternalStore((listener) => {
35
- listeners.add(listener);
36
- return () => {
37
- listeners.delete(listener);
38
- };
39
- }, () => snapshots.get(s), () => snapshot) };
40
+ return { useTranslations: () => useSyncExternalStore(subscribe, () => snapshots.get(s), () => snapshot) };
40
41
  }
41
42
  };
42
43
  };
package/package.json CHANGED
@@ -1,73 +1,73 @@
1
- {
2
- "name": "kotori",
3
- "description": "Strongly-typed and composable internationalization library for React",
4
- "version": "0.1.4",
5
- "scripts": {
6
- "setup": "rm -rf node_modules && npm i && git init && husky",
7
- "prepublishOnly": "npm i && npx tsc && npm run build",
8
- "build": "tsdown",
9
- "size": "tsdown --minify",
10
- "test": "vitest",
11
- "lint": "npx @biomejs/biome check --write",
12
- "dev": "vite --host"
13
- },
14
- "files": [
15
- "dist"
16
- ],
17
- "lint-staged": {
18
- "*": [
19
- "npm run lint"
20
- ]
21
- },
22
- "type": "module",
23
- "main": "./dist/index.cjs",
24
- "types": "./dist/index.d.cts",
25
- "exports": {
26
- ".": {
27
- "require": {
28
- "types": "./dist/index.d.cts",
29
- "default": "./dist/index.cjs"
30
- },
31
- "import": {
32
- "types": "./dist/index.d.mts",
33
- "default": "./dist/index.mjs"
34
- }
35
- }
36
- },
37
- "keywords": [
38
- "i18n",
39
- "internationalization",
40
- "react",
41
- "typescript",
42
- "strongly-typed"
43
- ],
44
- "devDependencies": {
45
- "@biomejs/biome": "^2.4.12",
46
- "@types/node": "^25.6.0",
47
- "@types/react": "^19.2.14",
48
- "@types/react-dom": "^19.2.3",
49
- "@vitejs/plugin-react": "^6.0.1",
50
- "@vitest/coverage-v8": "^4.1.5",
51
- "bcp47-language-tags": "^1.1.0",
52
- "husky": "^9.1.7",
53
- "lint-staged": "^16.4.0",
54
- "react": "^19.2.5",
55
- "react-dom": "^19.2.5",
56
- "tsdown": "^0.21.10",
57
- "tsx": "^4.21.0",
58
- "typescript": "^6.0.3",
59
- "vitest": "^4.1.5"
60
- },
61
- "repository": {
62
- "type": "git",
63
- "url": "git+https://github.com/tylim88/kotori.git"
64
- },
65
- "bugs": {
66
- "url": "https://github.com/tylim88/kotori/issues"
67
- },
68
- "author": "tylim88",
69
- "license": "MIT",
70
- "peerDependencies": {
71
- "react": ">=19.2.5"
72
- }
73
- }
1
+ {
2
+ "name": "kotori",
3
+ "description": "Strongly-typed and composable internationalization library for React",
4
+ "version": "0.1.6",
5
+ "scripts": {
6
+ "setup": "rm -rf node_modules && npm i && git init && husky",
7
+ "prepublishOnly": "npm i && npx tsc && npm run build",
8
+ "build": "tsdown",
9
+ "size": "tsdown --minify",
10
+ "test": "vitest",
11
+ "lint": "npx @biomejs/biome check --write",
12
+ "dev": "vite --host"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "lint-staged": {
18
+ "*": [
19
+ "npm run lint"
20
+ ]
21
+ },
22
+ "type": "module",
23
+ "main": "./dist/index.cjs",
24
+ "types": "./dist/index.d.cts",
25
+ "exports": {
26
+ ".": {
27
+ "require": {
28
+ "types": "./dist/index.d.cts",
29
+ "default": "./dist/index.cjs"
30
+ },
31
+ "import": {
32
+ "types": "./dist/index.d.mts",
33
+ "default": "./dist/index.mjs"
34
+ }
35
+ }
36
+ },
37
+ "keywords": [
38
+ "i18n",
39
+ "internationalization",
40
+ "react",
41
+ "typescript",
42
+ "strongly-typed"
43
+ ],
44
+ "devDependencies": {
45
+ "@biomejs/biome": "^2.4.12",
46
+ "@types/node": "^25.6.0",
47
+ "@types/react": "^19.2.14",
48
+ "@types/react-dom": "^19.2.3",
49
+ "@vitejs/plugin-react": "^6.0.1",
50
+ "@vitest/coverage-v8": "^4.1.5",
51
+ "bcp47-language-tags": "^1.1.0",
52
+ "husky": "^9.1.7",
53
+ "lint-staged": "^16.4.0",
54
+ "react": "^19.2.5",
55
+ "react-dom": "^19.2.5",
56
+ "tsdown": "^0.21.10",
57
+ "tsx": "^4.21.0",
58
+ "typescript": "^6.0.3",
59
+ "vitest": "^4.1.5"
60
+ },
61
+ "repository": {
62
+ "type": "git",
63
+ "url": "git+https://github.com/tylim88/kotori.git"
64
+ },
65
+ "bugs": {
66
+ "url": "https://github.com/tylim88/kotori/issues"
67
+ },
68
+ "author": "tylim88",
69
+ "license": "MIT",
70
+ "peerDependencies": {
71
+ "react": ">=19.2.5"
72
+ }
73
+ }