@fluix-ui/vanilla 0.0.5 → 0.0.7

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 CHANGED
@@ -8,14 +8,104 @@ Vanilla JS adapter for Fluix UI components.
8
8
  npm install @fluix-ui/vanilla @fluix-ui/css
9
9
  ```
10
10
 
11
- ## Usage
11
+ ## How imports work in Vanilla JS
12
+
13
+ ### Option A: npm + bundler (Vite/Webpack/Rollup)
14
+
15
+ Use standard ESM imports in your source files:
16
+
17
+ ```ts
18
+ import { createToaster, fluix } from "@fluix-ui/vanilla";
19
+ import "@fluix-ui/css";
20
+ ```
21
+
22
+ ### Option B: browser without bundler (CDN + global)
23
+
24
+ The IIFE build exposes a global `window.Fluix`.
25
+
26
+ ```html
27
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fluix-ui/css/dist/fluix.css" />
28
+ <script src="https://cdn.jsdelivr.net/npm/@fluix-ui/vanilla/dist/index.global.js"></script>
29
+ <script>
30
+ const { createToaster, fluix, createNotch, createMenu } = window.Fluix;
31
+ createToaster({ position: "top-right" });
32
+ fluix.success({ title: "Loaded" });
33
+ </script>
34
+ ```
35
+
36
+ ## Quick start (Toasts)
12
37
 
13
38
  ```ts
14
39
  import { createToaster, fluix } from "@fluix-ui/vanilla";
15
40
  import "@fluix-ui/css";
41
+
42
+ const toaster = createToaster({ position: "top-right", layout: "stack" });
43
+
44
+ document.querySelector("#save-btn")?.addEventListener("click", () => {
45
+ fluix.success({
46
+ title: "Saved",
47
+ description: "Your changes were stored.",
48
+ });
49
+ });
50
+ ```
51
+
52
+ ### Promise toasts
53
+
54
+ ```ts
55
+ await fluix.promise(saveUser(), {
56
+ loading: { title: "Saving..." },
57
+ success: (data) => ({
58
+ title: "Saved",
59
+ description: `User ${data.name} updated`,
60
+ }),
61
+ error: (err) => ({
62
+ title: "Failed",
63
+ description: err instanceof Error ? err.message : "Unexpected error",
64
+ }),
65
+ });
16
66
  ```
17
67
 
18
- ### Custom themes
68
+ ## Notch
69
+
70
+ ```ts
71
+ import { createNotch } from "@fluix-ui/vanilla";
72
+
73
+ const container = document.querySelector("#notch-root");
74
+ if (!container) throw new Error("Missing #notch-root");
75
+
76
+ const notch = createNotch(container, {
77
+ position: "top-center",
78
+ trigger: "click",
79
+ theme: "dark",
80
+ pill: "Now",
81
+ content: "Now playing: Fluix Theme",
82
+ });
83
+
84
+ notch.open();
85
+ ```
86
+
87
+ ## Menu
88
+
89
+ ```ts
90
+ import { createMenu } from "@fluix-ui/vanilla";
91
+
92
+ const container = document.querySelector("#menu-root");
93
+ if (!container) throw new Error("Missing #menu-root");
94
+
95
+ const menu = createMenu(container, {
96
+ activeId: "home",
97
+ orientation: "horizontal",
98
+ variant: "pill",
99
+ theme: "dark",
100
+ items: [
101
+ { id: "home", label: "Home" },
102
+ { id: "projects", label: "Projects" },
103
+ { id: "settings", label: "Settings" },
104
+ ],
105
+ });
106
+ ```
107
+
108
+ ## Theming
19
109
 
20
110
  Pass any theme name — themes are pure CSS. See `@fluix-ui/css` for details.
21
111
 
@@ -23,6 +113,20 @@ Pass any theme name — themes are pure CSS. See `@fluix-ui/css` for details.
23
113
  fluix.success({ title: "Done", theme: "midnight" });
24
114
  ```
25
115
 
116
+ ## Exports
117
+
118
+ ```ts
119
+ import { createToaster, createNotch, createMenu, fluix } from "@fluix-ui/vanilla";
120
+ import type {
121
+ NotchOptions,
122
+ MenuOptions,
123
+ MenuInstance,
124
+ MenuItemConfig,
125
+ FluixToastOptions,
126
+ FluixToasterConfig,
127
+ } from "@fluix-ui/vanilla";
128
+ ```
129
+
26
130
  ## Docs
27
131
 
28
132
  - Official docs: https://fluix.ivanlopezdev.es