fix
All checks were successful
Build and Deploy Next.js + Nginx Docker Image / build-and-deploy (push) Successful in 50s
Build and Deploy Next.js + Nginx Docker Image / deploy (push) Successful in 6s

This commit is contained in:
Mohamadzadeh 2026-07-13 15:07:58 +03:30
parent 414a95a3bb
commit 0a14270aaa
2 changed files with 37 additions and 28 deletions

56
dist/remote-ui.js vendored
View File

@ -1,15 +1,15 @@
import { jsx as _ } from "react/jsx-runtime";
import g, { useRef as u, useEffect as m } from "react";
import { createRoot as h } from "react-dom/client";
import { jsx as g } from "react/jsx-runtime";
import h, { useRef as u, useEffect as m } from "react";
import { createRoot as _ } from "react-dom/client";
import { Badge as E, ChakraProvider as P } from "@chakra-ui/react";
const p = "https://uikit.d.aiengines.ir/GBadge.js", d = "__UIKIT_REMOTE_DEPS__", s = "__UIKIT_REMOTE_CONFIG__", i = /* @__PURE__ */ new Map();
const R = "https://uikit.d.aiengines.ir/GBadge.js", d = "__UIKIT_REMOTE_DEPS__", f = "__UIKIT_REMOTE_CONFIG__", i = /* @__PURE__ */ new Map();
function w(e = {}) {
if (typeof window > "u") return;
const r = window[d] || {}, o = window[s] || {};
const r = window[d] || {}, n = window[f] || {};
window[d] = {
...r,
React: e.React || r.React || g,
createRoot: e.createRoot || r.createRoot || h,
React: e.React || r.React || h,
createRoot: e.createRoot || r.createRoot || _,
ChakraProvider: e.ChakraProvider || r.ChakraProvider || P,
Badge: e.Badge || r.Badge || E,
theme: Object.prototype.hasOwnProperty.call(e, "theme") ? e.theme : r.theme,
@ -17,17 +17,19 @@ function w(e = {}) {
...r.chakraProviderProps || {},
...e.chakraProviderProps || {}
}
}, window[s] = {
...o,
}, window[f] = {
...n,
...e.remoteUrl ? { GBadgeUrl: e.remoteUrl } : {}
};
}
function v() {
typeof window > "u" || window[d] || w();
if (typeof window > "u") return;
const e = window[d];
(!(e != null && e.React) || !(e != null && e.createRoot) || !(e != null && e.ChakraProvider) || !(e != null && e.Badge)) && w();
}
function k() {
var e;
return typeof window > "u" ? p : ((e = window[s]) == null ? void 0 : e.GBadgeUrl) || p;
return typeof window > "u" ? R : ((e = window[f]) == null ? void 0 : e.GBadgeUrl) || R;
}
function y() {
const e = k();
@ -52,33 +54,33 @@ function B(e) {
const T = ({
children: e,
remoteUrl: r,
theme: o,
chakraProviderProps: f,
...R
theme: n,
chakraProviderProps: s,
...p
}) => {
const c = u(null), t = u(null), a = u(null);
return a.current = {
...R,
const a = u(null), t = u(null), c = u(null);
return c.current = {
...p,
children: B(e),
...o !== void 0 ? { theme: o } : {},
...f ? { chakraProviderProps: f } : {}
...n !== void 0 ? { theme: n } : {},
...s ? { chakraProviderProps: s } : {}
}, m(() => {
let l = !0;
return v(), r && w({ remoteUrl: r }), y().then(() => {
if (!l || !c.current) return;
const n = document.createElement("uikit-g-badge");
n.componentProps = a.current, c.current.appendChild(n), t.current = n;
}).catch((n) => {
console.error("[uikit/remote/ui] Failed to load GBadge:", n);
if (!l || !a.current) return;
const o = document.createElement("uikit-g-badge");
o.componentProps = c.current, a.current.appendChild(o), t.current = o;
}).catch((o) => {
console.error("[uikit/remote/ui] Failed to load GBadge:", o);
}), () => {
l = !1, t.current && (t.current.remove(), t.current = null);
};
}, [r]), m(() => {
t.current && (t.current.componentProps = a.current);
}), /* @__PURE__ */ _(
t.current && (t.current.componentProps = c.current);
}), /* @__PURE__ */ g(
"span",
{
ref: c,
ref: a,
style: {
display: "contents"
}

View File

@ -41,7 +41,14 @@ export function setupUikitRemoteDeps(options = {}) {
function ensureRemoteDeps() {
if (typeof window === "undefined") return;
if (!window[REMOTE_DEPS_KEY]) {
const deps = window[REMOTE_DEPS_KEY];
if (
!deps?.React ||
!deps?.createRoot ||
!deps?.ChakraProvider ||
!deps?.Badge
) {
setupUikitRemoteDeps();
}
}