flexui-vue 2.0.0-alpha.2 → 2.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,97 @@
1
+ # flexui-vue
2
+
3
+ Vue 3 composables for FlexUI's interactive components. Each composable binds a
4
+ [flexui-runtime](https://www.npmjs.com/package/flexui-runtime) controller on
5
+ mount and disposes it on unmount, so dialog and menu state lives exactly as long
6
+ as the component that owns it.
7
+
8
+ ```bash
9
+ npm install flexui-runtime flexui-vue
10
+ ```
11
+
12
+ `vue` (3.5 or newer) is a peer dependency.
13
+
14
+ ## Dialog
15
+
16
+ ```vue
17
+ <script setup>
18
+ import { useDialog } from "flexui-vue";
19
+
20
+ const { ref, open, close, isOpen } = useDialog({ closeOnBackdrop: true });
21
+ </script>
22
+
23
+ <template>
24
+ <button class="fui-btn" @click="open">Settings</button>
25
+ <dialog ref="ref" class="fui-dialog" data-fui-dialog>
26
+ <h2>Settings</h2>
27
+ <button class="fui-btn" @click="close">Done</button>
28
+ </dialog>
29
+ </template>
30
+ ```
31
+
32
+ `useDialog(options)` returns `ref`, `open()`, `close()`, `toggle()` and `isOpen`.
33
+
34
+ ## Dropdown
35
+
36
+ ```vue
37
+ <script setup>
38
+ import { ref as vueRef } from "vue";
39
+ import { useDropdown } from "flexui-vue";
40
+
41
+ const menu = vueRef(null);
42
+ const trigger = useDropdown(menu);
43
+ </script>
44
+
45
+ <template>
46
+ <button :ref="trigger.ref" class="fui-btn">Account</button>
47
+ <div ref="menu" role="menu">…</div>
48
+ </template>
49
+ ```
50
+
51
+ `useDropdown(menu, options)` takes the menu element (a template ref) or a
52
+ selector and returns the trigger `ref` with the open state.
53
+
54
+ ## Popover
55
+
56
+ ```vue
57
+ const trigger = usePopover(panel);
58
+ ```
59
+
60
+ ## Tabs
61
+
62
+ ```vue
63
+ <script setup>
64
+ import { useTabs } from "flexui-vue";
65
+
66
+ const { ref, activeIndex, select } = useTabs();
67
+ </script>
68
+
69
+ <template>
70
+ <div ref="ref" class="fui-tabs" data-fui-tabs>
71
+ <div role="tablist">…</div>
72
+ </div>
73
+ </template>
74
+ ```
75
+
76
+ ## Theme
77
+
78
+ ```vue
79
+ <script setup>
80
+ import { useTheme } from "flexui-vue";
81
+
82
+ const { mode, resolved, setMode } = useTheme();
83
+ </script>
84
+ ```
85
+
86
+ `setMode("light" | "dark" | "system")` switches the theme without a rebuild, and
87
+ `resolved` tells you which theme is actually active.
88
+
89
+ ## Documentation
90
+
91
+ See the [FlexUI repository](https://github.com/Ahaduzzamankhan/flexui#readme) and
92
+ [docs/runtime.md](https://github.com/Ahaduzzamankhan/flexui/blob/main/docs/runtime.md)
93
+ for markup contracts, options and events.
94
+
95
+ ## License
96
+
97
+ MIT
package/dist/index.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  /**
2
- * Vue bindings for `@flexui/runtime`.
2
+ * Vue bindings for `flexui-runtime`.
3
3
  *
4
4
  * Composables bind on mount and dispose on unmount, so Dialog/Dropdown state is
5
5
  * destroyed with the component that owns it instead of leaking listeners.
6
6
  * Template refs use `ref="..."` on the element and the returned `ref`.
7
7
  */
8
8
  import { type Ref, type ShallowRef } from "vue";
9
- import { type Dialog, type DialogOptions } from "@flexui/runtime/dialog";
10
- import { type Dropdown, type DropdownOptions } from "@flexui/runtime/dropdown";
11
- import { type PopoverController, type PopoverOptions } from "@flexui/runtime/popover";
12
- import { type Tabs } from "@flexui/runtime/tabs";
13
- import { type ResolvedTheme, type ThemeMode } from "@flexui/runtime/theme";
9
+ import { type Dialog, type DialogOptions } from "flexui-runtime/dialog";
10
+ import { type Dropdown, type DropdownOptions } from "flexui-runtime/dropdown";
11
+ import { type PopoverController, type PopoverOptions } from "flexui-runtime/popover";
12
+ import { type Tabs } from "flexui-runtime/tabs";
13
+ import { type ResolvedTheme, type ThemeMode } from "flexui-runtime/theme";
14
14
  export interface UseDialogResult {
15
15
  /** `ref` for the `<dialog>` element. */
16
16
  element: Ref<HTMLDialogElement | null>;
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  /**
2
- * Vue bindings for `@flexui/runtime`.
2
+ * Vue bindings for `flexui-runtime`.
3
3
  *
4
4
  * Composables bind on mount and dispose on unmount, so Dialog/Dropdown state is
5
5
  * destroyed with the component that owns it instead of leaking listeners.
6
6
  * Template refs use `ref="..."` on the element and the returned `ref`.
7
7
  */
8
8
  import { onBeforeUnmount, onMounted, ref, shallowRef } from "vue";
9
- import { bindDialog } from "@flexui/runtime/dialog";
10
- import { bindDropdown } from "@flexui/runtime/dropdown";
11
- import { bindPopover } from "@flexui/runtime/popover";
12
- import { bindTabs } from "@flexui/runtime/tabs";
13
- import { getResolvedTheme, getTheme, setTheme, toggleTheme, } from "@flexui/runtime/theme";
9
+ import { bindDialog } from "flexui-runtime/dialog";
10
+ import { bindDropdown } from "flexui-runtime/dropdown";
11
+ import { bindPopover } from "flexui-runtime/popover";
12
+ import { bindTabs } from "flexui-runtime/tabs";
13
+ import { getResolvedTheme, getTheme, setTheme, toggleTheme, } from "flexui-runtime/theme";
14
14
  /** Binds a native `<dialog class="fui-dialog" data-fui-dialog>`. */
15
15
  export function useDialog(options = {}) {
16
16
  const element = ref(null);
package/package.json CHANGED
@@ -1,34 +1,35 @@
1
- {
2
- "name": "flexui-vue",
3
- "version": "2.0.0-alpha.2",
4
- "description": "Vue composables for FlexUI interactive components",
5
- "license": "MIT",
6
- "type": "module",
7
- "main": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "default": "./dist/index.js"
14
- }
15
- },
16
- "files": [
17
- "dist"
18
- ],
19
- "scripts": {
20
- "build": "tsc -p tsconfig.json",
21
- "typecheck": "tsc -p tsconfig.json --noEmit"
22
- },
23
- "dependencies": {
24
- "flexui-runtime": "2.0.0-alpha.2"
25
- },
26
- "peerDependencies": {
27
- "vue": "^3.5.46"
28
- },
29
- "keywords": [
30
- "flexui",
31
- "vue",
32
- "composables"
33
- ]
34
- }
1
+ {
2
+ "name": "flexui-vue",
3
+ "version": "2.0.0",
4
+ "description": "Vue composables for FlexUI interactive components",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc -p tsconfig.json",
22
+ "typecheck": "tsc -p tsconfig.json --noEmit"
23
+ },
24
+ "dependencies": {
25
+ "flexui-runtime": "2.0.0"
26
+ },
27
+ "peerDependencies": {
28
+ "vue": "^3.5.46"
29
+ },
30
+ "keywords": [
31
+ "flexui",
32
+ "vue",
33
+ "composables"
34
+ ]
35
+ }