y-design-ssr
Version:
SSR component library of YUI with Vue3
86 lines (85 loc) • 4.29 kB
JavaScript
import { ref as m, reactive as g } from "vue";
const n = (e) => (t) => Object.prototype.toString.call(t) === `[object ${e}]`, y = n("Arguments"), F = n("Function"), j = n("String"), U = n("Number"), D = n("Date"), G = n("RegExp"), W = n("Error"), I = n("Symbol"), _ = n("Map"), q = n("WeakMap"), w = n("Set"), K = n("WeakSet"), Q = n("Object"), X = n("Promise"), a = (e, t) => t ? typeof t == "string" ? ` ${e}--${t}` : Array.isArray(t) ? t.reduce((c, r) => c + a(e, r), "") : Object.keys(t).reduce(
(c, r) => c + (t[r] ? a(e, r) : ""),
""
) : "", d = (e) => (t, c) => {
let r = t, u = c;
return r && typeof r != "string" && (u = r, r = ""), r = r ? `${e}__${r}` : e, `${r}${a(r, u)}`;
}, o = () => (e, t) => t ? `${a(`y-${e}`, t)}` : `y-${e}`, f = {
"pull-refresh": {
pulling: "下拉刷新...",
loosing: "释放刷新...",
loading: "数据加载中...",
success: "数据已更新",
failed: "数据跟新失败,请稍后再试"
},
"form-item": {
validateMessage: "请输入正确内容"
}
}, s = m("zh-CN"), l = g({
"zh-CN": f
}), p = {
text() {
return l[s.value];
},
use(e, t) {
s.value = e, this.add({ [e]: t });
},
add(e = {}) {
Object.assign(l, e);
}
}, Y = (e) => {
const t = `y-${e}`;
return [t, d(t), o()];
}, Z = (e) => p.text()[e];
var b = /* @__PURE__ */ ((e) => (e.Mini = "mini", e.Small = "small", e.Middle = "middle", e.Large = "large", e))(b || {}), i = /* @__PURE__ */ ((e) => (e.Left = "left", e.Center = "center", e.Right = "right", e))(i || {}), N = /* @__PURE__ */ ((e) => (e.Top = "top", e.Middle = "middle", e.Bottom = "bottom", e))(N || {}), v = /* @__PURE__ */ ((e) => (e.Relative = "relative", e.Absolute = "absolute", e.Fixed = "fixed", e))(v || {}), h = /* @__PURE__ */ ((e) => (e.Top = "top", e.Right = "right", e.Bottom = "bottom", e.Left = "left", e.Center = "center", e))(h || {}), E = /* @__PURE__ */ ((e) => (e.clockwise = "clockwise", e.counterclockwise = "counterclockwise", e))(E || {}), x = /* @__PURE__ */ ((e) => (e.simple = "simple", e.multi = "multi", e))(x || {}), $ = /* @__PURE__ */ ((e) => (e.Top = "top", e.TopStart = "top-start", e.TopEnd = "top-end", e.Right = "right", e.RightStart = "right-start", e.RightEnd = "right-end", e.Left = "left", e.LeftStart = "left-start", e.LeftEnd = "left-end", e.Bottom = "bottom", e.BottomStart = "bottom-start", e.BottomEnd = "bottom-end", e))($ || {}), O = /* @__PURE__ */ ((e) => (e.left = "left", e.top = "top", e.bottom = "bottom", e.right = "right", e))(O || {}), B = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(B || {}), L = /* @__PURE__ */ ((e) => (e.Flex = "flex", e.Default = "", e))(L || {}), S = /* @__PURE__ */ ((e) => (e.Start = "start", e.Center = "center", e.End = "end", e.SpaceBetween = "space-between", e.SpaceAround = "space-around", e))(S || {}), C = /* @__PURE__ */ ((e) => (e.DEFUALT = "normal", e.PULLING = "pulling", e.LOOSING = "loosing", e.LOADING = "loading", e.SUCCESS = "success", e.FAILED = "failed", e))(C || {}), M = /* @__PURE__ */ ((e) => (e.ONCHANGE = "onChange", e.ONBLUR = "onBlur", e))(M || {}), k = /* @__PURE__ */ ((e) => (e.UP = "up", e.DOWN = "down", e))(k || {});
const H = (e) => isNaN(Number(e)) && typeof e == "string" ? e : `${e}px`, R = (e, t) => typeof e == "string" && e.includes("%") && e.includes("%") ? t * Number(e.replace(/%/g, "")) / 100 : Number(e), V = (e) => {
switch (e) {
case "top":
return "column-reverse";
case "bottom":
return "column";
case "left":
return "row-reverse";
case "right":
return "row";
default:
return "column";
}
};
export {
B as Align,
E as Direction,
k as DropdownDirection,
i as Horizontal,
h as Location,
x as PaginationMode,
v as Position,
C as RefreshStatus,
S as RowJustify,
L as RowType,
b as Size,
O as SwipePosition,
$ as TooltipPosition,
M as TriggerTypes,
N as Vertical,
Z as createLocale,
Y as createNamespace,
y as isArguments,
D as isDate,
W as isError,
F as isFunction,
_ as isMap,
U as isNumber,
Q as isObject,
X as isPromise,
G as isRegExp,
w as isSet,
j as isString,
I as isSymbol,
q as isWeakMap,
K as isWeakSet,
V as parseFlexDirection,
R as parsePercent,
H as parseUnit
};