@nice2dev/ui 1.1.5 → 1.1.7

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.
Files changed (164) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/README.md +50 -29
  3. package/css/legacy-bg-text-aliases.css +65 -61
  4. package/dist/NiceCodeEditor-Bc81wiaN.js +1134 -0
  5. package/dist/NiceCodeEditor-D6f8KdHN.js +1134 -0
  6. package/dist/NiceCodeEditor-DE3saxyt.cjs +260 -0
  7. package/dist/NiceCodeEditor-DZM16My5.cjs +260 -0
  8. package/dist/NiceCodeEditor-HqmcJjmZ.js +1179 -0
  9. package/dist/NiceColorPicker-6EqXaDj0.cjs +1 -0
  10. package/dist/NiceColorPicker-BiEWqWnd.js +596 -0
  11. package/dist/NiceColorPicker-Cuc6YXqz.cjs +1 -0
  12. package/dist/NiceColorPicker-DMATcNWG.js +596 -0
  13. package/dist/NiceColorPicker-R3O1nemp.js +596 -0
  14. package/dist/NiceConfirmDialog-B0e10fRL.cjs +1 -0
  15. package/dist/NiceConfirmDialog-BBDgEMHv.js +81 -0
  16. package/dist/NiceConfirmDialog-C7kdr8jJ.js +81 -0
  17. package/dist/NiceConfirmDialog-DMHqPfFM.js +81 -0
  18. package/dist/NiceConfirmDialog-ZJpQLQQS.cjs +1 -0
  19. package/dist/NiceDataGrid-BzUw4dSu.cjs +10 -0
  20. package/dist/NiceDataGrid-CPKcVOVz.js +1743 -0
  21. package/dist/NiceDataGrid-DJr33WMy.cjs +10 -0
  22. package/dist/NiceDataGrid-D_4gZ1Hu.js +1736 -0
  23. package/dist/NiceDataGrid-DlUAaXhD.js +1736 -0
  24. package/dist/NiceDocumentViewer-8ghRVtfO.js +672 -0
  25. package/dist/NiceDocumentViewer-ChWtA_Ry.cjs +180 -0
  26. package/dist/NiceDocumentViewer-DwLUV7Tc.js +672 -0
  27. package/dist/NiceDocumentViewer-goMzF1w3.cjs +180 -0
  28. package/dist/NiceDocumentViewer-gt1mxzP8.js +672 -0
  29. package/dist/NiceForm-CHEAHxDw.js +4805 -0
  30. package/dist/NiceForm-CJUp1CL0.cjs +1 -0
  31. package/dist/NiceForm-Cp_RH3Yj.js +4805 -0
  32. package/dist/NiceForm-a6tGr6ss.js +4819 -0
  33. package/dist/NiceForm-jU89oe2S.cjs +1 -0
  34. package/dist/NiceGantt-BnQwyTfG.cjs +1 -0
  35. package/dist/NiceGantt-D8coFAvK.js +328 -0
  36. package/dist/NiceGantt-DOZfT6r5.js +328 -0
  37. package/dist/NiceGantt-DQzH1V-R.js +328 -0
  38. package/dist/NiceGantt-jQ8ZpXko.cjs +1 -0
  39. package/dist/NiceHtmlEditor-B1nlXJNW.cjs +10 -0
  40. package/dist/NiceHtmlEditor-Bv3VqJPG.js +862 -0
  41. package/dist/NiceHtmlEditor-CKsGj-Ei.cjs +10 -0
  42. package/dist/NiceHtmlEditor-CloMgyzg.js +841 -0
  43. package/dist/NiceHtmlEditor-DUAHmkWI.js +841 -0
  44. package/dist/NiceLoginForm-Ce_QLnLf.js +736 -0
  45. package/dist/NiceLoginForm-DLpNTQlR.cjs +1 -0
  46. package/dist/NiceLoginForm-Dg0286Cc.js +736 -0
  47. package/dist/NiceLoginForm-X05Vadeg.js +708 -0
  48. package/dist/NiceLoginForm-f_dBCnUi.cjs +1 -0
  49. package/dist/NiceMention-BByI4nFG.js +11120 -0
  50. package/dist/NiceMention-BjeLN4Jx.cjs +430 -0
  51. package/dist/NiceMention-C2TPiMph.cjs +430 -0
  52. package/dist/NiceMention-C67vT6m0.js +11145 -0
  53. package/dist/NiceMention-D1cdy63w.cjs +430 -0
  54. package/dist/NiceMention-OaCi-GNO.js +11094 -0
  55. package/dist/NiceMention-QIuggb9Y.js +11122 -0
  56. package/dist/NiceMention.css +1 -1
  57. package/dist/NiceModal-CHaan9al.js +95 -0
  58. package/dist/NiceModal-Czq6OEAT.js +95 -0
  59. package/dist/NiceModal-D-HFwawr.js +95 -0
  60. package/dist/NiceModal-DOy2XTzc.cjs +1 -0
  61. package/dist/NiceModal-DkawKzEE.cjs +1 -0
  62. package/dist/NiceModuleLifecyclePanel-1CsP8Zst.js +6997 -0
  63. package/dist/NiceModuleLifecyclePanel-Bkx4Yg-3.cjs +1 -0
  64. package/dist/NiceModuleLifecyclePanel-C5oYtczk.js +6999 -0
  65. package/dist/NiceModuleLifecyclePanel-DCcy2yYi.cjs +1 -0
  66. package/dist/NiceModuleLifecyclePanel-DqdgW-0s.js +7004 -0
  67. package/dist/NiceModuleLifecyclePanel.css +1 -1
  68. package/dist/NicePagination-7od5KUa3.cjs +1 -0
  69. package/dist/NicePagination-DMrkR8hH.cjs +1 -0
  70. package/dist/NicePagination-DQmZpsSQ.js +179 -0
  71. package/dist/NicePagination-DipQRjPq.js +172 -0
  72. package/dist/NicePagination-KhlVXYaT.js +172 -0
  73. package/dist/NicePivotGrid-B-KthuqL.cjs +152 -0
  74. package/dist/NicePivotGrid-CLCTHkKO.cjs +152 -0
  75. package/dist/NicePivotGrid-DV54FCsH.js +1174 -0
  76. package/dist/NicePivotGrid-DoWLUPUs.js +1167 -0
  77. package/dist/NicePivotGrid-etwpfccz.js +1167 -0
  78. package/dist/NiceSavedQueryPanel-BABkTNc5.js +5129 -0
  79. package/dist/NiceSavedQueryPanel-Cfeig83P.cjs +586 -0
  80. package/dist/NiceSavedQueryPanel-DTWRLseb.cjs +586 -0
  81. package/dist/NiceSavedQueryPanel-Dy154sxE.js +5129 -0
  82. package/dist/NiceSavedQueryPanel-v7AffOOe.js +5129 -0
  83. package/dist/NiceSavedQueryPanel.css +1 -1
  84. package/dist/NiceScheduler-BEgB7ZgF.cjs +5 -0
  85. package/dist/NiceScheduler-C9JprsEI.cjs +5 -0
  86. package/dist/NiceScheduler-DSP-PPh0.js +1645 -0
  87. package/dist/NiceScheduler-DuPnaA3t.js +1652 -0
  88. package/dist/NiceScheduler-Oa89YZx9.js +1645 -0
  89. package/dist/NiceSelect-A336yeLZ.js +433 -0
  90. package/dist/NiceSelect-B5hTbqi2.js +433 -0
  91. package/dist/NiceSelect-BYSgDYzq.cjs +1 -0
  92. package/dist/NiceSelect-Dudf2T5T.js +433 -0
  93. package/dist/NiceSelect-DwBAIrX7.cjs +1 -0
  94. package/dist/NiceWindow-B6zjBTl9.cjs +1 -0
  95. package/dist/NiceWindow-BKQEx7Vf.js +1623 -0
  96. package/dist/NiceWindow-BnTH7Gy0.js +1623 -0
  97. package/dist/NiceWindow-CZN9NVZw.cjs +1 -0
  98. package/dist/NiceWindow-lxtPR7yZ.js +1623 -0
  99. package/dist/NiceWindow.css +1 -1
  100. package/dist/charts-B8_V3_nq.cjs +882 -0
  101. package/dist/charts-BZgyyybE.js +31933 -0
  102. package/dist/charts-FuDk5-r6.js +31958 -0
  103. package/dist/charts-INj3yFo5.js +31946 -0
  104. package/dist/charts-NolNXKUL.cjs +882 -0
  105. package/dist/charts.cjs +1 -1
  106. package/dist/charts.css +1 -1
  107. package/dist/charts.mjs +1 -1
  108. package/dist/core-A_A6c7an.js +795 -0
  109. package/dist/core-B2iH2J_X.js +795 -0
  110. package/dist/core-BmspZEfD.js +795 -0
  111. package/dist/core-DAfLOet6.cjs +1 -0
  112. package/dist/core-ZG3bgnBR.cjs +1 -0
  113. package/dist/data-branching-B3TOqXAO.cjs +1 -0
  114. package/dist/data-branching-BUGiICDZ.js +6275 -0
  115. package/dist/data-branching-DMXmcocj.js +6275 -0
  116. package/dist/data-branching-YE8P9M5P.js +6275 -0
  117. package/dist/data-branching-t6uhAwIm.cjs +1 -0
  118. package/dist/data-branching.cjs +1 -1
  119. package/dist/data-branching.mjs +1 -1
  120. package/dist/data.cjs +1 -1
  121. package/dist/data.d.ts +7 -2
  122. package/dist/data.mjs +3 -3
  123. package/dist/devops-BhV3OmF7.js +8285 -0
  124. package/dist/devops-BqUxnbRi.cjs +17 -0
  125. package/dist/devops-Bx-Qwj9w.cjs +17 -0
  126. package/dist/devops-DYZatW45.js +8251 -0
  127. package/dist/devops-R98k2zpd.js +8251 -0
  128. package/dist/devops.cjs +1 -1
  129. package/dist/devops.d.ts +29 -16
  130. package/dist/devops.mjs +1 -1
  131. package/dist/editors.cjs +1 -1
  132. package/dist/editors.d.ts +59 -28
  133. package/dist/editors.mjs +7 -7
  134. package/dist/feedback.cjs +1 -1
  135. package/dist/feedback.mjs +3 -3
  136. package/dist/index.cjs +445 -445
  137. package/dist/index.css +1 -1
  138. package/dist/index.d.ts +214 -119
  139. package/dist/index.mjs +16635 -16351
  140. package/dist/lazy.cjs +1 -1
  141. package/dist/lazy.d.ts +31 -18
  142. package/dist/lazy.mjs +24 -24
  143. package/dist/navigation.cjs +1 -1
  144. package/dist/navigation.d.ts +17 -14
  145. package/dist/navigation.mjs +130 -130
  146. package/dist/no-code-BPaAS4wW.cjs +332 -0
  147. package/dist/no-code-CBwUVL1i.js +7447 -0
  148. package/dist/no-code-CjktkQ50.js +7447 -0
  149. package/dist/no-code-DW2NrRba.js +7447 -0
  150. package/dist/no-code-DmFxrZ5T.cjs +332 -0
  151. package/dist/no-code.cjs +1 -1
  152. package/dist/no-code.d.ts +2 -2
  153. package/dist/no-code.mjs +1 -1
  154. package/dist/overlays.cjs +1 -1
  155. package/dist/overlays.d.ts +4 -4
  156. package/dist/overlays.mjs +2 -2
  157. package/dist/pickerCommons-C4XWRUvH.cjs +1 -0
  158. package/dist/pickerCommons-C_BpYs_m.cjs +1 -0
  159. package/dist/pickerCommons-DAOXH_u5.js +1122 -0
  160. package/dist/pickerCommons-Dn4wnDco.js +1122 -0
  161. package/dist/pickerCommons-DskswPS5.js +1122 -0
  162. package/dist/pickerCommons.css +1 -1
  163. package/dist/style.css +7 -7
  164. package/package.json +3 -3
