@sxl-studio/storybook-addon 1.0.13 → 1.0.14
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/index.js +2 -2
- package/dist/manager.js +17 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ function convertV2Components(components, fileKey) {
|
|
|
29
29
|
const nodeId = String(c.nodeId ?? "");
|
|
30
30
|
const sb = c.storybook ?? {};
|
|
31
31
|
const cc = c.codeConnect ?? {};
|
|
32
|
-
const figmaUrl = fileKey ? `https://www.figma.com/design/${fileKey}?node-id=${nodeId.replace(":", "-")}` : void 0;
|
|
32
|
+
const figmaUrl = typeof sb.figmaUrl === "string" && sb.figmaUrl.trim() ? sb.figmaUrl.trim() : fileKey ? `https://www.figma.com/design/${fileKey}?node-id=${nodeId.replace(":", "-")}` : void 0;
|
|
33
33
|
const statusRaw = typeof sb.status === "string" ? sb.status : void 0;
|
|
34
34
|
const readiness = statusRaw === "complete" || statusRaw === "ready-for-dev" || statusRaw === "in-progress" || statusRaw === "backlog" ? statusRaw : void 0;
|
|
35
35
|
const files = parseFiles(Array.isArray(cc.files) ? cc.files : []);
|
|
@@ -78,7 +78,7 @@ function convertV1Entries(rawEntries, fileKey) {
|
|
|
78
78
|
const b = e.binding;
|
|
79
79
|
const sb = b.storybook ?? {};
|
|
80
80
|
const nodeId = String(e.nodeId ?? "");
|
|
81
|
-
const figmaUrl = fileKey ? `https://www.figma.com/design/${fileKey}?node-id=${nodeId.replace(":", "-")}` : void 0;
|
|
81
|
+
const figmaUrl = typeof sb.figmaUrl === "string" && sb.figmaUrl.trim() ? sb.figmaUrl.trim() : fileKey ? `https://www.figma.com/design/${fileKey}?node-id=${nodeId.replace(":", "-")}` : void 0;
|
|
82
82
|
const statusRaw = typeof sb.status === "string" ? sb.status : void 0;
|
|
83
83
|
const readiness = statusRaw === "complete" || statusRaw === "ready-for-dev" || statusRaw === "in-progress" || statusRaw === "backlog" ? statusRaw : void 0;
|
|
84
84
|
const files = parseFiles(Array.isArray(b.files) ? b.files : []);
|
package/dist/manager.js
CHANGED
|
@@ -37,7 +37,7 @@ function convertV2Components(components, fileKey) {
|
|
|
37
37
|
const nodeId = String(c.nodeId ?? "");
|
|
38
38
|
const sb = c.storybook ?? {};
|
|
39
39
|
const cc = c.codeConnect ?? {};
|
|
40
|
-
const figmaUrl = fileKey ? `https://www.figma.com/design/${fileKey}?node-id=${nodeId.replace(":", "-")}` : void 0;
|
|
40
|
+
const figmaUrl = typeof sb.figmaUrl === "string" && sb.figmaUrl.trim() ? sb.figmaUrl.trim() : fileKey ? `https://www.figma.com/design/${fileKey}?node-id=${nodeId.replace(":", "-")}` : void 0;
|
|
41
41
|
const statusRaw = typeof sb.status === "string" ? sb.status : void 0;
|
|
42
42
|
const readiness = statusRaw === "complete" || statusRaw === "ready-for-dev" || statusRaw === "in-progress" || statusRaw === "backlog" ? statusRaw : void 0;
|
|
43
43
|
const files = parseFiles(Array.isArray(cc.files) ? cc.files : []);
|
|
@@ -86,7 +86,7 @@ function convertV1Entries(rawEntries, fileKey) {
|
|
|
86
86
|
const b = e.binding;
|
|
87
87
|
const sb = b.storybook ?? {};
|
|
88
88
|
const nodeId = String(e.nodeId ?? "");
|
|
89
|
-
const figmaUrl = fileKey ? `https://www.figma.com/design/${fileKey}?node-id=${nodeId.replace(":", "-")}` : void 0;
|
|
89
|
+
const figmaUrl = typeof sb.figmaUrl === "string" && sb.figmaUrl.trim() ? sb.figmaUrl.trim() : fileKey ? `https://www.figma.com/design/${fileKey}?node-id=${nodeId.replace(":", "-")}` : void 0;
|
|
90
90
|
const statusRaw = typeof sb.status === "string" ? sb.status : void 0;
|
|
91
91
|
const readiness = statusRaw === "complete" || statusRaw === "ready-for-dev" || statusRaw === "in-progress" || statusRaw === "backlog" ? statusRaw : void 0;
|
|
92
92
|
const files = parseFiles(Array.isArray(b.files) ? b.files : []);
|
|
@@ -3823,16 +3823,25 @@ var SxlPanel = () => {
|
|
|
3823
3823
|
}, []);
|
|
3824
3824
|
const entryForRender = result.status === "found" ? result.entry : null;
|
|
3825
3825
|
const showEmbed = !!entryForRender?.figmaUrl && entryForRender.designEmbed !== false;
|
|
3826
|
+
const renderEmbedSection = entryForRender?.designEmbed === true || !!entryForRender?.figmaUrl;
|
|
3826
3827
|
useEffect(() => {
|
|
3827
|
-
if (!
|
|
3828
|
+
if (!entryForRender) return;
|
|
3829
|
+
if (entryForRender.designEmbed === true && !entryForRender.figmaUrl) {
|
|
3830
|
+
console.warn(
|
|
3831
|
+
"[SXL Studio addon] Embed requested but figmaUrl is missing. Check diff `$figmaFileKey` or set `storybook.figmaUrl` in entry.",
|
|
3832
|
+
{ nodeId: entryForRender.nodeId, displayName: entryForRender.displayName }
|
|
3833
|
+
);
|
|
3834
|
+
return;
|
|
3835
|
+
}
|
|
3836
|
+
if (!showEmbed || !entryForRender.figmaUrl) return;
|
|
3828
3837
|
const embedUrl = buildEmbedUrl(entryForRender.figmaUrl);
|
|
3829
3838
|
console.info("[SXL Studio addon] Figma embed", {
|
|
3830
3839
|
designEmbed: entryForRender.designEmbed,
|
|
3831
3840
|
figmaUrl: entryForRender.figmaUrl,
|
|
3832
3841
|
embedUrl,
|
|
3833
|
-
hint: "If
|
|
3842
|
+
hint: "If iframe is blank, verify Storybook CSP frame-src includes https://www.figma.com"
|
|
3834
3843
|
});
|
|
3835
|
-
}, [
|
|
3844
|
+
}, [showEmbed, entryForRender?.figmaUrl, entryForRender?.designEmbed, entryForRender?.nodeId, entryForRender?.displayName]);
|
|
3836
3845
|
if (result.status === "no-registry") {
|
|
3837
3846
|
return React2.createElement(NoRegistryState, null);
|
|
3838
3847
|
}
|
|
@@ -3846,7 +3855,7 @@ var SxlPanel = () => {
|
|
|
3846
3855
|
const readiness = entry.meta?.readiness;
|
|
3847
3856
|
const dateStr = formatDate(entry.updatedAt);
|
|
3848
3857
|
const apiProps = entry.componentApi?.properties;
|
|
3849
|
-
return /* @__PURE__ */ React2.createElement("div", { style: panelRoot }, /* @__PURE__ */ React2.createElement("div", { style: topRow }, /* @__PURE__ */ React2.createElement("div", { style: titleBlock }, entry.displayName ? /* @__PURE__ */ React2.createElement("h2", { style: componentName }, entry.displayName) : null), /* @__PURE__ */ React2.createElement("div", { style: metaCol }, dateStr ? /* @__PURE__ */ React2.createElement("div", { style: dateText }, "Updated ", dateStr) : null, /* @__PURE__ */ React2.createElement("div", { style: badgeRow }, /* @__PURE__ */ React2.createElement(TokensBadge, { value: tokensBool }), readiness ? /* @__PURE__ */ React2.createElement(ReadinessBadge, { readiness }) : null))), entry.description ? /* @__PURE__ */ React2.createElement("div", { style: section }, /* @__PURE__ */ React2.createElement("div", { style: sectionLabel }, "Description"), /* @__PURE__ */ React2.createElement("div", { style: card }, /* @__PURE__ */ React2.createElement("p", { style: descriptionText }, entry.description))) : null,
|
|
3858
|
+
return /* @__PURE__ */ React2.createElement("div", { style: panelRoot }, /* @__PURE__ */ React2.createElement("div", { style: topRow }, /* @__PURE__ */ React2.createElement("div", { style: titleBlock }, entry.displayName ? /* @__PURE__ */ React2.createElement("h2", { style: componentName }, entry.displayName) : null), /* @__PURE__ */ React2.createElement("div", { style: metaCol }, dateStr ? /* @__PURE__ */ React2.createElement("div", { style: dateText }, "Updated ", dateStr) : null, /* @__PURE__ */ React2.createElement("div", { style: badgeRow }, /* @__PURE__ */ React2.createElement(TokensBadge, { value: tokensBool }), readiness ? /* @__PURE__ */ React2.createElement(ReadinessBadge, { readiness }) : null))), entry.description ? /* @__PURE__ */ React2.createElement("div", { style: section }, /* @__PURE__ */ React2.createElement("div", { style: sectionLabel }, "Description"), /* @__PURE__ */ React2.createElement("div", { style: card }, /* @__PURE__ */ React2.createElement("p", { style: descriptionText }, entry.description))) : null, renderEmbedSection ? /* @__PURE__ */ React2.createElement("div", { style: section }, /* @__PURE__ */ React2.createElement("div", { style: sectionLabel }, "Embed"), showEmbed ? /* @__PURE__ */ React2.createElement("div", { style: embedWrap }, /* @__PURE__ */ React2.createElement(
|
|
3850
3859
|
"iframe",
|
|
3851
3860
|
{
|
|
3852
3861
|
title: "Figma embed",
|
|
@@ -3856,9 +3865,7 @@ var SxlPanel = () => {
|
|
|
3856
3865
|
allow: "clipboard-write; fullscreen",
|
|
3857
3866
|
referrerPolicy: "no-referrer-when-downgrade",
|
|
3858
3867
|
onLoad: () => {
|
|
3859
|
-
|
|
3860
|
-
console.info("[SXL Studio addon] Figma iframe load event fired");
|
|
3861
|
-
}
|
|
3868
|
+
console.info("[SXL Studio addon] Figma iframe load event fired");
|
|
3862
3869
|
}
|
|
3863
3870
|
}
|
|
3864
3871
|
), /* @__PURE__ */ React2.createElement("div", { style: embedFooter }, /* @__PURE__ */ React2.createElement(
|
|
@@ -3879,7 +3886,7 @@ var SxlPanel = () => {
|
|
|
3879
3886
|
style: link
|
|
3880
3887
|
},
|
|
3881
3888
|
"Open in Figma Dev Mode \u2192"
|
|
3882
|
-
)))) : entry.figmaUrl ? /* @__PURE__ */ React2.createElement("div", { style: section }, /* @__PURE__ */ React2.createElement(
|
|
3889
|
+
))) : /* @__PURE__ */ React2.createElement("div", { style: card }, /* @__PURE__ */ React2.createElement("p", { style: { ...descriptionText, margin: 0 } }, "Embed is enabled but Figma URL is missing in registry entry. Re-link this component in plugin or ensure `diff-code-connect` has `$figmaFileKey` (or `storybook.figmaUrl`)."), /* @__PURE__ */ React2.createElement("p", { style: { ...descriptionText, margin: "8px 0 0", fontSize: "12px" } }, "Node: ", /* @__PURE__ */ React2.createElement("code", { style: emptyCode }, entry.nodeId)))) : entry.figmaUrl ? /* @__PURE__ */ React2.createElement("div", { style: section }, /* @__PURE__ */ React2.createElement(
|
|
3883
3890
|
"a",
|
|
3884
3891
|
{
|
|
3885
3892
|
href: buildDevModeUrl(entry.figmaUrl),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sxl-studio/storybook-addon",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "Storybook addon for SXL Studio — displays Figma Embed, component info and design token status for linked components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|