@clepit/core 0.6.0-beta.416 → 0.6.0-beta.417
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/CHANGELOG.md +3 -0
- package/dist/core/editor/index.d.ts +5 -0
- package/dist/core/element/index.d.ts +2 -0
- package/dist/core/i18n/index.d.ts +5 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
|
+
- `DrawContext.locale` and `DrawContext.defaultLocale`: `renderBlocks` draws each translated field in the language asked for, falling back to the page's own, and draws a translated document that names no language in the first of its languages, where it drew "[object Object]". A document with no translation draws exactly as before.
|
|
11
12
|
- `EditorConfig.onClearRequest`: the toolbar's Clear awaits the host and empties the page only when it resolves `true`; a rejection leaves the page and is reported. Absent, Clear empties the page at once, as before. `@clepit/react`'s `ClepitEditor` forwards it through the same latest-props contract as `onChange`.
|
|
12
13
|
- `EditorConfig.dialogLabels` and `DIALOG_LABELS`: the link, tooltip and status dialogs draw the host's words (titles, field labels, placeholders, the status variants, Cancel and Apply), in English when absent. Each dialog element carries a test id (`link-dialog-title`, `status-dialog-variant-success` and the rest).
|
|
13
14
|
- Six `blockToolbarLabels` keys for the image block's own words: `imageDropTitle`, `imageDropAction`, `imageDropFormats`, `imageUploading`, `imageUploadFailed` and `imageInvalidType`, in English when absent. The drop area's delete button takes the `delete` label as its tooltip and its `aria-label`. Each state carries a test id (`image-drop`, `image-drop-title`, `image-uploading`, `image-upload-failed`, `image-invalid-type` and the rest).
|
|
@@ -17,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
18
|
- `PublicPage.scheme`: `renderPage` draws the page in `light` or `dark` only, by setting `data-clepit-theme` on `<body>` (the attribute the theme's tokens resolve under) and a `color-scheme` meta so the browser's own canvas and text follow it. A page passing no scheme renders exactly as before.
|
|
18
19
|
|
|
19
20
|
### Fixed
|
|
21
|
+
- An editor given `locale` kept only the language being edited: an edit replaced a field's map of languages with one string. The editor now keeps each block's stored data and writes an edit back into it with the rule both twins share, on every way a block leaves it (`onChange`, `data.extract()`, `blocks.get` and `blocks.getAll`), while `blocks.insert`, `blocks.update` and `data.set` take stored data and show it in the language being edited. A converted block keeps the languages of the fields both types share.
|
|
22
|
+
- An editor given no `locale` drew a translated field as "[object Object]". It now shows a translated document in the first of its languages, and keeps the others through an edit.
|
|
20
23
|
- The inline toolbar no longer leaves a hidden copy of the rewrite menu behind each time a new selection repaints it, so each rewrite action exists once in the page.
|
|
21
24
|
|
|
22
25
|
## [0.6.0] - 2026-09-25
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EditorAPI, EditorConfig } from '../../types';
|
|
2
2
|
export declare class Editor {
|
|
3
|
+
private static sources;
|
|
3
4
|
static create(config: EditorConfig): EditorAPI;
|
|
4
5
|
private static initialize;
|
|
5
6
|
/**
|
|
@@ -12,6 +13,10 @@ export declare class Editor {
|
|
|
12
13
|
* change when they switched.
|
|
13
14
|
*/
|
|
14
15
|
private static localizeData;
|
|
16
|
+
private static localizeBlock;
|
|
17
|
+
private static localizeArriving;
|
|
18
|
+
private static delocalizeBlock;
|
|
19
|
+
private static delocalizeData;
|
|
15
20
|
private static render;
|
|
16
21
|
/** Releases the runtime a container holds and leaves its document in the
|
|
17
22
|
* store. `create` runs this first so a second create in the same container
|
|
@@ -66,6 +66,8 @@ export type DrawContext = {
|
|
|
66
66
|
issueChip?: IssueChipParts;
|
|
67
67
|
/** Translated issue words; English fallbacks otherwise. */
|
|
68
68
|
issueLabels?: Partial<Record<IssueLabel, string>>;
|
|
69
|
+
locale?: string;
|
|
70
|
+
defaultLocale?: string;
|
|
69
71
|
};
|
|
70
72
|
export type Backing = {
|
|
71
73
|
create(tag: string): ClepitElement;
|
|
@@ -40,4 +40,9 @@ export declare const resolveLocalized: <T>(value: Localized<T> | undefined, requ
|
|
|
40
40
|
* changes shape.
|
|
41
41
|
*/
|
|
42
42
|
export declare const withLocale: <T>(value: Localized<T> | undefined, locale: string, next: T, documentDefault: string) => Localized<T>;
|
|
43
|
+
export declare const writeBlockData: (blockType: string, stored: Record<string, unknown> | undefined, edited: Record<string, unknown>, locale: string, documentDefault: string) => Record<string, unknown>;
|
|
44
|
+
export declare const firstLocaleOf: (blocks: {
|
|
45
|
+
data: unknown;
|
|
46
|
+
type: string;
|
|
47
|
+
}[]) => string | undefined;
|
|
43
48
|
//# sourceMappingURL=index.d.ts.map
|