Empty.js 12 KB

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