tekivex-ui 2.5.11 → 2.5.13

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 (47) hide show
  1. package/dist/TkxForm-1KDzoniV.cjs +12 -0
  2. package/dist/TkxForm-9-W3Nl6m.js +314 -0
  3. package/dist/charts.cjs +1 -1
  4. package/dist/charts.js +543 -507
  5. package/dist/chunk-Bmb41Sf3.cjs +1 -0
  6. package/dist/headless.cjs +1 -1
  7. package/dist/headless.js +428 -447
  8. package/dist/hooks-6pRsPOyG.js +58 -0
  9. package/dist/hooks-mivgRljH.cjs +1 -0
  10. package/dist/i18n.cjs +1 -1
  11. package/dist/i18n.js +728 -752
  12. package/dist/index.cjs +26 -26
  13. package/dist/index.js +16102 -16619
  14. package/dist/quantum.cjs +14 -16
  15. package/dist/quantum.js +2473 -2279
  16. package/dist/realtime.cjs +4 -10
  17. package/dist/realtime.js +804 -958
  18. package/dist/src/components/TkxClock.d.ts.map +1 -1
  19. package/dist/src/components/TkxForm.d.ts.map +1 -1
  20. package/dist/src/components/TkxLiveFeed.d.ts +1 -1
  21. package/dist/src/components/TkxLiveLog.d.ts +1 -1
  22. package/dist/src/components/TkxRealTimeChart.d.ts +1 -1
  23. package/dist/src/components/TkxTooltip.d.ts.map +1 -1
  24. package/dist/src/components/TkxTypography.d.ts +5 -5
  25. package/dist/src/components/TkxTypography.d.ts.map +1 -1
  26. package/dist/tekivex-ui.css +2 -0
  27. package/dist/themes-BbJanqiC.js +498 -0
  28. package/dist/themes-CMq2vWXj.cjs +2 -0
  29. package/dist/tkx-0oAwZqgL.cjs +4 -0
  30. package/dist/tkx-DQkvHdE5.js +1172 -0
  31. package/package.json +18 -19
  32. package/src/charts/TkxPieChart.tsx +1 -1
  33. package/src/components/TkxClock.tsx +2 -2
  34. package/src/components/TkxForm.tsx +4 -2
  35. package/src/components/TkxTooltip.tsx +7 -5
  36. package/src/components/TkxTypography.tsx +2 -2
  37. package/dist/TkxForm-2tGLCPH6.js +0 -326
  38. package/dist/TkxForm-C2VqR2wC.cjs +0 -12
  39. package/dist/index-BgHMZe4Z.js +0 -66
  40. package/dist/index-Bt5y50Qa.cjs +0 -1
  41. package/dist/index-DnqXtpwV.cjs +0 -2
  42. package/dist/index-iUUHRxqJ.js +0 -515
  43. package/dist/security-C-ZPGoyG.js +0 -97
  44. package/dist/security-Uf0mjv8o.cjs +0 -1
  45. package/dist/style.css +0 -1
  46. package/dist/tkx-BtHzWKTl.js +0 -1112
  47. package/dist/tkx-C7GvVUE9.cjs +0 -4
