Empty.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. var __defProp = Object.defineProperty;
  2. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  3. var __getOwnPropNames = Object.getOwnPropertyNames;
  4. var __hasOwnProp = Object.prototype.hasOwnProperty;
  5. var __export = (target, all) => {
  6. for (var name2 in all)
  7. __defProp(target, name2, { get: all[name2], enumerable: true });
  8. };
  9. var __copyProps = (to, from, except, desc) => {
  10. if (from && typeof from === "object" || typeof from === "function") {
  11. for (let key of __getOwnPropNames(from))
  12. if (!__hasOwnProp.call(to, key) && key !== except)
  13. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  14. }
  15. return to;
  16. };
  17. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  18. var stdin_exports = {};
  19. __export(stdin_exports, {
  20. default: () => stdin_default
  21. });
  22. module.exports = __toCommonJS(stdin_exports);
  23. var import_vue = require("vue");
  24. var import_vue2 = require("vue");
  25. var import_use_id = require("../composables/use-id");
  26. var import_utils = require("../utils");
  27. const [name, bem] = (0, import_utils.createNamespace)("empty");
  28. const emptyProps = {
  29. image: (0, import_utils.makeStringProp)("default"),
  30. imageSize: [Number, String, Array],
  31. description: String
  32. };
  33. var stdin_default = (0, import_vue2.defineComponent)({
  34. name,
  35. props: emptyProps,
  36. setup(props, {
  37. slots
  38. }) {
  39. const renderDescription = () => {
  40. const description = slots.description ? slots.description() : props.description;
  41. if (description) {
  42. return (0, import_vue.createVNode)("p", {
  43. "class": bem("description")
  44. }, [description]);
  45. }
  46. };
  47. const renderBottom = () => {
  48. if (slots.default) {
  49. return (0, import_vue.createVNode)("div", {
  50. "class": bem("bottom")
  51. }, [slots.default()]);
  52. }
  53. };
  54. const baseId = (0, import_use_id.useId)();
  55. const getId = (num) => `${baseId}-${num}`;
  56. const getUrlById = (num) => `url(#${getId(num)})`;
  57. const renderStop = (color, offset, opacity) => (0, import_vue.createVNode)("stop", {
  58. "stop-color": color,
  59. "offset": `${offset}%`,
  60. "stop-opacity": opacity
  61. }, null);
  62. const renderStops = (fromColor, toColor) => [renderStop(fromColor, 0), renderStop(toColor, 100)];
  63. const renderShadow = (id) => [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("radialGradient", {
  64. "id": getId(id),
  65. "cx": "50%",
  66. "cy": "54%",
  67. "fx": "50%",
  68. "fy": "54%",
  69. "r": "297%",
  70. "gradientTransform": "matrix(-.16 0 0 -.33 .58 .72)"
  71. }, [renderStop("#EBEDF0", 0), renderStop("#F2F3F5", 100, 0.3)])]), (0, import_vue.createVNode)("ellipse", {
  72. "fill": getUrlById(id),
  73. "opacity": ".8",
  74. "cx": "80",
  75. "cy": "140",
  76. "rx": "46",
  77. "ry": "8"
  78. }, null)];
  79. const renderBuilding = () => [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
  80. "id": getId("a"),
  81. "x1": "64%",
  82. "y1": "100%",
  83. "x2": "64%"
  84. }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)])]), (0, import_vue.createVNode)("g", {
  85. "opacity": ".8"
  86. }, [(0, import_vue.createVNode)("path", {
  87. "d": "M36 131V53H16v20H2v58h34z",
  88. "fill": getUrlById("a")
  89. }, null), (0, import_vue.createVNode)("path", {
  90. "d": "M123 15h22v14h9v77h-31V15z",
  91. "fill": getUrlById("a")
  92. }, null)])];
  93. const renderCloud = () => [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
  94. "id": getId("b"),
  95. "x1": "64%",
  96. "y1": "97%",
  97. "x2": "64%",
  98. "y2": "0%"
  99. }, [renderStop("#F2F3F5", 0, 0.3), renderStop("#F2F3F5", 100)])]), (0, import_vue.createVNode)("g", {
  100. "opacity": ".8"
  101. }, [(0, import_vue.createVNode)("path", {
  102. "d": "M87 6c3 0 7 3 8 6a8 8 0 1 1-1 16H80a7 7 0 0 1-8-6c0-4 3-7 6-7 0-5 4-9 9-9Z",
  103. "fill": getUrlById("b")
  104. }, null), (0, import_vue.createVNode)("path", {
  105. "d": "M19 23c2 0 3 1 4 3 2 0 4 2 4 4a4 4 0 0 1-4 3v1h-7v-1l-1 1c-2 0-3-2-3-4 0-1 1-3 3-3 0-2 2-4 4-4Z",
  106. "fill": getUrlById("b")
  107. }, null)])];
  108. const renderNetwork = () => (0, import_vue.createVNode)("svg", {
  109. "viewBox": "0 0 160 160"
  110. }, [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
  111. "id": getId(1),
  112. "x1": "64%",
  113. "y1": "100%",
  114. "x2": "64%"
  115. }, [renderStop("#FFF", 0, 0.5), renderStop("#F2F3F5", 100)]), (0, import_vue.createVNode)("linearGradient", {
  116. "id": getId(2),
  117. "x1": "50%",
  118. "x2": "50%",
  119. "y2": "84%"
  120. }, [renderStop("#EBEDF0", 0), renderStop("#DCDEE0", 100, 0)]), (0, import_vue.createVNode)("linearGradient", {
  121. "id": getId(3),
  122. "x1": "100%",
  123. "x2": "100%",
  124. "y2": "100%"
  125. }, [renderStops("#EAEDF0", "#DCDEE0")]), (0, import_vue.createVNode)("radialGradient", {
  126. "id": getId(4),
  127. "cx": "50%",
  128. "cy": "0%",
  129. "fx": "50%",
  130. "fy": "0%",
  131. "r": "100%",
  132. "gradientTransform": "matrix(0 1 -.54 0 .5 -.5)"
  133. }, [renderStop("#EBEDF0", 0), renderStop("#FFF", 100, 0)])]), (0, import_vue.createVNode)("g", {
  134. "fill": "none"
  135. }, [renderBuilding(), (0, import_vue.createVNode)("path", {
  136. "fill": getUrlById(4),
  137. "d": "M0 139h160v21H0z"
  138. }, null), (0, import_vue.createVNode)("path", {
  139. "d": "M80 54a7 7 0 0 1 3 13v27l-2 2h-2a2 2 0 0 1-2-2V67a7 7 0 0 1 3-13z",
  140. "fill": getUrlById(2)
  141. }, null), (0, import_vue.createVNode)("g", {
  142. "opacity": ".6",
  143. "stroke-linecap": "round",
  144. "stroke-width": "7"
  145. }, [(0, import_vue.createVNode)("path", {
  146. "d": "M64 47a19 19 0 0 0-5 13c0 5 2 10 5 13",
  147. "stroke": getUrlById(3)
  148. }, null), (0, import_vue.createVNode)("path", {
  149. "d": "M53 36a34 34 0 0 0 0 48",
  150. "stroke": getUrlById(3)
  151. }, null), (0, import_vue.createVNode)("path", {
  152. "d": "M95 73a19 19 0 0 0 6-13c0-5-2-9-6-13",
  153. "stroke": getUrlById(3)
  154. }, null), (0, import_vue.createVNode)("path", {
  155. "d": "M106 84a34 34 0 0 0 0-48",
  156. "stroke": getUrlById(3)
  157. }, null)]), (0, import_vue.createVNode)("g", {
  158. "transform": "translate(31 105)"
  159. }, [(0, import_vue.createVNode)("rect", {
  160. "fill": "#EBEDF0",
  161. "width": "98",
  162. "height": "34",
  163. "rx": "2"
  164. }, null), (0, import_vue.createVNode)("rect", {
  165. "fill": "#FFF",
  166. "x": "9",
  167. "y": "8",
  168. "width": "80",
  169. "height": "18",
  170. "rx": "1.1"
  171. }, null), (0, import_vue.createVNode)("rect", {
  172. "fill": "#EBEDF0",
  173. "x": "15",
  174. "y": "12",
  175. "width": "18",
  176. "height": "6",
  177. "rx": "1.1"
  178. }, null)])])]);
  179. const renderMaterial = () => (0, import_vue.createVNode)("svg", {
  180. "viewBox": "0 0 160 160"
  181. }, [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
  182. "x1": "50%",
  183. "x2": "50%",
  184. "y2": "100%",
  185. "id": getId(5)
  186. }, [renderStops("#F2F3F5", "#DCDEE0")]), (0, import_vue.createVNode)("linearGradient", {
  187. "x1": "95%",
  188. "y1": "48%",
  189. "x2": "5.5%",
  190. "y2": "51%",
  191. "id": getId(6)
  192. }, [renderStops("#EAEDF1", "#DCDEE0")]), (0, import_vue.createVNode)("linearGradient", {
  193. "y1": "45%",
  194. "x2": "100%",
  195. "y2": "54%",
  196. "id": getId(7)
  197. }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), (0, import_vue.createVNode)("g", {
  198. "transform": "translate(36 50)",
  199. "fill": "none"
  200. }, [(0, import_vue.createVNode)("g", {
  201. "transform": "translate(8)"
  202. }, [(0, import_vue.createVNode)("rect", {
  203. "fill": "#EBEDF0",
  204. "opacity": ".6",
  205. "x": "38",
  206. "y": "13",
  207. "width": "36",
  208. "height": "53",
  209. "rx": "2"
  210. }, null), (0, import_vue.createVNode)("rect", {
  211. "fill": getUrlById(5),
  212. "width": "64",
  213. "height": "66",
  214. "rx": "2"
  215. }, null), (0, import_vue.createVNode)("rect", {
  216. "fill": "#FFF",
  217. "x": "6",
  218. "y": "6",
  219. "width": "52",
  220. "height": "55",
  221. "rx": "1"
  222. }, null), (0, import_vue.createVNode)("g", {
  223. "transform": "translate(15 17)",
  224. "fill": getUrlById(6)
  225. }, [(0, import_vue.createVNode)("rect", {
  226. "width": "34",
  227. "height": "6",
  228. "rx": "1"
  229. }, null), (0, import_vue.createVNode)("path", {
  230. "d": "M0 14h34v6H0z"
  231. }, null), (0, import_vue.createVNode)("rect", {
  232. "y": "28",
  233. "width": "34",
  234. "height": "6",
  235. "rx": "1"
  236. }, null)])]), (0, import_vue.createVNode)("rect", {
  237. "fill": getUrlById(7),
  238. "y": "61",
  239. "width": "88",
  240. "height": "28",
  241. "rx": "1"
  242. }, null), (0, import_vue.createVNode)("rect", {
  243. "fill": "#F7F8FA",
  244. "x": "29",
  245. "y": "72",
  246. "width": "30",
  247. "height": "6",
  248. "rx": "1"
  249. }, null)])]);
  250. const renderError = () => (0, import_vue.createVNode)("svg", {
  251. "viewBox": "0 0 160 160"
  252. }, [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
  253. "x1": "50%",
  254. "x2": "50%",
  255. "y2": "100%",
  256. "id": getId(8)
  257. }, [renderStops("#EAEDF1", "#DCDEE0")])]), renderBuilding(), renderCloud(), renderShadow("c"), (0, import_vue.createVNode)("path", {
  258. "d": "m59 60 21 21 21-21h3l9 9v3L92 93l21 21v3l-9 9h-3l-21-21-21 21h-3l-9-9v-3l21-21-21-21v-3l9-9h3Z",
  259. "fill": getUrlById(8)
  260. }, null)]);
  261. const renderSearch = () => (0, import_vue.createVNode)("svg", {
  262. "viewBox": "0 0 160 160"
  263. }, [(0, import_vue.createVNode)("defs", null, [(0, import_vue.createVNode)("linearGradient", {
  264. "x1": "50%",
  265. "y1": "100%",
  266. "x2": "50%",
  267. "id": getId(9)
  268. }, [renderStops("#EEE", "#D8D8D8")]), (0, import_vue.createVNode)("linearGradient", {
  269. "x1": "100%",
  270. "y1": "50%",
  271. "y2": "50%",
  272. "id": getId(10)
  273. }, [renderStops("#F2F3F5", "#DCDEE0")]), (0, import_vue.createVNode)("linearGradient", {
  274. "x1": "50%",
  275. "x2": "50%",
  276. "y2": "100%",
  277. "id": getId(11)
  278. }, [renderStops("#F2F3F5", "#DCDEE0")]), (0, import_vue.createVNode)("linearGradient", {
  279. "x1": "50%",
  280. "x2": "50%",
  281. "y2": "100%",
  282. "id": getId(12)
  283. }, [renderStops("#FFF", "#F7F8FA")])]), renderBuilding(), renderCloud(), renderShadow("d"), (0, import_vue.createVNode)("g", {
  284. "transform": "rotate(-45 113 -4)",
  285. "fill": "none"
  286. }, [(0, import_vue.createVNode)("rect", {
  287. "fill": getUrlById(9),
  288. "x": "24",
  289. "y": "52.8",
  290. "width": "5.8",
  291. "height": "19",
  292. "rx": "1"
  293. }, null), (0, import_vue.createVNode)("rect", {
  294. "fill": getUrlById(10),
  295. "x": "22.1",
  296. "y": "67.3",
  297. "width": "9.9",
  298. "height": "28",
  299. "rx": "1"
  300. }, null), (0, import_vue.createVNode)("circle", {
  301. "stroke": getUrlById(11),
  302. "stroke-width": "8",
  303. "cx": "27",
  304. "cy": "27",
  305. "r": "27"
  306. }, null), (0, import_vue.createVNode)("circle", {
  307. "fill": getUrlById(12),
  308. "cx": "27",
  309. "cy": "27",
  310. "r": "16"
  311. }, null), (0, import_vue.createVNode)("path", {
  312. "d": "M37 7c-8 0-15 5-16 12",
  313. "stroke": getUrlById(11),
  314. "stroke-width": "3",
  315. "opacity": ".5",
  316. "stroke-linecap": "round",
  317. "transform": "rotate(45 29 13)"
  318. }, null)])]);
  319. const renderImage = () => {
  320. var _a;
  321. if (slots.image) {
  322. return slots.image();
  323. }
  324. const PRESET_IMAGES = {
  325. error: renderError,
  326. search: renderSearch,
  327. network: renderNetwork,
  328. default: renderMaterial
  329. };
  330. return ((_a = PRESET_IMAGES[props.image]) == null ? void 0 : _a.call(PRESET_IMAGES)) || (0, import_vue.createVNode)("img", {
  331. "src": props.image
  332. }, null);
  333. };
  334. return () => (0, import_vue.createVNode)("div", {
  335. "class": bem()
  336. }, [(0, import_vue.createVNode)("div", {
  337. "class": bem("image"),
  338. "style": (0, import_utils.getSizeStyle)(props.imageSize)
  339. }, [renderImage()]), renderDescription(), renderBottom()]);
  340. }
  341. });