@nuxt/devtools 1.0.0-beta.0 → 1.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 (120) hide show
  1. package/dist/chunks/module-main.mjs +148 -46
  2. package/dist/chunks/vscode.mjs +3 -1
  3. package/dist/client/200.html +24 -24
  4. package/dist/client/404.html +24 -24
  5. package/dist/client/__blank/index.html +42 -0
  6. package/dist/client/_nuxt/{CodeDiff.vue.3beaa134.js → CodeDiff.vue.b74b0167.js} +1 -1
  7. package/dist/client/_nuxt/{ComposableItem.vue.136c5104.js → ComposableItem.vue.66a98e20.js} +1 -1
  8. package/dist/client/_nuxt/{DataSchemaButton.vue.125423b7.js → DataSchemaButton.vue.b30dcd6f.js} +1 -1
  9. package/dist/client/_nuxt/{DataSchemaDrawer.8ac6b677.js → DataSchemaDrawer.d00941d6.js} +1 -1
  10. package/dist/client/_nuxt/{DurationDisplay.vue.c49b4e64.js → DurationDisplay.vue.5b7cc04d.js} +1 -1
  11. package/dist/client/_nuxt/{FilepathItem.vue.5af0b5df.js → FilepathItem.vue.6dd69314.js} +1 -1
  12. package/dist/client/_nuxt/{HelpFab.vue.98c902f4.js → HelpFab.vue.314bc83b.js} +1 -1
  13. package/dist/client/_nuxt/LaunchPage.vue.017c62ce.js +1 -0
  14. package/dist/client/_nuxt/{NBadge.98d5d309.js → NBadge.e849763e.js} +1 -1
  15. package/dist/client/_nuxt/NCheckbox.vue.cf7e1e9d.js +1 -0
  16. package/dist/client/_nuxt/{NCodeBlock.vue.adf1e9b4.js → NCodeBlock.vue.882d562f.js} +2 -2
  17. package/dist/client/_nuxt/{NDrawer.vue.8e620517.js → NDrawer.vue.a4010d93.js} +1 -1
  18. package/dist/client/_nuxt/{NDropdown.vue.b2f7aaef.js → NDropdown.vue.3b1768f5.js} +1 -1
  19. package/dist/client/_nuxt/{NIconTitle.vue.bf8093eb.js → NIconTitle.vue.71113a3f.js} +1 -1
  20. package/dist/client/_nuxt/{NLink.vue.0e98999b.js → NLink.vue.a09685db.js} +1 -1
  21. package/dist/client/_nuxt/{NMarkdown.vue.b0e8b2fc.js → NMarkdown.vue.13c5f0c3.js} +1 -1
  22. package/dist/client/_nuxt/NNavbar.vue.d9a029e0.js +1 -0
  23. package/dist/client/_nuxt/{NSectionBlock.4347cc14.js → NSectionBlock.7f41e147.js} +1 -1
  24. package/dist/client/_nuxt/{NSelect.vue.4c22d30e.js → NSelect.vue.e7f8c81a.js} +1 -1
  25. package/dist/client/_nuxt/{NSelectTabs.vue.c9be0aa2.js → NSelectTabs.vue.ddc009ff.js} +1 -1
  26. package/dist/client/_nuxt/{NSwitch.vue.de333089.js → NSwitch.vue.8d3010b0.js} +1 -1
  27. package/dist/client/_nuxt/{NTip.vue.770a171a.js → NTip.vue.3f5fb5a1.js} +1 -1
  28. package/dist/client/_nuxt/{StateEditor.vue.332bb451.js → StateEditor.vue.162475d5.js} +1 -1
  29. package/dist/client/_nuxt/__blank.f49c5a73.js +1 -0
  30. package/dist/client/_nuxt/analyze-build.988e7c9e.js +1 -0
  31. package/dist/client/_nuxt/assets.2b649247.js +16 -0
  32. package/dist/client/_nuxt/{client.3f2665f1.js → client.253674ec.js} +1 -1
  33. package/dist/client/_nuxt/components.7583b49c.js +98 -0
  34. package/dist/client/_nuxt/{constants.4e5eba24.js → constants.2cc6e981.js} +1 -1
  35. package/dist/client/_nuxt/{css.a67813b3.js → css.f61fd02b.js} +3 -3
  36. package/dist/client/_nuxt/custom-_name_.0e141ac3.js +1 -0
  37. package/dist/client/_nuxt/{default.3ba7d10b.js → default.a50dad07.js} +1 -1
  38. package/dist/client/_nuxt/entry.3dd66f35.js +27 -0
  39. package/dist/client/_nuxt/entry.960c025a.css +1 -0
  40. package/dist/client/_nuxt/{error-404.9d2aaad9.js → error-404.429edf81.js} +1 -1
  41. package/dist/client/_nuxt/{error-500.20d1b3ce.js → error-500.9e83b20b.js} +1 -1
  42. package/dist/client/_nuxt/{full.6d0fd7cf.js → full.c90b8ab9.js} +1 -1
  43. package/dist/client/_nuxt/{hooks.908144b2.js → hooks.40588927.js} +1 -1
  44. package/dist/client/_nuxt/{html.af01869e.js → html.14085b69.js} +1 -1
  45. package/dist/client/_nuxt/imports.7b590e48.js +1 -0
  46. package/dist/client/_nuxt/index.8013a14e.js +17 -0
  47. package/dist/client/_nuxt/{index.eb95211d.js → index.90ae56cb.js} +1 -1
  48. package/dist/client/_nuxt/json-editor-vue.465dc720.js +129 -0
  49. package/dist/client/_nuxt/{middleware.9e4b2529.js → middleware.72aa446e.js} +1 -1
  50. package/dist/client/_nuxt/modules.d997669f.js +2 -0
  51. package/dist/client/_nuxt/{none.27bf71df.js → none.ab2b300f.js} +1 -1
  52. package/dist/client/_nuxt/open-graph.1cc10683.js +3 -0
  53. package/dist/client/_nuxt/{overview.4991be1e.js → overview.014aea35.js} +1 -1
  54. package/dist/client/_nuxt/pages.7f7e1a57.js +1 -0
  55. package/dist/client/_nuxt/{payload.eaf10e21.js → payload.58a8bb6b.js} +1 -1
  56. package/dist/client/_nuxt/{plugins.f02b2c56.js → plugins.1f073986.js} +1 -1
  57. package/dist/client/_nuxt/runtime-configs.6d4dd513.js +1 -0
  58. package/dist/client/_nuxt/server-routes.b5fc14db.js +9 -0
  59. package/dist/client/_nuxt/settings.04d1166d.js +1 -0
  60. package/dist/client/_nuxt/shellscript.e25d1410.js +4 -0
  61. package/dist/client/_nuxt/{state-components.ca4a58b1.js → state-components.c2be3414.js} +1 -1
  62. package/dist/client/_nuxt/state-modules.5bf4563c.js +1 -0
  63. package/dist/client/_nuxt/storage-options.2224e06b.js +1 -0
  64. package/dist/client/_nuxt/{storage.27117a31.js → storage.8cd70b69.js} +1 -1
  65. package/dist/client/_nuxt/{terminals.cdead889.js → terminals.ce3bbf0e.js} +2 -2
  66. package/dist/client/_nuxt/timeline.23647b38.js +29 -0
  67. package/dist/client/_nuxt/{unocss-runtime.ddd835d7.js → unocss-runtime.41db0d67.js} +2 -2
  68. package/dist/client/_nuxt/virtual-files.bc5e9072.js +1 -0
  69. package/dist/client/_nuxt/{vitesse-dark.ab479e3d.js → vitesse-dark.ff0e7dcb.js} +1 -1
  70. package/dist/client/_nuxt/{vitesse-light.696edcfd.js → vitesse-light.c6996724.js} +1 -1
  71. package/dist/client/_nuxt/{vue-html.0806679f.js → vue-html.88dda4a8.js} +1 -1
  72. package/dist/client/_nuxt/{vue.24311fdc.js → vue.7ad3b25a.js} +3 -3
  73. package/dist/client/index.html +24 -24
  74. package/dist/client/modules/analyze-build/index.html +24 -24
  75. package/dist/client/modules/assets/index.html +24 -24
  76. package/dist/client/modules/components/index.html +24 -24
  77. package/dist/client/modules/hooks/index.html +24 -24
  78. package/dist/client/modules/imports/index.html +24 -24
  79. package/dist/client/modules/middleware/index.html +24 -24
  80. package/dist/client/modules/modules/index.html +24 -24
  81. package/dist/client/modules/open-graph/index.html +24 -24
  82. package/dist/client/modules/overview/index.html +24 -24
  83. package/dist/client/modules/pages/index.html +24 -24
  84. package/dist/client/modules/payload/index.html +24 -24
  85. package/dist/client/modules/plugins/index.html +24 -24
  86. package/dist/client/modules/runtime-configs/index.html +24 -24
  87. package/dist/client/modules/server-routes/index.html +24 -24
  88. package/dist/client/modules/storage/index.html +24 -24
  89. package/dist/client/modules/terminals/index.html +24 -24
  90. package/dist/client/modules/timeline/index.html +24 -24
  91. package/dist/client/modules/virtual-files/index.html +24 -24
  92. package/dist/client/settings/index.html +24 -24
  93. package/dist/module.json +1 -1
  94. package/dist/module.mjs +1 -1
  95. package/dist/shared/devtools.d18bab28.mjs +84 -0
  96. package/package.json +32 -29
  97. package/dist/client/_nuxt/LaunchPage.vue.805f9595.js +0 -1
  98. package/dist/client/_nuxt/NCheckbox.vue.6fb2ece1.js +0 -1
  99. package/dist/client/_nuxt/Navbar.vue.371e4d0a.js +0 -1
  100. package/dist/client/_nuxt/analyze-build.281c50c1.js +0 -1
  101. package/dist/client/_nuxt/assets.ca8faf7a.js +0 -16
  102. package/dist/client/_nuxt/components.a8900a78.js +0 -98
  103. package/dist/client/_nuxt/custom-_name_.c49c72a2.js +0 -1
  104. package/dist/client/_nuxt/entry.1c0836ed.css +0 -1
  105. package/dist/client/_nuxt/entry.e01776ec.js +0 -27
  106. package/dist/client/_nuxt/imports.d7bd415a.js +0 -1
  107. package/dist/client/_nuxt/index.a0a2f0b3.js +0 -17
  108. package/dist/client/_nuxt/json-editor-vue.b22bf91c.js +0 -129
  109. package/dist/client/_nuxt/modules.fd214f26.js +0 -2
  110. package/dist/client/_nuxt/open-graph.b95ebacd.js +0 -3
  111. package/dist/client/_nuxt/pages.708b9e25.js +0 -1
  112. package/dist/client/_nuxt/runtime-configs.63235af8.js +0 -1
  113. package/dist/client/_nuxt/server-routes.88eebd4c.js +0 -9
  114. package/dist/client/_nuxt/settings.7dbb31cf.js +0 -1
  115. package/dist/client/_nuxt/shellscript.9d056341.js +0 -4
  116. package/dist/client/_nuxt/state-modules.6d6b039c.js +0 -1
  117. package/dist/client/_nuxt/storage-options.ab028b2a.js +0 -1
  118. package/dist/client/_nuxt/timeline.ddc61557.js +0 -29
  119. package/dist/client/_nuxt/virtual-files.9da3562d.js +0 -1
  120. package/dist/shared/devtools.c28fc9a7.mjs +0 -80
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.0",
4
+ "version": "1.0.0-beta.2",
5
5
  "license": "MIT",
