juxscript 1.0.62 → 1.0.63

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 (141) hide show
  1. package/bin/cli.js +161 -293
  2. package/docs/v2comps/HEADLESS.md +83 -0
  3. package/docs/v2comps/ISOMORPHISM.md +10 -0
  4. package/juxconfig.example.js +63 -58
  5. package/lib/componentsv2/base/BaseEngine.js +258 -0
  6. package/lib/componentsv2/base/BaseEngine.js.map +1 -0
  7. package/lib/componentsv2/base/BaseEngine.ts +303 -0
  8. package/lib/componentsv2/base/BaseSkin.js +108 -0
  9. package/lib/componentsv2/base/BaseSkin.js.map +1 -0
  10. package/lib/componentsv2/base/BaseSkin.ts +137 -0
  11. package/lib/componentsv2/base/GlobalBus.js +56 -0
  12. package/lib/componentsv2/base/GlobalBus.js.map +1 -0
  13. package/lib/componentsv2/base/GlobalBus.ts +60 -0
  14. package/lib/componentsv2/base/State.js +68 -0
  15. package/lib/componentsv2/base/State.js.map +1 -0
  16. package/lib/componentsv2/base/State.ts +62 -0
  17. package/lib/componentsv2/grid/component.js +41 -0
  18. package/lib/componentsv2/grid/component.js.map +1 -0
  19. package/lib/componentsv2/grid/component.ts +67 -0
  20. package/lib/componentsv2/grid/engine.js +73 -0
  21. package/lib/componentsv2/grid/engine.js.map +1 -0
  22. package/lib/componentsv2/grid/engine.ts +110 -0
  23. package/lib/componentsv2/grid/skin.js +95 -0
  24. package/lib/componentsv2/grid/skin.js.map +1 -0
  25. package/lib/componentsv2/grid/skin.ts +105 -0
  26. package/lib/componentsv2/grid/structure.css +58 -0
  27. package/lib/componentsv2/index.js +218 -0
  28. package/lib/componentsv2/index.js.map +1 -0
  29. package/lib/componentsv2/index.ts +253 -0
  30. package/lib/componentsv2/input/component.js +21 -0
  31. package/lib/componentsv2/input/component.js.map +1 -0
  32. package/lib/componentsv2/input/component.ts +28 -0
  33. package/lib/componentsv2/input/engine.js +50 -0
  34. package/lib/componentsv2/input/engine.js.map +1 -0
  35. package/lib/componentsv2/input/engine.ts +76 -0
  36. package/lib/componentsv2/input/skin.js +91 -0
  37. package/lib/componentsv2/input/skin.js.map +1 -0
  38. package/lib/componentsv2/input/skin.ts +91 -0
  39. package/lib/componentsv2/input/structure.css +47 -0
  40. package/lib/componentsv2/list/component.js +83 -0
  41. package/lib/componentsv2/list/component.js.map +1 -0
  42. package/lib/componentsv2/list/component.ts +97 -0
  43. package/lib/componentsv2/list/engine.js +261 -0
  44. package/lib/componentsv2/list/engine.js.map +1 -0
  45. package/lib/componentsv2/list/engine.ts +345 -0
  46. package/lib/componentsv2/list/skin.js +343 -0
  47. package/lib/componentsv2/list/skin.js.map +1 -0
  48. package/lib/componentsv2/list/skin.ts +367 -0
  49. package/lib/componentsv2/list/structure.css +359 -0
  50. package/lib/componentsv2/plugins/ClientSQLitePlugin.js +130 -0
  51. package/lib/componentsv2/plugins/ClientSQLitePlugin.js.map +1 -0
  52. package/lib/componentsv2/plugins/ClientSQLitePlugin.ts +154 -0
  53. package/lib/componentsv2/plugins/IndexedDBPlugin.js +75 -0
  54. package/lib/componentsv2/plugins/IndexedDBPlugin.js.map +1 -0
  55. package/lib/componentsv2/plugins/IndexedDBPlugin.ts +96 -0
  56. package/lib/componentsv2/plugins/LocalStoragePlugin.js +65 -0
  57. package/lib/componentsv2/plugins/LocalStoragePlugin.js.map +1 -0
  58. package/lib/componentsv2/plugins/LocalStoragePlugin.ts +86 -0
  59. package/lib/componentsv2/plugins/ServerSQLitePlugin.js +70 -0
  60. package/lib/componentsv2/plugins/ServerSQLitePlugin.js.map +1 -0
  61. package/lib/componentsv2/plugins/ServerSQLitePlugin.ts +99 -0
  62. package/lib/componentsv2/stubs/ComponentComposition.ts.stub +32 -0
  63. package/lib/componentsv2/stubs/ComponentEngine.ts.stub +36 -0
  64. package/lib/componentsv2/stubs/ComponentSkin.ts.stub +34 -0
  65. package/lib/componentsv2/stubs/ComponentStructure.css.stub +13 -0
  66. package/lib/componentsv2/tools/CreateSkin.js +62 -0
  67. package/lib/componentsv2/tools/DocSpam.js +134 -0
  68. package/lib/componentsv2/tools/FluencyAudit.js +141 -0
  69. package/lib/componentsv2/tools/OptionsAudit.js +177 -0
  70. package/lib/componentsv2/tools/Scaffold.js +140 -0
  71. package/lib/utils/fetch.js +428 -0
  72. package/lib/utils/fetch.js.map +1 -0
  73. package/machinery/build.js +2 -1
  74. package/machinery/compiler.js +200 -37
  75. package/machinery/config.js +93 -6
  76. package/machinery/diagnose.js +72 -0
  77. package/machinery/jux-module-pattern.md +118 -0
  78. package/machinery/server.js +23 -7
  79. package/machinery/verifier.js +143 -0
  80. package/machinery/watcher.js +53 -64
  81. package/package.json +11 -2
  82. package/lib/components/alert.ts +0 -200
  83. package/lib/components/app.ts +0 -258
  84. package/lib/components/badge.ts +0 -101
  85. package/lib/components/base/BaseComponent.ts +0 -417
  86. package/lib/components/base/FormInput.ts +0 -227
  87. package/lib/components/button.ts +0 -178
  88. package/lib/components/card.ts +0 -173
  89. package/lib/components/chart.ts +0 -231
  90. package/lib/components/checkbox.ts +0 -242
  91. package/lib/components/code.ts +0 -123
  92. package/lib/components/container.ts +0 -140
  93. package/lib/components/data.ts +0 -135
  94. package/lib/components/datepicker.ts +0 -234
  95. package/lib/components/dialog.ts +0 -172
  96. package/lib/components/divider.ts +0 -100
  97. package/lib/components/dropdown.ts +0 -186
  98. package/lib/components/element.ts +0 -267
  99. package/lib/components/error-handler.ts +0 -285
  100. package/lib/components/fileupload.ts +0 -309
  101. package/lib/components/grid.ts +0 -291
  102. package/lib/components/guard.ts +0 -92
  103. package/lib/components/heading.ts +0 -96
  104. package/lib/components/helpers.ts +0 -41
  105. package/lib/components/hero.ts +0 -224
  106. package/lib/components/icon.ts +0 -160
  107. package/lib/components/icons.ts +0 -175
  108. package/lib/components/include.ts +0 -440
  109. package/lib/components/input.ts +0 -457
  110. package/lib/components/list.ts +0 -419
  111. package/lib/components/loading.ts +0 -100
  112. package/lib/components/menu.ts +0 -260
  113. package/lib/components/modal.ts +0 -239
  114. package/lib/components/nav.ts +0 -257
  115. package/lib/components/paragraph.ts +0 -97
  116. package/lib/components/progress.ts +0 -139
  117. package/lib/components/radio.ts +0 -278
  118. package/lib/components/req.ts +0 -302
  119. package/lib/components/script.ts +0 -43
  120. package/lib/components/select.ts +0 -252
  121. package/lib/components/sidebar.ts +0 -167
  122. package/lib/components/style.ts +0 -43
  123. package/lib/components/switch.ts +0 -246
  124. package/lib/components/table.ts +0 -1249
  125. package/lib/components/tabs.ts +0 -250
  126. package/lib/components/theme-toggle.ts +0 -300
  127. package/lib/components/token-calculator.ts +0 -313
  128. package/lib/components/tooltip.ts +0 -144
  129. package/lib/components/view.ts +0 -190
  130. package/lib/components/write.ts +0 -272
  131. package/lib/jux.ts +0 -365
  132. package/lib/layouts/default.css +0 -260
  133. package/lib/layouts/figma.css +0 -334
  134. package/lib/reactivity/state.ts +0 -78
  135. package/machinery/bundleAssets.js +0 -0
  136. package/machinery/bundleJux.js +0 -0
  137. package/machinery/bundleVendors.js +0 -0
  138. package/presets/default/all.jux +0 -343
  139. package/presets/default/index.jux +0 -90
  140. package/presets/default/layout.jux +0 -57
  141. package/presets/default/style.css +0 -1612
