@bridge-ds/core 0.10.0 → 0.12.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/README.md CHANGED
@@ -283,6 +283,22 @@ reviewSuggestionOnGitHub(gh, n, { event, role?, message?, payloadSha? }, gov); l
283
283
  declineSuggestionOnGitHub(gh, n, reason, by?); syncSuggestionStateLabel(gh, n, labels, status);
284
284
  ```
285
285
 
286
+ ## storybook (storybook.ts)
287
+
288
+ Reads a deployed or built Storybook without the repo: `index.json` (v4 for Storybook 7, v5 for 8 and later), else
289
+ `stories.json` (v3). Entries are grouped by title into components (name = last title segment); test entries stay out
290
+ of `stories`. A 404, an HTML answer from a host that falls back to `index.html`, or a body with no entries moves on to
291
+ the next file. Errors carry a code: `invalid-url`, `not-found`, `not-json`, `private` (sign-in wall, Chromatic login
292
+ answer, 401/403), `empty`, `http`, `network`. Pure, with an injected `fetch`; `@bridge-ds/visual` uses the parser for
293
+ `storybook-static/index.json` and the iframe URL builder for its captures.
294
+
295
+ ```ts
296
+ fetchStorybookIndex(base, { fetch?, signal? }): Promise<{ version; source: 'index.json' | 'stories.json'; entries; components }>;
297
+ parseStorybookIndex(json, source?); groupStorybookComponents(entries): { title; name; group; stories; docs; tags }[];
298
+ normalizeStorybookUrl(pasted): string; // https only (http on localhost), drops ?path=, /index.html, /iframe.html
299
+ storybookIframeUrl(base, id, { viewMode?, globals?, args? }); storybookManagerUrl(base, id, viewMode?); storybookIndexUrls(base);
300
+ ```
301
+
286
302
  ## history (history.ts, history-github.ts, history-demo.ts)
287
303
 
288
304
  What changed in the tokens, when, who changed it and why, and how to undo it safely.
@@ -1,6 +1,6 @@
1
1
  import type { ChangesMode } from './config';
2
2
  import { type GitHubClient } from './github-client';
3
- import { type SuggestionPayloadV1 } from './suggestions';
3
+ import { type SuggestionFigmaNode, type SuggestionPayloadV1 } from './suggestions';
4
4
  import type { TokenEdit } from './token-edits';
5
5
  import { type ComponentPushDiff, type ComponentPushPlan, type FigmaOrigin, type FigmaPushStatus, type PushTokenContext } from './figma-push';
6
6
  /**
@@ -19,6 +19,7 @@ export type FigmaTokenWriter = (input: {
19
19
  fileKey?: string | undefined;
20
20
  nodeId?: string | undefined;
21
21
  url?: string | undefined;
22
+ nodes?: SuggestionFigmaNode[] | undefined;
22
23
  };
23
24
  }) => Promise<{
24
25
  number: number;
@@ -83,6 +84,10 @@ export declare function componentSpecSuggestionPayload(d: ComponentPushDiff, pla
83
84
  createdAt?: string | undefined;
84
85
  componentsDir?: string | undefined;
85
86
  }): SuggestionPayloadV1;
87
+ /** The Figma nodes of a push for a suggestion's links: the component as it is now (after), and before when known. */
88
+ export declare function figmaNodes(d: Pick<ComponentPushDiff, 'figma'>): {
89
+ nodes?: SuggestionFigmaNode[];
90
+ };
86
91
  /**
87
92
  * Opens the library branch of a component change from Figma, linked to its origin (the Figma component): an exact token
88
93
  * swap opens a token change (the shared proposal write: contrast gate, tier, changeset); anything that needs code opens
@@ -51,6 +51,12 @@ export interface ComponentPushDiff {
51
51
  nodeId?: string | undefined;
52
52
  nodeName?: string | undefined;
53
53
  url?: string | undefined;
54
+ /** A node that shows the design before the change, when the file keeps one (optional). */
55
+ before?: {
56
+ nodeId: string;
57
+ nodeName?: string | undefined;
58
+ url?: string | undefined;
59
+ } | undefined;
54
60
  } | undefined;
55
61
  /** The component as Figma has it now: variant axes, properties, bound variables (token paths) per variant. */
56
62
  variantAxes: Record<string, string[]>;
package/dist/index.d.ts CHANGED
@@ -63,3 +63,4 @@ export * from './suggestions';
63
63
  export * from './suggestion-review';
64
64
  export * from './suggestions-github';
65
65
  export * from './suggestion-apply';
66
+ export * from './storybook';