@qwik.dev/devtools 0.0.6 → 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.
Files changed (51) hide show
  1. package/README.md +66 -0
  2. package/dist/plugin/index.cjs +40 -1
  3. package/dist/plugin/index.mjs +40 -1
  4. package/dist/ui/components/DevtoolsButton/DevtoolsButton.qwik.cjs +21 -0
  5. package/dist/ui/components/DevtoolsButton/DevtoolsButton.qwik.mjs +21 -0
  6. package/dist/ui/components/DevtoolsContainer/DevtoolsContainer.qwik.cjs +12 -0
  7. package/dist/ui/components/DevtoolsContainer/DevtoolsContainer.qwik.mjs +12 -0
  8. package/dist/ui/components/DevtoolsPanel/DevtoolsPanel.qwik.cjs +34 -0
  9. package/dist/ui/components/DevtoolsPanel/DevtoolsPanel.qwik.mjs +34 -0
  10. package/dist/ui/components/Tab/Tab.qwik.cjs +17 -0
  11. package/dist/ui/components/Tab/Tab.qwik.mjs +17 -0
  12. package/dist/ui/components/TabContent/TabContent.qwik.cjs +21 -0
  13. package/dist/ui/components/TabContent/TabContent.qwik.mjs +21 -0
  14. package/dist/ui/components/TabTitle/TabTitle.qwik.cjs +11 -0
  15. package/dist/ui/components/TabTitle/TabTitle.qwik.mjs +11 -0
  16. package/dist/ui/devtools.qwik.cjs +87 -415
  17. package/dist/ui/devtools.qwik.mjs +88 -416
  18. package/dist/ui/features/Assets/Assets.qwik.cjs +60 -0
  19. package/dist/ui/features/Assets/Assets.qwik.mjs +60 -0
  20. package/dist/ui/features/Overview/Overview.qwik.cjs +165 -0
  21. package/dist/ui/features/Overview/Overview.qwik.mjs +165 -0
  22. package/dist/ui/features/Packages/Packages.qwik.cjs +95 -0
  23. package/dist/ui/features/Packages/Packages.qwik.mjs +95 -0
  24. package/dist/ui/features/Packages/components/InstallButton/InstallButton.qwik.cjs +36 -0
  25. package/dist/ui/features/Packages/components/InstallButton/InstallButton.qwik.mjs +36 -0
  26. package/dist/ui/features/Routes/Routes.qwik.cjs +65 -0
  27. package/dist/ui/features/Routes/Routes.qwik.mjs +65 -0
  28. package/dist/ui/global.css.qwik.cjs +3 -0
  29. package/dist/ui/global.css.qwik.mjs +4 -0
  30. package/dist/ui/hooks/useDebouncer.qwik.cjs +13 -0
  31. package/dist/ui/hooks/useDebouncer.qwik.mjs +13 -0
  32. package/dist/ui/lib-types/kit/src/types.d.ts +4 -0
  33. package/dist/ui/lib-types/ui/src/components/DevtoolsButton/DevtoolsButton.d.ts +6 -0
  34. package/dist/ui/lib-types/ui/src/components/DevtoolsContainer/DevtoolsContainer.d.ts +1 -0
  35. package/dist/ui/lib-types/ui/src/components/DevtoolsPanel/DevtoolsPanel.d.ts +6 -0
  36. package/dist/ui/lib-types/ui/src/components/Tab/Tab.d.ts +8 -0
  37. package/dist/ui/lib-types/ui/src/components/TabContent/TabContent.d.ts +1 -0
  38. package/dist/ui/lib-types/ui/src/components/TabTitle/TabTitle.d.ts +5 -0
  39. package/dist/ui/lib-types/ui/src/features/Assets/Assets.d.ts +6 -0
  40. package/dist/ui/lib-types/ui/src/features/Components/Components.d.ts +1 -0
  41. package/dist/ui/lib-types/ui/src/features/Overview/Overview.d.ts +6 -0
  42. package/dist/ui/lib-types/ui/src/features/Packages/Packages.d.ts +1 -0
  43. package/dist/ui/lib-types/ui/src/features/Packages/components/InstallButton/InstallButton.d.ts +6 -0
  44. package/dist/ui/lib-types/ui/src/features/Packages/types.d.ts +5 -0
  45. package/dist/ui/lib-types/ui/src/features/Routes/Routes.d.ts +6 -0
  46. package/dist/ui/lib-types/ui/src/hooks/useDebouncer.d.ts +2 -0
  47. package/dist/ui/lib-types/ui/src/index.d.ts +1 -1
  48. package/dist/ui/lib-types/ui/src/types/state.d.ts +10 -0
  49. package/package.json +3 -2
  50. package/dist/ui/devtools.css.qwik.cjs +0 -3
  51. package/dist/ui/devtools.css.qwik.mjs +0 -4
