@rokkit/ui 1.1.16 → 1.1.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/ui",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "Data driven UI components for Rokkit applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,10 +44,10 @@
44
44
  "dropdown"
45
45
  ],
46
46
  "dependencies": {
47
- "@rokkit/core": "1.1.16",
48
- "@rokkit/data": "1.1.16",
49
- "@rokkit/states": "1.1.16",
50
- "@rokkit/actions": "1.1.16",
47
+ "@rokkit/core": "1.1.18",
48
+ "@rokkit/data": "1.1.18",
49
+ "@rokkit/states": "1.1.18",
50
+ "@rokkit/actions": "1.1.18",
51
51
  "marked": "^15.0.0",
52
52
  "dompurify": "^3.0.0"
53
53
  },
@@ -1,9 +1,11 @@
1
- <script>
1
+ <script lang="ts">
2
2
  import { commands, messages } from '@rokkit/states'
3
3
  import { dismissable } from '@rokkit/actions'
4
4
 
5
- /** @type {{ open?: boolean, placeholder?: string }} */
6
- let { open = $bindable(false), placeholder } = $props()
5
+ /** Minimal command shape this palette reads (states' Command typedef isn't exported). */
6
+ type CommandLike = { id: string; label: string; keywords?: string[] }
7
+
8
+ let { open = $bindable(false), placeholder }: { open?: boolean; placeholder?: string } = $props()
7
9
 
8
10
  let query = $state('')
9
11
  let activeIndex = $state(0)
@@ -14,7 +16,7 @@
14
16
  label: messages.command.label
15
17
  })
16
18
 
17
- function score(cmd, q) {
19
+ function score(cmd: CommandLike, q: string) {
18
20
  const hay = `${cmd.label} ${cmd.id} ${(cmd.keywords ?? []).join(' ')}`.toLowerCase()
19
21
  return hay.includes(q)
20
22
  }
@@ -30,14 +32,14 @@
30
32
  activeIndex = 0
31
33
  }
32
34
 
33
- function runAt(index) {
35
+ function runAt(index: number) {
34
36
  const cmd = results[index]
35
37
  if (!cmd) return
36
38
  close()
37
39
  commands.execute(cmd.id)
38
40
  }
39
41
 
40
- function onkeydown(event) {
42
+ function onkeydown(event: KeyboardEvent) {
41
43
  if (event.key === 'ArrowDown') {
42
44
  event.preventDefault()
43
45
  activeIndex = Math.min(activeIndex + 1, results.length - 1)