@flowgram.ai/i18n-plugin 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.
@@ -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"]}
@@ -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 };
@@ -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,51 @@
1
+ {
2
+ "name": "@flowgram.ai/i18n-plugin",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "exports": {
6
+ "types": "./dist/index.d.ts",
7
+ "import": "./dist/esm/index.js",
8
+ "require": "./dist/index.js"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "module": "./dist/esm/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "dependencies": {
17
+ "@flowgram.ai/i18n": "0.1.0",
18
+ "@flowgram.ai/core": "0.1.0"
19
+ },
20
+ "devDependencies": {
21
+ "@types/bezier-js": "4.1.3",
22
+ "@types/lodash": "^4.14.137",
23
+ "@types/react": "^18",
24
+ "@types/react-dom": "^18",
25
+ "@types/styled-components": "^5",
26
+ "@vitest/coverage-v8": "^0.32.0",
27
+ "eslint": "^8.54.0",
28
+ "react": "^18",
29
+ "react-dom": "^18",
30
+ "reflect-metadata": "~0.2.2",
31
+ "styled-components": "^5",
32
+ "tsup": "^8.0.1",
33
+ "vitest": "^0.34.6",
34
+ "@flowgram.ai/ts-config": "0.1.0",
35
+ "@flowgram.ai/eslint-config": "0.1.0"
36
+ },
37
+ "peerDependencies": {},
38
+ "publishConfig": {
39
+ "access": "public",
40
+ "registry": "https://registry.npmjs.org/"
41
+ },
42
+ "scripts": {
43
+ "build": "npm run build:fast -- --dts-resolve",
44
+ "build:fast": "tsup src/index.ts --format cjs,esm --sourcemap --legacy-output",
45
+ "build:watch": "npm run build:fast -- --dts-resolve",
46
+ "clean": "rimraf dist",
47
+ "test": "exit 0",
48
+ "test:cov": "exit 0",
49
+ "watch": "npm run build:fast -- --dts-resolve --watch --ignore-watch dist"
50
+ }
51
+ }