@component-anatomy/storybook 0.0.1 → 0.0.2

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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const Panel: React.FC;
3
+ //# sourceMappingURL=Panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Panel.d.ts","sourceRoot":"","sources":["../src/Panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AA6EnD,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EA0FzB,CAAC"}
@@ -0,0 +1,20 @@
1
+ export declare const ADDON_ID = "component-anatomy";
2
+ export declare const PANEL_ID = "component-anatomy/panel";
3
+ /** Story parameter key: `parameters.anatomy = { ... }` */
4
+ export declare const PARAM_KEY = "anatomy";
5
+ /** Channel events used to sync the manager panel with the preview iframe. */
6
+ export declare const EVENTS: {
7
+ /** preview → manager: a part became active in the canvas (hover/programmatic). */
8
+ readonly PART_ENTER: "component-anatomy/part-enter";
9
+ /** preview → manager: no part is active anymore. */
10
+ readonly PART_LEAVE: "component-anatomy/part-leave";
11
+ /** preview → manager: resolved part list for the current story. */
12
+ readonly PARTS: "component-anatomy/parts";
13
+ /** manager → preview: the user hovers/focuses a panel entry. */
14
+ readonly HOVER_ITEM: "component-anatomy/hover-item";
15
+ /** manager → preview: the user left a panel entry. */
16
+ readonly LEAVE_ITEM: "component-anatomy/leave-item";
17
+ /** manager → preview: the panel mounted and wants the current part list. */
18
+ readonly PARTS_REQUEST: "component-anatomy/parts-request";
19
+ };
20
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,sBAAsB,CAAC;AAC5C,eAAO,MAAM,QAAQ,4BAAsB,CAAC;AAE5C,0DAA0D;AAC1D,eAAO,MAAM,SAAS,YAAY,CAAC;AAEnC,6EAA6E;AAC7E,eAAO,MAAM,MAAM;IACjB,kFAAkF;aAClF,UAAU;IACV,oDAAoD;aACpD,UAAU;IACV,mEAAmE;aACnE,KAAK;IACL,gEAAgE;aAChE,UAAU;IACV,sDAAsD;aACtD,UAAU;IACV,4EAA4E;aAC5E,aAAa;CACL,CAAC"}
package/dist/index.cjs CHANGED
@@ -18,14 +18,14 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  ADDON_ID: () => ADDON_ID,
24
24
  EVENTS: () => EVENTS,
25
25
  PANEL_ID: () => PANEL_ID,
26
26
  PARAM_KEY: () => PARAM_KEY
27
27
  });
28
- module.exports = __toCommonJS(src_exports);
28
+ module.exports = __toCommonJS(index_exports);
29
29
 
30
30
  // src/constants.ts
31
31
  var ADDON_ID = "component-anatomy";
@@ -0,0 +1,3 @@
1
+ export { ADDON_ID, PANEL_ID, PARAM_KEY, EVENTS } from './constants.js';
2
+ export type { AnatomyParameters } from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACvE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../src/manager.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { Renderer, PartialStoryFn, StoryContext } from 'storybook/internal/types';
2
+ export declare const withComponentAnatomy: (storyFn: PartialStoryFn<Renderer>, context: StoryContext<Renderer>) => any;
3
+ export declare const decorators: (typeof withComponentAnatomy)[];
4
+ //# sourceMappingURL=preview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAMvF,eAAO,MAAM,oBAAoB,YACtB,cAAc,CAAC,QAAQ,CAAC,WACxB,YAAY,CAAC,QAAQ,CAAC,QAyDhC,CAAC;AAEF,eAAO,MAAM,UAAU,iCAAyB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { AnatomyPartDefinition, AnatomyPresetName, AnatomyTheme } from '@component-anatomy/core';
2
+ /**
3
+ * Configuration for the anatomy addon, set through story parameters:
4
+ *
5
+ * ```ts
6
+ * export const Primary: Story = {
7
+ * parameters: {
8
+ * anatomy: {
9
+ * parts: [
10
+ * { id: 'label', name: 'Label', description: 'The visible text.' },
11
+ * ],
12
+ * },
13
+ * },
14
+ * };
15
+ * ```
16
+ */
17
+ export type AnatomyParameters = {
18
+ /**
19
+ * Part definitions. If omitted, parts are auto-discovered from
20
+ * `data-part` attributes in the rendered story.
21
+ */
22
+ parts?: AnatomyPartDefinition[];
23
+ /** Named visual preset for the canvas overlays. Default: 'default'. */
24
+ preset?: AnatomyPresetName;
25
+ /** Theme token overrides (applied on top of the preset). */
26
+ theme?: AnatomyTheme;
27
+ /** Show the floating name label chip in the canvas. Default: true. */
28
+ overlayLabel?: boolean;
29
+ /** Inflate highlight boxes by N pixels. Default: 0. */
30
+ overlayPadding?: number;
31
+ /**
32
+ * CSS selector to narrow the anatomy root inside the story canvas.
33
+ * Defaults to the whole canvas element.
34
+ */
35
+ root?: string;
36
+ /** Disable the addon for this story. */
37
+ disable?: boolean;
38
+ };
39
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,qBAAqB,EAAE,CAAC;IAChC,uEAAuE;IACvE,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,4DAA4D;IAC5D,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,sEAAsE;IACtE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@component-anatomy/storybook",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Storybook addon — interactive component anatomy panel synced with the story canvas",
5
5
  "license": "MIT",
6
6
  "author": "Julien Déramond",
@@ -57,20 +57,21 @@
57
57
  "@component-anatomy/core": "^0.0.1"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/react": "^18.3.3",
61
- "esbuild": "^0.21.0",
62
- "react": "^18.3.1",
60
+ "@types/react": "^19.2.17",
61
+ "esbuild": "^0.28.1",
62
+ "react": "^19.2.7",
63
63
  "storybook": "^10.0.0",
64
- "typescript": "^5.4.5"
64
+ "typescript": "^7.0.2"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "storybook": ">=9.0.0"
68
68
  },
69
69
  "engines": {
70
- "node": ">=18.0.0"
70
+ "node": ">=22.12.0"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "node build.mjs",
74
- "typecheck": "tsc --noEmit"
74
+ "typecheck": "tsc --noEmit",
75
+ "test": "node build.mjs && node ../../scripts/typecheck-fixture.mjs test/consumer-types.ts"
75
76
  }
76
77
  }