@uniweb/build 1.3.4 → 1.3.5
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/package.json +7 -7
- package/src/i18n/merge.js +15 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/build",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Build tooling for the Uniweb Component Web Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"js-yaml": "^4.1.0",
|
|
57
57
|
"sharp": "^0.35.3",
|
|
58
58
|
"yaml": "^2.5.0",
|
|
59
|
-
"@uniweb/content-reader": "~1.
|
|
59
|
+
"@uniweb/content-reader": "~1.4.0",
|
|
60
|
+
"@uniweb/projections": "~1.1.1",
|
|
60
61
|
"@uniweb/content-writer": "~1.1.2",
|
|
61
|
-
"@uniweb/semantic-parser": "~1.8.0",
|
|
62
62
|
"@uniweb/schemas": "~1.3.0",
|
|
63
|
-
"@uniweb/
|
|
63
|
+
"@uniweb/semantic-parser": "~1.8.1",
|
|
64
64
|
"@uniweb/theming": "~1.2.0"
|
|
65
65
|
},
|
|
66
66
|
"optionalDependencies": {
|
|
67
|
-
"@uniweb/runtime": "~1.1.
|
|
67
|
+
"@uniweb/runtime": "~1.1.4"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"@tailwindcss/vite": "^4.0.0",
|
|
74
74
|
"@vitejs/plugin-react": "^4.0.0 || ^5.0.0",
|
|
75
75
|
"vite-plugin-svgr": "^4.0.0",
|
|
76
|
-
"@uniweb/
|
|
77
|
-
"@uniweb/
|
|
76
|
+
"@uniweb/runtime": "~1.1.4",
|
|
77
|
+
"@uniweb/core": "~1.2.2"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"vite": {
|
package/src/i18n/merge.js
CHANGED
|
@@ -392,7 +392,7 @@ function applyElementTranslation(node, context, translations, fallbackToSource)
|
|
|
392
392
|
export function translatedInline(source, value) {
|
|
393
393
|
const fragment = inlineMarkdownToFragment(value)
|
|
394
394
|
if (!fragment) return null
|
|
395
|
-
return asLinkLabels(source, fragment) || fragment
|
|
395
|
+
return asLinkLabels(source, fragment, value) || fragment
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
/**
|
|
@@ -410,13 +410,13 @@ export function translationKeepsMarkup(markup, value) {
|
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
// The source's links with the fragment as their labels — the whole fragment for one link, a line
|
|
413
|
-
// each for several — or null: the fragment names a link of its own, the source is not
|
|
414
|
-
// or the lines do not match the links one to one.
|
|
415
|
-
function asLinkLabels(source, fragment) {
|
|
413
|
+
// of the value each for several — or null: the fragment names a link of its own, the source is not
|
|
414
|
+
// only links, or the lines do not match the links one to one.
|
|
415
|
+
function asLinkLabels(source, fragment, value) {
|
|
416
416
|
if (fragment.some((node) => linkMarkOf(node))) return null
|
|
417
417
|
const links = linkRuns(source)
|
|
418
418
|
if (!links) return null
|
|
419
|
-
const labels = links.length === 1 ? [trimInline(fragment)] :
|
|
419
|
+
const labels = links.length === 1 ? [trimInline(fragment)] : valueLines(value)
|
|
420
420
|
if (labels.length !== links.length || labels.some((label) => !label.length)) return null
|
|
421
421
|
const out = []
|
|
422
422
|
links.forEach((link, i) => {
|
|
@@ -503,6 +503,16 @@ function sameMark(a, b) {
|
|
|
503
503
|
return Boolean(a && b) && a.type === b.type && JSON.stringify(a.attrs || {}) === JSON.stringify(b.attrs || {})
|
|
504
504
|
}
|
|
505
505
|
|
|
506
|
+
// A value's lines as the translator wrote them, each read as inline markdown and split again at a
|
|
507
|
+
// line break written in it (`<br>`), each trimmed; blank lines dropped. ⭐ Split BEFORE it is read:
|
|
508
|
+
// a plain newline inside a paragraph reads as a space (2026-10-16), so the value, read whole, has no
|
|
509
|
+
// lines left. ⛔ Until then the read value was split, at the newlines it kept.
|
|
510
|
+
function valueLines(value) {
|
|
511
|
+
return String(value ?? '')
|
|
512
|
+
.split('\n')
|
|
513
|
+
.flatMap((line) => inlineLines(inlineMarkdownToFragment(line) || []))
|
|
514
|
+
}
|
|
515
|
+
|
|
506
516
|
// A fragment's lines, split at line breaks, each trimmed; blank lines dropped.
|
|
507
517
|
function inlineLines(fragment) {
|
|
508
518
|
const lines = [[]]
|