@flowgram.ai/i18n-plugin 0.1.0-alpha.2
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/esm/index.js +24 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { I18n as I18n2 } from "@flowgram.ai/i18n";
|
|
3
|
+
|
|
4
|
+
// src/create-i18n-plugin.ts
|
|
5
|
+
import { I18n } from "@flowgram.ai/i18n";
|
|
6
|
+
import { definePluginCreator } from "@flowgram.ai/core";
|
|
7
|
+
var createI18nPlugin = definePluginCreator({
|
|
8
|
+
onInit: (ctx, _opts) => {
|
|
9
|
+
if (_opts.onLanguageChange) {
|
|
10
|
+
ctx.playground.toDispose.push(I18n.onLanguageChange(_opts.onLanguageChange));
|
|
11
|
+
}
|
|
12
|
+
if (_opts.languages) {
|
|
13
|
+
_opts.languages.forEach((language) => I18n.addLanguage(language));
|
|
14
|
+
}
|
|
15
|
+
if (_opts.localLanguage) {
|
|
16
|
+
I18n.setLocalLanguage(_opts.localLanguage);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
I18n2 as I18n,
|
|
22
|
+
createI18nPlugin
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/create-i18n-plugin.ts"],"sourcesContent":["export { I18n, type I18nLanguage } from '@flowgram.ai/i18n';\nexport { createI18nPlugin, type I18nPluginOptions } from './create-i18n-plugin';\n","import { I18n, type I18nLanguage } from '@flowgram.ai/i18n';\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nexport interface I18nPluginOptions {\n localLanguage?: string;\n languages?: I18nLanguage[];\n onLanguageChange?: (languageId: string) => void;\n}\n/**\n * I18n Plugin\n */\nexport const createI18nPlugin = definePluginCreator<I18nPluginOptions>({\n onInit: (ctx, _opts) => {\n if (_opts.onLanguageChange) {\n ctx.playground.toDispose.push(I18n.onLanguageChange(_opts.onLanguageChange));\n }\n if (_opts.languages) {\n _opts.languages.forEach((language) => I18n.addLanguage(language));\n }\n if (_opts.localLanguage) {\n I18n.setLocalLanguage(_opts.localLanguage);\n }\n },\n});\n"],"mappings":";AAAA,SAAS,QAAAA,aAA+B;;;ACAxC,SAAS,YAA+B;AACxC,SAAS,2BAA2B;AAU7B,IAAM,mBAAmB,oBAAuC;AAAA,EACrE,QAAQ,CAAC,KAAK,UAAU;AACtB,QAAI,MAAM,kBAAkB;AAC1B,UAAI,WAAW,UAAU,KAAK,KAAK,iBAAiB,MAAM,gBAAgB,CAAC;AAAA,IAC7E;AACA,QAAI,MAAM,WAAW;AACnB,YAAM,UAAU,QAAQ,CAAC,aAAa,KAAK,YAAY,QAAQ,CAAC;AAAA,IAClE;AACA,QAAI,MAAM,eAAe;AACvB,WAAK,iBAAiB,MAAM,aAAa;AAAA,IAC3C;AAAA,EACF;AACF,CAAC;","names":["I18n"]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { I18nLanguage } from '@flowgram.ai/i18n';
|
|
2
|
+
export { I18n, I18nLanguage } from '@flowgram.ai/i18n';
|
|
3
|
+
import * as _flowgram_ai_core from '@flowgram.ai/core';
|
|
4
|
+
|
|
5
|
+
interface I18nPluginOptions {
|
|
6
|
+
localLanguage?: string;
|
|
7
|
+
languages?: I18nLanguage[];
|
|
8
|
+
onLanguageChange?: (languageId: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* I18n Plugin
|
|
12
|
+
*/
|
|
13
|
+
declare const createI18nPlugin: _flowgram_ai_core.PluginCreator<I18nPluginOptions>;
|
|
14
|
+
|
|
15
|
+
export { type I18nPluginOptions, createI18nPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { I18nLanguage } from '@flowgram.ai/i18n';
|
|
2
|
+
export { I18n, I18nLanguage } from '@flowgram.ai/i18n';
|
|
3
|
+
import * as _flowgram_ai_core from '@flowgram.ai/core';
|
|
4
|
+
|
|
5
|
+
interface I18nPluginOptions {
|
|
6
|
+
localLanguage?: string;
|
|
7
|
+
languages?: I18nLanguage[];
|
|
8
|
+
onLanguageChange?: (languageId: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* I18n Plugin
|
|
12
|
+
*/
|
|
13
|
+
declare const createI18nPlugin: _flowgram_ai_core.PluginCreator<I18nPluginOptions>;
|
|
14
|
+
|
|
15
|
+
export { type I18nPluginOptions, createI18nPlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
I18n: () => import_i18n2.I18n,
|
|
24
|
+
createI18nPlugin: () => createI18nPlugin
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
var import_i18n2 = require("@flowgram.ai/i18n");
|
|
28
|
+
|
|
29
|
+
// src/create-i18n-plugin.ts
|
|
30
|
+
var import_i18n = require("@flowgram.ai/i18n");
|
|
31
|
+
var import_core = require("@flowgram.ai/core");
|
|
32
|
+
var createI18nPlugin = (0, import_core.definePluginCreator)({
|
|
33
|
+
onInit: (ctx, _opts) => {
|
|
34
|
+
if (_opts.onLanguageChange) {
|
|
35
|
+
ctx.playground.toDispose.push(import_i18n.I18n.onLanguageChange(_opts.onLanguageChange));
|
|
36
|
+
}
|
|
37
|
+
if (_opts.languages) {
|
|
38
|
+
_opts.languages.forEach((language) => import_i18n.I18n.addLanguage(language));
|
|
39
|
+
}
|
|
40
|
+
if (_opts.localLanguage) {
|
|
41
|
+
import_i18n.I18n.setLocalLanguage(_opts.localLanguage);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
I18n,
|
|
48
|
+
createI18nPlugin
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/create-i18n-plugin.ts"],"sourcesContent":["export { I18n, type I18nLanguage } from '@flowgram.ai/i18n';\nexport { createI18nPlugin, type I18nPluginOptions } from './create-i18n-plugin';\n","import { I18n, type I18nLanguage } from '@flowgram.ai/i18n';\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nexport interface I18nPluginOptions {\n localLanguage?: string;\n languages?: I18nLanguage[];\n onLanguageChange?: (languageId: string) => void;\n}\n/**\n * I18n Plugin\n */\nexport const createI18nPlugin = definePluginCreator<I18nPluginOptions>({\n onInit: (ctx, _opts) => {\n if (_opts.onLanguageChange) {\n ctx.playground.toDispose.push(I18n.onLanguageChange(_opts.onLanguageChange));\n }\n if (_opts.languages) {\n _opts.languages.forEach((language) => I18n.addLanguage(language));\n }\n if (_opts.localLanguage) {\n I18n.setLocalLanguage(_opts.localLanguage);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,eAAwC;;;ACAxC,kBAAwC;AACxC,kBAAoC;AAU7B,IAAM,uBAAmB,iCAAuC;AAAA,EACrE,QAAQ,CAAC,KAAK,UAAU;AACtB,QAAI,MAAM,kBAAkB;AAC1B,UAAI,WAAW,UAAU,KAAK,iBAAK,iBAAiB,MAAM,gBAAgB,CAAC;AAAA,IAC7E;AACA,QAAI,MAAM,WAAW;AACnB,YAAM,UAAU,QAAQ,CAAC,aAAa,iBAAK,YAAY,QAAQ,CAAC;AAAA,IAClE;AACA,QAAI,MAAM,eAAe;AACvB,uBAAK,iBAAiB,MAAM,aAAa;AAAA,IAC3C;AAAA,EACF;AACF,CAAC;","names":["import_i18n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flowgram.ai/i18n-plugin",
|
|
3
|
+
"version": "0.1.0-alpha.2",
|
|
4
|
+
"homepage": "https://flowgram.ai/",
|
|
5
|
+
"repository": "https://github.com/bytedance/flowgram.ai",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"exports": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/esm/index.js",
|
|
10
|
+
"require": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"module": "./dist/esm/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@flowgram.ai/core": "0.1.0-alpha.2",
|
|
20
|
+
"@flowgram.ai/i18n": "0.1.0-alpha.2"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/bezier-js": "4.1.3",
|
|
24
|
+
"@types/lodash": "^4.14.137",
|
|
25
|
+
"@types/react": "^18",
|
|
26
|
+
"@types/react-dom": "^18",
|
|
27
|
+
"@types/styled-components": "^5",
|
|
28
|
+
"@vitest/coverage-v8": "^0.32.0",
|
|
29
|
+
"eslint": "^8.54.0",
|
|
30
|
+
"react": "^18",
|
|
31
|
+
"react-dom": "^18",
|
|
32
|
+
"reflect-metadata": "~0.2.2",
|
|
33
|
+
"styled-components": "^5",
|
|
34
|
+
"tsup": "^8.0.1",
|
|
35
|
+
"vitest": "^0.34.6",
|
|
36
|
+
"@flowgram.ai/eslint-config": "0.1.0-alpha.2",
|
|
37
|
+
"@flowgram.ai/ts-config": "0.1.0-alpha.2"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public",
|
|
42
|
+
"registry": "https://registry.npmjs.org/"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "npm run build:fast -- --dts-resolve",
|
|
46
|
+
"build:fast": "tsup src/index.ts --format cjs,esm --sourcemap --legacy-output",
|
|
47
|
+
"build:watch": "npm run build:fast -- --dts-resolve",
|
|
48
|
+
"clean": "rimraf dist",
|
|
49
|
+
"test": "exit 0",
|
|
50
|
+
"test:cov": "exit 0",
|
|
51
|
+
"watch": "npm run build:fast -- --dts-resolve --watch --ignore-watch dist"
|
|
52
|
+
}
|
|
53
|
+
}
|