-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
210d1e6
commit 62d7ef6
Showing
360 changed files
with
556,310 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { DetailedError } from './utils.js'; | ||
import type { DiagramDefinition, DiagramMetadata } from './diagram-api/types.js'; | ||
export type ParseErrorFunction = (err: string | DetailedError | unknown, hash?: any) => void; | ||
/** | ||
* An object representing a parsed mermaid diagram definition. | ||
* @privateRemarks This is exported as part of the public mermaidAPI. | ||
*/ | ||
export declare class Diagram { | ||
text: string; | ||
metadata: Pick<DiagramMetadata, 'title'>; | ||
type: string; | ||
parser: DiagramDefinition['parser']; | ||
renderer: DiagramDefinition['renderer']; | ||
db: DiagramDefinition['db']; | ||
private init?; | ||
private detectError?; | ||
constructor(text: string, metadata?: Pick<DiagramMetadata, 'title'>); | ||
parse(): void; | ||
render(id: string, version: string): Promise<void>; | ||
getParser(): import("./diagram-api/types.js").ParserDefinition; | ||
getType(): string; | ||
} | ||
/** | ||
* Parse the text asynchronously and generate a Diagram object asynchronously. | ||
* **Warning:** This function may be changed in the future. | ||
* @alpha | ||
* @param text - The mermaid diagram definition. | ||
* @param metadata - Diagram metadata, defined in YAML. | ||
* @returns A the Promise of a Diagram object. | ||
* @throws {@link UnknownDiagramError} if the diagram type can not be found. | ||
* @privateRemarks This is exported as part of the public mermaidAPI. | ||
*/ | ||
export declare const getDiagramFromText: (text: string, metadata?: Pick<DiagramMetadata, 'title'>) => Promise<Diagram>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function colors(specifier) { | ||
var n = specifier.length / 6 | 0, colors2 = new Array(n), i = 0; | ||
while (i < n) | ||
colors2[i] = "#" + specifier.slice(i * 6, ++i * 6); | ||
return colors2; | ||
} | ||
const d3schemeTableau10 = colors("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"); | ||
export { | ||
d3schemeTableau10 as d | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function o(e) { | ||
for (var c = e.length / 6 | 0, n = new Array(c), a = 0; a < c; ) | ||
n[a] = "#" + e.slice(a * 6, ++a * 6); | ||
return n; | ||
} | ||
const r = o("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"); | ||
export { | ||
r as d | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export declare const mermaidAPI: { | ||
render: import("@vitest/spy").Mock<any, any>; | ||
parse: (text: string, parseOptions?: import("../mermaidAPI.js").ParseOptions | undefined) => Promise<boolean>; | ||
initialize: import("@vitest/spy").Mock<any, any>; | ||
getConfig: () => import("../config.type.js").MermaidConfig; | ||
setConfig: (conf: import("../config.type.js").MermaidConfig) => import("../config.type.js").MermaidConfig; | ||
getSiteConfig: () => import("../config.type.js").MermaidConfig; | ||
updateSiteConfig: (conf: import("../config.type.js").MermaidConfig) => import("../config.type.js").MermaidConfig; | ||
reset: () => void; | ||
globalReset: () => void; | ||
defaultConfig: import("../config.type.js").MermaidConfig; | ||
}; | ||
export default mermaidAPI; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Accessibility (a11y) functions, types, helpers. | ||
* | ||
* @see https://www.w3.org/WAI/ | ||
* @see https://www.w3.org/TR/wai-aria-1.1/ | ||
* @see https://www.w3.org/TR/svg-aam-1.0/ | ||
*/ | ||
import type { D3Element } from './mermaidAPI.js'; | ||
/** | ||
* Add role and aria-roledescription to the svg element. | ||
* | ||
* @param svg - d3 object that contains the SVG HTML element | ||
* @param diagramType - diagram name for to the aria-roledescription | ||
*/ | ||
export declare function setA11yDiagramInfo(svg: D3Element, diagramType: string): void; | ||
/** | ||
* Add an accessible title and/or description element to a chart. | ||
* The title is usually not displayed and the description is never displayed. | ||
* | ||
* The following charts display their title as a visual and accessibility element: gantt. | ||
* | ||
* @param svg - d3 node to insert the a11y title and desc info | ||
* @param a11yTitle - a11y title. undefined or empty strings mean to skip them | ||
* @param a11yDesc - a11y description. undefined or empty strings mean to skip them | ||
* @param baseId - id used to construct the a11y title and description id | ||
*/ | ||
export declare function addSVGa11yTitleDescription(svg: D3Element, a11yTitle: string | undefined, a11yDesc: string | undefined, baseId: string): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
import { w as withPath, c as constant } from "./path-39bad7e2.js"; | ||
import { aw as pi, ax as cos, ay as sin, az as halfPi, aA as epsilon, V as tau, aB as sqrt, aC as min, aD as abs, aE as atan2, aF as asin, aG as acos, aH as max } from "./mermaid-dcacb631.js"; | ||
function arcInnerRadius(d) { | ||
return d.innerRadius; | ||
} | ||
function arcOuterRadius(d) { | ||
return d.outerRadius; | ||
} | ||
function arcStartAngle(d) { | ||
return d.startAngle; | ||
} | ||
function arcEndAngle(d) { | ||
return d.endAngle; | ||
} | ||
function arcPadAngle(d) { | ||
return d && d.padAngle; | ||
} | ||
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { | ||
var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; | ||
if (t * t < epsilon) | ||
return; | ||
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t; | ||
return [x0 + t * x10, y0 + t * y10]; | ||
} | ||
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { | ||
var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; | ||
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) | ||
cx0 = cx1, cy0 = cy1; | ||
return { | ||
cx: cx0, | ||
cy: cy0, | ||
x01: -ox, | ||
y01: -oy, | ||
x11: cx0 * (r1 / r - 1), | ||
y11: cy0 * (r1 / r - 1) | ||
}; | ||
} | ||
function d3arc() { | ||
var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = withPath(arc); | ||
function arc() { | ||
var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0; | ||
if (!context) | ||
context = buffer = path(); | ||
if (r1 < r0) | ||
r = r1, r1 = r0, r0 = r; | ||
if (!(r1 > epsilon)) | ||
context.moveTo(0, 0); | ||
else if (da > tau - epsilon) { | ||
context.moveTo(r1 * cos(a0), r1 * sin(a0)); | ||
context.arc(0, 0, r1, a0, a1, !cw); | ||
if (r0 > epsilon) { | ||
context.moveTo(r0 * cos(a1), r0 * sin(a1)); | ||
context.arc(0, 0, r0, a1, a0, cw); | ||
} | ||
} else { | ||
var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1; | ||
if (rp > epsilon) { | ||
var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap)); | ||
if ((da0 -= p0 * 2) > epsilon) | ||
p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0; | ||
else | ||
da0 = 0, a00 = a10 = (a0 + a1) / 2; | ||
if ((da1 -= p1 * 2) > epsilon) | ||
p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1; | ||
else | ||
da1 = 0, a01 = a11 = (a0 + a1) / 2; | ||
} | ||
var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10); | ||
if (rc > epsilon) { | ||
var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc; | ||
if (da < pi) { | ||
if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) { | ||
var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); | ||
rc0 = min(rc, (r0 - lc) / (kc - 1)); | ||
rc1 = min(rc, (r1 - lc) / (kc + 1)); | ||
} else { | ||
rc0 = rc1 = 0; | ||
} | ||
} | ||
} | ||
if (!(da1 > epsilon)) | ||
context.moveTo(x01, y01); | ||
else if (rc1 > epsilon) { | ||
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); | ||
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); | ||
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); | ||
if (rc1 < rc) | ||
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); | ||
else { | ||
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); | ||
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw); | ||
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw); | ||
} | ||
} else | ||
context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); | ||
if (!(r0 > epsilon) || !(da0 > epsilon)) | ||
context.lineTo(x10, y10); | ||
else if (rc0 > epsilon) { | ||
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); | ||
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); | ||
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); | ||
if (rc0 < rc) | ||
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); | ||
else { | ||
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw); | ||
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw); | ||
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw); | ||
} | ||
} else | ||
context.arc(0, 0, r0, a10, a00, cw); | ||
} | ||
context.closePath(); | ||
if (buffer) | ||
return context = null, buffer + "" || null; | ||
} | ||
arc.centroid = function() { | ||
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2; | ||
return [cos(a) * r, sin(a) * r]; | ||
}; | ||
arc.innerRadius = function(_) { | ||
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius; | ||
}; | ||
arc.outerRadius = function(_) { | ||
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius; | ||
}; | ||
arc.cornerRadius = function(_) { | ||
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius; | ||
}; | ||
arc.padRadius = function(_) { | ||
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius; | ||
}; | ||
arc.startAngle = function(_) { | ||
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle; | ||
}; | ||
arc.endAngle = function(_) { | ||
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle; | ||
}; | ||
arc.padAngle = function(_) { | ||
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle; | ||
}; | ||
arc.context = function(_) { | ||
return arguments.length ? (context = _ == null ? null : _, arc) : context; | ||
}; | ||
return arc; | ||
} | ||
export { | ||
d3arc as d | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { w as ln, c as H } from "./path-428ebac9.js"; | ||
import { aw as an, ax as V, ay as D, az as rn, aA as y, V as on, aB as K, aC as _, aD as un, aE as t, aF as sn, aG as tn, aH as fn } from "./mermaid-9f2aa176.js"; | ||
function cn(l) { | ||
return l.innerRadius; | ||
} | ||
function yn(l) { | ||
return l.outerRadius; | ||
} | ||
function gn(l) { | ||
return l.startAngle; | ||
} | ||
function mn(l) { | ||
return l.endAngle; | ||
} | ||
function pn(l) { | ||
return l && l.padAngle; | ||
} | ||
function dn(l, h, z, E, v, A, I, a) { | ||
var B = z - l, i = E - h, n = I - v, m = a - A, r = m * B - n * i; | ||
if (!(r * r < y)) | ||
return r = (n * (h - A) - m * (l - v)) / r, [l + r * B, h + r * i]; | ||
} | ||
function W(l, h, z, E, v, A, I) { | ||
var a = l - z, B = h - E, i = (I ? A : -A) / K(a * a + B * B), n = i * B, m = -i * a, r = l + n, s = h + m, f = z + n, c = E + m, O = (r + f) / 2, o = (s + c) / 2, p = f - r, g = c - s, R = p * p + g * g, T = v - A, w = r * c - f * s, C = (g < 0 ? -1 : 1) * K(fn(0, T * T * R - w * w)), F = (w * g - p * C) / R, G = (-w * p - g * C) / R, P = (w * g + p * C) / R, d = (-w * p + g * C) / R, x = F - O, e = G - o, u = P - O, S = d - o; | ||
return x * x + e * e > u * u + S * S && (F = P, G = d), { | ||
cx: F, | ||
cy: G, | ||
x01: -n, | ||
y01: -m, | ||
x11: F * (v / T - 1), | ||
y11: G * (v / T - 1) | ||
}; | ||
} | ||
function vn() { | ||
var l = cn, h = yn, z = H(0), E = null, v = gn, A = mn, I = pn, a = null, B = ln(i); | ||
function i() { | ||
var n, m, r = +l.apply(this, arguments), s = +h.apply(this, arguments), f = v.apply(this, arguments) - rn, c = A.apply(this, arguments) - rn, O = un(c - f), o = c > f; | ||
if (a || (a = n = B()), s < r && (m = s, s = r, r = m), !(s > y)) | ||
a.moveTo(0, 0); | ||
else if (O > on - y) | ||
a.moveTo(s * V(f), s * D(f)), a.arc(0, 0, s, f, c, !o), r > y && (a.moveTo(r * V(c), r * D(c)), a.arc(0, 0, r, c, f, o)); | ||
else { | ||
var p = f, g = c, R = f, T = c, w = O, C = O, F = I.apply(this, arguments) / 2, G = F > y && (E ? +E.apply(this, arguments) : K(r * r + s * s)), P = _(un(s - r) / 2, +z.apply(this, arguments)), d = P, x = P, e, u; | ||
if (G > y) { | ||
var S = sn(G / r * D(F)), L = sn(G / s * D(F)); | ||
(w -= S * 2) > y ? (S *= o ? 1 : -1, R += S, T -= S) : (w = 0, R = T = (f + c) / 2), (C -= L * 2) > y ? (L *= o ? 1 : -1, p += L, g -= L) : (C = 0, p = g = (f + c) / 2); | ||
} | ||
var j = s * V(p), J = s * D(p), M = r * V(T), N = r * D(T); | ||
if (P > y) { | ||
var Q = s * V(g), U = s * D(g), X = r * V(R), Y = r * D(R), q; | ||
if (O < an) | ||
if (q = dn(j, J, X, Y, Q, U, M, N)) { | ||
var Z = j - q[0], $ = J - q[1], k = Q - q[0], b = U - q[1], nn = 1 / D(tn((Z * k + $ * b) / (K(Z * Z + $ * $) * K(k * k + b * b))) / 2), en = K(q[0] * q[0] + q[1] * q[1]); | ||
d = _(P, (r - en) / (nn - 1)), x = _(P, (s - en) / (nn + 1)); | ||
} else | ||
d = x = 0; | ||
} | ||
C > y ? x > y ? (e = W(X, Y, j, J, s, x, o), u = W(Q, U, M, N, s, x, o), a.moveTo(e.cx + e.x01, e.cy + e.y01), x < P ? a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, x, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, s, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), !o), a.arc(u.cx, u.cy, x, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : (a.moveTo(j, J), a.arc(0, 0, s, p, g, !o)) : a.moveTo(j, J), !(r > y) || !(w > y) ? a.lineTo(M, N) : d > y ? (e = W(M, N, Q, U, r, -d, o), u = W(j, J, X, Y, r, -d, o), a.lineTo(e.cx + e.x01, e.cy + e.y01), d < P ? a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(u.y01, u.x01), !o) : (a.arc(e.cx, e.cy, d, t(e.y01, e.x01), t(e.y11, e.x11), !o), a.arc(0, 0, r, t(e.cy + e.y11, e.cx + e.x11), t(u.cy + u.y11, u.cx + u.x11), o), a.arc(u.cx, u.cy, d, t(u.y11, u.x11), t(u.y01, u.x01), !o))) : a.arc(0, 0, r, T, R, o); | ||
} | ||
if (a.closePath(), n) | ||
return a = null, n + "" || null; | ||
} | ||
return i.centroid = function() { | ||
var n = (+l.apply(this, arguments) + +h.apply(this, arguments)) / 2, m = (+v.apply(this, arguments) + +A.apply(this, arguments)) / 2 - an / 2; | ||
return [V(m) * n, D(m) * n]; | ||
}, i.innerRadius = function(n) { | ||
return arguments.length ? (l = typeof n == "function" ? n : H(+n), i) : l; | ||
}, i.outerRadius = function(n) { | ||
return arguments.length ? (h = typeof n == "function" ? n : H(+n), i) : h; | ||
}, i.cornerRadius = function(n) { | ||
return arguments.length ? (z = typeof n == "function" ? n : H(+n), i) : z; | ||
}, i.padRadius = function(n) { | ||
return arguments.length ? (E = n == null ? null : typeof n == "function" ? n : H(+n), i) : E; | ||
}, i.startAngle = function(n) { | ||
return arguments.length ? (v = typeof n == "function" ? n : H(+n), i) : v; | ||
}, i.endAngle = function(n) { | ||
return arguments.length ? (A = typeof n == "function" ? n : H(+n), i) : A; | ||
}, i.padAngle = function(n) { | ||
return arguments.length ? (I = typeof n == "function" ? n : H(+n), i) : I; | ||
}, i.context = function(n) { | ||
return arguments.length ? (a = n ?? null, i) : a; | ||
}, i; | ||
} | ||
export { | ||
vn as d | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function t(r) { | ||
return typeof r == "object" && "length" in r ? r : Array.from(r); | ||
} | ||
export { | ||
t as a | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function array(x) { | ||
return typeof x === "object" && "length" in x ? x : Array.from(x); | ||
} | ||
export { | ||
array as a | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* assignWithDepth Extends the functionality of {@link Object.assign} with the | ||
* ability to merge arbitrary-depth objects For each key in src with path `k` (recursively) | ||
* performs an Object.assign(dst[`k`], src[`k`]) with a slight change from the typical handling of | ||
* undefined for dst[`k`]: instead of raising an error, dst[`k`] is auto-initialized to `{}` and | ||
* effectively merged with src[`k`]<p> Additionally, dissimilar types will not clobber unless the | ||
* config.clobber parameter === true. Example: | ||
* | ||
* ``` | ||
* const config_0 = { foo: { bar: 'bar' }, bar: 'foo' }; | ||
* const config_1 = { foo: 'foo', bar: 'bar' }; | ||
* const result = assignWithDepth(config_0, config_1); | ||
* console.log(result); | ||
* //-> result: { foo: { bar: 'bar' }, bar: 'bar' } | ||
* ``` | ||
* | ||
* Traditional Object.assign would have clobbered foo in config_0 with foo in config_1. If src is a | ||
* destructured array of objects and dst is not an array, assignWithDepth will apply each element | ||
* of src to dst in order. | ||
* @param dst - The destination of the merge | ||
* @param src - The source object(s) to merge into destination | ||
* @param config - | ||
* * depth: depth to traverse within src and dst for merging | ||
* * clobber: should dissimilar types clobber | ||
*/ | ||
declare const assignWithDepth: (dst: any, src: any, { depth, clobber }?: { | ||
depth?: number | undefined; | ||
clobber?: boolean | undefined; | ||
}) => any; | ||
export default assignWithDepth; |
Oops, something went wrong.