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.

108 lines (107 loc) 2.93 kB
import { t as m, u as l } from "./mermaid-parser.core-uIDZYuBu.js"; import { n as t } from "./chunk-Y2CYZVJY-0JxdZxki.js"; import { m as n } from "./src-DtRLxcYO.js"; import "./chunk-WYO6CB5R-DDHkKowO.js"; import "./chunk-VAUOI2AC-izt0o4id.js"; import { n as p, r as u, t as a } from "./chunk-MOJQB5TN-BC46HDyu.js"; import { t as c } from "./chunk-JWPE2WC7-CGEmUMMZ.js"; var f = l().RailroadPeg.parser.LangiumParser, i = /* @__PURE__ */ t((e) => { const r = e.alternatives.map(d); return r.length === 1 ? r[0] : { type: "choice", alternatives: r }; }, "transformOrderedChoice"), d = /* @__PURE__ */ t((e) => { const r = e.elements.map(P); return r.length === 1 ? r[0] : { type: "sequence", elements: r }; }, "transformSequence"), P = /* @__PURE__ */ t((e) => { const r = g(e.suffix); return e.operator ? { type: "special", text: e.operator === "&" ? `&${s(r)}` : `!${s(r)}` } : r; }, "transformPrefix"), s = /* @__PURE__ */ t((e) => { switch (e.type) { case "terminal": return `"${e.value}"`; case "nonterminal": return e.name; case "special": return e.text; default: return "(...)"; } }, "nodeToLabel"), g = /* @__PURE__ */ t((e) => { const r = y(e.primary); if (!e.operator) return r; switch (e.operator) { case "?": return { type: "optional", element: r }; case "*": return { type: "repetition", element: r, min: 0, max: 1 / 0 }; case "+": return { type: "repetition", element: r, min: 1, max: 1 / 0 }; default: throw new Error(`Unsupported PEG suffix operator: ${e.operator}`); } }, "transformSuffix"), y = /* @__PURE__ */ t((e) => { switch (e.$type) { case "PegLiteral": return { type: "terminal", value: e.value }; case "PegIdentifier": return { type: "nonterminal", name: e.name }; case "PegGroup": return i(e.element); case "PegAny": return { type: "special", text: e.dot }; default: throw new Error(`Unsupported PEG primary node: ${e.$type}`); } }, "transformPrimary"), v = /* @__PURE__ */ t((e) => ({ name: e.name, definition: i(e.definition) }), "transformRule"), h = /* @__PURE__ */ t((e) => { c(e, a), e.title && a.setTitle(e.title), e.rules.map((r) => a.addRule(v(r))); }, "populateDb"), L = { parser: { parse: /* @__PURE__ */ t((e) => { a.clear(), n.debug("[PEG Parser] Starting Langium parse"); const r = f.parse(e); if (r.lexerErrors.length > 0 || r.parserErrors.length > 0) throw new m(r); const o = r.value; n.debug("[PEG Parser] Parsed rules:", o.rules.length), h(o), n.debug("[PEG Parser] Parse complete"); }, "parse"), parser: { yy: a } }, db: a, renderer: u, styles: p }; export { L as diagram };