sketchframe 0.9.0 → 0.10.0
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/dist/sketchframe-mcp.cjs +18 -4
- package/dist/sketchframe.cjs +18 -4
- package/package.json +1 -1
package/dist/sketchframe-mcp.cjs
CHANGED
|
@@ -355,12 +355,19 @@ function findNode(frame, query) {
|
|
|
355
355
|
if (trimmed === "" || trimmed === "/") return frame.root;
|
|
356
356
|
const byId = nodes.find((node2) => node2.id === trimmed) ?? nodes.find((node2) => node2.sketchId === trimmed);
|
|
357
357
|
if (byId) return byId;
|
|
358
|
-
const path = trimmed
|
|
358
|
+
const path = trimSlashes(trimmed).split("/");
|
|
359
359
|
const byPath = frameNodes.find((node2) => node2.path.length === path.length && node2.path.every((name, i) => name === path[i]));
|
|
360
360
|
if (byPath) return byPath;
|
|
361
361
|
const byName = nodes.filter((node2) => node2.name === trimmed);
|
|
362
362
|
return byName.length === 1 ? byName[0] : void 0;
|
|
363
363
|
}
|
|
364
|
+
function trimSlashes(text3) {
|
|
365
|
+
let start = 0;
|
|
366
|
+
let end = text3.length;
|
|
367
|
+
while (start < end && text3[start] === "/") start++;
|
|
368
|
+
while (end > start && text3[end - 1] === "/") end--;
|
|
369
|
+
return text3.slice(start, end);
|
|
370
|
+
}
|
|
364
371
|
function requireNode(frame, query) {
|
|
365
372
|
const node2 = findNode(frame, query);
|
|
366
373
|
if (node2) return node2;
|
|
@@ -442,7 +449,7 @@ function htmlForNode(frame, node2) {
|
|
|
442
449
|
const usedTokens = /* @__PURE__ */ new Set();
|
|
443
450
|
const classNames = /* @__PURE__ */ new Map();
|
|
444
451
|
const className = (current) => {
|
|
445
|
-
const base = (current.name || current.type).toLowerCase().replace(/[^a-z0-9]+/g, "-")
|
|
452
|
+
const base = trimDashes((current.name || current.type).toLowerCase().replace(/[^a-z0-9]+/g, "-")) || current.type;
|
|
446
453
|
const safe = /^[a-z]/.test(base) ? base : `n-${base}`;
|
|
447
454
|
const count = (classNames.get(safe) ?? 0) + 1;
|
|
448
455
|
classNames.set(safe, count);
|
|
@@ -614,7 +621,14 @@ function textCSS(style, color) {
|
|
|
614
621
|
return css;
|
|
615
622
|
}
|
|
616
623
|
function tokenVariable(token) {
|
|
617
|
-
return `--${token.toLowerCase().replace(/[^a-z0-9]+/g, "-")
|
|
624
|
+
return `--${trimDashes(token.toLowerCase().replace(/[^a-z0-9]+/g, "-")) || "token"}`;
|
|
625
|
+
}
|
|
626
|
+
function trimDashes(text3) {
|
|
627
|
+
let start = 0;
|
|
628
|
+
let end = text3.length;
|
|
629
|
+
while (start < end && text3[start] === "-") start++;
|
|
630
|
+
while (end > start && text3[end - 1] === "-") end--;
|
|
631
|
+
return text3.slice(start, end);
|
|
618
632
|
}
|
|
619
633
|
function px(value) {
|
|
620
634
|
const n = typeof value === "number" ? value : 0;
|
|
@@ -1154,7 +1168,7 @@ function optionalInteger(value) {
|
|
|
1154
1168
|
}
|
|
1155
1169
|
|
|
1156
1170
|
// src/version.ts
|
|
1157
|
-
var version = true ? "0.
|
|
1171
|
+
var version = true ? "0.10.0" : "dev";
|
|
1158
1172
|
|
|
1159
1173
|
// src/mcp.ts
|
|
1160
1174
|
var protocolVersions = ["2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"];
|
package/dist/sketchframe.cjs
CHANGED
|
@@ -460,12 +460,19 @@ function findNode(frame, query) {
|
|
|
460
460
|
if (trimmed === "" || trimmed === "/") return frame.root;
|
|
461
461
|
const byId = nodes.find((node2) => node2.id === trimmed) ?? nodes.find((node2) => node2.sketchId === trimmed);
|
|
462
462
|
if (byId) return byId;
|
|
463
|
-
const path = trimmed
|
|
463
|
+
const path = trimSlashes(trimmed).split("/");
|
|
464
464
|
const byPath = frameNodes.find((node2) => node2.path.length === path.length && node2.path.every((name, i) => name === path[i]));
|
|
465
465
|
if (byPath) return byPath;
|
|
466
466
|
const byName = nodes.filter((node2) => node2.name === trimmed);
|
|
467
467
|
return byName.length === 1 ? byName[0] : void 0;
|
|
468
468
|
}
|
|
469
|
+
function trimSlashes(text3) {
|
|
470
|
+
let start = 0;
|
|
471
|
+
let end = text3.length;
|
|
472
|
+
while (start < end && text3[start] === "/") start++;
|
|
473
|
+
while (end > start && text3[end - 1] === "/") end--;
|
|
474
|
+
return text3.slice(start, end);
|
|
475
|
+
}
|
|
469
476
|
function requireNode(frame, query) {
|
|
470
477
|
const node2 = findNode(frame, query);
|
|
471
478
|
if (node2) return node2;
|
|
@@ -733,7 +740,7 @@ function htmlForNode(frame, node2) {
|
|
|
733
740
|
const usedTokens = /* @__PURE__ */ new Set();
|
|
734
741
|
const classNames = /* @__PURE__ */ new Map();
|
|
735
742
|
const className = (current) => {
|
|
736
|
-
const base = (current.name || current.type).toLowerCase().replace(/[^a-z0-9]+/g, "-")
|
|
743
|
+
const base = trimDashes((current.name || current.type).toLowerCase().replace(/[^a-z0-9]+/g, "-")) || current.type;
|
|
737
744
|
const safe = /^[a-z]/.test(base) ? base : `n-${base}`;
|
|
738
745
|
const count = (classNames.get(safe) ?? 0) + 1;
|
|
739
746
|
classNames.set(safe, count);
|
|
@@ -905,7 +912,14 @@ function textCSS(style, color) {
|
|
|
905
912
|
return css;
|
|
906
913
|
}
|
|
907
914
|
function tokenVariable(token) {
|
|
908
|
-
return `--${token.toLowerCase().replace(/[^a-z0-9]+/g, "-")
|
|
915
|
+
return `--${trimDashes(token.toLowerCase().replace(/[^a-z0-9]+/g, "-")) || "token"}`;
|
|
916
|
+
}
|
|
917
|
+
function trimDashes(text3) {
|
|
918
|
+
let start = 0;
|
|
919
|
+
let end = text3.length;
|
|
920
|
+
while (start < end && text3[start] === "-") start++;
|
|
921
|
+
while (end > start && text3[end - 1] === "-") end--;
|
|
922
|
+
return text3.slice(start, end);
|
|
909
923
|
}
|
|
910
924
|
function px(value) {
|
|
911
925
|
const n = typeof value === "number" ? value : 0;
|
|
@@ -1364,7 +1378,7 @@ function optionalInteger(value) {
|
|
|
1364
1378
|
}
|
|
1365
1379
|
|
|
1366
1380
|
// src/version.ts
|
|
1367
|
-
var version = true ? "0.
|
|
1381
|
+
var version = true ? "0.10.0" : "dev";
|
|
1368
1382
|
|
|
1369
1383
|
// src/mcp.ts
|
|
1370
1384
|
var protocolVersions = ["2025-11-25", "2025-06-18", "2025-03-26", "2024-11-05"];
|
package/package.json
CHANGED