@@ -1,515 +0,0 @@
1
- import { createContext as D, createElement as y, useContext as R, useLayoutEffect as j, useEffect as N } from "react";
2
- const z = 2166136261, L = 16777619;
3
- function A(n) {
4
- let e = z;
5
- for (let t = 0; t < n.length; t++)
6
- e ^= n.charCodeAt(t), e = Math.imul(e, L) >>> 0;
7
- return e.toString(16).padStart(8, "0");
8
- }
9
- class F {
10
- constructor(e = 512) {
11
- this.cache = /* @__PURE__ */ new Map(), this.hits = 0, this.misses = 0, this.ceiling = Math.min(e, 512);
12
- }
13
- get(e) {
14
- if (!this.cache.has(e)) {
15
- this.misses++;
16
- return;
17
- }
18
- this.hits++;
19
- const t = this.cache.get(e);
20
- return this.cache.delete(e), this.cache.set(e, t), t;
21
- }
22
- set(e, t) {
23
- this.cache.has(e) ? this.cache.delete(e) : this.cache.size >= this.ceiling && this.cache.delete(this.cache.keys().next().value), this.cache.set(e, t);
24
- }
25
- has(e) {
26
- return this.cache.has(e);
27
- }
28
- invalidate(e) {
29
- e !== void 0 ? this.cache.delete(e) : this.cache.clear();
30
- }
31
- get size() {
32
- return this.cache.size;
33
- }
34
- get cacheHitRate() {
35
- const e = this.hits + this.misses;
36
- return e === 0 ? 0 : this.hits / e * 100;
37
- }
38
- }
39
- const u = new F(512);
40
- function O(n, e) {
41
- const t = u.get(n);
42
- if (t !== void 0) return t;
43
- const a = e();
44
- return u.set(n, a), a;
45
- }
46
- const E = [];
47
- let x = !1;
48
- const p = [];
49
- let b = 0, l = 0;
50
- function B() {
51
- const n = E.splice(0), e = performance.now();
52
- for (const a of n)
53
- try {
54
- a();
55
- } catch {
56
- }
57
- const t = performance.now() - e;
58
- b += t, l++, p.push({ duration: t, timestamp: Date.now() }), p.length > 100 && p.shift();
59
- }
60
- function V(n) {
61
- E.push(n), x || (x = !0, queueMicrotask(() => {
62
- B(), x = !1;
63
- }));
64
- }
65
- function P(n) {
66
- const e = n !== void 0 ? p.slice(-n) : p.slice();
67
- return {
68
- avgRenderTime: l === 0 ? 0 : b / l,
69
- cacheHitRate: u.cacheHitRate,
70
- renderCount: l,
71
- recent: e
72
- };
73
- }
74
- function q(n) {
75
- n !== void 0 ? u.invalidate(n) : u.invalidate();
76
- }
77
- const fe = {
78
- hash: A,
79
- memoize: O,
80
- batchUpdate: V,
81
- invalidate: q,
82
- get avgRenderTime() {
83
- return l === 0 ? 0 : b / l;
84
- },
85
- get cacheHitRate() {
86
- return u.cacheHitRate;
87
- },
88
- getMetrics: P
89
- }, h = /* @__PURE__ */ new Map();
90
- function k(n) {
91
- return n.replace(/([A-Z])/g, "-$1").toLowerCase();
92
- }
93
- function G(n) {
94
- return "tkx-" + A(n);
95
- }
96
- function T(n) {
97
- const e = G(n);
98
- return h.has(e) || h.set(e, n), e;
99
- }
100
- function K(n, ...e) {
101
- const t = n.reduce((s, r, i) => s + r + (e[i] !== void 0 ? String(e[i]) : ""), "");
102
- return { className: T(t.trim()), styles: t.trim() };
103
- }
104
- function U(n) {
105
- const e = Object.entries(n).map(([a, s]) => `${k(a)}: ${s};`).join(" ");
106
- return { className: T(e), styles: e };
107
- }
108
- const W = {
109
- xs: "480px",
110
- sm: "640px",
111
- md: "768px",
112
- lg: "1024px",
113
- xl: "1280px",
114
- "2xl": "1536px"
115
- };
116
- function I(n, e) {
117
- return `@media (min-width: ${W[n]}) { ${e} }`;
118
- }
119
- function _(n, e) {
120
- const t = Object.entries(e).map(([a, s]) => {
121
- const r = Object.entries(s).map(([i, o]) => `${k(i)}: ${o};`).join(" ");
122
- return `${a} { ${r} }`;
123
- }).join(" ");
124
- return `@keyframes ${n} { ${t} }`;
125
- }
126
- function $(n, e) {
127
- return e !== void 0 ? `--tkx-${n}: ${e};` : `var(--tkx-${n})`;
128
- }
129
- function M() {
130
- return Array.from(h.entries()).map(([n, e]) => `.${n} { ${e} }`).join(`
131
- `);
132
- }
133
- function Q() {
134
- h.clear();
135
- }
136
- function X() {
137
- if (typeof document > "u") return;
138
- let n = document.getElementById("tkx-styles");
139
- n || (n = document.createElement("style"), n.id = "tkx-styles", document.head.appendChild(n)), n.textContent = M();
140
- }
141
- const de = {
142
- css: K,
143
- fromObject: U,
144
- responsive: I,
145
- keyframes: _,
146
- cssVar: $,
147
- extractCSS: M,
148
- injectStyles: X,
149
- resetStyles: Q
150
- };
151
- function Z(n) {
152
- if (!n || typeof n != "string") return [0, 0, 0];
153
- const e = n.replace("#", ""), t = e.length === 3 ? e.split("").map((i) => i + i).join("") : e, a = parseInt(t.slice(0, 2), 16), s = parseInt(t.slice(2, 4), 16), r = parseInt(t.slice(4, 6), 16);
154
- return [isNaN(a) ? 0 : a, isNaN(s) ? 0 : s, isNaN(r) ? 0 : r];
155
- }
156
- function w(n) {
157
- const [e, t, a] = Z(n).map((s) => {
158
- const r = s / 255;
159
- return r <= 0.03928 ? r / 12.92 : ((r + 0.055) / 1.055) ** 2.4;
160
- });
161
- return 0.2126 * e + 0.7152 * t + 0.0722 * a;
162
- }
163
- function m(n, e) {
164
- const t = w(n), a = w(e), s = Math.max(t, a), r = Math.min(t, a);
165
- return (s + 0.05) / (r + 0.05);
166
- }
167
- function g(n, e, t = !1) {
168
- return m(n, e) >= (t ? 3 : 4.5);
169
- }
170
- function S(n, e, t = !1) {
171
- return m(n, e) >= (t ? 4.5 : 7);
172
- }
173
- function J(n, e) {
174
- const a = e ?? ["#ffffff", "#000000"];
175
- return a.reduce((s, r) => m(r, n) > m(s, n) ? r : s, a[0]);
176
- }
177
- function Y() {
178
- const n = document.createElement("div"), e = document.createElement("div");
179
- for (const t of [n, e])
180
- t.setAttribute("aria-atomic", "true"), t.style.cssText = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;", document.body.appendChild(t);
181
- return n.setAttribute("aria-live", "polite"), e.setAttribute("aria-live", "assertive"), {
182
- announce(t, a = "polite") {
183
- const s = a === "assertive" ? e : n;
184
- s.textContent = "", setTimeout(() => {
185
- s.textContent = t;
186
- }, 0);
187
- },
188
- destroy() {
189
- n.remove(), e.remove();
190
- }
191
- };
192
- }
193
- const ee = [
194
- "a[href]",
195
- "button:not([disabled])",
196
- "input:not([disabled])",
197
- "select:not([disabled])",
198
- "textarea:not([disabled])",
199
- '[tabindex]:not([tabindex="-1"])',
200
- "details > summary"
201
- ].join(", ");
202
- function te(n) {
203
- let e = null, t = null;
204
- function a() {
205
- return Array.from(n.querySelectorAll(ee)).filter(
206
- (s) => !s.closest("[hidden]") && !s.closest('[aria-hidden="true"]')
207
- );
208
- }
209
- return {
210
- activate() {
211
- e = document.activeElement;
212
- const s = a();
213
- s.length > 0 && s[0].focus(), t = (r) => {
214
- if (r.key !== "Tab") return;
215
- const i = a();
216
- if (i.length === 0) return;
217
- const o = i[0], f = i[i.length - 1];
218
- r.shiftKey ? document.activeElement === o && (r.preventDefault(), f.focus()) : document.activeElement === f && (r.preventDefault(), o.focus());
219
- }, n.addEventListener("keydown", t);
220
- },
221
- deactivate() {
222
- t && n.removeEventListener("keydown", t), e instanceof HTMLElement && e.focus(), e = null, t = null;
223
- }
224
- };
225
- }
226
- function ne(n, e, t, a) {
227
- let s = e;
228
- switch (n.key) {
229
- case "ArrowLeft":
230
- case "ArrowUp":
231
- n.preventDefault(), s = e === 0 ? t - 1 : e - 1;
232
- break;
233
- case "ArrowRight":
234
- case "ArrowDown":
235
- n.preventDefault(), s = e === t - 1 ? 0 : e + 1;
236
- break;
237
- case "Home":
238
- n.preventDefault(), s = 0;
239
- break;
240
- case "End":
241
- n.preventDefault(), s = t - 1;
242
- break;
243
- case "Enter":
244
- case " ":
245
- n.preventDefault(), a(e);
246
- return;
247
- default:
248
- return;
249
- }
250
- a(s);
251
- }
252
- function se(n, e, t, a, s) {
253
- let r = e;
254
- switch (n.key) {
255
- case "ArrowUp":
256
- n.preventDefault(), r = e === 0 ? t - 1 : e - 1;
257
- break;
258
- case "ArrowDown":
259
- n.preventDefault(), r = e === t - 1 ? 0 : e + 1;
260
- break;
261
- case "Home":
262
- n.preventDefault(), r = 0;
263
- break;
264
- case "End":
265
- n.preventDefault(), r = t - 1;
266
- break;
267
- case "Enter":
268
- case " ":
269
- n.preventDefault(), a(e);
270
- return;
271
- case "Escape":
272
- n.preventDefault(), s == null || s();
273
- return;
274
- default:
275
- return;
276
- }
277
- a(r);
278
- }
279
- function ae() {
280
- return typeof window > "u" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches;
281
- }
282
- function re() {
283
- return typeof window > "u" ? !1 : window.matchMedia("(forced-colors: active)").matches;
284
- }
285
- function ie(n, e = "polite") {
286
- if (typeof document > "u") return;
287
- let t = document.getElementById("tkx-live-region");
288
- t || (t = document.createElement("div"), t.id = "tkx-live-region", t.setAttribute("aria-live", e), t.setAttribute("aria-atomic", "true"), t.style.cssText = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;", document.body.appendChild(t)), t.textContent = "", setTimeout(() => {
289
- t && (t.textContent = n);
290
- }, 0);
291
- }
292
- const pe = {
293
- contrastRatio: m,
294
- meetsAA: g,
295
- meetsAAA: S,
296
- getAccessibleForeground: J,
297
- createAnnouncer: Y,
298
- createFocusTrap: te,
299
- handleTabsKeyboard: ne,
300
- handleMenuKeyboard: se,
301
- prefersReducedMotion: ae,
302
- prefersHighContrast: re,
303
- announce: ie
304
- }, oe = typeof window < "u" ? j : N, H = {
305
- bg: "#0a0a0f",
306
- surface: "#12121a",
307
- surfaceAlt: "#1a1a2e",
308
- border: "#2a2a3e",
309
- text: "#e8e8f4",
310
- textMuted: "#8888aa",
311
- primary: "#00f5d4",
312
- secondary: "#7b2ff7",
313
- danger: "#f72585",
314
- warning: "#ffbe0b",
315
- success: "#06d6a0",
316
- info: "#3a86ff"
317
- }, me = {
318
- bg: "#f8f6f1",
319
- surface: "#ffffff",
320
- surfaceAlt: "#f0ede6",
321
- border: "#ddd8cc",
322
- text: "#1a1815",
323
- textMuted: "#6b6560",
324
- primary: "#0d7c5f",
325
- secondary: "#6930c3",
326
- danger: "#c1121f",
327
- warning: "#d4a017",
328
- success: "#0d7c5f",
329
- info: "#1d4ed8"
330
- }, ce = /^#[0-9a-fA-F]{3,8}$/;
331
- function he(n, e) {
332
- const t = { ...n, ...e };
333
- for (const [a, s] of Object.entries(t))
334
- if (!ce.test(s))
335
- throw new Error(`Invalid hex color for theme token '${a}': ${s}`);
336
- return g(t.text, t.bg) || console.warn(
337
- `[TekiVex] Theme contrast warning: text (${t.text}) vs bg (${t.bg}) does not meet WCAG AA minimum (4.5:1)`
338
- ), g(t.primary, t.bg) || console.warn(
339
- `[TekiVex] Theme contrast warning: primary (${t.primary}) vs bg (${t.bg}) does not meet WCAG AA minimum`
340
- ), S(t.text, t.bg) || console.warn(
341
- `[TekiVex] Theme contrast warning: text (${t.text}) vs bg (${t.bg}) does not meet WCAG AAA minimum (7:1)`
342
- ), t;
343
- }
344
- const C = D(H);
345
- function xe({ theme: n = H, children: e }) {
346
- oe(() => {
347
- const a = Object.entries(n).map(([r, i]) => $(r, i)).join(" ");
348
- let s = document.getElementById("tkx-theme");
349
- if (!s) {
350
- s = document.createElement("style"), s.id = "tkx-theme";
351
- const r = document.head.querySelector("style");
352
- r ? document.head.insertBefore(s, r) : document.head.appendChild(s);
353
- }
354
- s.textContent = `:root { ${a} }`;
355
- }, [n]);
356
- const t = Object.fromEntries(
357
- Object.entries(n).map(([a, s]) => [
358
- `--tkx-${a}`,
359
- s
360
- ])
361
- );
362
- return y(
363
- C.Provider,
364
- { value: n },
365
- y("div", { style: { display: "contents", ...t } }, e)
366
- );
367
- }
368
- function ge() {
369
- return R(C);
370
- }
371
- function le(n) {
372
- const e = n.replace("#", ""), t = parseInt(e.slice(0, 2), 16) / 255, a = parseInt(e.slice(2, 4), 16) / 255, s = parseInt(e.slice(4, 6), 16) / 255, r = Math.max(t, a, s), i = Math.min(t, a, s);
373
- let o = 0, f = 0;
374
- const v = (r + i) / 2;
375
- if (r !== i) {
376
- const d = r - i;
377
- switch (f = v > 0.5 ? d / (2 - r - i) : d / (r + i), r) {
378
- case t:
379
- o = ((a - s) / d + (a < s ? 6 : 0)) / 6;
380
- break;
381
- case a:
382
- o = ((s - t) / d + 2) / 6;
383
- break;
384
- case s:
385
- o = ((t - a) / d + 4) / 6;
386
- break;
387
- }
388
- }
389
- return [Math.round(o * 360), Math.round(f * 100), Math.round(v * 100)];
390
- }
391
- function c(n, e, t) {
392
- e /= 100, t /= 100;
393
- const a = e * Math.min(t, 1 - t), s = (r) => {
394
- const i = (r + n / 30) % 12, o = t - a * Math.max(Math.min(i - 3, 9 - i, 1), -1);
395
- return Math.round(255 * o).toString(16).padStart(2, "0");
396
- };
397
- return `#${s(0)}${s(8)}${s(4)}`;
398
- }
399
- function be(n) {
400
- const [e, t] = le(n);
401
- return {
402
- 50: c(e, Math.min(t, 30), 96),
403
- 100: c(e, Math.min(t, 40), 90),
404
- 200: c(e, Math.min(t, 50), 80),
405
- 300: c(e, t, 70),
406
- 400: c(e, t, 60),
407
- 500: n,
408
- 600: c(e, t, 45),
409
- 700: c(e, t, 35),
410
- 800: c(e, t, 25),
411
- 900: c(e, t, 15)
412
- };
413
- }
414
- const ve = {
415
- xs: { fontSize: "0.75rem", lineHeight: "1rem" },
416
- sm: { fontSize: "0.875rem", lineHeight: "1.25rem" },
417
- base: { fontSize: "1rem", lineHeight: "1.5rem" },
418
- lg: { fontSize: "1.125rem", lineHeight: "1.75rem" },
419
- xl: { fontSize: "1.25rem", lineHeight: "1.75rem" },
420
- "2xl": { fontSize: "1.5rem", lineHeight: "2rem" },
421
- "3xl": { fontSize: "1.875rem", lineHeight: "2.25rem" },
422
- "4xl": { fontSize: "2.25rem", lineHeight: "2.5rem" },
423
- "5xl": { fontSize: "3rem", lineHeight: "1.15" }
424
- }, ye = {
425
- 0: "0px",
426
- 0.5: "2px",
427
- 1: "4px",
428
- 1.5: "6px",
429
- 2: "8px",
430
- 2.5: "10px",
431
- 3: "12px",
432
- 4: "16px",
433
- 5: "20px",
434
- 6: "24px",
435
- 8: "32px",
436
- 10: "40px",
437
- 12: "48px",
438
- 16: "64px",
439
- 20: "80px",
440
- 24: "96px"
441
- }, we = {
442
- sm: 640,
443
- md: 768,
444
- lg: 1024,
445
- xl: 1280,
446
- "2xl": 1536
447
- }, Ae = {
448
- none: "none",
449
- xs: "0 1px 2px 0 rgba(0,0,0,0.05)",
450
- sm: "0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)",
451
- md: "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",
452
- lg: "0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",
453
- xl: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)",
454
- "2xl": "0 25px 50px -12px rgba(0,0,0,0.25)",
455
- inner: "inset 0 2px 4px 0 rgba(0,0,0,0.06)"
456
- }, Ee = {
457
- hide: -1,
458
- base: 0,
459
- dropdown: 1e3,
460
- sticky: 1100,
461
- fixed: 1200,
462
- overlay: 1300,
463
- modal: 1400,
464
- popover: 1500,
465
- tooltip: 1600,
466
- toast: 1700,
467
- max: 9999
468
- }, ke = {
469
- none: "0",
470
- sm: "4px",
471
- md: "6px",
472
- lg: "8px",
473
- xl: "12px",
474
- "2xl": "16px",
475
- full: "9999px"
476
- };
477
- export {
478
- I as A,
479
- Ae as B,
480
- ye as C,
481
- ve as D,
482
- Ee as E,
483
- Q as F,
484
- Y as G,
485
- F as L,
486
- fe as Q,
487
- de as T,
488
- pe as W,
489
- C as a,
490
- xe as b,
491
- me as c,
492
- V as d,
493
- we as e,
494
- m as f,
495
- J as g,
496
- ne as h,
497
- te as i,
498
- he as j,
499
- K as k,
500
- $ as l,
501
- M as m,
502
- A as n,
503
- U as o,
504
- be as p,
505
- X as q,
506
- _ as r,
507
- g as s,
508
- S as t,
509
- ge as u,
510
- O as v,
511
- re as w,
512
- ae as x,
513
- H as y,
514
- ke as z
515
- };
@@ -1,97 +0,0 @@
1
- import { n as a } from "./index-iUUHRxqJ.js";
2
- const m = {
3
- "<": "&lt;",
4
- ">": "&gt;",
5
- "&": "&amp;",
6
- "'": "&#39;",
7
- '"': "&quot;"
8
- };
9
- function p(t) {
10
- return String(t).replace(/[<>&'"]/g, (n) => m[n] ?? n);
11
- }
12
- function u(t) {
13
- const n = {};
14
- for (const e of Object.keys(t))
15
- n[e] = f(t[e]);
16
- return n;
17
- }
18
- function f(t) {
19
- return typeof t == "string" ? p(t) : Array.isArray(t) ? t.map(f) : t !== null && typeof t == "object" && !l(t) ? u(t) : t;
20
- }
21
- function l(t) {
22
- return typeof t == "object" && t !== null && "$$typeof" in t;
23
- }
24
- function y(t, n) {
25
- const e = [];
26
- for (const [o, s] of Object.entries(n)) {
27
- const i = t[o], c = i == null;
28
- if (s.required && c) {
29
- e.push(`prop '${o}' is required`);
30
- continue;
31
- }
32
- if (!c) {
33
- if (typeof i !== s.type) {
34
- e.push(`prop '${o}' must be of type ${s.type}, got ${typeof i}`);
35
- continue;
36
- }
37
- s.type === "number" && typeof i == "number" && (s.min !== void 0 && i < s.min && e.push(`prop '${o}' must be >= ${s.min}`), s.max !== void 0 && i > s.max && e.push(`prop '${o}' must be <= ${s.max}`)), s.type === "string" && typeof i == "string" && s.pattern && !s.pattern.test(i) && e.push(`prop '${o}' does not match pattern ${s.pattern}`), s.enum && !s.enum.includes(i) && e.push(`prop '${o}' must be one of: ${s.enum.join(", ")}`);
38
- }
39
- }
40
- return { valid: e.length === 0, errors: e };
41
- }
42
- const h = /* @__PURE__ */ new Map();
43
- function g(t, n) {
44
- const e = {
45
- "default-src": ["'self'"],
46
- "style-src": n.allowInlineStyles ? ["'self'", "'unsafe-inline'"] : ["'self'"],
47
- "img-src": n.allowDataUrls ? ["'self'", "data:"] : n.allowExternalSrc ? ["'self'", "*"] : ["'self'"],
48
- "script-src": n.allowScripts ? ["'self'"] : ["'none'"]
49
- }, o = { componentId: t, permissions: n, directives: e };
50
- return h.set(t, o), o;
51
- }
52
- function d(t, n) {
53
- const e = h.get(t);
54
- return (e == null ? void 0 : e.permissions[n]) === !0;
55
- }
56
- let r = [];
57
- function $(t, n, e) {
58
- const o = a(JSON.stringify(e ?? {})), s = r.length > 0 ? r[r.length - 1].chainHash : "00000000", i = a(s + o + n + t), c = Object.freeze({
59
- timestamp: Date.now(),
60
- component: n,
61
- action: t,
62
- propsHash: o,
63
- chainHash: i
64
- });
65
- return r = Object.freeze([...r, c]), c;
66
- }
67
- function b(t) {
68
- let n = r;
69
- return t != null && t.component && (n = n.filter((e) => e.component === t.component)), t != null && t.action && (n = n.filter((e) => e.action === t.action)), t != null && t.limit && (n = n.slice(-t.limit)), n;
70
- }
71
- function H() {
72
- let t = "00000000";
73
- for (const n of r) {
74
- if (a(t + n.propsHash + n.component + n.action) !== n.chainHash) return !1;
75
- t = n.chainHash;
76
- }
77
- return !0;
78
- }
79
- const j = {
80
- sanitize: p,
81
- sanitizeProps: u,
82
- validateProps: y,
83
- createCSP: g,
84
- hasPermission: d,
85
- audit: $,
86
- getAuditLog: b,
87
- verifyAuditIntegrity: H
88
- };
89
- export {
90
- j as S,
91
- $ as a,
92
- u as b,
93
- H as c,
94
- b as g,
95
- p as s,
96
- y as v
97
- };
@@ -1 +0,0 @@
1
- "use strict";const a=require("./index-DnqXtpwV.cjs"),g={"<":"&lt;",">":"&gt;","&":"&amp;","'":"&#39;",'"':"&quot;"};function u(t){return String(t).replace(/[<>&'"]/g,n=>g[n]??n)}function p(t){const n={};for(const e of Object.keys(t))n[e]=f(t[e]);return n}function f(t){return typeof t=="string"?u(t):Array.isArray(t)?t.map(f):t!==null&&typeof t=="object"&&!$(t)?p(t):t}function $(t){return typeof t=="object"&&t!==null&&"$$typeof"in t}function h(t,n){const e=[];for(const[s,i]of Object.entries(n)){const o=t[s],c=o==null;if(i.required&&c){e.push(`prop '${s}' is required`);continue}if(!c){if(typeof o!==i.type){e.push(`prop '${s}' must be of type ${i.type}, got ${typeof o}`);continue}i.type==="number"&&typeof o=="number"&&(i.min!==void 0&&o<i.min&&e.push(`prop '${s}' must be >= ${i.min}`),i.max!==void 0&&o>i.max&&e.push(`prop '${s}' must be <= ${i.max}`)),i.type==="string"&&typeof o=="string"&&i.pattern&&!i.pattern.test(o)&&e.push(`prop '${s}' does not match pattern ${i.pattern}`),i.enum&&!i.enum.includes(o)&&e.push(`prop '${s}' must be one of: ${i.enum.join(", ")}`)}}return{valid:e.length===0,errors:e}}const l=new Map;function b(t,n){const e={"default-src":["'self'"],"style-src":n.allowInlineStyles?["'self'","'unsafe-inline'"]:["'self'"],"img-src":n.allowDataUrls?["'self'","data:"]:n.allowExternalSrc?["'self'","*"]:["'self'"],"script-src":n.allowScripts?["'self'"]:["'none'"]},s={componentId:t,permissions:n,directives:e};return l.set(t,s),s}function H(t,n){const e=l.get(t);return(e==null?void 0:e.permissions[n])===!0}let r=[];function y(t,n,e){const s=a.fnv1aHash(JSON.stringify(e??{})),i=r.length>0?r[r.length-1].chainHash:"00000000",o=a.fnv1aHash(i+s+n+t),c=Object.freeze({timestamp:Date.now(),component:n,action:t,propsHash:s,chainHash:o});return r=Object.freeze([...r,c]),c}function m(t){let n=r;return t!=null&&t.component&&(n=n.filter(e=>e.component===t.component)),t!=null&&t.action&&(n=n.filter(e=>e.action===t.action)),t!=null&&t.limit&&(n=n.slice(-t.limit)),n}function d(){let t="00000000";for(const n of r){if(a.fnv1aHash(t+n.propsHash+n.component+n.action)!==n.chainHash)return!1;t=n.chainHash}return!0}const S={sanitize:u,sanitizeProps:p,validateProps:h,createCSP:b,hasPermission:H,audit:y,getAuditLog:m,verifyAuditIntegrity:d};exports.Shield=S;exports.audit=y;exports.getAuditLog=m;exports.sanitizeProps=p;exports.sanitizeString=u;exports.validateProps=h;exports.verifyAuditIntegrity=d;
package/dist/style.css DELETED
@@ -1 +0,0 @@
1
- *,*:before,*:after{box-sizing:border-box}:root{--tkx-bg: #0a0a0f;--tkx-surface: #12121a;--tkx-surfaceAlt: #1a1a2e;--tkx-border: #2a2a3e;--tkx-text: #e8e8f4;--tkx-textMuted: #8888aa;--tkx-primary: #00f5d4;--tkx-secondary: #7b2ff7;--tkx-danger: #f72585;--tkx-warning: #ffbe0b;--tkx-success: #06d6a0;--tkx-info: #3a86ff;--tkx-space-xs: 4px;--tkx-space-sm: 8px;--tkx-space-md: 16px;--tkx-space-lg: 24px;--tkx-space-xl: 32px;--tkx-radius-sm: 4px;--tkx-radius-md: 8px;--tkx-radius-lg: 12px;--tkx-radius-full: 9999px;--tkx-font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;--tkx-font-mono: "Cascadia Code", "Fira Code", "Consolas", monospace;--tkx-transition: .2s ease;--tkx-transition-fast: .1s ease}.tkx-focus-ring:focus-visible{outline:2px solid var(--tkx-primary);outline-offset:2px;border-radius:2px}:focus:not(:focus-visible){outline:none}.tkx-skip-nav{position:absolute;top:-9999px;left:0;z-index:9999;padding:8px 16px;background:var(--tkx-primary);color:var(--tkx-bg);font-weight:600;text-decoration:none;border-radius:0 0 4px;transition:top var(--tkx-transition-fast)}.tkx-skip-nav:focus{top:0;outline:2px solid var(--tkx-bg);outline-offset:2px}.tkx-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@keyframes tkx-fade-in{0%{opacity:0}to{opacity:1}}@keyframes tkx-slide-up{0%{transform:translateY(8px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes tkx-pulse{0%,to{opacity:1}50%{opacity:.4}}@keyframes tkx-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes tkx-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}@keyframes tkx-ripple{0%{transform:scale(0);opacity:.6}to{transform:scale(4);opacity:0}}@media (prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}@media (prefers-contrast: more){:root{--tkx-border: currentColor}.tkx-focus-ring:focus-visible{outline-width:3px}}@media (forced-colors: active){.tkx-button,.tkx-badge,.tkx-toggle,.tkx-input,.tkx-card{forced-color-adjust:none}}