uikit/dist/provider.js
Mohamadzadeh 43b4a2a42b
All checks were successful
Build and Deploy Next.js + Nginx Docker Image / build-and-deploy (push) Has been skipped
Build and Deploy Next.js + Nginx Docker Image / deploy (push) Has been skipped
refactor new BiProvider | v1.2.1
2026-10-26 13:58:14 +03:30

33 lines
989 B
JavaScript

"use client";
import t from "react";
import { g as u } from "./chunks/feature-registry-B2iuEiEx.js";
function m({ children: p }) {
const o = [], s = [];
function i(r) {
t.Children.forEach(r, (e) => {
if (t.isValidElement(e) && e.type === t.Fragment) {
i(e.props.children);
return;
}
const a = u(e);
a ? o.push({ feature: a, props: e.props }) : s.push(e);
});
}
i(p), o.sort((r, e) => r.feature.priority - e.feature.priority);
const n = /* @__PURE__ */ new Set();
for (const { feature: r } of o) {
if (n.has(r.name))
throw new Error(`BiProvider: duplicate <${r.name} /> declaration.`);
n.add(r.name);
}
if (n.has("NextPagesRouter") && n.has("NextAppRouter"))
throw new Error("BiProvider: select only one Next.js router adapter.");
return o.reduceRight(
(r, { feature: e, props: a }) => t.createElement(e.Provider, a, r),
t.createElement(t.Fragment, null, ...s)
);
}
export {
m as BiProvider
};