@lijinmei-810/dev-inspector 0.1.2 → 0.2.1

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/index.d.cts CHANGED
@@ -1,10 +1,16 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
 
4
- declare function InspectorPanel({ targetEl, tokenMap, onTokenMapUpdate, onClose, }: {
4
+ declare global {
5
+ interface Window {
6
+ __DEV_INSPECTOR_LAST_PROMPT__?: string;
7
+ }
8
+ }
9
+ declare function InspectorPanel({ targetEl, tokenMap, onTokenMapUpdate, onTargetChange, onClose, }: {
5
10
  targetEl: Element;
6
11
  tokenMap: Record<string, string>;
7
12
  onTokenMapUpdate: (updates: Record<string, string>) => void;
13
+ onTargetChange: (el: Element) => void;
8
14
  onClose: () => void;
9
15
  }): react_jsx_runtime.JSX.Element;
10
16
  declare function DevInspector(): react_jsx_runtime.JSX.Element;
@@ -18,6 +24,28 @@ type PaletteGroup = {
18
24
  group: string;
19
25
  colors: PaletteColor[];
20
26
  };
27
+ type DevInspectorComponentPreviewCategory = 'action' | 'display' | 'feedback' | 'container' | 'form' | 'icon' | 'custom';
28
+ type DevInspectorComponentPreviewVariant = {
29
+ id: string;
30
+ label: string;
31
+ group?: string;
32
+ propsLabel?: string;
33
+ selector?: string;
34
+ usage?: string;
35
+ capabilities?: string[];
36
+ tokenRefs?: string[];
37
+ status?: string;
38
+ render: () => ReactNode;
39
+ };
40
+ type DevInspectorComponentPreview = {
41
+ type: string;
42
+ label: string;
43
+ category?: DevInspectorComponentPreviewCategory;
44
+ summary?: string;
45
+ selector?: string;
46
+ status?: string;
47
+ variants: DevInspectorComponentPreviewVariant[];
48
+ };
21
49
  type ShadowToken = {
22
50
  cssVar: string;
23
51
  value: string;
@@ -35,6 +63,19 @@ type TypographyToken = {
35
63
  color: string;
36
64
  usage: string;
37
65
  };
66
+ type InspectorTypographyLevel = {
67
+ fontSize: string;
68
+ fontWeight: string;
69
+ lineHeight: string;
70
+ color: string;
71
+ };
72
+ type InspectorTypographyTokens = {
73
+ title: InspectorTypographyLevel;
74
+ sectionLabel: InspectorTypographyLevel;
75
+ body: InspectorTypographyLevel;
76
+ meta: InspectorTypographyLevel;
77
+ tinyBadge: InspectorTypographyLevel;
78
+ };
38
79
  type RadiusPreset = {
39
80
  label: string;
40
81
  sub: string;
@@ -89,6 +130,7 @@ type DevInspectorEndpoints = {
89
130
  type DevInspectorTokenConfig = {
90
131
  colorPalette: PaletteGroup[];
91
132
  tokenLabels: Record<string, string>;
133
+ inspectorTypography: InspectorTypographyTokens;
92
134
  radiusPresets: RadiusPreset[];
93
135
  spaceSteps: SpaceStep[];
94
136
  borderWidthSteps: string[];
@@ -104,6 +146,7 @@ type DevInspectorConfig = {
104
146
  rootId: string;
105
147
  endpoints: DevInspectorEndpoints;
106
148
  tokens: DevInspectorTokenConfig;
149
+ componentPreviews: DevInspectorComponentPreview[];
107
150
  };
108
151
  type DevInspectorConfigOverrides = Omit<Partial<DevInspectorConfig>, 'endpoints' | 'tokens'> & {
109
152
  endpoints?: Partial<DevInspectorEndpoints>;
@@ -123,4 +166,4 @@ declare function useDevInspectorConfig(): DevInspectorConfig;
123
166
 
124
167
  declare function mountDevInspector(config?: DevInspectorConfigOverrides): HTMLElement;
125
168
 
126
- export { type BorderStyleOption, type ContainerStyleOption, DevInspector, type DevInspectorConfig, type DevInspectorConfigOverrides, type DevInspectorEndpoints, DevInspectorProvider, type DevInspectorTokenConfig, type FontSizeOption, InspectorPanel, type TypographyStyleOption, type TypographyToken, defaultDevInspectorConfig, mergeDevInspectorConfig, mountDevInspector, useDevInspectorConfig };
169
+ export { type BorderStyleOption, type ContainerStyleOption, DevInspector, type DevInspectorComponentPreview, type DevInspectorComponentPreviewCategory, type DevInspectorComponentPreviewVariant, type DevInspectorConfig, type DevInspectorConfigOverrides, type DevInspectorEndpoints, DevInspectorProvider, type DevInspectorTokenConfig, type FontSizeOption, InspectorPanel, type TypographyStyleOption, type TypographyToken, defaultDevInspectorConfig, mergeDevInspectorConfig, mountDevInspector, useDevInspectorConfig };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,16 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
3
 
4
- declare function InspectorPanel({ targetEl, tokenMap, onTokenMapUpdate, onClose, }: {
4
+ declare global {
5
+ interface Window {
6
+ __DEV_INSPECTOR_LAST_PROMPT__?: string;
7
+ }
8
+ }
9
+ declare function InspectorPanel({ targetEl, tokenMap, onTokenMapUpdate, onTargetChange, onClose, }: {
5
10
  targetEl: Element;
6
11
  tokenMap: Record<string, string>;
7
12
  onTokenMapUpdate: (updates: Record<string, string>) => void;
13
+ onTargetChange: (el: Element) => void;
8
14
  onClose: () => void;
9
15
  }): react_jsx_runtime.JSX.Element;
10
16
  declare function DevInspector(): react_jsx_runtime.JSX.Element;
@@ -18,6 +24,28 @@ type PaletteGroup = {
18
24
  group: string;
19
25
  colors: PaletteColor[];
20
26
  };
27
+ type DevInspectorComponentPreviewCategory = 'action' | 'display' | 'feedback' | 'container' | 'form' | 'icon' | 'custom';
28
+ type DevInspectorComponentPreviewVariant = {
29
+ id: string;
30
+ label: string;
31
+ group?: string;
32
+ propsLabel?: string;
33
+ selector?: string;
34
+ usage?: string;
35
+ capabilities?: string[];
36
+ tokenRefs?: string[];
37
+ status?: string;
38
+ render: () => ReactNode;
39
+ };
40
+ type DevInspectorComponentPreview = {
41
+ type: string;
42
+ label: string;
43
+ category?: DevInspectorComponentPreviewCategory;
44
+ summary?: string;
45
+ selector?: string;
46
+ status?: string;
47
+ variants: DevInspectorComponentPreviewVariant[];
48
+ };
21
49
  type ShadowToken = {
22
50
  cssVar: string;
23
51
  value: string;
@@ -35,6 +63,19 @@ type TypographyToken = {
35
63
  color: string;
36
64
  usage: string;
37
65
  };
66
+ type InspectorTypographyLevel = {
67
+ fontSize: string;
68
+ fontWeight: string;
69
+ lineHeight: string;
70
+ color: string;
71
+ };
72
+ type InspectorTypographyTokens = {
73
+ title: InspectorTypographyLevel;
74
+ sectionLabel: InspectorTypographyLevel;
75
+ body: InspectorTypographyLevel;
76
+ meta: InspectorTypographyLevel;
77
+ tinyBadge: InspectorTypographyLevel;
78
+ };
38
79
  type RadiusPreset = {
39
80
  label: string;
40
81
  sub: string;
@@ -89,6 +130,7 @@ type DevInspectorEndpoints = {
89
130
  type DevInspectorTokenConfig = {
90
131
  colorPalette: PaletteGroup[];
91
132
  tokenLabels: Record<string, string>;
133
+ inspectorTypography: InspectorTypographyTokens;
92
134
  radiusPresets: RadiusPreset[];
93
135
  spaceSteps: SpaceStep[];
94
136
  borderWidthSteps: string[];
@@ -104,6 +146,7 @@ type DevInspectorConfig = {
104
146
  rootId: string;
105
147
  endpoints: DevInspectorEndpoints;
106
148
  tokens: DevInspectorTokenConfig;
149
+ componentPreviews: DevInspectorComponentPreview[];
107
150
  };
108
151
  type DevInspectorConfigOverrides = Omit<Partial<DevInspectorConfig>, 'endpoints' | 'tokens'> & {
109
152
  endpoints?: Partial<DevInspectorEndpoints>;
@@ -123,4 +166,4 @@ declare function useDevInspectorConfig(): DevInspectorConfig;
123
166
 
124
167
  declare function mountDevInspector(config?: DevInspectorConfigOverrides): HTMLElement;
125
168
 
126
- export { type BorderStyleOption, type ContainerStyleOption, DevInspector, type DevInspectorConfig, type DevInspectorConfigOverrides, type DevInspectorEndpoints, DevInspectorProvider, type DevInspectorTokenConfig, type FontSizeOption, InspectorPanel, type TypographyStyleOption, type TypographyToken, defaultDevInspectorConfig, mergeDevInspectorConfig, mountDevInspector, useDevInspectorConfig };
169
+ export { type BorderStyleOption, type ContainerStyleOption, DevInspector, type DevInspectorComponentPreview, type DevInspectorComponentPreviewCategory, type DevInspectorComponentPreviewVariant, type DevInspectorConfig, type DevInspectorConfigOverrides, type DevInspectorEndpoints, DevInspectorProvider, type DevInspectorTokenConfig, type FontSizeOption, InspectorPanel, type TypographyStyleOption, type TypographyToken, defaultDevInspectorConfig, mergeDevInspectorConfig, mountDevInspector, useDevInspectorConfig };