kotori 0.0.12 → 0.0.14
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 +2 -2
- package/dist/index.cjs +3 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -4
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ const intro = dict({
|
|
|
16
16
|
zh: '你好,现在是 {{time}} 吗?',
|
|
17
17
|
// ❌ TypeScript error: unknown key 'nam'
|
|
18
18
|
ms: 'Hai {{nam}}, adakah pukul {{time}} sekarang?'
|
|
19
|
-
// optional: type your arguments, by default it's `Record<'name'|'time', string>` in this example
|
|
19
|
+
// optional: type your arguments, by default it's `Record<'name'|'time', string | number>` in this example
|
|
20
20
|
})<{name: string; time: `${number}:${number}`}>
|
|
21
21
|
|
|
22
22
|
// ✅ Works
|
|
@@ -75,7 +75,7 @@ const time = dict({
|
|
|
75
75
|
zh: '时间 {{time}}',
|
|
76
76
|
ja: '時間 {{time}}',
|
|
77
77
|
ms: 'waktu {{time}}',
|
|
78
|
-
// optional: type your arguments, by default it's `Record<'time', string>` in this example
|
|
78
|
+
// optional: type your arguments, by default it's `Record<'time', string | number>` in this example
|
|
79
79
|
})<{ time: `${number}:${number}:${number}` }>
|
|
80
80
|
|
|
81
81
|
const { useTranslations } = createTranslations({
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let react = require("react");
|
|
3
|
-
|
|
4
3
|
//#region src/index.ts
|
|
5
4
|
const kotori = (props) => {
|
|
6
5
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -42,10 +41,9 @@ const kotori = (props) => {
|
|
|
42
41
|
if (refCount === 0) snapshots.delete(s);
|
|
43
42
|
listeners.delete(listener);
|
|
44
43
|
};
|
|
45
|
-
}, () => snapshots.get(s)) };
|
|
44
|
+
}, () => snapshots.get(s), () => snapshot) };
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
47
|
};
|
|
49
|
-
|
|
50
48
|
//#endregion
|
|
51
|
-
exports.kotori = kotori;
|
|
49
|
+
exports.kotori = kotori;
|
package/dist/index.d.cts
CHANGED
|
@@ -12,7 +12,7 @@ declare const kotori: <const PrimaryTag extends AllTags, const SecondaryTags ext
|
|
|
12
12
|
primaryLanguageTag: PrimaryTag;
|
|
13
13
|
secondaryLanguageTags: SecondaryTags[];
|
|
14
14
|
}) => {
|
|
15
|
-
dict: <const PrimaryString extends string, const SecondaryObject extends { [Key in SecondaryTags]: ExtractVariables<PrimaryString> extends infer PrimaryVariables ? ExtractVariables<SecondaryObject[Key] & string> extends infer SecondaryVariables ? PrimaryVariables[] extends SecondaryVariables[] ? SecondaryVariables[] extends PrimaryVariables[] ? SecondaryObject[Key] : "variables not match!" : "variables not match!!" : never : never }>(translation: { [Key in PrimaryTag]: PrimaryString } & SecondaryObject) => <const ArgsType extends Record<ExtractVariables<PrimaryString>, string | number> = Record<ExtractVariables<PrimaryString>, string>>() => Readonly<{
|
|
15
|
+
dict: <const PrimaryString extends string, const SecondaryObject extends { [Key in SecondaryTags]: ExtractVariables<PrimaryString> extends infer PrimaryVariables ? ExtractVariables<SecondaryObject[Key] & string> extends infer SecondaryVariables ? PrimaryVariables[] extends SecondaryVariables[] ? SecondaryVariables[] extends PrimaryVariables[] ? SecondaryObject[Key] : "variables not match!" : "variables not match!!" : never : never }>(translation: { [Key in PrimaryTag]: PrimaryString } & SecondaryObject) => <const ArgsType extends Record<ExtractVariables<PrimaryString>, string | number> = Record<ExtractVariables<PrimaryString>, string | number>>() => Readonly<{
|
|
16
16
|
translation: typeof translation;
|
|
17
17
|
[_args]?: ArgsType;
|
|
18
18
|
}>;
|
package/dist/index.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ declare const kotori: <const PrimaryTag extends AllTags, const SecondaryTags ext
|
|
|
12
12
|
primaryLanguageTag: PrimaryTag;
|
|
13
13
|
secondaryLanguageTags: SecondaryTags[];
|
|
14
14
|
}) => {
|
|
15
|
-
dict: <const PrimaryString extends string, const SecondaryObject extends { [Key in SecondaryTags]: ExtractVariables<PrimaryString> extends infer PrimaryVariables ? ExtractVariables<SecondaryObject[Key] & string> extends infer SecondaryVariables ? PrimaryVariables[] extends SecondaryVariables[] ? SecondaryVariables[] extends PrimaryVariables[] ? SecondaryObject[Key] : "variables not match!" : "variables not match!!" : never : never }>(translation: { [Key in PrimaryTag]: PrimaryString } & SecondaryObject) => <const ArgsType extends Record<ExtractVariables<PrimaryString>, string | number> = Record<ExtractVariables<PrimaryString>, string>>() => Readonly<{
|
|
15
|
+
dict: <const PrimaryString extends string, const SecondaryObject extends { [Key in SecondaryTags]: ExtractVariables<PrimaryString> extends infer PrimaryVariables ? ExtractVariables<SecondaryObject[Key] & string> extends infer SecondaryVariables ? PrimaryVariables[] extends SecondaryVariables[] ? SecondaryVariables[] extends PrimaryVariables[] ? SecondaryObject[Key] : "variables not match!" : "variables not match!!" : never : never }>(translation: { [Key in PrimaryTag]: PrimaryString } & SecondaryObject) => <const ArgsType extends Record<ExtractVariables<PrimaryString>, string | number> = Record<ExtractVariables<PrimaryString>, string | number>>() => Readonly<{
|
|
16
16
|
translation: typeof translation;
|
|
17
17
|
[_args]?: ArgsType;
|
|
18
18
|
}>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
|
2
|
-
|
|
3
2
|
//#region src/index.ts
|
|
4
3
|
const kotori = (props) => {
|
|
5
4
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -41,10 +40,9 @@ const kotori = (props) => {
|
|
|
41
40
|
if (refCount === 0) snapshots.delete(s);
|
|
42
41
|
listeners.delete(listener);
|
|
43
42
|
};
|
|
44
|
-
}, () => snapshots.get(s)) };
|
|
43
|
+
}, () => snapshots.get(s), () => snapshot) };
|
|
45
44
|
}
|
|
46
45
|
};
|
|
47
46
|
};
|
|
48
|
-
|
|
49
47
|
//#endregion
|
|
50
|
-
export { kotori };
|
|
48
|
+
export { kotori };
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kotori",
|
|
3
3
|
"description": "Strongly-typed and composable internationalization library for React",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.14",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"setup": "rm -rf node_modules && npm i && git init && husky",
|
|
7
7
|
"prepublishOnly": "npm i && npx tsc && npm run build",
|
|
8
8
|
"build": "tsdown",
|
|
9
|
+
"size": "tsdown --minify",
|
|
9
10
|
"test": "vitest",
|
|
10
11
|
"lint": "npx @biomejs/biome check --write",
|
|
11
12
|
"dev": "vite --host"
|