@sxl-studio/storybook-addon 1.0.3 → 1.0.5
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/manager.js +29 -7
- package/package.json +1 -1
package/dist/manager.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// src/manager.tsx
|
|
2
2
|
import { addons, types } from "@storybook/manager-api";
|
|
3
|
-
import { AddonPanel } from "@storybook/components";
|
|
4
3
|
|
|
5
4
|
// src/constants.ts
|
|
6
5
|
var ADDON_ID = "sxl-studio";
|
|
@@ -180,6 +179,13 @@ function resolveEntry(params) {
|
|
|
180
179
|
const name = params.component.toLowerCase();
|
|
181
180
|
found = registry.entries.find((e) => e.displayName.toLowerCase() === name);
|
|
182
181
|
}
|
|
182
|
+
console.info("[SXL Storybook Addon] resolve-entry", {
|
|
183
|
+
hasRegistry: !!registry,
|
|
184
|
+
registryEntries: registry?.entries?.length ?? 0,
|
|
185
|
+
figmaNodeId: params.figmaNodeId ?? null,
|
|
186
|
+
component: params.component ?? null,
|
|
187
|
+
found: found ? { nodeId: found.nodeId, displayName: found.displayName } : null
|
|
188
|
+
});
|
|
183
189
|
if (!found) return null;
|
|
184
190
|
return {
|
|
185
191
|
...found,
|
|
@@ -240,6 +246,12 @@ var StatusRow = ({
|
|
|
240
246
|
] });
|
|
241
247
|
var SxlPanel = () => {
|
|
242
248
|
const params = useParameter(PARAM_KEY);
|
|
249
|
+
console.info("[SXL Storybook Addon] panel-params", {
|
|
250
|
+
hasParams: !!params,
|
|
251
|
+
keys: params ? Object.keys(params) : [],
|
|
252
|
+
hasRegistry: !!params?.registry,
|
|
253
|
+
registryEntries: params?.registry?.entries?.length ?? 0
|
|
254
|
+
});
|
|
243
255
|
const entry = resolveEntry(params);
|
|
244
256
|
if (!entry) return /* @__PURE__ */ jsx(EmptyState, {});
|
|
245
257
|
const tokenStatus = entry.meta?.tokenStatus;
|
|
@@ -307,10 +319,20 @@ var SxlPanel = () => {
|
|
|
307
319
|
|
|
308
320
|
// src/manager.tsx
|
|
309
321
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
322
|
+
var REGISTRY_GUARD_KEY = "__sxlStudioAddonRegistered__";
|
|
323
|
+
if (!globalThis[REGISTRY_GUARD_KEY]) {
|
|
324
|
+
globalThis[REGISTRY_GUARD_KEY] = true;
|
|
325
|
+
console.info("[SXL Storybook Addon] register manager addon");
|
|
326
|
+
addons.register(ADDON_ID, () => {
|
|
327
|
+
addons.add(PANEL_ID, {
|
|
328
|
+
type: types.PANEL,
|
|
329
|
+
title: "SXL Studio",
|
|
330
|
+
render: ({ active }) => {
|
|
331
|
+
if (!active) return null;
|
|
332
|
+
return /* @__PURE__ */ jsx2(SxlPanel, {});
|
|
333
|
+
}
|
|
334
|
+
});
|
|
315
335
|
});
|
|
316
|
-
}
|
|
336
|
+
} else {
|
|
337
|
+
console.warn("[SXL Storybook Addon] skip duplicate manager registration");
|
|
338
|
+
}
|
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.5",
|
|
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",
|