@dwntgrnd/devlens 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 +318 -0
- package/dist/DevLensDrawer-VWGWB7ZJ.mjs +4569 -0
- package/dist/chunk-LWQVUC3L.mjs +94 -0
- package/dist/index.css +1148 -0
- package/dist/index.d.mts +75 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +5009 -0
- package/dist/index.mjs +25 -0
- package/package.json +59 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/DevLensProvider.tsx
|
|
2
|
+
import { createContext, useMemo } from "react";
|
|
3
|
+
|
|
4
|
+
// src/config/migration-defaults.ts
|
|
5
|
+
var DEFAULT_MIGRATION_MAP = {
|
|
6
|
+
"text-black": {
|
|
7
|
+
replacement: "text-foreground",
|
|
8
|
+
reason: "Use semantic foreground token for theme support",
|
|
9
|
+
confidence: "high"
|
|
10
|
+
},
|
|
11
|
+
"text-white": {
|
|
12
|
+
replacement: "text-background",
|
|
13
|
+
reason: "Use semantic background token for theme support",
|
|
14
|
+
confidence: "high"
|
|
15
|
+
},
|
|
16
|
+
"text-gray-900": {
|
|
17
|
+
replacement: "text-foreground",
|
|
18
|
+
reason: "Use semantic foreground token",
|
|
19
|
+
confidence: "high"
|
|
20
|
+
},
|
|
21
|
+
"text-gray-500": {
|
|
22
|
+
replacement: "text-muted-foreground",
|
|
23
|
+
reason: "Use semantic muted foreground token",
|
|
24
|
+
confidence: "high"
|
|
25
|
+
},
|
|
26
|
+
"bg-white": {
|
|
27
|
+
replacement: "bg-background",
|
|
28
|
+
reason: "Use semantic background token for theme support",
|
|
29
|
+
confidence: "high"
|
|
30
|
+
},
|
|
31
|
+
"bg-gray-100": {
|
|
32
|
+
replacement: "bg-muted",
|
|
33
|
+
reason: "Use semantic muted token",
|
|
34
|
+
confidence: "medium"
|
|
35
|
+
},
|
|
36
|
+
"border-gray-200": {
|
|
37
|
+
replacement: "border-border",
|
|
38
|
+
reason: "Use semantic border token",
|
|
39
|
+
confidence: "high"
|
|
40
|
+
},
|
|
41
|
+
"border-gray-300": {
|
|
42
|
+
replacement: "border-input",
|
|
43
|
+
reason: "Use semantic input border token",
|
|
44
|
+
confidence: "medium"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/config/defaults.ts
|
|
49
|
+
var DEFAULT_CONFIG = {
|
|
50
|
+
tokenOverrides: {},
|
|
51
|
+
tokenGroups: [],
|
|
52
|
+
scaleBaseline: { mapping: [] },
|
|
53
|
+
migrationMap: DEFAULT_MIGRATION_MAP,
|
|
54
|
+
projectTextSizeClasses: [],
|
|
55
|
+
namespace: "devlens",
|
|
56
|
+
detachedRoute: "/dev/devlens-detached",
|
|
57
|
+
previewFontFamily: "inherit"
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/DevLensProvider.tsx
|
|
61
|
+
import { jsx } from "react/jsx-runtime";
|
|
62
|
+
var DevLensContext = createContext(DEFAULT_CONFIG);
|
|
63
|
+
function DevLensProvider({ children, ...config }) {
|
|
64
|
+
const value = useMemo(
|
|
65
|
+
() => ({
|
|
66
|
+
...DEFAULT_CONFIG,
|
|
67
|
+
...config,
|
|
68
|
+
// Deep merge maps rather than replace
|
|
69
|
+
tokenOverrides: { ...DEFAULT_CONFIG.tokenOverrides, ...config.tokenOverrides },
|
|
70
|
+
migrationMap: { ...DEFAULT_CONFIG.migrationMap, ...config.migrationMap },
|
|
71
|
+
tokenGroups: [
|
|
72
|
+
...DEFAULT_CONFIG.tokenGroups,
|
|
73
|
+
...config.tokenGroups ?? []
|
|
74
|
+
],
|
|
75
|
+
projectTextSizeClasses: [
|
|
76
|
+
...DEFAULT_CONFIG.projectTextSizeClasses,
|
|
77
|
+
...config.projectTextSizeClasses ?? []
|
|
78
|
+
]
|
|
79
|
+
}),
|
|
80
|
+
[config]
|
|
81
|
+
);
|
|
82
|
+
return /* @__PURE__ */ jsx(DevLensContext.Provider, { value, children });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/hooks/use-devlens-config.ts
|
|
86
|
+
import { useContext } from "react";
|
|
87
|
+
function useDevLensConfig() {
|
|
88
|
+
return useContext(DevLensContext);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
DevLensProvider,
|
|
93
|
+
useDevLensConfig
|
|
94
|
+
};
|