@fiduswriter/frontend 0.1.67 → 0.1.69

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 (115) hide show
  1. package/README.md +7 -0
  2. package/css/two_factor.css +0 -52
  3. package/css/user_template_manager.css +6 -0
  4. package/dist/app/index.d.ts.map +1 -1
  5. package/dist/app/index.js +2 -1
  6. package/dist/app/index.js.map +1 -1
  7. package/dist/css/bibliography/colors.css +0 -4
  8. package/dist/css/bibliography/forms.css +3 -61
  9. package/dist/css/document-template-editor/document_template_designer.css +68 -68
  10. package/dist/css/fwtoolkit/action_chooser_dialog.css +66 -0
  11. package/dist/css/fwtoolkit/action_toolbar.css +132 -0
  12. package/dist/css/fwtoolkit/alerts.css +53 -19
  13. package/dist/css/fwtoolkit/application_menu_controller.css +28 -0
  14. package/dist/css/fwtoolkit/attachment_field.css +19 -0
  15. package/dist/css/fwtoolkit/attachment_list.css +118 -0
  16. package/dist/css/fwtoolkit/avatar_label.css +80 -0
  17. package/dist/css/fwtoolkit/boolean_switch.css +128 -0
  18. package/dist/css/fwtoolkit/buttons.css +181 -85
  19. package/dist/css/fwtoolkit/category_filter_controller.css +11 -0
  20. package/dist/css/fwtoolkit/checkable_list.css +39 -6
  21. package/dist/css/fwtoolkit/colors.css +71 -69
  22. package/dist/css/fwtoolkit/common.css +49 -17
  23. package/dist/css/fwtoolkit/content_menu.css +49 -27
  24. package/dist/css/fwtoolkit/data_table.css +278 -41
  25. package/dist/css/fwtoolkit/datatable_bulk.css +106 -0
  26. package/dist/css/fwtoolkit/destination_settings_form.css +67 -0
  27. package/dist/css/fwtoolkit/dialog.css +100 -25
  28. package/dist/css/fwtoolkit/dialog_presets.css +157 -0
  29. package/dist/css/fwtoolkit/dialog_table.css +63 -26
  30. package/dist/css/fwtoolkit/directory_navigator.css +244 -0
  31. package/dist/css/fwtoolkit/drop_up.css +36 -24
  32. package/dist/css/fwtoolkit/faq_dialog.css +28 -4
  33. package/dist/css/fwtoolkit/file_input_field.css +150 -0
  34. package/dist/css/fwtoolkit/file_selector.css +265 -12
  35. package/dist/css/fwtoolkit/form_error_summary.css +53 -0
  36. package/dist/css/fwtoolkit/forms.css +261 -54
  37. package/dist/css/fwtoolkit/fwtoolkit.css +6618 -1522
  38. package/dist/css/fwtoolkit/grid_size_picker.css +119 -0
  39. package/dist/css/fwtoolkit/icon_button_group.css +110 -0
  40. package/dist/css/fwtoolkit/image_preview_field.css +156 -0
  41. package/dist/css/fwtoolkit/inline_status.css +69 -0
  42. package/dist/css/fwtoolkit/inline_tools.css +47 -16
  43. package/dist/css/fwtoolkit/input_list.css +33 -2
  44. package/dist/css/fwtoolkit/loader.css +12 -2
  45. package/dist/css/fwtoolkit/media_card_grid.css +251 -0
  46. package/dist/css/fwtoolkit/navigation_drawer.css +172 -0
  47. package/dist/css/fwtoolkit/one_time_code_field.css +135 -0
  48. package/dist/css/fwtoolkit/overflow_action_bar.css +28 -0
  49. package/dist/css/fwtoolkit/overview_menu.css +35 -27
  50. package/dist/css/fwtoolkit/permission_badge.css +121 -0
  51. package/dist/css/fwtoolkit/progress_task.css +51 -27
  52. package/dist/css/fwtoolkit/pulldown.css +50 -22
  53. package/dist/css/fwtoolkit/pulldown_menu.css +22 -11
  54. package/dist/css/fwtoolkit/remote_options_field.css +297 -0
  55. package/dist/css/fwtoolkit/reset.css +4 -3
  56. package/dist/css/fwtoolkit/resource_field.css +134 -0
  57. package/dist/css/fwtoolkit/sortable_list.css +160 -0
  58. package/dist/css/fwtoolkit/text.css +54 -15
  59. package/dist/css/fwtoolkit/token_input.css +189 -0
  60. package/dist/css/fwtoolkit/tokens.css +158 -0
  61. package/dist/css/fwtoolkit/tree_view.css +165 -0
  62. package/dist/css/fwtoolkit/two_pane_selector.css +150 -9
  63. package/dist/css/fwtoolkit/ui_tabs.css +41 -13
  64. package/dist/css/image-manager/dialog_usermedia.css +41 -41
  65. package/dist/css/manifest.json +29 -0
  66. package/dist/css/two_factor.css +0 -52
  67. package/dist/css/user_template_manager.css +6 -0
  68. package/dist/document_templates/editor.d.ts +3 -0
  69. package/dist/document_templates/editor.d.ts.map +1 -1
  70. package/dist/document_templates/editor.js +35 -18
  71. package/dist/document_templates/editor.js.map +1 -1
  72. package/dist/user/auth/login.d.ts.map +1 -1
  73. package/dist/user/auth/login.js +2 -1
  74. package/dist/user/auth/login.js.map +1 -1
  75. package/dist/user/auth/signup.d.ts +3 -1
  76. package/dist/user/auth/signup.d.ts.map +1 -1
  77. package/dist/user/auth/signup.js +30 -1
  78. package/dist/user/auth/signup.js.map +1 -1
  79. package/dist/user/auth/social_icons.d.ts +2 -0
  80. package/dist/user/auth/social_icons.d.ts.map +1 -0
  81. package/dist/user/auth/social_icons.js +11 -0
  82. package/dist/user/auth/social_icons.js.map +1 -0
  83. package/dist/user/auth/two_factor.d.ts.map +1 -1
  84. package/dist/user/auth/two_factor.js +133 -157
  85. package/dist/user/auth/two_factor.js.map +1 -1
  86. package/locale/ar/messages.json +371 -357
  87. package/locale/bg/messages.json +371 -357
  88. package/locale/cs/messages.json +371 -357
  89. package/locale/da/messages.json +371 -357
  90. package/locale/de/messages.json +371 -357
  91. package/locale/en/messages.json +371 -357
  92. package/locale/en_US/messages.json +371 -357
  93. package/locale/es/messages.json +371 -357
  94. package/locale/fr/messages.json +371 -357
  95. package/locale/it/messages.json +371 -357
  96. package/locale/ja/messages.json +371 -357
  97. package/locale/ko/messages.json +371 -357
  98. package/locale/nb/messages.json +371 -357
  99. package/locale/nl/messages.json +371 -357
  100. package/locale/pl/messages.json +371 -357
  101. package/locale/pt_BR/messages.json +371 -357
  102. package/locale/pt_PT/messages.json +371 -357
  103. package/locale/ru/messages.json +371 -357
  104. package/locale/sv/messages.json +371 -357
  105. package/locale/tr/messages.json +371 -357
  106. package/locale/zh_Hans/messages.json +371 -357
  107. package/package.json +8 -7
  108. package/scripts/extract-i18n-generic.js +182 -139
  109. package/src/app/index.ts +3 -1
  110. package/src/document_templates/editor.ts +41 -21
  111. package/src/user/auth/login.ts +2 -1
  112. package/src/user/auth/signup.ts +50 -1
  113. package/src/user/auth/social_icons.ts +10 -0
  114. package/src/user/auth/two_factor.ts +203 -228
  115. package/scripts/extract-fwtoolkit-i18n.js +0 -230
