@justanarthur/payload-plugin-translator 1.3.20 → 3.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.
- package/README.md +132 -215
- package/dist/client.css +41 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.js +320 -0
- package/dist/index.d.ts +63 -11
- package/dist/index.js +275 -82
- package/dist/jobs.d.ts +50 -0
- package/dist/jobs.js +28 -0
- package/dist/resolvers/copy.d.ts +19 -3
- package/dist/resolvers/copy.js +9 -13
- package/dist/resolvers/google.d.ts +23 -11
- package/dist/resolvers/google.js +10 -46
- package/dist/resolvers/libreTranslate.d.ts +23 -15
- package/dist/resolvers/libreTranslate.js +10 -47
- package/dist/resolvers/openAI.d.ts +29 -21
- package/dist/resolvers/openAI.js +9 -134
- package/dist/resolvers/types.d.ts +14 -16
- package/dist/resolvers/types.js +0 -3
- package/dist/shared/chunk-97ktc51q.js +15 -0
- package/dist/shared/chunk-ecnph6hw.js +205 -0
- package/dist/shared/chunk-frnemj69.js +6 -0
- package/dist/shared/chunk-fsveh29m.js +55 -0
- package/dist/shared/chunk-q51q8rd2.js +855 -0
- package/dist/shared/chunk-zhrw0jnz.js +57 -0
- package/dist/types.d.ts +32 -22
- package/dist/types.js +0 -3
- package/package.json +89 -63
- package/dist/client/api/index.d.ts +0 -8
- package/dist/client/api/index.d.ts.map +0 -1
- package/dist/client/api/index.js +0 -28
- package/dist/client/api/index.js.map +0 -1
- package/dist/client/components/CustomButton/CustomButtonWithTranslator.d.ts +0 -5
- package/dist/client/components/CustomButton/CustomButtonWithTranslator.d.ts.map +0 -1
- package/dist/client/components/CustomButton/CustomButtonWithTranslator.js +0 -28
- package/dist/client/components/CustomButton/CustomButtonWithTranslator.js.map +0 -1
- package/dist/client/components/CustomButton/index.d.ts +0 -3
- package/dist/client/components/CustomButton/index.d.ts.map +0 -1
- package/dist/client/components/CustomButton/index.js +0 -10
- package/dist/client/components/CustomButton/index.js.map +0 -1
- package/dist/client/components/CustomButton/styles.scss +0 -5
- package/dist/client/components/LocaleLabel/LocaleLabel.d.ts +0 -5
- package/dist/client/components/LocaleLabel/LocaleLabel.d.ts.map +0 -1
- package/dist/client/components/LocaleLabel/LocaleLabel.js +0 -28
- package/dist/client/components/LocaleLabel/LocaleLabel.js.map +0 -1
- package/dist/client/components/LocaleLabel/index.d.ts +0 -2
- package/dist/client/components/LocaleLabel/index.d.ts.map +0 -1
- package/dist/client/components/LocaleLabel/index.js +0 -3
- package/dist/client/components/LocaleLabel/index.js.map +0 -1
- package/dist/client/components/ResolverButton/ResolverButton.d.ts +0 -5
- package/dist/client/components/ResolverButton/ResolverButton.d.ts.map +0 -1
- package/dist/client/components/ResolverButton/ResolverButton.js +0 -16
- package/dist/client/components/ResolverButton/ResolverButton.js.map +0 -1
- package/dist/client/components/ResolverButton/index.d.ts +0 -2
- package/dist/client/components/ResolverButton/index.d.ts.map +0 -1
- package/dist/client/components/ResolverButton/index.js +0 -3
- package/dist/client/components/ResolverButton/index.js.map +0 -1
- package/dist/client/components/TranslatorModal/Content.d.ts +0 -2
- package/dist/client/components/TranslatorModal/Content.d.ts.map +0 -1
- package/dist/client/components/TranslatorModal/Content.js +0 -60
- package/dist/client/components/TranslatorModal/Content.js.map +0 -1
- package/dist/client/components/TranslatorModal/TranslatorModal.d.ts +0 -3
- package/dist/client/components/TranslatorModal/TranslatorModal.d.ts.map +0 -1
- package/dist/client/components/TranslatorModal/TranslatorModal.js +0 -26
- package/dist/client/components/TranslatorModal/TranslatorModal.js.map +0 -1
- package/dist/client/components/TranslatorModal/index.d.ts +0 -2
- package/dist/client/components/TranslatorModal/index.d.ts.map +0 -1
- package/dist/client/components/TranslatorModal/index.js +0 -3
- package/dist/client/components/TranslatorModal/index.js.map +0 -1
- package/dist/client/components/TranslatorModal/styles.scss +0 -76
- package/dist/client/providers/Translator/TranslatorProvider.d.ts +0 -5
- package/dist/client/providers/Translator/TranslatorProvider.d.ts.map +0 -1
- package/dist/client/providers/Translator/TranslatorProvider.js +0 -109
- package/dist/client/providers/Translator/TranslatorProvider.js.map +0 -1
- package/dist/client/providers/Translator/context.d.ts +0 -21
- package/dist/client/providers/Translator/context.d.ts.map +0 -1
- package/dist/client/providers/Translator/context.js +0 -9
- package/dist/client/providers/Translator/context.js.map +0 -1
- package/dist/exports/client.d.ts +0 -2
- package/dist/exports/client.d.ts.map +0 -1
- package/dist/exports/client.js +0 -3
- package/dist/exports/client.js.map +0 -1
- package/dist/i18n-translations.d.ts +0 -87
- package/dist/i18n-translations.d.ts.map +0 -1
- package/dist/i18n-translations.js +0 -88
- package/dist/i18n-translations.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/resolvers/copy.d.ts.map +0 -1
- package/dist/resolvers/copy.js.map +0 -1
- package/dist/resolvers/google.d.ts.map +0 -1
- package/dist/resolvers/google.js.map +0 -1
- package/dist/resolvers/libreTranslate.d.ts.map +0 -1
- package/dist/resolvers/libreTranslate.js.map +0 -1
- package/dist/resolvers/openAI.d.ts.map +0 -1
- package/dist/resolvers/openAI.js.map +0 -1
- package/dist/resolvers/types.d.ts.map +0 -1
- package/dist/resolvers/types.js.map +0 -1
- package/dist/translate/endpoint.d.ts +0 -3
- package/dist/translate/endpoint.d.ts.map +0 -1
- package/dist/translate/endpoint.js +0 -23
- package/dist/translate/endpoint.js.map +0 -1
- package/dist/translate/findEntityWithConfig.d.ts +0 -16
- package/dist/translate/findEntityWithConfig.d.ts.map +0 -1
- package/dist/translate/findEntityWithConfig.js +0 -34
- package/dist/translate/findEntityWithConfig.js.map +0 -1
- package/dist/translate/operation.d.ts +0 -9
- package/dist/translate/operation.d.ts.map +0 -1
- package/dist/translate/operation.js +0 -78
- package/dist/translate/operation.js.map +0 -1
- package/dist/translate/traverseFields.d.ts +0 -17
- package/dist/translate/traverseFields.d.ts.map +0 -1
- package/dist/translate/traverseFields.js +0 -233
- package/dist/translate/traverseFields.js.map +0 -1
- package/dist/translate/traverseRichText.d.ts +0 -10
- package/dist/translate/traverseRichText.d.ts.map +0 -1
- package/dist/translate/traverseRichText.js +0 -24
- package/dist/translate/traverseRichText.js.map +0 -1
- package/dist/translate/types.d.ts +0 -27
- package/dist/translate/types.d.ts.map +0 -1
- package/dist/translate/types.js +0 -3
- package/dist/translate/types.js.map +0 -1
- package/dist/translate/updateEntity.d.ts +0 -14
- package/dist/translate/updateEntity.d.ts.map +0 -1
- package/dist/translate/updateEntity.js +0 -26
- package/dist/translate/updateEntity.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/chunkArray.d.ts +0 -2
- package/dist/utils/chunkArray.d.ts.map +0 -1
- package/dist/utils/chunkArray.js +0 -7
- package/dist/utils/chunkArray.js.map +0 -1
- package/dist/utils/isEmpty.d.ts +0 -2
- package/dist/utils/isEmpty.d.ts.map +0 -1
- package/dist/utils/isEmpty.js +0 -8
- package/dist/utils/isEmpty.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,215 +1,132 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
resolver_my_submitButtonLabelEmpty: 'Translate only empty fields',
|
|
134
|
-
resolver_my_submitButtonLabelFull: 'Translate all',
|
|
135
|
-
resolver_my_successMessage: 'Successfully translated. Press "Save" to apply the changes.',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
},
|
|
140
|
-
});
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## Using the Local API
|
|
144
|
-
|
|
145
|
-
```ts
|
|
146
|
-
import { translateOperation } from '@payload-enchants/translator';
|
|
147
|
-
|
|
148
|
-
const translateResult = await translateOperation({
|
|
149
|
-
collectionSlug: 'posts', // or globalSlug if globals,
|
|
150
|
-
emptyOnly: false, // optional, should translate all the fields values or only fields that are empty, by default false.
|
|
151
|
-
id: postDefaultLocale.id, // pass the doc id if it's a collection
|
|
152
|
-
locale: 'de', // locale to translate to
|
|
153
|
-
localeFrom: 'en', // locale to translate from
|
|
154
|
-
payload, // payload instance, you can get it with getPayload or req.payload in hooks
|
|
155
|
-
req, // PayloadRequest, can be used instead of payload, more appreciable than payload if you have it
|
|
156
|
-
overrideAccess: false, //
|
|
157
|
-
resolver: 'copy', // pass resolver key
|
|
158
|
-
update: true, // optional, should update immediately or just return the translated result, default false
|
|
159
|
-
data: {}, // Optional, if you want to translate from your data passed here instead of the current doc, should be in "localeFrom" locale, for example { title: "Hello" }
|
|
160
|
-
});
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### Example of the hook that uses local operation to copy the doc data to other locales
|
|
164
|
-
|
|
165
|
-
```ts
|
|
166
|
-
import type { CollectionAfterChangeHook } from 'payload/types';
|
|
167
|
-
import { translateOperation } from '@payload-enchants/translator';
|
|
168
|
-
|
|
169
|
-
export const copyOtherLocales: CollectionAfterChangeHook = async ({
|
|
170
|
-
collection,
|
|
171
|
-
doc,
|
|
172
|
-
operation,
|
|
173
|
-
req,
|
|
174
|
-
}) => {
|
|
175
|
-
if (operation !== 'create') return;
|
|
176
|
-
|
|
177
|
-
const locale = req.locale;
|
|
178
|
-
|
|
179
|
-
if (!locale || !req.payload.config.localization) return;
|
|
180
|
-
|
|
181
|
-
const otherLocales = req.payload.config.localization.locales.filter(
|
|
182
|
-
(each) => each.code !== locale,
|
|
183
|
-
);
|
|
184
|
-
|
|
185
|
-
const { id } = doc;
|
|
186
|
-
|
|
187
|
-
for (const { code } of otherLocales) {
|
|
188
|
-
await translateOperation({
|
|
189
|
-
collectionSlug: collection.slug,
|
|
190
|
-
data: doc,
|
|
191
|
-
id,
|
|
192
|
-
locale: code,
|
|
193
|
-
localeFrom: locale,
|
|
194
|
-
req,
|
|
195
|
-
resolver: 'copy',
|
|
196
|
-
update: true,
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
### Omitting fields
|
|
203
|
-
|
|
204
|
-
To omit a specific field for translation, simply add `custom.translatorSkip = true` to the field's config.
|
|
205
|
-
|
|
206
|
-
```ts
|
|
207
|
-
const field = {
|
|
208
|
-
custom: {
|
|
209
|
-
translatorSkip: true,
|
|
210
|
-
},
|
|
211
|
-
localized: true,
|
|
212
|
-
name: 'skip',
|
|
213
|
-
type: 'text',
|
|
214
|
-
};
|
|
215
|
-
```
|
|
1
|
+
# @justanarthur/payload-plugin-translator
|
|
2
|
+
|
|
3
|
+
[Payload CMS](https://payloadcms.com) plugin that keeps localized docs in sync. On every save of a
|
|
4
|
+
listed collection or global, it schedules background jobs that translate each field from the source
|
|
5
|
+
locale into every other declared locale, using a configurable resolver (Google Translate, OpenAI,
|
|
6
|
+
LibreTranslate, or your own).
|
|
7
|
+
|
|
8
|
+
Editor UX: the publish and save buttons in the affected collections/globals are swapped for a
|
|
9
|
+
custom variant that surfaces the job status. Locales without translations stay empty until the job
|
|
10
|
+
finishes — the plugin never blocks the editor's save.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add @justanarthur/payload-plugin-translator
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Requires `payload@^3.85.0` and `react@^19`. The plugin reads your `config.localization.locales` —
|
|
19
|
+
it short-circuits (returns the config unchanged) when there's only one locale or no localization.
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
// payload.config.ts
|
|
25
|
+
import { buildConfig } from 'payload'
|
|
26
|
+
import { translator, openAIResolver } from '@justanarthur/payload-plugin-translator'
|
|
27
|
+
|
|
28
|
+
export default buildConfig({
|
|
29
|
+
plugins: [
|
|
30
|
+
translator({
|
|
31
|
+
collections: ['pages', 'posts'],
|
|
32
|
+
globals: ['header', 'footer'],
|
|
33
|
+
resolvers: [
|
|
34
|
+
openAIResolver({ apiKey: process.env.OPENAI_API_KEY! })
|
|
35
|
+
]
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
That's the whole integration. The first save of a Page doc schedules one translate job per non-source
|
|
42
|
+
locale; the job runs against your resolver and writes each translated field back into the
|
|
43
|
+
collection's `_locales` row.
|
|
44
|
+
|
|
45
|
+
## Built-in resolvers
|
|
46
|
+
|
|
47
|
+
| Resolver | Import | Env / config | Notes |
|
|
48
|
+
|--------------------|-------------------------------------------------|---------------------------------|------------------------------------------------------------------|
|
|
49
|
+
| `googleResolver` | `@justanarthur/payload-plugin-translator/resolvers/google` | `apiKey` (Google Cloud Translation API) | Cheap, good for bulk text. Locale codes are remapped where useful (e.g. `ua` → `uk`). |
|
|
50
|
+
| `openAIResolver` | `@justanarthur/payload-plugin-translator/resolvers/openAI` | `apiKey`, optional `model`/`baseUrl`/`prompt`/`chunkLength` | Best fidelity. Default model `gpt-4o-mini`. gpt-5.x uses `max_completion_tokens` + `reasoning_effort: 'low'` automatically. Slugs get a transliteration rule baked into the prompt. |
|
|
51
|
+
| `libreResolver` | `@justanarthur/payload-plugin-translator/resolvers/libreTranslate` | `apiKey`, optional `url`/`chunkLength` | Self-host friendly. Same locale remap as Google. |
|
|
52
|
+
| `copyResolver` | `@justanarthur/payload-plugin-translator/resolvers/copy` | none | Returns the source text verbatim. Useful as a fallback or for testing. |
|
|
53
|
+
|
|
54
|
+
You can supply multiple resolvers — they run in the order declared, and the first one to return
|
|
55
|
+
`success: true` wins for the chunk.
|
|
56
|
+
|
|
57
|
+
## Writing your own resolver
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import type { TranslateResolver } from '@justanarthur/payload-plugin-translator/resolvers/types'
|
|
61
|
+
|
|
62
|
+
export const myResolver: TranslateResolver = {
|
|
63
|
+
key: 'my-translator',
|
|
64
|
+
resolve: async ({ localeFrom, localeTo, texts, req }) => {
|
|
65
|
+
// call your translator of choice
|
|
66
|
+
return { success: true, translatedTexts: ['...'] }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`texts` is the flat string array extracted from the doc; you return the same-length array in
|
|
72
|
+
`translatedTexts`. Returning `{ success: false }` makes the job retry.
|
|
73
|
+
|
|
74
|
+
## Options reference
|
|
75
|
+
|
|
76
|
+
| Option | Type | Required | Notes |
|
|
77
|
+
|---------------|-----------------------|----------|------------------------------------------------------------------------|
|
|
78
|
+
| `collections` | `CollectionSlug[]` | yes | Collections to auto-translate. |
|
|
79
|
+
| `globals` | `GlobalSlug[]` | yes | Globals to auto-translate. |
|
|
80
|
+
| `resolvers` | `TranslateResolver[]` | yes | Tried in order; first to succeed wins per chunk. |
|
|
81
|
+
| `autoTranslate` | `boolean` | no | Default `true`. Set `false` to opt out of the auto-translate afterChange hook — useful when you drive translation manually via the `translateOperation` export. |
|
|
82
|
+
| `disabled` | `boolean` | no | Skip the plugin entirely (no overrides, no jobs). Useful in tests. |
|
|
83
|
+
| `_options.additionalTraverseRichText` | function | no | Hook to extend rich-text traversal — see below. |
|
|
84
|
+
|
|
85
|
+
### Rich-text traversal hook
|
|
86
|
+
|
|
87
|
+
The plugin walks Lexical richText fields itself, but custom Lexical nodes (e.g. blocks the host
|
|
88
|
+
defines for landing pages) won't be visited. `_options.additionalTraverseRichText` lets you register
|
|
89
|
+
a custom walker:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
translator({
|
|
93
|
+
// ...
|
|
94
|
+
_options: {
|
|
95
|
+
additionalTraverseRichText: ({ root, onText }) => {
|
|
96
|
+
// call onText(siblingData, attribute?) for every leaf string you find
|
|
97
|
+
// siblingData mutates the doc tree in-place
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The hook receives `onText` which mutates the data tree, plus the root node. It's called for every
|
|
104
|
+
richText field before translation begins.
|
|
105
|
+
|
|
106
|
+
## How it works under the hood
|
|
107
|
+
|
|
108
|
+
- On plugin init: registers a `translate` Payload **task** and a `translate` **workflow**, swapped
|
|
109
|
+
Publish/Save buttons per collection/global, and an admin-only endpoint at `/api/translator/translate`.
|
|
110
|
+
- On `afterChange` (when `autoTranslate: true`): the plugin enqueues one workflow run per non-source
|
|
111
|
+
locale. The job extracts translatable fields, asks each resolver in turn, writes the result back
|
|
112
|
+
into the `_locales` row.
|
|
113
|
+
- The plugin de-duplicates via `AUTO_TRANSLATE_MARKER` — re-running it on an already-attached hook
|
|
114
|
+
is a no-op, so it's safe to wrap multiple plugins around the same collection.
|
|
115
|
+
|
|
116
|
+
## Manual translation
|
|
117
|
+
|
|
118
|
+
Two escape hatches when you don't want the auto-hook:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
// the operation (Payload `operation` you can call from custom endpoints)
|
|
122
|
+
import { translateOperation } from '@justanarthur/payload-plugin-translator'
|
|
123
|
+
|
|
124
|
+
// the job factories (advanced — you usually don't need these directly)
|
|
125
|
+
import { createTranslateTask, createTranslateWorkflow } from '@justanarthur/payload-plugin-translator/jobs'
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
For most hosts the auto-hook + resolver list is enough.
|
|
129
|
+
|
|
130
|
+
## Licence
|
|
131
|
+
|
|
132
|
+
MIT
|
package/dist/client.css
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* src/client/components/CustomButton/styles.css */
|
|
2
|
+
.translator__custom-save-button {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: .5rem;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* src/client/components/TranslatorModal/styles.css */
|
|
9
|
+
.translator__modal {
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.translator__wrapper {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 1rem;
|
|
17
|
+
padding: 1rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.translator__close {
|
|
21
|
+
position: absolute;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
background: none;
|
|
24
|
+
border: 0;
|
|
25
|
+
font-size: 1.25rem;
|
|
26
|
+
line-height: 1;
|
|
27
|
+
top: .5rem;
|
|
28
|
+
right: .5rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.translator__content {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
gap: .75rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.translator__buttons {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-wrap: wrap;
|
|
40
|
+
gap: .5rem;
|
|
41
|
+
}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { JSX as JSX_1kxb } from "react/jsx-runtime";
|
|
2
|
+
type Element_12xgc = JSX_1kxb["Element"];
|
|
3
|
+
declare const CustomButtonWithTranslator: ({ type }: {
|
|
4
|
+
type: "publish" | "save";
|
|
5
|
+
}) => Element_12xgc;
|
|
6
|
+
export { CustomButtonWithTranslator as default, CustomButtonWithTranslator };
|