@@ -0,0 +1,795 @@
1
+ import te, { useState as M, useRef as V, useEffect as k, useCallback as m, useMemo as v, useContext as re, createContext as ce, lazy as ie, Suspense as de } from "react";
2
+ import { a as P, s as U, l as oe, v as se, f as W, m as J, h as H, b as ne, d as ae } from "./charts-FuDk5-r6.js";
3
+ import { jsxs as Q, jsx as i, Fragment as ue } from "react/jsx-runtime";
4
+ const q = ce(null);
5
+ function Se({
6
+ children: e,
7
+ initialPolicy: o,
8
+ policyEndpoint: t,
9
+ instanceCeiling: r,
10
+ tenantPolicy: s,
11
+ groupPolicy: n,
12
+ userPreference: d,
13
+ instanceId: a = "default",
14
+ tenantId: c,
15
+ onPolicyChange: f
16
+ }) {
17
+ const [l, p] = M(o || P), [g, T] = M(
18
+ d
19
+ ), [w, A] = M(!!t), [z, h] = M(null), S = V(/* @__PURE__ */ new Map());
20
+ k(() => {
21
+ const y = r || H(a), u = U(y, s, n, g);
22
+ p(u), f?.(u), S.current.forEach((I) => {
23
+ I.updatePolicy(u);
24
+ });
25
+ }, [r, s, n, g, a, f]), k(() => {
26
+ if (!t)
27
+ return;
28
+ (async () => {
29
+ A(!0), h(null);
30
+ try {
31
+ const u = await fetch(t, {
32
+ credentials: "include"
33
+ });
34
+ if (!u.ok)
35
+ throw new Error(`Failed to fetch policy: ${u.status}`);
36
+ const I = u.headers.get(W);
37
+ if (I) {
38
+ const E = J(I);
39
+ if (E) {
40
+ const O = r || H(a), K = U(
41
+ O,
42
+ s ? { ...s, mode: E } : {
43
+ tenantId: "default",
44
+ mode: E,
45
+ allowGroupOverride: !0,
46
+ allowUserOverride: !0,
47
+ updatedAt: Date.now()
48
+ },
49
+ n,
50
+ g
51
+ );
52
+ p(K), f?.(K);
53
+ }
54
+ }
55
+ try {
56
+ const E = await u.json();
57
+ E.policy && (p(E.policy), f?.(E.policy));
58
+ } catch {
59
+ }
60
+ } catch (u) {
61
+ h(u instanceof Error ? u : new Error("Unknown error"));
62
+ } finally {
63
+ A(!1);
64
+ }
65
+ })();
66
+ }, [
67
+ t,
68
+ r,
69
+ s,
70
+ n,
71
+ g,
72
+ a,
73
+ f
74
+ ]);
75
+ const L = m((y) => {
76
+ T((u) => ({
77
+ userId: u?.userId || "anonymous",
78
+ preferredMode: y.preferredMode || u?.preferredMode || "traceless",
79
+ restrictCookies: y.restrictCookies ?? u?.restrictCookies,
80
+ restrictLocalStorage: y.restrictLocalStorage ?? u?.restrictLocalStorage,
81
+ restrictSessionStorage: y.restrictSessionStorage ?? u?.restrictSessionStorage,
82
+ setAt: Date.now()
83
+ }));
84
+ }, []), b = m(() => oe(l, a, c), [l, a, c]), G = m(() => se(l), [l]), B = m(async () => {
85
+ if (t) {
86
+ A(!0);
87
+ try {
88
+ const y = await fetch(t, {
89
+ credentials: "include",
90
+ cache: "no-cache"
91
+ });
92
+ if (y.ok) {
93
+ const u = y.headers.get(W);
94
+ if (u) {
95
+ const I = J(u);
96
+ if (I) {
97
+ const E = r || H(a), O = U(
98
+ E,
99
+ s ? { ...s, mode: I } : void 0,
100
+ n,
101
+ g
102
+ );
103
+ p(O), f?.(O);
104
+ }
105
+ }
106
+ }
107
+ } finally {
108
+ A(!1);
109
+ }
110
+ }
111
+ }, [
112
+ t,
113
+ r,
114
+ s,
115
+ n,
116
+ g,
117
+ a,
118
+ f
119
+ ]), j = m(
120
+ (y = "nice2dev") => {
121
+ let u = S.current.get(y);
122
+ return u || (u = new ne(l, y), S.current.set(y, u)), u;
123
+ },
124
+ [l]
125
+ ), $ = v(() => ae(l), [l]), le = v(
126
+ () => ({
127
+ policy: l,
128
+ canUseCookies: l.cookiesAllowed,
129
+ canUseLocalStorage: l.localStorageAllowed,
130
+ canUseSessionStorage: l.sessionStorageAllowed,
131
+ canPersist: l.localStorageAllowed,
132
+ mode: l.effectiveMode,
133
+ requiresConsentBanner: l.requiresConsentBanner,
134
+ badgeInfo: $,
135
+ setUserPreference: L,
136
+ generateReport: b,
137
+ runAudit: G,
138
+ refreshPolicy: B,
139
+ getStorageAdapter: j,
140
+ isLoading: w,
141
+ error: z
142
+ }),
143
+ [
144
+ l,
145
+ $,
146
+ L,
147
+ b,
148
+ G,
149
+ B,
150
+ j,
151
+ w,
152
+ z
153
+ ]
154
+ );
155
+ return te.createElement(q.Provider, { value: le }, e);
156
+ }
157
+ function ye() {
158
+ const e = re(q);
159
+ if (!e)
160
+ throw new Error("useTracelessPolicy must be used within a TracelessProvider");
161
+ return e;
162
+ }
163
+ function D() {
164
+ const e = re(q);
165
+ if (e)
166
+ return e;
167
+ const o = new ne(P);
168
+ return {
169
+ policy: P,
170
+ canUseCookies: !1,
171
+ canUseLocalStorage: !1,
172
+ canUseSessionStorage: !1,
173
+ canPersist: !1,
174
+ mode: "traceless",
175
+ requiresConsentBanner: !1,
176
+ badgeInfo: ae(P),
177
+ setUserPreference: () => {
178
+ },
179
+ generateReport: () => oe(P, "default"),
180
+ runAudit: () => se(P),
181
+ refreshPolicy: async () => {
182
+ },
183
+ getStorageAdapter: () => o,
184
+ isLoading: !1,
185
+ error: null
186
+ };
187
+ }
188
+ function F(e = "nice2dev") {
189
+ const { getStorageAdapter: o } = D();
190
+ return v(() => o(e), [o, e]);
191
+ }
192
+ function X(e, o, t) {
193
+ const r = F(t?.namespace), { canPersist: s, canUseSessionStorage: n } = D(), d = t?.storageMode === "session" ? n : s, [a, c] = M(() => {
194
+ if (d) {
195
+ const l = r.get(e, t?.storageMode);
196
+ if (l !== null)
197
+ return l;
198
+ }
199
+ return o;
200
+ }), f = m(
201
+ (l) => {
202
+ c((p) => {
203
+ const g = typeof l == "function" ? l(p) : l;
204
+ return d && r.set(e, g, t?.storageMode === "session" ? "session" : "local"), g;
205
+ });
206
+ },
207
+ [r, e, d, t?.storageMode]
208
+ );
209
+ return [a, f, d];
210
+ }
211
+ function we() {
212
+ const { requiresConsentBanner: e, mode: o } = D(), t = F("nice2dev-consent"), [r, s] = M(() => t.get("banner-dismissed") === !0), n = m(() => {
213
+ s(!0), t.set("banner-dismissed", !0);
214
+ }, [t]);
215
+ return {
216
+ shouldShow: e && !r,
217
+ mode: o,
218
+ dismiss: n
219
+ };
220
+ }
221
+ function ve(e = !1) {
222
+ const { runAudit: o } = D(), [t, r] = M(null), s = m(() => {
223
+ const n = o();
224
+ return r(n), n;
225
+ }, [o]);
226
+ return k(() => {
227
+ e && s();
228
+ }, [e, s]), {
229
+ result: t,
230
+ run: s,
231
+ isCompliant: t?.compliant ?? null
232
+ };
233
+ }
234
+ function be() {
235
+ const { policy: e, getStorageAdapter: o } = D(), t = v(() => o("local"), [o]), r = m(
236
+ (a) => t.get(a),
237
+ [t]
238
+ ), s = m(
239
+ (a, c) => {
240
+ t.set(a, c);
241
+ },
242
+ [t]
243
+ ), n = m(
244
+ (a) => {
245
+ t.remove(a);
246
+ },
247
+ [t]
248
+ ), d = m(() => {
249
+ t.clear();
250
+ }, [t]);
251
+ return v(
252
+ () => ({
253
+ getItem: r,
254
+ setItem: s,
255
+ removeItem: n,
256
+ clear: d,
257
+ isAvailable: e.localStorageAllowed,
258
+ effectiveMode: e.effectiveMode,
259
+ policy: e
260
+ }),
261
+ [r, s, n, d, e]
262
+ );
263
+ }
264
+ function ke() {
265
+ const { policy: e, getStorageAdapter: o } = D(), t = v(() => o("session"), [o]), r = m(
266
+ (a) => t.get(a),
267
+ [t]
268
+ ), s = m(
269
+ (a, c) => {
270
+ t.set(a, c);
271
+ },
272
+ [t]
273
+ ), n = m(
274
+ (a) => {
275
+ t.remove(a);
276
+ },
277
+ [t]
278
+ ), d = m(() => {
279
+ t.clear();
280
+ }, [t]);
281
+ return v(
282
+ () => ({
283
+ getItem: r,
284
+ setItem: s,
285
+ removeItem: n,
286
+ clear: d,
287
+ isAvailable: e.sessionStorageAllowed,
288
+ effectiveMode: e.effectiveMode
289
+ }),
290
+ [r, s, n, d, e]
291
+ );
292
+ }
293
+ function Ae({
294
+ storageKey: e,
295
+ initialState: o = {},
296
+ onStateChange: t,
297
+ storageType: r = "auto"
298
+ }) {
299
+ const { policy: s, getStorageAdapter: n } = D(), d = `nice-datagrid-${e}`, a = v(() => {
300
+ if (r === "local" && s.localStorageAllowed)
301
+ return "local";
302
+ if (r === "session" && s.sessionStorageAllowed)
303
+ return "session";
304
+ if (r === "auto") {
305
+ if (s.localStorageAllowed)
306
+ return "local";
307
+ if (s.sessionStorageAllowed)
308
+ return "session";
309
+ }
310
+ return "memory";
311
+ }, [r, s]), c = v(() => n(a === "session" ? "session-grid" : "local-grid"), [n, a]), [f, l] = M(() => {
312
+ const w = c.get(d);
313
+ if (w)
314
+ try {
315
+ return { ...o, ...JSON.parse(w) };
316
+ } catch {
317
+ return o;
318
+ }
319
+ return o;
320
+ });
321
+ k(() => {
322
+ c.set(d, JSON.stringify(f)), t?.(f);
323
+ }, [f, c, d, t]);
324
+ const p = m((w) => {
325
+ l((A) => ({ ...A, ...w }));
326
+ }, []), g = m(() => {
327
+ c.remove(d), l(o);
328
+ }, [c, d, o]);
329
+ return {
330
+ state: f,
331
+ updateState: p,
332
+ setState: l,
333
+ clearState: g,
334
+ degraded: a === "memory",
335
+ effectiveStorageType: a,
336
+ policy: s
337
+ };
338
+ }
339
+ function Le({
340
+ storageKey: e,
341
+ autoSaveInterval: o = 5e3,
342
+ maxVersions: t = 10
343
+ }) {
344
+ const { policy: r, getStorageAdapter: s } = D(), n = `nice-editor-${e}`, d = `${n}-history`, a = v(() => s("editor"), [s]), [c, f] = X(n, null, {
345
+ storageMode: r.localStorageAllowed ? "local" : "session"
346
+ }), [l, p] = X(d, [], {
347
+ storageMode: "local"
348
+ }), g = m(
349
+ (h, S) => {
350
+ const L = {
351
+ content: h,
352
+ cursorPosition: S,
353
+ lastModified: Date.now(),
354
+ version: (c?.version ?? 0) + 1
355
+ };
356
+ f(L);
357
+ },
358
+ [c, f]
359
+ ), T = m(() => {
360
+ !c || !r.localStorageAllowed || p((h) => [...h, c].slice(-t));
361
+ }, [c, r.localStorageAllowed, t, p]), w = m(
362
+ (h) => {
363
+ const S = l.find((L) => L.version === h);
364
+ S && f(S);
365
+ },
366
+ [l, f]
367
+ ), A = m(() => {
368
+ a.remove(n), f(null);
369
+ }, [a, n, f]), z = V(null);
370
+ return k(() => {
371
+ if (!o || !c?.content || c.content === z.current)
372
+ return;
373
+ const h = setTimeout(() => {
374
+ z.current = c.content ?? null;
375
+ }, o);
376
+ return () => clearTimeout(h);
377
+ }, [c?.content, o]), {
378
+ draft: c,
379
+ saveDraft: g,
380
+ saveToHistory: T,
381
+ restoreVersion: w,
382
+ clearDraft: A,
383
+ history: l,
384
+ hasDraft: c !== null,
385
+ degraded: !r.localStorageAllowed && !r.sessionStorageAllowed,
386
+ policy: r
387
+ };
388
+ }
389
+ function Ce(e = "local") {
390
+ const o = F(e), t = V([]);
391
+ return v(
392
+ () => ({
393
+ getItem: (r) => o.get(r),
394
+ setItem: (r, s) => {
395
+ o.set(r, s), t.current.includes(r) || t.current.push(r);
396
+ },
397
+ removeItem: (r) => {
398
+ o.remove(r), t.current = t.current.filter((s) => s !== r);
399
+ },
400
+ clear: () => {
401
+ o.clear(), t.current = [];
402
+ },
403
+ get length() {
404
+ return t.current.length;
405
+ },
406
+ key: (r) => t.current[r] ?? null
407
+ }),
408
+ [o]
409
+ );
410
+ }
411
+ function xe(e) {
412
+ const { policy: o } = D();
413
+ return v(() => {
414
+ const t = o.cookiesAllowed && e.cookies !== !1, r = o.localStorageAllowed && e.localStorage !== !1, s = o.sessionStorageAllowed && e.sessionStorage !== !1;
415
+ return {
416
+ cookiesAllowed: t,
417
+ localStorageAllowed: r,
418
+ sessionStorageAllowed: s,
419
+ effectiveMode: o.effectiveMode,
420
+ canPersist: r || s,
421
+ degraded: !r && !s
422
+ };
423
+ }, [o, e.cookies, e.localStorage, e.sessionStorage]);
424
+ }
425
+ const R = ({
426
+ height: e = 200
427
+ }) => /* @__PURE__ */ i(
428
+ "div",
429
+ {
430
+ className: "ntd-lazy-loading",
431
+ style: {
432
+ display: "flex",
433
+ alignItems: "center",
434
+ justifyContent: "center",
435
+ height: e,
436
+ background: "var(--ntd-color-surface, #f5f5f5)",
437
+ borderRadius: "var(--ntd-radius, 8px)",
438
+ animation: "ntd-pulse 1.5s ease-in-out infinite"
439
+ },
440
+ children: /* @__PURE__ */ i(
441
+ "div",
442
+ {
443
+ className: "ntd-lazy-loading-spinner",
444
+ style: {
445
+ width: 24,
446
+ height: 24,
447
+ border: "2px solid var(--ntd-color-border, #ddd)",
448
+ borderTopColor: "var(--ntd-color-primary, #6366f1)",
449
+ borderRadius: "50%",
450
+ animation: "ntd-spin 0.8s linear infinite"
451
+ }
452
+ }
453
+ )
454
+ }
455
+ ), fe = (e, o) => /* @__PURE__ */ Q(
456
+ "div",
457
+ {
458
+ className: "ntd-lazy-error",
459
+ style: {
460
+ display: "flex",
461
+ flexDirection: "column",
462
+ alignItems: "center",
463
+ justifyContent: "center",
464
+ padding: 24,
465
+ background: "var(--ntd-color-error-bg, #fee2e2)",
466
+ borderRadius: "var(--ntd-radius, 8px)",
467
+ color: "var(--ntd-color-error, #dc2626)"
468
+ },
469
+ children: [
470
+ /* @__PURE__ */ Q(
471
+ "svg",
472
+ {
473
+ width: "32",
474
+ height: "32",
475
+ viewBox: "0 0 24 24",
476
+ fill: "none",
477
+ stroke: "currentColor",
478
+ strokeWidth: "2",
479
+ children: [
480
+ /* @__PURE__ */ i("circle", { cx: "12", cy: "12", r: "10" }),
481
+ /* @__PURE__ */ i("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
482
+ /* @__PURE__ */ i("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
483
+ ]
484
+ }
485
+ ),
486
+ /* @__PURE__ */ i("p", { style: { margin: "12px 0 8px", fontWeight: 500 }, children: "Failed to load component" }),
487
+ /* @__PURE__ */ i("p", { style: { margin: 0, fontSize: "0.875em", opacity: 0.8 }, children: e.message }),
488
+ /* @__PURE__ */ i(
489
+ "button",
490
+ {
491
+ onClick: o,
492
+ style: {
493
+ marginTop: 16,
494
+ padding: "8px 16px",
495
+ border: "none",
496
+ borderRadius: "var(--ntd-radius, 8px)",
497
+ background: "var(--ntd-color-error, #dc2626)",
498
+ color: "var(--nice-bg-primary, #fff)",
499
+ cursor: "pointer",
500
+ fontSize: "0.875em"
501
+ },
502
+ children: "Retry"
503
+ }
504
+ )
505
+ ]
506
+ }
507
+ );
508
+ class me extends te.Component {
509
+ constructor() {
510
+ super(...arguments), this.state = { error: null }, this.handleRetry = () => {
511
+ this.setState({ error: null });
512
+ };
513
+ }
514
+ static getDerivedStateFromError(o) {
515
+ return { error: o };
516
+ }
517
+ render() {
518
+ return this.state.error ? this.props.fallback(this.state.error, this.handleRetry) : this.props.children;
519
+ }
520
+ }
521
+ function C(e, o = {}) {
522
+ const {
523
+ fallback: t = /* @__PURE__ */ i(R, {}),
524
+ preloadOnMount: r = !1,
525
+ preloadOnHover: s = !1,
526
+ preloadAfterIdle: n,
527
+ minLoadingTime: d = 0,
528
+ ssrFallback: a,
529
+ errorFallback: c = fe,
530
+ displayName: f
531
+ } = o;
532
+ let l = null, p = !1;
533
+ const g = async () => {
534
+ if (l)
535
+ return l;
536
+ const h = Date.now();
537
+ l = e();
538
+ const S = await l;
539
+ if (d > 0) {
540
+ const L = Date.now() - h;
541
+ L < d && await new Promise((b) => setTimeout(b, d - L));
542
+ }
543
+ return p = !0, S;
544
+ }, T = ie(g), w = (h) => {
545
+ const S = V(null);
546
+ return k(() => {
547
+ r && !p && g();
548
+ }, []), k(() => {
549
+ if (n && !p) {
550
+ const b = "requestIdleCallback" in window ? window.requestIdleCallback(() => g(), {
551
+ timeout: n
552
+ }) : setTimeout(() => g(), n);
553
+ return () => {
554
+ "cancelIdleCallback" in window ? window.cancelIdleCallback(b) : clearTimeout(b);
555
+ };
556
+ }
557
+ }, []), k(() => {
558
+ if (!s || p)
559
+ return;
560
+ const b = S.current;
561
+ if (!b)
562
+ return;
563
+ const G = () => {
564
+ p || g();
565
+ };
566
+ return b.addEventListener("mouseenter", G, { once: !0 }), () => b.removeEventListener("mouseenter", G);
567
+ }, []), typeof window > "u" && a ? /* @__PURE__ */ i(ue, { children: a }) : /* @__PURE__ */ i("div", { ref: S, className: "ntd-lazy-wrapper", children: /* @__PURE__ */ i(me, { fallback: c, children: /* @__PURE__ */ i(de, { fallback: t, children: /* @__PURE__ */ i(T, { ...h }) }) }) });
568
+ }, A = async () => {
569
+ p || await g();
570
+ }, z = w;
571
+ return z.preload = A, z.displayName = f || "LazyComponent", z;
572
+ }
573
+ function Ne(e = 0.1, o = "100px") {
574
+ const t = V(null), [r, s] = M(!1);
575
+ return k(() => {
576
+ if (!t.current || r)
577
+ return;
578
+ const n = new IntersectionObserver(
579
+ ([d]) => {
580
+ d.isIntersecting && (s(!0), n.disconnect());
581
+ },
582
+ { threshold: e, rootMargin: o }
583
+ );
584
+ return n.observe(t.current), () => n.disconnect();
585
+ }, [e, o, r]), [t, r];
586
+ }
587
+ function ze(e, o = 2e3) {
588
+ k(() => {
589
+ if ("requestIdleCallback" in window) {
590
+ const t = window.requestIdleCallback(
591
+ () => {
592
+ e.forEach((r) => r());
593
+ },
594
+ { timeout: o }
595
+ );
596
+ return () => window.cancelIdleCallback(t);
597
+ } else {
598
+ const t = setTimeout(() => {
599
+ e.forEach((r) => r());
600
+ }, o);
601
+ return () => clearTimeout(t);
602
+ }
603
+ }, []);
604
+ }
605
+ function Ee(e, o) {
606
+ const t = V(/* @__PURE__ */ new Set());
607
+ k(() => {
608
+ const r = document.querySelectorAll("a[href]"), s = (n) => {
609
+ const a = n.currentTarget.getAttribute("href");
610
+ a && e[a] && !t.current.has(a) && (e[a](), t.current.add(a));
611
+ };
612
+ return r.forEach((n) => {
613
+ n.addEventListener("mouseenter", s);
614
+ }), () => {
615
+ r.forEach((n) => {
616
+ n.removeEventListener("mouseenter", s);
617
+ });
618
+ };
619
+ }, [o, e]);
620
+ }
621
+ const Y = () => /* @__PURE__ */ i(R, { height: 400 }), Z = () => /* @__PURE__ */ i(R, { height: 300 }), _ = () => /* @__PURE__ */ i(R, { height: 500 }), ee = () => /* @__PURE__ */ i(R, { height: 600 }), x = (e) => e, N = {
622
+ /**
623
+ * Lazy-loaded NiceCodeEditor (Monaco ~2MB)
624
+ *
625
+ * @example
626
+ * ```tsx
627
+ * import { LazyComponents } from '@nice2dev/ui';
628
+ *
629
+ * <LazyComponents.CodeEditor
630
+ * value={code}
631
+ * language="typescript"
632
+ * onChange={setCode}
633
+ * />
634
+ * ```
635
+ */
636
+ CodeEditor: C(
637
+ x(
638
+ () => import("./NiceCodeEditor-HqmcJjmZ.js").then((e) => ({ default: e.NiceCodeEditor }))
639
+ ),
640
+ {
641
+ fallback: /* @__PURE__ */ i(Y, {}),
642
+ preloadOnHover: !0,
643
+ displayName: "LazyCodeEditor"
644
+ }
645
+ ),
646
+ /**
647
+ * Lazy-loaded NiceHtmlEditor
648
+ */
649
+ HtmlEditor: C(
650
+ x(
651
+ () => import("./NiceHtmlEditor-Bv3VqJPG.js").then((e) => ({ default: e.NiceHtmlEditor }))
652
+ ),
653
+ {
654
+ fallback: /* @__PURE__ */ i(Y, {}),
655
+ preloadOnHover: !0,
656
+ displayName: "LazyHtmlEditor"
657
+ }
658
+ ),
659
+ /**
660
+ * Lazy-loaded NiceDocumentViewer
661
+ */
662
+ DocumentViewer: C(
663
+ x(
664
+ () => import("./NiceDocumentViewer-gt1mxzP8.js").then((e) => ({ default: e.NiceDocumentViewer }))
665
+ ),
666
+ {
667
+ fallback: /* @__PURE__ */ i(R, { height: 600 }),
668
+ displayName: "LazyDocumentViewer"
669
+ }
670
+ ),
671
+ /**
672
+ * Lazy-loaded NiceChart
673
+ */
674
+ Chart: C(
675
+ x(() => import("./charts-FuDk5-r6.js").then((e) => e.fC).then((e) => ({ default: e.NiceChart }))),
676
+ {
677
+ fallback: /* @__PURE__ */ i(Z, {}),
678
+ preloadAfterIdle: 3e3,
679
+ displayName: "LazyChart"
680
+ }
681
+ ),
682
+ /**
683
+ * Lazy-loaded NiceVectorMap
684
+ */
685
+ VectorMap: C(
686
+ x(
687
+ () => import("./charts-FuDk5-r6.js").then((e) => e.fF).then((e) => ({ default: e.NiceVectorMap }))
688
+ ),
689
+ {
690
+ fallback: /* @__PURE__ */ i(R, { height: 400 }),
691
+ displayName: "LazyVectorMap"
692
+ }
693
+ ),
694
+ /**
695
+ * Lazy-loaded NiceSankey
696
+ */
697
+ Sankey: C(
698
+ x(
699
+ () => import("./charts-FuDk5-r6.js").then((e) => e.fD).then((e) => ({ default: e.NiceSankey }))
700
+ ),
701
+ {
702
+ fallback: /* @__PURE__ */ i(Z, {}),
703
+ displayName: "LazySankey"
704
+ }
705
+ ),
706
+ /**
707
+ * Lazy-loaded NiceScheduler
708
+ */
709
+ Scheduler: C(
710
+ x(
711
+ () => import("./NiceScheduler-DuPnaA3t.js").then((e) => e.b).then((e) => ({ default: e.NiceScheduler }))
712
+ ),
713
+ {
714
+ fallback: /* @__PURE__ */ i(ee, {}),
715
+ displayName: "LazyScheduler"
716
+ }
717
+ ),
718
+ /**
719
+ * Lazy-loaded NiceGantt
720
+ */
721
+ Gantt: C(
722
+ x(
723
+ () => import("./NiceGantt-D8coFAvK.js").then((e) => ({ default: e.NiceGantt }))
724
+ ),
725
+ {
726
+ fallback: /* @__PURE__ */ i(ee, {}),
727
+ displayName: "LazyGantt"
728
+ }
729
+ ),
730
+ /**
731
+ * Lazy-loaded NicePivotGrid
732
+ */
733
+ PivotGrid: C(
734
+ x(
735
+ () => import("./NicePivotGrid-DV54FCsH.js").then((e) => e.o).then((e) => ({ default: e.NicePivotGrid }))
736
+ ),
737
+ {
738
+ fallback: /* @__PURE__ */ i(_, {}),
739
+ displayName: "LazyPivotGrid"
740
+ }
741
+ ),
742
+ /**
743
+ * Lazy-loaded NiceDataGrid (for very heavy usage)
744
+ */
745
+ DataGrid: C(
746
+ x(
747
+ () => import("./NiceDataGrid-CPKcVOVz.js").then((e) => e.b).then((e) => ({ default: e.NiceDataGrid }))
748
+ ),
749
+ {
750
+ fallback: /* @__PURE__ */ i(_, {}),
751
+ preloadAfterIdle: 2e3,
752
+ displayName: "LazyDataGrid"
753
+ }
754
+ )
755
+ };
756
+ async function Me() {
757
+ await Promise.all([
758
+ N.CodeEditor.preload(),
759
+ N.HtmlEditor.preload(),
760
+ N.DocumentViewer.preload(),
761
+ N.Chart.preload(),
762
+ N.VectorMap.preload(),
763
+ N.Sankey.preload(),
764
+ N.Scheduler.preload(),
765
+ N.Gantt.preload(),
766
+ N.PivotGrid.preload()
767
+ ]);
768
+ }
769
+ async function De(e) {
770
+ await Promise.all(e.map((o) => N[o].preload()));
771
+ }
772
+ export {
773
+ fe as D,
774
+ N as L,
775
+ Se as T,
776
+ we as a,
777
+ D as b,
778
+ ve as c,
779
+ R as d,
780
+ C as e,
781
+ De as f,
782
+ Le as g,
783
+ Ae as h,
784
+ Ne as i,
785
+ X as j,
786
+ ze as k,
787
+ Ee as l,
788
+ xe as m,
789
+ be as n,
790
+ ye as o,
791
+ Me as p,
792
+ ke as q,
793
+ Ce as r,
794
+ F as u
795
+ };