stickyflow 0.9.2 → 0.9.3

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/CHANGELOG.md CHANGED
@@ -17,6 +17,16 @@ Two things count as breaking here that are easy to overlook:
17
17
 
18
18
  ## [Unreleased]
19
19
 
20
+ ## [0.9.3] - 2026-10-28
21
+
22
+ ### Fixed
23
+
24
+ - A block that a `Repeat` made could be selected but not removed, as it has no lines of its own and the removal found nothing to cut. `removeCanvasObject` now keeps the cell of that block out of the Repeat, by adding it to the `where` of the Repeat, so the block and the other blocks of that cell are gone and every other cell is as it was. Moving, resizing and styling a made block still change nothing, as they have to change the Repeat.
25
+
26
+ ### Changed
27
+
28
+ - The language is version 1.6, which is the version that has the `Repeat` block. Documents that declare an earlier version are read as before, as the reader takes the version number as it is written.
29
+
20
30
  ## [0.9.2] - 2026-10-28
21
31
 
22
32
  ### Added
@@ -6821,12 +6821,69 @@ function outermostRemovalRanges(ranges) {
6821
6821
  );
6822
6822
  }
6823
6823
 
6824
+ // src/runtime/interaction/sflPatch/canvasObjectPatch/repeatCell.ts
6825
+ var REPEAT_HEADER = /^(\s*)Repeat\s+[A-Za-z_]\w*\s*\{\s*$/;
6826
+ var TEMPLATE_HEADER = /^\s*[A-Z]\w*\s+([A-Za-z_]\w*)\b[^{]*\{/;
6827
+ var PROPERTY = /^\s*[A-Za-z_]\w*\s*:/;
6828
+ var WHERE = /^(\s*)where\s*:\s*(.+?)\s*$/;
6829
+ var escaped = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
6830
+ function excludeRepeatCell(lines, id) {
6831
+ const masked = maskLines(lines);
6832
+ if (masked === null) {
6833
+ return null;
6834
+ }
6835
+ for (let start = 0; start < masked.length; start++) {
6836
+ const header = masked[start].match(REPEAT_HEADER);
6837
+ if (!header) {
6838
+ continue;
6839
+ }
6840
+ const end = blockEndLine(lines, start);
6841
+ let depth = 0;
6842
+ let cell = null;
6843
+ let whereLine = -1;
6844
+ let lastProperty = start;
6845
+ let seenTemplate = false;
6846
+ for (let i = start; i <= end; i++) {
6847
+ if (depth === 1 && i > start) {
6848
+ const template = masked[i].match(TEMPLATE_HEADER);
6849
+ if (template) {
6850
+ seenTemplate = true;
6851
+ const made = id.match(new RegExp(`^${escaped(template[1])}_(\\d+)(?:_(\\d+))?$`));
6852
+ if (made) {
6853
+ cell = { col: Number(made[1]), row: made[2] === void 0 ? 0 : Number(made[2]) };
6854
+ }
6855
+ } else if (WHERE.test(masked[i])) {
6856
+ whereLine = i;
6857
+ } else if (!seenTemplate && PROPERTY.test(masked[i])) {
6858
+ lastProperty = i;
6859
+ }
6860
+ }
6861
+ depth += braceDelta(masked[i]);
6862
+ }
6863
+ if (!cell) {
6864
+ continue;
6865
+ }
6866
+ const keep = `(col != ${cell.col} || row != ${cell.row})`;
6867
+ const out = [...lines];
6868
+ if (whereLine >= 0) {
6869
+ const where = lines[whereLine].match(WHERE);
6870
+ if (where) {
6871
+ out[whereLine] = `${where[1]}where: (${where[2]}) && ${keep}`;
6872
+ return out;
6873
+ }
6874
+ }
6875
+ out.splice(lastProperty + 1, 0, `${header[1]} where: ${keep}`);
6876
+ return out;
6877
+ }
6878
+ return null;
6879
+ }
6880
+
6824
6881
  // src/runtime/interaction/sflPatch/canvasObjectPatch/remove.ts
6825
6882
  function removeCanvasObject(sfl, id, options = {}) {
6826
6883
  const lines = sfl.split("\n");
6827
6884
  const canvasObjectRange = findOwnerBlock(lines, id);
6828
6885
  if (!canvasObjectRange) {
6829
- return sfl;
6886
+ return excludeRepeatCell(lines, id)?.join("\n") ?? sfl;
6830
6887
  }
6831
6888
  const ranges = [canvasObjectRange];
6832
6889
  if (options.alsoRemoveLinks ?? true) {