insikt.js 1.0.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/README.md ADDED
@@ -0,0 +1,119 @@
1
+ # INSIKT
2
+ [![npm version](https://img.shields.io/npm/v/insikt.js.svg)](https://www.npmjs.com/package/insikt.js)
3
+ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/insikt.js)](https://bundlephobia.com/package/insikt.js)
4
+ [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
+ [![Deploy Pages](https://github.com/benneberg/insikt/actions/workflows/deploy-pages.yml/badge.svg)](https://github.com/benneberg/insikt/actions/workflows/deploy-pages.yml)
6
+
7
+
8
+ **A mobile-first, zero-dependency developer console for debugging directly inside the browser.**
9
+
10
+ Desktop DevTools are excellent. Mobile debugging is still painful. INSIKT provides a clean, elegant, mobile-first debugging experience directly inside the browser without requiring remote debugging setups or desktop tooling.
11
+
12
+ > 🌐 **Live Demo & Documentation**: [benneberg.github.io/insikt](https://benneberg.github.io/insikt/)
13
+
14
+
15
+ ---
16
+ # Features
17
+ - Mobile-first debugging UI
18
+ - Console log capture
19
+ - Runtime error tracking
20
+ - Fetch/XHR interception
21
+ - Storage inspection
22
+ - Built-in REPL
23
+ - Floating overlay interface
24
+ - Bookmarklet support
25
+ - CDN delivery
26
+ - NPM package
27
+ - Zero dependencies
28
+ ---
29
+ # Why INSIKT?
30
+ Desktop DevTools are excellent.
31
+ Mobile debugging is still painful.
32
+ INSIKT was built to provide a clean, elegant, mobile-first debugging experience directly inside the browser without requiring remote debugging setups or desktop tooling.
33
+ The project focuses on:
34
+ - simplicity
35
+ - speed
36
+ - visibility
37
+ - minimalism
38
+ - developer ergonomics
39
+ ---
40
+ # Installation
41
+ ## NPM
42
+ ```bash
43
+ npm install insikt.js
44
+ ```
45
+ ```js
46
+ import 'insikt.js';
47
+ ```
48
+ ---
49
+ ## CDN
50
+ ```html
51
+ <script src="https://cdn.jsdelivr.net/npm/insikt.js/dist/insikt.umd.js"></script>
52
+ ```
53
+ ---
54
+ ## Bookmarklet
55
+ Create a bookmark with this URL:
56
+ ```javascript
57
+ javascript:(function(){
58
+ const s=document.createElement('script');
59
+ s.src='https://cdn.jsdelivr.net/npm/insikt.js/dist/insikt.umd.js';
60
+ document.body.appendChild(s);
61
+ })();
62
+ ```
63
+ ---
64
+ # Usage
65
+ INSIKT auto-initializes when loaded.
66
+ Global API:
67
+ ```js
68
+ window.insikt.toggle();
69
+ window.insikt.clear();
70
+ window.insikt.destroy();
71
+ window.insikt.init();
72
+ ```
73
+ ---
74
+ # Screenshots
75
+ ## Floating Action Button
76
+ (Add screenshot)
77
+ ## Console Overlay
78
+ (Add screenshot)
79
+ ## Network Inspector
80
+ (Add screenshot)
81
+ ---
82
+ # Architecture
83
+ INSIKT uses:
84
+ - console proxying
85
+ - fetch/XHR interception
86
+ - runtime error listeners
87
+ - overlay-based UI rendering
88
+ - centralized runtime state
89
+ - automatic cleanup lifecycle
90
+ The library is designed to remain lightweight and dependency-free.
91
+ ---
92
+ # Roadmap
93
+ - [ ] console.table support
94
+ - [ ] IndexedDB viewer
95
+ - [ ] WebSocket inspector
96
+ - [ ] Performance timeline
97
+ - [ ] Plugin API
98
+ - [ ] Theme system
99
+ - [ ] Session export/import
100
+ ---
101
+ # Browser Support
102
+ - Safari iOS
103
+ - Chrome Android
104
+ - Samsung Internet
105
+ - Chromium desktop browsers
106
+ ---
107
+ # Development
108
+ ```bash
109
+ npm install
110
+ npm run dev
111
+ ```
112
+ Build production bundle:
113
+ ```bash
114
+ npm run build
115
+ ```
116
+ ---
117
+ # License
118
+ MIT
119
+
@@ -0,0 +1,81 @@
1
+ const VERSION = "1.0.0";
2
+ const state = {
3
+ initialized: false,
4
+ panelVisible: false,
5
+ logs: [],
6
+ requests: [],
7
+ errors: [],
8
+ ui: {
9
+ root: null
10
+ }
11
+ };
12
+ function initInsikt(options = {}) {
13
+ if (state.initialized) return;
14
+ state.initialized = true;
15
+ createUI();
16
+ attachConsoleProxy();
17
+ attachGlobalErrorHandler();
18
+ console.log(`[INSIKT v${VERSION}] initialized`);
19
+ }
20
+ function destroyInsikt() {
21
+ removeUI();
22
+ state.initialized = false;
23
+ console.log("[INSIKT] destroyed");
24
+ }
25
+ function toggleInsikt() {
26
+ state.panelVisible = !state.panelVisible;
27
+ }
28
+ function clearLogs() {
29
+ state.logs = [];
30
+ state.requests = [];
31
+ state.errors = [];
32
+ }
33
+ function createUI() {
34
+ state.ui.root = document.createElement("div");
35
+ state.ui.root.id = "insikt-root";
36
+ document.body.appendChild(state.ui.root);
37
+ }
38
+ function removeUI() {
39
+ if (state.ui.root) {
40
+ state.ui.root.remove();
41
+ state.ui.root = null;
42
+ }
43
+ }
44
+ function attachConsoleProxy() {
45
+ const originalLog = console.log;
46
+ console.log = (...args) => {
47
+ state.logs.push({ type: "log", args, timestamp: Date.now() });
48
+ originalLog.apply(console, args);
49
+ };
50
+ }
51
+ function attachGlobalErrorHandler() {
52
+ window.addEventListener("error", (event) => {
53
+ state.errors.push({ error: event.error, timestamp: Date.now() });
54
+ });
55
+ }
56
+ const insiktAPI = {
57
+ version: VERSION,
58
+ init: initInsikt,
59
+ destroy: destroyInsikt,
60
+ toggle: toggleInsikt,
61
+ clear: clearLogs
62
+ };
63
+ if (typeof window !== "undefined") {
64
+ window.insikt = insiktAPI;
65
+ if (!window.__INSIKT_INITIALIZED__) {
66
+ window.__INSIKT_INITIALIZED__ = true;
67
+ if (document.readyState === "loading") {
68
+ document.addEventListener("DOMContentLoaded", initInsikt);
69
+ } else {
70
+ initInsikt();
71
+ }
72
+ }
73
+ }
74
+ export {
75
+ clearLogs,
76
+ insiktAPI as default,
77
+ destroyInsikt,
78
+ initInsikt,
79
+ toggleInsikt
80
+ };
81
+ //# sourceMappingURL=insikt.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insikt.es.js","sources":["../src/index.js"],"sourcesContent":["const VERSION = '1.0.0';\n\nconst state = {\n initialized: false,\n panelVisible: false,\n logs: [],\n requests: [],\n errors: [],\n ui: {\n root: null,\n panel: null,\n fab: null\n }\n};\n\nfunction initInsikt(options = {}) {\n if (state.initialized) return;\n state.initialized = true;\n \n createUI();\n attachConsoleProxy();\n attachGlobalErrorHandler();\n \n console.log(`[INSIKT v${VERSION}] initialized`);\n}\n\nfunction destroyInsikt() {\n removeUI();\n state.initialized = false;\n console.log('[INSIKT] destroyed');\n}\n\nfunction toggleInsikt() {\n state.panelVisible = !state.panelVisible;\n if (state.ui.panel) {\n state.ui.panel.style.display = state.panelVisible ? 'block' : 'none';\n }\n}\n\nfunction clearLogs() {\n state.logs = [];\n state.requests = [];\n state.errors = [];\n // TODO: Add UI clear logic here\n}\n\nfunction createUI() {\n // TODO: Build elegant, minimalist overlay UI\n state.ui.root = document.createElement('div');\n state.ui.root.id = 'insikt-root';\n document.body.appendChild(state.ui.root);\n}\n\nfunction removeUI() {\n if (state.ui.root) {\n state.ui.root.remove();\n state.ui.root = null;\n }\n}\n\nfunction attachConsoleProxy() {\n const originalLog = console.log;\n console.log = (...args) => {\n state.logs.push({ type: 'log', args, timestamp: Date.now() });\n originalLog.apply(console, args);\n };\n}\n\nfunction attachGlobalErrorHandler() {\n window.addEventListener('error', (event) => {\n state.errors.push({ error: event.error, timestamp: Date.now() });\n });\n}\n\n// Public API\nconst insiktAPI = {\n version: VERSION,\n init: initInsikt,\n destroy: destroyInsikt,\n toggle: toggleInsikt,\n clear: clearLogs\n};\n\n// Auto-initialize in browser environments\nif (typeof window !== 'undefined') {\n window.insikt = insiktAPI;\n if (!window.__INSIKT_INITIALIZED__) {\n window.__INSIKT_INITIALIZED__ = true;\n // Defer initialization to ensure DOM is ready\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', initInsikt);\n } else {\n initInsikt();\n }\n }\n}\n\nexport { initInsikt, destroyInsikt, toggleInsikt, clearLogs };\nexport default insiktAPI;\n"],"names":[],"mappings":"AAAA,MAAM,UAAU;AAEhB,MAAM,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N,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,OAAO;AACT;AAGA,IAAI,OAAO,WAAW,aAAa;AACjC,SAAO,SAAS;AAChB,MAAI,CAAC,OAAO,wBAAwB;AAClC,WAAO,yBAAyB;AAEhC,QAAI,SAAS,eAAe,WAAW;AACrC,eAAS,iBAAiB,oBAAoB,UAAU;AAAA,IAC1D,OAAO;AACL,iBAAU;AAAA,IACZ;AAAA,EACF;AACF;"}
@@ -0,0 +1,2 @@
1
+ !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).insikt={})}(this,function(e){"use strict";const o="1.0.0",i={initialized:!1,panelVisible:!1,logs:[],requests:[],errors:[],ui:{root:null}};function t(e={}){i.initialized||(i.initialized=!0,i.ui.root=document.createElement("div"),i.ui.root.id="insikt-root",document.body.appendChild(i.ui.root),function(){const e=console.log;console.log=(...o)=>{i.logs.push({type:"log",args:o,timestamp:Date.now()}),e.apply(console,o)}}(),window.addEventListener("error",e=>{i.errors.push({error:e.error,timestamp:Date.now()})}),console.log(`[INSIKT v${o}] initialized`))}function n(){i.ui.root&&(i.ui.root.remove(),i.ui.root=null),i.initialized=!1,console.log("[INSIKT] destroyed")}function s(){i.panelVisible=!i.panelVisible}function l(){i.logs=[],i.requests=[],i.errors=[]}const r={version:o,init:t,destroy:n,toggle:s,clear:l};"undefined"!=typeof window&&(window.insikt=r,window.__INSIKT_INITIALIZED__||(window.__INSIKT_INITIALIZED__=!0,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t())),e.clearLogs=l,e.default=r,e.destroyInsikt=n,e.initInsikt=t,e.toggleInsikt=s,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2
+ //# sourceMappingURL=insikt.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insikt.umd.js","sources":["../src/index.js"],"sourcesContent":["const VERSION = '1.0.0';\n\nconst state = {\n initialized: false,\n panelVisible: false,\n logs: [],\n requests: [],\n errors: [],\n ui: {\n root: null,\n panel: null,\n fab: null\n }\n};\n\nfunction initInsikt(options = {}) {\n if (state.initialized) return;\n state.initialized = true;\n \n createUI();\n attachConsoleProxy();\n attachGlobalErrorHandler();\n \n console.log(`[INSIKT v${VERSION}] initialized`);\n}\n\nfunction destroyInsikt() {\n removeUI();\n state.initialized = false;\n console.log('[INSIKT] destroyed');\n}\n\nfunction toggleInsikt() {\n state.panelVisible = !state.panelVisible;\n if (state.ui.panel) {\n state.ui.panel.style.display = state.panelVisible ? 'block' : 'none';\n }\n}\n\nfunction clearLogs() {\n state.logs = [];\n state.requests = [];\n state.errors = [];\n // TODO: Add UI clear logic here\n}\n\nfunction createUI() {\n // TODO: Build elegant, minimalist overlay UI\n state.ui.root = document.createElement('div');\n state.ui.root.id = 'insikt-root';\n document.body.appendChild(state.ui.root);\n}\n\nfunction removeUI() {\n if (state.ui.root) {\n state.ui.root.remove();\n state.ui.root = null;\n }\n}\n\nfunction attachConsoleProxy() {\n const originalLog = console.log;\n console.log = (...args) => {\n state.logs.push({ type: 'log', args, timestamp: Date.now() });\n originalLog.apply(console, args);\n };\n}\n\nfunction attachGlobalErrorHandler() {\n window.addEventListener('error', (event) => {\n state.errors.push({ error: event.error, timestamp: Date.now() });\n });\n}\n\n// Public API\nconst insiktAPI = {\n version: VERSION,\n init: initInsikt,\n destroy: destroyInsikt,\n toggle: toggleInsikt,\n clear: clearLogs\n};\n\n// Auto-initialize in browser environments\nif (typeof window !== 'undefined') {\n window.insikt = insiktAPI;\n if (!window.__INSIKT_INITIALIZED__) {\n window.__INSIKT_INITIALIZED__ = true;\n // Defer initialization to ensure DOM is ready\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', initInsikt);\n } else {\n initInsikt();\n }\n }\n}\n\nexport { initInsikt, destroyInsikt, toggleInsikt, clearLogs };\nexport default insiktAPI;\n"],"names":["VERSION","state","initialized","panelVisible","logs","requests","errors","ui","root","initInsikt","options","document","createElement","id","body","appendChild","originalLog","console","log","args","push","type","timestamp","Date","now","apply","attachConsoleProxy","window","addEventListener","event","error","destroyInsikt","remove","toggleInsikt","clearLogs","insiktAPI","version","init","destroy","toggle","clear","insikt","__INSIKT_INITIALIZED__","readyState"],"mappings":"6OAAA,MAAMA,EAAU,QAEVC,EAAQ,CACZC,aAAa,EACbC,cAAc,EACdC,KAAM,GACNC,SAAU,GACVC,OAAQ,GACRC,GAAI,CACFC,KAAM,OAMV,SAASC,EAAWC,EAAU,IACxBT,EAAMC,cACVD,EAAMC,aAAc,EA+BpBD,EAAMM,GAAGC,KAAOG,SAASC,cAAc,OACvCX,EAAMM,GAAGC,KAAKK,GAAK,cACnBF,SAASG,KAAKC,YAAYd,EAAMM,GAAGC,MAUrC,WACE,MAAMQ,EAAcC,QAAQC,IAC5BD,QAAQC,IAAM,IAAIC,KAChBlB,EAAMG,KAAKgB,KAAK,CAAEC,KAAM,MAAOF,OAAMG,UAAWC,KAAKC,QACrDR,EAAYS,MAAMR,QAASE,GAE/B,CA9CEO,GAiDAC,OAAOC,iBAAiB,QAAUC,IAChC5B,EAAMK,OAAOc,KAAK,CAAEU,MAAOD,EAAMC,MAAOR,UAAWC,KAAKC,UA/C1DP,QAAQC,IAAI,YAAYlB,kBAC1B,CAEA,SAAS+B,IA4BH9B,EAAMM,GAAGC,OACXP,EAAMM,GAAGC,KAAKwB,SACd/B,EAAMM,GAAGC,KAAO,MA5BlBP,EAAMC,aAAc,EACpBe,QAAQC,IAAI,qBACd,CAEA,SAASe,IACPhC,EAAME,cAAgBF,EAAME,YAI9B,CAEA,SAAS+B,IACPjC,EAAMG,KAAO,GACbH,EAAMI,SAAW,GACjBJ,EAAMK,OAAS,EAEjB,CA+BK,MAAC6B,EAAY,CAChBC,QAASpC,EACTqC,KAAM5B,EACN6B,QAASP,EACTQ,OAAQN,EACRO,MAAON,GAIa,oBAAXP,SACTA,OAAOc,OAASN,EACXR,OAAOe,yBACVf,OAAOe,wBAAyB,EAEJ,YAAxB/B,SAASgC,WACXhC,SAASiB,iBAAiB,mBAAoBnB,GAE9CA"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "insikt.js",
3
+ "version": "1.0.0",
4
+ "description": "A mobile-first in-browser developer console and debugging overlay.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "main": "./dist/insikt.umd.js",
11
+ "module": "./dist/insikt.es.js",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/insikt.es.js",
15
+ "require": "./dist/insikt.umd.js"
16
+ }
17
+ },
18
+ "scripts": {
19
+ "dev": "vite",
20
+ "build": "vite build",
21
+ "preview": "vite preview"
22
+ },
23
+ "keywords": [
24
+ "mobile",
25
+ "console",
26
+ "debug",
27
+ "browser",
28
+ "devtools",
29
+ "overlay",
30
+ "javascript"
31
+ ],
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/benneberg/insikt.git"
35
+ },
36
+ "homepage": "https://benneberg.github.io/insikt/",
37
+ "bugs": {
38
+ "url": "https://github.com/benneberg/insikt/issues"
39
+ },
40
+ "devDependencies": {
41
+ "terser": "^5.0.0",
42
+ "vite": "^5.0.0"
43
+ }
44
+ }
45
+