@@ -0,0 +1,58 @@
1
+ .jux-grid {
2
+ display: grid;
3
+ /* Default containment */
4
+ box-sizing: border-box;
5
+ position: relative;
6
+ transition: gap var(--transition-fast), width var(--transition-fast), height var(--transition-fast);
7
+ }
8
+
9
+ .jux-grid-cell {
10
+ /* Cells are containers for content */
11
+ position: relative;
12
+ min-width: 0; /* Prevent flex/grid blowouts */
13
+ min-height: 0;
14
+
15
+ /* Layout flexibility for inner content */
16
+ display: flex;
17
+ flex-direction: column;
18
+ }
19
+
20
+ /*
21
+ ✨ GRIDDER: The Blueprint Mode
22
+ Visualizes the Ordinal System
23
+ */
24
+ .jux-grid-ordinal-label {
25
+ display: none; /* Hidden by default */
26
+ }
27
+
28
+ .jux-gridder-active {
29
+ background-color: var(--color-surface-base);
30
+ outline: 2px dashed var(--color-brand-subtle);
31
+ gap: 4px !important; /* Force visible gap for inspection */
32
+ }
33
+
34
+ .jux-gridder-active .jux-grid-cell {
35
+ border: 1px dashed var(--color-border);
36
+ background-color: rgba(255, 255, 255, 0.5);
37
+ align-items: center;
38
+ justify-content: center;
39
+ }
40
+
41
+ .jux-gridder-active .jux-grid-ordinal-label {
42
+ display: block;
43
+ position: absolute;
44
+ top: 0;
45
+ left: 0;
46
+ background: var(--color-brand);
47
+ color: #fff;
48
+ font-family: monospace;
49
+ font-size: 10px;
50
+ padding: 2px 4px;
51
+ opacity: 0.8;
52
+ z-index: 10;
53
+ border-bottom-right-radius: 4px;
54
+ }
55
+
56
+ .jux-grid:hover {
57
+ background-color: var(--color-surface-hover);
58
+ }
@@ -0,0 +1,218 @@
1
+ import { GlobalBus } from './base/GlobalBus.js';
2
+ import { ServerSQLitePlugin } from './plugins/ServerSQLitePlugin.js'; // The Real Server Deal
3
+ import { LocalStoragePlugin } from './plugins/LocalStoragePlugin.js';
4
+ import { IndexedDBPlugin } from './plugins/IndexedDBPlugin.js';
5
+ import { ClientSQLitePlugin } from './plugins/ClientSQLitePlugin.js';
6
+ import { List } from './list/component.js';
7
+ import { Grid } from './grid/component.js';
8
+ import { Input } from './input/component.js'; // ✅ Registered
9
+ // Export individually
10
+ export { List, Grid, Input };
11
+ /**
12
+ * Curated documentation for core framework capabilities.
13
+ * These strings are appended to the reflection data in juxDef.tree.
14
+ */
15
+ const STATIC_DOCS = {
16
+ // BaseEngine / Lifecycle
17
+ 'rollback': 'Reverts state to previous Snapshot (Time Travel Undo).',
18
+ 'rollforward': 'Redoes a previously rolled-back state change.',
19
+ 'dispose': 'Cleans up global listeners to prevent memory leaks.',
20
+ 'on': 'Subscribes to a local event on this component instance.',
21
+ 'off': 'Unsubscribes from a local event.',
22
+ 'listenTo': 'Subscribes to the Global "Neighborhood" Event Bus.',
23
+ 'render': 'Mounts the component visual (Skin) to the DOM.',
24
+ 'addPlugin': 'Injects external services/drivers (DI) into the engine.',
25
+ // Plugin Mixins
26
+ 'query': 'Executes a raw SQL query against the attached database driver (via SQLitePlugin).',
27
+ 'sqlRun': 'Executes a write operation against Client-Side WASM SQLite.',
28
+ 'sqlExec': 'Executes a read query against Client-Side WASM SQLite.',
29
+ // List Config / Knobs
30
+ 'knobs': 'Configures multiple UI features at once (add, edit, move, etc).',
31
+ 'enableNoItems': 'Sets a custom message for empty states.',
32
+ 'enableSearch': 'Shows a toolbar input for real-time text filtering.',
33
+ // Data Mutation
34
+ 'addItems': 'Bulk insert optimization (single render cycle).',
35
+ 'addItem': 'Adds a single item object or string.',
36
+ 'updateItem': 'Patches properties of an item at specific index.',
37
+ 'removeItem': 'Deletes item at index.',
38
+ 'moveItem': 'Reorders item from index A to B (Drag & Drop).',
39
+ // Input Config
40
+ 'setValue': 'Programmatically sets the input value.',
41
+ 'setError': 'Displays validation error message below input.',
42
+ 'setLabel': 'Updates the field label.'
43
+ };
44
+ export const tree = () => {
45
+ // Internal access to engines (private to this scope/getter)
46
+ const engines = (typeof window !== 'undefined' ? window.juxEngines : {}) || {};
47
+ const root = {};
48
+ // Reflection Helper: Inspects function source to gather docs
49
+ const inspectStart = (name, fn) => {
50
+ try {
51
+ const source = fn.toString();
52
+ // 1. Signature / Params
53
+ // Matches "methodName(a, b) {" or "(a, b) =>"
54
+ let params = '';
55
+ const paramMatch = source.match(/^[^(]*\(([^)]*)\)/);
56
+ if (paramMatch) {
57
+ // Start from arg list
58
+ params = paramMatch[1].replace(/\s+/g, ' ').trim();
59
+ }
60
+ // 2. Returns this? (Heuristic)
61
+ // Checks for "return this" or explicit arrow return of instance
62
+ const returnsThis = /return\s+this/.test(source) || /=>\s*this/.test(source);
63
+ // 3. Emissions (Heuristic)
64
+ // Scans for this.emit('event-name', ...)
65
+ const emissions = new Set();
66
+ const emitRegex = /this\.emit\(\s*['"]([^'"]+)['"]/g;
67
+ let match;
68
+ while ((match = emitRegex.exec(source)) !== null) {
69
+ emissions.add(match[1]);
70
+ }
71
+ // Format Output
72
+ let doc = `${name}(${params})`;
73
+ const extras = [];
74
+ if (returnsThis)
75
+ extras.push('returns this');
76
+ if (emissions.size > 0)
77
+ extras.push(`emits: ${Array.from(emissions).join(', ')}`);
78
+ if (extras.length > 0) {
79
+ doc += ` -> ${extras.join(' | ')}`;
80
+ }
81
+ // 4. Append Static Docs if available
82
+ if (STATIC_DOCS[name]) {
83
+ doc += ` // ${STATIC_DOCS[name]}`;
84
+ }
85
+ return doc;
86
+ }
87
+ catch (e) {
88
+ return `${name}(?)`;
89
+ }
90
+ };
91
+ Object.keys(engines).forEach(id => {
92
+ const engine = engines[id];
93
+ // Collect all discoverable methods (Instance + Inherited)
94
+ const capabilities = [];
95
+ const processed = new Set();
96
+ // Safe interaction helper
97
+ const addMethod = (k) => {
98
+ if (processed.has(k))
99
+ return;
100
+ if (k === 'constructor')
101
+ return;
102
+ try {
103
+ // FIX: Always access via instance to ensure 'this' context is correct for getters
104
+ // and to avoid invoking methods on the prototype object which lacks private state.
105
+ const val = engine[k];
106
+ if (typeof val === 'function') {
107
+ processed.add(k);
108
+ capabilities.push(inspectStart(k, val));
109
+ }
110
+ }
111
+ catch (e) {
112
+ // Ignore properties that cannot be accessed (e.g. strict mode violations, private getters)
113
+ }
114
+ };
115
+ // 1. Instance (Factory-added methods like .render, .knobs)
116
+ Object.getOwnPropertyNames(engine).forEach(k => addMethod(k));
117
+ // 2. Prototype Chain (Class Inheritance)
118
+ let proto = Object.getPrototypeOf(engine);
119
+ while (proto && proto !== Object.prototype) {
120
+ Object.getOwnPropertyNames(proto).forEach(k => addMethod(k));
121
+ proto = Object.getPrototypeOf(proto);
122
+ }
123
+ // Safe snapshot
124
+ root[id] = {
125
+ type: engine.constructor.name,
126
+ state: { ...engine.state },
127
+ listeners: engine.eventRegistry || {},
128
+ capabilities: capabilities.sort()
129
+ };
130
+ });
131
+ return root;
132
+ };
133
+ export const use = (query) => {
134
+ const engines = (typeof window !== 'undefined' ? window.juxEngines : {}) || {};
135
+ const keys = Object.keys(engines);
136
+ // 1. Exact Match
137
+ if (engines[query]) {
138
+ window.jux = engines[query];
139
+ console.log(`🎯 Active Engine set to: %c${query}`, 'font-weight:bold; color:#00ff00');
140
+ console.log(` You can now call methods on %cwindow.jux`, 'font-style:italic');
141
+ return engines[query];
142
+ }
143
+ // 2. Fuzzy/Smart Match
144
+ const candidates = keys.filter(k => k.toLowerCase().includes(query.toLowerCase()));
145
+ if (candidates.length === 1) {
146
+ const match = candidates[0];
147
+ window.jux = engines[match];
148
+ console.log(`🎯 Smart Match! Active Engine set to: %c${match}`, 'font-weight:bold; color:#00ff00');
149
+ console.log(` You can now call methods on %cwindow.jux`, 'font-style:italic');
150
+ return engines[match];
151
+ }
152
+ // 3. Ambiguous or No Match
153
+ if (candidates.length > 1) {
154
+ console.warn(`⚠️ Ambiguous match for "${query}". Did you mean:`);
155
+ console.table(candidates);
156
+ }
157
+ else {
158
+ console.warn(`❌ Engine "${query}" not found. Available IDs:`, keys);
159
+ }
160
+ };
161
+ export const engines = () => {
162
+ const engines = (typeof window !== 'undefined' ? window.juxEngines : {}) || {};
163
+ const keys = Object.keys(engines);
164
+ console.group('🔑 Available Engines');
165
+ keys.forEach(k => console.log(`"${k}"`));
166
+ console.groupEnd();
167
+ return keys;
168
+ };
169
+ export const log = () => {
170
+ console.group('JUX Runtime Inspector');
171
+ console.groupCollapsed('📦 Component Tree (Active Instances)');
172
+ const treeData = tree();
173
+ if (Object.keys(treeData).length === 0) {
174
+ console.log("No active components found.");
175
+ }
176
+ else {
177
+ console.table(Object.keys(treeData).map(k => ({
178
+ ID: k,
179
+ Type: treeData[k].type,
180
+ Items: (treeData[k].state.items?.length) ?? 'N/A'
181
+ })));
182
+ console.log(treeData);
183
+ }
184
+ console.groupEnd();
185
+ console.groupCollapsed('📡 Global Event Bus');
186
+ console.log(GlobalBus.registry);
187
+ console.groupEnd();
188
+ console.groupEnd();
189
+ };
190
+ /**
191
+ * juxDef: Global Introspection & Debugging Tool
192
+ * Exposed to window.juxDef for console access.
193
+ */
194
+ export const juxDef = {
195
+ tree,
196
+ use,
197
+ engines,
198
+ log
199
+ };
200
+ // Automatically attach to window for DevTables/Console access
201
+ if (typeof window !== 'undefined') {
202
+ // @ts-ignore
203
+ window.juxDef = juxDef;
204
+ }
205
+ // Export as a namespace object
206
+ export const juxV2 = {
207
+ List,
208
+ Grid,
209
+ Input,
210
+ events: GlobalBus,
211
+ plugins: {
212
+ ServerSQLitePlugin,
213
+ LocalStoragePlugin,
214
+ IndexedDBPlugin,
215
+ ClientSQLitePlugin
216
+ }
217
+ };
218
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC,CAAC,uBAAuB;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAGrE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC,CAAC,eAAe;AAE7D,sBAAsB;AACtB,OAAO,EACH,IAAI,EACJ,IAAI,EACJ,KAAK,EACR,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,GAA2B;IACxC,yBAAyB;IACzB,UAAU,EAAE,wDAAwD;IACpE,aAAa,EAAE,+CAA+C;IAC9D,SAAS,EAAE,qDAAqD;IAChE,IAAI,EAAE,yDAAyD;IAC/D,KAAK,EAAE,kCAAkC;IACzC,UAAU,EAAE,oDAAoD;IAChE,QAAQ,EAAE,gDAAgD;IAC1D,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from './plugins/ServerSQLitePlugin.js'; // The Real Server Deal
4
+ import { LocalStoragePlugin } from './plugins/LocalStoragePlugin.js';
5
+ import { IndexedDBPlugin } from './plugins/IndexedDBPlugin.js';
6
+ import { ClientSQLitePlugin } from './plugins/ClientSQLitePlugin.js';
7
+
8
+
9
+ import { List } from './list/component.js';
10
+ import { Grid } from './grid/component.js';
11
+ import { Input } from './input/component.js'; // ✅ Registered
12
+
13
+ // Export individually
14
+ export {
15
+ List,
16
+ Grid,
17
+ Input
18
+ };
19
+
20
+ /**
21
+ * Curated documentation for core framework capabilities.
22
+ * These strings are appended to the reflection data in juxDef.tree.
23
+ */
24
+ const STATIC_DOCS: Record<string, string> = {
25
+ // BaseEngine / Lifecycle
26
+ 'rollback': 'Reverts state to previous Snapshot (Time Travel Undo).',
27
+ 'rollforward': 'Redoes a previously rolled-back state change.',
28
+ 'dispose': 'Cleans up global listeners to prevent memory leaks.',
29
+ 'on': 'Subscribes to a local event on this component instance.',
30
+ 'off': 'Unsubscribes from a local event.',
31
+ 'listenTo': 'Subscribes to the Global "Neighborhood" Event Bus.',
32
+ 'render': 'Mounts the component visual (Skin) to the DOM.',
33
+ 'addPlugin': 'Injects external services/drivers (DI) into the engine.',
34
+
35
+ // Plugin Mixins
36
+ 'query': 'Executes a raw SQL query against the attached database driver (via SQLitePlugin).',
37
+ 'sqlRun': 'Executes a write operation against Client-Side WASM SQLite.',
38
+ 'sqlExec': 'Executes a read query against Client-Side WASM SQLite.',
39
+
40
+ // List Config / Knobs
41
+ 'knobs': 'Configures multiple UI features at once (add, edit, move, etc).',
42
+ 'enableNoItems': 'Sets a custom message for empty states.',
43
+ 'enableSearch': 'Shows a toolbar input for real-time text filtering.',
44
+
45
+ // Data Mutation
46
+ 'addItems': 'Bulk insert optimization (single render cycle).',
47
+ 'addItem': 'Adds a single item object or string.',
48
+ 'updateItem': 'Patches properties of an item at specific index.',
49
+ 'removeItem': 'Deletes item at index.',
50
+ 'moveItem': 'Reorders item from index A to B (Drag & Drop).',
51
+
52
+ // Input Config
53
+ 'setValue': 'Programmatically sets the input value.',
54
+ 'setError': 'Displays validation error message below input.',
55
+ 'setLabel': 'Updates the field label.'
56
+ };
57
+
58
+ export const tree = () => {
59
+ // Internal access to engines (private to this scope/getter)
60
+ const engines = (typeof window !== 'undefined' ? (window as any).juxEngines : {}) || {};
61
+ const root: Record<string, any> = {};
62
+
63
+ // Reflection Helper: Inspects function source to gather docs
64
+ const inspectStart = (name: string, fn: Function): string => {
65
+ try {
66
+ const source = fn.toString();
67
+
68
+ // 1. Signature / Params
69
+ // Matches "methodName(a, b) {" or "(a, b) =>"
70
+ let params = '';
71
+ const paramMatch = source.match(/^[^(]*\(([^)]*)\)/);
72
+ if (paramMatch) {
73
+ // Start from arg list
74
+ params = paramMatch[1].replace(/\s+/g, ' ').trim();
75
+ }
76
+
77
+ // 2. Returns this? (Heuristic)
78
+ // Checks for "return this" or explicit arrow return of instance
79
+ const returnsThis = /return\s+this/.test(source) || /=>\s*this/.test(source);
80
+
81
+ // 3. Emissions (Heuristic)
82
+ // Scans for this.emit('event-name', ...)
83
+ const emissions = new Set<string>();
84
+ const emitRegex = /this\.emit\(\s*['"]([^'"]+)['"]/g;
85
+ let match;
86
+ while ((match = emitRegex.exec(source)) !== null) {
87
+ emissions.add(match[1]);
88
+ }
89
+
90
+ // Format Output
91
+ let doc = `${name}(${params})`;
92
+ const extras: string[] = [];
93
+
94
+ if (returnsThis) extras.push('returns this');
95
+ if (emissions.size > 0) extras.push(`emits: ${Array.from(emissions).join(', ')}`);
96
+
97
+ if (extras.length > 0) {
98
+ doc += ` -> ${extras.join(' | ')}`;
99
+ }
100
+
101
+ // 4. Append Static Docs if available
102
+ if (STATIC_DOCS[name]) {
103
+ doc += ` // ${STATIC_DOCS[name]}`;
104
+ }
105
+
106
+ return doc;
107
+ } catch (e) {
108
+ return `${name}(?)`;
109
+ }
110
+ };
111
+
112
+ Object.keys(engines).forEach(id => {
113
+ const engine = engines[id];
114
+
115
+ // Collect all discoverable methods (Instance + Inherited)
116
+ const capabilities: string[] = [];
117
+ const processed = new Set<string>();
118
+
119
+ // Safe interaction helper
120
+ const addMethod = (k: string) => {
121
+ if (processed.has(k)) return;
122
+ if (k === 'constructor') return;
123
+
124
+ try {
125
+ // FIX: Always access via instance to ensure 'this' context is correct for getters
126
+ // and to avoid invoking methods on the prototype object which lacks private state.
127
+ const val = (engine as any)[k];
128
+
129
+ if (typeof val === 'function') {
130
+ processed.add(k);
131
+ capabilities.push(inspectStart(k, val));
132
+ }
133
+ } catch (e) {
134
+ // Ignore properties that cannot be accessed (e.g. strict mode violations, private getters)
135
+ }
136
+ };
137
+
138
+ // 1. Instance (Factory-added methods like .render, .knobs)
139
+ Object.getOwnPropertyNames(engine).forEach(k => addMethod(k));
140
+
141
+ // 2. Prototype Chain (Class Inheritance)
142
+ let proto = Object.getPrototypeOf(engine);
143
+ while (proto && proto !== Object.prototype) {
144
+ Object.getOwnPropertyNames(proto).forEach(k => addMethod(k));
145
+ proto = Object.getPrototypeOf(proto);
146
+ }
147
+
148
+ // Safe snapshot
149
+ root[id] = {
150
+ type: engine.constructor.name,
151
+ state: { ...engine.state },
152
+ listeners: engine.eventRegistry || {},
153
+ capabilities: capabilities.sort()
154
+ };
155
+ });
156
+ return root;
157
+ };
158
+
159
+ export const use = (query: string) => {
160
+ const engines = (typeof window !== 'undefined' ? (window as any).juxEngines : {}) || {};
161
+ const keys = Object.keys(engines);
162
+
163
+ // 1. Exact Match
164
+ if (engines[query]) {
165
+ (window as any).jux = engines[query];
166
+ console.log(`🎯 Active Engine set to: %c${query}`, 'font-weight:bold; color:#00ff00');
167
+ console.log(` You can now call methods on %cwindow.jux`, 'font-style:italic');
168
+ return engines[query];
169
+ }
170
+
171
+ // 2. Fuzzy/Smart Match
172
+ const candidates = keys.filter(k => k.toLowerCase().includes(query.toLowerCase()));
173
+
174
+ if (candidates.length === 1) {
175
+ const match = candidates[0];
176
+ (window as any).jux = engines[match];
177
+ console.log(`🎯 Smart Match! Active Engine set to: %c${match}`, 'font-weight:bold; color:#00ff00');
178
+ console.log(` You can now call methods on %cwindow.jux`, 'font-style:italic');
179
+ return engines[match];
180
+ }
181
+
182
+ // 3. Ambiguous or No Match
183
+ if (candidates.length > 1) {
184
+ console.warn(`⚠️ Ambiguous match for "${query}". Did you mean:`);
185
+ console.table(candidates);
186
+ } else {
187
+ console.warn(`❌ Engine "${query}" not found. Available IDs:`, keys);
188
+ }
189
+ };
190
+
191
+ export const engines = () => {
192
+ const engines = (typeof window !== 'undefined' ? (window as any).juxEngines : {}) || {};
193
+ const keys = Object.keys(engines);
194
+ console.group('🔑 Available Engines');
195
+ keys.forEach(k => console.log(`"${k}"`));
196
+ console.groupEnd();
197
+ return keys;
198
+ };
199
+
200
+ export const log = () => {
201
+ console.group('JUX Runtime Inspector');
202
+
203
+ console.groupCollapsed('📦 Component Tree (Active Instances)');
204
+ const treeData = tree();
205
+ if (Object.keys(treeData).length === 0) {
206
+ console.log("No active components found.");
207
+ } else {
208
+ console.table(Object.keys(treeData).map(k => ({
209
+ ID: k,
210
+ Type: treeData[k].type,
211
+ Items: (treeData[k].state.items?.length) ?? 'N/A'
212
+ })));
213
+ console.log(treeData);
214
+ }
215
+ console.groupEnd();
216
+
217
+ console.groupCollapsed('📡 Global Event Bus');
218
+ console.log(GlobalBus.registry);
219
+ console.groupEnd();
220
+
221
+ console.groupEnd();
222
+ };
223
+
224
+ /**
225
+ * juxDef: Global Introspection & Debugging Tool
226
+ * Exposed to window.juxDef for console access.
227
+ */
228
+ export const juxDef = {
229
+ tree,
230
+ use,
231
+ engines,
232
+ log
233
+ };
234
+
235
+ // Automatically attach to window for DevTables/Console access
236
+ if (typeof window !== 'undefined') {
237
+ // @ts-ignore
238
+ window.juxDef = juxDef;
239
+ }
240
+
241
+ // Export as a namespace object
242
+ export const juxV2 = {
243
+ List,
244
+ Grid,
245
+ Input,
246
+ events: GlobalBus,
247
+ plugins: {
248
+ ServerSQLitePlugin,
249
+ LocalStoragePlugin,
250
+ IndexedDBPlugin,
251
+ ClientSQLitePlugin
252
+ }
253
+ };
@@ -0,0 +1,21 @@
1
+ import { InputEngine } from './engine.js';
2
+ import { InputSkin } from './skin.js';
3
+ export function Input(id, options = {}) {
4
+ const engine = new InputEngine(id, options);
5
+ if (typeof window !== 'undefined') {
6
+ // @ts-ignore
7
+ window.juxEngines = window.juxEngines || {};
8
+ // @ts-ignore
9
+ window.juxEngines[id] = engine;
10
+ }
11
+ const skin = new InputSkin(engine);
12
+ // @ts-ignore
13
+ engine.render = (targetId) => {
14
+ const target = typeof targetId === 'string' ? document.getElementById(targetId) : targetId;
15
+ if (target)
16
+ skin.renderSkin(target);
17
+ return engine;
18
+ };
19
+ return engine;
20
+ }
21
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAMtC,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,UAAwB,EAAE;IACxD,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAE5C,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAChC,aAAa;QACb,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAC5C,aAAa;QACb,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;IACnC,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IAEnC,aAAa;IACb,MAAM,CAAC,MAAM,GAAG,CAAC,QAA8B,EAAE,EAAE;QAC/C,MAAM,MAAM,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC3F,IAAI,MAAM;YAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,MAAwB,CAAC;IACpC,CAAC,CAAC;IAEF,OAAO,MAAwB,CAAC;AACpC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { InputEngine, InputOptions } from './engine.js';
2
+ import { InputSkin } from './skin.js';
3
+
4
+ export type InputComponent = InputEngine & {
5
+ render: (targetId: string | HTMLElement) => InputComponent;
6
+ };
7
+
8
+ export function Input(id: string, options: InputOptions = {}): InputComponent {
9
+ const engine = new InputEngine(id, options);
10
+
11
+ if (typeof window !== 'undefined') {
12
+ // @ts-ignore
13
+ window.juxEngines = window.juxEngines || {};
14
+ // @ts-ignore
15
+ window.juxEngines[id] = engine;
16
+ }
17
+
18
+ const skin = new InputSkin(engine);
19
+
20
+ // @ts-ignore
21
+ engine.render = (targetId: string | HTMLElement) => {
22
+ const target = typeof targetId === 'string' ? document.getElementById(targetId) : targetId;
23
+ if (target) skin.renderSkin(target);
24
+ return engine as InputComponent;
25
+ };
26
+
27
+ return engine as InputComponent;
28
+ }
@@ -0,0 +1,50 @@
1
+ import { BaseEngine } from '../base/BaseEngine.js';
2
+ export class InputEngine extends BaseEngine {
3
+ constructor(id, options = {}) {
4
+ super(id, options);
5
+ }
6
+ prepareState(id, options) {
7
+ return {
8
+ id,
9
+ classes: ['jux-input-wrapper'],
10
+ visible: true,
11
+ disabled: false,
12
+ loading: false,
13
+ attributes: {},
14
+ value: options.value !== undefined ? String(options.value) : '',
15
+ label: options.label || null,
16
+ placeholder: options.placeholder || '',
17
+ type: options.type || 'text',
18
+ error: null,
19
+ readonly: options.readonly || false
20
+ };
21
+ }
22
+ // --- Mutators ---
23
+ setValue(value) {
24
+ this.updateState({ value: String(value) });
25
+ this.emit('change', { value });
26
+ return this;
27
+ }
28
+ setLabel(label) {
29
+ this.updateState({ label });
30
+ return this;
31
+ }
32
+ setPlaceholder(text) {
33
+ this.updateState({ placeholder: text });
34
+ return this;
35
+ }
36
+ setError(message) {
37
+ this.updateState({ error: message });
38
+ this.emit('validation', { valid: !message, error: message });
39
+ return this;
40
+ }
41
+ setType(type) {
42
+ this.updateState({ type });
43
+ return this;
44
+ }
45
+ setReadonly(readonly) {
46
+ this.updateState({ readonly });
47
+ return this;
48
+ }
49
+ }
50
+ //# sourceMappingURL=engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.js","sourceRoot":"","sources":["engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,uBAAuB,CAAC;AAmB9D,MAAM,OAAO,WAAY,SAAQ,UAAoC;IAEjE,YAAY,EAAU,EAAE,UAAwB,EAAE;QAC9C,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACvB,CAAC;IAES,YAAY,CAAC,EAAU,EAAE,OAAqB;QACpD,OAAO;YACH,EAAE;YACF,OAAO,EAAE,CAAC,mBAAmB,CAAC;YAC9B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,EAAE;YACd,KAAK,EAAE,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;YAC/D,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,IAAI;YAC5B,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,EAAE;YACtC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,MAAM;YAC5B,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK;SACtC,CAAC;IACN,CAAC;IAED,mBAAmB;IAEnB,QAAQ,CAAC,KAAsB;QAC3B,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC3C,IAAI,CAA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