component-previewer 0.1.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/LICENSE +21 -0
- package/README.md +126 -0
- package/lib/module/PreviewControls.js +177 -0
- package/lib/module/PreviewControls.js.map +1 -0
- package/lib/module/PreviewList.js +99 -0
- package/lib/module/PreviewList.js.map +1 -0
- package/lib/module/PreviewStage.js +82 -0
- package/lib/module/PreviewStage.js.map +1 -0
- package/lib/module/Previewer.js +31 -0
- package/lib/module/Previewer.js.map +1 -0
- package/lib/module/controls.js +112 -0
- package/lib/module/controls.js.map +1 -0
- package/lib/module/csf.js +63 -0
- package/lib/module/csf.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/registry.js +28 -0
- package/lib/module/registry.js.map +1 -0
- package/lib/module/shell.js +18 -0
- package/lib/module/shell.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/PreviewControls.d.ts +8 -0
- package/lib/typescript/src/PreviewControls.d.ts.map +1 -0
- package/lib/typescript/src/PreviewList.d.ts +7 -0
- package/lib/typescript/src/PreviewList.d.ts.map +1 -0
- package/lib/typescript/src/PreviewStage.d.ts +9 -0
- package/lib/typescript/src/PreviewStage.d.ts.map +1 -0
- package/lib/typescript/src/Previewer.d.ts +9 -0
- package/lib/typescript/src/Previewer.d.ts.map +1 -0
- package/lib/typescript/src/controls.d.ts +24 -0
- package/lib/typescript/src/controls.d.ts.map +1 -0
- package/lib/typescript/src/csf.d.ts +3 -0
- package/lib/typescript/src/csf.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/registry.d.ts +8 -0
- package/lib/typescript/src/registry.d.ts.map +1 -0
- package/lib/typescript/src/shell.d.ts +7 -0
- package/lib/typescript/src/shell.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +49 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +88 -0
- package/src/PreviewControls.tsx +128 -0
- package/src/PreviewList.tsx +71 -0
- package/src/PreviewStage.tsx +72 -0
- package/src/Previewer.tsx +28 -0
- package/src/controls.ts +75 -0
- package/src/csf.ts +59 -0
- package/src/index.ts +23 -0
- package/src/registry.ts +21 -0
- package/src/shell.tsx +22 -0
- package/src/types.ts +68 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// A render-ready control descriptor. Pure data — the UI maps these to inputs.
|
|
4
|
+
|
|
5
|
+
// Normalize an ArgType's `control` (string shorthand or { type, ... }) into a
|
|
6
|
+
// kind plus any numeric bounds. Returns kind: undefined when no control given.
|
|
7
|
+
function explicit(argType) {
|
|
8
|
+
const c = argType?.control;
|
|
9
|
+
if (!c) return {};
|
|
10
|
+
if (typeof c === 'string') {
|
|
11
|
+
return {
|
|
12
|
+
kind: c,
|
|
13
|
+
min: argType?.min,
|
|
14
|
+
max: argType?.max,
|
|
15
|
+
step: argType?.step
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
kind: c.type,
|
|
20
|
+
min: c.min ?? argType?.min,
|
|
21
|
+
max: c.max ?? argType?.max,
|
|
22
|
+
step: c.step ?? argType?.step
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function toNumber(value) {
|
|
26
|
+
return typeof value === 'number' ? value : Number(value);
|
|
27
|
+
}
|
|
28
|
+
function toText(value) {
|
|
29
|
+
return typeof value === 'string' ? value : value == null ? '' : String(value);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Build controls for a story's editable args. Explicit `argTypes` win; otherwise
|
|
33
|
+
// the kind is inferred from the runtime value type. `range` becomes a number
|
|
34
|
+
// control with bounds. `select` needs `options`, else it degrades to text.
|
|
35
|
+
// Non-primitive values (function/object/array/null/undefined) with no explicit
|
|
36
|
+
// control are skipped — they pass through to render untouched.
|
|
37
|
+
export function inferControls(args, argTypes = {}) {
|
|
38
|
+
const controls = [];
|
|
39
|
+
for (const name of Object.keys(args)) {
|
|
40
|
+
const value = args[name];
|
|
41
|
+
const {
|
|
42
|
+
kind,
|
|
43
|
+
min,
|
|
44
|
+
max,
|
|
45
|
+
step
|
|
46
|
+
} = explicit(argTypes[name]);
|
|
47
|
+
if (kind === 'select') {
|
|
48
|
+
const options = argTypes[name]?.options;
|
|
49
|
+
if (options && options.length > 0) {
|
|
50
|
+
controls.push({
|
|
51
|
+
name,
|
|
52
|
+
kind: 'select',
|
|
53
|
+
value,
|
|
54
|
+
options
|
|
55
|
+
});
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
// No options to choose from — fall back to a text control.
|
|
59
|
+
controls.push({
|
|
60
|
+
name,
|
|
61
|
+
kind: 'text',
|
|
62
|
+
value: toText(value)
|
|
63
|
+
});
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (kind === 'number' || kind === 'range') {
|
|
67
|
+
controls.push({
|
|
68
|
+
name,
|
|
69
|
+
kind: 'number',
|
|
70
|
+
value: toNumber(value),
|
|
71
|
+
min,
|
|
72
|
+
max,
|
|
73
|
+
step
|
|
74
|
+
});
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (kind === 'boolean') {
|
|
78
|
+
controls.push({
|
|
79
|
+
name,
|
|
80
|
+
kind: 'boolean',
|
|
81
|
+
value: Boolean(value)
|
|
82
|
+
});
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (kind === 'text') {
|
|
86
|
+
controls.push({
|
|
87
|
+
name,
|
|
88
|
+
kind: 'text',
|
|
89
|
+
value: toText(value)
|
|
90
|
+
});
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// No explicit control — infer from the value type.
|
|
95
|
+
if (typeof value === 'string') controls.push({
|
|
96
|
+
name,
|
|
97
|
+
kind: 'text',
|
|
98
|
+
value
|
|
99
|
+
});else if (typeof value === 'number') controls.push({
|
|
100
|
+
name,
|
|
101
|
+
kind: 'number',
|
|
102
|
+
value
|
|
103
|
+
});else if (typeof value === 'boolean') controls.push({
|
|
104
|
+
name,
|
|
105
|
+
kind: 'boolean',
|
|
106
|
+
value
|
|
107
|
+
});
|
|
108
|
+
// else: skipped (function/object/array/null/undefined).
|
|
109
|
+
}
|
|
110
|
+
return controls;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=controls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["explicit","argType","c","control","kind","min","max","step","type","toNumber","value","Number","toText","String","inferControls","args","argTypes","controls","name","Object","keys","options","length","push","Boolean"],"sourceRoot":"../../src","sources":["controls.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createElement } from 'react';
|
|
4
|
+
const RESERVED = new Set(['default', '__esModule']);
|
|
5
|
+
function slug(s) {
|
|
6
|
+
return s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
7
|
+
}
|
|
8
|
+
function deriveTitle(meta, id) {
|
|
9
|
+
if (meta?.title) return meta.title;
|
|
10
|
+
const c = meta?.component;
|
|
11
|
+
if (c?.displayName) return c.displayName;
|
|
12
|
+
if (c?.name) return c.name;
|
|
13
|
+
return id.replace(/^.*\//, '').replace(/\.stories\.[jt]sx?$/, '');
|
|
14
|
+
}
|
|
15
|
+
function normalizeStory(raw) {
|
|
16
|
+
if (typeof raw === 'function') return {
|
|
17
|
+
render: raw
|
|
18
|
+
};
|
|
19
|
+
if (raw && typeof raw === 'object') return raw;
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Parse one CSF module into normalized story entries. Pure: no rendering, no
|
|
24
|
+
// host libraries. This is the heart of the surface-agnostic core.
|
|
25
|
+
export function parseCsfModule(id, mod) {
|
|
26
|
+
const meta = mod.default;
|
|
27
|
+
const title = deriveTitle(meta, id);
|
|
28
|
+
const entries = [];
|
|
29
|
+
for (const exportName of Object.keys(mod)) {
|
|
30
|
+
if (RESERVED.has(exportName)) continue;
|
|
31
|
+
const story = normalizeStory(mod[exportName]);
|
|
32
|
+
if (!story) continue;
|
|
33
|
+
const args = {
|
|
34
|
+
...(meta?.args ?? {}),
|
|
35
|
+
...(story.args ?? {})
|
|
36
|
+
};
|
|
37
|
+
// argTypes merge with the same precedence as args (story wins over meta).
|
|
38
|
+
const argTypes = {
|
|
39
|
+
...(meta?.argTypes ?? {}),
|
|
40
|
+
...(story.argTypes ?? {})
|
|
41
|
+
};
|
|
42
|
+
// Story decorators wrap innermost, meta decorators outer (Storybook order).
|
|
43
|
+
const decorators = [...(story.decorators ?? []), ...(meta?.decorators ?? [])];
|
|
44
|
+
const name = story.name ?? exportName;
|
|
45
|
+
const render = story.render ?? (a => {
|
|
46
|
+
if (!meta?.component) {
|
|
47
|
+
throw new Error(`Story "${exportName}" in ${id}: no render fn and meta has no component`);
|
|
48
|
+
}
|
|
49
|
+
return /*#__PURE__*/createElement(meta.component, a);
|
|
50
|
+
});
|
|
51
|
+
entries.push({
|
|
52
|
+
id: `${slug(title)}--${slug(name)}`,
|
|
53
|
+
title,
|
|
54
|
+
name,
|
|
55
|
+
args,
|
|
56
|
+
argTypes,
|
|
57
|
+
decorators,
|
|
58
|
+
render
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return entries;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=csf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createElement","RESERVED","Set","slug","s","toLowerCase","replace","deriveTitle","meta","id","title","c","component","displayName","name","normalizeStory","raw","render","parseCsfModule","mod","default","entries","exportName","Object","keys","has","story","args","argTypes","decorators","a","Error","push"],"sourceRoot":"../../src","sources":["csf.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Surface-agnostic core
|
|
4
|
+
export { parseCsfModule } from "./csf.js";
|
|
5
|
+
export { buildRegistry, fromRequireContext, fromGlob } from "./registry.js";
|
|
6
|
+
export { composeStory } from "./shell.js";
|
|
7
|
+
export { inferControls } from "./controls.js";
|
|
8
|
+
// UI (reused by backends)
|
|
9
|
+
export { Previewer } from "./Previewer.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["parseCsfModule","buildRegistry","fromRequireContext","fromGlob","composeStory","inferControls","Previewer"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA,SAASA,cAAc,QAAQ,UAAO;AACtC,SAASC,aAAa,EAAEC,kBAAkB,EAAEC,QAAQ,QAAQ,eAAY;AACxE,SAASC,YAAY,QAAQ,YAAS;AAEtC,SAASC,aAAa,QAAQ,eAAY;AAgB1C;AACA,SAASC,SAAS,QAAQ,gBAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { parseCsfModule } from "./csf.js";
|
|
4
|
+
// Build a sorted, flattened registry from already-loaded story modules.
|
|
5
|
+
export function buildRegistry(modules) {
|
|
6
|
+
return modules.slice().sort((a, b) => a.id.localeCompare(b.id)).flatMap(({
|
|
7
|
+
id,
|
|
8
|
+
module
|
|
9
|
+
}) => parseCsfModule(id, module));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Discovery adapter — Metro's require.context (native + web/Metro).
|
|
13
|
+
export function fromRequireContext(ctx) {
|
|
14
|
+
return buildRegistry(ctx.keys().map(id => ({
|
|
15
|
+
id,
|
|
16
|
+
module: ctx(id)
|
|
17
|
+
})));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Discovery adapter — Vite's eager import.meta.glob (web/Vite backend).
|
|
21
|
+
// Pass `import.meta.glob('...', { eager: true })`.
|
|
22
|
+
export function fromGlob(glob) {
|
|
23
|
+
return buildRegistry(Object.entries(glob).map(([id, module]) => ({
|
|
24
|
+
id,
|
|
25
|
+
module
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["parseCsfModule","buildRegistry","modules","slice","sort","a","b","id","localeCompare","flatMap","module","fromRequireContext","ctx","keys","map","fromGlob","glob","Object","entries"],"sourceRoot":"../../src","sources":["registry.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,UAAO;AAGtC;AACA,OAAO,SAASC,aAAaA,CAACC,OAAiD,EAAgB;EAC7F,OAAOA,OAAO,CACXC,KAAK,CAAC,CAAC,CACPC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,EAAE,CAACC,aAAa,CAACF,CAAC,CAACC,EAAE,CAAC,CAAC,CACxCE,OAAO,CAAC,CAAC;IAAEF,EAAE;IAAEG;EAAO,CAAC,KAAKV,cAAc,CAACO,EAAE,EAAEG,MAAM,CAAC,CAAC;AAC5D;;AAEA;AACA,OAAO,SAASC,kBAAkBA,CAACC,GAAmB,EAAgB;EACpE,OAAOX,aAAa,CAACW,GAAG,CAACC,IAAI,CAAC,CAAC,CAACC,GAAG,CAAEP,EAAE,KAAM;IAAEA,EAAE;IAAEG,MAAM,EAAEE,GAAG,CAACL,EAAE;EAAe,CAAC,CAAC,CAAC,CAAC;AACtF;;AAEA;AACA;AACA,OAAO,SAASQ,QAAQA,CAACC,IAAiB,EAAgB;EACxD,OAAOf,aAAa,CAACgB,MAAM,CAACC,OAAO,CAACF,IAAI,CAAC,CAACF,GAAG,CAAC,CAAC,CAACP,EAAE,EAAEG,MAAM,CAAC,MAAM;IAAEH,EAAE;IAAEG;EAAO,CAAC,CAAC,CAAC,CAAC;AACpF","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createElement } from 'react';
|
|
4
|
+
// Compose the full element for a story:
|
|
5
|
+
// AppShell (outer, single source of truth) > decorators > story.render(args).
|
|
6
|
+
// The real-shell contract: the host's AppShell ALWAYS wraps outside; CSF
|
|
7
|
+
// decorators run inside it. Pure — returns an element tree, does not mount.
|
|
8
|
+
// `args` defaults to the story's declared args; pass an override for live edits.
|
|
9
|
+
export function composeStory(entry, Shell, args = entry.args) {
|
|
10
|
+
let node = entry.render(args);
|
|
11
|
+
for (const decorate of entry.decorators) {
|
|
12
|
+
const inner = node;
|
|
13
|
+
const Story = () => inner;
|
|
14
|
+
node = decorate(Story);
|
|
15
|
+
}
|
|
16
|
+
return Shell ? /*#__PURE__*/createElement(Shell, null, node) : node;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createElement","composeStory","entry","Shell","args","node","render","decorate","decorators","inner","Story"],"sourceRoot":"../../src","sources":["shell.tsx"],"mappings":";;AAAA,SAASA,aAAa,QAAQ,OAAO;AAMrC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,KAAiB,EAAEC,KAAsB,EAAEC,IAAU,GAAGF,KAAK,CAACE,IAAI,EAAgB;EAC7G,IAAIC,IAAkB,GAAGH,KAAK,CAACI,MAAM,CAACF,IAAI,CAAC;EAE3C,KAAK,MAAMG,QAAQ,IAAIL,KAAK,CAACM,UAAU,EAAE;IACvC,MAAMC,KAAK,GAAGJ,IAAI;IAClB,MAAMK,KAAoB,GAAGA,CAAA,KAAMD,KAAK;IACxCJ,IAAI,GAAGE,QAAQ,CAACG,KAAK,CAAC;EACxB;EAEA,OAAOP,KAAK,gBAAGH,aAAa,CAACG,KAAK,EAAE,IAAI,EAAEE,IAAI,CAAC,GAAGA,IAAI;AACxD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Control } from './controls.js';
|
|
3
|
+
export declare function PreviewControls({ controls, onChange, onReset, }: {
|
|
4
|
+
controls: Control[];
|
|
5
|
+
onChange: (name: string, value: unknown) => void;
|
|
6
|
+
onReset: () => void;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
//# sourceMappingURL=PreviewControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewControls.d.ts","sourceRoot":"","sources":["../../../src/PreviewControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAY,CAAC;AAI1C,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,qBAqBA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StoryEntry } from './types.js';
|
|
3
|
+
export declare function PreviewList({ entries, onSelect, }: {
|
|
4
|
+
entries: StoryEntry[];
|
|
5
|
+
onSelect: (entry: StoryEntry) => void;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
//# sourceMappingURL=PreviewList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewList.d.ts","sourceRoot":"","sources":["../../../src/PreviewList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAI1C,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,QAAQ,GACT,EAAE;IACD,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CACvC,qBAwCA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ShellComponent } from './shell.js';
|
|
3
|
+
import type { StoryEntry } from './types.js';
|
|
4
|
+
export declare function PreviewStage({ entry, shell, onBack, }: {
|
|
5
|
+
entry: StoryEntry;
|
|
6
|
+
shell?: ShellComponent;
|
|
7
|
+
onBack: () => void;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=PreviewStage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewStage.d.ts","sourceRoot":"","sources":["../../../src/PreviewStage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAIjD,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,YAAS,CAAC;AAC5D,OAAO,KAAK,EAAQ,UAAU,EAAE,MAAM,YAAS,CAAC;AAKhD,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,qBA6BA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ShellComponent } from './shell.js';
|
|
3
|
+
import type { StoryEntry } from './types.js';
|
|
4
|
+
export declare function Previewer({ stories, shell, initialStoryId, }: {
|
|
5
|
+
stories: StoryEntry[];
|
|
6
|
+
shell?: ShellComponent;
|
|
7
|
+
initialStoryId?: string;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
//# sourceMappingURL=Previewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Previewer.d.ts","sourceRoot":"","sources":["../../../src/Previewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAM1C,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,KAAK,EACL,cAAc,GACf,EAAE;IACD,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,qBASA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Args, ArgTypes } from './types.js';
|
|
2
|
+
export type Control = {
|
|
3
|
+
name: string;
|
|
4
|
+
kind: 'text';
|
|
5
|
+
value: string;
|
|
6
|
+
} | {
|
|
7
|
+
name: string;
|
|
8
|
+
kind: 'boolean';
|
|
9
|
+
value: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
name: string;
|
|
12
|
+
kind: 'number';
|
|
13
|
+
value: number;
|
|
14
|
+
min?: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
step?: number;
|
|
17
|
+
} | {
|
|
18
|
+
name: string;
|
|
19
|
+
kind: 'select';
|
|
20
|
+
value: unknown;
|
|
21
|
+
options: unknown[];
|
|
22
|
+
};
|
|
23
|
+
export declare function inferControls(args: Args, argTypes?: ArgTypes): Control[];
|
|
24
|
+
//# sourceMappingURL=controls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../../../src/controls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAW,QAAQ,EAAe,MAAM,YAAS,CAAC;AAGpE,MAAM,MAAM,OAAO,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1F;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC;AA4BzE,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,GAAE,QAAa,GAAG,OAAO,EAAE,CAuC5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csf.d.ts","sourceRoot":"","sources":["../../../src/csf.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,SAAS,EAAe,UAAU,EAAE,MAAM,YAAS,CAAC;AA2BlF,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,UAAU,EAAE,CA8BvE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { parseCsfModule } from './csf.js';
|
|
2
|
+
export { buildRegistry, fromRequireContext, fromGlob } from './registry.js';
|
|
3
|
+
export { composeStory } from './shell.js';
|
|
4
|
+
export type { ShellComponent } from './shell.js';
|
|
5
|
+
export { inferControls } from './controls.js';
|
|
6
|
+
export type { Control } from './controls.js';
|
|
7
|
+
export type { Args, ArgType, ArgTypes, ControlKind, CsfModule, Decorator, GlobModules, Meta, RequireContext, Story, StoryEntry, } from './types.js';
|
|
8
|
+
export { Previewer } from './Previewer.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAO,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAS,CAAC;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,YAAS,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAY,CAAC;AAC3C,YAAY,EAAE,OAAO,EAAE,MAAM,eAAY,CAAC;AAC1C,YAAY,EACV,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,IAAI,EACJ,cAAc,EACd,KAAK,EACL,UAAU,GACX,MAAM,YAAS,CAAC;AAGjB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAa,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CsfModule, GlobModules, RequireContext, StoryEntry } from './types.js';
|
|
2
|
+
export declare function buildRegistry(modules: Array<{
|
|
3
|
+
id: string;
|
|
4
|
+
module: CsfModule;
|
|
5
|
+
}>): StoryEntry[];
|
|
6
|
+
export declare function fromRequireContext(ctx: RequireContext): StoryEntry[];
|
|
7
|
+
export declare function fromGlob(glob: GlobModules): StoryEntry[];
|
|
8
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAGlF,wBAAgB,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC,GAAG,UAAU,EAAE,CAK7F;AAGD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,UAAU,EAAE,CAEpE;AAID,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE,CAExD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentType, ReactElement } from 'react';
|
|
2
|
+
import type { Args, StoryEntry } from './types.js';
|
|
3
|
+
export type ShellComponent = ComponentType<{
|
|
4
|
+
children: ReactElement;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function composeStory(entry: StoryEntry, Shell?: ShellComponent, args?: Args): ReactElement;
|
|
7
|
+
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/shell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,YAAS,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC;IAAE,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC;AAOvE,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,cAAc,EAAE,IAAI,GAAE,IAAiB,GAAG,YAAY,CAU7G"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ComponentType, ReactElement } from 'react';
|
|
2
|
+
export type Args = Record<string, unknown>;
|
|
3
|
+
export type Decorator = (Story: ComponentType) => ReactElement;
|
|
4
|
+
export type ControlKind = 'text' | 'number' | 'boolean' | 'select' | 'range';
|
|
5
|
+
export type ArgType = {
|
|
6
|
+
control?: ControlKind | {
|
|
7
|
+
type: ControlKind;
|
|
8
|
+
min?: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
step?: number;
|
|
11
|
+
};
|
|
12
|
+
options?: unknown[];
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
step?: number;
|
|
16
|
+
};
|
|
17
|
+
export type ArgTypes = Record<string, ArgType>;
|
|
18
|
+
export type Meta = {
|
|
19
|
+
title?: string;
|
|
20
|
+
component?: ComponentType<any>;
|
|
21
|
+
args?: Args;
|
|
22
|
+
argTypes?: ArgTypes;
|
|
23
|
+
decorators?: Decorator[];
|
|
24
|
+
};
|
|
25
|
+
export type Story = {
|
|
26
|
+
name?: string;
|
|
27
|
+
args?: Args;
|
|
28
|
+
argTypes?: ArgTypes;
|
|
29
|
+
decorators?: Decorator[];
|
|
30
|
+
render?: (args: Args) => ReactElement;
|
|
31
|
+
} | ((args: Args) => ReactElement);
|
|
32
|
+
export type CsfModule = {
|
|
33
|
+
default?: Meta;
|
|
34
|
+
} & Record<string, unknown>;
|
|
35
|
+
export type StoryEntry = {
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
name: string;
|
|
39
|
+
args: Args;
|
|
40
|
+
argTypes: ArgTypes;
|
|
41
|
+
decorators: Decorator[];
|
|
42
|
+
render: (args: Args) => ReactElement;
|
|
43
|
+
};
|
|
44
|
+
export type RequireContext = {
|
|
45
|
+
keys(): string[];
|
|
46
|
+
(id: string): unknown;
|
|
47
|
+
};
|
|
48
|
+
export type GlobModules = Record<string, CsfModule>;
|
|
49
|
+
//# 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,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIzD,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAI3C,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,aAAa,KAAK,YAAY,CAAC;AAI/D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7E,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,CAAC,EAAE,WAAW,GAAG;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzF,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAG/C,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,SAAS,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC1B,CAAC;AAGF,MAAM,MAAM,KAAK,GACb;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,YAAY,CAAC;CACvC,GACD,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,YAAY,CAAC,CAAC;AAGnC,MAAM,MAAM,SAAS,GAAG;IAAE,OAAO,CAAC,EAAE,IAAI,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAIrE,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,YAAY,CAAC;CACtC,CAAC;AAKF,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,IAAI,MAAM,EAAE,CAAC;IAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC;AAGzE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "component-previewer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Render a single React Native component instantly in its app's real provider shell, without booting the app.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"packageManager": "pnpm@11.5.3",
|
|
7
|
+
"author": "Edmond Ndanji <ndanjiedmond@gmail.com>",
|
|
8
|
+
"homepage": "https://github.com/2bTwist/component-previewer#readme",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/2bTwist/component-previewer.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/2bTwist/component-previewer/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"react-native",
|
|
18
|
+
"expo",
|
|
19
|
+
"storybook",
|
|
20
|
+
"csf",
|
|
21
|
+
"component",
|
|
22
|
+
"preview",
|
|
23
|
+
"previewer",
|
|
24
|
+
"react-native-web",
|
|
25
|
+
"ios",
|
|
26
|
+
"devtools"
|
|
27
|
+
],
|
|
28
|
+
"workspaces": [
|
|
29
|
+
"example"
|
|
30
|
+
],
|
|
31
|
+
"source": "./src/index.ts",
|
|
32
|
+
"main": "./lib/module/index.js",
|
|
33
|
+
"module": "./lib/module/index.js",
|
|
34
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
35
|
+
"react-native": "./src/index.ts",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"source": "./src/index.ts",
|
|
39
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
40
|
+
"default": "./lib/module/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./package.json": "./package.json"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"src",
|
|
46
|
+
"lib"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "bob build",
|
|
50
|
+
"lint": "eslint src __tests__",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:watch": "vitest",
|
|
54
|
+
"prepare": "bob build"
|
|
55
|
+
},
|
|
56
|
+
"react-native-builder-bob": {
|
|
57
|
+
"source": "src",
|
|
58
|
+
"output": "lib",
|
|
59
|
+
"targets": [
|
|
60
|
+
[
|
|
61
|
+
"module",
|
|
62
|
+
{
|
|
63
|
+
"esm": true
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
"typescript",
|
|
68
|
+
{
|
|
69
|
+
"project": "tsconfig.build.json"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"peerDependencies": {
|
|
75
|
+
"react": "*",
|
|
76
|
+
"react-native": "*"
|
|
77
|
+
},
|
|
78
|
+
"devDependencies": {
|
|
79
|
+
"@types/react": "^19.2.17",
|
|
80
|
+
"eslint": "^10.5.0",
|
|
81
|
+
"react": "^19.2.7",
|
|
82
|
+
"react-native": "^0.86.0",
|
|
83
|
+
"react-native-builder-bob": "^0.42.1",
|
|
84
|
+
"typescript": "^6.0.3",
|
|
85
|
+
"typescript-eslint": "^8.61.0",
|
|
86
|
+
"vitest": "^4.1.8"
|
|
87
|
+
}
|
|
88
|
+
}
|