@hazem3500/palette 0.9.146 → 0.9.147

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,8 +271,20 @@ export function designEditFromProse(body, selector) {
271
271
  // Token values from the Tokens view apply page-wide, so they target :root.
272
272
  if (header[1] === "token") target ||= ":root";
273
273
  let layout = "";
274
+ // A suggestion's fenced diff: `- prop: before;` / `+ prop: after;` lines inside the rule block.
275
+ let fence = false;
276
+ const diff = { before: new Map(), after: new Map() };
274
277
  for (const line of lines.slice(1)) {
275
- if (line.startsWith("Target: ")) target ||= line.slice(8).trim();
278
+ if (fence) {
279
+ if (/^```/.test(line)) fence = false;
280
+ else {
281
+ const declaration = /^([-+])\s+([\w-]+)\s*:\s*(.*?);?\s*$/.exec(line);
282
+ if (declaration) diff[declaration[1] === "-" ? "before" : "after"].set(declaration[2], declaration[3]);
283
+ }
284
+ continue;
285
+ }
286
+ if (header[1] === "style" && /^```diff\s*$/.test(line)) fence = true;
287
+ else if (line.startsWith("Target: ")) target ||= line.slice(8).trim();
276
288
  else if (header[1] === "geometry") {
277
289
  if (line.startsWith("Layout: ")) layout = line.slice(8).trim().slice(0, 200);
278
290
  // "- Move Button “Save”: from Toolbar (3rd) → Sidebar (1st)", then "From: …" and "To: …" lines.
@@ -302,6 +314,10 @@ export function designEditFromProse(body, selector) {
302
314
  if (item && JSON.stringify(item.from) !== JSON.stringify(item.to)) changes.push(item);
303
315
  }
304
316
  }
317
+ for (const [property, to] of diff.after) {
318
+ const from = diff.before.get(property);
319
+ if (from !== to) changes.push({ kind: "css", property, from: from ?? "", to });
320
+ }
305
321
  }
306
322
  // A move line without its From and To lines can't be applied; keep the rest of the edit.
307
323
  for (let index = changes.length - 1; index >= 0; index--)