react-state-basis 0.1.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.
package/dist/index.js ADDED
@@ -0,0 +1,451 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ BasisProvider: () => BasisProvider,
24
+ __testEngine__: () => __testEngine__,
25
+ __test__: () => __test__,
26
+ beginEffectTracking: () => beginEffectTracking,
27
+ createContext: () => createContext,
28
+ currentTickBatch: () => currentTickBatch,
29
+ endEffectTracking: () => endEffectTracking,
30
+ history: () => history,
31
+ printBasisHealthReport: () => printBasisHealthReport,
32
+ recordUpdate: () => recordUpdate,
33
+ registerVariable: () => registerVariable,
34
+ unregisterVariable: () => unregisterVariable,
35
+ useBasisConfig: () => useBasisConfig,
36
+ useContext: () => useContext,
37
+ useEffect: () => useEffect,
38
+ useMemo: () => useMemo,
39
+ useReducer: () => useReducer,
40
+ useState: () => useState
41
+ });
42
+ module.exports = __toCommonJS(index_exports);
43
+
44
+ // src/core/logger.ts
45
+ var STYLES = {
46
+ // Brand Colors
47
+ basis: "background: #6c5ce7; color: white; font-weight: bold; padding: 2px 6px; border-radius: 3px;",
48
+ version: "background: #a29bfe; color: #2d3436; padding: 2px 6px; border-radius: 3px; margin-left: -4px;",
49
+ // Headers
50
+ headerRed: "background: #d63031; color: white; font-weight: bold; padding: 4px 8px; border-radius: 4px;",
51
+ headerBlue: "background: #0984e3; color: white; font-weight: bold; padding: 4px 8px; border-radius: 4px;",
52
+ headerGreen: "background: #00b894; color: white; font-weight: bold; padding: 4px 8px; border-radius: 4px;",
53
+ // Elements
54
+ label: "background: #dfe6e9; color: #2d3436; padding: 0 4px; border-radius: 3px; font-family: monospace; font-weight: bold; border: 1px solid #b2bec3;",
55
+ location: "color: #0984e3; font-family: monospace; font-weight: bold;",
56
+ math: "color: #636e72; font-style: italic; font-family: serif;",
57
+ // Code Block
58
+ codeBlock: `
59
+ background: #1e1e1e;
60
+ color: #9cdcfe;
61
+ padding: 8px 12px;
62
+ display: block;
63
+ margin: 4px 0;
64
+ border-left: 3px solid #00b894;
65
+ font-family: 'Fira Code', monospace;
66
+ line-height: 1.4;
67
+ border-radius: 0 3px 3px 0;
68
+ `,
69
+ // Highlights
70
+ dim: "color: #e84393; font-weight: bold;",
71
+ bold: "font-weight: bold;"
72
+ };
73
+ var parseLabel = (label) => {
74
+ const parts = label.split(" -> ");
75
+ return {
76
+ file: parts[0] || "Unknown",
77
+ name: parts[1] || label
78
+ };
79
+ };
80
+ var displayBootLog = (windowSize) => {
81
+ console.log(
82
+ `%cBasis%cAuditor v0.1.0%c Monitoring State Space | Window: ${windowSize} ticks`,
83
+ STYLES.basis,
84
+ STYLES.version,
85
+ "color: #636e72; font-style: italic; margin-left: 8px;"
86
+ );
87
+ };
88
+ var displayRedundancyAlert = (labelA, labelB, sim, totalDimensions) => {
89
+ const infoA = parseLabel(labelA);
90
+ const infoB = parseLabel(labelB);
91
+ const isCrossFile = infoA.file !== infoB.file;
92
+ console.group(`%c \u{1F4D0} BASIS | DIMENSION COLLAPSE DETECTED `, STYLES.headerRed);
93
+ console.log(`%c\u{1F4CD} Location: %c${isCrossFile ? `${infoA.file} & ${infoB.file}` : infoA.file}`, STYLES.bold, STYLES.location);
94
+ console.log(
95
+ `%cAnalysis:%c Vectors %c${infoA.name}%c and %c${infoB.name}%c are collinear (redundant).`,
96
+ STYLES.bold,
97
+ "",
98
+ STYLES.label,
99
+ "",
100
+ STYLES.label,
101
+ ""
102
+ );
103
+ console.log(
104
+ `%cHow to fix:%c Project %c${infoB.name}%c as a derived value:
105
+ %c// \u{1F6E0}\uFE0F Basis Fix: Remove useState, use useMemo
106
+ const ${infoB.name} = useMemo(() => deriveFrom(${infoA.name}), [${infoA.name}]);%c`,
107
+ "color: #00b894; font-weight: bold;",
108
+ "",
109
+ "color: #e84393; font-weight: bold;",
110
+ "",
111
+ STYLES.codeBlock,
112
+ ""
113
+ );
114
+ console.groupCollapsed(`%c \u{1F52C} Proof Details `, "color: #636e72; font-size: 10px; cursor: pointer;");
115
+ console.table({
116
+ "Similarity": `${(sim * 100).toFixed(2)}%`,
117
+ "Linear Dependency": "TRUE",
118
+ "Rank": totalDimensions - 1
119
+ });
120
+ console.groupEnd();
121
+ console.groupEnd();
122
+ };
123
+ var displayCausalHint = (targetLabel, sourceLabel) => {
124
+ const target = parseLabel(targetLabel);
125
+ const source = parseLabel(sourceLabel);
126
+ const isCrossFile = target.file !== source.file;
127
+ const locationPath = isCrossFile ? `${source.file} \u2794 ${target.file}` : target.file;
128
+ console.groupCollapsed(`%c \u{1F4A1} BASIS | CAUSALITY (Sequential Update) `, STYLES.headerBlue);
129
+ console.log(`%c\u{1F4CD} Location: %c${locationPath}`, STYLES.bold, STYLES.location);
130
+ console.log(
131
+ `%cSequence:%c %c${source.name}%c \u2794 Effect \u2794 %c${target.name}%c`,
132
+ STYLES.bold,
133
+ "",
134
+ STYLES.label,
135
+ "",
136
+ STYLES.label,
137
+ ""
138
+ );
139
+ console.log(
140
+ `%cObservation:%c Variable %c${target.name}%c is being manually synchronized.
141
+ This creates a %c"Double Render Cycle"%c.`,
142
+ STYLES.bold,
143
+ "",
144
+ STYLES.label,
145
+ "",
146
+ "color: #d63031; font-weight: bold;",
147
+ ""
148
+ );
149
+ console.log(
150
+ `%cHow to fix:%c Use %cuseMemo%c to calculate %c${target.name}%c during render:
151
+ %cconst ${target.name} = useMemo(() => computeFrom(${source.name.includes("effect") ? "source" : source.name}), [${source.name.includes("effect") ? "source" : source.name}]);%c`,
152
+ "color: #00b894; font-weight: bold;",
153
+ "",
154
+ "color: #0984e3; font-weight: bold;",
155
+ "",
156
+ "color: #e84393; font-weight: bold;",
157
+ "",
158
+ STYLES.codeBlock,
159
+ ""
160
+ );
161
+ console.groupEnd();
162
+ };
163
+ var displayInfiniteLoop = (label) => {
164
+ const info = parseLabel(label);
165
+ console.group(`%c \u{1F6D1} BASIS CRITICAL | CIRCUIT BREAKER `, STYLES.headerRed);
166
+ console.error(
167
+ `Infinite oscillation detected on: %c${info.name}%c
168
+ Execution halted to prevent browser thread lock. Check your dependency arrays.`,
169
+ "color: white; background: #d63031; padding: 2px 4px; border-radius: 3px;",
170
+ ""
171
+ );
172
+ console.groupEnd();
173
+ };
174
+ var displayHealthReport = (history2, similarityFn, threshold) => {
175
+ const entries = Array.from(history2.entries());
176
+ const totalVars = entries.length;
177
+ if (totalVars === 0) return;
178
+ const clusters = [];
179
+ const processed = /* @__PURE__ */ new Set();
180
+ let independentCount = 0;
181
+ entries.forEach(([labelA, vecA]) => {
182
+ if (processed.has(labelA)) return;
183
+ const currentCluster = [labelA];
184
+ processed.add(labelA);
185
+ entries.forEach(([labelB, vecB]) => {
186
+ if (labelA === labelB || processed.has(labelB)) return;
187
+ const sim = similarityFn(vecA, vecB);
188
+ if (sim > threshold) {
189
+ currentCluster.push(labelB);
190
+ processed.add(labelB);
191
+ }
192
+ });
193
+ if (currentCluster.length > 1) {
194
+ clusters.push(currentCluster);
195
+ } else {
196
+ independentCount++;
197
+ }
198
+ });
199
+ const systemRank = independentCount + clusters.length;
200
+ const efficiency = systemRank / totalVars * 100;
201
+ console.group(`%c \u{1F4CA} BASIS | SYSTEM HEALTH REPORT `, STYLES.headerGreen);
202
+ console.log(
203
+ `%cBasis Efficiency: %c${efficiency.toFixed(1)}% %c(Rank: ${systemRank}/${totalVars})`,
204
+ STYLES.bold,
205
+ `color: ${efficiency > 85 ? "#00b894" : "#d63031"}; font-size: 16px; font-weight: bold;`,
206
+ "color: #636e72; font-style: italic;"
207
+ );
208
+ if (clusters.length > 0) {
209
+ console.log(`%cDetected ${clusters.length} Redundancy Clusters:`, "font-weight: bold; color: #e17055; margin-top: 10px;");
210
+ clusters.forEach((cluster, idx) => {
211
+ const names = cluster.map((l) => parseLabel(l).name).join(" \u27F7 ");
212
+ console.log(` %c${idx + 1}%c ${names}`, "background: #e17055; color: white; border-radius: 50%; padding: 0 5px;", "font-family: monospace;");
213
+ });
214
+ } else {
215
+ console.log("%c\u2728 All state variables are linearly independent. Your Basis is optimal.", "color: #00b894; font-weight: bold; margin-top: 10px;");
216
+ }
217
+ if (totalVars > 0 && totalVars < 15) {
218
+ console.groupCollapsed("%cView Full Correlation Matrix", "color: #636e72; font-size: 11px;");
219
+ const matrix = {};
220
+ entries.forEach(([labelA]) => {
221
+ const nameA = parseLabel(labelA).name;
222
+ matrix[nameA] = {};
223
+ entries.forEach(([labelB]) => {
224
+ const nameB = parseLabel(labelB).name;
225
+ const sim = similarityFn(history2.get(labelA), history2.get(labelB));
226
+ matrix[nameA][nameB] = sim > threshold ? `\u274C ${(sim * 100).toFixed(0)}%` : `\u2705`;
227
+ });
228
+ });
229
+ console.table(matrix);
230
+ console.groupEnd();
231
+ } else {
232
+ console.log("%c[Note] Matrix hidden due to high dimensionality. Focus on clusters above.", "color: #636e72; font-size: 10px; font-style: italic;");
233
+ }
234
+ console.groupEnd();
235
+ };
236
+
237
+ // src/core/math.ts
238
+ var calculateCosineSimilarity = (A, B) => {
239
+ let dot = 0, magA = 0, magB = 0;
240
+ for (let i = 0; i < A.length; i++) {
241
+ dot += A[i] * B[i];
242
+ magA += A[i] * A[i];
243
+ magB += B[i] * B[i];
244
+ }
245
+ return magA && magB ? dot / (Math.sqrt(magA) * Math.sqrt(magB)) : 0;
246
+ };
247
+
248
+ // src/core/constants.ts
249
+ var WINDOW_SIZE = 50;
250
+ var SIMILARITY_THRESHOLD = 0.88;
251
+ var LOOP_THRESHOLD = 25;
252
+ var LOOP_WINDOW_MS = 500;
253
+ var ANALYSIS_INTERVAL = 5;
254
+
255
+ // src/engine.ts
256
+ var history = /* @__PURE__ */ new Map();
257
+ var currentTickBatch = /* @__PURE__ */ new Set();
258
+ var updateLog = [];
259
+ var currentEffectSource = null;
260
+ var tick = 0;
261
+ var isBatching = false;
262
+ displayBootLog(WINDOW_SIZE);
263
+ var analyzeBasis = () => {
264
+ const entries = Array.from(history.entries());
265
+ if (entries.length < 2) return;
266
+ entries.forEach(([labelA, vecA], i) => {
267
+ entries.slice(i + 1).forEach(([labelB, vecB]) => {
268
+ const sim = calculateCosineSimilarity(vecA, vecB);
269
+ if (sim > SIMILARITY_THRESHOLD) {
270
+ displayRedundancyAlert(labelA, labelB, sim, history.size);
271
+ }
272
+ });
273
+ });
274
+ };
275
+ var printBasisHealthReport = (threshold = 0.5) => {
276
+ displayHealthReport(history, calculateCosineSimilarity, threshold);
277
+ };
278
+ var beginEffectTracking = (label) => {
279
+ currentEffectSource = label;
280
+ };
281
+ var endEffectTracking = () => {
282
+ currentEffectSource = null;
283
+ };
284
+ var registerVariable = (label) => {
285
+ if (!history.has(label)) {
286
+ history.set(label, new Array(WINDOW_SIZE).fill(0));
287
+ }
288
+ };
289
+ var unregisterVariable = (label) => {
290
+ history.delete(label);
291
+ };
292
+ var recordUpdate = (label) => {
293
+ const now = Date.now();
294
+ updateLog.push({ label, ts: now });
295
+ updateLog = updateLog.filter((e) => now - e.ts < LOOP_WINDOW_MS);
296
+ if (updateLog.filter((e) => e.label === label).length > LOOP_THRESHOLD) {
297
+ displayInfiniteLoop(label);
298
+ return false;
299
+ }
300
+ if (currentEffectSource && currentEffectSource !== label) {
301
+ displayCausalHint(label, currentEffectSource);
302
+ }
303
+ currentTickBatch.add(label);
304
+ if (!isBatching) {
305
+ isBatching = true;
306
+ setTimeout(() => {
307
+ tick++;
308
+ history.forEach((vec, l) => {
309
+ vec.shift();
310
+ vec.push(currentTickBatch.has(l) ? 1 : 0);
311
+ });
312
+ currentTickBatch.clear();
313
+ isBatching = false;
314
+ if (tick % ANALYSIS_INTERVAL === 0) {
315
+ analyzeBasis();
316
+ }
317
+ }, 20);
318
+ }
319
+ return true;
320
+ };
321
+ if (typeof window !== "undefined") {
322
+ window.printBasisReport = printBasisHealthReport;
323
+ }
324
+ var __testEngine__ = {
325
+ history,
326
+ currentTickBatch,
327
+ registerVariable,
328
+ recordUpdate,
329
+ printBasisHealthReport,
330
+ beginEffectTracking,
331
+ endEffectTracking
332
+ };
333
+
334
+ // src/hooks.ts
335
+ var import_react = require("react");
336
+ function useState(initialValue, label) {
337
+ const [val, setVal] = (0, import_react.useState)(initialValue);
338
+ const effectiveLabel = label || "anonymous_state";
339
+ (0, import_react.useEffect)(() => {
340
+ registerVariable(effectiveLabel);
341
+ return () => unregisterVariable(effectiveLabel);
342
+ }, [effectiveLabel]);
343
+ const setter = (0, import_react.useCallback)((newValue) => {
344
+ if (recordUpdate(effectiveLabel)) {
345
+ setVal(newValue);
346
+ }
347
+ }, [effectiveLabel]);
348
+ return [val, setter];
349
+ }
350
+ function useMemo(factory, deps, label) {
351
+ const effectiveLabel = label || "anonymous_projection";
352
+ (0, import_react.useEffect)(() => {
353
+ if (window._basis_debug !== false) {
354
+ console.log(`%c [Basis] Valid Projection: "${effectiveLabel}" `, "color: #2ecc71; font-weight: bold;");
355
+ }
356
+ }, [effectiveLabel]);
357
+ return (0, import_react.useMemo)(factory, deps || []);
358
+ }
359
+ function useEffect(effect, deps, label) {
360
+ const effectiveLabel = label || "anonymous_effect";
361
+ (0, import_react.useEffect)(() => {
362
+ beginEffectTracking(effectiveLabel);
363
+ const cleanup = effect();
364
+ endEffectTracking();
365
+ return cleanup;
366
+ }, deps);
367
+ }
368
+ function useReducer(reducer, initialArg, init, label) {
369
+ const effectiveLabel = typeof init === "string" ? init : label || "anonymous_reducer";
370
+ const reactInit = typeof init === "function" ? init : void 0;
371
+ const [state, dispatch] = (0, import_react.useReducer)(reducer, initialArg, reactInit);
372
+ (0, import_react.useEffect)(() => {
373
+ registerVariable(effectiveLabel);
374
+ return () => unregisterVariable(effectiveLabel);
375
+ }, [effectiveLabel]);
376
+ const basisDispatch = (0, import_react.useCallback)((action) => {
377
+ if (recordUpdate(effectiveLabel)) {
378
+ dispatch(action);
379
+ }
380
+ }, [effectiveLabel]);
381
+ return [state, basisDispatch];
382
+ }
383
+ function createContext(defaultValue, label) {
384
+ const context = (0, import_react.createContext)(defaultValue);
385
+ if (label) {
386
+ context._basis_label = label;
387
+ }
388
+ return context;
389
+ }
390
+ function useContext(context) {
391
+ return (0, import_react.useContext)(context);
392
+ }
393
+ var __test__ = {
394
+ registerVariable,
395
+ unregisterVariable,
396
+ recordUpdate,
397
+ beginEffectTracking,
398
+ endEffectTracking,
399
+ history,
400
+ currentTickBatch
401
+ };
402
+
403
+ // src/context.tsx
404
+ var import_react2 = require("react");
405
+ var import_jsx_runtime = require("react/jsx-runtime");
406
+ var BasisContext = (0, import_react2.createContext)({ debug: false });
407
+ var BasisProvider = ({ children, debug = true }) => {
408
+ if (typeof window !== "undefined") {
409
+ window._basis_debug = debug;
410
+ }
411
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(BasisContext.Provider, { value: { debug }, children: [
412
+ children,
413
+ debug && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: {
414
+ position: "fixed",
415
+ bottom: 10,
416
+ right: 10,
417
+ background: "black",
418
+ color: "#0f0",
419
+ padding: "5px 10px",
420
+ fontSize: "10px",
421
+ fontFamily: "monospace",
422
+ border: "1px solid #0f0",
423
+ zIndex: 99999,
424
+ borderRadius: "4px",
425
+ pointerEvents: "none"
426
+ }, children: "BASIS_ENGINE: ACTIVE" })
427
+ ] });
428
+ };
429
+ var useBasisConfig = () => (0, import_react2.useContext)(BasisContext);
430
+ // Annotate the CommonJS export names for ESM import in node:
431
+ 0 && (module.exports = {
432
+ BasisProvider,
433
+ __testEngine__,
434
+ __test__,
435
+ beginEffectTracking,
436
+ createContext,
437
+ currentTickBatch,
438
+ endEffectTracking,
439
+ history,
440
+ printBasisHealthReport,
441
+ recordUpdate,
442
+ registerVariable,
443
+ unregisterVariable,
444
+ useBasisConfig,
445
+ useContext,
446
+ useEffect,
447
+ useMemo,
448
+ useReducer,
449
+ useState
450
+ });
451
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/core/logger.ts","../src/core/math.ts","../src/core/constants.ts","../src/engine.ts","../src/hooks.ts","../src/context.tsx"],"sourcesContent":["// src/index.ts\n\nexport * from './engine';\nexport * from './hooks';\nexport * from './context';\nexport type { \n ReactNode, \n ReactElement, \n FC, \n PropsWithChildren, \n Context,\n Dispatch,\n SetStateAction,\n Reducer,\n CSSProperties\n} from 'react';","// src/core/logger.ts\n\nconst STYLES = {\n // Brand Colors\n basis: \"background: #6c5ce7; color: white; font-weight: bold; padding: 2px 6px; border-radius: 3px;\",\n version: \"background: #a29bfe; color: #2d3436; padding: 2px 6px; border-radius: 3px; margin-left: -4px;\",\n\n // Headers\n headerRed: \"background: #d63031; color: white; font-weight: bold; padding: 4px 8px; border-radius: 4px;\",\n headerBlue: \"background: #0984e3; color: white; font-weight: bold; padding: 4px 8px; border-radius: 4px;\",\n headerGreen: \"background: #00b894; color: white; font-weight: bold; padding: 4px 8px; border-radius: 4px;\",\n\n // Elements\n label: \"background: #dfe6e9; color: #2d3436; padding: 0 4px; border-radius: 3px; font-family: monospace; font-weight: bold; border: 1px solid #b2bec3;\",\n location: \"color: #0984e3; font-family: monospace; font-weight: bold;\",\n math: \"color: #636e72; font-style: italic; font-family: serif;\",\n\n // Code Block\n codeBlock: `\n background: #1e1e1e; \n color: #9cdcfe; \n padding: 8px 12px; \n display: block; \n margin: 4px 0; \n border-left: 3px solid #00b894; \n font-family: 'Fira Code', monospace; \n line-height: 1.4; \n border-radius: 0 3px 3px 0;\n `,\n\n // Highlights\n dim: \"color: #e84393; font-weight: bold;\",\n bold: \"font-weight: bold;\"\n};\n\nconst parseLabel = (label: string) => {\n const parts = label.split(' -> ');\n return {\n file: parts[0] || \"Unknown\",\n name: parts[1] || label\n };\n};\n\nexport const displayBootLog = (windowSize: number) => {\n console.log(\n `%cBasis%cAuditor v0.1.0%c Monitoring State Space | Window: ${windowSize} ticks`,\n STYLES.basis,\n STYLES.version,\n \"color: #636e72; font-style: italic; margin-left: 8px;\"\n );\n};\n\nexport const displayRedundancyAlert = (labelA: string, labelB: string, sim: number, totalDimensions: number) => {\n const infoA = parseLabel(labelA);\n const infoB = parseLabel(labelB);\n const isCrossFile = infoA.file !== infoB.file;\n\n console.group(`%c šŸ“ BASIS | DIMENSION COLLAPSE DETECTED `, STYLES.headerRed);\n\n console.log(`%cšŸ“ Location: %c${isCrossFile ? `${infoA.file} & ${infoB.file}` : infoA.file}`, STYLES.bold, STYLES.location);\n\n console.log(\n `%cAnalysis:%c Vectors %c${infoA.name}%c and %c${infoB.name}%c are collinear (redundant).`,\n STYLES.bold, \"\", STYLES.label, \"\", STYLES.label, \"\"\n );\n\n console.log(\n `%cHow to fix:%c Project %c${infoB.name}%c as a derived value:\n%c// šŸ› ļø Basis Fix: Remove useState, use useMemo\nconst ${infoB.name} = useMemo(() => deriveFrom(${infoA.name}), [${infoA.name}]);%c`,\n \"color: #00b894; font-weight: bold;\", \"\",\n \"color: #e84393; font-weight: bold;\", \"\",\n STYLES.codeBlock, \"\"\n );\n\n console.groupCollapsed(`%c šŸ”¬ Proof Details `, \"color: #636e72; font-size: 10px; cursor: pointer;\");\n console.table({\n \"Similarity\": `${(sim * 100).toFixed(2)}%`,\n \"Linear Dependency\": \"TRUE\",\n \"Rank\": totalDimensions - 1\n });\n console.groupEnd();\n console.groupEnd();\n};\n\nexport const displayCausalHint = (targetLabel: string, sourceLabel: string) => {\n const target = parseLabel(targetLabel);\n const source = parseLabel(sourceLabel);\n\n const isCrossFile = target.file !== source.file;\n const locationPath = isCrossFile\n ? `${source.file} āž” ${target.file}`\n : target.file;\n\n console.groupCollapsed(`%c šŸ’” BASIS | CAUSALITY (Sequential Update) `, STYLES.headerBlue);\n\n console.log(`%cšŸ“ Location: %c${locationPath}`, STYLES.bold, STYLES.location);\n\n console.log(\n `%cSequence:%c %c${source.name}%c āž” Effect āž” %c${target.name}%c`,\n STYLES.bold, \"\",\n STYLES.label, \"\",\n STYLES.label, \"\"\n );\n\n console.log(\n `%cObservation:%c Variable %c${target.name}%c is being manually synchronized.\nThis creates a %c\"Double Render Cycle\"%c.`,\n STYLES.bold, \"\", STYLES.label, \"\",\n \"color: #d63031; font-weight: bold;\", \"\"\n );\n\n console.log(\n `%cHow to fix:%c Use %cuseMemo%c to calculate %c${target.name}%c during render:\n%cconst ${target.name} = useMemo(() => computeFrom(${source.name.includes('effect') ? 'source' : source.name}), [${source.name.includes('effect') ? 'source' : source.name}]);%c`,\n \"color: #00b894; font-weight: bold;\", \"\",\n \"color: #0984e3; font-weight: bold;\", \"\",\n \"color: #e84393; font-weight: bold;\", \"\",\n STYLES.codeBlock, \"\"\n );\n\n console.groupEnd();\n};\n\nexport const displayInfiniteLoop = (label: string) => {\n const info = parseLabel(label);\n console.group(`%c šŸ›‘ BASIS CRITICAL | CIRCUIT BREAKER `, STYLES.headerRed);\n console.error(\n `Infinite oscillation detected on: %c${info.name}%c\nExecution halted to prevent browser thread lock. Check your dependency arrays.`,\n \"color: white; background: #d63031; padding: 2px 4px; border-radius: 3px;\", \"\"\n );\n console.groupEnd();\n};\n\nexport const displayHealthReport = (\n history: Map<string, number[]>,\n similarityFn: (A: number[], B: number[]) => number,\n threshold: number\n) => {\n const entries = Array.from(history.entries());\n const totalVars = entries.length;\n if (totalVars === 0) return;\n\n const clusters: string[][] = [];\n const processed = new Set<string>();\n let independentCount = 0;\n\n entries.forEach(([labelA, vecA]) => {\n if (processed.has(labelA)) return;\n\n const currentCluster = [labelA];\n processed.add(labelA);\n\n entries.forEach(([labelB, vecB]) => {\n if (labelA === labelB || processed.has(labelB)) return;\n\n const sim = similarityFn(vecA, vecB);\n if (sim > threshold) {\n currentCluster.push(labelB);\n processed.add(labelB);\n }\n });\n\n if (currentCluster.length > 1) {\n clusters.push(currentCluster);\n } else {\n independentCount++;\n }\n });\n\n const systemRank = independentCount + clusters.length;\n const efficiency = (systemRank / totalVars) * 100;\n\n console.group(`%c šŸ“Š BASIS | SYSTEM HEALTH REPORT `, STYLES.headerGreen);\n\n console.log(\n `%cBasis Efficiency: %c${efficiency.toFixed(1)}% %c(Rank: ${systemRank}/${totalVars})`,\n STYLES.bold,\n `color: ${efficiency > 85 ? '#00b894' : '#d63031'}; font-size: 16px; font-weight: bold;`,\n \"color: #636e72; font-style: italic;\"\n );\n\n if (clusters.length > 0) {\n console.log(`%cDetected ${clusters.length} Redundancy Clusters:`, \"font-weight: bold; color: #e17055; margin-top: 10px;\");\n\n clusters.forEach((cluster, idx) => {\n const names = cluster.map(l => parseLabel(l).name).join(' ⟷ ');\n console.log(` %c${idx + 1}%c ${names}`, \"background: #e17055; color: white; border-radius: 50%; padding: 0 5px;\", \"font-family: monospace;\");\n });\n } else {\n console.log(\"%c✨ All state variables are linearly independent. Your Basis is optimal.\", \"color: #00b894; font-weight: bold; margin-top: 10px;\");\n }\n\n if (totalVars > 0 && totalVars < 15) {\n console.groupCollapsed(\"%cView Full Correlation Matrix\", \"color: #636e72; font-size: 11px;\");\n const matrix: any = {};\n entries.forEach(([labelA]) => {\n const nameA = parseLabel(labelA).name;\n matrix[nameA] = {};\n entries.forEach(([labelB]) => {\n const nameB = parseLabel(labelB).name;\n const sim = similarityFn(history.get(labelA)!, history.get(labelB)!);\n matrix[nameA][nameB] = sim > threshold ? `āŒ ${(sim * 100).toFixed(0)}%` : `āœ…`;\n });\n });\n console.table(matrix);\n console.groupEnd();\n } else {\n console.log(\"%c[Note] Matrix hidden due to high dimensionality. Focus on clusters above.\", \"color: #636e72; font-size: 10px; font-style: italic;\");\n }\n\n console.groupEnd();\n};","// src/core/math.ts\n\nexport const calculateCosineSimilarity = (A: number[], B: number[]): number => {\n let dot = 0, magA = 0, magB = 0;\n for (let i = 0; i < A.length; i++) {\n dot += A[i] * B[i];\n magA += A[i] * A[i];\n magB += B[i] * B[i];\n }\n return magA && magB ? dot / (Math.sqrt(magA) * Math.sqrt(magB)) : 0;\n};","// src/core/constants.ts\n\nexport const WINDOW_SIZE = 50;\nexport const SIMILARITY_THRESHOLD = 0.88;\nexport const LOOP_THRESHOLD = 25;\nexport const LOOP_WINDOW_MS = 500;\nexport const ANALYSIS_INTERVAL = 5;","// src/engine.ts\n\nimport * as UI from './core/logger';\nimport { calculateCosineSimilarity } from './core/math';\nimport { \n WINDOW_SIZE, \n SIMILARITY_THRESHOLD, \n LOOP_THRESHOLD, \n LOOP_WINDOW_MS, \n ANALYSIS_INTERVAL \n} from './core/constants';\n\nexport const history = new Map<string, number[]>();\nexport const currentTickBatch = new Set<string>();\nlet updateLog: { label: string; ts: number }[] = [];\nlet currentEffectSource: string | null = null; \nlet tick = 0;\nlet isBatching = false;\n\nUI.displayBootLog(WINDOW_SIZE);\n\nconst analyzeBasis = () => {\n const entries = Array.from(history.entries());\n if (entries.length < 2) return;\n\n entries.forEach(([labelA, vecA], i) => {\n entries.slice(i + 1).forEach(([labelB, vecB]) => {\n const sim = calculateCosineSimilarity(vecA, vecB);\n \n if (sim > SIMILARITY_THRESHOLD) {\n UI.displayRedundancyAlert(labelA, labelB, sim, history.size);\n }\n });\n });\n};\n\nexport const printBasisHealthReport = (threshold = 0.5) => {\n UI.displayHealthReport(history, calculateCosineSimilarity, threshold);\n};\n\nexport const beginEffectTracking = (label: string) => { currentEffectSource = label; };\nexport const endEffectTracking = () => { currentEffectSource = null; };\n\nexport const registerVariable = (label: string) => {\n if (!history.has(label)) {\n history.set(label, new Array(WINDOW_SIZE).fill(0));\n }\n};\n\nexport const unregisterVariable = (label: string) => {\n history.delete(label);\n};\n\nexport const recordUpdate = (label: string): boolean => {\n const now = Date.now();\n\n updateLog.push({ label, ts: now });\n updateLog = updateLog.filter(e => now - e.ts < LOOP_WINDOW_MS);\n if (updateLog.filter(e => e.label === label).length > LOOP_THRESHOLD) {\n UI.displayInfiniteLoop(label);\n return false;\n }\n\n if (currentEffectSource && currentEffectSource !== label) {\n UI.displayCausalHint(label, currentEffectSource);\n }\n\n currentTickBatch.add(label);\n\n if (!isBatching) {\n isBatching = true;\n setTimeout(() => {\n tick++;\n history.forEach((vec, l) => {\n vec.shift();\n vec.push(currentTickBatch.has(l) ? 1 : 0);\n });\n\n currentTickBatch.clear();\n isBatching = false;\n \n if (tick % ANALYSIS_INTERVAL === 0) {\n analyzeBasis();\n }\n }, 20);\n }\n\n return true;\n};\n\nif (typeof window !== 'undefined') {\n (window as any).printBasisReport = printBasisHealthReport;\n}\n\nexport const __testEngine__ = {\n history,\n currentTickBatch,\n registerVariable,\n recordUpdate,\n printBasisHealthReport,\n beginEffectTracking,\n endEffectTracking,\n};","// src/hooks.ts\n\nimport { \n useState as reactUseState, \n useEffect as reactUseEffect, \n useMemo as reactUseMemo, \n useReducer as reactUseReducer,\n useContext as reactUseContext,\n createContext as reactCreateContext,\n useCallback \n} from 'react';\n\nimport type { \n Reducer, \n Context,\n Dispatch,\n SetStateAction,\n DependencyList,\n EffectCallback\n} from 'react';\n\nimport { \n registerVariable, \n unregisterVariable, \n recordUpdate, \n beginEffectTracking, \n endEffectTracking \n} from './engine';\n\nimport * as engine from './engine';\n\nexport type { \n ReactNode, \n FC, \n PropsWithChildren, \n Context, \n ReactElement,\n Dispatch,\n SetStateAction,\n Reducer,\n CSSProperties,\n EffectCallback,\n DependencyList\n} from 'react';\n\nexport function useState<T>(initialValue: T, label?: string): [T, Dispatch<SetStateAction<T>>] {\n const [val, setVal] = reactUseState(initialValue);\n const effectiveLabel = label || 'anonymous_state';\n\n reactUseEffect(() => {\n registerVariable(effectiveLabel);\n return () => unregisterVariable(effectiveLabel);\n }, [effectiveLabel]);\n\n const setter = useCallback((newValue: SetStateAction<T>) => {\n if (recordUpdate(effectiveLabel)) {\n setVal(newValue);\n }\n }, [effectiveLabel]);\n\n return [val, setter];\n}\n\nexport function useMemo<T>(factory: () => T, deps: DependencyList | undefined, label?: string): T {\n const effectiveLabel = label || 'anonymous_projection';\n \n reactUseEffect(() => {\n if ((window as any)._basis_debug !== false) {\n console.log(`%c [Basis] Valid Projection: \"${effectiveLabel}\" `, \"color: #2ecc71; font-weight: bold;\");\n }\n }, [effectiveLabel]);\n\n return reactUseMemo(factory, deps || []);\n}\n\nexport function useEffect(effect: EffectCallback, deps?: DependencyList, label?: string) {\n const effectiveLabel = label || 'anonymous_effect';\n\n reactUseEffect(() => {\n beginEffectTracking(effectiveLabel);\n const cleanup = effect();\n endEffectTracking();\n return cleanup;\n }, deps);\n}\n\nexport function useReducer<S, A, I>(\n reducer: Reducer<S, A>,\n initialArg: I & S,\n init?: any,\n label?: string\n): [S, Dispatch<A>] {\n\n const effectiveLabel = typeof init === 'string' ? init : (label || 'anonymous_reducer');\n\n const reactInit = typeof init === 'function' ? init : undefined;\n\n const [state, dispatch] = reactUseReducer(reducer, initialArg, reactInit);\n\n reactUseEffect(() => {\n registerVariable(effectiveLabel);\n return () => unregisterVariable(effectiveLabel);\n }, [effectiveLabel]);\n\n const basisDispatch = useCallback((action: A) => {\n if (recordUpdate(effectiveLabel)) {\n dispatch(action);\n }\n }, [effectiveLabel]);\n\n return [state, basisDispatch];\n}\n\nexport function createContext<T>(defaultValue: T, label?: string): Context<T> {\n const context = reactCreateContext(defaultValue);\n if (label) {\n (context as any)._basis_label = label;\n }\n return context;\n}\n\nexport function useContext<T>(context: Context<T>): T {\n return reactUseContext(context);\n}\n\nexport const __test__ = {\n registerVariable,\n unregisterVariable,\n recordUpdate,\n beginEffectTracking,\n endEffectTracking,\n history: (engine as any).history,\n currentTickBatch: (engine as any).currentTickBatch\n};","// src/context.tsx\n\nimport React, { createContext, useContext, ReactNode } from 'react';\n\nconst BasisContext = createContext({ debug: false });\n\ninterface BasisProviderProps {\n children: ReactNode;\n debug?: boolean;\n}\n\nexport const BasisProvider: React.FC<BasisProviderProps> = ({ children, debug = true }) => {\n if (typeof window !== 'undefined') {\n (window as any)._basis_debug = debug;\n }\n\n return (\n <BasisContext.Provider value={{ debug }}>\n {children}\n {debug && (\n <div style={{ \n position: 'fixed', bottom: 10, right: 10, background: 'black', color: '#0f0', \n padding: '5px 10px', fontSize: '10px', fontFamily: 'monospace', \n border: '1px solid #0f0', zIndex: 99999, borderRadius: '4px', pointerEvents: 'none'\n }}>\n BASIS_ENGINE: ACTIVE\n </div>\n )}\n </BasisContext.Provider>\n );\n};\n\nexport const useBasisConfig = () => useContext(BasisContext);"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,SAAS;AAAA;AAAA,EAEb,OAAO;AAAA,EACP,SAAS;AAAA;AAAA,EAGT,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA;AAAA,EAGb,OAAO;AAAA,EACP,UAAU;AAAA,EACV,MAAM;AAAA;AAAA,EAGN,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaX,KAAK;AAAA,EACL,MAAM;AACR;AAEA,IAAM,aAAa,CAAC,UAAkB;AACpC,QAAM,QAAQ,MAAM,MAAM,MAAM;AAChC,SAAO;AAAA,IACL,MAAM,MAAM,CAAC,KAAK;AAAA,IAClB,MAAM,MAAM,CAAC,KAAK;AAAA,EACpB;AACF;AAEO,IAAM,iBAAiB,CAAC,e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AAA,MAAS,OAAO;AAAA,MACtE,SAAS;AAAA,MAAY,UAAU;AAAA,MAAQ,YAAY;AAAA,MACnD,QAAQ;AAAA,MAAkB,QAAQ;AAAA,MAAO,cAAc;AAAA,MAAO,eAAe;AAAA,IAC/E,GAAG,kCAEH;AAAA,KAEJ;AAEJ;AAEO,IAAM,iBAAiB,UAAM,0BAAW,YAAY;","names":["history","reactUseState","reactUseEffect","reactUseMemo","reactUseReducer","reactCreateContext","reactUseContext","import_react"]}