UNPKG

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