@almadar/ui 2.6.0 → 2.7.0

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.
@@ -1,104 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
3
-
4
- // lib/cn.ts
5
- function cn(...inputs) {
6
- return twMerge(clsx(inputs));
7
- }
8
-
9
- // lib/debug.ts
10
- var DEBUG_ENABLED = typeof window !== "undefined" && (localStorage.getItem("debug") === "true" || process.env.NODE_ENV === "development");
11
- function isDebugEnabled() {
12
- return DEBUG_ENABLED;
13
- }
14
- function debug(...args) {
15
- if (DEBUG_ENABLED) {
16
- console.log("[DEBUG]", ...args);
17
- }
18
- }
19
- function debugGroup(label) {
20
- if (DEBUG_ENABLED) {
21
- console.group(`[DEBUG] ${label}`);
22
- }
23
- }
24
- function debugGroupEnd() {
25
- if (DEBUG_ENABLED) {
26
- console.groupEnd();
27
- }
28
- }
29
- function debugWarn(...args) {
30
- if (DEBUG_ENABLED) {
31
- console.warn("[DEBUG]", ...args);
32
- }
33
- }
34
- function debugError(...args) {
35
- if (DEBUG_ENABLED) {
36
- console.error("[DEBUG]", ...args);
37
- }
38
- }
39
- function debugTable(data) {
40
- if (DEBUG_ENABLED) {
41
- console.table(data);
42
- }
43
- }
44
- function debugTime(label) {
45
- if (DEBUG_ENABLED) {
46
- console.time(`[DEBUG] ${label}`);
47
- }
48
- }
49
- function debugTimeEnd(label) {
50
- if (DEBUG_ENABLED) {
51
- console.timeEnd(`[DEBUG] ${label}`);
52
- }
53
- }
54
- function debugInput(inputType, data) {
55
- if (DEBUG_ENABLED) {
56
- console.log(`[DEBUG:INPUT] ${inputType}:`, data);
57
- }
58
- }
59
- function debugCollision(entityA, entityB, details) {
60
- if (DEBUG_ENABLED) {
61
- console.log(
62
- `[DEBUG:COLLISION] ${entityA.type || entityA.id} <-> ${entityB.type || entityB.id}`,
63
- details ?? ""
64
- );
65
- }
66
- }
67
- function debugPhysics(entityId, physics) {
68
- if (DEBUG_ENABLED) {
69
- console.log(`[DEBUG:PHYSICS] ${entityId}:`, physics);
70
- }
71
- }
72
- function debugGameState(stateName, value) {
73
- if (DEBUG_ENABLED) {
74
- console.log(`[DEBUG:GAME_STATE] ${stateName}:`, value);
75
- }
76
- }
77
-
78
- // lib/getNestedValue.ts
79
- function getNestedValue(obj, path) {
80
- if (obj === null || obj === void 0) {
81
- return void 0;
82
- }
83
- if (!path.includes(".")) {
84
- return obj[path];
85
- }
86
- const parts = path.split(".");
87
- let value = obj;
88
- for (const part of parts) {
89
- if (value === null || value === void 0) {
90
- return void 0;
91
- }
92
- if (typeof value !== "object") {
93
- return void 0;
94
- }
95
- value = value[part];
96
- }
97
- return value;
98
- }
99
- function formatNestedFieldLabel(path) {
100
- const lastPart = path.includes(".") ? path.split(".").pop() : path;
101
- return lastPart.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase()).replace(/Id$/, "").trim();
102
- }
103
-
104
- export { cn, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, formatNestedFieldLabel, getNestedValue, isDebugEnabled };