UNPKG

ranui

Version:

A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.

72 lines (71 loc) 2.56 kB
import { n as a } from "./chunk-Y2CYZVJY-0JxdZxki.js"; import { x as h } from "./chunk-WYO6CB5R-DDHkKowO.js"; var m = /* @__PURE__ */ a((t) => { const { handDrawnSeed: e } = h(); return { fill: t, hachureAngle: 120, hachureGap: 4, fillWeight: 2, roughness: 0.7, stroke: t, seed: e }; }, "solidStateFill"), c = /* @__PURE__ */ a((t) => { const e = p([ ...t.cssCompiledStyles || [], ...t.cssStyles || [], ...t.labelStyle || [] ]); return { stylesMap: e, stylesArray: [...e] }; }, "compileStyles"), p = /* @__PURE__ */ a((t) => { const e = /* @__PURE__ */ new Map(); return t.forEach((r) => { const [o, i] = r.split(":"); e.set(o.trim(), i?.trim()); }), e; }, "styles2Map"), d = /* @__PURE__ */ a((t) => t === "color" || t === "font-size" || t === "font-family" || t === "font-weight" || t === "font-style" || t === "text-decoration" || t === "text-align" || t === "text-transform" || t === "line-height" || t === "letter-spacing" || t === "word-spacing" || t === "text-shadow" || t === "text-overflow" || t === "white-space" || t === "word-wrap" || t === "word-break" || t === "overflow-wrap" || t === "hyphens", "isLabelStyle"), S = /* @__PURE__ */ a((t) => { const { stylesArray: e } = c(t), r = [], o = [], i = [], l = []; return e.forEach((s) => { const n = s[0]; d(n) ? r.push(s.join(":") + " !important") : (o.push(s.join(":") + " !important"), n.includes("stroke") && i.push(s.join(":") + " !important"), n === "fill" && l.push(s.join(":") + " !important")); }), { labelStyles: r.join(";"), nodeStyles: o.join(";"), stylesArray: e, borderStyles: i, backgroundStyles: l }; }, "styles2String"), w = /* @__PURE__ */ a((t, e) => { const { themeVariables: r, handDrawnSeed: o } = h(), { nodeBorder: i, mainBkg: l } = r, { stylesMap: s } = c(t); return Object.assign({ roughness: 0.7, fill: s.get("fill") || l, fillStyle: "hachure", fillWeight: 4, hachureGap: 5.2, stroke: s.get("stroke") || i, seed: o, strokeWidth: s.get("stroke-width")?.replace("px", "") || 1.3, fillLineDash: [0, 0], strokeLineDash: f(s.get("stroke-dasharray")) }, e); }, "userNodeOverrides"), f = /* @__PURE__ */ a((t) => { if (!t) return [0, 0]; const e = t.trim().split(/\s+/).map(Number); if (e.length === 1) { const r = isNaN(e[0]) ? 0 : e[0]; return [r, r]; } return [isNaN(e[0]) ? 0 : e[0], isNaN(e[1]) ? 0 : e[1]]; }, "getStrokeDashArray"); export { w as a, S as i, d as n, m as r, c as t };