@intlayer/editor-react 4.0.3

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.
Files changed (45) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +18 -0
  3. package/dist/cjs/CommunicatorContext.cjs +43 -0
  4. package/dist/cjs/CommunicatorContext.cjs.map +1 -0
  5. package/dist/cjs/DictionariesRecordContext.cjs +61 -0
  6. package/dist/cjs/DictionariesRecordContext.cjs.map +1 -0
  7. package/dist/cjs/EditedContentContext.cjs +193 -0
  8. package/dist/cjs/EditedContentContext.cjs.map +1 -0
  9. package/dist/cjs/EditorProvider.cjs +34 -0
  10. package/dist/cjs/EditorProvider.cjs.map +1 -0
  11. package/dist/cjs/FocusDictionaryContext.cjs +79 -0
  12. package/dist/cjs/FocusDictionaryContext.cjs.map +1 -0
  13. package/dist/cjs/index.cjs +31 -0
  14. package/dist/cjs/index.cjs.map +1 -0
  15. package/dist/cjs/useCrossFrameState.cjs +66 -0
  16. package/dist/cjs/useCrossFrameState.cjs.map +1 -0
  17. package/dist/esm/CommunicatorContext.mjs +18 -0
  18. package/dist/esm/CommunicatorContext.mjs.map +1 -0
  19. package/dist/esm/DictionariesRecordContext.mjs +36 -0
  20. package/dist/esm/DictionariesRecordContext.mjs.map +1 -0
  21. package/dist/esm/EditedContentContext.mjs +173 -0
  22. package/dist/esm/EditedContentContext.mjs.map +1 -0
  23. package/dist/esm/EditorProvider.mjs +12 -0
  24. package/dist/esm/EditorProvider.mjs.map +1 -0
  25. package/dist/esm/FocusDictionaryContext.mjs +53 -0
  26. package/dist/esm/FocusDictionaryContext.mjs.map +1 -0
  27. package/dist/esm/index.mjs +6 -0
  28. package/dist/esm/index.mjs.map +1 -0
  29. package/dist/esm/useCrossFrameState.mjs +44 -0
  30. package/dist/esm/useCrossFrameState.mjs.map +1 -0
  31. package/dist/types/CommunicatorContext.d.ts +9 -0
  32. package/dist/types/CommunicatorContext.d.ts.map +1 -0
  33. package/dist/types/DictionariesRecordContext.d.ts +11 -0
  34. package/dist/types/DictionariesRecordContext.d.ts.map +1 -0
  35. package/dist/types/EditedContentContext.d.ts +28 -0
  36. package/dist/types/EditedContentContext.d.ts.map +1 -0
  37. package/dist/types/EditorProvider.d.ts +4 -0
  38. package/dist/types/EditorProvider.d.ts.map +1 -0
  39. package/dist/types/FocusDictionaryContext.d.ts +21 -0
  40. package/dist/types/FocusDictionaryContext.d.ts.map +1 -0
  41. package/dist/types/index.d.ts +6 -0
  42. package/dist/types/index.d.ts.map +1 -0
  43. package/dist/types/useCrossFrameState.d.ts +3 -0
  44. package/dist/types/useCrossFrameState.d.ts.map +1 -0
  45. package/package.json +102 -0