6
6
  "repository": "nuxt/devtools",
7
7
  "exports": {
@@ -33,19 +33,21 @@
33
33
  "@nuxt/kit": "^3.7.4",
34
34
  "birpc": "^0.2.14",
35
35
  "consola": "^3.2.3",
36
+ "destr": "^2.0.1",
36
37
  "error-stack-parser-es": "^0.1.1",
37
38
  "execa": "^7.2.0",
38
39
  "fast-glob": "^3.3.1",
39
40
  "flatted": "^3.2.9",
40
41
  "get-port-please": "^3.1.1",
41
42
  "global-dirs": "^3.0.1",
42
- "h3": "^1.8.1",
43
+ "h3": "^1.8.2",
43
44
  "hookable": "^5.5.3",
44
45
  "image-meta": "^0.1.1",
45
46
  "is-installed-globally": "^0.4.0",
46
- "launch-editor": "^2.6.0",
47
- "local-pkg": "^0.4.3",
47
+ "launch-editor": "^2.6.1",
48
+ "local-pkg": "^0.5.0",
48
49
  "magicast": "^0.3.0",
50
+ "nitropack": "^2.6.3",
49
51
  "nypm": "^0.3.3",
50
52
  "ofetch": "^1.3.3",
51
53
  "ohash": "^1.1.3",
@@ -54,62 +56,63 @@
54
56
  "perfect-debounce": "^1.0.0",
55
57
  "pkg-types": "^1.0.3",
56
58
  "rc9": "^2.1.1",
59
+ "scule": "^1.0.0",
57
60
  "semver": "^7.5.4",
58
61
  "simple-git": "^3.20.0",
59
62
  "sirv": "^2.0.3",
60
- "unimport": "^3.3.0",
61
- "vite-plugin-inspect": "^0.7.38",
62
- "vite-plugin-vue-inspector": "^3.7.1",
63
+ "unimport": "^3.4.0",
64
+ "vite-plugin-inspect": "^0.7.40",
65
+ "vite-plugin-vue-inspector": "^4.0.0",
63
66
  "which": "^3.0.1",
64
67
  "ws": "^8.14.2",
65
- "@nuxt/devtools-kit": "1.0.0-beta.0",
66
- "@nuxt/devtools-wizard": "1.0.0-beta.0"
68
+ "@nuxt/devtools-kit": "1.0.0-beta.2",
69
+ "@nuxt/devtools-wizard": "1.0.0-beta.2"
67
70
  },
