uikit/dist/chunks/_shared-DHh79jO9.js
Mohamadzadeh f11313909d
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
add new BiProvider and v1.1.0
2026-10-25 16:15:10 +03:30

45 lines
1.2 KiB
JavaScript

import n from "react";
const p = Symbol.for("uikit.provider.feature.v1");
function d(o, r, i) {
function a() {
return null;
}
return a.displayName = `BiProvider.${o}`, Object.defineProperty(a, p, {
value: Object.freeze({ name: o, priority: r, Provider: i })
}), a;
}
function f(o) {
var r;
return n.isValidElement(o) ? (r = o.type) == null ? void 0 : r[p] : void 0;
}
function l({ children: o }) {
const r = [], i = [];
function a(t) {
n.Children.forEach(t, (e) => {
if (n.isValidElement(e) && e.type === n.Fragment) {
a(e.props.children);
return;
}
const s = f(e);
s ? r.push({ feature: s, props: e.props }) : i.push(e);
});
}
a(o), r.sort((t, e) => t.feature.priority - e.feature.priority);
const u = /* @__PURE__ */ new Set();
for (const { feature: t } of r) {
if (u.has(t.name))
throw new Error(`BiProvider: duplicate <${t.name} /> declaration.`);
u.add(t.name);
}
if (u.has("NextPagesRouter") && u.has("NextAppRouter"))
throw new Error("BiProvider: select only one Next.js router adapter.");
return r.reduceRight(
(t, { feature: e, props: s }) => n.createElement(e.Provider, s, t),
n.createElement(n.Fragment, null, ...i)
);
}
export {
l as B,
d
};