@versa_ai/vmml-editor 1.0.32 → 1.0.33

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @versa_ai/vmml-editor@1.0.32 build D:\code\work\vmml-player\packages\editor
2
+ > @versa_ai/vmml-editor@1.0.33 build D:\code\work\vmml-player\packages\editor
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -9,6 +9,7 @@
9
9
  CLI Target: node16
10
10
  CJS Build start
11
11
  ESM Build start
12
+ DTS Build start
12
13
 
13
14
   WARN  ▲ [WARNING] Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.
14
15
 
@@ -123,13 +124,12 @@ More info and automated migrator: https://sass-lang.com/d/slash-div [35
123
124
 
124
125
 
125
126
 
126
- CJS dist\index.js 115.87 KB
127
- CJS dist\index.js.map 221.07 KB
128
- CJS ⚡️ Build success in 906ms
129
- ESM dist\index.mjs 114.26 KB
130
- ESM dist\index.mjs.map 220.78 KB
131
- ESM ⚡️ Build success in 906ms
132
- DTS Build start
133
- DTS ⚡️ Build success in 1918ms
127
+ CJS dist\index.js 116.27 KB
128
+ CJS dist\index.js.map 222.40 KB
129
+ CJS ⚡️ Build success in 2872ms
130
+ ESM dist\index.mjs 114.66 KB
131
+ ESM dist\index.mjs.map 222.11 KB
132
+ ESM ⚡️ Build success in 2872ms
133
+ DTS ⚡️ Build success in 6088ms
134
134
  DTS dist\index.d.ts 158.00 B
135
135
  DTS dist\index.d.mts 158.00 B
package/dist/index.js CHANGED
@@ -1441,6 +1441,25 @@ var EditorCanvas = react.forwardRef(
1441
1441
  return null;
1442
1442
  }
1443
1443
  };
1444
+ const setTextAlign = (p, stroke, direction) => {
1445
+ if (direction === "center") {
1446
+ p.style.justifyContent = "center";
1447
+ stroke.style.left = "50%";
1448
+ stroke.style.top = "50%";
1449
+ stroke.style.transform = "translate(-50%, -50%)";
1450
+ }
1451
+ if (direction === "left") {
1452
+ stroke.style.left = "0";
1453
+ stroke.style.top = "0";
1454
+ stroke.style.transform = "none";
1455
+ }
1456
+ if (direction === "right") {
1457
+ p.style.justifyContent = "flex-end";
1458
+ stroke.style.right = "0";
1459
+ stroke.style.top = "50%";
1460
+ stroke.style.transform = "translateY(-50%)";
1461
+ }
1462
+ };
1444
1463
  const createTextImg = async ({ textContent, bgColor, textColor, stColor, strokeW, fontAssetUrl = null, textBasicInfo, letterSpacing }) => {
1445
1464
  const fontBase64 = await loadFont(fontAssetUrl);
1446
1465
  const container = document.createElement("div");
@@ -1462,7 +1481,6 @@ var EditorCanvas = react.forwardRef(
1462
1481
  p.style.padding = "0";
1463
1482
  if (letterSpacing) p.style.letterSpacing = `${letterSpacing}px`;
1464
1483
  p.style.zIndex = "2";
1465
- if (textWarapCenter) p.style.justifyContent = "center";
1466
1484
  const fill = document.createElement("span");
1467
1485
  fill.textContent = line || " ";
1468
1486
  fill.style.color = textColor;
@@ -1474,15 +1492,9 @@ var EditorCanvas = react.forwardRef(
1474
1492
  stroke.style.color = "transparent";
1475
1493
  stroke.style.webkitTextStrokeWidth = `${strokeW}px`;
1476
1494
  stroke.style.webkitTextStrokeColor = stColor;
1477
- if (textWarapCenter) {
1478
- stroke.style.left = "50%";
1479
- stroke.style.top = "50%";
1480
- stroke.style.transform = "translate(-50%, -50%)";
1481
- } else {
1482
- stroke.style.left = "0";
1483
- stroke.style.top = "0";
1484
- }
1485
- stroke.style.zIndex = "-1";
1495
+ let dr = textBasicInfo.textAlign || "left";
1496
+ if (textWarapCenter) dr = "center";
1497
+ setTextAlign(p, stroke, dr);
1486
1498
  p.appendChild(fill);
1487
1499
  p.appendChild(stroke);
1488
1500
  container.appendChild(p);