@@ -0,0 +1,60 @@
1
+ import { jsx, jsxs } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$ } from "@qwik.dev/core";
3
+ const Assets = component$(({ state }) => {
4
+ return /* @__PURE__ */ jsx("div", {
5
+ class: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
6
+ children: state.assets?.map((asset) => {
7
+ const isImage = asset.path.match(/\.(jpg|jpeg|png|gif|svg|webp)$/i);
8
+ const fileExt = asset.path.split(".").pop()?.toUpperCase();
9
+ return /* @__PURE__ */ jsxs("div", {
10
+ class: "overflow-hidden rounded-xl border border-white/10 bg-white/[0.03] transition-all duration-200 hover:bg-white/[0.05]",
11
+ children: [
12
+ isImage ? /* @__PURE__ */ jsx("div", {
13
+ class: "aspect-square overflow-hidden bg-black/20",
14
+ children: /* @__PURE__ */ jsx("img", {
15
+ width: 176,
16
+ height: 176,
17
+ src: asset.publicPath,
18
+ alt: asset.path,
19
+ class: "h-full w-full object-cover"
20
+ })
21
+ }) : /* @__PURE__ */ jsx("div", {
22
+ class: "flex aspect-square items-center justify-center bg-black/20",
23
+ children: /* @__PURE__ */ jsx("span", {
24
+ class: "font-mono text-2xl text-zinc-400",
25
+ children: fileExt
26
+ })
27
+ }),
28
+ /* @__PURE__ */ jsxs("div", {
29
+ class: "space-y-2 p-4",
30
+ children: [
31
+ /* @__PURE__ */ jsx("div", {
32
+ class: "truncate text-sm",
33
+ title: asset.path,
34
+ children: asset.path.split("/").pop()
35
+ }),
36
+ /* @__PURE__ */ jsxs("div", {
37
+ class: "flex items-center justify-between text-xs text-zinc-400",
38
+ children: [
39
+ /* @__PURE__ */ jsxs("span", {
40
+ children: [
41
+ (asset.size / 1024).toFixed(2),
42
+ " KB"
43
+ ]
44
+ }),
45
+ /* @__PURE__ */ jsx("span", {
46
+ class: "rounded-full bg-white/5 px-2 py-1",
47
+ children: fileExt
48
+ })
49
+ ]
50
+ })
51
+ ]
52
+ })
53
+ ]
54
+ }, asset.filePath);
55
+ })
56
+ });
57
+ });
58
+ export {
59
+ Assets
60
+ };
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
4
+ const core = require("@qwik.dev/core");
5
+ const hi_qwik = require("../../node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.cjs");
6
+ const lu_qwik = require("../../node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.cjs");
7
+ const Overview = core.component$(({ state }) => {
8
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
9
+ children: [
10
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
11
+ class: "grid grid-cols-1 gap-5 md:grid-cols-3",
12
+ children: [
13
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
14
+ class: "flex items-center gap-5 rounded-xl border border-white/10 bg-white/[0.03] p-5 transition-all duration-200 hover:-translate-y-0.5 hover:bg-white/[0.05]",
15
+ children: [
16
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
17
+ class: "rounded-lg border border-white/10 bg-white/5 p-3.5",
18
+ children: /* @__PURE__ */ jsxRuntime.jsx(lu_qwik.LuFolderTree, {
19
+ class: "h-6 w-6 text-emerald-500"
20
+ })
21
+ }),
22
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
23
+ children: [
24
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
25
+ class: "text-3xl font-semibold",
26
+ children: state.routes?.length
27
+ }),
28
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
29
+ class: "text-sm text-zinc-400",
30
+ children: "pages"
31
+ })
32
+ ]
33
+ })
34
+ ]
35
+ }),
36
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
37
+ class: "flex items-center gap-5 rounded-xl border border-white/10 bg-white/[0.03] p-5 transition-all duration-200 hover:-translate-y-0.5 hover:bg-white/[0.05]",
38
+ children: [
39
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
40
+ class: "rounded-lg border border-white/10 bg-white/5 p-3.5",
41
+ children: /* @__PURE__ */ jsxRuntime.jsx(hi_qwik.HiCubeOutline, {
42
+ class: "h-6 w-6 text-emerald-500"
43
+ })
44
+ }),
45
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
46
+ children: [
47
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
48
+ class: "text-3xl font-semibold",
49
+ children: state.assets.length
50
+ }),
51
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
52
+ class: "text-sm text-zinc-400",
53
+ children: "components"
54
+ })
55
+ ]
56
+ })
57
+ ]
58
+ }),
59
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
60
+ class: "flex items-center gap-5 rounded-xl border border-white/10 bg-white/[0.03] p-5 transition-all duration-200 hover:-translate-y-0.5 hover:bg-white/[0.05]",
61
+ children: [
62
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
63
+ class: "rounded-lg border border-white/10 bg-white/5 p-3.5",
64
+ children: /* @__PURE__ */ jsxRuntime.jsx(hi_qwik.HiPhotoOutline, {
65
+ class: "h-6 w-6 text-emerald-500"
66
+ })
67
+ }),
68
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
69
+ children: [
70
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
71
+ class: "text-3xl font-semibold",
72
+ children: state.assets.length || 0
73
+ }),
74
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
75
+ class: "text-sm text-zinc-400",
76
+ children: "assets"
77
+ })
78
+ ]
79
+ })
80
+ ]
81
+ })
82
+ ]
83
+ }),
84
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
85
+ class: "space-y-4 rounded-xl border border-white/10 bg-white/[0.03] p-5",
86
+ children: [
87
+ /* @__PURE__ */ jsxRuntime.jsx("h3", {
88
+ class: "text-lg font-semibold",
89
+ children: "Installed Packages"
90
+ }),
91
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
92
+ class: "grid grid-cols-1 gap-3 md:grid-cols-2",
93
+ children: state.npmPackages.map(([name, version]) => /* @__PURE__ */ jsxRuntime.jsxs("div", {
94
+ class: "flex items-center justify-between rounded-lg bg-white/5 p-3",
95
+ children: [
96
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
97
+ class: "text-sm",
98
+ children: name
99
+ }),
100
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
101
+ class: "rounded-full border border-white/10 bg-white/5 px-2 py-1 text-xs text-zinc-400",
102
+ children: version
103
+ })
104
+ ]
105
+ }, name))
106
+ })
107
+ ]
108
+ }),
109
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
110
+ class: "space-y-4 rounded-xl border border-white/10 bg-white/[0.03] p-5",
111
+ children: [
112
+ /* @__PURE__ */ jsxRuntime.jsx("h3", {
113
+ class: "text-lg font-semibold",
114
+ children: "Performance"
115
+ }),
116
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
117
+ class: "space-y-3",
118
+ children: [
119
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
120
+ class: "flex justify-between border-b border-white/10 py-2",
121
+ children: [
122
+ /* @__PURE__ */ jsxRuntime.jsx("span", {
123
+ class: "text-zinc-400",
124
+ children: "SSR to full load"
125
+ }),
126
+ /* @__PURE__ */ jsxRuntime.jsx("span", {
127
+ class: "font-medium",
128
+ children: "-"
129
+ })
130
+ ]
131
+ }),
132
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
133
+ class: "flex justify-between border-b border-white/10 py-2",
134
+ children: [
135
+ /* @__PURE__ */ jsxRuntime.jsx("span", {
136
+ class: "text-zinc-400",
137
+ children: "Page load"
138
+ }),
139
+ /* @__PURE__ */ jsxRuntime.jsx("span", {
140
+ class: "font-medium",
141
+ children: "-"
142
+ })
143
+ ]
144
+ }),
145
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
146
+ class: "flex justify-between py-2",
147
+ children: [
148
+ /* @__PURE__ */ jsxRuntime.jsx("span", {
149
+ class: "text-zinc-400",
150
+ children: "Navigation"
151
+ }),
152
+ /* @__PURE__ */ jsxRuntime.jsx("span", {
153
+ class: "font-medium",
154
+ children: "-"
155
+ })
156
+ ]
157
+ })
158
+ ]
159
+ })
160
+ ]
161
+ })
162
+ ]
163
+ });
164
+ });
165
+ exports.Overview = Overview;
@@ -0,0 +1,165 @@
1
+ import { jsxs, Fragment, jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$ } from "@qwik.dev/core";
3
+ import { HiCubeOutline, HiPhotoOutline } from "../../node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.mjs";
4
+ import { LuFolderTree } from "../../node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.mjs";
5
+ const Overview = component$(({ state }) => {
6
+ return /* @__PURE__ */ jsxs(Fragment, {
7
+ children: [
8
+ /* @__PURE__ */ jsxs("div", {
9
+ class: "grid grid-cols-1 gap-5 md:grid-cols-3",
10
+ children: [
11
+ /* @__PURE__ */ jsxs("div", {
12
+ class: "flex items-center gap-5 rounded-xl border border-white/10 bg-white/[0.03] p-5 transition-all duration-200 hover:-translate-y-0.5 hover:bg-white/[0.05]",
13
+ children: [
14
+ /* @__PURE__ */ jsx("div", {
15
+ class: "rounded-lg border border-white/10 bg-white/5 p-3.5",
16
+ children: /* @__PURE__ */ jsx(LuFolderTree, {
17
+ class: "h-6 w-6 text-emerald-500"
18
+ })
19
+ }),
20
+ /* @__PURE__ */ jsxs("div", {
21
+ children: [
22
+ /* @__PURE__ */ jsx("div", {
23
+ class: "text-3xl font-semibold",
24
+ children: state.routes?.length
25
+ }),
26
+ /* @__PURE__ */ jsx("div", {
27
+ class: "text-sm text-zinc-400",
28
+ children: "pages"
29
+ })
30
+ ]
31
+ })
32
+ ]
33
+ }),
34
+ /* @__PURE__ */ jsxs("div", {
35
+ class: "flex items-center gap-5 rounded-xl border border-white/10 bg-white/[0.03] p-5 transition-all duration-200 hover:-translate-y-0.5 hover:bg-white/[0.05]",
36
+ children: [
37
+ /* @__PURE__ */ jsx("div", {
38
+ class: "rounded-lg border border-white/10 bg-white/5 p-3.5",
39
+ children: /* @__PURE__ */ jsx(HiCubeOutline, {
40
+ class: "h-6 w-6 text-emerald-500"
41
+ })
42
+ }),
43
+ /* @__PURE__ */ jsxs("div", {
44
+ children: [
45
+ /* @__PURE__ */ jsx("div", {
46
+ class: "text-3xl font-semibold",
47
+ children: state.assets.length
48
+ }),
49
+ /* @__PURE__ */ jsx("div", {
50
+ class: "text-sm text-zinc-400",
51
+ children: "components"
52
+ })
53
+ ]
54
+ })
55
+ ]
56
+ }),
57
+ /* @__PURE__ */ jsxs("div", {
58
+ class: "flex items-center gap-5 rounded-xl border border-white/10 bg-white/[0.03] p-5 transition-all duration-200 hover:-translate-y-0.5 hover:bg-white/[0.05]",
59
+ children: [
60
+ /* @__PURE__ */ jsx("div", {
61
+ class: "rounded-lg border border-white/10 bg-white/5 p-3.5",
62
+ children: /* @__PURE__ */ jsx(HiPhotoOutline, {
63
+ class: "h-6 w-6 text-emerald-500"
64
+ })
65
+ }),
66
+ /* @__PURE__ */ jsxs("div", {
67
+ children: [
68
+ /* @__PURE__ */ jsx("div", {
69
+ class: "text-3xl font-semibold",
70
+ children: state.assets.length || 0
71
+ }),
72
+ /* @__PURE__ */ jsx("div", {
73
+ class: "text-sm text-zinc-400",
74
+ children: "assets"
75
+ })
76
+ ]
77
+ })
78
+ ]
79
+ })
80
+ ]
81
+ }),
82
+ /* @__PURE__ */ jsxs("div", {
83
+ class: "space-y-4 rounded-xl border border-white/10 bg-white/[0.03] p-5",
84
+ children: [
85
+ /* @__PURE__ */ jsx("h3", {
86
+ class: "text-lg font-semibold",
87
+ children: "Installed Packages"
88
+ }),
89
+ /* @__PURE__ */ jsx("div", {
90
+ class: "grid grid-cols-1 gap-3 md:grid-cols-2",
91
+ children: state.npmPackages.map(([name, version]) => /* @__PURE__ */ jsxs("div", {
92
+ class: "flex items-center justify-between rounded-lg bg-white/5 p-3",
93
+ children: [
94
+ /* @__PURE__ */ jsx("div", {
95
+ class: "text-sm",
96
+ children: name
97
+ }),
98
+ /* @__PURE__ */ jsx("div", {
99
+ class: "rounded-full border border-white/10 bg-white/5 px-2 py-1 text-xs text-zinc-400",
100
+ children: version
101
+ })
102
+ ]
103
+ }, name))
104
+ })
105
+ ]
106
+ }),
107
+ /* @__PURE__ */ jsxs("div", {
108
+ class: "space-y-4 rounded-xl border border-white/10 bg-white/[0.03] p-5",
109
+ children: [
110
+ /* @__PURE__ */ jsx("h3", {
111
+ class: "text-lg font-semibold",
112
+ children: "Performance"
113
+ }),
114
+ /* @__PURE__ */ jsxs("div", {
115
+ class: "space-y-3",
116
+ children: [
117
+ /* @__PURE__ */ jsxs("div", {
118
+ class: "flex justify-between border-b border-white/10 py-2",
119
+ children: [
120
+ /* @__PURE__ */ jsx("span", {
121
+ class: "text-zinc-400",
122
+ children: "SSR to full load"
123
+ }),
124
+ /* @__PURE__ */ jsx("span", {
125
+ class: "font-medium",
126
+ children: "-"
127
+ })
128
+ ]
129
+ }),
130
+ /* @__PURE__ */ jsxs("div", {
131
+ class: "flex justify-between border-b border-white/10 py-2",
132
+ children: [
133
+ /* @__PURE__ */ jsx("span", {
134
+ class: "text-zinc-400",
135
+ children: "Page load"
136
+ }),
137
+ /* @__PURE__ */ jsx("span", {
138
+ class: "font-medium",
139
+ children: "-"
140
+ })
141
+ ]
142
+ }),
143
+ /* @__PURE__ */ jsxs("div", {
144
+ class: "flex justify-between py-2",
145
+ children: [
146
+ /* @__PURE__ */ jsx("span", {
147
+ class: "text-zinc-400",
148
+ children: "Navigation"
149
+ }),
150
+ /* @__PURE__ */ jsx("span", {
151
+ class: "font-medium",
152
+ children: "-"
153
+ })
154
+ ]
155
+ })
156
+ ]
157
+ })
158
+ ]
159
+ })
160
+ ]
161
+ });
162
+ });
163
+ export {
164
+ Overview
165
+ };
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
4
+ const core = require("@qwik.dev/core");
5
+ const useDebouncer = require("../../hooks/useDebouncer.qwik.cjs");
6
+ const InstallButton = require("./components/InstallButton/InstallButton.qwik.cjs");
7
+ const Packages = core.component$(() => {
8
+ const debouncedQuery = core.useSignal("");
9
+ const installingPackage = core.useSignal(null);
10
+ const debounceSearch = useDebouncer.useDebouncer(core.$((value) => {
11
+ debouncedQuery.value = value;
12
+ }), 300);
13
+ const searchResults = core.useResource$(async ({ track }) => {
14
+ const query = track(() => debouncedQuery.value);
15
+ if (!query || query.length < 2) {
16
+ return [];
17
+ }
18
+ const response = await fetch(`https://registry.npmjs.org/-/v1/search?text=${query}`);
19
+ const data = await response.json();
20
+ const packages = data.objects.map((obj) => ({
21
+ name: obj.package.name,
22
+ version: obj.package.version,
23
+ description: obj.package.description || "No description available"
24
+ }));
25
+ return packages;
26
+ });
27
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
28
+ class: "space-y-4",
29
+ children: [
30
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
31
+ class: "relative",
32
+ children: /* @__PURE__ */ jsxRuntime.jsx("input", {
33
+ type: "text",
34
+ onInput$: (_, target) => {
35
+ debounceSearch(target.value);
36
+ },
37
+ placeholder: "Search npm packages...",
38
+ class: "w-full rounded-lg border border-white/10 bg-white/5 px-4 py-2 text-sm text-white placeholder-zinc-500 outline-none focus:border-white/20"
39
+ })
40
+ }),
41
+ /* @__PURE__ */ jsxRuntime.jsx(core.Resource, {
42
+ value: searchResults,
43
+ onPending: () => /* @__PURE__ */ jsxRuntime.jsx("div", {
44
+ class: "absolute right-3 top-1",
45
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", {
46
+ class: "h-5 w-5 animate-spin rounded-full border-2 border-white/10 border-t-white/40"
47
+ })
48
+ }),
49
+ onRejected: (error) => /* @__PURE__ */ jsxRuntime.jsx("div", {
50
+ class: "mt-2 text-xs text-red-400",
51
+ children: error.message || "Failed to fetch packages"
52
+ }),
53
+ onResolved: (packages) => {
54
+ return /* @__PURE__ */ jsxRuntime.jsx("div", {
55
+ class: "grid gap-3 md:grid-cols-2",
56
+ children: packages.map((pkg) => {
57
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
58
+ class: "flex flex-col gap-2 rounded-lg bg-white/5 p-3",
59
+ children: [
60
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
61
+ class: "flex items-center justify-between",
62
+ children: [
63
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
64
+ class: "text-sm",
65
+ children: pkg.name
66
+ }),
67
+ /* @__PURE__ */ jsxRuntime.jsxs("div", {
68
+ class: "flex items-center gap-2",
69
+ children: [
70
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
71
+ class: "rounded-full border border-white/10 bg-white/5 px-2 py-1 text-xs text-zinc-400",
72
+ children: pkg.version
73
+ }),
74
+ /* @__PURE__ */ jsxRuntime.jsx(InstallButton.InstallButton, {
75
+ pkg,
76
+ installingPackage
77
+ })
78
+ ]
79
+ })
80
+ ]
81
+ }),
82
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
83
+ class: "line-clamp-2 text-xs text-zinc-400",
84
+ children: pkg.description
85
+ })
86
+ ]
87
+ }, pkg.name);
88
+ })
89
+ });
90
+ }
91
+ })
92
+ ]
93
+ });
94
+ });
95
+ exports.Packages = Packages;
@@ -0,0 +1,95 @@
1
+ import { jsxs, jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useSignal, $, useResource$, Resource } from "@qwik.dev/core";
3
+ import { useDebouncer } from "../../hooks/useDebouncer.qwik.mjs";
4
+ import { InstallButton } from "./components/InstallButton/InstallButton.qwik.mjs";
5
+ const Packages = component$(() => {
6
+ const debouncedQuery = useSignal("");
7
+ const installingPackage = useSignal(null);
8
+ const debounceSearch = useDebouncer($((value) => {
9
+ debouncedQuery.value = value;
10
+ }), 300);
11
+ const searchResults = useResource$(async ({ track }) => {
12
+ const query = track(() => debouncedQuery.value);
13
+ if (!query || query.length < 2) {
14
+ return [];
15
+ }
16
+ const response = await fetch(`https://registry.npmjs.org/-/v1/search?text=${query}`);
17
+ const data = await response.json();
18
+ const packages = data.objects.map((obj) => ({
19
+ name: obj.package.name,
20
+ version: obj.package.version,
21
+ description: obj.package.description || "No description available"
22
+ }));
23
+ return packages;
24
+ });
25
+ return /* @__PURE__ */ jsxs("div", {
26
+ class: "space-y-4",
27
+ children: [
28
+ /* @__PURE__ */ jsx("div", {
29
+ class: "relative",
30
+ children: /* @__PURE__ */ jsx("input", {
31
+ type: "text",
32
+ onInput$: (_, target) => {
33
+ debounceSearch(target.value);
34
+ },
35
+ placeholder: "Search npm packages...",
36
+ class: "w-full rounded-lg border border-white/10 bg-white/5 px-4 py-2 text-sm text-white placeholder-zinc-500 outline-none focus:border-white/20"
37
+ })
38
+ }),
39
+ /* @__PURE__ */ jsx(Resource, {
40
+ value: searchResults,
41
+ onPending: () => /* @__PURE__ */ jsx("div", {
42
+ class: "absolute right-3 top-1",
43
+ children: /* @__PURE__ */ jsx("div", {
44
+ class: "h-5 w-5 animate-spin rounded-full border-2 border-white/10 border-t-white/40"
45
+ })
46
+ }),
47
+ onRejected: (error) => /* @__PURE__ */ jsx("div", {
48
+ class: "mt-2 text-xs text-red-400",
49
+ children: error.message || "Failed to fetch packages"
50
+ }),
51
+ onResolved: (packages) => {
52
+ return /* @__PURE__ */ jsx("div", {
53
+ class: "grid gap-3 md:grid-cols-2",
54
+ children: packages.map((pkg) => {
55
+ return /* @__PURE__ */ jsxs("div", {
56
+ class: "flex flex-col gap-2 rounded-lg bg-white/5 p-3",
57
+ children: [
58
+ /* @__PURE__ */ jsxs("div", {
59
+ class: "flex items-center justify-between",
60
+ children: [
61
+ /* @__PURE__ */ jsx("div", {
62
+ class: "text-sm",
63
+ children: pkg.name
64
+ }),
65
+ /* @__PURE__ */ jsxs("div", {
66
+ class: "flex items-center gap-2",
67
+ children: [
68
+ /* @__PURE__ */ jsx("div", {
69
+ class: "rounded-full border border-white/10 bg-white/5 px-2 py-1 text-xs text-zinc-400",
70
+ children: pkg.version
71
+ }),
72
+ /* @__PURE__ */ jsx(InstallButton, {
73
+ pkg,
74
+ installingPackage
75
+ })
76
+ ]
77
+ })
78
+ ]
79
+ }),
80
+ /* @__PURE__ */ jsx("div", {
81
+ class: "line-clamp-2 text-xs text-zinc-400",
82
+ children: pkg.description
83
+ })
84
+ ]
85
+ }, pkg.name);
86
+ })
87
+ });
88
+ }
89
+ })
90
+ ]
91
+ });
92
+ });
93
+ export {
94
+ Packages
95
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
4
+ require("../../../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.cjs");
5
+ const context = require("../../../../packages/kit/src/context.qwik.cjs");
6
+ require("../../../../node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.cjs");
7
+ const core = require("@qwik.dev/core");
8
+ const InstallButton = core.component$(({ pkg, installingPackage }) => {
9
+ return /* @__PURE__ */ jsxRuntime.jsx("button", {
10
+ onClick$: async () => {
11
+ installingPackage.value = pkg.name;
12
+ const rpc = context.getViteClientRpc();
13
+ const result = await rpc.installPackage(pkg.name);
14
+ if (!result.success) {
15
+ return Promise.reject(result.error || "Installation failed");
16
+ }
17
+ },
18
+ disabled: installingPackage.value === pkg.name,
19
+ class: [
20
+ "rounded-full px-2 py-1 text-xs",
21
+ installingPackage.value === pkg.name ? "cursor-not-allowed bg-blue-500/5 text-blue-400/50" : "bg-blue-500/10 text-blue-400 hover:bg-blue-500/20"
22
+ ].join(" "),
23
+ children: installingPackage.value === pkg.name ? /* @__PURE__ */ jsxRuntime.jsxs("div", {
24
+ class: "flex items-center gap-1",
25
+ children: [
26
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
27
+ class: "h-3 w-3 animate-spin rounded-full border border-current border-t-transparent"
28
+ }),
29
+ /* @__PURE__ */ jsxRuntime.jsx("span", {
30
+ children: "Installing..."
31
+ })
32
+ ]
33
+ }) : "Install"
34
+ });
35
+ });
36
+ exports.InstallButton = InstallButton;
@@ -0,0 +1,36 @@
1
+ import { jsx, jsxs } from "@qwik.dev/core/jsx-runtime";
2
+ import "../../../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.mjs";
3
+ import { getViteClientRpc } from "../../../../packages/kit/src/context.qwik.mjs";
4
+ import "../../../../node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.mjs";
5
+ import { component$ } from "@qwik.dev/core";
6
+ const InstallButton = component$(({ pkg, installingPackage }) => {
7
+ return /* @__PURE__ */ jsx("button", {
8
+ onClick$: async () => {
9
+ installingPackage.value = pkg.name;
10
+ const rpc = getViteClientRpc();
11
+ const result = await rpc.installPackage(pkg.name);
12
+ if (!result.success) {
13
+ return Promise.reject(result.error || "Installation failed");
14
+ }
15
+ },
16
+ disabled: installingPackage.value === pkg.name,
17
+ class: [
18
+ "rounded-full px-2 py-1 text-xs",
19
+ installingPackage.value === pkg.name ? "cursor-not-allowed bg-blue-500/5 text-blue-400/50" : "bg-blue-500/10 text-blue-400 hover:bg-blue-500/20"
20
+ ].join(" "),
21
+ children: installingPackage.value === pkg.name ? /* @__PURE__ */ jsxs("div", {
22
+ class: "flex items-center gap-1",
23
+ children: [
24
+ /* @__PURE__ */ jsx("div", {
25
+ class: "h-3 w-3 animate-spin rounded-full border border-current border-t-transparent"
26
+ }),
27
+ /* @__PURE__ */ jsx("span", {
28
+ children: "Installing..."
29
+ })
30
+ ]
31
+ }) : "Install"
32
+ });
33
+ });
34
+ export {
35
+ InstallButton
36
+ };