68
71
  "devDependencies": {
69
72
  "@iconify-json/bxl": "^1.1.7",
70
73
  "@iconify-json/carbon": "^1.1.21",
71
74
  "@iconify-json/logos": "^1.1.37",
72
75
  "@iconify-json/ri": "^1.1.12",
73
- "@iconify-json/simple-icons": "^1.1.72",
74
- "@iconify-json/tabler": "^1.1.92",
75
- "@nuxt/content": "^2.8.2",
76
+ "@iconify-json/simple-icons": "^1.1.74",
77
+ "@iconify-json/tabler": "^1.1.95",
78
+ "@nuxt/content": "^2.8.5",
76
79
  "@nuxtjs/color-mode": "^3.3.0",
77
80
  "@parcel/watcher": "^2.3.0",
78
- "@types/markdown-it-link-attributes": "^3.0.1",
81
+ "@types/markdown-it-link-attributes": "^3.0.2",
79
82
  "@types/ua-parser-js": "^0.7.37",
80
- "@unocss/nuxt": "^0.56.2",
81
- "@unocss/preset-icons": "^0.56.2",
82
- "@unocss/preset-uno": "^0.56.2",
83
- "@unocss/runtime": "^0.56.2",
84
- "@vueuse/nuxt": "^10.4.1",
83
+ "@unocss/nuxt": "^0.56.5",
84
+ "@unocss/preset-icons": "^0.56.5",
85
+ "@unocss/preset-uno": "^0.56.5",
86
+ "@unocss/runtime": "^0.56.5",
87
+ "@vueuse/nuxt": "^10.5.0",
85
88
  "esno": "^0.17.0",
86
89
  "floating-vue": "2.0.0-beta.24",
87
90
  "fuse.js": "^6.6.2",
88
- "json-editor-vue": "^0.10.16",
89
- "markdown-it": "^13.0.1",
91
+ "json-editor-vue": "^0.10.19",
92
+ "markdown-it": "^13.0.2",
90
93
  "markdown-it-link-attributes": "^4.0.1",
91
94
  "nanoid": "^5.0.1",
92
95
  "nuxt": "^3.7.4",
93
- "nuxt-vitest": "^0.10.5",
94
- "quicktype-core": "^23.0.75",
95
- "shikiji": "^0.6.8",
96
+ "nuxt-vitest": "^0.11.0",
97
+ "quicktype-core": "^23.0.76",
98
+ "shikiji": "^0.6.10",
96
99
  "theme-vitesse": "^0.7.3",
97
100
  "ua-parser-js": "^1.0.36",
98
- "unocss": "^0.56.2",
101
+ "unocss": "^0.56.5",
99
102
  "unplugin-vue-markdown": "^0.24.3",
100
- "vanilla-jsoneditor": "^0.18.4",
103
+ "vanilla-jsoneditor": "^0.18.9",
101
104
  "vis-data": "^7.1.7",
102
- "vis-network": "^9.1.6",
103
- "vue-tsc": "^1.8.14",
105
+ "vis-network": "^9.1.7",
106
+ "vue-tsc": "^1.8.19",
104
107
  "vue-virtual-scroller": "2.0.0-beta.8",
105
108
  "xterm": "^5.3.0",
106
109
  "xterm-addon-fit": "^0.8.0",
107
- "@nuxt/devtools": "1.0.0-beta.0"
110
+ "@nuxt/devtools": "1.0.0-beta.2"
108
111
  },
