react-source-spotlight 1.0.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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +375 -0
  3. package/bin/cli.js +28 -0
  4. package/dist/Spotlight.d.ts +8 -0
  5. package/dist/Spotlight.d.ts.map +1 -0
  6. package/dist/SpotlightProvider.d.ts +12 -0
  7. package/dist/SpotlightProvider.d.ts.map +1 -0
  8. package/dist/__tests__/setup.d.ts +2 -0
  9. package/dist/__tests__/setup.d.ts.map +1 -0
  10. package/dist/cli/Spotlight.d.ts +8 -0
  11. package/dist/cli/Spotlight.d.ts.map +1 -0
  12. package/dist/cli/SpotlightProvider.d.ts +12 -0
  13. package/dist/cli/SpotlightProvider.d.ts.map +1 -0
  14. package/dist/cli/__tests__/setup.d.ts +2 -0
  15. package/dist/cli/__tests__/setup.d.ts.map +1 -0
  16. package/dist/cli/cli/config.d.ts +3 -0
  17. package/dist/cli/cli/config.d.ts.map +1 -0
  18. package/dist/cli/cli/generator.d.ts +8 -0
  19. package/dist/cli/cli/generator.d.ts.map +1 -0
  20. package/dist/cli/components/CodeModal.d.ts +10 -0
  21. package/dist/cli/components/CodeModal.d.ts.map +1 -0
  22. package/dist/cli/components/DevModeToggle.d.ts +7 -0
  23. package/dist/cli/components/DevModeToggle.d.ts.map +1 -0
  24. package/dist/cli/config.d.ts +3 -0
  25. package/dist/cli/config.d.ts.map +1 -0
  26. package/dist/cli/generator.d.ts +8 -0
  27. package/dist/cli/generator.d.ts.map +1 -0
  28. package/dist/cli/generator.js +128 -0
  29. package/dist/cli/generator.js.map +1 -0
  30. package/dist/cli/hooks/useSourceSpotlight.d.ts +11 -0
  31. package/dist/cli/hooks/useSourceSpotlight.d.ts.map +1 -0
  32. package/dist/cli/index.d.ts +6 -0
  33. package/dist/cli/index.d.ts.map +1 -0
  34. package/dist/cli/types.d.ts +45 -0
  35. package/dist/cli/types.d.ts.map +1 -0
  36. package/dist/components/CodeModal.d.ts +10 -0
  37. package/dist/components/CodeModal.d.ts.map +1 -0
  38. package/dist/components/DevModeToggle.d.ts +7 -0
  39. package/dist/components/DevModeToggle.d.ts.map +1 -0
  40. package/dist/hooks/useSourceSpotlight.d.ts +11 -0
  41. package/dist/hooks/useSourceSpotlight.d.ts.map +1 -0
  42. package/dist/index.d.ts +6 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.esm.js +3295 -0
  45. package/dist/index.esm.js.map +1 -0
  46. package/dist/index.js +3300 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/types.d.ts +45 -0
  49. package/dist/types.d.ts.map +1 -0
  50. package/package.json +73 -0
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var path = require('path');
5
+ var glob = require('glob');
6
+ var chalk = require('chalk');
7
+
8
+ function _interopNamespaceDefault(e) {
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
26
+ var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
27
+
28
+ const DEFAULT_CONFIG = {
29
+ input: './src/components/**/*.{tsx,jsx}',
30
+ output: './public/spotlight-map.json',
31
+ exclude: ['**/*.test.*', '**/*.spec.*', '**/__tests__/**'],
32
+ features: {
33
+ cleanCodeBadge: { threshold: 100 },
34
+ githubLinks: true,
35
+ copyButton: true,
36
+ },
37
+ };
38
+ function loadConfig(configPath) {
39
+ const resolvedPath = path__namespace.resolve(process.cwd(), configPath);
40
+ // Check if config file exists
41
+ if (fs__namespace.existsSync(resolvedPath)) {
42
+ try {
43
+ // Clear require cache to get fresh config
44
+ delete require.cache[require.resolve(resolvedPath)];
45
+ const userConfig = require(resolvedPath);
46
+ // Merge with defaults
47
+ return {
48
+ ...DEFAULT_CONFIG,
49
+ ...userConfig,
50
+ features: {
51
+ ...DEFAULT_CONFIG.features,
52
+ ...userConfig.features,
53
+ },
54
+ };
55
+ }
56
+ catch (error) {
57
+ console.warn(`Warning: Could not load config from ${configPath}, using defaults`);
58
+ return DEFAULT_CONFIG;
59
+ }
60
+ }
61
+ // Return defaults if no config file
62
+ return DEFAULT_CONFIG;
63
+ }
64
+
65
+ async function generateMap(options) {
66
+ console.log(chalk.blue('🔍 React Source Spotlight - Generating source map...\n'));
67
+ // 1. Load configuration
68
+ const config = loadConfig(options.config || 'spotlight.config.js');
69
+ // Override config with CLI options if provided
70
+ const inputPattern = options.input || config.input;
71
+ const outputPath = options.output || config.output;
72
+ console.log(chalk.gray(`Input pattern: ${inputPattern}`));
73
+ console.log(chalk.gray(`Output path: ${outputPath}\n`));
74
+ // 2. Scan for component files
75
+ const files = await glob.glob(inputPattern, {
76
+ ignore: config.exclude || [],
77
+ absolute: false,
78
+ });
79
+ if (files.length === 0) {
80
+ console.warn(chalk.yellow('⚠️ No component files found!'));
81
+ console.log(chalk.gray('Check your input pattern in spotlight.config.js'));
82
+ return;
83
+ }
84
+ console.log(chalk.green(`✓ Found ${files.length} component files\n`));
85
+ // 3. Build source map
86
+ const sourceMap = {};
87
+ let processedCount = 0;
88
+ for (const file of files) {
89
+ try {
90
+ const absolutePath = path__namespace.resolve(process.cwd(), file);
91
+ const content = fs__namespace.readFileSync(absolutePath, 'utf-8');
92
+ const stats = fs__namespace.statSync(absolutePath);
93
+ // Use relative path as key for portability
94
+ const relativePath = path__namespace.relative(process.cwd(), absolutePath);
95
+ sourceMap[relativePath] = {
96
+ code: content,
97
+ lines: content.split('\n').length,
98
+ size: content.length,
99
+ lastModified: stats.mtime,
100
+ };
101
+ processedCount++;
102
+ // Show progress for large projects
103
+ if (processedCount % 10 === 0) {
104
+ console.log(chalk.gray(` Processed ${processedCount}/${files.length} files...`));
105
+ }
106
+ }
107
+ catch (error) {
108
+ console.warn(chalk.yellow(`⚠️ Could not process ${file}:`, error));
109
+ }
110
+ }
111
+ // 4. Ensure output directory exists
112
+ const outputDir = path__namespace.dirname(outputPath);
113
+ if (!fs__namespace.existsSync(outputDir)) {
114
+ fs__namespace.mkdirSync(outputDir, { recursive: true });
115
+ }
116
+ // 5. Write source map to file
117
+ fs__namespace.writeFileSync(outputPath, JSON.stringify(sourceMap, null, 2), 'utf-8');
118
+ // 6. Calculate total size
119
+ const totalSize = Object.values(sourceMap).reduce((sum, data) => sum + data.size, 0);
120
+ const sizeInKB = (totalSize / 1024).toFixed(2);
121
+ console.log(chalk.green('\n✅ Source map generated successfully!'));
122
+ console.log(chalk.gray(` Components: ${processedCount}`));
123
+ console.log(chalk.gray(` Total size: ${sizeInKB} KB`));
124
+ console.log(chalk.gray(` Output: ${outputPath}\n`));
125
+ }
126
+
127
+ exports.generateMap = generateMap;
128
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sources":["../../src/cli/config.ts","../../src/cli/generator.ts"],"sourcesContent":["import * as fs from 'fs';\r\nimport * as path from 'path';\r\nimport { SpotlightConfig } from '../types';\r\n\r\nconst DEFAULT_CONFIG: SpotlightConfig = {\r\n input: './src/components/**/*.{tsx,jsx}',\r\n output: './public/spotlight-map.json',\r\n exclude: ['**/*.test.*', '**/*.spec.*', '**/__tests__/**'],\r\n features: {\r\n cleanCodeBadge: { threshold: 100 },\r\n githubLinks: true,\r\n copyButton: true,\r\n },\r\n};\r\n\r\nexport function loadConfig(configPath: string): SpotlightConfig {\r\n const resolvedPath = path.resolve(process.cwd(), configPath);\r\n\r\n // Check if config file exists\r\n if (fs.existsSync(resolvedPath)) {\r\n try {\r\n // Clear require cache to get fresh config\r\n delete require.cache[require.resolve(resolvedPath)];\r\n const userConfig = require(resolvedPath);\r\n\r\n // Merge with defaults\r\n return {\r\n ...DEFAULT_CONFIG,\r\n ...userConfig,\r\n features: {\r\n ...DEFAULT_CONFIG.features,\r\n ...userConfig.features,\r\n },\r\n };\r\n } catch (error) {\r\n console.warn(\r\n `Warning: Could not load config from ${configPath}, using defaults`\r\n );\r\n return DEFAULT_CONFIG;\r\n }\r\n }\r\n\r\n // Return defaults if no config file\r\n return DEFAULT_CONFIG;\r\n}\r\n","import * as fs from 'fs';\r\nimport * as path from 'path';\r\nimport { glob } from 'glob';\r\nimport chalk from 'chalk';\r\nimport { loadConfig } from './config';\r\nimport { SourceData } from '../types';\r\n\r\ninterface GenerateOptions {\r\n config?: string;\r\n output?: string;\r\n input?: string;\r\n}\r\n\r\nexport async function generateMap(options: GenerateOptions): Promise<void> {\r\n console.log(chalk.blue('🔍 React Source Spotlight - Generating source map...\\n'));\r\n\r\n // 1. Load configuration\r\n const config = loadConfig(options.config || 'spotlight.config.js');\r\n\r\n // Override config with CLI options if provided\r\n const inputPattern = options.input || config.input;\r\n const outputPath = options.output || config.output;\r\n\r\n console.log(chalk.gray(`Input pattern: ${inputPattern}`));\r\n console.log(chalk.gray(`Output path: ${outputPath}\\n`));\r\n\r\n // 2. Scan for component files\r\n const files = await glob(inputPattern, {\r\n ignore: config.exclude || [],\r\n absolute: false,\r\n });\r\n\r\n if (files.length === 0) {\r\n console.warn(chalk.yellow('⚠️ No component files found!'));\r\n console.log(chalk.gray('Check your input pattern in spotlight.config.js'));\r\n return;\r\n }\r\n\r\n console.log(chalk.green(`✓ Found ${files.length} component files\\n`));\r\n\r\n // 3. Build source map\r\n const sourceMap: Record<string, SourceData> = {};\r\n let processedCount = 0;\r\n\r\n for (const file of files) {\r\n try {\r\n const absolutePath = path.resolve(process.cwd(), file);\r\n const content = fs.readFileSync(absolutePath, 'utf-8');\r\n const stats = fs.statSync(absolutePath);\r\n\r\n // Use relative path as key for portability\r\n const relativePath = path.relative(process.cwd(), absolutePath);\r\n\r\n sourceMap[relativePath] = {\r\n code: content,\r\n lines: content.split('\\n').length,\r\n size: content.length,\r\n lastModified: stats.mtime,\r\n };\r\n\r\n processedCount++;\r\n\r\n // Show progress for large projects\r\n if (processedCount % 10 === 0) {\r\n console.log(chalk.gray(` Processed ${processedCount}/${files.length} files...`));\r\n }\r\n } catch (error) {\r\n console.warn(chalk.yellow(`⚠️ Could not process ${file}:`, error));\r\n }\r\n }\r\n\r\n // 4. Ensure output directory exists\r\n const outputDir = path.dirname(outputPath);\r\n if (!fs.existsSync(outputDir)) {\r\n fs.mkdirSync(outputDir, { recursive: true });\r\n }\r\n\r\n // 5. Write source map to file\r\n fs.writeFileSync(outputPath, JSON.stringify(sourceMap, null, 2), 'utf-8');\r\n\r\n // 6. Calculate total size\r\n const totalSize = Object.values(sourceMap).reduce(\r\n (sum, data) => sum + data.size,\r\n 0\r\n );\r\n const sizeInKB = (totalSize / 1024).toFixed(2);\r\n\r\n console.log(chalk.green('\\n✅ Source map generated successfully!'));\r\n console.log(chalk.gray(` Components: ${processedCount}`));\r\n console.log(chalk.gray(` Total size: ${sizeInKB} KB`));\r\n console.log(chalk.gray(` Output: ${outputPath}\\n`));\r\n}\r\n"],"names":["path","fs","glob"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,MAAM,cAAc,GAAoB;AACpC,IAAA,KAAK,EAAE,iCAAiC;AACxC,IAAA,MAAM,EAAE,6BAA6B;AACrC,IAAA,OAAO,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,iBAAiB,CAAC;AAC1D,IAAA,QAAQ,EAAE;AACN,QAAA,cAAc,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE;AAClC,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,UAAU,EAAE,IAAI;AACnB,KAAA;CACJ;AAEK,SAAU,UAAU,CAAC,UAAkB,EAAA;AACzC,IAAA,MAAM,YAAY,GAAGA,eAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC;;A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A,CAAI,CAAC,CAAC;AACzD;;;;"}
@@ -0,0 +1,11 @@
1
+ import { SourceData } from '../types';
2
+ export declare function useSourceSpotlight(): {
3
+ isDevMode: boolean;
4
+ toggleDevMode: () => void;
5
+ enableDevMode: () => void;
6
+ disableDevMode: () => void;
7
+ getSourceCode: (filename: string) => SourceData | undefined;
8
+ sourceMap: Record<string, SourceData>;
9
+ hasSourceMap: boolean;
10
+ };
11
+ //# sourceMappingURL=useSourceSpotlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSourceSpotlight.d.ts","sourceRoot":"","sources":["../../src/hooks/useSourceSpotlight.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,wBAAgB,kBAAkB;;;;;8BAcA,MAAM,KAAG,UAAU,GAAG,SAAS;;;EAKhE"}
@@ -0,0 +1,6 @@
1
+ export { SpotlightProvider } from './SpotlightProvider';
2
+ export { Spotlight } from './Spotlight';
3
+ export { DevModeToggle } from './components/DevModeToggle';
4
+ export { useSourceSpotlight } from './hooks/useSourceSpotlight';
5
+ export type { SpotlightConfig, SpotlightContextType, SourceData, SpotlightProviderProps, SpotlightProps, DevModeToggleProps, } from './types';
6
+ //# 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,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,YAAY,EACR,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,kBAAkB,GACrB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,45 @@
1
+ export interface SourceData {
2
+ code: string;
3
+ lines: number;
4
+ size: number;
5
+ lastModified: Date;
6
+ }
7
+ export interface SpotlightContextType {
8
+ isDevMode: boolean;
9
+ setIsDevMode: (value: boolean) => void;
10
+ sourceMap: Record<string, SourceData>;
11
+ repoUrl?: string;
12
+ theme: 'light' | 'dark';
13
+ }
14
+ export interface SpotlightConfig {
15
+ input: string;
16
+ output: string;
17
+ exclude?: string[];
18
+ repoUrl?: string;
19
+ features?: {
20
+ cleanCodeBadge?: {
21
+ threshold: number;
22
+ };
23
+ githubLinks?: boolean;
24
+ copyButton?: boolean;
25
+ };
26
+ }
27
+ export interface SpotlightProviderProps {
28
+ children: React.ReactNode;
29
+ mapUrl?: string;
30
+ repoUrl?: string;
31
+ theme?: 'light' | 'dark';
32
+ }
33
+ export interface SpotlightProps {
34
+ filename: string;
35
+ children: React.ReactNode;
36
+ }
37
+ export interface DevModeToggleProps {
38
+ position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
39
+ }
40
+ export interface CodeModalProps {
41
+ filename: string;
42
+ sourceData: SourceData;
43
+ onClose: () => void;
44
+ }
45
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE;QACP,cAAc,CAAC,EAAE;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC;QACvC,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,UAAU,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC;CACL;AAED,MAAM,WAAW,sBAAsB;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,cAAc,GAAG,aAAa,CAAC;CACxE;AAED,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SourceData } from '../types';
3
+ interface CodeModalProps {
4
+ filename: string;
5
+ sourceData: SourceData;
6
+ onClose: () => void;
7
+ }
8
+ export declare function CodeModal({ filename, sourceData, onClose }: CodeModalProps): React.JSX.Element | null;
9
+ export {};
10
+ //# sourceMappingURL=CodeModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodeModal.d.ts","sourceRoot":"","sources":["../../src/components/CodeModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,UAAU,cAAc;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,cAAc,4BA0H1E"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface DevModeToggleProps {
3
+ position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
4
+ }
5
+ export declare function DevModeToggle({ position, }: DevModeToggleProps): React.JSX.Element | null;
6
+ export {};
7
+ //# sourceMappingURL=DevModeToggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevModeToggle.d.ts","sourceRoot":"","sources":["../../src/components/DevModeToggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAG1C,UAAU,kBAAkB;IACxB,QAAQ,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,cAAc,GAAG,aAAa,CAAC;CACxE;AAED,wBAAgB,aAAa,CAAC,EAC1B,QAAyB,GAC5B,EAAE,kBAAkB,4BAoBpB"}
@@ -0,0 +1,11 @@
1
+ import { SourceData } from '../types';
2
+ export declare function useSourceSpotlight(): {
3
+ isDevMode: boolean;
4
+ toggleDevMode: () => void;
5
+ enableDevMode: () => void;
6
+ disableDevMode: () => void;
7
+ getSourceCode: (filename: string) => SourceData | undefined;
8
+ sourceMap: Record<string, SourceData>;
9
+ hasSourceMap: boolean;
10
+ };
11
+ //# sourceMappingURL=useSourceSpotlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSourceSpotlight.d.ts","sourceRoot":"","sources":["../../src/hooks/useSourceSpotlight.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,wBAAgB,kBAAkB;;;;;8BAcA,MAAM,KAAG,UAAU,GAAG,SAAS;;;EAKhE"}
@@ -0,0 +1,6 @@
1
+ export { SpotlightProvider } from './SpotlightProvider';
2
+ export { Spotlight } from './Spotlight';
3
+ export { DevModeToggle } from './components/DevModeToggle';
4
+ export { useSourceSpotlight } from './hooks/useSourceSpotlight';
5
+ export type { SpotlightConfig, SpotlightContextType, SourceData, SpotlightProviderProps, SpotlightProps, DevModeToggleProps, } from './types';
6
+ //# 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,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,YAAY,EACR,eAAe,EACf,oBAAoB,EACpB,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,kBAAkB,GACrB,MAAM,SAAS,CAAC"}