@nexushub/client 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-NOIMIIA5.js +53 -0
- package/dist/chunk-VFVPDENW.cjs +53 -0
- package/dist/cli.cjs +460 -99
- package/dist/content/binary-compiler.cjs +135 -0
- package/dist/content/binary-compiler.d.cts +28 -0
- package/dist/content/binary-compiler.d.ts +28 -0
- package/dist/content/binary-compiler.js +100 -0
- package/dist/content/local-cache-server.cjs +184 -52
- package/dist/content/local-cache-server.d.cts +9 -4
- package/dist/content/local-cache-server.d.ts +9 -4
- package/dist/content/local-cache-server.js +184 -52
- package/dist/index.cjs +221 -99
- package/dist/index.js +221 -99
- package/dist/local-cache-server-BNLLL4NR.js +224 -0
- package/dist/local-cache-server-SF5SXE7H.cjs +224 -0
- package/dist/react.cjs +399 -78
- package/dist/react.d.cts +140 -1
- package/dist/react.d.ts +140 -1
- package/dist/react.js +370 -49
- package/package.json +2 -1
- package/dist/local-cache-server-6DXQJFCQ.cjs +0 -114
- package/dist/local-cache-server-DBJWR7HD.js +0 -114
package/dist/react.cjs
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkVFVPDENWcjs = require('./chunk-VFVPDENW.cjs');
|
|
5
|
+
|
|
6
|
+
// src/components/NexusProvider.tsx
|
|
2
7
|
|
|
3
8
|
|
|
4
9
|
|
|
@@ -10,54 +15,6 @@
|
|
|
10
15
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
11
16
|
var _navigation = require('next/navigation');
|
|
12
17
|
|
|
13
|
-
// src/config.ts
|
|
14
|
-
var DEFAULT_API_URL = "https://endpoints.gnexus.co.tz";
|
|
15
|
-
var DEFAULT_ANALYTICS_URL = "https://sentry.gnexus.co.tz";
|
|
16
|
-
var LOCAL_NEST_URL = "https://endpoints.gnexus.co.tz";
|
|
17
|
-
var LOCAL_RUST_URL = "https://sentry.gnexus.co.tz";
|
|
18
|
-
var getEnvConfig = () => {
|
|
19
|
-
const NEXT_PUBLIC_ID = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_NEXUS_ID : void 0;
|
|
20
|
-
const NEXT_PUBLIC_KEY = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_NEXUS_KEY : void 0;
|
|
21
|
-
const NEXT_PUBLIC_URL = typeof process !== "undefined" ? process.env.NEXT_PUBLIC_NEXUS_API_URL : void 0;
|
|
22
|
-
const NODE_ID = typeof process !== "undefined" ? process.env.NEXUS_PROJECT_ID : void 0;
|
|
23
|
-
const NODE_KEY = typeof process !== "undefined" ? process.env.NEXUS_API_KEY : void 0;
|
|
24
|
-
const NODE_URL = typeof process !== "undefined" ? process.env.NEXUS_API_URL : void 0;
|
|
25
|
-
const NODE_ENV = typeof process !== "undefined" ? process.env.NODE_ENV : "production";
|
|
26
|
-
const isDev = NODE_ENV === "development" || typeof window !== "undefined" && window.location.hostname === "localhost";
|
|
27
|
-
const projectId = _nullishCoalesce(NEXT_PUBLIC_ID, () => ( NODE_ID));
|
|
28
|
-
const apiKey = _nullishCoalesce(NEXT_PUBLIC_KEY, () => ( NODE_KEY));
|
|
29
|
-
const apiUrl = _nullishCoalesce(_nullishCoalesce(NEXT_PUBLIC_URL, () => ( NODE_URL)), () => ( (isDev ? LOCAL_NEST_URL : DEFAULT_API_URL)));
|
|
30
|
-
const analyticsUrl = apiUrl.includes("localhost") ? LOCAL_RUST_URL : DEFAULT_ANALYTICS_URL;
|
|
31
|
-
return {
|
|
32
|
-
projectId,
|
|
33
|
-
apiKey,
|
|
34
|
-
apiUrl,
|
|
35
|
-
analyticsUrl
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
var mergeConfigs = (base, override) => {
|
|
39
|
-
const mergedApiUrl = override.apiUrl || base.apiUrl || DEFAULT_API_URL;
|
|
40
|
-
const mergedAnalyticsUrl = override.analyticsUrl || base.analyticsUrl || (mergedApiUrl.includes("localhost") ? LOCAL_RUST_URL : DEFAULT_ANALYTICS_URL);
|
|
41
|
-
return {
|
|
42
|
-
...base,
|
|
43
|
-
...override,
|
|
44
|
-
apiUrl: mergedApiUrl,
|
|
45
|
-
analyticsUrl: mergedAnalyticsUrl,
|
|
46
|
-
projectId: override.projectId || base.projectId,
|
|
47
|
-
apiKey: override.apiKey || base.apiKey
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
var getFullConfig = (partialConfig) => {
|
|
51
|
-
const envConfig = getEnvConfig();
|
|
52
|
-
return mergeConfigs(envConfig, partialConfig || {});
|
|
53
|
-
};
|
|
54
|
-
var validateConfig = (config) => {
|
|
55
|
-
const errors = [];
|
|
56
|
-
if (!config.projectId) errors.push("Missing projectId");
|
|
57
|
-
if (!config.apiUrl) errors.push("Missing apiUrl");
|
|
58
|
-
return errors;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
18
|
// src/content/cache-implementations.ts
|
|
62
19
|
var CacheTags = {
|
|
63
20
|
project: (projectId) => `nexus_project_${projectId}`,
|
|
@@ -261,7 +218,7 @@ var BrowserCache = class {
|
|
|
261
218
|
const keysToRemove = [];
|
|
262
219
|
for (let i = 0; i < localStorage.length; i++) {
|
|
263
220
|
const key = localStorage.key(i);
|
|
264
|
-
if (_optionalChain([key, 'optionalAccess',
|
|
221
|
+
if (_optionalChain([key, 'optionalAccess', _2 => _2.startsWith, 'call', _3 => _3(this.prefix)])) {
|
|
265
222
|
keysToRemove.push(key);
|
|
266
223
|
}
|
|
267
224
|
}
|
|
@@ -275,7 +232,7 @@ var BrowserCache = class {
|
|
|
275
232
|
this.currentSize = 0;
|
|
276
233
|
for (let i = 0; i < localStorage.length; i++) {
|
|
277
234
|
const key = localStorage.key(i);
|
|
278
|
-
if (_optionalChain([key, 'optionalAccess',
|
|
235
|
+
if (_optionalChain([key, 'optionalAccess', _4 => _4.startsWith, 'call', _5 => _5(this.prefix)])) {
|
|
279
236
|
const item = localStorage.getItem(key);
|
|
280
237
|
if (item) {
|
|
281
238
|
this.currentSize += new Blob([item]).size;
|
|
@@ -291,7 +248,7 @@ var BrowserCache = class {
|
|
|
291
248
|
let oldestTime = Infinity;
|
|
292
249
|
for (let i = 0; i < localStorage.length; i++) {
|
|
293
250
|
const key = localStorage.key(i);
|
|
294
|
-
if (_optionalChain([key, 'optionalAccess',
|
|
251
|
+
if (_optionalChain([key, 'optionalAccess', _6 => _6.startsWith, 'call', _7 => _7(this.prefix)])) {
|
|
295
252
|
const item = localStorage.getItem(key);
|
|
296
253
|
if (item) {
|
|
297
254
|
try {
|
|
@@ -325,7 +282,7 @@ var LocalCacheProxy = class {
|
|
|
325
282
|
async getInstance() {
|
|
326
283
|
if (this.instance) return this.instance;
|
|
327
284
|
if (typeof window === "undefined") {
|
|
328
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./local-cache-server-
|
|
285
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./local-cache-server-SF5SXE7H.cjs")));
|
|
329
286
|
this.instance = new mod.LocalCache(this.cachePath);
|
|
330
287
|
} else {
|
|
331
288
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./local-cache-client-IGAL7SZ6.cjs")));
|
|
@@ -334,7 +291,7 @@ var LocalCacheProxy = class {
|
|
|
334
291
|
return this.instance;
|
|
335
292
|
}
|
|
336
293
|
isLoaded() {
|
|
337
|
-
return _optionalChain([this, 'access',
|
|
294
|
+
return _optionalChain([this, 'access', _8 => _8.instance, 'optionalAccess', _9 => _9.isLoaded, 'call', _10 => _10()]) || false;
|
|
338
295
|
}
|
|
339
296
|
async getPage(slug) {
|
|
340
297
|
const inst = await this.getInstance();
|
|
@@ -417,10 +374,10 @@ var ExponentialBackoff = class {
|
|
|
417
374
|
return delay;
|
|
418
375
|
}
|
|
419
376
|
isClientError(error) {
|
|
420
|
-
return _optionalChain([error, 'optionalAccess',
|
|
377
|
+
return _optionalChain([error, 'optionalAccess', _11 => _11.status]) >= 400 && _optionalChain([error, 'optionalAccess', _12 => _12.status]) < 500;
|
|
421
378
|
}
|
|
422
379
|
isRateLimitError(error) {
|
|
423
|
-
return _optionalChain([error, 'optionalAccess',
|
|
380
|
+
return _optionalChain([error, 'optionalAccess', _13 => _13.status]) === 429;
|
|
424
381
|
}
|
|
425
382
|
};
|
|
426
383
|
var CircuitBreaker = class {
|
|
@@ -531,10 +488,10 @@ function buildQueryString(query) {
|
|
|
531
488
|
if (query.sort) params.append("sort", query.sort);
|
|
532
489
|
if (query.order) params.append("order", query.order);
|
|
533
490
|
if (query.search) params.append("search", query.search);
|
|
534
|
-
if (_optionalChain([query, 'access',
|
|
491
|
+
if (_optionalChain([query, 'access', _14 => _14.include, 'optionalAccess', _15 => _15.length])) {
|
|
535
492
|
params.append("include", query.include.join(","));
|
|
536
493
|
}
|
|
537
|
-
if (_optionalChain([query, 'access',
|
|
494
|
+
if (_optionalChain([query, 'access', _16 => _16.fields, 'optionalAccess', _17 => _17.length])) {
|
|
538
495
|
params.append("fields", query.fields.join(","));
|
|
539
496
|
}
|
|
540
497
|
if (query.filter) {
|
|
@@ -816,7 +773,7 @@ var ContentEngine = class {
|
|
|
816
773
|
}
|
|
817
774
|
return this.requestBatcher.schedule(cacheKey, async () => {
|
|
818
775
|
const params = new URLSearchParams();
|
|
819
|
-
if (_optionalChain([options, 'access',
|
|
776
|
+
if (_optionalChain([options, 'access', _18 => _18.include, 'optionalAccess', _19 => _19.length])) {
|
|
820
777
|
params.append("include", options.include.join(","));
|
|
821
778
|
}
|
|
822
779
|
const url = `${this.config.apiUrl}/content/${this.config.projectId}/collection/${collectionId}/${itemId}?${params}`;
|
|
@@ -849,10 +806,10 @@ var ContentEngine = class {
|
|
|
849
806
|
q: query,
|
|
850
807
|
limit: (options.limit || 20).toString()
|
|
851
808
|
});
|
|
852
|
-
if (_optionalChain([options, 'access',
|
|
809
|
+
if (_optionalChain([options, 'access', _20 => _20.collections, 'optionalAccess', _21 => _21.length])) {
|
|
853
810
|
params.append("collections", options.collections.join(","));
|
|
854
811
|
}
|
|
855
|
-
if (_optionalChain([options, 'access',
|
|
812
|
+
if (_optionalChain([options, 'access', _22 => _22.fields, 'optionalAccess', _23 => _23.length])) {
|
|
856
813
|
params.append("fields", options.fields.join(","));
|
|
857
814
|
}
|
|
858
815
|
const url = `${this.config.apiUrl}/content/${this.config.projectId}/search?${params}`;
|
|
@@ -913,7 +870,7 @@ var ContentEngine = class {
|
|
|
913
870
|
}
|
|
914
871
|
};
|
|
915
872
|
eventSource.onerror = () => {
|
|
916
|
-
_optionalChain([eventSource, 'optionalAccess',
|
|
873
|
+
_optionalChain([eventSource, 'optionalAccess', _24 => _24.close, 'call', _25 => _25()]);
|
|
917
874
|
if (isClosed) return;
|
|
918
875
|
const timeout = Math.min(1e3 * Math.pow(2, retryCount), 1e4);
|
|
919
876
|
retryCount++;
|
|
@@ -926,7 +883,7 @@ var ContentEngine = class {
|
|
|
926
883
|
connect();
|
|
927
884
|
return () => {
|
|
928
885
|
isClosed = true;
|
|
929
|
-
_optionalChain([eventSource, 'optionalAccess',
|
|
886
|
+
_optionalChain([eventSource, 'optionalAccess', _26 => _26.close, 'call', _27 => _27()]);
|
|
930
887
|
};
|
|
931
888
|
}
|
|
932
889
|
// --- CACHE MANAGEMENT ---
|
|
@@ -1798,8 +1755,8 @@ var AnalyticsEngine = class {
|
|
|
1798
1755
|
navigator.share = (data) => {
|
|
1799
1756
|
this.tracker.send("social_share", {
|
|
1800
1757
|
method: "native_share_menu",
|
|
1801
|
-
url: _optionalChain([data, 'optionalAccess',
|
|
1802
|
-
title: _optionalChain([data, 'optionalAccess',
|
|
1758
|
+
url: _optionalChain([data, 'optionalAccess', _28 => _28.url]) || window.location.href,
|
|
1759
|
+
title: _optionalChain([data, 'optionalAccess', _29 => _29.title])
|
|
1803
1760
|
});
|
|
1804
1761
|
return originalShare(data);
|
|
1805
1762
|
};
|
|
@@ -1848,7 +1805,7 @@ var AnalyticsEngine = class {
|
|
|
1848
1805
|
this.tracker.send("click", {
|
|
1849
1806
|
element_type: "link",
|
|
1850
1807
|
href: link.href,
|
|
1851
|
-
text: _optionalChain([link, 'access',
|
|
1808
|
+
text: _optionalChain([link, 'access', _30 => _30.innerText, 'optionalAccess', _31 => _31.substring, 'call', _32 => _32(0, 50)]),
|
|
1852
1809
|
id: link.id,
|
|
1853
1810
|
classes: link.className,
|
|
1854
1811
|
dataset: { ...link.dataset },
|
|
@@ -1859,7 +1816,7 @@ var AnalyticsEngine = class {
|
|
|
1859
1816
|
if (button) {
|
|
1860
1817
|
this.tracker.send("click", {
|
|
1861
1818
|
element_type: "button",
|
|
1862
|
-
text: _optionalChain([button, 'access',
|
|
1819
|
+
text: _optionalChain([button, 'access', _33 => _33.innerText, 'optionalAccess', _34 => _34.substring, 'call', _35 => _35(0, 50)]),
|
|
1863
1820
|
id: button.id,
|
|
1864
1821
|
classes: button.className,
|
|
1865
1822
|
coordinates: { x: e.clientX, y: e.clientY }
|
|
@@ -1951,7 +1908,7 @@ var AnalyticsEngine = class {
|
|
|
1951
1908
|
{
|
|
1952
1909
|
event_name: "outbound_click",
|
|
1953
1910
|
href: link.href,
|
|
1954
|
-
text: _optionalChain([link, 'access',
|
|
1911
|
+
text: _optionalChain([link, 'access', _36 => _36.innerText, 'optionalAccess', _37 => _37.substring, 'call', _38 => _38(0, 50)]),
|
|
1955
1912
|
destination_host: linkHost,
|
|
1956
1913
|
coordinates: { x: e.clientX, y: e.clientY }
|
|
1957
1914
|
},
|
|
@@ -2042,7 +1999,7 @@ var AnalyticsEngine = class {
|
|
|
2042
1999
|
filename: e.filename,
|
|
2043
2000
|
lineno: e.lineno,
|
|
2044
2001
|
colno: e.colno,
|
|
2045
|
-
stack: _optionalChain([e, 'access',
|
|
2002
|
+
stack: _optionalChain([e, 'access', _39 => _39.error, 'optionalAccess', _40 => _40.stack]),
|
|
2046
2003
|
url: window.location.href,
|
|
2047
2004
|
type: "uncaught_error"
|
|
2048
2005
|
});
|
|
@@ -2223,16 +2180,16 @@ function getSelector(el, depth = 0) {
|
|
|
2223
2180
|
// src/client.ts
|
|
2224
2181
|
var NexusClient = class {
|
|
2225
2182
|
constructor(config) {
|
|
2226
|
-
const fullConfig = getFullConfig(config);
|
|
2183
|
+
const fullConfig = _chunkVFVPDENWcjs.getFullConfig.call(void 0, config);
|
|
2227
2184
|
this.config = {
|
|
2228
|
-
debug: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
2229
|
-
cacheStrategy: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
2230
|
-
revalidateTime: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
2231
|
-
timeout: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
2232
|
-
retries: _nullishCoalesce(_optionalChain([config, 'optionalAccess',
|
|
2185
|
+
debug: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _41 => _41.debug]), () => ( false)),
|
|
2186
|
+
cacheStrategy: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _42 => _42.cacheStrategy]), () => ( "memory")),
|
|
2187
|
+
revalidateTime: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _43 => _43.revalidateTime]), () => ( 60)),
|
|
2188
|
+
timeout: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _44 => _44.timeout]), () => ( 1e4)),
|
|
2189
|
+
retries: _nullishCoalesce(_optionalChain([config, 'optionalAccess', _45 => _45.retries]), () => ( 3)),
|
|
2233
2190
|
...fullConfig
|
|
2234
2191
|
};
|
|
2235
|
-
const errors = validateConfig(this.config);
|
|
2192
|
+
const errors = _chunkVFVPDENWcjs.validateConfig.call(void 0, this.config);
|
|
2236
2193
|
if (errors.length > 0) {
|
|
2237
2194
|
console.warn("\u26A0\uFE0F NexusHub: Configuration issues:", errors.join(", "));
|
|
2238
2195
|
if (!this.config.projectId) {
|
|
@@ -2556,7 +2513,7 @@ var NexusProvider = ({
|
|
|
2556
2513
|
});
|
|
2557
2514
|
socket.on("live_event", (event) => {
|
|
2558
2515
|
setLatestEvent(event);
|
|
2559
|
-
_optionalChain([onLiveEvent, 'optionalCall',
|
|
2516
|
+
_optionalChain([onLiveEvent, 'optionalCall', _46 => _46(event)]);
|
|
2560
2517
|
});
|
|
2561
2518
|
socketRef.current = socket;
|
|
2562
2519
|
} catch (err) {
|
|
@@ -2615,10 +2572,374 @@ var useNexusAnalytics = () => {
|
|
|
2615
2572
|
};
|
|
2616
2573
|
};
|
|
2617
2574
|
|
|
2575
|
+
// src/components/NexusRenders.tsx
|
|
2576
|
+
|
|
2577
|
+
var _lucidereact = require('lucide-react'); var LucideIcons = _interopRequireWildcard(_lucidereact);
|
|
2578
|
+
|
|
2579
|
+
function NexusRichText({ value, className = "" }) {
|
|
2580
|
+
if (!value) return null;
|
|
2581
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2582
|
+
"div",
|
|
2583
|
+
{
|
|
2584
|
+
className: `prose dark:prose-invert max-w-none text-foreground leading-relaxed ${className}`,
|
|
2585
|
+
dangerouslySetInnerHTML: { __html: value }
|
|
2586
|
+
}
|
|
2587
|
+
);
|
|
2588
|
+
}
|
|
2589
|
+
function NexusLongText({ value, className = "" }) {
|
|
2590
|
+
if (!value) return null;
|
|
2591
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2592
|
+
"p",
|
|
2593
|
+
{
|
|
2594
|
+
className: `text-sm text-muted-foreground whitespace-pre-line leading-relaxed ${className}`,
|
|
2595
|
+
dangerouslySetInnerHTML: { __html: value }
|
|
2596
|
+
}
|
|
2597
|
+
);
|
|
2598
|
+
}
|
|
2599
|
+
function NexusIcon({
|
|
2600
|
+
name,
|
|
2601
|
+
className = "",
|
|
2602
|
+
size = 20,
|
|
2603
|
+
strokeWidth = 2
|
|
2604
|
+
}) {
|
|
2605
|
+
if (!name) return null;
|
|
2606
|
+
const IconComponent = LucideIcons[name];
|
|
2607
|
+
if (!IconComponent) {
|
|
2608
|
+
const Fallback = LucideIcons.HelpCircle;
|
|
2609
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Fallback, { className, size, strokeWidth });
|
|
2610
|
+
}
|
|
2611
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2612
|
+
IconComponent,
|
|
2613
|
+
{
|
|
2614
|
+
className,
|
|
2615
|
+
size,
|
|
2616
|
+
strokeWidth
|
|
2617
|
+
}
|
|
2618
|
+
);
|
|
2619
|
+
}
|
|
2620
|
+
function NexusImage({
|
|
2621
|
+
value,
|
|
2622
|
+
className = "",
|
|
2623
|
+
alt = "",
|
|
2624
|
+
...props
|
|
2625
|
+
}) {
|
|
2626
|
+
if (!value) return null;
|
|
2627
|
+
const imageUrl = typeof value === "string" ? value : value.url;
|
|
2628
|
+
const imageAlt = typeof value === "string" ? alt : value.alt || alt;
|
|
2629
|
+
if (!imageUrl) return null;
|
|
2630
|
+
return (
|
|
2631
|
+
/* eslint-disable-next-line @next/next/no-img-element */
|
|
2632
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2633
|
+
"img",
|
|
2634
|
+
{
|
|
2635
|
+
src: imageUrl,
|
|
2636
|
+
alt: imageAlt,
|
|
2637
|
+
className: `max-w-full h-auto object-cover rounded-xl ${className}`,
|
|
2638
|
+
...props
|
|
2639
|
+
}
|
|
2640
|
+
)
|
|
2641
|
+
);
|
|
2642
|
+
}
|
|
2643
|
+
function NexusGallery({
|
|
2644
|
+
value,
|
|
2645
|
+
className = "",
|
|
2646
|
+
imageClassName = ""
|
|
2647
|
+
}) {
|
|
2648
|
+
if (!value || value.length === 0) return null;
|
|
2649
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2650
|
+
"div",
|
|
2651
|
+
{
|
|
2652
|
+
className: `grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 ${className}`,
|
|
2653
|
+
children: value.map((img, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
+
"div",
|
|
2655
|
+
{
|
|
2656
|
+
className: "overflow-hidden rounded-xl aspect-square bg-muted/20 border border-border",
|
|
2657
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2658
|
+
NexusImage,
|
|
2659
|
+
{
|
|
2660
|
+
value: img,
|
|
2661
|
+
className: `w-full h-full object-cover hover:scale-105 transition-transform duration-500 ${imageClassName}`
|
|
2662
|
+
}
|
|
2663
|
+
)
|
|
2664
|
+
},
|
|
2665
|
+
idx
|
|
2666
|
+
))
|
|
2667
|
+
}
|
|
2668
|
+
);
|
|
2669
|
+
}
|
|
2670
|
+
function NexusVideo({
|
|
2671
|
+
value,
|
|
2672
|
+
className = "",
|
|
2673
|
+
autoplay = false
|
|
2674
|
+
}) {
|
|
2675
|
+
if (!value) return null;
|
|
2676
|
+
const isYouTube = value.includes("youtube.com") || value.includes("youtu.be");
|
|
2677
|
+
const isVimeo = value.includes("vimeo.com");
|
|
2678
|
+
if (isYouTube) {
|
|
2679
|
+
const videoId = value.includes("youtu.be") ? value.split("/").pop() : _optionalChain([value, 'access', _47 => _47.split, 'call', _48 => _48("v="), 'access', _49 => _49[1], 'optionalAccess', _50 => _50.split, 'call', _51 => _51("&"), 'access', _52 => _52[0]]);
|
|
2680
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2681
|
+
"iframe",
|
|
2682
|
+
{
|
|
2683
|
+
src: `https://www.youtube.com/embed/${videoId}?autoplay=${autoplay ? 1 : 0}`,
|
|
2684
|
+
className: `w-full aspect-video rounded-xl border-0 ${className}`,
|
|
2685
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
2686
|
+
allowFullScreen: true,
|
|
2687
|
+
title: "YouTube Video"
|
|
2688
|
+
}
|
|
2689
|
+
);
|
|
2690
|
+
}
|
|
2691
|
+
if (isVimeo) {
|
|
2692
|
+
const videoId = value.split("/").pop();
|
|
2693
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2694
|
+
"iframe",
|
|
2695
|
+
{
|
|
2696
|
+
src: `https://player.vimeo.com/video/${videoId}?autoplay=${autoplay ? 1 : 0}`,
|
|
2697
|
+
className: `w-full aspect-video rounded-xl border-0 ${className}`,
|
|
2698
|
+
allow: "autoplay; fullscreen; picture-in-picture",
|
|
2699
|
+
allowFullScreen: true,
|
|
2700
|
+
title: "Vimeo Video"
|
|
2701
|
+
}
|
|
2702
|
+
);
|
|
2703
|
+
}
|
|
2704
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2705
|
+
"video",
|
|
2706
|
+
{
|
|
2707
|
+
src: value,
|
|
2708
|
+
controls: true,
|
|
2709
|
+
autoPlay: autoplay,
|
|
2710
|
+
muted: autoplay,
|
|
2711
|
+
playsInline: true,
|
|
2712
|
+
className: `w-full rounded-xl border border-border object-contain ${className}`
|
|
2713
|
+
}
|
|
2714
|
+
);
|
|
2715
|
+
}
|
|
2716
|
+
function NexusMap({ value, className = "" }) {
|
|
2717
|
+
if (!value || !value.lat || !value.lng) return null;
|
|
2718
|
+
const query = encodeURIComponent(
|
|
2719
|
+
value.address || `${value.lat},${value.lng}`
|
|
2720
|
+
);
|
|
2721
|
+
const embedUrl = `https://maps.google.com/maps?q=${query}&t=&z=13&ie=UTF8&iwloc=&output=embed`;
|
|
2722
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2723
|
+
"div",
|
|
2724
|
+
{
|
|
2725
|
+
className: `overflow-hidden rounded-xl border border-border aspect-video w-full ${className}`,
|
|
2726
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2727
|
+
"iframe",
|
|
2728
|
+
{
|
|
2729
|
+
title: "Embedded Map",
|
|
2730
|
+
width: "100%",
|
|
2731
|
+
height: "100%",
|
|
2732
|
+
src: embedUrl,
|
|
2733
|
+
className: "border-0",
|
|
2734
|
+
allowFullScreen: true,
|
|
2735
|
+
loading: "lazy"
|
|
2736
|
+
}
|
|
2737
|
+
)
|
|
2738
|
+
}
|
|
2739
|
+
);
|
|
2740
|
+
}
|
|
2741
|
+
function NexusColor({
|
|
2742
|
+
value,
|
|
2743
|
+
className = "",
|
|
2744
|
+
showHexLabel = true
|
|
2745
|
+
}) {
|
|
2746
|
+
if (!value) return null;
|
|
2747
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex items-center gap-2.5 ${className}`, children: [
|
|
2748
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2749
|
+
"div",
|
|
2750
|
+
{
|
|
2751
|
+
className: "h-6 w-6 rounded-full border border-border/80 shadow-xs shrink-0",
|
|
2752
|
+
style: { backgroundColor: value }
|
|
2753
|
+
}
|
|
2754
|
+
),
|
|
2755
|
+
showHexLabel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-mono text-xs font-semibold text-foreground/80 uppercase", children: value })
|
|
2756
|
+
] });
|
|
2757
|
+
}
|
|
2758
|
+
function NexusGradient({
|
|
2759
|
+
value,
|
|
2760
|
+
children,
|
|
2761
|
+
className = "",
|
|
2762
|
+
asTextMask = false
|
|
2763
|
+
}) {
|
|
2764
|
+
if (!value) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children });
|
|
2765
|
+
if (asTextMask) {
|
|
2766
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2767
|
+
"span",
|
|
2768
|
+
{
|
|
2769
|
+
className: `bg-clip-text text-transparent font-bold ${className}`,
|
|
2770
|
+
style: { backgroundImage: value, WebkitBackgroundClip: "text" },
|
|
2771
|
+
children
|
|
2772
|
+
}
|
|
2773
|
+
);
|
|
2774
|
+
}
|
|
2775
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2776
|
+
"div",
|
|
2777
|
+
{
|
|
2778
|
+
className: `rounded-xl ${className}`,
|
|
2779
|
+
style: { backgroundImage: value },
|
|
2780
|
+
children
|
|
2781
|
+
}
|
|
2782
|
+
);
|
|
2783
|
+
}
|
|
2784
|
+
function NexusAddress({ value, className = "" }) {
|
|
2785
|
+
if (!value) return null;
|
|
2786
|
+
const lines = [
|
|
2787
|
+
value.street,
|
|
2788
|
+
[value.city, value.state, value.postalCode].filter(Boolean).join(", "),
|
|
2789
|
+
value.country
|
|
2790
|
+
].filter(Boolean);
|
|
2791
|
+
if (lines.length === 0) return null;
|
|
2792
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2793
|
+
"div",
|
|
2794
|
+
{
|
|
2795
|
+
className: `flex items-start gap-2.5 p-3 rounded-xl border border-border bg-card/50 ${className}`,
|
|
2796
|
+
children: [
|
|
2797
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LucideIcons.MapPin, { className: "h-4 w-4 text-muted-foreground shrink-0 mt-0.5" }),
|
|
2798
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-xs text-foreground/80 leading-relaxed font-medium", children: lines.map((line, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: line }, i)) })
|
|
2799
|
+
]
|
|
2800
|
+
}
|
|
2801
|
+
);
|
|
2802
|
+
}
|
|
2803
|
+
function NexusKeyValue({ value, className = "" }) {
|
|
2804
|
+
if (!value || Object.keys(value).length === 0) return null;
|
|
2805
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2806
|
+
"div",
|
|
2807
|
+
{
|
|
2808
|
+
className: `border border-border rounded-xl overflow-hidden bg-card/30 divide-y divide-border ${className}`,
|
|
2809
|
+
children: Object.entries(value).map(([k, v]) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex text-xs px-4 py-3 gap-4", children: [
|
|
2810
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-1/3 font-bold text-muted-foreground select-none uppercase tracking-wider text-[10px]", children: k }),
|
|
2811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex-1 font-medium text-foreground", children: v })
|
|
2812
|
+
] }, k))
|
|
2813
|
+
}
|
|
2814
|
+
);
|
|
2815
|
+
}
|
|
2816
|
+
function NexusTags({
|
|
2817
|
+
value,
|
|
2818
|
+
className = "",
|
|
2819
|
+
badgeClassName = ""
|
|
2820
|
+
}) {
|
|
2821
|
+
if (!value || value.length === 0) return null;
|
|
2822
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `flex flex-wrap gap-1.5 ${className}`, children: value.map((tag) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2823
|
+
"span",
|
|
2824
|
+
{
|
|
2825
|
+
className: `inline-flex items-center rounded-lg border border-border bg-muted/40 px-2.5 py-1 text-xs font-semibold text-foreground/80 ${badgeClassName}`,
|
|
2826
|
+
children: tag
|
|
2827
|
+
},
|
|
2828
|
+
tag
|
|
2829
|
+
)) });
|
|
2830
|
+
}
|
|
2831
|
+
function NexusProgress({
|
|
2832
|
+
value,
|
|
2833
|
+
max = 100,
|
|
2834
|
+
className = "",
|
|
2835
|
+
color = "bg-primary"
|
|
2836
|
+
}) {
|
|
2837
|
+
if (value === null) return null;
|
|
2838
|
+
const percent = Math.min(value / max * 100, 100);
|
|
2839
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `w-full ${className}`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-2 w-full rounded-full bg-muted overflow-hidden border border-border/30", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2840
|
+
"div",
|
|
2841
|
+
{
|
|
2842
|
+
className: `h-full rounded-full transition-all duration-500 ${color}`,
|
|
2843
|
+
style: { width: `${percent}%` }
|
|
2844
|
+
}
|
|
2845
|
+
) }) });
|
|
2846
|
+
}
|
|
2847
|
+
function NexusBlendContainer({
|
|
2848
|
+
mode,
|
|
2849
|
+
children,
|
|
2850
|
+
className = ""
|
|
2851
|
+
}) {
|
|
2852
|
+
const blendStyle = mode ? { mixBlendMode: mode } : {};
|
|
2853
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className, style: blendStyle, children });
|
|
2854
|
+
}
|
|
2855
|
+
function NexusCode({
|
|
2856
|
+
value,
|
|
2857
|
+
language = "json",
|
|
2858
|
+
className = "",
|
|
2859
|
+
showLineNumbers = false
|
|
2860
|
+
}) {
|
|
2861
|
+
const [copied, setCopied] = _react.useState.call(void 0, false);
|
|
2862
|
+
if (!value) return null;
|
|
2863
|
+
const handleCopy = () => {
|
|
2864
|
+
navigator.clipboard.writeText(value);
|
|
2865
|
+
setCopied(true);
|
|
2866
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
2867
|
+
};
|
|
2868
|
+
const lines = value.split("\n");
|
|
2869
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2870
|
+
"div",
|
|
2871
|
+
{
|
|
2872
|
+
className: `relative rounded-xl border border-border bg-[#090A0F] overflow-hidden ${className}`,
|
|
2873
|
+
children: [
|
|
2874
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between px-4 py-2 border-b border-border bg-white/2 select-none", children: [
|
|
2875
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-[10px] font-black uppercase text-muted-foreground tracking-wider", children: language }),
|
|
2876
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2877
|
+
"button",
|
|
2878
|
+
{
|
|
2879
|
+
onClick: handleCopy,
|
|
2880
|
+
className: "flex items-center gap-1.5 text-[10px] font-bold text-muted-foreground hover:text-primary transition-colors cursor-pointer",
|
|
2881
|
+
children: copied ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2882
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LucideIcons.Check, { className: "h-3 w-3 text-emerald-400" }),
|
|
2883
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-emerald-400", children: "Copied!" })
|
|
2884
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2885
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LucideIcons.Copy, { className: "h-3 w-3" }),
|
|
2886
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Copy Code" })
|
|
2887
|
+
] })
|
|
2888
|
+
}
|
|
2889
|
+
)
|
|
2890
|
+
] }),
|
|
2891
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex overflow-x-auto p-4 font-mono text-[11px] leading-relaxed text-emerald-400 select-text", children: [
|
|
2892
|
+
showLineNumbers && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col text-right text-gray-600 select-none pr-3.5 border-r border-border/30 mr-3.5", children: lines.map((_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: i + 1 }, i)) }),
|
|
2893
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "pre", { className: "flex-1 whitespace-pre", children: value })
|
|
2894
|
+
] })
|
|
2895
|
+
]
|
|
2896
|
+
}
|
|
2897
|
+
);
|
|
2898
|
+
}
|
|
2899
|
+
function NexusBoolean({
|
|
2900
|
+
value,
|
|
2901
|
+
className = "",
|
|
2902
|
+
trueLabel = "Active",
|
|
2903
|
+
falseLabel = "Inactive"
|
|
2904
|
+
}) {
|
|
2905
|
+
if (value === null) return null;
|
|
2906
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2907
|
+
"span",
|
|
2908
|
+
{
|
|
2909
|
+
className: `inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[10px] font-black uppercase tracking-wider border shadow-sm ${value ? "border-emerald-500/20 bg-emerald-500/10 text-emerald-400" : "border-muted-foreground/20 bg-muted-foreground/10 text-muted-foreground"} ${className}`,
|
|
2910
|
+
children: [
|
|
2911
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2912
|
+
"span",
|
|
2913
|
+
{
|
|
2914
|
+
className: `h-1.5 w-1.5 rounded-full ${value ? "bg-emerald-500 animate-pulse" : "bg-muted-foreground"}`
|
|
2915
|
+
}
|
|
2916
|
+
),
|
|
2917
|
+
value ? trueLabel : falseLabel
|
|
2918
|
+
]
|
|
2919
|
+
}
|
|
2920
|
+
);
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
|
|
2924
|
+
|
|
2925
|
+
|
|
2926
|
+
|
|
2927
|
+
|
|
2928
|
+
|
|
2929
|
+
|
|
2930
|
+
|
|
2931
|
+
|
|
2932
|
+
|
|
2933
|
+
|
|
2934
|
+
|
|
2935
|
+
|
|
2936
|
+
|
|
2937
|
+
|
|
2938
|
+
|
|
2618
2939
|
|
|
2619
2940
|
|
|
2620
2941
|
|
|
2621
2942
|
|
|
2622
2943
|
|
|
2623
2944
|
|
|
2624
|
-
exports.AuthProvider = AuthProvider; exports.NexusProvider = NexusProvider; exports.useNexus = useNexus; exports.useNexusAnalytics = useNexusAnalytics; exports.useNexusAuth = useNexusAuth; exports.useNexusLiveFeed = useNexusLiveFeed;
|
|
2945
|
+
exports.AuthProvider = AuthProvider; exports.NexusAddress = NexusAddress; exports.NexusBlendContainer = NexusBlendContainer; exports.NexusBoolean = NexusBoolean; exports.NexusCode = NexusCode; exports.NexusColor = NexusColor; exports.NexusGallery = NexusGallery; exports.NexusGradient = NexusGradient; exports.NexusIcon = NexusIcon; exports.NexusImage = NexusImage; exports.NexusKeyValue = NexusKeyValue; exports.NexusLongText = NexusLongText; exports.NexusMap = NexusMap; exports.NexusProgress = NexusProgress; exports.NexusProvider = NexusProvider; exports.NexusRichText = NexusRichText; exports.NexusTags = NexusTags; exports.NexusVideo = NexusVideo; exports.useNexus = useNexus; exports.useNexusAnalytics = useNexusAnalytics; exports.useNexusAuth = useNexusAuth; exports.useNexusLiveFeed = useNexusLiveFeed;
|