109
112
  "scripts": {
110
113
  "build": "pnpm dev:prepare && pnpm build:module && pnpm build:client && esno scripts/prepare.ts",
111
114
  "build:client": "nuxi generate client",
112
- "build:module": "nuxt-build-module",
115
+ "build:module": "nuxt-build-module build",
113
116
  "dev": "nuxi dev client",
114
117
  "dev:playground": "pnpm build && nuxi dev playground",
115
118
  "dev:prepare": "nuxi prepare client"
@@ -1 +0,0 @@
1
- import{d as f,h as o,j as a,A as b,o as t,i as r,k as i,t as c,p as _,m as g,n as h,ap as N,v as w,F as x,bw as C,a1 as y,_ as B,ak as $}from"./entry.e01776ec.js";import{_ as V}from"./NMarkdown.vue.b0e8b2fc.js";const v={"text-xl":""},P={flex:"~ gap2 wrap"},j=f({__name:"LaunchPage",props:{icon:{},title:{},description:{},actions:{}},emits:["action"],setup(F){return(e,I)=>{const l=C,m=V,p=y,d=B,u=$,k=b;return t(),o(k,null,{default:a(()=>[r(u,{flex:"~ col gap2",mxa:"","min-w-100":"","items-center":"",p6:""},{default:a(()=>[r(l,{mb2:"","text-5xl":"",icon:e.icon||e.icon,title:e.title},null,8,["icon","title"]),i("h1",v,c(e.title),1),e.description?(t(),o(m,{key:0,mb2:"","mt--1":"","text-center":"","text-base":"",op50:"",markdown:e.description},null,8,["markdown"])):_("",!0),i("div",P,[(t(!0),g(x,null,h(e.actions,(n,s)=>(t(),o(d,N({key:s,n:"solid primary",disabled:n.pending,to:n.src,target:n.src?"_blank":void 0},n.attrs,{onClick:()=>{n.handle?.(),e.$emit("action",s)}}),{default:a(()=>[n.pending?(t(),o(p,{key:0,icon:"carbon-circle-dash","animate-spin":""})):_("",!0),w(" "+c(n.label),1)]),_:2},1040,["disabled","to","target","onClick"]))),128))])]),_:1})]),_:1})}}});export{j as _};
@@ -1 +0,0 @@
1
- import{d as i,a5 as r,o as p,m as b,I as u,bE as h,f as a,k as n,l as k,ab as f,i as m,a6 as v,G as _,a1 as x}from"./entry.e01776ec.js";const V=["checked","disabled"],y=["disabled"],B={class:"n-checkbox-box n-checked:n-checkbox-box-checked peer-active:n-active-base peer-focus-visible:n-focus-base n-transition"},$=i({__name:"NCheckbox",props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},setup(c,{emit:t}){const e=r(c,"modelValue",t,{passive:!0});return(o,s)=>{const d=x;return p(),b("label",{class:"n-checkbox hover:n-checkbox-hover select-none items-center n-disabled:n-disabled",checked:a(e)||null,disabled:o.disabled||null},[u(n("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>k(e)?e.value=l:null),type:"checkbox",class:"peer absolute op0",disabled:o.disabled,onKeypress:s[1]||(s[1]=f(l=>e.value=!a(e),["enter"]))},null,40,y),[[h,a(e)]]),n("span",B,[m(d,{class:"n-checkbox-icon scale-0 transform op0 n-transition n-checked:scale-100 n-checked:op100"})]),n("span",{class:_([a(e)?"":"op50","n-transition"])},[v(o.$slots,"default")],2)],8,V)}}});export{$ as _};
@@ -1 +0,0 @@
1
- import{d as r,m as c,k as d,a6 as s,G as n,o as i,i as p,V as u}from"./entry.e01776ec.js";const f={flex:"~ gap4","items-center":""},g=r({__name:"Navbar",props:{search:{type:String,default:void 0},noPadding:{type:Boolean,default:!1}},emits:["update:search"],setup(a,{emit:t}){function o(e){t("update:search",e.target.value)}return(e,m)=>{const l=u;return i(),c("div",{flex:"~ col gap2",border:"b base","flex-1":"","navbar-glass":"",class:n([{p4:!a.noPadding}])},[d("div",f,[s(e.$slots,"search",{},()=>[p(l,{placeholder:"Search...",icon:"carbon-search",n:"primary","flex-auto":"",class:n({"px-5 py-2":!a.noPadding}),value:a.search,onInput:o},null,8,["class","value"])]),s(e.$slots,"actions")]),s(e.$slots,"default")],2)}}});export{g as _};
@@ -1 +0,0 @@
1
- import{d as R,a as V,r as S,o,m as i,k as e,F as c,n as E,G as F,f as t,t as m,p as b,H as G,i as r,j as a,v as _,I as A,J as D,K as P,L as U,_ as L,M as X,N as ee,O as ne,P as te,Q as oe,R as le,S as ie,U as k,h as w,l as j,V as se,W as ae,A as re}from"./entry.e01776ec.js";import{_ as ue}from"./FilepathItem.vue.5af0b5df.js";import{_ as de}from"./NTip.vue.770a171a.js";import{_ as ce}from"./NCodeBlock.vue.adf1e9b4.js";import{_ as me}from"./NCheckbox.vue.6fb2ece1.js";import{_ as _e}from"./HelpFab.vue.98c902f4.js";import"./client.3f2665f1.js";const pe={"h-full":"",grid:"~ rows-[max-content_1fr]"},fe={flex:"~ wrap","w-full":""},ve=["onClick"],he=e("div",{border:"b base","flex-auto":""},null,-1),ye={key:0,flex:"~ col gap-4 items-center justify-center",p4:""},be=e("div",{"flex-auto":""},null,-1),$e={grid:"~ cols-[30px_1fr] gap-x-2 gap-y-3 items-center justify-center","w-100":""},xe=e("div",{"i-carbon-commit":"","text-xl":""},null,-1),ge=e("div",{"text-sm":"",op50:""}," Name ",-1),we=e("div",{"i-carbon-time":"","text-xl":""},null,-1),ze=e("div",{"text-sm":"",op50:""}," Build duration ",-1),Be=e("div",{"i-carbon-cics-program":"","text-xl":""},null,-1),ke=e("div",{"text-sm":"",op50:""}," Client bundle size ",-1),Ce=e("div",{"i-carbon-bare-metal-server":"","text-xl":""},null,-1),Ne=e("div",{"text-sm":"",op50:""}," Nitro bundle size ",-1),Te=e("div",{"i-carbon-edge-node":"","text-xl":""},null,-1),Ae=e("div",{"text-sm":"",op50:""}," Built ",-1),De=e("div",{"i-carbon:folder-parent":"","text-xl":""},null,-1),Ie=e("div",{"text-sm":"",op50:""}," Report Path ",-1),Ve=e("div",{"flex-auto":""},null,-1),I="/__nuxt_devtools__/analyze/",Se=R({__name:"BuildAnalyzeDetails",props:{current:{},prev:{}},setup(C){const p=C,f=V(()=>{const n=[{name:"Overview",id:"overview"}];return p.current.features.bundleClient&&n.push({name:"Client Bundle",id:"bundle-client"}),p.current.features.bundleNitro&&n.push({name:"Nitro Bundle",id:"bundle-nitro"}),p.current.features.viteInspect&&n.push({name:"Vite Inspect",id:"vite-inspect"}),n}),l=S(f.value[0]);function $(n){return n<1024?`${n}B`:n<1024*1024?`${(n/1024).toFixed(1)}KB`:n<1024*1024*1024?`${(n/1024/1024).toFixed(1)}MB`:`${(n/1024/1024/1024).toFixed(1)}GB`}function g(n){return`${((n.endTime-n.startTime)/1e3).toFixed(1)}s`}async function x(n){return P.clearAnalyzeBuilds(await U(),[n])}return(n,u)=>{const z=ue,N=L;return o(),i("div",pe,[e("div",fe,[(o(!0),i(c,null,E(t(f),(v,T)=>(o(),i("button",{key:T,px4:"",py2:"",border:"r base",hover:"bg-active",class:F(v.id===t(l).id?"":"border-b"),onClick:d=>l.value=v},[e("div",{class:F(v.id===t(l).id?"":"op30")},m(v.name),3)],10,ve))),128)),he]),t(l).id==="overview"?(o(),i("div",ye,[be,e("div",$e,[xe,e("div",null,[ge,e("div",null,m(n.current.name),1)]),we,e("div",null,[ze,e("div",null,m(g(n.current)),1)]),n.current.size?.clientBundle?(o(),i(c,{key:0},[Be,e("div",null,[ke,e("div",null,m($(n.current.size.clientBundle)),1)])],64)):b("",!0),n.current.size.nitroBundle?(o(),i(c,{key:1},[Ce,e("div",null,[Ne,e("div",null,m($(n.current.size.nitroBundle)),1)])],64)):b("",!0),Te,e("div",null,[Ae,e("div",null,m(t(G)(new Date(n.current.endTime))),1)]),De,e("div",null,[Ie,r(z,{filepath:n.current.analyzeDir},null,8,["filepath"])])]),Ve,r(N,{n:"rose",icon:"carbon-delete",onClick:u[0]||(u[0]=v=>x(n.current.name))},{default:a(()=>[_(" Delete this report ")]),_:1})])):b("",!0),u._lazyshow1||t(l).id==="bundle-client"?(u._lazyshow1=!0,o(),i(c,null,[A(e("iframe",{src:`${I}${n.current.slug}/client.html`,"h-full":"","w-full":""},null,8,["src"]),[[D,t(l).id==="bundle-client"]])],64)):b("v-show-if",!0),u._lazyshow2||t(l).id==="bundle-nitro"?(u._lazyshow2=!0,o(),i(c,null,[A(e("iframe",{src:`${I}${n.current.slug}/nitro.html`,"h-full":"","w-full":""},null,8,["src"]),[[D,t(l).id==="bundle-nitro"]])],64)):b("v-show-if",!0),u._lazyshow3||t(l).id==="vite-inspect"?(u._lazyshow3=!0,o(),i(c,null,[A(e("iframe",{src:`${I}${n.current.slug}/.vite-inspect/`,"h-full":"","w-full":""},null,8,["src"]),[[D,t(l).id==="vite-inspect"]])],64)):b("v-show-if",!0)])}}}),Fe={class:"markdown-body"},Pe=e("h1",null,"Build Analyze",-1),je=e("p",null,[_("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"),_(" and present the output data directly in DevTools for easy browsing and comparing.")],-1),Re=[Pe,je],Ee={__name:"analyze-build",setup(C,{expose:p}){return p({frontmatter:{}}),(l,$)=>(o(),i("div",Fe,Re))}},Ge={flex:"~ col"},Ue=["onClick"],Le={flex:"~ gap-1 items-center wrap","w-full":"","text-sm":"",op60:""},Oe=e("div",{"i-carbon-time":""},null,-1),He=e("div",{"flex-auto":""},null,-1),Ke=e("div",{"x-divider":""},null,-1),Me={flex:"~ items-center justify-center wrap",p4:""},We={flex:"~ col gap-1","w-250":"",p4:""},Je=e("h3",{class:"text-lg font-medium leading-6",mb2:""}," Start analyze build? ",-1),Qe=e("p",{op50:""}," Enter the name of the build: ",-1),Ye=e("div",{my3:"","x-divider":""},null,-1),Ze=e("p",{op50:""}," The following command will be executed in your terminal: ",-1),qe={flex:"~ gap-3",mt2:"","justify-end":""},an=R({__name:"analyze-build",setup(C){const p=X(),f=ee(),l=ne(),$=te("analyze-build:slug",""),g=V(()=>f.value?.builds.find(d=>d.slug===$.value)??f.value?.builds[0]),x=S(!1),n=S(""),u=V(()=>f.value?.builds.some(d=>d.name===n.value.trim()));async function z(){n.value=await P.generateAnalyzeBuildName(),await p.start()&&(k.value={name:n.value,processId:await P.startAnalyzeBuild(await U(),n.value)},x.value&&v())}const N=oe();function v(){k.value?.processId&&(N.value=k.value.processId,l.push("/modules/terminals"))}function T(d){return`${((d.endTime-d.startTime)/1e3).toFixed(1)}s`}return le(()=>[{id:"action:analyze-build: start",title:"Start a new analyze build",icon:"i-carbon-edge-node",action:z}]),(d,h)=>{const B=L,O=Se,H=re,K=ie,M=se,W=de,J=ce,Q=me,Y=ae,Z=Ee,q=_e;return o(),i(c,null,[r(K,{"left-size":30},{left:a(()=>[e("div",Ge,[(o(!0),i(c,null,E(t(f)?.builds,s=>(o(),i(c,{key:s.slug},[e("button",{flex:"~ col gap1","hover:bg-active":"",p3:"",class:F(s.slug===t(g)?.slug?"text-primary bg-active":""),onClick:y=>$.value=s.slug},[e("code",null,m(s.name),1),e("div",Le,[Oe,e("span",null,m(T(s)),1),He,e("span",null,m(t(G)(new Date(s.endTime))),1)])],10,Ue),Ke],64))),128)),e("div",Me,[("processAnalyzeBuildInfo"in d?d.processAnalyzeBuildInfo:t(k))?(o(),w(B,{key:1,n:"primary",icon:"carbon-circle-dash animate-spin",onClick:h[1]||(h[1]=s=>v())},{default:a(()=>[_(" Building... ")]),_:1})):(o(),w(B,{key:0,n:"primary",icon:"carbon-edge-node",onClick:h[0]||(h[0]=s=>z())},{default:a(()=>[_(" Start a new build ")]),_:1}))])])]),right:a(()=>[t(g)?(o(),w(O,{key:0,current:t(g)},null,8,["current"])):(o(),w(H,{key:1}))]),_:1}),r(t(p),null,{default:a(({resolve:s})=>[r(Y,{"model-value":!0,onClose:y=>s(!1)},{default:a(()=>[e("div",We,[Je,Qe,r(M,{modelValue:t(n),"onUpdate:modelValue":h[2]||(h[2]=y=>j(n)?n.value=y:null),placeholder:"Build name"},null,8,["modelValue"]),t(u)?(o(),w(W,{key:0,"n-orange":""},{default:a(()=>[_(" A build with the same name already exists, continue would overrides the previous build result. ")]),_:1})):b("",!0),Ye,Ze,r(J,{code:`npx nuxi analyze --no-serve --name=${t(n)}`,lang:"bash",px4:"",py2:"",border:"~ base rounded",lines:!1},null,8,["code"]),r(Q,{modelValue:t(x),"onUpdate:modelValue":h[3]||(h[3]=y=>j(x)?x.value=y:null),mt2:"",n:"primary"},{default:a(()=>[_(" Navigate to terminal ")]),_:1},8,["modelValue"]),e("div",qe,[r(B,{onClick:y=>s(!1)},{default:a(()=>[_(" Cancel ")]),_:2},1032,["onClick"]),r(B,{n:"solid primary",onClick:y=>s(!0)},{default:a(()=>[_(" Start ")]),_:2},1032,["onClick"])])])]),_:2},1032,["onClose"])]),_:1}),r(q,null,{default:a(()=>[r(Z)]),_:1})],64)}}});export{an as default};
@@ -1,16 +0,0 @@
1
- import{d as X,r as N,X as q,o,m as c,i as d,f as t,k as e,v as $,F as z,n as Z,h as I,j as x,p as T,G as Y,Y as U,Z as de,a0 as pe,K as G,L as H,_ as ee,a1 as ne,V as oe,a as A,a2 as me,a3 as fe,a4 as se,t as F,a5 as ae,a6 as ve,l as R,a7 as he,b as te,a8 as _e,e as ge,a9 as xe,aa as le,I as W,ab as be,ac as we,W as ye,ad as $e,ae as ke,af as Ce}from"./entry.e01776ec.js";import{_ as Pe}from"./Navbar.vue.371e4d0a.js";import{_ as Ae}from"./NSectionBlock.4347cc14.js";import{_ as De}from"./FilepathItem.vue.5af0b5df.js";import{_ as Ve,u as Fe}from"./storage-options.ab028b2a.js";import{_ as Ne}from"./NDrawer.vue.8e620517.js";import{D as Ie}from"./constants.4e5eba24.js";import"./NIconTitle.vue.bf8093eb.js";import"./NCodeBlock.vue.adf1e9b4.js";import"./client.3f2665f1.js";const Se={key:0,"h-full":"","w-full":"",flex:"","items-center":"","justify-center":""},Te={for:"drop-zone-input","text-3xl":""},je={key:1,relative:"","h-full":"","w-full":"",grid:"~ rows-[max-content_1fr_max-content]"},Ee=e("div",{px6:"",py6:""},[e("h1",{"text-2xl":""}," Upload "),e("p",{"text-sm":"",op50:""}," Drag and drop files to upload ")],-1),Ue={grid:"~ cols-minmax-8rem","overflow-auto":"",p6:""},Le={flex:"","items-center":"","justify-center":"","of-hidden":"",rounded:"","rounded-t-lg":"","bg-active":"","object-cover":"",class:"aspect-1/1",border:"~ base"},ze=["src"],Be={flex:"~ gap1","items-center":""},Me={flex:"~ gap-2","items-center":"","justify-center":"",p8:""},Oe=X({__name:"DropZone",props:{folder:{type:String,required:!0}},setup(j){const l=j,p=N(!1),n=N(),m=N([]),h=["image","video"];function D(r){n.value=r.target,p.value=!0}function u(r){r.target===n.value&&(p.value=!1)}function k(r){r.preventDefault()}function K(r){r.preventDefault(),L(r.dataTransfer.files)}function L(r){const g=Array.from(r||[]);if(g.length){const v=[],C=m.value.map(f=>f.name);for(const f of g)if(C.includes(f.name)){let a=1;const[V,i]=f.name.split(".");for(;C.includes(`${V} (${a}).${i}`);)a++;const s=`${V}-${a}.${i}`,M=new Blob([f],{type:f.type}),O=new File([M],s,{lastModified:Date.now()});v.push(O),C.push(s)}else f.type===""?U({message:"Folders are not supported yet",icon:"carbon:face-dissatisfied",classes:"text-orange"}):h.some(a=>f.type.includes(a))?v.push(f):U({message:`"${f.type}" file type is not allowed`,icon:"carbon:face-dissatisfied",classes:"text-orange"});m.value=[...m.value,...v]}}async function b(){if(de.value||pe.value)return;const r=[];for(const g of m.value){const v=new FileReader;v.readAsDataURL(g);const f=(await new Promise(a=>{v.onload=()=>a(v.result)})).split(";base64,").pop();r.push({path:g.name,encoding:"base64",content:f})}await G.writeStaticAssets(await H(),[...r],l.folder).then(()=>{E(),U({message:"Files uploaded successfully!",icon:"i-carbon:checkmark"})}).catch(g=>{console.error(g),E(),U({message:`Error uploading files: ${g}`,icon:"i-carbon-warning",classes:"text-red"})}),p.value=!1}function _(r){m.value?.splice(r,1)}function w(r){return URL.createObjectURL(r)}function B(r,g){const[v,C]=r.name.split("."),f=g.replace(/\.\w+$/,""),a=`${f}.${C}`;return f.length===0?(alert("File name must be at least 1 characters long"),v):(Object.defineProperty(r,"name",{value:a,writable:!1}),m.value.splice(m.value.indexOf(r),1,r),r)}function S(){m.value=[]}function E(){p.value=!1,S()}return q("dragenter",D),q("dragleave",u),q("dragover",k),q("drop",K),(r,g)=>{const v=ee,C=ne,f=oe;return o(),c("div",{fixed:"","bottom-0":"","left-13":"","right-0":"","top-0":"","z-10":"","backdrop-blur-20":"","transition-all":"",class:Y(t(p)?"opacity-100 visible":"opacity-0 invisible")},[d(v,{icon:"carbon-close",absolute:"","right-5":"","top-5":"","z-20":"","text-xl":"",border:!1,onClick:E}),t(m)?.length?(o(),c("div",je,[Ee,e("div",Ue,[(o(!0),c(z,null,Z(t(m),(a,V)=>(o(),c("div",{key:a.name,flex:"~ col gap-2",relative:"","h-50":"","w-40":"","items-center":""},[e("div",Le,[e("img",{"h-full":"","w-full":"","rounded-t-lg":"","object-cover":"",src:w(a)},null,8,ze)]),e("div",Be,[d(f,{n:"xs","h-full":"","flex-auto":"","model-value":a.name,"onUpdate:modelValue":i=>B(a,i.target.value)},null,8,["model-value","onUpdate:modelValue"]),d(v,{n:"red",icon:"carbon-trash-can","h-full":"","flex-none":"",title:"Remove file",onClick:i=>_(V)},null,8,["onClick"])])]))),128))]),e("div",Me,[t(m).length?(o(),I(v,{key:0,n:"red",onClick:S},{default:x(()=>[d(C,{icon:"carbon-clean"}),$(" Clear ")]),_:1})):T("",!0),d(v,{disabled:!t(m).length,n:"primary solid",onClick:b},{default:x(()=>[d(C,{icon:"carbon-cloud-upload"}),$(" Upload ")]),_:1},8,["disabled"])])])):(o(),c("div",Se,[e("label",Te,[d(C,{icon:"carbon-cloud-upload","mr-2":""}),$(" Drop files here or click to select ")]),e("input",{id:"drop-zone-input",type:"file",multiple:"",hidden:"",onChange:g[0]||(g[0]=a=>L(a.target.files))},null,32)]))],2)}}}),Re=X({__name:"AssetFontPreview",props:{asset:{}},setup(j){const l=j,p=A(()=>`devtools-assets-${me(l.asset)}`);return fe(A(()=>`
2
- @font-face {
3
- font-family: '${p.value}';
4
- src: url('${l.asset.publicPath}');
5
- }
6
- `)),(n,m)=>(o(),c("div",{"of-hidden":"",style:se({fontFamily:`'${t(p)}'`})}," 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))}}),Ke={flex:"","items-center":"","justify-center":"","of-hidden":"","bg-active":"","object-cover":"",p1:""},Xe=["src"],Ge={key:2,"i-carbon-document":"","text-3xl":"",op20:""},Ze={key:3,"w-full":"","self-start":"",p4:""},We=["textContent"],qe={key:4},Ye=["src","autoplay","controls"],He={key:5},Je={key:0,"i-carbon-volume-up":"","text-3xl":"",op20:""},Qe=["src"],et={key:6,"i-carbon-help":"","text-3xl":"",op20:""},ie=X({__name:"AssetPreview",props:{asset:{},textContent:{},detail:{type:Boolean}},setup(j){return(l,p)=>{const n=Re;return o(),c("div",Ke,[l.asset.type==="image"?(o(),c("img",{key:0,src:l.asset.publicPath},null,8,Xe)):l.asset.type==="font"?(o(),I(n,{key:l.asset.publicPath,asset:l.asset,"self-stretch":"",p2:"","text-2xl":""},null,8,["asset"])):l.asset.type==="text"&&!l.textContent?(o(),c("div",Ge)):l.asset.type==="text"&&l.textContent?(o(),c("div",Ze,[e("pre",{"max-h-10rem":"","of-hidden":"","text-xs":"","font-mono":"",textContent:F(l.textContent)},null,8,We)])):l.asset.type==="video"?(o(),c("div",qe,[e("video",{src:l.asset.publicPath,autoplay:l.detail,controls:l.detail},null,8,Ye)])):l.asset.type==="audio"?(o(),c("div",He,[l.detail?(o(),c("audio",{key:1,src:l.asset.publicPath,controls:""},null,8,Qe)):(o(),c("div",Je))])):(o(),c("div",et))])}}}),tt={flex:"~ col gap-1",hover:"bg-active","items-center":"","of-hidden":"",rounded:"",p2:""},nt={"w-full":"","of-hidden":"",truncate:"","ws-nowrap":"","text-center":"","text-xs":""},ot=X({__name:"AssetGridItem",props:{asset:{},folder:{}},setup(j){const l=j,p=A(()=>l.folder&&l.asset.path.startsWith(l.folder)?l.asset.path.slice(l.folder.length):l.asset.path);return(n,m)=>{const h=ie;return o(),c("button",tt,[d(h,{"h-30":"","w-30":"",rounded:"",border:"~ base",asset:n.asset},null,8,["asset"]),e("div",nt,F(t(p)),1)])}}}),re=X({__name:"AssetListItem",props:{item:{},index:{default:0},modelValue:{}},setup(j,{emit:l}){const p=j,n=ae(p,"modelValue",l,{passive:!0}),m=A(()=>p.item?.children?.length),h=N(!0),D=A(()=>m.value?"i-carbon-folder":p.item.type==="image"?"i-carbon-image":p.item.type==="video"?"i-carbon-video":p.item.type==="audio"?"i-carbon-volume-up":p.item.type==="font"?"i-carbon-text-small-caps":p.item.type==="text"?"i-carbon-document":p.item.type==="json"?"i-carbon-json":"i-carbon-document-blank");return(u,k)=>{const K=ne,L=re;return o(),c("div",null,[e("button",{flex:"~ gap-2","w-full":"","items-center":"",hover:"bg-active",px4:"",py1:"",style:se({paddingLeft:`calc(1rem + ${u.index*1.5}em)`}),class:Y({"bg-active":!t(m)&&t(n)?.filePath===u.item?.filePath}),border:"b base",onClick:k[0]||(k[0]=b=>t(m)?h.value=!t(h):n.value=u.item)},[e("div",{class:Y(t(D))},null,2),e("span",{class:Y({"flex items-center":t(m)}),"flex-auto":"","text-start":"","text-sm":"","font-mono":""},F(u.item.path),3),t(m)?(o(),I(K,{key:0,icon:"carbon:chevron-right","transform-rotate":t(h)?90:0,transition:""},null,8,["transform-rotate"])):T("",!0)],6),t(h)?ve(u.$slots,"default",{key:0},()=>[(o(!0),c(z,null,Z(u.item?.children,b=>(o(),I(L,{key:b.filepath,modelValue:t(n),"onUpdate:modelValue":k[1]||(k[1]=_=>R(n)?n.value=_:null),item:b,index:u.index+1},null,8,["modelValue","item","index"]))),128))]):T("",!0)])}}}),st={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},at=e("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[e("div",{"x-divider":""}),e("div",{"flex-none":""}," Preview "),e("div",{"x-divider":""})],-1),lt={flex:"~","items-center":"","justify-center":""},it=e("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[e("div",{"x-divider":""}),e("div",{"flex-none":""}," Details "),e("div",{"x-divider":""})],-1),rt={"max-w-full":"","w-full":"","table-fixed":""},ct=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Filepath ",-1),ut={flex:"~ gap-1","w-full":"","items-center":""},dt=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Public Path ",-1),pt={flex:"~ gap-1","w-full":"","items-center":"","of-hidden":""},mt={"flex-auto":"","of-hidden":"",truncate:"","ws-pre":"","font-mono":""},ft=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Type ",-1),vt={capitalize:""},ht=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Image Size ",-1),_t={key:0},gt=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Aspect Ratio ",-1),xt=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," File size ",-1),bt=e("td",{"w-30":"","ws-nowrap":"",pr5:"","text-right":"",op50:""}," Last modified ",-1),wt={op70:""},yt=e("div",{flex:"~ gap2","mb--2":"","items-center":"",op50:""},[e("div",{"x-divider":""}),e("div",{"flex-none":""}," Actions "),e("div",{"x-divider":""})],-1),$t={flex:"~ gap2 wrap"},kt=e("div",{"flex-auto":""},null,-1),Ct={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},Pt=e("span",null," Are you sure you want to delete this asset? ",-1),At={flex:"~ gap2 wrap justify-center"},Dt={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p8:""},Vt={flex:"~ gap2 wrap justify-center"},Ft={flex:"~ col gap-4","min-h-full":"","w-full":"","of-hidden":"",p4:""},Nt=["onKeydown"],It={flex:"","justify-end":"","gap-4":""},St=X({__name:"AssetDetails",props:{modelValue:{}},setup(j,{emit:l}){const n=ae(j,"modelValue",l,{passive:!0}),m=he(),h=te(()=>{if(n.value.type==="image")return G.getImageMeta(n.value.filePath)}),D=N(!1),u=N(),k=N(0),K=te(async()=>{if(n.value.type!=="text")return;k.value;const i=await G.getTextAssetContent(n.value.filePath);return u.value=i,i});async function L(){if(K.value!==u.value)try{await G.writeStaticAssets(await H(),[{path:n.value.path,content:u.value,override:!0}],""),D.value=!1,k.value++,U({message:"Updated",icon:"i-carbon-checkmark",classes:"text-green"})}catch{U({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const b=_e(),_=A(()=>(b.value?._installedModules||[]).some(s=>s.meta?.name==="@nuxt/image"||s.meta?.name==="@nuxt/image-edge")),w=A(()=>{const i=[];if(n.value.type==="image"){const s=h.value?.width?`
7
- width="${h.value.width}"
8
- height="${h.value.height}" `:" ";return i.push({lang:"vue-html",code:`<img${s}
9
- src="${n.value.publicPath}"
10
- />`,name:"Plain Image"}),_.value&&i.push({lang:"vue-html",code:`<NuxtImg${s}
11
- src="${n.value.publicPath}"
12
- />`,name:"Nuxt Img",docs:"https://image.nuxt.com/usage/nuxt-img"},{lang:"vue-html",code:`<NuxtPicture${s}
13
- src="${n.value.publicPath}"
14
- />`,name:"Nuxt Picture",docs:"https://image.nuxt.com/usage/nuxt-picture"}),i}return i.push({lang:"html",code:`<a download href="${n.value.publicPath}">
15
- Download ${n.value.path.split("/").slice(-1)[0]}
16
- </a>`,name:"Download link"}),i}),B=ge(),S=xe(()=>n.value.mtime),E=A(()=>{const i=n.value.size;return i<1024?`${i} B`:i<1024*1024?`${(i/1024).toFixed(2)} KB`:`${(i/1024/1024).toFixed(2)} MB`}),r=A(()=>{if(!h.value?.width||!h.value?.height)return"";const i=(M,O)=>O?i(O,M%O):M,s=i(h.value.width,h.value.height);return s>3?`${h.value.width/s}:${h.value.height/s}`:""}),g=A(()=>["image","text","video","audio","font"].includes(n.value.type)),v=N(!1);async function C(){try{await G.deleteStaticAsset(await H(),n.value.filePath),n.value=void 0,v.value=!1,U({message:"Asset deleted",icon:"i-carbon-checkmark",classes:"text-green"})}catch{U({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}const f=N(!1),a=N("");async function V(){const i=n.value.filePath.split("/"),s=i.slice(-1)[0].split(".").slice(0,-1).join(".");if(!a.value||a.value===s)return U({message:"Please enter a new name",icon:"i-carbon-warning",classes:"text-orange"});try{const M=i.slice(-1)[0].split(".").slice(-1)[0],O=`${i.slice(0,-1).join("/")}/${a.value}.${M}`;await G.renameStaticAsset(await H(),n.value.filePath,O),n.value=void 0,f.value=!1,U({message:"Asset renamed",icon:"i-carbon-checkmark",classes:"text-green"})}catch{U({message:"Something went wrong!",icon:"i-carbon-warning",classes:"text-red"})}}return(i,s)=>{const M=ie,O=De,P=ee,ce=Ve,J=ye,ue=oe,Q=le("tooltip");return o(),c(z,null,[e("div",st,[t(g)?(o(),c(z,{key:0},[at,e("div",lt,[d(M,{detail:"","max-h-80":"","min-h-20":"","min-w-20":"","w-auto":"",rounded:"",border:"~ base",asset:t(n),"text-content":t(K)},null,8,["asset","text-content"])])],64)):T("",!0),it,e("table",rt,[e("tbody",null,[e("tr",null,[ct,e("td",null,[e("div",ut,[d(O,{filepath:t(n).filePath,"text-left":""},null,8,["filepath"]),W(d(P,{"flex-none":"",title:"Open in Editor",icon:"carbon-launch",border:!1,onClick:s[0]||(s[0]=y=>t(m)(t(n).filePath))},null,512),[[Q,"Open in Editor"]])])])]),e("tr",null,[dt,e("td",null,[e("div",pt,[e("div",mt,F(t(n).publicPath),1),W(d(P,{"flex-none":"",title:"Copy public path",icon:"carbon-copy",border:!1,onClick:s[1]||(s[1]=y=>t(B)(t(n).publicPath))},null,512),[[Q,"Copy public path"]]),W(d(P,{"flex-none":"",to:t(n).publicPath,icon:"carbon-launch",target:"_blank",border:!1,title:"Open in browser"},null,8,["to"]),[[Q,"Open in browser"]])])])]),e("tr",null,[ft,e("td",vt,F(t(n).type),1)]),t(h)?.width?(o(),c(z,{key:0},[e("tr",null,[ht,e("td",null,F(t(h).width)+" x "+F(t(h).height),1)]),t(r)?(o(),c("tr",_t,[gt,e("td",null,F(t(r)),1)])):T("",!0)],64)):T("",!0),e("tr",null,[xt,e("td",null,F(t(E)),1)]),e("tr",null,[bt,e("td",null,[$(F(new Date(t(n).mtime).toLocaleString())+" ",1),e("span",wt,"("+F(t(S))+")",1)])])])]),yt,e("div",$t,[d(P,{to:t(n).publicPath,download:"",target:"_blank",icon:"carbon-download",n:"green"},{default:x(()=>[$(" Download ")]),_:1},8,["to"]),t(n).type==="text"?(o(),I(P,{key:0,icon:"carbon-edit",n:"cyan",onClick:s[2]||(s[2]=y=>D.value=!t(D))},{default:x(()=>[$(" Edit ")]),_:1})):T("",!0),d(P,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:s[3]||(s[3]=y=>f.value=!t(f))},{default:x(()=>[$(" Rename ")]),_:1}),d(P,{icon:"carbon-delete",n:"red",onClick:s[4]||(s[4]=y=>v.value=!t(v))},{default:x(()=>[$(" Delete ")]),_:1}),t(n).type==="image"?(o(),I(P,{key:1,disabled:"",icon:"carbon-image-service"},{default:x(()=>[$(" Optimize image (Coming soon) ")]),_:1})):T("",!0)]),kt,t(w).length?(o(),I(ce,{key:1,border:"t base","mx--4":"","mb--4":"","code-snippets":t(w)},null,8,["code-snippets"])):T("",!0)]),d(J,{modelValue:t(v),"onUpdate:modelValue":s[6]||(s[6]=y=>R(v)?v.value=y:null)},{default:x(()=>[e("div",Ct,[Pt,e("div",At,[d(P,{icon:"carbon-close",onClick:s[5]||(s[5]=y=>v.value=!1)},{default:x(()=>[$(" Cancel ")]),_:1}),d(P,{icon:"carbon-delete",n:"red",onClick:C},{default:x(()=>[$(" Delete ")]),_:1})])])]),_:1},8,["modelValue"]),d(J,{modelValue:t(f),"onUpdate:modelValue":s[9]||(s[9]=y=>R(f)?f.value=y:null)},{default:x(()=>[e("div",Dt,[d(ue,{modelValue:t(a),"onUpdate:modelValue":s[7]||(s[7]=y=>R(a)?a.value=y:null),placeholder:"New name",n:"blue"},null,8,["modelValue"]),e("div",Vt,[d(P,{icon:"carbon-close",onClick:s[8]||(s[8]=y=>f.value=!1)},{default:x(()=>[$(" Cancel ")]),_:1}),d(P,{icon:"carbon-text-annotation-toggle",n:"blue",onClick:V},{default:x(()=>[$(" Rename ")]),_:1})])])]),_:1},8,["modelValue"]),t(n).type==="text"?(o(),I(J,{key:0,modelValue:t(D),"onUpdate:modelValue":s[12]||(s[12]=y=>R(D)?D.value=y:null)},{default:x(()=>[e("div",Ft,[W(e("textarea",{"onUpdate:modelValue":s[10]||(s[10]=y=>R(u)?u.value=y:null),placeholder:"Item value...",class:"h-lg w-xl of-auto rounded-lg p-4 text-sm font-mono outline-none",onKeydown:be(L,["enter"])},null,40,Nt),[[we,t(u)]]),e("div",It,[d(P,{icon:"carbon-close",onClick:s[11]||(s[11]=y=>D.value=!1)},{default:x(()=>[$(" Cancel ")]),_:1}),d(P,{icon:"carbon:save",n:"primary",onClick:L},{default:x(()=>[$(" save ")]),_:1})])])]),_:1},8,["modelValue"])):T("",!0)],64)}}}),Tt={"h-full":"","of-auto":""},jt={"flex-none":"",flex:"~ gap2 items-center"},Et={op50:""},Ut={key:0},Lt={"mt--4":"",px2:"",grid:"~ cols-minmax-8rem"},zt={key:1,p2:"",grid:"~ cols-minmax-8rem"},Bt={key:1},Ht=X({__name:"assets",setup(j){const l=$e(),p=N(""),n=A(()=>new ke(l.value||[],{keys:["path"]})),m=A(()=>p.value?n.value.search(p.value).map(_=>_.item):l.value||[]),h=A(()=>{const b={};for(const _ of m.value){const w=`${_.path.split("/").slice(0,-1).join("/")}/`;b[w]||(b[w]=[]),b[w].push(_)}return Object.entries(b).sort(([_],[w])=>_.localeCompare(w))}),D=A(()=>{const b={path:"public",children:[]},_=(w,B,S)=>{const[E,...r]=B;let g=w.children.find(v=>v.path===E);g||(g={...S,path:E,children:[]},w.children.push(g)),r.length>1?_(g,r,S):r.length===1&&g.children.push({...S,path:r[0]})};return m.value.forEach(w=>{const B=w.path.split("/").filter(S=>S!=="");_(b,B,w)}),b.children}),u=N(),{view:k}=Fe("assets");function K(){k.value=k.value==="list"?"grid":"list"}Ce("Escape",()=>{u.value=void 0});const L=N();return(b,_)=>{const w=ee,B=Pe,S=Oe,E=ot,r=Ae,g=re,v=St,C=Ne,f=le("tooltip");return o(),c("div",Tt,[d(B,{ref_key:"navbar",ref:L,search:t(p),"onUpdate:search":_[0]||(_[0]=a=>R(p)?p.value=a:null),pb2:""},{actions:x(()=>[e("div",jt,[W(d(w,{"text-lg":"",border:!1,icon:t(k)==="grid"?"i-carbon-list":"i-carbon-grid",title:"Toggle view",onClick:K},null,8,["icon"]),[[f,"Toggle View",void 0,{"bottom-end":!0}]])])]),default:x(()=>[e("div",Et,[t(p)?(o(),c("span",Ut,F(t(m).length)+" matched · ",1)):T("",!0),e("span",null,F(t(l)?.length)+" assets in total",1)])]),_:1},8,["search"]),d(S,{folder:"/"}),t(k)==="grid"?(o(),c(z,{key:0},[t(h).length>1?(o(!0),c(z,{key:0},Z(t(h),([a,V])=>(o(),I(r,{key:a,text:a,description:`${V.length} items`,open:V.length<=("DETAILS_MAX_ITEMS"in b?b.DETAILS_MAX_ITEMS:t(Ie)),padding:!1},{default:x(()=>[e("div",Lt,[(o(!0),c(z,null,Z(V,i=>(o(),I(E,{key:i.path,asset:i,folder:a,onClick:s=>u.value=i},null,8,["asset","folder","onClick"]))),128))])]),_:2},1032,["text","description","open"]))),128)):(o(),c("div",zt,[(o(!0),c(z,null,Z(t(m),a=>(o(),I(E,{key:a.path,asset:a,onClick:V=>u.value=a},null,8,["asset","onClick"]))),128))]))],64)):(o(),c("div",Bt,[(o(!0),c(z,null,Z(t(D),(a,V)=>(o(),I(g,{key:V,modelValue:t(u),"onUpdate:modelValue":_[1]||(_[1]=i=>R(u)?u.value=i:null),item:a},null,8,["modelValue","item"]))),128))])),d(C,{"model-value":!!t(u),"auto-close":"","w-120":"",top:t(L),onClose:_[3]||(_[3]=a=>u.value=void 0)},{default:x(()=>[t(u)?(o(),I(v,{key:0,modelValue:t(u),"onUpdate:modelValue":_[2]||(_[2]=a=>R(u)?u.value=a:null)},null,8,["modelValue"])):T("",!0)]),_:1},8,["model-value","top"])])}}});export{Ht as default};