| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 | var __defProp = Object.defineProperty;var __getOwnPropDesc = Object.getOwnPropertyDescriptor;var __getOwnPropNames = Object.getOwnPropertyNames;var __hasOwnProp = Object.prototype.hasOwnProperty;var __export = (target, all) => {  for (var name2 in all)    __defProp(target, name2, { get: all[name2], enumerable: true });};var __copyProps = (to, from, except, desc) => {  if (from && typeof from === "object" || typeof from === "function") {    for (let key of __getOwnPropNames(from))      if (!__hasOwnProp.call(to, key) && key !== except)        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });  }  return to;};var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);var stdin_exports = {};__export(stdin_exports, {  default: () => stdin_default});module.exports = __toCommonJS(stdin_exports);var import_vue = require("vue");var import_vue2 = require("vue");var import_utils = require("../utils");const [name, bem] = (0, import_utils.createNamespace)("space");const spaceProps = {  align: String,  direction: {    type: String,    default: "horizontal"  },  size: {    type: [Number, String, Array],    default: 8  },  wrap: Boolean,  fill: Boolean};function filterEmpty(children = []) {  const nodes = [];  children.forEach((child) => {    if (Array.isArray(child)) {      nodes.push(...child);    } else if (child.type === import_vue2.Fragment) {      nodes.push(...filterEmpty(child.children));    } else {      nodes.push(child);    }  });  return nodes.filter((c) => {    var _a;    return !(c && (typeof Comment !== "undefined" && c.type === Comment || c.type === import_vue2.Fragment && ((_a = c.children) == null ? void 0 : _a.length) === 0 || c.type === Text && c.children.trim() === ""));  });}var stdin_default = (0, import_vue2.defineComponent)({  name,  props: spaceProps,  setup(props, {    slots  }) {    const mergedAlign = (0, import_vue2.computed)(() => {      var _a;      return (_a = props.align) != null ? _a : props.direction === "horizontal" ? "center" : "";    });    const getMargin = (size) => {      if (typeof size === "number") {        return size + "px";      }      return size;    };    const getMarginStyle = (isLast) => {      const style = {};      const marginRight = `${getMargin(Array.isArray(props.size) ? props.size[0] : props.size)}`;      const marginBottom = `${getMargin(Array.isArray(props.size) ? props.size[1] : props.size)}`;      if (isLast) {        return props.wrap ? {          marginBottom        } : {};      }      if (props.direction === "horizontal") {        style.marginRight = marginRight;      }      if (props.direction === "vertical" || props.wrap) {        style.marginBottom = marginBottom;      }      return style;    };    return () => {      var _a;      const children = filterEmpty((_a = slots.default) == null ? void 0 : _a.call(slots));      return (0, import_vue.createVNode)("div", {        "class": [bem({          [props.direction]: props.direction,          [`align-${mergedAlign.value}`]: mergedAlign.value,          wrap: props.wrap,          fill: props.fill        })]      }, [children.map((c, i) => (0, import_vue.createVNode)("div", {        "key": `item-${i}`,        "class": `${name}-item`,        "style": getMarginStyle(i === children.length - 1)      }, [c]))]);    };  }});
 |