flexui-svelte 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 +72 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/package.json +40 -39
package/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# flexui-svelte
|
|
2
|
+
|
|
3
|
+
Svelte actions for FlexUI's interactive components. They wrap the
|
|
4
|
+
[flexui-runtime](https://www.npmjs.com/package/flexui-runtime) controllers, run
|
|
5
|
+
when the element mounts, and clean themselves up when it is destroyed. No Svelte
|
|
6
|
+
imports are needed, so the same actions work with Svelte 4 and 5.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install flexui-runtime flexui-svelte
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Dialog
|
|
13
|
+
|
|
14
|
+
```svelte
|
|
15
|
+
<script>
|
|
16
|
+
import { dialog } from "flexui-svelte";
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<button class="fui-btn" on:click={() => document.querySelector("#settings").showModal()}>
|
|
20
|
+
Settings
|
|
21
|
+
</button>
|
|
22
|
+
|
|
23
|
+
<dialog id="settings" class="fui-dialog" data-fui-dialog use:dialog={{ closeOnBackdrop: true }}>
|
|
24
|
+
<h2>Settings</h2>
|
|
25
|
+
</dialog>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Dropdown
|
|
29
|
+
|
|
30
|
+
```svelte
|
|
31
|
+
<script>
|
|
32
|
+
import { dropdown } from "flexui-svelte";
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<button class="fui-btn" use:dropdown={"#account-menu"}>Account</button>
|
|
36
|
+
<div id="account-menu" role="menu">…</div>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Popover
|
|
40
|
+
|
|
41
|
+
```svelte
|
|
42
|
+
<button class="fui-btn" use:popover={"#filters"}>Filters</button>
|
|
43
|
+
<div id="filters" popover>…</div>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Tabs
|
|
47
|
+
|
|
48
|
+
```svelte
|
|
49
|
+
<div class="fui-tabs" data-fui-tabs use:tabs>
|
|
50
|
+
<div role="tablist">…</div>
|
|
51
|
+
</div>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Parameters are read once, when the action runs. For reactive state, the runtime
|
|
55
|
+
events (`fui:open`, `fui:close`, `fui:tabchange`, `fui:themechange`) give you the
|
|
56
|
+
same information Svelte would otherwise duplicate.
|
|
57
|
+
|
|
58
|
+
## Lower-level binding
|
|
59
|
+
|
|
60
|
+
The package also exports `bindDialog`, `bindDropdown`, `bindPopover` and
|
|
61
|
+
`bindTabs`, which return the underlying controller when you want to drive it
|
|
62
|
+
yourself.
|
|
63
|
+
|
|
64
|
+
## Documentation
|
|
65
|
+
|
|
66
|
+
See the [FlexUI repository](https://github.com/Ahaduzzamankhan/flexui#readme) and
|
|
67
|
+
[docs/runtime.md](https://github.com/Ahaduzzamankhan/flexui/blob/main/docs/runtime.md)
|
|
68
|
+
for markup contracts, options and events.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Svelte actions for
|
|
2
|
+
* Svelte actions for `flexui-runtime`.
|
|
3
3
|
*
|
|
4
4
|
* ```svelte
|
|
5
5
|
* <script>
|
|
6
|
-
* import { dialog, dropdown, tabs } from "
|
|
6
|
+
* import { dialog, dropdown, tabs } from "flexui-svelte";
|
|
7
7
|
* </script>
|
|
8
8
|
*
|
|
9
9
|
* <dialog class="fui-dialog" use:dialog={{ closeOnBackdrop: true }}>…</dialog>
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* on the framework and works with Svelte 4 and 5 component syntax alike.
|
|
16
16
|
* Parameters are read once, when the action runs.
|
|
17
17
|
*/
|
|
18
|
-
import { bindDialog, type DialogOptions } from "
|
|
19
|
-
import { bindDropdown, type DropdownOptions } from "
|
|
20
|
-
import { bindPopover, type PopoverOptions } from "
|
|
21
|
-
import { bindTabs } from "
|
|
18
|
+
import { bindDialog, type DialogOptions } from "flexui-runtime/dialog";
|
|
19
|
+
import { bindDropdown, type DropdownOptions } from "flexui-runtime/dropdown";
|
|
20
|
+
import { bindPopover, type PopoverOptions } from "flexui-runtime/popover";
|
|
21
|
+
import { bindTabs } from "flexui-runtime/tabs";
|
|
22
22
|
/** The shape Svelte uses for an action's return value. */
|
|
23
23
|
export interface Action<Params = undefined> {
|
|
24
24
|
update?(params: Params): void;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Svelte actions for
|
|
2
|
+
* Svelte actions for `flexui-runtime`.
|
|
3
3
|
*
|
|
4
4
|
* ```svelte
|
|
5
5
|
* <script>
|
|
6
|
-
* import { dialog, dropdown, tabs } from "
|
|
6
|
+
* import { dialog, dropdown, tabs } from "flexui-svelte";
|
|
7
7
|
* </script>
|
|
8
8
|
*
|
|
9
9
|
* <dialog class="fui-dialog" use:dialog={{ closeOnBackdrop: true }}>…</dialog>
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
* on the framework and works with Svelte 4 and 5 component syntax alike.
|
|
16
16
|
* Parameters are read once, when the action runs.
|
|
17
17
|
*/
|
|
18
|
-
import { bindDialog } from "
|
|
19
|
-
import { bindDropdown } from "
|
|
20
|
-
import { bindPopover } from "
|
|
21
|
-
import { bindTabs } from "
|
|
18
|
+
import { bindDialog } from "flexui-runtime/dialog";
|
|
19
|
+
import { bindDropdown } from "flexui-runtime/dropdown";
|
|
20
|
+
import { bindPopover } from "flexui-runtime/popover";
|
|
21
|
+
import { bindTabs } from "flexui-runtime/tabs";
|
|
22
22
|
function noop() {
|
|
23
23
|
// Actions without a parameter still need a destroy hook.
|
|
24
24
|
}
|
package/package.json
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "flexui-svelte",
|
|
3
|
-
"version": "2.0.0
|
|
4
|
-
"description": "Svelte actions 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
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "flexui-svelte",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Svelte actions 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
|
+
"svelte": ">=4.0.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependenciesMeta": {
|
|
31
|
+
"svelte": {
|
|
32
|
+
"optional": true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"flexui",
|
|
37
|
+
"svelte",
|
|
38
|
+
"actions"
|
|
39
|
+
]
|
|
40
|
+
}
|