@deijose/nix-ionic 0.2.0 → 0.3.1
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 +135 -28
- package/dist/favicon.ico +0 -0
- package/dist/index.cjs +2612 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +2602 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/index.d.ts +2 -3
- package/dist/nix-js-logo.png +0 -0
- package/dist/p-9VcRUwdB-BZDASSRz.js +323 -0
- package/dist/p-9VcRUwdB-BZDASSRz.js.map +1 -0
- package/dist/p-9VcRUwdB-Bw8gCHlL.cjs +340 -0
- package/dist/p-9VcRUwdB-Bw8gCHlL.cjs.map +1 -0
- package/dist/p-BJoMtgfR-DP5flT_f.js +1206 -0
- package/dist/p-BJoMtgfR-DP5flT_f.js.map +1 -0
- package/dist/p-BJoMtgfR-DyzhC2Uw.cjs +1319 -0
- package/dist/p-BJoMtgfR-DyzhC2Uw.cjs.map +1 -0
- package/dist/p-BgwEQWW6-BM87vVU5.cjs +72 -0
- package/dist/p-BgwEQWW6-BM87vVU5.cjs.map +1 -0
- package/dist/p-BgwEQWW6-DIo2-ASC.js +72 -0
- package/dist/p-BgwEQWW6-DIo2-ASC.js.map +1 -0
- package/dist/p-BmVRXR1y-BsLZqRc0.cjs +41 -0
- package/dist/p-BmVRXR1y-BsLZqRc0.cjs.map +1 -0
- package/dist/p-BmVRXR1y-t-R4bYc1.js +41 -0
- package/dist/p-BmVRXR1y-t-R4bYc1.js.map +1 -0
- package/dist/p-C59ryAuS-CFciP5mq.cjs +42 -0
- package/dist/p-C59ryAuS-CFciP5mq.cjs.map +1 -0
- package/dist/p-C59ryAuS-DazlzUfi.js +19 -0
- package/dist/p-C59ryAuS-DazlzUfi.js.map +1 -0
- package/dist/p-CBzELu-H-DlS7IGlS.cjs +292 -0
- package/dist/p-CBzELu-H-DlS7IGlS.cjs.map +1 -0
- package/dist/p-CBzELu-H-bk38lWXh.js +287 -0
- package/dist/p-CBzELu-H-bk38lWXh.js.map +1 -0
- package/dist/p-CU1SSH8_-1VQUU8Zi.js +27 -0
- package/dist/p-CU1SSH8_-1VQUU8Zi.js.map +1 -0
- package/dist/p-CU1SSH8_-D56vgRhd.cjs +32 -0
- package/dist/p-CU1SSH8_-D56vgRhd.cjs.map +1 -0
- package/dist/p-Cl0B-RWe-CaQPWG_o.js +258 -0
- package/dist/p-Cl0B-RWe-CaQPWG_o.js.map +1 -0
- package/dist/p-Cl0B-RWe-CsujC7rr.cjs +269 -0
- package/dist/p-Cl0B-RWe-CsujC7rr.cjs.map +1 -0
- package/dist/p-CneGxKsZ-C5qTtPZx.cjs +26 -0
- package/dist/p-CneGxKsZ-C5qTtPZx.cjs.map +1 -0
- package/dist/p-CneGxKsZ-DghQx9uV.js +26 -0
- package/dist/p-CneGxKsZ-DghQx9uV.js.map +1 -0
- package/dist/p-Cwv-vmkN-CEJtqyzO.js +141 -0
- package/dist/p-Cwv-vmkN-CEJtqyzO.js.map +1 -0
- package/dist/p-Cwv-vmkN-_Ll5IGJb.cjs +141 -0
- package/dist/p-Cwv-vmkN-_Ll5IGJb.cjs.map +1 -0
- package/dist/p-Cz5nLPGT-CCHjKH-2.cjs +45 -0
- package/dist/p-Cz5nLPGT-CCHjKH-2.cjs.map +1 -0
- package/dist/p-Cz5nLPGT-mbB7NqG3.js +45 -0
- package/dist/p-Cz5nLPGT-mbB7NqG3.js.map +1 -0
- package/dist/p-D13Eaw-8-CkhHu_JZ.js +35 -0
- package/dist/p-D13Eaw-8-CkhHu_JZ.js.map +1 -0
- package/dist/p-D13Eaw-8-DwZ_qr-I.cjs +46 -0
- package/dist/p-D13Eaw-8-DwZ_qr-I.cjs.map +1 -0
- package/dist/p-D6Ynv7Xh-CQpbvraJ.cjs +41 -0
- package/dist/p-D6Ynv7Xh-CQpbvraJ.cjs.map +1 -0
- package/dist/p-D6Ynv7Xh-bzjdXLwD.js +41 -0
- package/dist/p-D6Ynv7Xh-bzjdXLwD.js.map +1 -0
- package/dist/p-DgbT0exM-BY3-DNWX.cjs +178 -0
- package/dist/p-DgbT0exM-BY3-DNWX.cjs.map +1 -0
- package/dist/p-DgbT0exM-Bjp0vDlM.js +107 -0
- package/dist/p-DgbT0exM-Bjp0vDlM.js.map +1 -0
- package/dist/p-ZjP4CjeZ-BpWsQNNL.cjs +20 -0
- package/dist/p-ZjP4CjeZ-BpWsQNNL.cjs.map +1 -0
- package/dist/p-ZjP4CjeZ-iNpKbiw2.js +9 -0
- package/dist/p-ZjP4CjeZ-iNpKbiw2.js.map +1 -0
- package/dist/p-vEbVo2hO-Bo4CY69w.cjs +80 -0
- package/dist/p-vEbVo2hO-Bo4CY69w.cjs.map +1 -0
- package/dist/p-vEbVo2hO-CpCOqZ3z.js +69 -0
- package/dist/p-vEbVo2hO-CpCOqZ3z.js.map +1 -0
- package/dist/rolldown-runtime-CYJQ3TkU.cjs +18 -0
- package/dist/rolldown-runtime-CiIaOW0V.js +13 -0
- package/package.json +94 -2
- package/dist/lib/IonRouterOutlet.d.ts +0 -23
- package/dist/lib/lifecycle.d.ts +0 -36
- package/dist/lib/nix-ionic.cjs +0 -1
- package/dist/lib/nix-ionic.cjs.map +0 -1
- package/dist/lib/nix-ionic.js +0 -1
- package/dist/lib/nix-ionic.js.map +0 -1
- package/dist/lib/setup.d.ts +0 -5
package/README.md
CHANGED
|
@@ -29,14 +29,98 @@ npm install @deijose/nix-ionic @deijose/nix-js @ionic/core
|
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Modular component loading (v0.3.0+)
|
|
33
|
+
|
|
34
|
+
Starting with v0.3.0, `setupNixIonic()` only registers **6 minimal core components** needed for routing (`ion-app`, `ion-router`, `ion-route`, `ion-router-outlet`, `ion-back-button`, `ion-icon`). All other components are loaded **on demand**.
|
|
35
|
+
|
|
36
|
+
This means you **only pay for what you use**, reducing your initial bundle size dramatically.
|
|
37
|
+
|
|
38
|
+
### Three ways to load components
|
|
39
|
+
|
|
40
|
+
#### 1. Individual components (maximum tree-shaking) ✅
|
|
41
|
+
|
|
42
|
+
Import only the exact components you need:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { setupNixIonic } from "@deijose/nix-ionic";
|
|
46
|
+
import {
|
|
47
|
+
defineIonHeader,
|
|
48
|
+
defineIonToolbar,
|
|
49
|
+
defineIonTitle,
|
|
50
|
+
defineIonContent,
|
|
51
|
+
defineIonButton,
|
|
52
|
+
} from "@deijose/nix-ionic/components";
|
|
53
|
+
|
|
54
|
+
setupNixIonic({
|
|
55
|
+
components: [
|
|
56
|
+
defineIonHeader,
|
|
57
|
+
defineIonToolbar,
|
|
58
|
+
defineIonTitle,
|
|
59
|
+
defineIonContent,
|
|
60
|
+
defineIonButton,
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### 2. Category bundles (balanced approach)
|
|
33
66
|
|
|
34
|
-
|
|
67
|
+
Load components by category:
|
|
35
68
|
|
|
36
69
|
```typescript
|
|
37
|
-
import {
|
|
38
|
-
|
|
70
|
+
import { setupNixIonic } from "@deijose/nix-ionic";
|
|
71
|
+
import { layoutComponents } from "@deijose/nix-ionic/bundles/layout";
|
|
72
|
+
import { buttonComponents } from "@deijose/nix-ionic/bundles/buttons";
|
|
73
|
+
import { listComponents } from "@deijose/nix-ionic/bundles/lists";
|
|
74
|
+
|
|
75
|
+
setupNixIonic({
|
|
76
|
+
components: [...layoutComponents, ...buttonComponents, ...listComponents],
|
|
77
|
+
});
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Available bundles:**
|
|
81
|
+
|
|
82
|
+
| Bundle | Import path | Components |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| Layout | `@deijose/nix-ionic/bundles/layout` | header, toolbar, title, content, footer, buttons |
|
|
85
|
+
| Navigation | `@deijose/nix-ionic/bundles/navigation` | menu, menu-button |
|
|
86
|
+
| Forms | `@deijose/nix-ionic/bundles/forms` | input, textarea, checkbox, toggle, select, select-option, radio, radio-group, range, searchbar |
|
|
87
|
+
| Lists | `@deijose/nix-ionic/bundles/lists` | list, list-header, item, item-divider, item-sliding, item-options, item-option, label, note, card, card-header, card-title, card-subtitle, card-content |
|
|
88
|
+
| Feedback | `@deijose/nix-ionic/bundles/feedback` | spinner, progress-bar, skeleton-text, badge, avatar, thumbnail |
|
|
89
|
+
| Buttons | `@deijose/nix-ionic/bundles/buttons` | button, fab, fab-button, fab-list, ripple-effect |
|
|
90
|
+
| Overlays | `@deijose/nix-ionic/bundles/overlays` | modal, popover, toast, alert |
|
|
91
|
+
| **All** | `@deijose/nix-ionic/bundles/all` | All of the above |
|
|
92
|
+
|
|
93
|
+
#### 3. All components (same as v0.2.x)
|
|
94
|
+
|
|
95
|
+
If you want backward-compatible behavior with all components loaded at once:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { setupNixIonic } from "@deijose/nix-ionic";
|
|
99
|
+
import { allComponents } from "@deijose/nix-ionic/bundles/all";
|
|
100
|
+
|
|
101
|
+
setupNixIonic({ components: allComponents });
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Migration from v0.2.x
|
|
105
|
+
|
|
106
|
+
```diff
|
|
107
|
+
import { setupNixIonic } from "@deijose/nix-ionic";
|
|
108
|
+
+ import { allComponents } from "@deijose/nix-ionic/bundles/all";
|
|
109
|
+
|
|
110
|
+
- setupNixIonic();
|
|
111
|
+
+ setupNixIonic({ components: allComponents });
|
|
112
|
+
```
|
|
39
113
|
|
|
114
|
+
Or better yet, import only what you actually use for a smaller bundle.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Quick start
|
|
119
|
+
|
|
120
|
+
### 1. Initialize and Mount in `main.ts`
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
// 1. Core Styles (order matters)
|
|
40
124
|
import "@ionic/core/css/core.css";
|
|
41
125
|
import "@ionic/core/css/normalize.css";
|
|
42
126
|
import "@ionic/core/css/structure.css";
|
|
@@ -44,28 +128,37 @@ import "@ionic/core/css/typography.css";
|
|
|
44
128
|
import "@ionic/core/css/padding.css";
|
|
45
129
|
import "@ionic/core/css/flex-utils.css";
|
|
46
130
|
import "@ionic/core/css/display.css";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### 2. Define your routes
|
|
131
|
+
import "./style.css";
|
|
50
132
|
|
|
51
|
-
|
|
133
|
+
// 2. Framework Imports
|
|
52
134
|
import { NixComponent, html, mount } from "@deijose/nix-js";
|
|
53
|
-
import { IonRouterOutlet } from "@deijose/nix-ionic";
|
|
135
|
+
import { setupNixIonic, IonRouterOutlet } from "@deijose/nix-ionic";
|
|
136
|
+
import { layoutComponents } from "@deijose/nix-ionic/bundles/layout";
|
|
137
|
+
import { defineIonButton } from "@deijose/nix-ionic/components";
|
|
138
|
+
|
|
139
|
+
// 3. Pages
|
|
54
140
|
import { HomePage } from "./pages/HomePage";
|
|
55
141
|
import { DetailPage } from "./pages/DetailPage";
|
|
56
142
|
|
|
143
|
+
// Configure and inject Ionic Core (only the components you use)
|
|
144
|
+
setupNixIonic({
|
|
145
|
+
components: [...layoutComponents, defineIonButton],
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// 4. Router Configuration
|
|
57
149
|
const outlet = new IonRouterOutlet([
|
|
58
150
|
{ path: "/", component: (ctx) => new HomePage(ctx) },
|
|
59
|
-
{ path: "/detail/:id", component: (ctx) => new DetailPage(ctx) }
|
|
60
|
-
{ path: "/profile", component: (ctx) => ProfilePage(ctx) },
|
|
151
|
+
{ path: "/detail/:id", component: (ctx) => new DetailPage(ctx) }
|
|
61
152
|
]);
|
|
62
153
|
|
|
154
|
+
// 5. App Component
|
|
63
155
|
class App extends NixComponent {
|
|
64
|
-
render() {
|
|
156
|
+
override render() {
|
|
65
157
|
return html`<ion-app>${outlet}</ion-app>`;
|
|
66
158
|
}
|
|
67
159
|
}
|
|
68
160
|
|
|
161
|
+
// 6. Bootstrap
|
|
69
162
|
mount(new App(), "#app");
|
|
70
163
|
```
|
|
71
164
|
|
|
@@ -288,6 +381,17 @@ interface PageContext {
|
|
|
288
381
|
|
|
289
382
|
## API Reference
|
|
290
383
|
|
|
384
|
+
### `setupNixIonic(options?)`
|
|
385
|
+
|
|
386
|
+
```typescript
|
|
387
|
+
setupNixIonic(options?: {
|
|
388
|
+
iconAssetPath?: string;
|
|
389
|
+
components?: ComponentDefiner[];
|
|
390
|
+
}): void
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
Initializes Ionic Core and registers the minimal routing components. Pass additional components via `options.components`.
|
|
394
|
+
|
|
291
395
|
### `IonRouterOutlet`
|
|
292
396
|
|
|
293
397
|
```typescript
|
|
@@ -349,6 +453,7 @@ useIonViewDidLeave(lc: PageLifecycle, fn: () => void): void
|
|
|
349
453
|
| `ion-back-button` | native | wrapper | wrapper |
|
|
350
454
|
| Lifecycle hooks | directive | hooks | `IonPage` / composables |
|
|
351
455
|
| Navigation API | `NavController` | `useHistory` | `useRouter()` |
|
|
456
|
+
| Modular loading | ❌ | ❌ | ✅ tree-shakeable |
|
|
352
457
|
|
|
353
458
|
|
|
354
459
|
## Project setup
|
|
@@ -429,11 +534,7 @@ my-app/
|
|
|
429
534
|
### `main.ts` — entry point
|
|
430
535
|
|
|
431
536
|
```typescript
|
|
432
|
-
//
|
|
433
|
-
import { defineCustomElements } from "@ionic/core/loader";
|
|
434
|
-
defineCustomElements();
|
|
435
|
-
|
|
436
|
-
// ── Ionic CSS (order matters) ─────────────────────────────────────────────────
|
|
537
|
+
// 1. Core Styles (order matters)
|
|
437
538
|
import "@ionic/core/css/core.css";
|
|
438
539
|
import "@ionic/core/css/normalize.css";
|
|
439
540
|
import "@ionic/core/css/structure.css";
|
|
@@ -441,31 +542,37 @@ import "@ionic/core/css/typography.css";
|
|
|
441
542
|
import "@ionic/core/css/padding.css";
|
|
442
543
|
import "@ionic/core/css/flex-utils.css";
|
|
443
544
|
import "@ionic/core/css/display.css";
|
|
444
|
-
|
|
445
|
-
// ── App styles ────────────────────────────────────────────────────────────────
|
|
446
545
|
import "./style.css";
|
|
447
546
|
|
|
448
|
-
//
|
|
547
|
+
// 2. Framework Imports
|
|
449
548
|
import { NixComponent, html, mount } from "@deijose/nix-js";
|
|
450
|
-
import
|
|
451
|
-
import {
|
|
549
|
+
import { setupNixIonic, IonRouterOutlet } from "@deijose/nix-ionic";
|
|
550
|
+
import { layoutComponents } from "@deijose/nix-ionic/bundles/layout";
|
|
551
|
+
import { buttonComponents } from "@deijose/nix-ionic/bundles/buttons";
|
|
552
|
+
|
|
553
|
+
// 3. Pages
|
|
554
|
+
import { HomePage } from "./pages/HomePage";
|
|
555
|
+
import { DetailPage } from "./pages/DetailPage";
|
|
452
556
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
557
|
+
// Configure and inject Ionic Core
|
|
558
|
+
setupNixIonic({
|
|
559
|
+
components: [...layoutComponents, ...buttonComponents],
|
|
560
|
+
});
|
|
456
561
|
|
|
562
|
+
// 4. Router Configuration
|
|
457
563
|
const outlet = new IonRouterOutlet([
|
|
458
564
|
{ path: "/", component: (ctx) => new HomePage(ctx) },
|
|
459
|
-
{ path: "/detail/:id", component: (ctx) => new DetailPage(ctx) }
|
|
460
|
-
{ path: "/profile", component: (ctx) => ProfilePage(ctx) },
|
|
565
|
+
{ path: "/detail/:id", component: (ctx) => new DetailPage(ctx) }
|
|
461
566
|
]);
|
|
462
567
|
|
|
568
|
+
// 5. App Component
|
|
463
569
|
class App extends NixComponent {
|
|
464
|
-
override render()
|
|
570
|
+
override render() {
|
|
465
571
|
return html`<ion-app>${outlet}</ion-app>`;
|
|
466
572
|
}
|
|
467
573
|
}
|
|
468
574
|
|
|
575
|
+
// 6. Bootstrap
|
|
469
576
|
mount(new App(), "#app");
|
|
470
577
|
```
|
|
471
578
|
|
package/dist/favicon.ico
ADDED
|
Binary file
|