@@ -1,230 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * extract-fwtoolkit-i18n.js
5
- *
6
- * Scans fwtoolkit/src/ for gettext() calls, extracts unique msgids,
7
- * looks up translations from the Django djangojs.po files, and writes
8
- * per-language messages.po files into fwtoolkit/locale/.
9
- *
10
- * Usage:
11
- * node scripts/extract-fwtoolkit-i18n.js <path-to-django-locale> <path-to-fwtoolkit>
12
- *
13
- * Example:
14
- * node scripts/extract-fwtoolkit-i18n.js \
15
- * ../../fiduswriter-server-backend/fiduswriter/locale \
16
- * ../../fwtoolkit
17
- */
18
-
19
- import { readFileSync, writeFileSync, mkdirSync, readdirSync, existsSync } from "node:fs"
20
- import { join } from "node:path"
21
-
22
- const djangoLocalePath = process.argv[2]
23
- const fwtoolkitPath = process.argv[3]
24
-
25
- if (!djangoLocalePath || !fwtoolkitPath) {
26
- console.error("Usage: node extract-fwtoolkit-i18n.js <django-locale-dir> <fwtoolkit-dir>")
27
- process.exit(1)
28
- }
29
-
30
- // ---------------------------------------------------------------------------
31
- // Step 1 — Scan fwtoolkit/src/ for gettext() calls
32
- // ---------------------------------------------------------------------------
33
-
34
- /** Simple regex: matches gettext("...") with optional whitespace.
35
- * Does NOT handle gettext(msgid_variable) or template literals. */
36
- const GETTEXT_RE = /gettext\s*\(\s*["']([^"']+)["']\s*\)/g
37
-
38
- /** @type {Set<string>} */
39
- const msgids = new Set()
40
-
41
- function scanDir(dir) {
42
- if (!existsSync(dir)) return
43
- for (const entry of readdirSync(dir, { withFileTypes: true })) {
44
- const full = join(dir, entry.name)
45
- if (entry.isDirectory() && entry.name !== "node_modules" && !entry.name.startsWith(".")) {
46
- scanDir(full)
47
- } else if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".js"))) {
48
- const content = readFileSync(full, "utf8")
49
- let match
50
- while ((match = GETTEXT_RE.exec(content)) !== null) {
51
- msgids.add(match[1])
52
- }
53
- }
54
- }
55
- }
56
-
57
- console.log(`Scanning ${fwtoolkitPath}/src/ for gettext() calls...`)
58
- scanDir(join(fwtoolkitPath, "src"))
59
- console.log(`Found ${msgids.size} unique msgids.\n`)
60
-
61
- if (msgids.size === 0) {
62
- console.log("No gettext() calls found. Exiting.")
63
- process.exit(0)
64
- }
65
-
66
- // ---------------------------------------------------------------------------
67
- // Step 2 — Look up translations from Django djangojs.po
68
- // ---------------------------------------------------------------------------
69
-
70
- const languages = readdirSync(djangoLocalePath, { withFileTypes: true })
71
- .filter((e) => e.isDirectory())
72
- .map((e) => e.name)
73
-
74
- console.log(`Looking up translations in ${languages.length} languages...`)
75
-
76
- let totalTranslated = 0
77
-
78
- for (const lang of languages) {
79
- const poFile = join(djangoLocalePath, lang, "LC_MESSAGES", "djangojs.po")
80
- if (!existsSync(poFile)) continue
81
-
82
- const poContent = readFileSync(poFile, "utf8")
83
-
84
- // Build translation map from this language's djangojs.po
85
- /** @type {Map<string, {msgstr: string, comment: string}>} */
86
- const translationMap = new Map()
87
-
88
- let currentMsgid = null
89
- let currentComment = ""
90
- for (const line of poContent.split("\n")) {
91
- const trimmed = line.trim()
92
-
93
- // Comment lines
94
- if (trimmed.startsWith("#:")) {
95
- if (currentMsgid === null) {
96
- currentComment += line + "\n"
97
- }
98
- continue
99
- }
100
- if (trimmed.startsWith("#,") || trimmed.startsWith("#.") || trimmed.startsWith("#|")) {
101
- if (currentMsgid === null) {
102
- currentComment += line + "\n"
103
- }
104
- continue
105
- }
106
- if (trimmed.startsWith("#") && !trimmed.startsWith("#:")) {
107
- continue
108
- }
109
-
110
- // msgid line
111
- if (trimmed.startsWith('msgid "')) {
112
- currentMsgid = unescapePo(trimmed.slice(7, -1))
113
- continue
114
- }
115
- if (trimmed.startsWith('msgid ')) {
116
- currentMsgid = unescapePo(trimmed.slice(6))
117
- continue
118
- }
119
-
120
- // msgstr line — capture translation
121
- if (trimmed.startsWith('msgstr "') && currentMsgid !== null) {
122
- const msgstr = unescapePo(trimmed.slice(8, -1))
123
- if (msgstr) {
124
- translationMap.set(currentMsgid, {
125
- msgstr,
126
- comment: currentComment.trim(),
127
- })
128
- }
129
- currentMsgid = null
130
- currentComment = ""
131
- continue
132
- }
133
- if (trimmed.startsWith('msgstr ') && currentMsgid !== null) {
134
- const msgstr = unescapePo(trimmed.slice(7))
135
- if (msgstr) {
136
- translationMap.set(currentMsgid, {
137
- msgstr,
138
- comment: currentComment.trim(),
139
- })
140
- }
141
- currentMsgid = null
142
- currentComment = ""
143
- continue
144
- }
145
-
146
- // Plural forms — skip for simplicity (fwtoolkit doesn't use ngettext)
147
- if (trimmed.startsWith('msgid_plural') || trimmed.startsWith('msgstr[')) {
148
- currentMsgid = null
149
- currentComment = ""
150
- continue
151
- }
152
-
153
- // Continuation of msgid
154
- if (trimmed.startsWith('"') && currentMsgid !== null) {
155
- currentMsgid += unescapePo(trimmed.slice(1, -1))
156
- continue
157
- }
158
- }
159
-
160
- // Build .po file content
161
- const entries = []
162
- for (const msgid of msgids) {
163
- const translation = translationMap.get(msgid)
164
- const msgstr = translation ? translation.msgstr : ""
165
- const comment = translation ? translation.comment : ""
166
- entries.push({ msgid, msgstr, comment })
167
-
168
- if (msgstr) totalTranslated++
169
- }
170
-
171
- // Sort by msgid for stable output
172
- entries.sort((a, b) => a.msgid.localeCompare(b.msgid))
173
-
174
- const header = [
175
- `# Translations for fwtoolkit`,
176
- `# Language: ${lang}`,
177
- `# Auto-generated by extract-fwtoolkit-i18n.js`,
178
- `# Source: fwtoolkit/src/ (gettext() calls)`,
179
- `#`,
180
- `msgid ""`,
181
- `msgstr ""`,
182
- `"Content-Type: text/plain; charset=UTF-8\\n"`,
183
- `"Language: ${lang}\\n"`,
184
- `"Plural-Forms: nplurals=2; plural=(n != 1);\\n"`,
185
- ``,
186
- ].join("\n")
187
-
188
- const body = entries
189
- .map((e) => {
190
- let lines = ""
191
- if (e.comment) lines += e.comment + "\n"
192
- lines += `msgid "${escapePo(e.msgid)}"\n`
193
- lines += `msgstr "${escapePo(e.msgstr)}"\n`
194
- return lines + "\n"
195
- })
196
- .join("")
197
-
198
- const langDir = join(fwtoolkitPath, "locale", lang, "LC_MESSAGES")
199
- mkdirSync(langDir, { recursive: true })
200
- const outFile = join(langDir, "messages.po")
201
- writeFileSync(outFile, header + body, "utf8")
202
-
203
- const translated = entries.filter((e) => e.msgstr).length
204
- console.log(` ${lang}: ${entries.length} entries, ${translated} translated`)
205
- }
206
-
207
- console.log(`\nTotal translated strings across all languages: ${totalTranslated}`)
208
- console.log("Done.")
209
-
210
- // ---------------------------------------------------------------------------
211
- // Helpers
212
- // ---------------------------------------------------------------------------
213
-
214
- function escapePo(s) {
215
- return s
216
- .replace(/\\/g, "\\\\")
217
- .replace(/"/g, '\\"')
218
- .replace(/\n/g, "\\n")
219
- .replace(/\r/g, "\\r")
220
- .replace(/\t/g, "\\t")
221
- }
222
-
223
- function unescapePo(s) {
224
- return s
225
- .replace(/\\"/g, '"')
226
- .replace(/\\n/g, "\n")
227
- .replace(/\\r/g, "\r")
228
- .replace(/\\t/g, "\t")
229
- .replace(/\\\\/g, "\\")
230
- }