@@ -0,0 +1,28 @@
1
+ import { type Dictionary, type DictionaryValue, type KeyPath } from '@intlayer/core';
2
+ import { FC, PropsWithChildren } from 'react';
3
+ import { DictionaryContent } from './DictionariesRecordContext';
4
+ type EditedContentActionsContextType = {
5
+ setEditedContent: (dictionaryKey: Dictionary['key'], newValue: DictionaryValue) => void;
6
+ addEditedContent: (dictionaryKey: Dictionary['key'], newValue: DictionaryValue, keyPath?: KeyPath[], overwrite?: boolean) => void;
7
+ renameEditedContent: (dictionaryKey: Dictionary['key'], newKey: KeyPath['key'], keyPath?: KeyPath[]) => void;
8
+ removeEditedContent: (dictionaryKey: Dictionary['key'], keyPath: KeyPath[]) => void;
9
+ restoreEditedContent: (dictionaryKey: Dictionary['key']) => void;
10
+ clearEditedDictionaryContent: (dictionaryKey: Dictionary['key']) => void;
11
+ clearEditedContent: () => void;
12
+ getEditedContentValue: (dictionaryKey: Dictionary['key'], keyPath: KeyPath[]) => DictionaryValue | undefined;
13
+ };
14
+ export declare const EditedContentProvider: FC<PropsWithChildren>;
15
+ export declare const useEditedContentActions: () => EditedContentActionsContextType;
16
+ export declare const useEditedContent: () => {
17
+ setEditedContent: (dictionaryKey: Dictionary["key"], newValue: DictionaryValue) => void;
18
+ addEditedContent: (dictionaryKey: Dictionary["key"], newValue: DictionaryValue, keyPath?: KeyPath[], overwrite?: boolean) => void;
19
+ renameEditedContent: (dictionaryKey: Dictionary["key"], newKey: KeyPath["key"], keyPath?: KeyPath[]) => void;
20
+ removeEditedContent: (dictionaryKey: Dictionary["key"], keyPath: KeyPath[]) => void;
21
+ restoreEditedContent: (dictionaryKey: Dictionary["key"]) => void;
22
+ clearEditedDictionaryContent: (dictionaryKey: Dictionary["key"]) => void;
23
+ clearEditedContent: () => void;
24
+ getEditedContentValue: (dictionaryKey: Dictionary["key"], keyPath: KeyPath[]) => DictionaryValue | undefined;
25
+ editedContent: DictionaryContent;
26
+ };
27
+ export {};
28
+ //# sourceMappingURL=EditedContentContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditedContentContext.d.ts","sourceRoot":"","sources":["../../src/EditedContentContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,OAAO,EAIb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAA6B,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EACL,iBAAiB,EAElB,MAAM,6BAA6B,CAAC;AAWrC,KAAK,+BAA+B,GAAG;IACrC,gBAAgB,EAAE,CAChB,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,EAChC,QAAQ,EAAE,eAAe,KACtB,IAAI,CAAC;IACV,gBAAgB,EAAE,CAChB,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,EAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,OAAO,EAAE,EACnB,SAAS,CAAC,EAAE,OAAO,KAChB,IAAI,CAAC;IACV,mBAAmB,EAAE,CACnB,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,EAChC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,EACtB,OAAO,CAAC,EAAE,OAAO,EAAE,KAChB,IAAI,CAAC;IACV,mBAAmB,EAAE,CACnB,aAAa,EAAE,UAAU,C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G,SAAS;mBAjCjB,iBAAiB;CA2PjC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type FC, type PropsWithChildren } from 'react';
2
+ import { UseCrossPlatformStateProps } from './CommunicatorContext';
3
+ export declare const EditorProvider: FC<PropsWithChildren<UseCrossPlatformStateProps>>;
4
+ //# sourceMappingURL=EditorProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditorProvider.d.ts","sourceRoot":"","sources":["../../src/EditorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,EAEL,0BAA0B,EAC3B,MAAM,uBAAuB,CAAC;AAG/B,eAAO,MAAM,cAAc,EAAE,EAAE,CAC7B,iBAAiB,CAAC,0BAA0B,CAAC,CAS9C,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { KeyPath } from '@intlayer/core';
2
+ import { FC, PropsWithChildren } from 'react';
3
+ type DictionaryPath = string;
4
+ export type FileContent = {
5
+ dictionaryKey: string;
6
+ keyPath?: KeyPath[];
7
+ dictionaryPath?: DictionaryPath;
8
+ };
9
+ interface FocusDictionaryActions {
10
+ setFocusedContent: (content: FileContent | null) => void;
11
+ setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;
12
+ }
13
+ export declare const FocusDictionaryProvider: FC<PropsWithChildren>;
14
+ export declare const useFocusDictionaryActions: () => FocusDictionaryActions;
15
+ export declare const useFocusDictionary: () => {
16
+ setFocusedContent: (content: FileContent | null) => void;
17
+ setFocusedContentKeyPath: (keyPath: KeyPath[]) => void;
18
+ focusedContent: FileContent | null;
19
+ };
20
+ export {};
21
+ //# sourceMappingURL=FocusDictionaryContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FocusDictionaryContext.d.ts","sourceRoot":"","sources":["../../src/FocusDictionaryContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAA6B,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGzE,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAMF,UAAU,sBAAsB;IAC9B,iBAAiB,EAAE,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IACzD,wBAAwB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACxD;AASD,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,iBAAiB,CA4BzD,CAAC;AAEF,eAAO,MAAM,yBAAyB,8BAQrC,CAAC;AAEF,eAAO,MAAM,kBAAkB;uBAnDV,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI;8BAC9B,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,IAAI;oBALtC,WAAW,GAAG,IAAI;CAkEnC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './DictionariesRecordContext';
2
+ export * from './EditedContentContext';
3
+ export * from './FocusDictionaryContext';
4
+ export * from './EditorProvider';
5
+ export * from './useCrossFrameState';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type SetStateAction } from 'react';
2
+ export declare const useCrossFrameState: <T>(key: string, initialValue?: T) => readonly [T, (valueOrUpdater: SetStateAction<T>) => void];
3
+ //# sourceMappingURL=useCrossFrameState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCrossFrameState.d.ts","sourceRoot":"","sources":["../../src/useCrossFrameState.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,OAAO,CAAC;AAGzE,eAAO,MAAM,kBAAkB,GAAI,CAAC,OAAQ,MAAM,iBAAiB,CAAC,mCAuC1B,cAAc,CAAC,CAAC,CAAC,UAe1D,CAAC"}
package/package.json ADDED
@@ -0,0 +1,102 @@
1
+ {
2
+ "name": "@intlayer/editor-react",
3
+ "version": "4.0.3",
4
+ "private": false,
5
+ "description": "Provides the states and context to interact with the Intlayer editor",
6
+ "keywords": [
7
+ "intlayer",
8
+ "editor",
9
+ "api"
10
+ ],
11
+ "homepage": "https://intlayer.org",
12
+ "bugs": {
13
+ "url": "https://github.com/aymericzip/intlayer/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/aymericzip/intlayer.git"
18
+ },
19
+ "license": "Apache-2.0",
20
+ "author": {
21
+ "name": "Aymeric PINEAU",
22
+ "url": "https://github.com/aymericzip"
23
+ },
24
+ "contributors": [
25
+ {
26
+ "name": "Aymeric Pineau",
27
+ "email": "ay.pineau@gmail.com",
28
+ "url": "https://github.com/aymericzip"
29
+ }
30
+ ],
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/types/index.d.ts",
34
+ "require": "./dist/cjs/index.cjs",
35
+ "import": "./dist/esm/index.mjs"
36
+ },
37
+ "./package.json": "./package.json"
38
+ },
39
+ "main": "dist/cjs/index.cjs",
40
+ "module": "dist/esm/index.mjs",
41
+ "types": "dist/types/index.d.ts",
42
+ "typesVersions": {
43
+ "*": {
44
+ "package.json": [
45
+ "./package.json"
46
+ ]
47
+ }
48
+ },
49
+ "files": [
50
+ "./dist",
51
+ "./package.json"
52
+ ],
53
+ "dependencies": {
54
+ "@intlayer/config": "^4.0.3",
55
+ "@intlayer/core": "4.0.3",
56
+ "@intlayer/editor": "4.0.3"
57
+ },
58
+ "devDependencies": {
59
+ "@types/node": "^22.10.6",
60
+ "@types/react": "^18.3.1",
61
+ "@types/react-dom": "^18.3.1",
62
+ "@typescript-eslint/parser": "^8.20.0",
63
+ "concurrently": "^9.1.2",
64
+ "eslint": "^9.18.0",
65
+ "prettier": "^3.4.2",
66
+ "rimraf": "^6.0.1",
67
+ "tsc-alias": "^1.8.10",
68
+ "tsup": "^8.3.5",
69
+ "typescript": "^5.7.3",
70
+ "@utils/ts-config": "1.0.4",
71
+ "@utils/tsup-config": "1.0.4",
72
+ "@utils/ts-config-types": "1.0.4",
73
+ "@utils/eslint-config": "1.0.4"
74
+ },
75
+ "peerDependencies": {
76
+ "react": ">=18.3.1",
77
+ "react-dom": ">=18.3.1",
78
+ "@intlayer/config": "4.0.3",
79
+ "@intlayer/core": "^4.0.3",
80
+ "@intlayer/editor": "4.0.3"
81
+ },
82
+ "engines": {
83
+ "node": ">=14.18"
84
+ },
85
+ "bug": {
86
+ "url": "https://github.com/aymericzip/intlayer/issues"
87
+ },
88
+ "scripts": {
89
+ "build": "pnpm build:package & pnpm build:types",
90
+ "build:package": "tsup",
91
+ "build:types": "tsc --project ./tsconfig.types.json && tsc-alias --project ./tsconfig.types.json",
92
+ "clean": "rimraf ./dist",
93
+ "dev": "concurrently --prefix none \"tsup --watch\" \"tsc --project ./tsconfig.types.json --watch\" \"tsc-alias --project ./tsconfig.types.json --watch\"",
94
+ "lint": "eslint . --cache",
95
+ "lint:fix": "eslint . --cache --fix",
96
+ "prettier": "prettier . --check",
97
+ "prettier:fix": "prettier . --write",
98
+ "process-files": "ts-node src/transpiler/processFilesCLI.ts --dir $npm_config_dir --extension $npm_config_extension --no-node-snapshot",
99
+ "test": "",
100
+ "typecheck": "tsup --project ./tsconfig.json --noEmit"
101
+ }
102
+ }