@parhelia/localization 0.1.10745
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/LICENSE +8 -0
- package/README.md +29 -0
- package/dist/core/src/editor/ui/DragPreview.d.ts +15 -0
- package/dist/core/src/editor/ui/DragPreview.d.ts.map +1 -0
- package/dist/core/src/editor/ui/DragPreview.js +32 -0
- package/dist/core/src/editor/ui/PerfectTree.d.ts +79 -0
- package/dist/core/src/editor/ui/PerfectTree.d.ts.map +1 -0
- package/dist/core/src/editor/ui/PerfectTree.js +857 -0
- package/dist/localization/src/LocalizeItemCommand.d.ts +8 -0
- package/dist/localization/src/LocalizeItemCommand.d.ts.map +1 -0
- package/dist/localization/src/LocalizeItemCommand.js +44 -0
- package/dist/localization/src/LocalizeItemDialog.d.ts +4 -0
- package/dist/localization/src/LocalizeItemDialog.d.ts.map +1 -0
- package/dist/localization/src/LocalizeItemDialog.js +126 -0
- package/dist/localization/src/LocalizeItemUtils.d.ts +17 -0
- package/dist/localization/src/LocalizeItemUtils.d.ts.map +1 -0
- package/dist/localization/src/LocalizeItemUtils.js +93 -0
- package/dist/localization/src/api/discovery.d.ts +36 -0
- package/dist/localization/src/api/discovery.d.ts.map +1 -0
- package/dist/localization/src/api/discovery.js +29 -0
- package/dist/localization/src/constants.d.ts +15 -0
- package/dist/localization/src/constants.d.ts.map +1 -0
- package/dist/localization/src/constants.js +21 -0
- package/dist/localization/src/hooks/useTranslationWizard.d.ts +6 -0
- package/dist/localization/src/hooks/useTranslationWizard.d.ts.map +1 -0
- package/dist/localization/src/hooks/useTranslationWizard.js +78 -0
- package/dist/localization/src/index.d.ts +69 -0
- package/dist/localization/src/index.d.ts.map +1 -0
- package/dist/localization/src/index.js +152 -0
- package/dist/localization/src/services/translationService.d.ts +102 -0
- package/dist/localization/src/services/translationService.d.ts.map +1 -0
- package/dist/localization/src/services/translationService.js +37 -0
- package/dist/localization/src/setup/LocalizationSetupStep.d.ts +3 -0
- package/dist/localization/src/setup/LocalizationSetupStep.d.ts.map +1 -0
- package/dist/localization/src/setup/LocalizationSetupStep.js +108 -0
- package/dist/localization/src/sidebar/TranslationSidebar.d.ts +2 -0
- package/dist/localization/src/sidebar/TranslationSidebar.d.ts.map +1 -0
- package/dist/localization/src/sidebar/TranslationSidebar.js +93 -0
- package/dist/localization/src/steps/MetadataInputStep.d.ts +4 -0
- package/dist/localization/src/steps/MetadataInputStep.d.ts.map +1 -0
- package/dist/localization/src/steps/MetadataInputStep.js +38 -0
- package/dist/localization/src/steps/ServiceLanguageSelectionStep.d.ts +3 -0
- package/dist/localization/src/steps/ServiceLanguageSelectionStep.d.ts.map +1 -0
- package/dist/localization/src/steps/ServiceLanguageSelectionStep.js +91 -0
- package/dist/localization/src/steps/SubitemDiscoveryStep.d.ts +3 -0
- package/dist/localization/src/steps/SubitemDiscoveryStep.d.ts.map +1 -0
- package/dist/localization/src/steps/SubitemDiscoveryStep.js +391 -0
- package/dist/localization/src/steps/index.d.ts +5 -0
- package/dist/localization/src/steps/index.d.ts.map +1 -0
- package/dist/localization/src/steps/index.js +4 -0
- package/dist/localization/src/steps/types.d.ts +68 -0
- package/dist/localization/src/steps/types.d.ts.map +1 -0
- package/dist/localization/src/steps/types.js +1 -0
- package/dist/localization/src/translation-center/BatchTranslationView.d.ts +7 -0
- package/dist/localization/src/translation-center/BatchTranslationView.d.ts.map +1 -0
- package/dist/localization/src/translation-center/BatchTranslationView.js +487 -0
- package/dist/localization/src/translation-center/RecentTranslations.d.ts +2 -0
- package/dist/localization/src/translation-center/RecentTranslations.d.ts.map +1 -0
- package/dist/localization/src/translation-center/RecentTranslations.js +199 -0
- package/dist/localization/src/translation-center/TranslationManagement.d.ts +2 -0
- package/dist/localization/src/translation-center/TranslationManagement.d.ts.map +1 -0
- package/dist/localization/src/translation-center/TranslationManagement.js +25 -0
- package/dist/localization/src/types.d.ts +18 -0
- package/dist/localization/src/types.d.ts.map +1 -0
- package/dist/localization/src/types.js +1 -0
- package/dist/localization/src/utils/createVersions.d.ts +14 -0
- package/dist/localization/src/utils/createVersions.d.ts.map +1 -0
- package/dist/localization/src/utils/createVersions.js +26 -0
- package/package.json +47 -0
- package/styles.css +1 -0
package/LICENSE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @parhelia/localization
|
|
2
|
+
|
|
3
|
+
Localization and translation features for Parhelia visual editor.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @parhelia/localization
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { LocalizeItemDialog, TranslationSidebar } from '@parhelia/localization';
|
|
15
|
+
import '@parhelia/localization/styles.css';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- Translation wizard
|
|
21
|
+
- Localization setup
|
|
22
|
+
- Translation center
|
|
23
|
+
- Multi-language content management
|
|
24
|
+
- Version creation for localized content
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
See LICENSE file for details.
|
|
29
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Lightweight React component for consistent multi-select drag previews.
|
|
4
|
+
* Use with renderToString or by creating a DOM node and setting innerHTML.
|
|
5
|
+
*/
|
|
6
|
+
export declare function DragMultiSelectPreview({ count, noun, }: {
|
|
7
|
+
count: number;
|
|
8
|
+
noun?: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* Imperative helper to attach a consistent multi-select drag image.
|
|
12
|
+
* Returns a cleanup function that removes the temporary element.
|
|
13
|
+
*/
|
|
14
|
+
export declare function setMultiDragImage(event: React.DragEvent<any>, count: number, noun?: string): () => void;
|
|
15
|
+
//# sourceMappingURL=DragPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragPreview.d.ts","sourceRoot":"","sources":["../../../../../../core/src/editor/ui/DragPreview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,IAAc,GACf,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,2CASA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,EAC3B,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,MAAgB,GACrB,MAAM,IAAI,CAiBZ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Lightweight React component for consistent multi-select drag previews.
|
|
4
|
+
* Use with renderToString or by creating a DOM node and setting innerHTML.
|
|
5
|
+
*/
|
|
6
|
+
export function DragMultiSelectPreview({ count, noun = "items", }) {
|
|
7
|
+
return (_jsx("div", { className: "rounded-md border border-gray-300 bg-white px-4 py-2 pl-8 text-sm shadow-md", children: _jsxs("div", { className: "flex items-center", children: [_jsx("span", { className: "mr-1 font-bold", children: count }), _jsx("span", { children: noun })] }) }));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Imperative helper to attach a consistent multi-select drag image.
|
|
11
|
+
* Returns a cleanup function that removes the temporary element.
|
|
12
|
+
*/
|
|
13
|
+
export function setMultiDragImage(event, count, noun = "items") {
|
|
14
|
+
const temp = document.createElement("div");
|
|
15
|
+
temp.className =
|
|
16
|
+
"bg-white shadow-md rounded-md border border-gray-300 px-4 pl-8 py-2 text-sm absolute top-[-1000px] left-[-1000px]";
|
|
17
|
+
temp.innerHTML = `<div class="flex items-center"><span class="font-bold mr-1">${count}</span> ${noun}</div>`;
|
|
18
|
+
document.body.appendChild(temp);
|
|
19
|
+
try {
|
|
20
|
+
event.dataTransfer.setDragImage(temp, 15, 15);
|
|
21
|
+
}
|
|
22
|
+
catch { }
|
|
23
|
+
const cleanup = () => {
|
|
24
|
+
try {
|
|
25
|
+
document.body.removeChild(temp);
|
|
26
|
+
}
|
|
27
|
+
catch { }
|
|
28
|
+
};
|
|
29
|
+
// Defer cleanup to next tick so the drag image is captured.
|
|
30
|
+
setTimeout(cleanup, 0);
|
|
31
|
+
return cleanup;
|
|
32
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface TreeNode<T = any> {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
data?: T;
|
|
7
|
+
/** Indicates if the node is expandable (has or can have children) */
|
|
8
|
+
hasChildren?: boolean;
|
|
9
|
+
/** Indicates if the node can be dragged */
|
|
10
|
+
isDraggable?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* If present, contains the node's children.
|
|
13
|
+
* Use undefined to signal that children have not yet been loaded.
|
|
14
|
+
* Use null to signal that children are currently loading.
|
|
15
|
+
*/
|
|
16
|
+
children?: TreeNode<T>[] | null;
|
|
17
|
+
}
|
|
18
|
+
export interface TreeProps<T = any> {
|
|
19
|
+
/** Array of tree nodes */
|
|
20
|
+
nodes: TreeNode<T>[];
|
|
21
|
+
/** Keys of currently selected nodes */
|
|
22
|
+
selectedKeys?: string[];
|
|
23
|
+
/** Keys of expanded nodes */
|
|
24
|
+
expandedKeys?: string[];
|
|
25
|
+
/** Callback to render a single node (template) */
|
|
26
|
+
renderNode: (node: TreeNode<T>, searchTerm?: string) => React.ReactNode;
|
|
27
|
+
/** Called when a node's expand/collapse toggle is activated */
|
|
28
|
+
onToggleExpand?: (key: string) => void;
|
|
29
|
+
/** Called when a node is clicked for selection */
|
|
30
|
+
onSelect?: (key: string, event: React.MouseEvent) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Called during a drag over a drop zone between nodes.
|
|
33
|
+
* @param parent The parent node of the current list (null for root level)
|
|
34
|
+
* @param index The position where a new node would be inserted (0 = before first node)
|
|
35
|
+
*/
|
|
36
|
+
onDragOverZone?: (parent: TreeNode<T> | null, index: number, event: React.DragEvent) => boolean;
|
|
37
|
+
isValidDropZone?: (parent: TreeNode<T> | null, index: number) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Called when an item is dropped into a drop zone between nodes.
|
|
40
|
+
* @param parent The parent node of the current list (null for root level)
|
|
41
|
+
* @param index The position where a new node should be inserted (0 = before first node)
|
|
42
|
+
*/
|
|
43
|
+
onDrop?: (parent: TreeNode<T> | null, index: number, event: React.DragEvent) => void;
|
|
44
|
+
isDragging?: boolean;
|
|
45
|
+
onStartDrag?: (data: {
|
|
46
|
+
node: TreeNode<T>;
|
|
47
|
+
event: React.DragEvent<any>;
|
|
48
|
+
isMultiSelect: boolean;
|
|
49
|
+
}) => void;
|
|
50
|
+
onDragEnd?: (event: React.DragEvent | null) => void;
|
|
51
|
+
enableDragAndDrop?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Callback that notifies when a lazy load should occur.
|
|
54
|
+
* When a node is toggled and its children haven't been loaded yet (i.e. undefined),
|
|
55
|
+
* this callback is invoked so you can load the children asynchronously and update your tree model.
|
|
56
|
+
*/
|
|
57
|
+
onLazyLoad?: (node: TreeNode<T>) => void;
|
|
58
|
+
onDoubleClick?: (node: TreeNode<T>) => void;
|
|
59
|
+
onContextMenu?: (node: TreeNode<T>, event: React.MouseEvent) => void;
|
|
60
|
+
/** Whether to automatically scroll to the first selected node when selection changes */
|
|
61
|
+
scrollToSelected?: boolean;
|
|
62
|
+
/** Whether to enable keyboard search functionality */
|
|
63
|
+
enableKeyboardSearch?: boolean;
|
|
64
|
+
/** Time in ms before search is cleared (default: 1500) */
|
|
65
|
+
searchClearDelay?: number;
|
|
66
|
+
/** Whether to disable automatic selection when expanding nodes (even during search) */
|
|
67
|
+
disableAutoSelectOnExpand?: boolean;
|
|
68
|
+
/** Noun used in multi-select drag preview (e.g., "items", "components"). Default: "items" */
|
|
69
|
+
multiDragNoun?: string;
|
|
70
|
+
/** Whether to enable keyboard navigation (default: true) */
|
|
71
|
+
enableKeyboardNavigation?: boolean;
|
|
72
|
+
/** Called when keyboard navigation focus changes */
|
|
73
|
+
onKeyboardNavigationChange?: (key: string) => void;
|
|
74
|
+
}
|
|
75
|
+
export declare const highlightText: (text: string, searchTerm: string) => React.ReactNode;
|
|
76
|
+
export declare const PerfectTree: <T>({ nodes, selectedKeys, expandedKeys, renderNode, onToggleExpand, onSelect, onDragOverZone, onDrop, isDragging, onStartDrag, onDragEnd, onLazyLoad, onDoubleClick, onContextMenu, enableDragAndDrop, isValidDropZone, scrollToSelected, enableKeyboardSearch, searchClearDelay, disableAutoSelectOnExpand, multiDragNoun, enableKeyboardNavigation, onKeyboardNavigationChange, }: TreeProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
declare const _default: typeof PerfectTree;
|
|
78
|
+
export default _default;
|
|
79
|
+
//# sourceMappingURL=PerfectTree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PerfectTree.d.ts","sourceRoot":"","sources":["../../../../../../core/src/editor/ui/PerfectTree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAKf,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,qEAAqE;IACrE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC,CA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