@nuxt/devtools 1.7.0 → 2.0.0-beta.2

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 (125) hide show
  1. package/.discoveryrc.cjs +13 -0
  2. package/README.md +8 -5
  3. package/dist/chunks/module-main.mjs +104 -50
  4. package/dist/chunks/vite-inspect.mjs +5 -1
  5. package/dist/chunks/vscode.mjs +2 -2
  6. package/dist/client/200.html +15 -15
  7. package/dist/client/404.html +15 -15
  8. package/dist/client/_nuxt/__blank-mzki7hds.js +1 -0
  9. package/dist/client/_nuxt/{analyze-build-ducxx7hk.js → analyze-build-cm7nbw0a.js} +1 -1
  10. package/dist/client/_nuxt/{assets-i0wwgco0.js → assets-4eyg0st2.js} +3 -3
  11. package/dist/client/_nuxt/builds/latest.json +1 -1
  12. package/dist/client/_nuxt/builds/meta/7235b424-6975-4a9d-93d7-43e41c8bf0d0.json +1 -0
  13. package/dist/client/_nuxt/{client-my5lks1i.js → client-bnemmvey.js} +1 -1
  14. package/dist/client/_nuxt/{code-diff.vue-hs4v40uj.js → code-diff.vue-b35z64iy.js} +1 -1
  15. package/dist/client/_nuxt/{code-snippets.vue-k22v8u0h.js → code-snippets.vue-kod959e4.js} +1 -1
  16. package/dist/client/_nuxt/components-owz73qfn.js +1 -0
  17. package/dist/client/_nuxt/{composable-item.vue-ec65e9jn.js → composable-item.vue-k3upmevr.js} +1 -1
  18. package/dist/client/_nuxt/custom-_name_-1x91219n.js +1 -0
  19. package/dist/client/_nuxt/{default-j6ndp61j.js → default-knqf5o69.js} +1 -1
  20. package/dist/client/_nuxt/duration-display.vue-jvaccd8v.js +1 -0
  21. package/dist/client/_nuxt/entry.css-egk2z7qr.css +1 -0
  22. package/dist/client/_nuxt/{error-404-ceo5987l.js → error-404-njmanbq9.js} +1 -1
  23. package/dist/client/_nuxt/error-404.css-lmmxplpx.css +1 -0
  24. package/dist/client/_nuxt/{error-500-lwkwf49w.js → error-500-efmvdg7h.js} +1 -1
  25. package/dist/client/_nuxt/error-500.css-u0boq89r.css +1 -0
  26. package/dist/client/_nuxt/error-g6edq0yb.js +9 -0
  27. package/dist/client/_nuxt/filepath-item.vue-jlqwj704.js +1 -0
  28. package/dist/client/_nuxt/full-b288af13.js +1 -0
  29. package/dist/client/_nuxt/{help-fab.vue-d5mgp1hs.js → help-fab.vue-j6249tgf.js} +1 -1
  30. package/dist/client/_nuxt/{hooks-m0lvq8gl.js → hooks-j5sf1l7v.js} +1 -1
  31. package/dist/client/_nuxt/imports-bnmsrgkh.js +1 -0
  32. package/dist/client/_nuxt/index-fzja6ux8.js +2 -0
  33. package/dist/client/_nuxt/index-nx28hfsi.js +1 -0
  34. package/dist/client/_nuxt/launch-page.vue-h6bzyiyl.js +1 -0
  35. package/dist/client/_nuxt/modules-dg7kfyjr.js +1 -0
  36. package/dist/client/_nuxt/mxzg8bne.js +17 -0
  37. package/dist/client/_nuxt/nbadge-065dqs5v.js +1 -0
  38. package/dist/client/_nuxt/{ncheckbox.vue-hj8qatqi.js → ncheckbox.vue-d0yw5qc1.js} +1 -1
  39. package/dist/client/_nuxt/ncode-block.css-lvdc77tw.css +1 -0
  40. package/dist/client/_nuxt/ncode-block.vue-c2t0anp9.js +2 -0
  41. package/dist/client/_nuxt/ndrawer.vue-g7wzeynf.js +1 -0
  42. package/dist/client/_nuxt/ndropdown.vue-jksxbs6t.js +1 -0
  43. package/dist/client/_nuxt/{nicon-title.vue-lmnsr02i.js → nicon-title.vue-hch1agon.js} +1 -1
  44. package/dist/client/_nuxt/{nlink.vue-nuag3fiz.js → nlink.vue-i0hrioln.js} +1 -1
  45. package/dist/client/_nuxt/{nmarkdown.vue-ew01nvcn.js → nmarkdown.vue-lym2fx3e.js} +1 -1
  46. package/dist/client/_nuxt/nnavbar.vue-y4opgitt.js +1 -0
  47. package/dist/client/_nuxt/none-nup47uz7.js +1 -0
  48. package/dist/client/_nuxt/nsection-block-mb0wrwu4.js +1 -0
  49. package/dist/client/_nuxt/nselect-tabs.vue-mvcu0rv4.js +1 -0
  50. package/dist/client/_nuxt/nselect.vue-eyd0vhij.js +1 -0
  51. package/dist/client/_nuxt/{open-graph-jlz5vrcc.js → open-graph-k0hqg0gj.js} +2 -2
  52. package/dist/client/_nuxt/overview-o54gzos9.js +1 -0
  53. package/dist/client/_nuxt/pages-eou4r3my.js +1 -0
  54. package/dist/client/_nuxt/{payload-ibdys3jx.js → payload-nhrpw6bb.js} +1 -1
  55. package/dist/client/_nuxt/pinia-fydnwhe3.js +1 -0
  56. package/dist/client/_nuxt/plugins-c7p6t581.js +1 -0
  57. package/dist/client/_nuxt/render-tree-j2aypyg1.js +1 -0
  58. package/dist/client/_nuxt/{runtime-configs-tx27yuue.js → runtime-configs-d0jvii1m.js} +1 -1
  59. package/dist/client/_nuxt/server-discovery-gexdv3di.js +1 -0
  60. package/dist/client/_nuxt/{server-route-inputs.vue-ndm30y4c.js → server-route-inputs.vue-o8209idy.js} +1 -1
  61. package/dist/client/_nuxt/server-routes-dqhxkhv4.js +9 -0
  62. package/dist/client/_nuxt/server-tasks-k2bo3ecg.js +1 -0
  63. package/dist/client/_nuxt/settings-kg4bwnbo.js +1 -0
  64. package/dist/client/_nuxt/{stacktrace-list.vue-bbs3noa6.js → stacktrace-list.vue-cb98on8v.js} +1 -1
  65. package/dist/client/_nuxt/{state-components-hlkgglj2.js → state-components-of7uu2vz.js} +1 -1
  66. package/dist/client/_nuxt/state-editor.vue-j30ssdvq.js +1 -0
  67. package/dist/client/_nuxt/state-modules-dvf4dhgf.js +1 -0
  68. package/dist/client/_nuxt/storage-h5g7r393.js +1 -0
  69. package/dist/client/_nuxt/{terminals-ifniwc30.js → terminals-h4bqkpmq.js} +1 -1
  70. package/dist/client/_nuxt/{timeline-l57dgwoy.js → timeline-km82a89k.js} +2 -2
  71. package/dist/client/_nuxt/{unocss-runtime-cgapiai4.js → unocss-runtime-eltx4hvu.js} +1 -1
  72. package/dist/client/_nuxt/vendor/{json-editor-vue-gv8v06ez.js → json-editor-vue-fw81xiot.js} +100 -100
  73. package/dist/client/_nuxt/vendor/shiki-j4jbxo4i.js +148 -0
  74. package/dist/client/_nuxt/vendor/{unocss-f0kk6o39.js → unocss-dypm4cev.js} +2 -2
  75. package/dist/client/_nuxt/vendor/{vis-dlwijd5n.js → vis-fzckz0r6.js} +12 -12
  76. package/dist/client/_nuxt/vendor/{xterm-dbpzgj7s.js → xterm-b1jefe3j.js} +7 -7
  77. package/dist/client/_nuxt/virtual-files-lhs4uf37.js +1 -0
  78. package/dist/client/_nuxt/{vue-virtual-scroller.esm-cgrk8bqc.js → vue-virtual-scroller.esm-luvj44av.js} +1 -1
  79. package/dist/client/discovery/index.html +611 -0
  80. package/dist/client/index.html +15 -15
  81. package/dist/module.json +2 -2
  82. package/dist/module.mjs +1 -1
  83. package/dist/runtime/plugins/view/Main.vue +2 -9
  84. package/dist/shared/{devtools.5ac54dae.mjs → devtools.60b2ba4d.mjs} +3 -2
  85. package/package.json +43 -37
  86. package/dist/client/_nuxt/__blank-i07cwg93.js +0 -1
  87. package/dist/client/_nuxt/builds/meta/a420b23e-eff0-4a26-9593-f64aed27b3ae.json +0 -1
  88. package/dist/client/_nuxt/components-mno98knb.js +0 -1
  89. package/dist/client/_nuxt/components-tree-olgegwda.js +0 -1
  90. package/dist/client/_nuxt/custom-_name_-go82yg9m.js +0 -1
  91. package/dist/client/_nuxt/duration-display.vue-h9fie5qa.js +0 -1
  92. package/dist/client/_nuxt/entry.css-f054t818.css +0 -1
  93. package/dist/client/_nuxt/er2hcepb.js +0 -17
  94. package/dist/client/_nuxt/error-404.css-f2iw8q7i.css +0 -1
  95. package/dist/client/_nuxt/error-500.css-xen1rmly.css +0 -1
  96. package/dist/client/_nuxt/error-egdh3jtf.js +0 -9
  97. package/dist/client/_nuxt/filepath-item.vue-n2otfocd.js +0 -1
  98. package/dist/client/_nuxt/full-ndos3x1d.js +0 -1
  99. package/dist/client/_nuxt/imports-ldyykc17.js +0 -1
  100. package/dist/client/_nuxt/index-cx44rs14.js +0 -2
  101. package/dist/client/_nuxt/index-nvb37cqm.js +0 -1
  102. package/dist/client/_nuxt/launch-page.vue-f4th9x6r.js +0 -1
  103. package/dist/client/_nuxt/modules-djmqshrp.js +0 -1
  104. package/dist/client/_nuxt/nbadge-fn7hrj12.js +0 -1
  105. package/dist/client/_nuxt/ncode-block.css-c9cb29at.css +0 -1
  106. package/dist/client/_nuxt/ncode-block.vue-bvtirmea.js +0 -2
  107. package/dist/client/_nuxt/ndrawer.vue-gxd9fltc.js +0 -1
  108. package/dist/client/_nuxt/ndropdown.vue-cmmqgxbt.js +0 -1
  109. package/dist/client/_nuxt/nnavbar.vue-hzjn49l3.js +0 -1
  110. package/dist/client/_nuxt/none-i32auprq.js +0 -1
  111. package/dist/client/_nuxt/nsection-block-f8z83agf.js +0 -1
  112. package/dist/client/_nuxt/nselect-tabs.vue-fducs2m0.js +0 -1
  113. package/dist/client/_nuxt/nselect.vue-e15n7240.js +0 -1
  114. package/dist/client/_nuxt/overview-hklnwlr6.js +0 -1
  115. package/dist/client/_nuxt/pages-g6rzdi8u.js +0 -1
  116. package/dist/client/_nuxt/pinia-ixbpay8a.js +0 -1
  117. package/dist/client/_nuxt/plugins-hepwq7ey.js +0 -1
  118. package/dist/client/_nuxt/server-routes-m68bu4bu.js +0 -9
  119. package/dist/client/_nuxt/server-tasks-m0c7tiad.js +0 -1
  120. package/dist/client/_nuxt/settings-f97g7u7e.js +0 -1
  121. package/dist/client/_nuxt/state-editor.vue-d73uejpo.js +0 -1
  122. package/dist/client/_nuxt/state-modules-5svqrca0.js +0 -1
  123. package/dist/client/_nuxt/storage-cvuwvjle.js +0 -1
  124. package/dist/client/_nuxt/vendor/shiki-ml6g43ls.js +0 -57
  125. package/dist/client/_nuxt/virtual-files-lrwriib3.js +0 -1
@@ -0,0 +1,13 @@
1
+ const { join } = require('node:path')
2
+
3
+ module.exports = {
4
+ name: 'Nuxt Server Data',
5
+ basedir: join(__dirname, 'discovery'),
6
+ embed: true,
7
+ // view: {
8
+ // assets: [
9
+ // './pages/common.css',
10
+ // './pages/default.js',
11
+ // ],
12
+ // },
13
+ }
package/README.md CHANGED
@@ -25,9 +25,12 @@ Unleash Nuxt Developer Experience.
25
25
 
26
26
  <br>
27
27
 
