@mulanjs/mulanjs 1.0.1-dev.20260219085559 → 1.0.1-dev.20260219164037
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 +38 -19
- package/dist/components/infinity-list.js +110 -0
- package/dist/index.js +8 -4
- package/dist/mulan.esm.js +188 -5
- package/dist/mulan.js +12 -2
- package/dist/router/index.js +53 -1
- package/dist/types/components/infinity-list.d.ts +17 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/router/index.d.ts +1 -0
- package/dist/types/src/compiler/compiler.d.ts +7 -0
- package/dist/types/src/compiler/script-compiler.d.ts +8 -0
- package/dist/types/src/compiler/sfc-parser.d.ts +21 -0
- package/dist/types/src/compiler/style-compiler.d.ts +7 -0
- package/dist/types/src/compiler/template-compiler.d.ts +7 -0
- package/dist/types/src/components/bloch-sphere.d.ts +16 -0
- package/dist/types/src/components/infinity-list.d.ts +17 -0
- package/dist/types/src/core/component.d.ts +54 -0
- package/dist/types/src/core/hooks.d.ts +49 -0
- package/dist/types/src/core/quantum.d.ts +50 -0
- package/dist/types/src/core/query.d.ts +14 -0
- package/dist/types/src/core/reactive.d.ts +21 -0
- package/dist/types/src/core/renderer.d.ts +4 -0
- package/dist/types/src/core/vault.d.ts +12 -0
- package/dist/types/src/index.d.ts +79 -0
- package/dist/types/src/router/index.d.ts +25 -0
- package/dist/types/src/security/sanitizer.d.ts +22 -0
- package/dist/types/src/store/index.d.ts +10 -0
- package/dist/types/tests/ssg_repro/src/main.d.ts +6 -0
- package/package.json +1 -1
- package/src/cli/index.js +8 -0
- package/src/cli/static-generator.js +183 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@mulanjs/mulanjs)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
> **"
|
|
6
|
+
> **"The Framework of Power. Zero Runtime Overhead. Pure ASTR Evolution."**
|
|
7
7
|
|
|
8
8
|
MulanJS is a high-performance, next-generation web framework designed to bridge the gap between classic web development and the future of quantum-inspired state management. It is powered by a custom-built Signal Reactivity Engine and ASTR-Q+ architecture.
|
|
9
9
|
|
|
@@ -29,16 +29,35 @@ npx @mulanjs/mulanjs@dev init my-project
|
|
|
29
29
|
npm install @mulanjs/mulanjs@dev
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
*Note: The dev version is updated frequently. You can check the latest version number by running `npm view @mulanjs/mulanjs dist-tags.dev`.*
|
|
33
|
-
|
|
34
32
|
## ⚡ Core Features
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
* **Signal Reactivity Engine** ⚡: Fine-grained reactivity that tracks exact dependencies, eliminating the need for a Virtual DOM.
|
|
35
|
+
* **ASTR-Q+ Engine** 🌌: Simulated quantum registers for probabilistic state management and complex logic branching.
|
|
36
|
+
* **Iron Fortress Security** 🛡️: Built-in "Iron Fortress" security module that auto-sanitizes inputs and generates CSP headers.
|
|
37
|
+
* **Mulan Cycle** 🔄: A redefined component lifecycle (Init, Mount, Destroy) for predictable state management.
|
|
38
|
+
* **TypeScript First** 🟦: Built from the ground up with TypeScript for world-class type safety.
|
|
39
|
+
* **Mulan Power Server** 🚀: Instant, state-preserving Hot Module Replacement (HMR) powered by the Compiler.
|
|
40
|
+
* **Genesis Directives** ✨: Custom syntax (`mu-for`, `mu-if`) compiled directly to high-performance JavaScript.
|
|
41
|
+
|
|
42
|
+
## 🌟 Advanced Capabilities
|
|
43
|
+
|
|
44
|
+
### Mulan Genesis Static (SSG) 🌍
|
|
45
|
+
Pre-render your world with `mulan static`. Perfect for SEO and instant content.
|
|
46
|
+
|
|
47
|
+
### Mulan Anima (FLIP Physics) 🎬
|
|
48
|
+
Just add `mu-animate` to any list for zero-config, 60fps layout transitions.
|
|
49
|
+
|
|
50
|
+
### Mulan Infinity (Big Data) 📈
|
|
51
|
+
Built-in virtualization to render 1,000,000+ rows without performance loss.
|
|
52
|
+
|
|
53
|
+
### Mulan Vault (Persistence) 💾
|
|
54
|
+
State that survives refreshes using `muVault`. Your data, secured in the Iron Fortress.
|
|
55
|
+
|
|
56
|
+
### Mulan Router (Time Travel) 🧭
|
|
57
|
+
Zero-config hash routing with `<mu-link>` for instant, single-page navigation.
|
|
41
58
|
|
|
59
|
+
### Native SCSS Support 🎨
|
|
60
|
+
Built-in support for `<style lang="scss">`. No config required. Just design.
|
|
42
61
|
## 🚀 Quick Start Example
|
|
43
62
|
|
|
44
63
|
MulanJS components (`.mujs`) allow you to write powerful, reactive UI with minimal boilerplate.
|
|
@@ -59,16 +78,16 @@ const debugClick = () => {
|
|
|
59
78
|
<mu-template>
|
|
60
79
|
<div class="page">
|
|
61
80
|
<div class="hero">
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
81
|
+
<h1>Powerful. Fast. MulanJS.</h1>
|
|
82
|
+
<p>The next generation framework for modern web applications.</p>
|
|
83
|
+
|
|
84
|
+
<div class="counter-box">
|
|
85
|
+
<p>Interactive Counter:</p>
|
|
86
|
+
<!-- Native Event Binding -->
|
|
87
|
+
<button class="mu-btn" @click="debugClick()">
|
|
88
|
+
Count is: ${state.count}
|
|
89
|
+
</button>
|
|
90
|
+
</div>
|
|
72
91
|
</div>
|
|
73
92
|
</div>
|
|
74
93
|
</mu-template>
|
|
@@ -103,7 +122,7 @@ p { font-size: 1.2rem; color: #888; max-width: 600px; margin: 0 auto 40px; }
|
|
|
103
122
|
```
|
|
104
123
|
|
|
105
124
|
## Created By
|
|
106
|
-
**Nitin Kumar** (@nitinkumardev09) - *Creator of .mujs & MulanJS Framework*
|
|
125
|
+
**Nitin Kumar** (@nitinkumardev09) - *Creator of .mujs & MulanJS Framework*
|
|
107
126
|
|
|
108
127
|
## License
|
|
109
128
|
MIT
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export class MuInfinity extends HTMLElement {
|
|
2
|
+
constructor() {
|
|
3
|
+
super();
|
|
4
|
+
this._items = [];
|
|
5
|
+
this._itemHeight = 50; // Default height
|
|
6
|
+
this._template = '';
|
|
7
|
+
this.attachShadow({ mode: 'open' });
|
|
8
|
+
// Structure:
|
|
9
|
+
// :host { overflow-y: auto; display: block; height: 100%; }
|
|
10
|
+
// .spacer { height: totalHeight; position: relative; }
|
|
11
|
+
// .content { position: absolute; top: padding; width: 100%; }
|
|
12
|
+
this.shadowRoot.innerHTML = `
|
|
13
|
+
<style>
|
|
14
|
+
:host {
|
|
15
|
+
display: block;
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
height: 100%;
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
.spacer {
|
|
21
|
+
position: relative;
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
.content {
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
31
|
+
<div class="spacer">
|
|
32
|
+
<div class="content"></div>
|
|
33
|
+
</div>
|
|
34
|
+
`;
|
|
35
|
+
this.container = this.shadowRoot.host; // The host itself scrolls
|
|
36
|
+
this.spacer = this.shadowRoot.querySelector('.spacer');
|
|
37
|
+
this.content = this.shadowRoot.querySelector('.content');
|
|
38
|
+
this.onScroll = this.onScroll.bind(this);
|
|
39
|
+
}
|
|
40
|
+
static get observedAttributes() {
|
|
41
|
+
return ['item-height'];
|
|
42
|
+
}
|
|
43
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
44
|
+
if (name === 'item-height') {
|
|
45
|
+
this._itemHeight = parseInt(newValue, 10) || 50;
|
|
46
|
+
this.renderVisible();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
connectedCallback() {
|
|
50
|
+
// Find the template provided by the user (Support both standard and branded tags)
|
|
51
|
+
const templateTag = this.querySelector('template') || this.querySelector('mu-template');
|
|
52
|
+
if (templateTag) {
|
|
53
|
+
this._template = templateTag.innerHTML;
|
|
54
|
+
}
|
|
55
|
+
this.addEventListener('scroll', this.onScroll);
|
|
56
|
+
// Wait for next frame to get initial height if not set
|
|
57
|
+
requestAnimationFrame(() => this.renderVisible());
|
|
58
|
+
}
|
|
59
|
+
disconnectedCallback() {
|
|
60
|
+
this.removeEventListener('scroll', this.onScroll);
|
|
61
|
+
}
|
|
62
|
+
set items(value) {
|
|
63
|
+
this._items = value;
|
|
64
|
+
this.renderVisible();
|
|
65
|
+
}
|
|
66
|
+
get items() { return this._items; }
|
|
67
|
+
onScroll() {
|
|
68
|
+
requestAnimationFrame(() => this.renderVisible());
|
|
69
|
+
}
|
|
70
|
+
renderVisible() {
|
|
71
|
+
if (!this._items.length)
|
|
72
|
+
return;
|
|
73
|
+
const scrollTop = this.scrollTop;
|
|
74
|
+
const hostHeight = this.clientHeight || 400; // Default fallback if not sized
|
|
75
|
+
const totalHeight = this._items.length * this._itemHeight;
|
|
76
|
+
this.spacer.style.height = `${totalHeight}px`;
|
|
77
|
+
// Windowing Math
|
|
78
|
+
const startIndex = Math.floor(scrollTop / this._itemHeight);
|
|
79
|
+
const buffer = 5;
|
|
80
|
+
const visibleCount = Math.ceil(hostHeight / this._itemHeight);
|
|
81
|
+
const renderStart = Math.max(0, startIndex - buffer);
|
|
82
|
+
const renderEnd = Math.min(this._items.length, startIndex + visibleCount + buffer);
|
|
83
|
+
const startOffset = renderStart * this._itemHeight;
|
|
84
|
+
this.content.style.transform = `translateY(${startOffset}px)`;
|
|
85
|
+
// Render specific slice
|
|
86
|
+
const visibleItems = this._items.slice(renderStart, renderEnd);
|
|
87
|
+
// Simple string replacement template engine for the demo
|
|
88
|
+
// In a real Mulan compilation, this would be an optimized ASTR render
|
|
89
|
+
let html = '';
|
|
90
|
+
visibleItems.forEach((item, index) => {
|
|
91
|
+
const absoluteIndex = renderStart + index;
|
|
92
|
+
// Basic mustache replacement {{ item.prop }}
|
|
93
|
+
let rowHtml = this._template
|
|
94
|
+
.replace(/{{\s*item\s*}}/g, String(item)) // {{ item }}
|
|
95
|
+
.replace(/{{\s*index\s*}}/g, String(absoluteIndex)); // {{ index }}
|
|
96
|
+
// Handle object properties: {{ item.name }}
|
|
97
|
+
if (typeof item === 'object' && item !== null) {
|
|
98
|
+
rowHtml = rowHtml.replace(/{{\s*item\.(\w+)\s*}}/g, (_, prop) => {
|
|
99
|
+
return String(item[prop] || '');
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
html += `<div style="height: ${this._itemHeight}px; overflow: hidden;">${rowHtml}</div>`;
|
|
103
|
+
});
|
|
104
|
+
this.content.innerHTML = html;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Register
|
|
108
|
+
if (typeof customElements !== 'undefined' && !customElements.get('mu-infinity')) {
|
|
109
|
+
customElements.define('mu-infinity', MuInfinity);
|
|
110
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -9,18 +9,20 @@ export * from './core/query';
|
|
|
9
9
|
export * from './core/vault';
|
|
10
10
|
export * from './core/quantum';
|
|
11
11
|
export * from './components/bloch-sphere';
|
|
12
|
+
export * from './components/infinity-list';
|
|
12
13
|
// Global Mulan Object for non-module usage
|
|
13
14
|
import { reactive, effect } from './core/reactive';
|
|
14
15
|
import { MuComponent, defineComponent } from './core/component';
|
|
15
|
-
import { MuRouter } from './router/index';
|
|
16
|
+
import { MuRouter, createRouter } from './router/index';
|
|
16
17
|
import { MuStore } from './store/index';
|
|
17
18
|
import { Security } from './security/sanitizer';
|
|
18
19
|
import * as Hooks from './core/hooks';
|
|
19
20
|
import * as Query from './core/query';
|
|
20
21
|
import { render } from './core/renderer';
|
|
21
22
|
import * as Quantum from './core/quantum';
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
import * as InfinityList from './components/infinity-list';
|
|
24
|
+
const Mulan = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ reactive,
|
|
25
|
+
effect, Component: MuComponent, defineComponent, Router: MuRouter, createRouter, Store: MuStore, Security: Security }, Hooks), Query), Quantum), InfinityList), { render,
|
|
24
26
|
// MULAN INSIGHT: Branded Logging
|
|
25
27
|
log: (msg, ...args) => {
|
|
26
28
|
console.log(`%c[MulanJS]%c ${msg}`, "color: #ff3e00; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;", "", ...args);
|
|
@@ -49,5 +51,7 @@ if (typeof window !== 'undefined') {
|
|
|
49
51
|
}
|
|
50
52
|
};
|
|
51
53
|
}
|
|
52
|
-
window
|
|
54
|
+
if (typeof window !== 'undefined') {
|
|
55
|
+
window.Mulan = Mulan;
|
|
56
|
+
}
|
|
53
57
|
export default Mulan;
|
package/dist/mulan.esm.js
CHANGED
|
@@ -265,6 +265,130 @@ if (typeof customElements !== 'undefined') {
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
|
|
268
|
+
/***/ },
|
|
269
|
+
|
|
270
|
+
/***/ "./src/components/infinity-list.ts"
|
|
271
|
+
/*!*****************************************!*\
|
|
272
|
+
!*** ./src/components/infinity-list.ts ***!
|
|
273
|
+
\*****************************************/
|
|
274
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
275
|
+
|
|
276
|
+
__webpack_require__.r(__webpack_exports__);
|
|
277
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
278
|
+
/* harmony export */ MuInfinity: () => (/* binding */ MuInfinity)
|
|
279
|
+
/* harmony export */ });
|
|
280
|
+
class MuInfinity extends HTMLElement {
|
|
281
|
+
constructor() {
|
|
282
|
+
super();
|
|
283
|
+
this._items = [];
|
|
284
|
+
this._itemHeight = 50; // Default height
|
|
285
|
+
this._template = '';
|
|
286
|
+
this.attachShadow({ mode: 'open' });
|
|
287
|
+
// Structure:
|
|
288
|
+
// :host { overflow-y: auto; display: block; height: 100%; }
|
|
289
|
+
// .spacer { height: totalHeight; position: relative; }
|
|
290
|
+
// .content { position: absolute; top: padding; width: 100%; }
|
|
291
|
+
this.shadowRoot.innerHTML = `
|
|
292
|
+
<style>
|
|
293
|
+
:host {
|
|
294
|
+
display: block;
|
|
295
|
+
overflow-y: auto;
|
|
296
|
+
height: 100%;
|
|
297
|
+
position: relative;
|
|
298
|
+
}
|
|
299
|
+
.spacer {
|
|
300
|
+
position: relative;
|
|
301
|
+
width: 100%;
|
|
302
|
+
}
|
|
303
|
+
.content {
|
|
304
|
+
position: absolute;
|
|
305
|
+
top: 0;
|
|
306
|
+
left: 0;
|
|
307
|
+
width: 100%;
|
|
308
|
+
}
|
|
309
|
+
</style>
|
|
310
|
+
<div class="spacer">
|
|
311
|
+
<div class="content"></div>
|
|
312
|
+
</div>
|
|
313
|
+
`;
|
|
314
|
+
this.container = this.shadowRoot.host; // The host itself scrolls
|
|
315
|
+
this.spacer = this.shadowRoot.querySelector('.spacer');
|
|
316
|
+
this.content = this.shadowRoot.querySelector('.content');
|
|
317
|
+
this.onScroll = this.onScroll.bind(this);
|
|
318
|
+
}
|
|
319
|
+
static get observedAttributes() {
|
|
320
|
+
return ['item-height'];
|
|
321
|
+
}
|
|
322
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
323
|
+
if (name === 'item-height') {
|
|
324
|
+
this._itemHeight = parseInt(newValue, 10) || 50;
|
|
325
|
+
this.renderVisible();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
connectedCallback() {
|
|
329
|
+
// Find the template provided by the user (Support both standard and branded tags)
|
|
330
|
+
const templateTag = this.querySelector('template') || this.querySelector('mu-template');
|
|
331
|
+
if (templateTag) {
|
|
332
|
+
this._template = templateTag.innerHTML;
|
|
333
|
+
}
|
|
334
|
+
this.addEventListener('scroll', this.onScroll);
|
|
335
|
+
// Wait for next frame to get initial height if not set
|
|
336
|
+
requestAnimationFrame(() => this.renderVisible());
|
|
337
|
+
}
|
|
338
|
+
disconnectedCallback() {
|
|
339
|
+
this.removeEventListener('scroll', this.onScroll);
|
|
340
|
+
}
|
|
341
|
+
set items(value) {
|
|
342
|
+
this._items = value;
|
|
343
|
+
this.renderVisible();
|
|
344
|
+
}
|
|
345
|
+
get items() { return this._items; }
|
|
346
|
+
onScroll() {
|
|
347
|
+
requestAnimationFrame(() => this.renderVisible());
|
|
348
|
+
}
|
|
349
|
+
renderVisible() {
|
|
350
|
+
if (!this._items.length)
|
|
351
|
+
return;
|
|
352
|
+
const scrollTop = this.scrollTop;
|
|
353
|
+
const hostHeight = this.clientHeight || 400; // Default fallback if not sized
|
|
354
|
+
const totalHeight = this._items.length * this._itemHeight;
|
|
355
|
+
this.spacer.style.height = `${totalHeight}px`;
|
|
356
|
+
// Windowing Math
|
|
357
|
+
const startIndex = Math.floor(scrollTop / this._itemHeight);
|
|
358
|
+
const buffer = 5;
|
|
359
|
+
const visibleCount = Math.ceil(hostHeight / this._itemHeight);
|
|
360
|
+
const renderStart = Math.max(0, startIndex - buffer);
|
|
361
|
+
const renderEnd = Math.min(this._items.length, startIndex + visibleCount + buffer);
|
|
362
|
+
const startOffset = renderStart * this._itemHeight;
|
|
363
|
+
this.content.style.transform = `translateY(${startOffset}px)`;
|
|
364
|
+
// Render specific slice
|
|
365
|
+
const visibleItems = this._items.slice(renderStart, renderEnd);
|
|
366
|
+
// Simple string replacement template engine for the demo
|
|
367
|
+
// In a real Mulan compilation, this would be an optimized ASTR render
|
|
368
|
+
let html = '';
|
|
369
|
+
visibleItems.forEach((item, index) => {
|
|
370
|
+
const absoluteIndex = renderStart + index;
|
|
371
|
+
// Basic mustache replacement {{ item.prop }}
|
|
372
|
+
let rowHtml = this._template
|
|
373
|
+
.replace(/{{\s*item\s*}}/g, String(item)) // {{ item }}
|
|
374
|
+
.replace(/{{\s*index\s*}}/g, String(absoluteIndex)); // {{ index }}
|
|
375
|
+
// Handle object properties: {{ item.name }}
|
|
376
|
+
if (typeof item === 'object' && item !== null) {
|
|
377
|
+
rowHtml = rowHtml.replace(/{{\s*item\.(\w+)\s*}}/g, (_, prop) => {
|
|
378
|
+
return String(item[prop] || '');
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
html += `<div style="height: ${this._itemHeight}px; overflow: hidden;">${rowHtml}</div>`;
|
|
382
|
+
});
|
|
383
|
+
this.content.innerHTML = html;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
// Register
|
|
387
|
+
if (typeof customElements !== 'undefined' && !customElements.get('mu-infinity')) {
|
|
388
|
+
customElements.define('mu-infinity', MuInfinity);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
|
|
268
392
|
/***/ },
|
|
269
393
|
|
|
270
394
|
/***/ "./src/core/component.ts"
|
|
@@ -1604,6 +1728,33 @@ class MuRouter {
|
|
|
1604
1728
|
}
|
|
1605
1729
|
});
|
|
1606
1730
|
}
|
|
1731
|
+
// [Chronos] Prefetch a route's component code in the background
|
|
1732
|
+
prefetch(path) {
|
|
1733
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1734
|
+
if (this.isServer)
|
|
1735
|
+
return;
|
|
1736
|
+
const { route } = this.matchRoute(path);
|
|
1737
|
+
if (route) {
|
|
1738
|
+
let componentToRender = route.component;
|
|
1739
|
+
// Check if it's a lazy-loaded function that hasn't been resolved yet
|
|
1740
|
+
if (typeof componentToRender === 'function' && !componentToRender.prototype) {
|
|
1741
|
+
// If it's already a resolved module (from previous prefetch), componentToRender might be the result.
|
|
1742
|
+
// But typically in our simple implementation, route.component stays as the function until we replace it.
|
|
1743
|
+
// To avoid double-fetching, we can check if it has a specific flag or property.
|
|
1744
|
+
// For this implementation, we'll just run it and let the browser cache the module request (standard ES Module behavior).
|
|
1745
|
+
try {
|
|
1746
|
+
// console.log(`[Chronos] Prefetching ${path}...`);
|
|
1747
|
+
yield componentToRender();
|
|
1748
|
+
// We don't need to do anything with the result here.
|
|
1749
|
+
// The browser's module cache will handle the speedup when the user actually navigates.
|
|
1750
|
+
}
|
|
1751
|
+
catch (e) {
|
|
1752
|
+
console.warn(`[Chronos] Failed to prefetch ${path}`, e);
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1607
1758
|
navigate(path) {
|
|
1608
1759
|
if (this.isServer) {
|
|
1609
1760
|
this.currentPath = path;
|
|
@@ -1615,7 +1766,12 @@ class MuRouter {
|
|
|
1615
1766
|
}
|
|
1616
1767
|
// --- Factory for Easy Usage ---
|
|
1617
1768
|
const createRouter = (options) => {
|
|
1618
|
-
|
|
1769
|
+
// Expose the router instance globally for <mu-link> to access
|
|
1770
|
+
const router = new MuRouter(options.routes, options.rootContainer);
|
|
1771
|
+
if (typeof window !== 'undefined') {
|
|
1772
|
+
window.__MULAN_ROUTER__ = router;
|
|
1773
|
+
}
|
|
1774
|
+
return router;
|
|
1619
1775
|
};
|
|
1620
1776
|
// --- Web Component: <mu-link> ---
|
|
1621
1777
|
// Usage: <mu-link to="/about">About Us</mu-link>
|
|
@@ -1631,6 +1787,26 @@ if (typeof window !== 'undefined' && !customElements.get('mu-link')) {
|
|
|
1631
1787
|
window.location.hash = to;
|
|
1632
1788
|
}
|
|
1633
1789
|
});
|
|
1790
|
+
// [Chronos] Intelligent Pre-fetching
|
|
1791
|
+
this.addEventListener('mouseenter', () => {
|
|
1792
|
+
const to = this.getAttribute('to');
|
|
1793
|
+
if (to) {
|
|
1794
|
+
const router = window.__MULAN_ROUTER__;
|
|
1795
|
+
if (router && typeof router.prefetch === 'function') {
|
|
1796
|
+
router.prefetch(to);
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
});
|
|
1800
|
+
// [Chronos] Also prefetch on focus for keyboard users
|
|
1801
|
+
this.addEventListener('focus', () => {
|
|
1802
|
+
const to = this.getAttribute('to');
|
|
1803
|
+
if (to) {
|
|
1804
|
+
const router = window.__MULAN_ROUTER__;
|
|
1805
|
+
if (router && typeof router.prefetch === 'function') {
|
|
1806
|
+
router.prefetch(to);
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
});
|
|
1634
1810
|
}
|
|
1635
1811
|
connectedCallback() {
|
|
1636
1812
|
this.style.cursor = 'pointer';
|
|
@@ -1841,6 +2017,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1841
2017
|
/* harmony export */ Component: () => (/* reexport safe */ _core_component__WEBPACK_IMPORTED_MODULE_1__.MuComponent),
|
|
1842
2018
|
/* harmony export */ MuBlochSphereElement: () => (/* reexport safe */ _components_bloch_sphere__WEBPACK_IMPORTED_MODULE_10__.MuBlochSphereElement),
|
|
1843
2019
|
/* harmony export */ MuComponent: () => (/* reexport safe */ _core_component__WEBPACK_IMPORTED_MODULE_1__.MuComponent),
|
|
2020
|
+
/* harmony export */ MuInfinity: () => (/* reexport safe */ _components_infinity_list__WEBPACK_IMPORTED_MODULE_11__.MuInfinity),
|
|
1844
2021
|
/* harmony export */ MuRouter: () => (/* reexport safe */ _router_index__WEBPACK_IMPORTED_MODULE_3__.MuRouter),
|
|
1845
2022
|
/* harmony export */ MuStore: () => (/* reexport safe */ _store_index__WEBPACK_IMPORTED_MODULE_4__.MuStore),
|
|
1846
2023
|
/* harmony export */ Router: () => (/* reexport safe */ _router_index__WEBPACK_IMPORTED_MODULE_3__.MuRouter),
|
|
@@ -1892,6 +2069,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1892
2069
|
/* harmony import */ var _core_vault__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./core/vault */ "./src/core/vault.ts");
|
|
1893
2070
|
/* harmony import */ var _core_quantum__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./core/quantum */ "./src/core/quantum.ts");
|
|
1894
2071
|
/* harmony import */ var _components_bloch_sphere__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./components/bloch-sphere */ "./src/components/bloch-sphere.ts");
|
|
2072
|
+
/* harmony import */ var _components_infinity_list__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./components/infinity-list */ "./src/components/infinity-list.ts");
|
|
2073
|
+
|
|
1895
2074
|
|
|
1896
2075
|
|
|
1897
2076
|
|
|
@@ -1913,8 +2092,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1913
2092
|
|
|
1914
2093
|
|
|
1915
2094
|
|
|
1916
|
-
|
|
1917
|
-
|
|
2095
|
+
|
|
2096
|
+
const Mulan = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ reactive: _core_reactive__WEBPACK_IMPORTED_MODULE_0__.reactive,
|
|
2097
|
+
effect: _core_reactive__WEBPACK_IMPORTED_MODULE_0__.effect, Component: _core_component__WEBPACK_IMPORTED_MODULE_1__.MuComponent, defineComponent: _core_component__WEBPACK_IMPORTED_MODULE_1__.defineComponent, Router: _router_index__WEBPACK_IMPORTED_MODULE_3__.MuRouter, createRouter: _router_index__WEBPACK_IMPORTED_MODULE_3__.createRouter, Store: _store_index__WEBPACK_IMPORTED_MODULE_4__.MuStore, Security: _security_sanitizer__WEBPACK_IMPORTED_MODULE_5__.Security }, _core_hooks__WEBPACK_IMPORTED_MODULE_6__), _core_query__WEBPACK_IMPORTED_MODULE_7__), _core_quantum__WEBPACK_IMPORTED_MODULE_9__), _components_infinity_list__WEBPACK_IMPORTED_MODULE_11__), { render: _core_renderer__WEBPACK_IMPORTED_MODULE_2__.render,
|
|
1918
2098
|
// MULAN INSIGHT: Branded Logging
|
|
1919
2099
|
log: (msg, ...args) => {
|
|
1920
2100
|
console.log(`%c[MulanJS]%c ${msg}`, "color: #ff3e00; font-weight: bold; background: #222; padding: 2px 4px; border-radius: 3px;", "", ...args);
|
|
@@ -1943,7 +2123,9 @@ if (typeof window !== 'undefined') {
|
|
|
1943
2123
|
}
|
|
1944
2124
|
};
|
|
1945
2125
|
}
|
|
1946
|
-
window
|
|
2126
|
+
if (typeof window !== 'undefined') {
|
|
2127
|
+
window.Mulan = Mulan;
|
|
2128
|
+
}
|
|
1947
2129
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Mulan);
|
|
1948
2130
|
|
|
1949
2131
|
})();
|
|
@@ -1951,6 +2133,7 @@ window.Mulan = Mulan;
|
|
|
1951
2133
|
const __webpack_exports__Component = __webpack_exports__.Component;
|
|
1952
2134
|
const __webpack_exports__MuBlochSphereElement = __webpack_exports__.MuBlochSphereElement;
|
|
1953
2135
|
const __webpack_exports__MuComponent = __webpack_exports__.MuComponent;
|
|
2136
|
+
const __webpack_exports__MuInfinity = __webpack_exports__.MuInfinity;
|
|
1954
2137
|
const __webpack_exports__MuRouter = __webpack_exports__.MuRouter;
|
|
1955
2138
|
const __webpack_exports__MuStore = __webpack_exports__.MuStore;
|
|
1956
2139
|
const __webpack_exports__Router = __webpack_exports__.Router;
|
|
@@ -1990,4 +2173,4 @@ const __webpack_exports__sanitize = __webpack_exports__.sanitize;
|
|
|
1990
2173
|
const __webpack_exports__setCurrentInstance = __webpack_exports__.setCurrentInstance;
|
|
1991
2174
|
const __webpack_exports__useMutation = __webpack_exports__.useMutation;
|
|
1992
2175
|
const __webpack_exports__useQuery = __webpack_exports__.useQuery;
|
|
1993
|
-
export { __webpack_exports__Component as Component, __webpack_exports__MuBlochSphereElement as MuBlochSphereElement, __webpack_exports__MuComponent as MuComponent, __webpack_exports__MuRouter as MuRouter, __webpack_exports__MuStore as MuStore, __webpack_exports__Router as Router, __webpack_exports__Security as Security, __webpack_exports__Signal as Signal, __webpack_exports__default as default, __webpack_exports__defineComponent as defineComponent, __webpack_exports__effect as effect, __webpack_exports__getCurrentInstance as getCurrentInstance, __webpack_exports__hydrate as hydrate, __webpack_exports__muEffect as muEffect, __webpack_exports__muEntangle as muEntangle, __webpack_exports__muGate as muGate, __webpack_exports__muGeom as muGeom, __webpack_exports__muMeasure as muMeasure, __webpack_exports__muMemo as muMemo, __webpack_exports__muPulse as muPulse, __webpack_exports__muQubit as muQubit, __webpack_exports__muRegister as muRegister, __webpack_exports__muSearch as muSearch, __webpack_exports__muState as muState, __webpack_exports__muTeleport as muTeleport, __webpack_exports__muVault as muVault, __webpack_exports__onMuDestroy as onMuDestroy, __webpack_exports__onMuIdle as onMuIdle, __webpack_exports__onMuInit as onMuInit, __webpack_exports__onMuMount as onMuMount, __webpack_exports__onMuResume as onMuResume, __webpack_exports__onMuShake as onMuShake, __webpack_exports__onMuVoice as onMuVoice, __webpack_exports__persistent as persistent, __webpack_exports__reactive as reactive, __webpack_exports__ref as ref, __webpack_exports__render as render, __webpack_exports__renderToString as renderToString, __webpack_exports__sanitize as sanitize, __webpack_exports__setCurrentInstance as setCurrentInstance, __webpack_exports__useMutation as useMutation, __webpack_exports__useQuery as useQuery };
|
|
2176
|
+
export { __webpack_exports__Component as Component, __webpack_exports__MuBlochSphereElement as MuBlochSphereElement, __webpack_exports__MuComponent as MuComponent, __webpack_exports__MuInfinity as MuInfinity, __webpack_exports__MuRouter as MuRouter, __webpack_exports__MuStore as MuStore, __webpack_exports__Router as Router, __webpack_exports__Security as Security, __webpack_exports__Signal as Signal, __webpack_exports__default as default, __webpack_exports__defineComponent as defineComponent, __webpack_exports__effect as effect, __webpack_exports__getCurrentInstance as getCurrentInstance, __webpack_exports__hydrate as hydrate, __webpack_exports__muEffect as muEffect, __webpack_exports__muEntangle as muEntangle, __webpack_exports__muGate as muGate, __webpack_exports__muGeom as muGeom, __webpack_exports__muMeasure as muMeasure, __webpack_exports__muMemo as muMemo, __webpack_exports__muPulse as muPulse, __webpack_exports__muQubit as muQubit, __webpack_exports__muRegister as muRegister, __webpack_exports__muSearch as muSearch, __webpack_exports__muState as muState, __webpack_exports__muTeleport as muTeleport, __webpack_exports__muVault as muVault, __webpack_exports__onMuDestroy as onMuDestroy, __webpack_exports__onMuIdle as onMuIdle, __webpack_exports__onMuInit as onMuInit, __webpack_exports__onMuMount as onMuMount, __webpack_exports__onMuResume as onMuResume, __webpack_exports__onMuShake as onMuShake, __webpack_exports__onMuVoice as onMuVoice, __webpack_exports__persistent as persistent, __webpack_exports__reactive as reactive, __webpack_exports__ref as ref, __webpack_exports__render as render, __webpack_exports__renderToString as renderToString, __webpack_exports__sanitize as sanitize, __webpack_exports__setCurrentInstance as setCurrentInstance, __webpack_exports__useMutation as useMutation, __webpack_exports__useQuery as useQuery };
|