openfig-cli 0.3.28 → 0.3.29

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.
@@ -271,6 +271,8 @@ function esc(s) {
271
271
  */
272
272
  function isStaleLayout(chars, baselines, glyphs) {
273
273
  if (!chars) return false;
274
+ // No derivedTextData at all (e.g. programmatically created text)
275
+ if (!baselines?.length && !glyphs?.length) return true;
274
276
  const len = chars.length;
275
277
 
276
278
  if (baselines?.length) {
@@ -356,9 +358,27 @@ function fallbackTextTspans(dispChars, fontSize, node) {
356
358
  : adjLineAscent;
357
359
  }
358
360
 
361
+ // List marker support: read lineType from textData.lines
362
+ const linesMeta = node.textData?.lines ?? [];
363
+ let orderedCounter = 0;
364
+
359
365
  const tspans = lines.map((line, i) => {
360
366
  const y = startY + i * adjLineHeight;
361
- return `<tspan x="${startX}" y="${y.toFixed(2)}" text-anchor="${anchor}">${esc(line) || ' '}</tspan>`;
367
+ const meta = linesMeta[i];
368
+ const lineType = meta?.lineType;
369
+ const indent = (meta?.indentationLevel ?? 0) * adjFontSize * 0.8;
370
+ let prefix = '';
371
+ if (lineType === 'UNORDERED_LIST') {
372
+ prefix = '\u2022 '; // bullet •
373
+ orderedCounter = 0;
374
+ } else if (lineType === 'ORDERED_LIST') {
375
+ orderedCounter++;
376
+ prefix = `${orderedCounter}. `;
377
+ } else {
378
+ orderedCounter = 0;
379
+ }
380
+ const x = startX + indent;
381
+ return `<tspan x="${x.toFixed(2)}" y="${y.toFixed(2)}" text-anchor="${anchor}">${esc(prefix + line) || ' '}</tspan>`;
362
382
  }).join('');
363
383
 
364
384
  return { tspans, fontSize: adjFontSize };
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": "0.2",
3
3
  "name": "openfig",
4
- "version": "0.3.28",
4
+ "version": "0.3.29",
5
5
  "description": "Open-source tools for Figma file parsing and rendering",
6
6
  "author": {
7
7
  "name": "OpenFig Contributors"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openfig-cli",
3
- "version": "0.3.28",
3
+ "version": "0.3.29",
4
4
  "description": "OpenFig — Open-source tools for Figma file parsing and rendering",
5
5
  "type": "module",
6
6
  "bin": {