28
+ > [!NOTE]
29
+ > You are viewing the v2.x branch which are in active development. For the latest stable version, please refer to the [v1.x branch](https://github.com/nuxt/devtools/tree/v1)
30
+
28
31
  ## Installation
29
32
 
30
- > Nuxt DevTools requires **Nuxt v3.9.0 or higher**.
33
+ > Nuxt DevTools v2 requires **Nuxt v3.15.0 or higher**.
31
34
 
32
35
  Nuxt DevTools is **enabled by default** in Nuxt v3.8.0. You can press <kbd>Shift</kbd> + <kbd>Alt</kbd> / <kbd>⇧ Shift</kbd> + <kbd>⌥ Option</kbd> + <kbd>D</kbd> in your app to open it up.
33
36
 
@@ -41,17 +44,17 @@ export default defineNuxtConfig({
41
44
  })
42
45
  ```
43
46
 
44
- ### Edge Release Channel
47
+ ### Nightly Release Channel
45
48
 
46
- Similar to [Nuxt's Nightly Channel](https://nuxt.com/docs/guide/going-further/nightly-release-channel#opting-into-the-edge-channel), DevTools also offers an edge release channel, that automatically releases for every commit to `main` branch.
49
+ Similar to [Nuxt's Nightly Channel](https://nuxt.com/docs/guide/going-further/nightly-release-channel), DevTools also offers a nightly release channel, that automatically releases for every commit to `main` branch.
47
50
 
48
- You can opt-in to the edge release channel by running:
51
+ You can opt-in to the nightly release channel by running:
49
52
 
50
53
  ```diff
51
54
  {
52
55
  "devDependencies": {
53
56
  -- "@nuxt/devtools": "^0.1.0"
54
- ++ "@nuxt/devtools": "npm:@nuxt/devtools-edge@latest"
57
+ ++ "@nuxt/devtools": "npm:@nuxt/devtools-nightly@latest"
55
58
  }
56
59
  }
57
60
  ```
@@ -6,7 +6,7 @@ import { colors } from 'consola/utils';
6
6
  import { join, dirname as dirname$1, resolve } from 'pathe';
7
7
  import sirv from 'sirv';
8
8
  import { searchForWorkspaceRoot } from 'vite';
9
- import { d as defaultAllowedExtensions, a as defaultTabOptions, W as WS_EVENT_NAME } from '../shared/devtools.5ac54dae.mjs';
9
+ import { d as defaultAllowedExtensions, a as defaultTabOptions, W as WS_EVENT_NAME } from '../shared/devtools.60b2ba4d.mjs';
10
10
  import { dirname, join as join$1, relative, parse } from 'node:path';
11
11
  import { randomStr } from '@antfu/utils';
12
12
  import { hash } from 'ohash';
@@ -31,7 +31,7 @@ import { getPackageInfo } from 'local-pkg';
31
31
  import 'pkg-types';
32
32
  import semver from 'semver';
33
33
 
34
- const version = "1.7.0";
34
+ const version = "2.0.0-beta.2";
35
35
 
36
36
  function getHomeDir() {
37
37
  return process.env.XDG_CONFIG_HOME || homedir();
@@ -384,6 +384,54 @@ function setupCustomTabRPC({ nuxt, options, refresh }) {
384
384
  };
385
385
  }
386
386
 
387
+ let options;
388
+ function getOptions() {
389
+ return options;
390
+ }
391
+ function setupOptionsRPC({ nuxt }) {
392
+ async function getOptions2(tab) {
393
+ if (!options || options[tab]) {
394
+ options = defaultTabOptions;
395
+ await read(tab);
396
+ }
397
+ return options[tab];
398
+ }
399
+ async function read(tab) {
400
+ options[tab] = await readLocalOptions(defaultTabOptions[tab], {
401
+ root: nuxt.options.rootDir,
402
+ key: tab !== "ui" && tab
403
+ });
404
+ return options;
405
+ }
406
+ getOptions2("ui");
407
+ async function clearOptions() {
408
+ options = void 0;
409
+ await clearLocalOptions({
410
+ root: nuxt.options.rootDir
411
+ });
412
+ }
413
+ return {
414
+ async updateOptions(tab, _settings) {
415
+ const settings = await getOptions2(tab);
416
+ Object.assign(settings, _settings);
417
+ await writeLocalOptions(
418
+ { ...settings },
419
+ {
420
+ root: nuxt.options.rootDir,
421
+ key: tab !== "ui" && tab
422
+ }
423
+ );
424
+ nuxt.callHook("builder:generateApp", {
425
+ filter(template) {
426
+ return template.filename.includes("devtools/settings.js");
427
+ }
428
+ });
429
+ },
430
+ getOptions: getOptions2,
431
+ clearOptions
432
+ };
433
+ }
434
+
387
435
  function setupGeneralRPC({
388
436
  nuxt,
389
437
  options,
@@ -443,9 +491,6 @@ function setupGeneralRPC({
443
491
  app = v;
444
492
  });
445
493
  return {
446
- getServerConfig() {
447
- return nuxt.options;
448
- },
449
494
  getServerRuntimeConfig() {
450
495
  const ENV_PREFIX = "NITRO_";
451
496
  const ENV_PREFIX_ALT = "NUXT_";
@@ -530,7 +575,10 @@ function setupGeneralRPC({
530
575
  if (result)
531
576
  return true;
532
577
  }
533
- await import('launch-editor').then((r) => (r.default || r)(path + suffix));
578
+ let editor = getOptions()?.behavior.openInEditor ?? void 0;
579
+ if (editor === "auto")
580
+ editor = void 0;
581
+ await import('launch-editor').then((r) => (r.default || r)(path + suffix, editor));
534
582
  return true;
535
583
  } catch (e) {
536
584
  console.error(e);
@@ -1148,7 +1196,11 @@ async function checkForUpdateOf(name, current, nuxt = useNuxt()) {
1148
1196
  try {
1149
1197
  if (!current) {
1150
1198
  const require = createRequire(nuxt.options.rootDir);
1151
- const info = await getPackageInfo(name, { paths: require.resolve.paths(name) || void 0 });
1199
+ const modulePaths = [
1200
+ ...nuxt.options.modulesDir,
1201
+ ...require.resolve.paths(name) || []
1202
+ ];
1203
+ const info = await getPackageInfo(name, { paths: modulePaths });
1152
1204
  if (!info)
1153
1205
  return;
1154
1206
  current = info.packageJson.version;
@@ -1342,51 +1394,52 @@ function setupNpmRPC({ nuxt, ensureDevAuthToken }) {
1342
1394
  };
1343
1395
  }
1344
1396
 
1345
- let options;
1346
- function getOptions() {
1347
- return options;
1348
- }
1349
- function setupOptionsRPC({ nuxt }) {
1350
- async function getOptions2(tab) {
1351
- if (!options || options[tab]) {
1352
- options = defaultTabOptions;
1353
- await read(tab);
1354
- }
1355
- return options[tab];
1356
- }
1357
- async function read(tab) {
1358
- options[tab] = await readLocalOptions(defaultTabOptions[tab], {
1359
- root: nuxt.options.rootDir,
1360
- key: tab !== "ui" && tab
1361
- });
1362
- return options;
1363
- }
1364
- getOptions2("ui");
1365
- async function clearOptions() {
1366
- options = void 0;
1367
- await clearLocalOptions({
1368
- root: nuxt.options.rootDir
1369
- });
1370
- }
1371
- return {
1372
- async updateOptions(tab, _settings) {
1373
- const settings = await getOptions2(tab);
1374
- Object.assign(settings, _settings);
1375
- await writeLocalOptions(
1376
- { ...settings },
1377
- {
1378
- root: nuxt.options.rootDir,
1379
- key: tab !== "ui" && tab
1397
+ function setupServerDataRPC({
1398
+ nuxt,
1399
+ ensureDevAuthToken
1400
+ }) {
1401
+ let nitro;
1402
+ let viteServer;
1403
+ let viteClient;
1404
+ nuxt.hook("nitro:build:before", (_nitro) => {
1405
+ nitro = _nitro;
1406
+ });
1407
+ nuxt.hook("vite:extendConfig", (vite, options) => {
1408
+ if (options.isServer) {
1409
+ vite.plugins ||= [];
1410
+ vite.plugins.push({
1411
+ name: "nuxt:devtools:config-retriever",
1412
+ enforce: "post",
1413
+ configResolved(config) {
1414
+ viteServer = config;
1380
1415
  }
1381
- );
1382
- nuxt.callHook("builder:generateApp", {
1383
- filter(template) {
1384
- return template.filename.includes("devtools/settings.js");
1416
+ });
1417
+ } else if (options.isClient) {
1418
+ vite.plugins ||= [];
1419
+ vite.plugins.push({
1420
+ name: "nuxt:devtools:config-retriever",
1421
+ enforce: "post",
1422
+ configResolved(config) {
1423
+ viteClient = config;
1385
1424
  }
1386
1425
  });
1426
+ }
1427
+ });
1428
+ return {
1429
+ getServerConfig() {
1430
+ return nuxt.options;
1387
1431
  },
1388
- getOptions: getOptions2,
1389
- clearOptions
1432
+ async getServerData(token) {
1433
+ await ensureDevAuthToken(token);
1434
+ return {
1435
+ nuxt: nuxt.options,
1436
+ nitro: nitro?.options,
1437
+ vite: {
1438
+ server: viteServer,
1439
+ client: viteClient
1440
+ }
1441
+ };
1442
+ }
1390
1443
  };
1391
1444
  }
1392
1445
 
@@ -1817,7 +1870,8 @@ function setupRPC(nuxt, options) {
1817
1870
  ...setupAnalyzeBuildRPC(ctx),
1818
1871
  ...setupOptionsRPC(ctx),
1819
1872
  ...setupTimelineRPC(ctx),
1820
- ...setupTelemetryRPC(ctx)
1873
+ ...setupTelemetryRPC(ctx),
1874
+ ...setupServerDataRPC(ctx)
1821
1875
  });
1822
1876
  const wsClients = /* @__PURE__ */ new Set();
1823
1877
  const vitePlugin = {
@@ -1877,7 +1931,7 @@ async function enableModule(options, nuxt) {
1877
1931
  await import('./analyze-build.mjs').then(({ setup }) => setup(nuxt, options));
1878
1932
  return;
1879
1933
  }
1880
- const enabledExplicitly = nuxt.options.devtools === true || nuxt.options.devtools && nuxt.options.devtools.enabled || !!nuxt.options.modules.find((m) => m === "@nuxt/devtools" || m === "@nuxt/devtools-edge");
1934
+ const enabledExplicitly = nuxt.options.devtools === true || nuxt.options.devtools && nuxt.options.devtools.enabled || !!nuxt.options.modules.find((m) => m === "@nuxt/devtools" || m === "@nuxt/devtools-edge" || m === "@nuxt/devtools-nightly");
1881
1935
  await nuxt.callHook("devtools:before");
1882
1936
  if (options.iframeProps) {
1883
1937
  nuxt.options.runtimeConfig.app.devtools ||= {};
@@ -22,7 +22,11 @@ async function setup({ nuxt, rpc }) {
22
22
  }
23
23
  }), nuxt);
24
24
  async function getComponentsRelationships() {
25
- const modules = (await api?.rpc.list())?.modules || [];
25
+ const meta = await api?.rpc.getMetadata();
26
+ const modules = (meta ? await api?.rpc.getModulesList({
27
+ vite: meta?.instances[0].vite,
28
+ env: meta?.instances[0].environments[0]
29
+ }) : null) || [];
26
30
  const components = await rpc.functions.getComponents() || [];
27
31
  const vueModules = modules.filter((m) => {
28
32
  const plainId = m.id.replace(/\?v=\w+$/, "");
@@ -12,7 +12,7 @@ import 'consola/utils';
12
12
  import 'pathe';
13
13
  import 'sirv';
14
14
  import 'vite';
15
- import '../shared/devtools.5ac54dae.mjs';
15
+ import '../shared/devtools.60b2ba4d.mjs';
16
16
  import '../dirs.mjs';
17
17
  import 'node:url';
18
18
  import 'is-installed-globally';
@@ -63,7 +63,7 @@ async function setup({ nuxt, options, openInEditorHooks, rpc }) {
63
63
  const installed = !!await which(codeBinary).catch(() => null);
64
64
  let port = vsOptions?.port || 3080;
65
65
  let url = `http://localhost:${port}`;
66
- const host = vsOptions?.host ? `--host=${vsOptions.host}` : "";
66
+ const host = vsOptions?.host ? `--host=${vsOptions.host}` : "--host=127.0.0.1";
67
67
  let loaded = false;
68
68
  let promise = null;
69
69
  const mode = vsOptions?.mode || "local-serve";
@@ -1,20 +1,20 @@
1
1
  <!DOCTYPE html><html data-capo=""><head><meta charset="utf-8">
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1">
3
- <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/entry.css-f054t818.css" crossorigin>
3
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/entry.css-egk2z7qr.css" crossorigin>
4
4
  <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue.css-mqq5uooj.css" crossorigin>
5
5
  <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss.css-mhvipxpl.css" crossorigin>
6
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/er2hcepb.js">
7
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue-gv8v06ez.js">
8
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss-f0kk6o39.js">
9
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/shiki-ml6g43ls.js">
6
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/mxzg8bne.js">
7
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue-fw81xiot.js">
8
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss-dypm4cev.js">
9
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/shiki-j4jbxo4i.js">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/markdown-it-fvu08dbs.js">
11
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/default-j6ndp61j.js">
12
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/full-ndos3x1d.js">
13
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/none-i32auprq.js">
14
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/unocss-runtime-cgapiai4.js">
15
- <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404.css-f2iw8q7i.css">
16
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404-ceo5987l.js">
17
- <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500.css-xen1rmly.css">
18
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500-lwkwf49w.js">
19
- <script type="module" src="/__NUXT_DEVTOOLS_BASE__/_nuxt/er2hcepb.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1735205290311,false]</script>
20
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_BASE__/",buildId:"a420b23e-eff0-4a26-9593-f64aed27b3ae",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/default-knqf5o69.js">
12
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/full-b288af13.js">
13
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/none-nup47uz7.js">
14
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/unocss-runtime-eltx4hvu.js">
15
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404.css-lmmxplpx.css">
16
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404-njmanbq9.js">
17
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500.css-u0boq89r.css">
18
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500-efmvdg7h.js">
19
+ <script type="module" src="/__NUXT_DEVTOOLS_BASE__/_nuxt/mxzg8bne.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1737018576773,false]</script>
20
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_BASE__/",buildId:"7235b424-6975-4a9d-93d7-43e41c8bf0d0",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -1,20 +1,20 @@
1
1
  <!DOCTYPE html><html data-capo=""><head><meta charset="utf-8">
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1">
3
- <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/entry.css-f054t818.css" crossorigin>
3
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/entry.css-egk2z7qr.css" crossorigin>
4
4
  <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue.css-mqq5uooj.css" crossorigin>
5
5
  <link rel="stylesheet" href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss.css-mhvipxpl.css" crossorigin>
6
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/er2hcepb.js">
7
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue-gv8v06ez.js">
8
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss-f0kk6o39.js">
9
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/shiki-ml6g43ls.js">
6
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/mxzg8bne.js">
7
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/json-editor-vue-fw81xiot.js">
8
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/unocss-dypm4cev.js">
9
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/shiki-j4jbxo4i.js">
10
10
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/vendor/markdown-it-fvu08dbs.js">
11
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/default-j6ndp61j.js">
12
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/full-ndos3x1d.js">
13
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/none-i32auprq.js">
14
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/unocss-runtime-cgapiai4.js">
15
- <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404.css-f2iw8q7i.css">
16
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404-ceo5987l.js">
17
- <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500.css-xen1rmly.css">
18
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500-lwkwf49w.js">
19
- <script type="module" src="/__NUXT_DEVTOOLS_BASE__/_nuxt/er2hcepb.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1735205290312,false]</script>
20
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_BASE__/",buildId:"a420b23e-eff0-4a26-9593-f64aed27b3ae",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
11
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/default-knqf5o69.js">
12
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/full-b288af13.js">
13
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/none-nup47uz7.js">
14
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/unocss-runtime-eltx4hvu.js">
15
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404.css-lmmxplpx.css">
16
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-404-njmanbq9.js">
17
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500.css-u0boq89r.css">
18
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_BASE__/_nuxt/error-500-efmvdg7h.js">
19
+ <script type="module" src="/__NUXT_DEVTOOLS_BASE__/_nuxt/mxzg8bne.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1737018576773,false]</script>
20
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_BASE__/",buildId:"7235b424-6975-4a9d-93d7-43e41c8bf0d0",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
@@ -0,0 +1 @@
1
+ import{k as e,S as n,Q as t}from"./vendor/json-editor-vue-fw81xiot.js";const c={"h-screen":"","w-screen":"","bg-black":""},r=e({__name:"__blank",setup(o){return(s,_)=>(t(),n("div",c))}});export{r as default};
@@ -1 +1 @@
1
- import{f as P,g as J,r as S,h as R,e as U,j as X,k as h,l as ee,m as ne,n as te,o as le,p as ie,q as oe,s as C,v as re,w as ue,x as se,c as ae}from"./er2hcepb.js";import{_ as de}from"./filepath-item.vue-n2otfocd.js";import{k as E,l as V,b as F,Q as i,S as u,U as e,F as p,ab as G,Y as j,a5 as v,W as x,u as c,a0 as d,$ as a,a6 as f,a8 as A,a9 as I,M as k}from"./vendor/json-editor-vue-gv8v06ez.js";import{_ as me}from"./ncode-block.vue-bvtirmea.js";import{_ as pe}from"./ncheckbox.vue-hj8qatqi.js";import{_ as ve}from"./help-fab.vue-d5mgp1hs.js";import"./vendor/unocss-f0kk6o39.js";import"./vendor/shiki-ml6g43ls.js";import"./client-my5lks1i.js";const fe={"h-full":"",grid:"~ rows-[max-content_1fr]"},ye={flex:"~ wrap","w-full":""},be=["onClick"],ce={key:0,flex:"~ col gap-4 items-center justify-center",p4:""},ge={grid:"~ cols-[30px_1fr] gap-x-2 gap-y-3 items-center justify-center","w-100":""},xe=E({__name:"BuildAnalyzeDetails",props:{current:{},prev:{}},setup(N){const y=N,$=`${J().app.baseURL}/__nuxt_devtools__/analyze/`.replace(/\/+/g,"/"),b=V(()=>{const l=[{name:"Overview",id:"overview"}];return y.current.features.bundleClient&&l.push({name:"Client Bundle",id:"bundle-client"}),y.current.features.bundleNitro&&l.push({name:"Nitro Bundle",id:"bundle-nitro"}),y.current.features.viteInspect&&l.push({name:"Vite Inspect",id:"vite-inspect"}),l}),o=F(b.value[0]);function z(l){return`${((l.endTime-l.startTime)/1e3).toFixed(1)}s`}function m(l){return l<1024?`${l}B`:l<1024*1024?`${(l/1024).toFixed(1)}KB`:l<1024*1024*1024?`${(l/1024/1024).toFixed(1)}MB`:`${(l/1024/1024/1024).toFixed(1)}GB`}async function T(l){return S.clearAnalyzeBuilds(await R(),[l])}return(l,n)=>{const D=de,B=U;return i(),u("div",fe,[e("div",ye,[(i(!0),u(p,null,G(b.value,(r,t)=>(i(),u("button",{key:t,px4:"",py2:"",border:"r base",hover:"bg-active",class:j(r.id===o.value.id?"":"border-b"),onClick:_=>o.value=r},[e("div",{class:j(r.id===o.value.id?"":"op30")},v(r.name),3)],10,be))),128)),n[1]||(n[1]=e("div",{border:"b base","flex-auto":""},null,-1))]),o.value.id==="overview"?(i(),u("div",ce,[n[15]||(n[15]=e("div",{"flex-auto":""},null,-1)),e("div",ge,[n[10]||(n[10]=e("div",{"i-carbon-commit":"","text-xl":""},null,-1)),e("div",null,[n[2]||(n[2]=e("div",{"text-sm":"",op50:""}," Name ",-1)),e("div",null,v(l.current.name),1)]),n[11]||(n[11]=e("div",{"i-carbon-time":"","text-xl":""},null,-1)),e("div",null,[n[3]||(n[3]=e("div",{"text-sm":"",op50:""}," Build duration ",-1)),e("div",null,v(z(l.current)),1)]),l.current.size?.clientBundle?(i(),u(p,{key:0},[n[5]||(n[5]=e("div",{"i-carbon-cics-program":"","text-xl":""},null,-1)),e("div",null,[n[4]||(n[4]=e("div",{"text-sm":"",op50:""}," Client bundle size ",-1)),e("div",null,v(m(l.current.size.clientBundle)),1)])],64)):x("",!0),l.current.size.nitroBundle?(i(),u(p,{key:1},[n[7]||(n[7]=e("div",{"i-carbon-bare-metal-server":"","text-xl":""},null,-1)),e("div",null,[n[6]||(n[6]=e("div",{"text-sm":"",op50:""}," Nitro bundle size ",-1)),e("div",null,v(m(l.current.size.nitroBundle)),1)])],64)):x("",!0),n[12]||(n[12]=e("div",{"i-carbon-edge-node":"","text-xl":""},null,-1)),e("div",null,[n[8]||(n[8]=e("div",{"text-sm":"",op50:""}," Built ",-1)),e("div",null,v(c(P)(new Date(l.current.endTime))),1)]),n[13]||(n[13]=e("div",{"i-carbon:folder-parent":"","text-xl":""},null,-1)),e("div",null,[n[9]||(n[9]=e("div",{"text-sm":"",op50:""}," Report Path ",-1)),d(D,{filepath:l.current.analyzeDir},null,8,["filepath"])])]),n[16]||(n[16]=e("div",{"flex-auto":""},null,-1)),d(B,{n:"rose",icon:"carbon-delete",onClick:n[0]||(n[0]=r=>T(l.current.name))},{default:a(()=>n[14]||(n[14]=[f(" Delete this report ")])),_:1})])):x("",!0),n._lazyshow1||o.value.id==="bundle-client"?(n._lazyshow1=!0,i(),u(p,null,[A(e("iframe",{src:`${c($)}${l.current.slug}/client.html`,"h-full":"","w-full":""},null,8,["src"]),[[I,o.value.id==="bundle-client"]])],64)):x("v-show-if",!0),n._lazyshow2||o.value.id==="bundle-nitro"?(n._lazyshow2=!0,i(),u(p,null,[A(e("iframe",{src:`${c($)}${l.current.slug}/nitro.html`,"h-full":"","w-full":""},null,8,["src"]),[[I,o.value.id==="bundle-nitro"]])],64)):x("v-show-if",!0),n._lazyshow3||o.value.id==="vite-inspect"?(n._lazyshow3=!0,i(),u(p,null,[A(e("iframe",{src:`${c($)}${l.current.slug}/.vite-inspect/`,"h-full":"","w-full":""},null,8,["src"]),[[I,o.value.id==="vite-inspect"]])],64)):x("v-show-if",!0)])}}}),we={class:"markdown-body"},$e={__name:"analyze-build",setup(N,{expose:y}){return y({frontmatter:{}}),($,b)=>(i(),u("div",we,b[0]||(b[0]=[e("h1",null,"Build Analyze",-1),e("p",null,[f("DevTools provides a build analyze tool to help you understand the size of your app in production. Whenever you start a new build, it runs the command "),e("code",null,"nuxt build --analyze"),f(" and present the output data directly in DevTools for easy browsing and comparing.")],-1)])))}},ze={flex:"~ col"},_e=["onClick"],ke={flex:"~ gap-1 items-center wrap","w-full":"","text-sm":"",op60:""},Be={flex:"~ items-center justify-center wrap",p4:""},Ce={flex:"~ col gap-1","w-250":"",p4:""},Ne={flex:"~ gap-3",mt2:"","justify-end":""},Re=E({__name:"analyze-build",setup(N){const y=X(),w=h(),$=ee(),b=ne("analyze-build:slug",""),o=V(()=>w.value?.builds.find(r=>r.slug===b.value)??w.value?.builds[0]),z=F(!1),m=F(""),T=V(()=>w.value?.builds.some(r=>r.name===m.value.trim()));async function l(){m.value=await S.generateAnalyzeBuildName(),await y.start()&&(oe("analyze-build:start"),C.value={name:m.value,processId:await S.startAnalyzeBuild(await R(),m.value)},z.value&&B())}const n=te();function D(r){return`${((r.endTime-r.startTime)/1e3).toFixed(1)}s`}function B(){C.value?.processId&&(n.value=C.value.processId,$.push("/modules/terminals"))}return le(()=>[{id:"action:analyze-build: start",title:"Start a new analyze build",icon:"i-carbon-edge-node",action:l}]),(r,t)=>{const _=U,L=xe,M=ae,O=ie,W=re,Y=ue,q=me,H=pe,K=se,Q=$e,Z=ve;return i(),u(p,null,[d(O,{"left-size":30},{left:a(()=>[e("div",ze,[(i(!0),u(p,null,G(c(w)?.builds,s=>(i(),u(p,{key:s.slug},[e("button",{flex:"~ col gap1","hover:bg-active":"",p3:"",class:j(s.slug===o.value?.slug?"text-primary bg-active":""),onClick:g=>b.value=s.slug},[e("code",null,v(s.name),1),e("div",ke,[t[4]||(t[4]=e("div",{"i-carbon-time":""},null,-1)),e("span",null,v(D(s)),1),t[5]||(t[5]=e("div",{"flex-auto":""},null,-1)),e("span",null,v(c(P)(new Date(s.endTime))),1)])],10,_e),t[6]||(t[6]=e("div",{"x-divider":""},null,-1))],64))),128)),e("div",Be,[c(C)?(i(),k(_,{key:1,n:"primary",icon:"carbon-circle-dash animate-spin",onClick:t[1]||(t[1]=s=>B())},{default:a(()=>t[8]||(t[8]=[f(" Building... ")])),_:1})):(i(),k(_,{key:0,n:"primary",icon:"carbon-edge-node",onClick:t[0]||(t[0]=s=>l())},{default:a(()=>t[7]||(t[7]=[f(" Start a new build ")])),_:1}))])])]),right:a(()=>[o.value?(i(),k(L,{key:0,current:o.value},null,8,["current"])):(i(),k(M,{key:1}))]),_:1}),d(c(y),null,{default:a(({resolve:s})=>[d(K,{"model-value":!0,onClose:g=>s(!1)},{default:a(()=>[e("div",Ce,[t[13]||(t[13]=e("h3",{class:"text-lg font-medium leading-6",mb2:""}," Start analyze build? ",-1)),t[14]||(t[14]=e("p",{op50:""}," Enter the name of the build: ",-1)),d(W,{modelValue:m.value,"onUpdate:modelValue":t[2]||(t[2]=g=>m.value=g),placeholder:"Build name"},null,8,["modelValue"]),T.value?(i(),k(Y,{key:0,"n-orange":""},{default:a(()=>t[9]||(t[9]=[f(" A build with the same name already exists, continue would overrides the previous build result. ")])),_:1})):x("",!0),t[15]||(t[15]=e("div",{my3:"","x-divider":""},null,-1)),t[16]||(t[16]=e("p",{op50:""}," The following command will be executed in your terminal: ",-1)),d(q,{code:`npx nuxi analyze --no-serve --name=${m.value}`,lang:"bash",px4:"",py2:"",border:"~ base rounded",lines:!1},null,8,["code"]),d(H,{modelValue:z.value,"onUpdate:modelValue":t[3]||(t[3]=g=>z.value=g),mt2:"",n:"primary"},{default:a(()=>t[10]||(t[10]=[f(" Navigate to terminal ")])),_:1},8,["modelValue"]),e("div",Ne,[d(_,{onClick:g=>s(!1)},{default:a(()=>t[11]||(t[11]=[f(" Cancel ")])),_:2},1032,["onClick"]),d(_,{n:"solid primary",onClick:g=>s(!0)},{default:a(()=>t[12]||(t[12]=[f(" Start ")])),_:2},1032,["onClick"])])])]),_:2},1032,["onClose"])]),_:1}),d(Z,null,{default:a(()=>[d(Q)]),_:1})],64)}}});export{Re as default};
1
+ import{g as P,h as J,r as S,j as R,f as U,k as X,l as h,m as ee,n as ne,o as te,p as le,q as ie,s as oe,v as C,w as re,x as ue,y as se,d as ae}from"./mxzg8bne.js";import{_ as de}from"./filepath-item.vue-jlqwj704.js";import{k as E,l as V,b as F,Q as i,S as u,U as e,F as p,ab as G,Y as j,a5 as v,W as x,u as c,a0 as d,$ as a,a6 as f,a8 as A,a9 as I,M as k}from"./vendor/json-editor-vue-fw81xiot.js";import{_ as me}from"./ncode-block.vue-c2t0anp9.js";import{_ as pe}from"./ncheckbox.vue-d0yw5qc1.js";import{_ as ve}from"./help-fab.vue-j6249tgf.js";import"./vendor/unocss-dypm4cev.js";import"./vendor/shiki-j4jbxo4i.js";import"./client-bnemmvey.js";const fe={"h-full":"",grid:"~ rows-[max-content_1fr]"},ye={flex:"~ wrap","w-full":""},be=["onClick"],ce={key:0,flex:"~ col gap-4 items-center justify-center",p4:""},ge={grid:"~ cols-[30px_1fr] gap-x-2 gap-y-3 items-center justify-center","w-100":""},xe=E({__name:"BuildAnalyzeDetails",props:{current:{},prev:{}},setup(N){const y=N,$=`${J().app.baseURL}/__nuxt_devtools__/analyze/`.replace(/\/+/g,"/"),b=V(()=>{const l=[{name:"Overview",id:"overview"}];return y.current.features.bundleClient&&l.push({name:"Client Bundle",id:"bundle-client"}),y.current.features.bundleNitro&&l.push({name:"Nitro Bundle",id:"bundle-nitro"}),y.current.features.viteInspect&&l.push({name:"Vite Inspect",id:"vite-inspect"}),l}),o=F(b.value[0]);function z(l){return`${((l.endTime-l.startTime)/1e3).toFixed(1)}s`}function m(l){return l<1024?`${l}B`:l<1024*1024?`${(l/1024).toFixed(1)}KB`:l<1024*1024*1024?`${(l/1024/1024).toFixed(1)}MB`:`${(l/1024/1024/1024).toFixed(1)}GB`}async function T(l){return S.clearAnalyzeBuilds(await R(),[l])}return(l,n)=>{const D=de,B=U;return i(),u("div",fe,[e("div",ye,[(i(!0),u(p,null,G(b.value,(r,t)=>(i(),u("button",{key:t,px4:"",py2:"",border:"r base",hover:"bg-active",class:j(r.id===o.value.id?"":"border-b"),onClick:_=>o.value=r},[e("div",{class:j(r.id===o.value.id?"":"op30")},v(r.name),3)],10,be))),128)),n[1]||(n[1]=e("div",{border:"b base","flex-auto":""},null,-1))]),o.value.id==="overview"?(i(),u("div",ce,[n[15]||(n[15]=e("div",{"flex-auto":""},null,-1)),e("div",ge,[n[10]||(n[10]=e("div",{"i-carbon-commit":"","text-xl":""},null,-1)),e("div",null,[n[2]||(n[2]=e("div",{"text-sm":"",op50:""}," Name ",-1)),e("div",null,v(l.current.name),1)]),n[11]||(n[11]=e("div",{"i-carbon-time":"","text-xl":""},null,-1)),e("div",null,[n[3]||(n[3]=e("div",{"text-sm":"",op50:""}," Build duration ",-1)),e("div",null,v(z(l.current)),1)]),l.current.size?.clientBundle?(i(),u(p,{key:0},[n[5]||(n[5]=e("div",{"i-carbon-cics-program":"","text-xl":""},null,-1)),e("div",null,[n[4]||(n[4]=e("div",{"text-sm":"",op50:""}," Client bundle size ",-1)),e("div",null,v(m(l.current.size.clientBundle)),1)])],64)):x("",!0),l.current.size.nitroBundle?(i(),u(p,{key:1},[n[7]||(n[7]=e("div",{"i-carbon-bare-metal-server":"","text-xl":""},null,-1)),e("div",null,[n[6]||(n[6]=e("div",{"text-sm":"",op50:""}," Nitro bundle size ",-1)),e("div",null,v(m(l.current.size.nitroBundle)),1)])],64)):x("",!0),n[12]||(n[12]=e("div",{"i-carbon-edge-node":"","text-xl":""},null,-1)),e("div",null,[n[8]||(n[8]=e("div",{"text-sm":"",op50:""}," Built ",-1)),e("div",null,v(c(P)(new Date(l.current.endTime))),1)]),n[13]||(n[13]=e("div",{"i-carbon:folder-parent":"","text-xl":""},null,-1)),e("div",null,[n[9]||(n[9]=e("div",{"text-sm":"",op50:""}," Report Path ",-1)),d(D,{filepath:l.current.analyzeDir},null,8,["filepath"])])]),n[16]||(n[16]=e("div",{"flex-auto":""},null,-1)),d(B,{n:"rose",icon:"carbon-delete",onClick:n[0]||(n[0]=r=>T(l.current.name))},{default:a(()=>n[14]||(n[14]=[f(" Delete this report ")])),_:1})])):x("",!0),n._lazyshow1||o.value.id==="bundle-client"?(n._lazyshow1=!0,i(),u(p,null,[A(e("iframe",{src:`${c($)}${l.current.slug}/client.html`,"h-full":"","w-full":""},null,8,["src"]),[[I,o.value.id==="bundle-client"]])],64)):x("v-show-if",!0),n._lazyshow2||o.value.id==="bundle-nitro"?(n._lazyshow2=!0,i(),u(p,null,[A(e("iframe",{src:`${c($)}${l.current.slug}/nitro.html`,"h-full":"","w-full":""},null,8,["src"]),[[I,o.value.id==="bundle-nitro"]])],64)):x("v-show-if",!0),n._lazyshow3||o.value.id==="vite-inspect"?(n._lazyshow3=!0,i(),u(p,null,[A(e("iframe",{src:`${c($)}${l.current.slug}/.vite-inspect/`,"h-full":"","w-full":""},null,8,["src"]),[[I,o.value.id==="vite-inspect"]])],64)):x("v-show-if",!0)])}}}),we={class:"markdown-body"},$e={__name:"analyze-build",setup(N,{expose:y}){return y({frontmatter:{}}),($,b)=>(i(),u("div",we,b[0]||(b[0]=[e("h1",null,"Build Analyze",-1),e("p",null,[f("DevTools provides a build analyze tool to help you understand the size of your app in production. Whenever you start a new build, it runs the command "),e("code",null,"nuxt build --analyze"),f(" and present the output data directly in DevTools for easy browsing and comparing.")],-1)])))}},ze={flex:"~ col"},_e=["onClick"],ke={flex:"~ gap-1 items-center wrap","w-full":"","text-sm":"",op60:""},Be={flex:"~ items-center justify-center wrap",p4:""},Ce={flex:"~ col gap-1","w-250":"",p4:""},Ne={flex:"~ gap-3",mt2:"","justify-end":""},Re=E({__name:"analyze-build",setup(N){const y=X(),w=h(),$=ee(),b=ne("analyze-build:slug",""),o=V(()=>w.value?.builds.find(r=>r.slug===b.value)??w.value?.builds[0]),z=F(!1),m=F(""),T=V(()=>w.value?.builds.some(r=>r.name===m.value.trim()));async function l(){m.value=await S.generateAnalyzeBuildName(),await y.start()&&(oe("analyze-build:start"),C.value={name:m.value,processId:await S.startAnalyzeBuild(await R(),m.value)},z.value&&B())}const n=te();function D(r){return`${((r.endTime-r.startTime)/1e3).toFixed(1)}s`}function B(){C.value?.processId&&(n.value=C.value.processId,$.push("/modules/terminals"))}return le(()=>[{id:"action:analyze-build: start",title:"Start a new analyze build",icon:"i-carbon-edge-node",action:l}]),(r,t)=>{const _=U,L=xe,M=ae,O=ie,W=re,Y=ue,q=me,H=pe,K=se,Q=$e,Z=ve;return i(),u(p,null,[d(O,{"left-size":30},{left:a(()=>[e("div",ze,[(i(!0),u(p,null,G(c(w)?.builds,s=>(i(),u(p,{key:s.slug},[e("button",{flex:"~ col gap1","hover:bg-active":"",p3:"",class:j(s.slug===o.value?.slug?"text-primary bg-active":""),onClick:g=>b.value=s.slug},[e("code",null,v(s.name),1),e("div",ke,[t[4]||(t[4]=e("div",{"i-carbon-time":""},null,-1)),e("span",null,v(D(s)),1),t[5]||(t[5]=e("div",{"flex-auto":""},null,-1)),e("span",null,v(c(P)(new Date(s.endTime))),1)])],10,_e),t[6]||(t[6]=e("div",{"x-divider":""},null,-1))],64))),128)),e("div",Be,[c(C)?(i(),k(_,{key:1,n:"primary",icon:"carbon-circle-dash animate-spin",onClick:t[1]||(t[1]=s=>B())},{default:a(()=>t[8]||(t[8]=[f(" Building... ")])),_:1})):(i(),k(_,{key:0,n:"primary",icon:"carbon-edge-node",onClick:t[0]||(t[0]=s=>l())},{default:a(()=>t[7]||(t[7]=[f(" Start a new build ")])),_:1}))])])]),right:a(()=>[o.value?(i(),k(L,{key:0,current:o.value},null,8,["current"])):(i(),k(M,{key:1}))]),_:1}),d(c(y),null,{default:a(({resolve:s})=>[d(K,{"model-value":!0,onClose:g=>s(!1)},{default:a(()=>[e("div",Ce,[t[13]||(t[13]=e("h3",{class:"text-lg font-medium leading-6",mb2:""}," Start analyze build? ",-1)),t[14]||(t[14]=e("p",{op50:""}," Enter the name of the build: ",-1)),d(W,{modelValue:m.value,"onUpdate:modelValue":t[2]||(t[2]=g=>m.value=g),placeholder:"Build name"},null,8,["modelValue"]),T.value?(i(),k(Y,{key:0,"n-orange":""},{default:a(()=>t[9]||(t[9]=[f(" A build with the same name already exists, continue would overrides the previous build result. ")])),_:1})):x("",!0),t[15]||(t[15]=e("div",{my3:"","x-divider":""},null,-1)),t[16]||(t[16]=e("p",{op50:""}," The following command will be executed in your terminal: ",-1)),d(q,{code:`npx nuxi analyze --no-serve --name=${m.value}`,lang:"bash",px4:"",py2:"",border:"~ base rounded",lines:!1},null,8,["code"]),d(H,{modelValue:z.value,"onUpdate:modelValue":t[3]||(t[3]=g=>z.value=g),mt2:"",n:"primary"},{default:a(()=>t[10]||(t[10]=[f(" Navigate to terminal ")])),_:1},8,["modelValue"]),e("div",Ne,[d(_,{onClick:g=>s(!1)},{default:a(()=>t[11]||(t[11]=[f(" Cancel ")])),_:2},1032,["onClick"]),d(_,{n:"solid primary",onClick:g=>s(!0)},{default:a(()=>t[12]||(t[12]=[f(" Start ")])),_:2},1032,["onClick"])])])]),_:2},1032,["onClose"])]),_:1}),d(Z,null,{default:a(()=>[d(Q)]),_:1})],64)}}});export{Re as default};
@@ -1,9 +1,9 @@
1
- import{y as ee,z as H,A as ce,B as pe,q as me,r as W,h as X,C as M,e as te,D as ne,v as se,E as ve,F as fe,G as le,H as ge,I as he,J as xe,K as be,x as we,L as _e,M as ye,N as $e,b as ke,O as Ce}from"./er2hcepb.js";import{_ as Ve}from"./ncheckbox.vue-hj8qatqi.js";import{_ as Pe}from"./ndropdown.vue-cmmqgxbt.js";import{_ as Ae}from"./nnavbar.vue-hzjn49l3.js";import{k as Z,b as T,ae as oe,S as i,a8 as K,a0 as d,U as t,a6 as D,F as L,ab as G,M as V,$ as h,W as S,Y as J,u as m,Q as o,l as U,X as ae,a5 as F,V as De,y as Fe,Z as Ne,al as Se}from"./vendor/json-editor-vue-gv8v06ez.js";import{_ as Ue}from"./nsection-block-f8z83agf.js";import{_ as Ie}from"./filepath-item.vue-n2otfocd.js";import{_ as Te}from"./code-snippets.vue-k22v8u0h.js";import{_ as je}from"./ndrawer.vue-gxd9fltc.js";import{D as Be}from"./constants-b32h69zq.js";import"./vendor/unocss-f0kk6o39.js";import"./vendor/shiki-ml6g43ls.js";import"./nicon-title.vue-lmnsr02i.js";import"./ncode-block.vue-bvtirmea.js";import"./client-my5lks1i.js";const Ee={key:0,"h-full":"","w-full":"",flex:"","items-center":"","justify-center":""},ze={for:"drop-zone-input","text-3xl":"",hover:"text-green cursor-pointer","transition-all":""},Le={key:1,relative:"","h-full":"","w-full":"",grid:"~ rows-[max-content_1fr_max-content]"},Oe={grid:"~ cols-minmax-8rem gap-8","overflow-auto":"",p6:""},Me={flex:"","items-center":"","justify-center":"","of-hidden":"",rounded:"","rounded-t-lg":"","bg-active":"","object-cover":"",class:"aspect-1/1",border:"~ base"},Re=["src"],Ke={flex:"~ gap1","items-center":""},qe={flex:"~ gap-2","items-center":"","justify-center":"",p8:""},Ge=Z({__name:"AssetDropZone",props:{modelValue:{type:Boolean,required:!0},folder:{type:String,required:!0}},setup(z){const l=z,f=ee(l,"modelValue"),C=T(),n=T([]);function v(s){C.value=s.target,f.value=!0}function b(s){s.target===C.value&&(f.value=!1)}function j(s){s.preventDefault()}function P(s){s.preventDefault(),x(s.dataTransfer.files)}function x(s){const c=Array.from(s||[]);if(c.length){const g=[],_=n.value.map(u=>u.name);for(const u of c)if(_.includes(u.name)){let A=1;const[y,E]=u.name.split(".");for(;_.includes(`${y} (${A}).${E}`);)A++;const R=`${y}-${A}.${E}`,a=new Blob([u],{type:u.type}),e=new File([a],R,{lastModified:Date.now()});g.push(e),_.push(R)}else u.type===""&&M({message:"Folders are not supported yet",icon:"carbon:face-dissatisfied",classes:"text-orange"}),g.push(u);n.value=[...n.value,...g]}}async function B(){if(ce.value||pe.value)return;me("assets:upload");const s=[];for(const c of n.value){const g=new FileReader;g.readAsDataURL(c);const u=(await new Promise(A=>{g.onload=()=>A(g.result)})).split(";base64,").pop();s.push({path:c.name,encoding:"base64",content:u})}await W.writeStaticAssets(await X(),[...s],l.folder).then(()=>{p(),M({message:"Files uploaded successfully!",icon:"i-carbon:checkmark"})}).catch(c=>{p(),M({message:`Error uploading files: ${c?.message??"unknown"}`,icon:"i-carbon-warning",classes:"text-red"})}),f.value=!1}function q(s){n.value?.splice(s,1)}function O(s){return URL.createObjectURL(s)}function w(s,c){const[g,_]=s.name.split("."),u=c.replace(/\.\w+$/,""),A=`${u}.${_}`;return u.length===0?(alert("File name must be at least 1 characters long"),g):(Object.defineProperty(s,"name",{value:A,writable:!1}),n.value.splice(n.value.indexOf(s),1,s),s)}function r(){n.value=[]}function p(){f.value=!1,r()}return H("dragenter",v),H("dragleave",b),H("dragover",j),H("drop",P),(s,c)=>{const g=te,_=ne,u=se,A=oe("tooltip");return o(),i("div",{fixed:"","bottom-0":"","left-13":"","right-0":"","top-0":"","z-10":"","backdrop-blur-20":"","transition-all":"",class:J(m(f)?"opacity-100 visible":"opacity-0 invisible")},[K(d(g,{icon:"carbon-close",title:"Close",absolute:"","right-5":"","top-5":"","z-20":"","text-xl":"",border:!1,onClick:p},null,512),[[A,"Close",void 0,{"bottom-end":!0}]]),n.value?.length?(o(),i("div",Le,[c[4]||(c[4]=t("div",{px6:"",py6:""},[t("h1",{"text-2xl":""}," Upload "),t("p",{"text-sm":"",op50:""}," Drag and drop files to upload ")],-1)),t("div",Oe,[(o(!0),i(L,null,G(n.value,(y,E)=>(o(),i("div",{key:y.name,flex:"~ col gap-2",relative:"","h-50":"","w-40":"","items-center":""},[t("div",Me,[t("img",{"h-full":"","w-full":"","rounded-t-lg":"","object-cover":"",src:O(y)},null,8,Re)]),t("div",Ke,[d(u,{n:"xs","h-full":"","flex-auto":"","model-value":y.name,"onUpdate:modelValue":R=>w(y,R.target.value)},null,8,["model-value","onUpdate:modelValue"]),d(g,{n:"red",icon:"carbon-trash-can","h-full":"","flex-none":"",title:"Remove file",onClick:R=>q(E)},null,8,["onClick"])])]))),128))]),t("div",qe,[n.value.length?(o(),V(g,{key:0,n:"red",onClick:r},{default:h(()=>[d(_,{icon:"carbon-clean"}),c[2]||(c[2]=D(" Clear "))]),_:1})):S("",!0),d(g,{disabled:!n.value.length,n:"primary solid",onClick:B},{default:h(()=>[d(_,{icon:"carbon-cloud-upload"}),c[3]||(c[3]=D(" Upload "))]),_:1},8,["disabled"])])])):(o(),i("div",Ee,[t("label",ze,[d(_,{icon:"carbon-cloud-upload","mr-2":""}),c[1]||(c[1]=D(" Drop files here or click to select "))]),t("input",{id:"drop-zone-input",type:"file",multiple:"",hidden:"",onChange:c[0]||(c[0]=y=>x(y.target.files))},null,32)]))],2)}}}),Ze=Z({__name:"AssetFontPreview",props:{asset:{}},setup(z){const l=z,f=U(()=>`devtools-assets-${ve(l.asset)}`);return fe(U(()=>`
1
+ import{z as ee,A as H,B as ce,C as pe,s as me,r as W,j as X,D as M,f as te,E as ne,w as se,F as ve,G as fe,H as le,I as ge,J as he,K as xe,L as be,y as we,M as ye,N as _e,O as $e,c as ke,P as Ce}from"./mxzg8bne.js";import{_ as Ve}from"./ncheckbox.vue-d0yw5qc1.js";import{_ as Pe}from"./ndropdown.vue-jksxbs6t.js";import{_ as Ae}from"./nnavbar.vue-y4opgitt.js";import{k as q,b as j,ae as oe,S as i,a8 as K,a0 as d,U as t,a6 as D,F as L,ab as Z,M as V,$ as h,W as S,Y as J,u as m,Q as o,l as U,X as ae,a5 as F,V as De,y as Fe,Z as Ne,al as Se}from"./vendor/json-editor-vue-fw81xiot.js";import{_ as Ue}from"./nsection-block-mb0wrwu4.js";import{_ as Ie}from"./filepath-item.vue-jlqwj704.js";import{_ as je}from"./code-snippets.vue-kod959e4.js";import{_ as Te}from"./ndrawer.vue-g7wzeynf.js";import{D as Be}from"./constants-b32h69zq.js";import"./vendor/unocss-dypm4cev.js";import"./vendor/shiki-j4jbxo4i.js";import"./nicon-title.vue-hch1agon.js";import"./ncode-block.vue-c2t0anp9.js";import"./client-bnemmvey.js";const Ee={key:0,"h-full":"","w-full":"",flex:"","items-center":"","justify-center":""},ze={for:"drop-zone-input","text-3xl":"",hover:"text-green cursor-pointer","transition-all":""},Le={key:1,relative:"","h-full":"","w-full":"",grid:"~ rows-[max-content_1fr_max-content]"},Oe={grid:"~ cols-minmax-8rem gap-8","overflow-auto":"",p6:""},Me={flex:"","items-center":"","justify-center":"","of-hidden":"",rounded:"","rounded-t-lg":"","bg-active":"","object-cover":"",class:"aspect-1/1",border:"~ base"},Re=["src"],Ke={flex:"~ gap1","items-center":""},Ge={flex:"~ gap-2","items-center":"","justify-center":"",p8:""},Ze=q({__name:"AssetDropZone",props:{modelValue:{type:Boolean,required:!0},folder:{type:String,required:!0}},setup(z){const l=z,f=ee(l,"modelValue"),C=j(),n=j([]);function v(s){C.value=s.target,f.value=!0}function b(s){s.target===C.value&&(f.value=!1)}function T(s){s.preventDefault()}function P(s){s.preventDefault(),x(s.dataTransfer.files)}function x(s){const c=Array.from(s||[]);if(c.length){const g=[],y=n.value.map(u=>u.name);for(const u of c)if(y.includes(u.name)){let A=1;const[_,E]=u.name.split(".");for(;y.includes(`${_} (${A}).${E}`);)A++;const R=`${_}-${A}.${E}`,a=new Blob([u],{type:u.type}),e=new File([a],R,{lastModified:Date.now()});g.push(e),y.push(R)}else u.type===""&&M({message:"Folders are not supported yet",icon:"carbon:face-dissatisfied",classes:"text-orange"}),g.push(u);n.value=[...n.value,...g]}}async function B(){if(ce.value||pe.value)return;me("assets:upload");const s=[];for(const c of n.value){const g=new FileReader;g.readAsDataURL(c);const u=(await new Promise(A=>{g.onload=()=>A(g.result)})).split(";base64,").pop();s.push({path:c.name,encoding:"base64",content:u})}await W.writeStaticAssets(await X(),[...s],l.folder).then(()=>{p(),M({message:"Files uploaded successfully!",icon:"i-carbon:checkmark"})}).catch(c=>{p(),M({message:`Error uploading files: ${c?.message??"unknown"}`,icon:"i-carbon-warning",classes:"text-red"})}),f.value=!1}function G(s){n.value?.splice(s,1)}function O(s){return URL.createObjectURL(s)}function w(s,c){const[g,y]=s.name.split("."),u=c.replace(/\.\w+$/,""),A=`${u}.${y}`;return u.length===0?(alert("File name must be at least 1 characters long"),g):(Object.defineProperty(s,"name",{value:A,writable:!1}),n.value.splice(n.value.indexOf(s),1,s),s)}function r(){n.value=[]}function p(){f.value=!1,r()}return H("dragenter",v),H("dragleave",b),H("dragover",T),H("drop",P),(s,c)=>{const g=te,y=ne,u=se,A=oe("tooltip");return o(),i("div",{fixed:"","bottom-0":"","left-13":"","right-0":"","top-0":"","z-10":"","backdrop-blur-20":"","transition-all":"",class:J(m(f)?"opacity-100 visible":"opacity-0 invisible")},[K(d(g,{icon:"carbon-close",title:"Close",absolute:"","right-5":"","top-5":"","z-20":"","text-xl":"",border:!1,onClick:p},null,512),[[A,"Close",void 0,{"bottom-end":!0}]]),n.value?.length?(o(),i("div",Le,[c[4]||(c[4]=t("div",{px6:"",py6:""},[t("h1",{"text-2xl":""}," Upload "),t("p",{"text-sm":"",op50:""}," Drag and drop files to upload ")],-1)),t("div",Oe,[(o(!0),i(L,null,Z(n.value,(_,E)=>(o(),i("div",{key:_.name,flex:"~ col gap-2",relative:"","h-50":"","w-40":"","items-center":""},[t("div",Me,[t("img",{"h-full":"","w-full":"","rounded-t-lg":"","object-cover":"",src:O(_)},null,8,Re)]),t("div",Ke,[d(u,{n:"xs","h-full":"","flex-auto":"","model-value":_.name,"onUpdate:modelValue":R=>w(_,R.target.value)},null,8,["model-value","onUpdate:modelValue"]),d(g,{n:"red",icon:"carbon-trash-can","h-full":"","flex-none":"",title:"Remove file",onClick:R=>G(E)},null,8,["onClick"])])]))),128))]),t("div",Ge,[n.value.length?(o(),V(g,{key:0,n:"red",onClick:r},{default:h(()=>[d(y,{icon:"carbon-clean"}),c[2]||(c[2]=D(" Clear "))]),_:1})):S("",!0),d(g,{disabled:!n.value.length,n:"primary solid",onClick:B},{default:h(()=>[d(y,{icon:"carbon-cloud-upload"}),c[3]||(c[3]=D(" Upload "))]),_:1},8,["disabled"])])])):(o(),i("div",Ee,[t("label",ze,[d(y,{icon:"carbon-cloud-upload","mr-2":""}),c[1]||(c[1]=D(" Drop files here or click to select "))]),t("input",{id:"drop-zone-input",type:"file",multiple:"",hidden:"",onChange:c[0]||(c[0]=_=>x(_.target.files))},null,32)]))],2)}}}),qe=q({__name:"AssetFontPreview",props:{asset:{}},setup(z){const l=z,f=U(()=>`devtools-assets-${ve(l.asset)}`);return fe(U(()=>`
2
2
  @font-face {
3
3
  font-family: '${f.value}';
4
4
  src: url('${l.asset.publicPath}');
5
5
  }
6
- `)),(C,n)=>(o(),i("div",{"of-hidden":"",style:ae({fontFamily:`'${f.value}'`})}," Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz ",4))}}),We={flex:"","items-center":"","justify-center":"","of-hidden":"","bg-active":"","object-cover":"",p1:""},Xe=["src"],He={key:2,"i-carbon-document":"","text-3xl":"",op20:""},Je={key:3,"w-full":"","self-start":"",p4:""},Qe=["textContent"],Ye={key:4},et=["src","autoplay","controls"],tt={key:5},nt={key:0,"i-carbon-volume-up":"","text-3xl":"",op20:""},ot=["src"],lt={key:6,"i-carbon-help":"","text-3xl":"",op20:""},ie=Z({__name:"AssetPreview",props:{asset:{},textContent:{},detail:{type:Boolean}},setup(z){return(l,f)=>{const C=Ze;return o(),i("div",We,[l.asset.type==="image"?(o(),i("img",{key:0,src:l.asset.publicPath},null,8,Xe)):l.asset.type==="font"?(o(),V(C,{key:l.asset.publicPath,asset:l.asset,"self-stretch":"",p2:"","text-2xl":""},null,8,["asset"])):l.asset.type==="text"&&!l.textContent?(o(),i("div",He)):l.asset.type==="text"&&l.textContent?(o(),i("div",Je,[t("pre",{"max-h-10rem":"","of-hidden":"","text-xs":"","font-mono":"",textContent:F(l.textContent)},null,8,Qe)])):l.asset.type==="video"?(o(),i("div",Ye,[t("video",{src:l.asset.publicPath,autoplay:l.detail,controls:l.detail},null,8,et)])):l.asset.type==="audio"?(o(),i("div",tt,[l.detail?(o(),i("audio",{key:1,src:l.asset.publicPath,controls:""},null,8,ot)):(o(),i("div",nt))])):(o(),i("div",lt))])}}}),st={relative:"",flex:"~ col gap-1",hover:"bg-active","items-center":"","of-hidden":"",rounded:"",p2:""},at={"w-full":"","of-hidden":"",truncate:"","ws-nowrap":"","text-center":"","text-xs":""},it=Z({__name:"AssetGridItem",props:{asset:{},folder:{}},setup(z){const l=z,f=U(()=>l.folder&&l.asset.path.startsWith(l.folder)?l.asset.path.slice(l.folder.length):l.asset.path);return(C,n)=>{const v=ne,b=ie;return o(),i("button",st,[C.asset.layer?(o(),V(v,{key:0,icon:"i-carbon-layers",absolute:"","right-4":"","top-4":"","bg-primary":""})):S("",!0),d(b,{"h-30":"","w-30":"",rounded:"",border:"~ base",asset:C.asset},null,8,["asset"]),t("div",at,F(f.value),1)])}}}),re=Z({__name:"AssetListItem",props:{item:{},index:{default:0},modelValue:{}},setup(z,{emit:l}){const f=z,n=ee(f,"modelValue",l,{passive:!0}),v=U(()=>f.item?.children?.length),b=T(!0),j=U(()=>v.value?"i-carbon-folder":f.item.type==="image"?"i-carbon-image":f.item.type==="video"?"i-carbon-video":f.item.type==="audio"?"i-carbon-volume-up":f.item.type==="font"?"i-carbon-text-small-caps":f.item.type==="text"?"i-carbon-document":f.item.type==="json"?"i-carbon-json":"i-carbon-document-blank");return(P,x)=>{const B=ne,q=re;return o(),i("div",null,[t("button",{flex:"~ gap-2","w-full":"","items-center":"",hover:"bg-active",px4:"",py1:"",style:ae({paddingLeft:`calc(1rem + ${P.index*1.5}em)`}),class:J({"bg-active":!v.value&&m(n)?.filePath===P.item?.filePath}),border:"b base",onClick:x[0]||(x[0]=O=>v.value?b.value=!b.value:n.value=P.item)},[t("div",{class:J(j.value)},null,2),t("span",{class:J({"flex items-center":v.value}),"flex-auto":"","text-start":"","text-sm":"","font-mono":""},[D(F(P.item.path)+" ",1),P.item.layer?(o(),V(B,{key:0,icon:"i-carbon-layers","bg-primary":""})):S("",!0)],2),v.value?(o(),V(B,{key:0,icon:"carbon:chevron-right","transform-rotate":b.value?90:0,transition:""},null,8,["transform-rotate"])):S("",!0)],6),b.value?De(P.$slots,"default",{key:0},()=>[(o(!0),i(L,null,G(P.item?.children,O=>(o(),V(q,{key:O.filepath,modelValue:m(n),"onUpdate:modelValue":x[1]||(x[1]=w=>Fe(n)?n.value=w:null),item:O,index:P.index+1},null,8,["modelValue","item","index"]))),128))]):S("",!0)])}}}),rt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},ut={flex:"~","items-center":"","justify-center":""},dt={"max-w-full":"","w-full":"","table-fixed":""},ct={flex:"~ gap-1","w-full":"","items-center":""},pt={flex:"~ gap-1","w-full":"","items-center":"","of-hidden":""},mt={"flex-auto":"","of-hidden":"",truncate:"","ws-pre":"","font-mono":""},vt={capitalize:""},ft={key:0},gt={op70:""},ht={flex:"~ gap2 wrap"},xt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},bt={flex:"~ gap2 wrap justify-center"},wt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},_t={flex:"~ gap2 wrap justify-center"},yt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},$t={flex:"","justify-end":"","gap-4":""},kt=Z({__name:"AssetDetails",props:{modelValue:{}},setup(z,{emit:l}){const n=ee(z,"modelValue",l,{passive:!0}),v=le(async()=>{if(n.value.type==="image")return W.getImageMeta(await X(),n.value.filePath)}),b=T(!1),j=T(),P=T(0),x=le(async()=>{if(n.value.type!=="text")return;P.value;const a=await W.getTextAssetContent(await X(),n.value.filePath);return j.value=a,a});async function B(){if(x.value!==j.value)try{await W.writeStaticAssets(await X(),[{path:n.value.path,content:j.value,override:!0}],""),b.value=!1,P.value++,M({message:"Updated",icon:"i-carbon-checkmark",classes:"text-green"})}catch(a){console.error(a),M({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const q=ge(),O=U(()=>(q.value?._installedModules||[]).some(e=>e.meta?.name==="@nuxt/image"||e.meta?.name==="@nuxt/image-edge")),w=U(()=>{const a=[];if(n.value.type==="image"){const e=v.value?.width?`
6
+ `)),(C,n)=>(o(),i("div",{"of-hidden":"",style:ae({fontFamily:`'${f.value}'`})}," Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz ",4))}}),We={flex:"","items-center":"","justify-center":"","of-hidden":"","bg-active":"","object-cover":"",p1:""},Xe=["src"],He={key:2,"i-carbon-document":"","text-3xl":"",op20:""},Je={key:3,"w-full":"","self-start":"",p4:""},Qe=["textContent"],Ye={key:4},et=["src","autoplay","controls"],tt={key:5},nt={key:0,"i-carbon-volume-up":"","text-3xl":"",op20:""},ot=["src"],lt={key:6,"i-carbon-help":"","text-3xl":"",op20:""},ie=q({__name:"AssetPreview",props:{asset:{},textContent:{},detail:{type:Boolean}},setup(z){return(l,f)=>{const C=qe;return o(),i("div",We,[l.asset.type==="image"?(o(),i("img",{key:0,src:l.asset.publicPath},null,8,Xe)):l.asset.type==="font"?(o(),V(C,{key:l.asset.publicPath,asset:l.asset,"self-stretch":"",p2:"","text-2xl":""},null,8,["asset"])):l.asset.type==="text"&&!l.textContent?(o(),i("div",He)):l.asset.type==="text"&&l.textContent?(o(),i("div",Je,[t("pre",{"max-h-10rem":"","of-hidden":"","text-xs":"","font-mono":"",textContent:F(l.textContent)},null,8,Qe)])):l.asset.type==="video"?(o(),i("div",Ye,[t("video",{src:l.asset.publicPath,autoplay:l.detail,controls:l.detail},null,8,et)])):l.asset.type==="audio"?(o(),i("div",tt,[l.detail?(o(),i("audio",{key:1,src:l.asset.publicPath,controls:""},null,8,ot)):(o(),i("div",nt))])):(o(),i("div",lt))])}}}),st={relative:"",flex:"~ col gap-1",hover:"bg-active","items-center":"","of-hidden":"",rounded:"",p2:""},at={"w-full":"","of-hidden":"",truncate:"","ws-nowrap":"","text-center":"","text-xs":""},it=q({__name:"AssetGridItem",props:{asset:{},folder:{}},setup(z){const l=z,f=U(()=>l.folder&&l.asset.path.startsWith(l.folder)?l.asset.path.slice(l.folder.length):l.asset.path);return(C,n)=>{const v=ne,b=ie;return o(),i("button",st,[C.asset.layer?(o(),V(v,{key:0,icon:"i-carbon-layers",absolute:"","right-4":"","top-4":"","bg-primary":""})):S("",!0),d(b,{"h-30":"","w-30":"",rounded:"",border:"~ base",asset:C.asset},null,8,["asset"]),t("div",at,F(f.value),1)])}}}),re=q({__name:"AssetListItem",props:{item:{},index:{default:0},modelValue:{}},setup(z,{emit:l}){const f=z,n=ee(f,"modelValue",l,{passive:!0}),v=U(()=>f.item?.children?.length),b=j(!0),T=U(()=>v.value?"i-carbon-folder":f.item.type==="image"?"i-carbon-image":f.item.type==="video"?"i-carbon-video":f.item.type==="audio"?"i-carbon-volume-up":f.item.type==="font"?"i-carbon-text-small-caps":f.item.type==="text"?"i-carbon-document":f.item.type==="json"?"i-carbon-json":"i-carbon-document-blank");return(P,x)=>{const B=ne,G=re;return o(),i("div",null,[t("button",{flex:"~ gap-2","w-full":"","items-center":"",hover:"bg-active",px4:"",py1:"",style:ae({paddingLeft:`calc(1rem + ${P.index*1.5}em)`}),class:J({"bg-active":!v.value&&m(n)?.filePath===P.item?.filePath}),border:"b base",onClick:x[0]||(x[0]=O=>v.value?b.value=!b.value:n.value=P.item)},[t("div",{class:J(T.value)},null,2),t("span",{class:J({"flex items-center":v.value}),"flex-auto":"","text-start":"","text-sm":"","font-mono":""},[D(F(P.item.path)+" ",1),P.item.layer?(o(),V(B,{key:0,icon:"i-carbon-layers","bg-primary":""})):S("",!0)],2),v.value?(o(),V(B,{key:0,icon:"carbon:chevron-right","transform-rotate":b.value?90:0,transition:""},null,8,["transform-rotate"])):S("",!0)],6),b.value?De(P.$slots,"default",{key:0},()=>[(o(!0),i(L,null,Z(P.item?.children,O=>(o(),V(G,{key:O.filepath,modelValue:m(n),"onUpdate:modelValue":x[1]||(x[1]=w=>Fe(n)?n.value=w:null),item:O,index:P.index+1},null,8,["modelValue","item","index"]))),128))]):S("",!0)])}}}),rt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},ut={flex:"~","items-center":"","justify-center":""},dt={"max-w-full":"","w-full":"","table-fixed":""},ct={flex:"~ gap-1","w-full":"","items-center":""},pt={flex:"~ gap-1","w-full":"","items-center":"","of-hidden":""},mt={"flex-auto":"","of-hidden":"",truncate:"","ws-pre":"","font-mono":""},vt={capitalize:""},ft={key:0},gt={op70:""},ht={flex:"~ gap2 wrap"},xt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},bt={flex:"~ gap2 wrap justify-center"},wt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},yt={flex:"~ gap2 wrap justify-center"},_t={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},$t={flex:"","justify-end":"","gap-4":""},kt=q({__name:"AssetDetails",props:{modelValue:{}},setup(z,{emit:l}){const n=ee(z,"modelValue",l,{passive:!0}),v=le(async()=>{if(n.value.type==="image")return W.getImageMeta(await X(),n.value.filePath)}),b=j(!1),T=j(),P=j(0),x=le(async()=>{if(n.value.type!=="text")return;P.value;const a=await W.getTextAssetContent(await X(),n.value.filePath);return T.value=a,a});async function B(){if(x.value!==T.value)try{await W.writeStaticAssets(await X(),[{path:n.value.path,content:T.value,override:!0}],""),b.value=!1,P.value++,M({message:"Updated",icon:"i-carbon-checkmark",classes:"text-green"})}catch(a){console.error(a),M({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const G=ge(),O=U(()=>(G.value?._installedModules||[]).some(e=>e.meta?.name==="@nuxt/image"||e.meta?.name==="@nuxt/image-edge"||e.meta?.name==="@nuxt/image-nightly")),w=U(()=>{const a=[];if(n.value.type==="image"){const e=v.value?.width?`
7
7
  width="${v.value.width}"
8
8
  height="${v.value.height}" `:" ";return a.push({lang:"vue-html",code:`<img${e}
9
9
  src="${n.value.publicPath}"
@@ -13,4 +13,4 @@ import{y as ee,z as H,A as ce,B as pe,q as me,r as W,h as X,C as M,e as te,D as
13
13
  src="${n.value.publicPath}"
14
14
  />`,name:"Nuxt Picture",docs:"https://image.nuxt.com/usage/nuxt-picture"}),a}return a.push({lang:"html",code:`<a download href="${n.value.publicPath}">
15
15
  Download ${n.value.path.split("/").slice(-1)[0]}
16
- </a>`,name:"Download link"}),a}),r=he(),p=xe(),s=be(()=>n.value.mtime),c=U(()=>{const a=n.value.size;return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(2)} KB`:`${(a/1024/1024).toFixed(2)} MB`}),g=U(()=>{if(!v.value?.width||!v.value?.height)return"";const a=($,I)=>I?a(I,$%I):$,e=a(v.value.width,v.value.height);return e>3?`${v.value.width/e}:${v.value.height/e}`:""}),_=U(()=>["image","text","video","audio","font"].includes(n.value.type)),u=T(!1);async function A(){try{await W.deleteStaticAsset(await X(),n.value.filePath),n.value=void 0,u.value=!1,M({message:"Asset deleted",icon:"i-carbon-checkmark",classes:"text-green"})}catch(a){console.error(a),M({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const y=T(!1),E=T("");async function R(){const a=n.value.filePath.split("/"),e=a.slice(-1)[0].split(".").slice(0,-1).join(".");if(!E.value||E.value===e)return M({message:"Please enter a new name",icon:"i-carbon-warning",classes:"text-orange"});try{const $=a.slice(-1)[0].split(".").slice(-1)[0],I=`${a.slice(0,-1).join("/")}/${E.value}.${$}`;await W.renameStaticAsset(await X(),n.value.filePath,I),n.value=void 0,y.value=!1,M({message:"Asset renamed",icon:"i-carbon-checkmark",classes:"text-green"})}catch($){console.error($),M({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}return(a,e)=>{const $=ie,I=Ie,N=te,ue=Te,Q=we,de=se,Y=oe("tooltip");return o(),i(L,null,[t("div",rt,[_.value?(o(),i(L,{key:0},[e[13]||(e[13]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Preview "),t("div",{"x-divider":""})],-1)),t("div",ut,[d($,{detail:"","max-h-80":"","min-h-20":"","min-w-20":"","w-auto":"",rounded:"",border:"~ base",asset:m(n),"text-content":m(x)},null,8,["asset","text-content"])])],64)):S("",!0),e[25]||(e[25]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Details "),t("div",{"x-divider":""})],-1)),t("table",dt,[t("tbody",null,[t("tr",null,[e[14]||(e[14]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Filepath ",-1)),t("td",null,[t("div",ct,[d(I,{filepath:m(n).filePath,"text-left":""},null,8,["filepath"]),K(d(N,{"flex-none":"",title:"Open in Editor",icon:"carbon-launch",border:!1,onClick:e[0]||(e[0]=k=>m(p)(m(n).filePath))},null,512),[[Y,"Open in Editor"]])])])]),t("tr",null,[e[15]||(e[15]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Public Path ",-1)),t("td",null,[t("div",pt,[t("div",mt,F(m(n).publicPath),1),K(d(N,{"flex-none":"",title:"Copy public path",icon:"carbon-copy",border:!1,onClick:e[1]||(e[1]=k=>m(r)(m(n).publicPath,"assets-public-path"))},null,512),[[Y,"Copy public path"]]),K(d(N,{"flex-none":"",to:m(n).publicPath,icon:"carbon-launch",target:"_blank",border:!1,title:"Open in browser"},null,8,["to"]),[[Y,"Open in browser"]])])])]),t("tr",null,[e[16]||(e[16]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Type ",-1)),t("td",vt,F(m(n).type),1)]),m(v)?.width?(o(),i(L,{key:0},[t("tr",null,[e[17]||(e[17]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Image Size ",-1)),t("td",null,F(m(v).width)+" x "+F(m(v).height),1)]),g.value?(o(),i("tr",ft,[e[18]||(e[18]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Aspect Ratio ",-1)),t("td",null,F(g.value),1)])):S("",!0)],64)):S("",!0),t("tr",null,[e[19]||(e[19]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," File size ",-1)),t("td",null,F(c.value),1)]),t("tr",null,[e[20]||(e[20]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Last modified ",-1)),t("td",null,[D(F(new Date(m(n).mtime).toLocaleString())+" ",1),t("span",gt,"("+F(m(s))+")",1)])])])]),e[26]||(e[26]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Actions "),t("div",{"x-divider":""})],-1)),t("div",ht,[d(N,{to:m(n).publicPath,download:"",target:"_blank",icon:"carbon-download",n:"green"},{default:h(()=>e[21]||(e[21]=[D(" Download ")])),_:1},8,["to"]),m(n).type==="text"?(o(),V(N,{key:0,icon:"carbon-edit",n:"cyan",onClick:e[2]||(e[2]=k=>b.value=!b.value)},{default:h(()=>e[22]||(e[22]=[D(" Edit ")])),_:1})):S("",!0),d(N,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:e[3]||(e[3]=k=>y.value=!y.value)},{default:h(()=>e[23]||(e[23]=[D(" Rename ")])),_:1}),d(N,{icon:"carbon-delete",n:"red",onClick:e[4]||(e[4]=k=>u.value=!u.value)},{default:h(()=>e[24]||(e[24]=[D(" Delete ")])),_:1})]),e[27]||(e[27]=t("div",{"flex-auto":""},null,-1)),w.value.length?(o(),V(ue,{key:1,border:"t base","mx--4":"","mb--4":"","code-snippets":w.value},null,8,["code-snippets"])):S("",!0)]),d(Q,{modelValue:u.value,"onUpdate:modelValue":e[6]||(e[6]=k=>u.value=k)},{default:h(()=>[t("div",xt,[e[30]||(e[30]=t("span",null," Are you sure you want to delete this asset? ",-1)),t("div",bt,[d(N,{icon:"carbon-close",onClick:e[5]||(e[5]=k=>u.value=!1)},{default:h(()=>e[28]||(e[28]=[D(" Cancel ")])),_:1}),d(N,{icon:"carbon-delete",n:"red",onClick:A},{default:h(()=>e[29]||(e[29]=[D(" Delete ")])),_:1})])])]),_:1},8,["modelValue"]),d(Q,{modelValue:y.value,"onUpdate:modelValue":e[9]||(e[9]=k=>y.value=k)},{default:h(()=>[t("div",wt,[d(de,{modelValue:E.value,"onUpdate:modelValue":e[7]||(e[7]=k=>E.value=k),placeholder:"New name",n:"blue"},null,8,["modelValue"]),t("div",_t,[d(N,{icon:"carbon-close",onClick:e[8]||(e[8]=k=>y.value=!1)},{default:h(()=>e[31]||(e[31]=[D(" Cancel ")])),_:1}),d(N,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:R},{default:h(()=>e[32]||(e[32]=[D(" Rename ")])),_:1})])])]),_:1},8,["modelValue"]),m(n).type==="text"?(o(),V(Q,{key:0,modelValue:b.value,"onUpdate:modelValue":e[12]||(e[12]=k=>b.value=k)},{default:h(()=>[t("div",yt,[K(t("textarea",{"onUpdate:modelValue":e[10]||(e[10]=k=>j.value=k),placeholder:"Item value...",class:"h-lg w-xl of-auto rounded-lg p-4 text-sm font-mono outline-none",onKeydown:Ne(B,["enter"])},null,544),[[Se,j.value]]),t("div",$t,[d(N,{icon:"carbon-close",onClick:e[11]||(e[11]=k=>b.value=!1)},{default:h(()=>e[33]||(e[33]=[D(" Cancel ")])),_:1}),d(N,{icon:"carbon:save",n:"primary",onClick:B},{default:h(()=>e[34]||(e[34]=[D(" save ")])),_:1})])])]),_:1},8,["modelValue"])):S("",!0)],64)}}}),Ct={"h-full":"","of-auto":""},Vt={"flex-none":"",flex:"~ gap2 items-center","text-lg":""},Pt={flex:"~ items-center justify-center",absolute:"","bottom--1":"","right--1":"","h-4":"","w-4":"","rounded-full":"","bg-primary:30":"","text-8px":""},At={flex:"~ col","w-30":"","of-auto":""},Dt={"text-xs":"",op75:""},Ft={op50:""},Nt={key:0},St={"mt--4":"",px2:"",grid:"~ cols-minmax-8rem"},Ut={key:1,p2:"",grid:"~ cols-minmax-8rem"},It={key:1},Ht=Z({__name:"assets",setup(z){const l=_e(),f=T(!1),C=T(""),n=U(()=>new ye(l.value||[],{keys:["path"]})),v=$e(()=>{const w=[];for(const r of l.value||[]){const p=r.path.split(".").pop();p&&!w.find(s=>s.name===p)&&w.push({name:p,value:!0})}return w}),b=U(()=>(C.value?n.value.search(C.value).map(r=>r.item):l.value||[]).filter(r=>{const p=r.path.split(".").pop();return!p||v.some(s=>s.name===p&&s.value)})),j=U(()=>{const w={};for(const r of b.value){const p=`${r.path.split("/").slice(0,-1).join("/")}/`;w[p]||(w[p]=[]),w[p].push(r)}return Object.entries(w).sort(([r],[p])=>r.localeCompare(p))}),P=U(()=>{const w={path:"public",children:[]},r=(p,s,c)=>{const[g,..._]=s;let u=p.children.find(A=>A.path===g);u||(u={...c,path:g,children:[]},p.children.push(u)),_.length>1?r(u,_,c):_.length===1&&u.children.push({...c,path:_[0]})};return b.value.forEach(p=>{const s=p.path.split("/").filter(c=>c!=="");r(w,s,p)}),w.children}),x=T(),{view:B}=ke("assets");function q(){B.value=B.value==="list"?"grid":"list"}Ce("Escape",()=>{x.value=void 0});const O=T();return(w,r)=>{const p=te,s=Ve,c=Pe,g=Ae,_=Ge,u=it,A=Ue,y=re,E=kt,R=je,a=oe("tooltip");return o(),i("div",Ct,[d(g,{ref_key:"navbar",ref:O,search:C.value,"onUpdate:search":r[1]||(r[1]=e=>C.value=e),pb2:""},{actions:h(()=>[t("div",Vt,[K(d(p,{icon:"carbon:cloud-upload",title:"File Upload",border:!1,onClick:r[0]||(r[0]=e=>f.value=!f.value)},null,512),[[a,"File Upload",void 0,{"bottom-end":!0}]]),m(v).length?(o(),V(c,{key:0,direction:"end",n:"sm primary"},{trigger:h(({click:e})=>[K(d(p,{icon:"carbon-filter",border:!1,title:"Filter",p3:"","text-lg":"",onClick:$=>e()},null,8,["onClick"]),[[a,"Filter",void 0,{"bottom-end":!0}]]),t("span",Pt,F(m(v).length),1)]),default:h(()=>[t("div",At,[(o(!0),i(L,null,G(m(v),e=>(o(),V(s,{key:e.name,modelValue:e.value,"onUpdate:modelValue":$=>e.value=$,flex:"~ gap-2",rounded:"",px2:"",py2:""},{default:h(()=>[t("span",Dt,F(e.name),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]))),128))])]),_:1})):S("",!0),K(d(p,{"text-lg":"",border:!1,icon:m(B)==="grid"?"i-carbon-list":"i-carbon-grid",title:"Toggle view",onClick:q},null,8,["icon"]),[[a,"Toggle View",void 0,{"bottom-end":!0}]])])]),default:h(()=>[t("div",Ft,[C.value?(o(),i("span",Nt,F(b.value.length)+" matched · ",1)):S("",!0),t("span",null,F(m(l)?.length)+" assets in total",1)])]),_:1},8,["search"]),d(_,{modelValue:f.value,"onUpdate:modelValue":r[2]||(r[2]=e=>f.value=e),folder:"/"},null,8,["modelValue"]),m(B)==="grid"?(o(),i(L,{key:0},[j.value.length>1?(o(!0),i(L,{key:0},G(j.value,([e,$])=>(o(),V(A,{key:e,text:e,description:`${$.length} items`,open:$.length<=m(Be),padding:!1},{default:h(()=>[t("div",St,[(o(!0),i(L,null,G($,I=>(o(),V(u,{key:I.path,asset:I,folder:e,onClick:N=>x.value=I},null,8,["asset","folder","onClick"]))),128))])]),_:2},1032,["text","description","open"]))),128)):(o(),i("div",Ut,[(o(!0),i(L,null,G(b.value,e=>(o(),V(u,{key:e.path,asset:e,onClick:$=>x.value=e},null,8,["asset","onClick"]))),128))]))],64)):(o(),i("div",It,[(o(!0),i(L,null,G(P.value,(e,$)=>(o(),V(y,{key:$,modelValue:x.value,"onUpdate:modelValue":r[3]||(r[3]=I=>x.value=I),item:e},null,8,["modelValue","item"]))),128))])),d(R,{"model-value":!!x.value,"auto-close":"","w-120":"",top:O.value,onClose:r[5]||(r[5]=e=>x.value=void 0)},{default:h(()=>[x.value?(o(),V(E,{key:0,modelValue:x.value,"onUpdate:modelValue":r[4]||(r[4]=e=>x.value=e)},null,8,["modelValue"])):S("",!0)]),_:1},8,["model-value","top"])])}}});export{Ht as default};
16
+ </a>`,name:"Download link"}),a}),r=he(),p=xe(),s=be(()=>n.value.mtime),c=U(()=>{const a=n.value.size;return a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(2)} KB`:`${(a/1024/1024).toFixed(2)} MB`}),g=U(()=>{if(!v.value?.width||!v.value?.height)return"";const a=($,I)=>I?a(I,$%I):$,e=a(v.value.width,v.value.height);return e>3?`${v.value.width/e}:${v.value.height/e}`:""}),y=U(()=>["image","text","video","audio","font"].includes(n.value.type)),u=j(!1);async function A(){try{await W.deleteStaticAsset(await X(),n.value.filePath),n.value=void 0,u.value=!1,M({message:"Asset deleted",icon:"i-carbon-checkmark",classes:"text-green"})}catch(a){console.error(a),M({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const _=j(!1),E=j("");async function R(){const a=n.value.filePath.split("/"),e=a.slice(-1)[0].split(".").slice(0,-1).join(".");if(!E.value||E.value===e)return M({message:"Please enter a new name",icon:"i-carbon-warning",classes:"text-orange"});try{const $=a.slice(-1)[0].split(".").slice(-1)[0],I=`${a.slice(0,-1).join("/")}/${E.value}.${$}`;await W.renameStaticAsset(await X(),n.value.filePath,I),n.value=void 0,_.value=!1,M({message:"Asset renamed",icon:"i-carbon-checkmark",classes:"text-green"})}catch($){console.error($),M({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}return(a,e)=>{const $=ie,I=Ie,N=te,ue=je,Q=we,de=se,Y=oe("tooltip");return o(),i(L,null,[t("div",rt,[y.value?(o(),i(L,{key:0},[e[13]||(e[13]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Preview "),t("div",{"x-divider":""})],-1)),t("div",ut,[d($,{detail:"","max-h-80":"","min-h-20":"","min-w-20":"","w-auto":"",rounded:"",border:"~ base",asset:m(n),"text-content":m(x)},null,8,["asset","text-content"])])],64)):S("",!0),e[25]||(e[25]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Details "),t("div",{"x-divider":""})],-1)),t("table",dt,[t("tbody",null,[t("tr",null,[e[14]||(e[14]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Filepath ",-1)),t("td",null,[t("div",ct,[d(I,{filepath:m(n).filePath,"text-left":""},null,8,["filepath"]),K(d(N,{"flex-none":"",title:"Open in Editor",icon:"carbon-launch",border:!1,onClick:e[0]||(e[0]=k=>m(p)(m(n).filePath))},null,512),[[Y,"Open in Editor"]])])])]),t("tr",null,[e[15]||(e[15]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Public Path ",-1)),t("td",null,[t("div",pt,[t("div",mt,F(m(n).publicPath),1),K(d(N,{"flex-none":"",title:"Copy public path",icon:"carbon-copy",border:!1,onClick:e[1]||(e[1]=k=>m(r)(m(n).publicPath,"assets-public-path"))},null,512),[[Y,"Copy public path"]]),K(d(N,{"flex-none":"",to:m(n).publicPath,icon:"carbon-launch",target:"_blank",border:!1,title:"Open in browser"},null,8,["to"]),[[Y,"Open in browser"]])])])]),t("tr",null,[e[16]||(e[16]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Type ",-1)),t("td",vt,F(m(n).type),1)]),m(v)?.width?(o(),i(L,{key:0},[t("tr",null,[e[17]||(e[17]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Image Size ",-1)),t("td",null,F(m(v).width)+" x "+F(m(v).height),1)]),g.value?(o(),i("tr",ft,[e[18]||(e[18]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Aspect Ratio ",-1)),t("td",null,F(g.value),1)])):S("",!0)],64)):S("",!0),t("tr",null,[e[19]||(e[19]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," File size ",-1)),t("td",null,F(c.value),1)]),t("tr",null,[e[20]||(e[20]=t("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Last modified ",-1)),t("td",null,[D(F(new Date(m(n).mtime).toLocaleString())+" ",1),t("span",gt,"("+F(m(s))+")",1)])])])]),e[26]||(e[26]=t("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[t("div",{"x-divider":""}),t("div",{"flex-none":""}," Actions "),t("div",{"x-divider":""})],-1)),t("div",ht,[d(N,{to:m(n).publicPath,download:"",target:"_blank",icon:"carbon-download",n:"green"},{default:h(()=>e[21]||(e[21]=[D(" Download ")])),_:1},8,["to"]),m(n).type==="text"?(o(),V(N,{key:0,icon:"carbon-edit",n:"cyan",onClick:e[2]||(e[2]=k=>b.value=!b.value)},{default:h(()=>e[22]||(e[22]=[D(" Edit ")])),_:1})):S("",!0),d(N,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:e[3]||(e[3]=k=>_.value=!_.value)},{default:h(()=>e[23]||(e[23]=[D(" Rename ")])),_:1}),d(N,{icon:"carbon-delete",n:"red",onClick:e[4]||(e[4]=k=>u.value=!u.value)},{default:h(()=>e[24]||(e[24]=[D(" Delete ")])),_:1})]),e[27]||(e[27]=t("div",{"flex-auto":""},null,-1)),w.value.length?(o(),V(ue,{key:1,border:"t base","mx--4":"","mb--4":"","code-snippets":w.value},null,8,["code-snippets"])):S("",!0)]),d(Q,{modelValue:u.value,"onUpdate:modelValue":e[6]||(e[6]=k=>u.value=k)},{default:h(()=>[t("div",xt,[e[30]||(e[30]=t("span",null," Are you sure you want to delete this asset? ",-1)),t("div",bt,[d(N,{icon:"carbon-close",onClick:e[5]||(e[5]=k=>u.value=!1)},{default:h(()=>e[28]||(e[28]=[D(" Cancel ")])),_:1}),d(N,{icon:"carbon-delete",n:"red",onClick:A},{default:h(()=>e[29]||(e[29]=[D(" Delete ")])),_:1})])])]),_:1},8,["modelValue"]),d(Q,{modelValue:_.value,"onUpdate:modelValue":e[9]||(e[9]=k=>_.value=k)},{default:h(()=>[t("div",wt,[d(de,{modelValue:E.value,"onUpdate:modelValue":e[7]||(e[7]=k=>E.value=k),placeholder:"New name",n:"blue"},null,8,["modelValue"]),t("div",yt,[d(N,{icon:"carbon-close",onClick:e[8]||(e[8]=k=>_.value=!1)},{default:h(()=>e[31]||(e[31]=[D(" Cancel ")])),_:1}),d(N,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:R},{default:h(()=>e[32]||(e[32]=[D(" Rename ")])),_:1})])])]),_:1},8,["modelValue"]),m(n).type==="text"?(o(),V(Q,{key:0,modelValue:b.value,"onUpdate:modelValue":e[12]||(e[12]=k=>b.value=k)},{default:h(()=>[t("div",_t,[K(t("textarea",{"onUpdate:modelValue":e[10]||(e[10]=k=>T.value=k),placeholder:"Item value...",class:"h-lg w-xl of-auto rounded-lg p-4 text-sm font-mono outline-none",onKeydown:Ne(B,["enter"])},null,544),[[Se,T.value]]),t("div",$t,[d(N,{icon:"carbon-close",onClick:e[11]||(e[11]=k=>b.value=!1)},{default:h(()=>e[33]||(e[33]=[D(" Cancel ")])),_:1}),d(N,{icon:"carbon:save",n:"primary",onClick:B},{default:h(()=>e[34]||(e[34]=[D(" save ")])),_:1})])])]),_:1},8,["modelValue"])):S("",!0)],64)}}}),Ct={"h-full":"","of-auto":""},Vt={"flex-none":"",flex:"~ gap2 items-center","text-lg":""},Pt={flex:"~ items-center justify-center",absolute:"","bottom--1":"","right--1":"","h-4":"","w-4":"","rounded-full":"","bg-primary:30":"","text-8px":""},At={flex:"~ col","w-30":"","of-auto":""},Dt={"text-xs":"",op75:""},Ft={op50:""},Nt={key:0},St={"mt--4":"",px2:"",grid:"~ cols-minmax-8rem"},Ut={key:1,p2:"",grid:"~ cols-minmax-8rem"},It={key:1},Ht=q({__name:"assets",setup(z){const l=ye(),f=j(!1),C=j(""),n=U(()=>new _e(l.value||[],{keys:["path"]})),v=$e(()=>{const w=[];for(const r of l.value||[]){const p=r.path.split(".").pop();p&&!w.find(s=>s.name===p)&&w.push({name:p,value:!0})}return w}),b=U(()=>(C.value?n.value.search(C.value).map(r=>r.item):l.value||[]).filter(r=>{const p=r.path.split(".").pop();return!p||v.some(s=>s.name===p&&s.value)})),T=U(()=>{const w={};for(const r of b.value){const p=`${r.path.split("/").slice(0,-1).join("/")}/`;w[p]||(w[p]=[]),w[p].push(r)}return Object.entries(w).sort(([r],[p])=>r.localeCompare(p))}),P=U(()=>{const w={path:"public",children:[]},r=(p,s,c)=>{const[g,...y]=s;let u=p.children.find(A=>A.path===g);u||(u={...c,path:g,children:[]},p.children.push(u)),y.length>1?r(u,y,c):y.length===1&&u.children.push({...c,path:y[0]})};return b.value.forEach(p=>{const s=p.path.split("/").filter(c=>c!=="");r(w,s,p)}),w.children}),x=j(),{view:B}=ke("assets");function G(){B.value=B.value==="list"?"grid":"list"}Ce("Escape",()=>{x.value=void 0});const O=j();return(w,r)=>{const p=te,s=Ve,c=Pe,g=Ae,y=Ze,u=it,A=Ue,_=re,E=kt,R=Te,a=oe("tooltip");return o(),i("div",Ct,[d(g,{ref_key:"navbar",ref:O,search:C.value,"onUpdate:search":r[1]||(r[1]=e=>C.value=e),pb2:""},{actions:h(()=>[t("div",Vt,[K(d(p,{icon:"carbon:cloud-upload",title:"File Upload",border:!1,onClick:r[0]||(r[0]=e=>f.value=!f.value)},null,512),[[a,"File Upload",void 0,{"bottom-end":!0}]]),m(v).length?(o(),V(c,{key:0,direction:"end",n:"sm primary"},{trigger:h(({click:e})=>[K(d(p,{icon:"carbon-filter",border:!1,title:"Filter",p3:"","text-lg":"",onClick:$=>e()},null,8,["onClick"]),[[a,"Filter",void 0,{"bottom-end":!0}]]),t("span",Pt,F(m(v).length),1)]),default:h(()=>[t("div",At,[(o(!0),i(L,null,Z(m(v),e=>(o(),V(s,{key:e.name,modelValue:e.value,"onUpdate:modelValue":$=>e.value=$,flex:"~ gap-2",rounded:"",px2:"",py2:""},{default:h(()=>[t("span",Dt,F(e.name),1)]),_:2},1032,["modelValue","onUpdate:modelValue"]))),128))])]),_:1})):S("",!0),K(d(p,{"text-lg":"",border:!1,icon:m(B)==="grid"?"i-carbon-list":"i-carbon-grid",title:"Toggle view",onClick:G},null,8,["icon"]),[[a,"Toggle View",void 0,{"bottom-end":!0}]])])]),default:h(()=>[t("div",Ft,[C.value?(o(),i("span",Nt,F(b.value.length)+" matched · ",1)):S("",!0),t("span",null,F(m(l)?.length)+" assets in total",1)])]),_:1},8,["search"]),d(y,{modelValue:f.value,"onUpdate:modelValue":r[2]||(r[2]=e=>f.value=e),folder:"/"},null,8,["modelValue"]),m(B)==="grid"?(o(),i(L,{key:0},[T.value.length>1?(o(!0),i(L,{key:0},Z(T.value,([e,$])=>(o(),V(A,{key:e,text:e,description:`${$.length} items`,open:$.length<=m(Be),padding:!1},{default:h(()=>[t("div",St,[(o(!0),i(L,null,Z($,I=>(o(),V(u,{key:I.path,asset:I,folder:e,onClick:N=>x.value=I},null,8,["asset","folder","onClick"]))),128))])]),_:2},1032,["text","description","open"]))),128)):(o(),i("div",Ut,[(o(!0),i(L,null,Z(b.value,e=>(o(),V(u,{key:e.path,asset:e,onClick:$=>x.value=e},null,8,["asset","onClick"]))),128))]))],64)):(o(),i("div",It,[(o(!0),i(L,null,Z(P.value,(e,$)=>(o(),V(_,{key:$,modelValue:x.value,"onUpdate:modelValue":r[3]||(r[3]=I=>x.value=I),item:e},null,8,["modelValue","item"]))),128))])),d(R,{"model-value":!!x.value,"auto-close":"","w-120":"",top:O.value,onClose:r[5]||(r[5]=e=>x.value=void 0)},{default:h(()=>[x.value?(o(),V(E,{key:0,modelValue:x.value,"onUpdate:modelValue":r[4]||(r[4]=e=>x.value=e)},null,8,["modelValue"])):S("",!0)]),_:1},8,["model-value","top"])])}}});export{Ht as default};
@@ -1 +1 @@
1
- {"id":"a420b23e-eff0-4a26-9593-f64aed27b3ae","timestamp":1735205262713}
1
+ {"id":"7235b424-6975-4a9d-93d7-43e41c8bf0d0","timestamp":1737018546641}
@@ -0,0 +1 @@
1
+ {"id":"7235b424-6975-4a9d-93d7-43e41c8bf0d0","timestamp":1737018546641,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -1 +1 @@
1
- import{j as f,H as r}from"./vendor/json-editor-vue-gv8v06ez.js";let e;const n=[];function s(i){if(n.push(i),!(typeof window>"u"))return window.__NUXT_DEVTOOLS__&&n.forEach(o=>o(window.__NUXT_DEVTOOLS__)),Object.defineProperty(window,"__NUXT_DEVTOOLS__",{set(o){o&&n.forEach(t=>t(o))},get(){return e.value},configurable:!0}),()=>{n.splice(n.indexOf(i),1)}}function u(){e||(e=f(),s(o));function i(){e&&r(e)}function o(t){e.value=t,t.host&&t.host.hooks.hook("host:update:reactivity",i)}return e}const c=u();export{c as d};
1
+ import{j as f,H as r}from"./vendor/json-editor-vue-fw81xiot.js";let e;const n=[];function s(i){if(n.push(i),!(typeof window>"u"))return window.__NUXT_DEVTOOLS__&&n.forEach(o=>o(window.__NUXT_DEVTOOLS__)),Object.defineProperty(window,"__NUXT_DEVTOOLS__",{set(o){o&&n.forEach(t=>t(o))},get(){return e.value},configurable:!0}),()=>{n.splice(n.indexOf(i),1)}}function u(){e||(e=f(),s(o));function i(){e&&r(e)}function o(t){e.value=t,t.host&&t.host.hooks.hook("host:update:reactivity",i)}return e}const c=u();export{c as d};