@bedard/hexboard 0.0.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.
Files changed (38) hide show
  1. package/.github/workflows/build.yml +65 -0
  2. package/.github/workflows/release.yml +0 -0
  3. package/.vscode/settings.json +5 -0
  4. package/LICENSE +21 -0
  5. package/README.md +8 -0
  6. package/dist/index.d.ts +127 -0
  7. package/dist/index.js +1056 -0
  8. package/eslint.config.js +85 -0
  9. package/index.html +22 -0
  10. package/package.json +58 -0
  11. package/src/lib/components/hexboard/Hexboard.vue +865 -0
  12. package/src/lib/components/hexboard/constants.ts +389 -0
  13. package/src/lib/components/hexboard/dom.ts +19 -0
  14. package/src/lib/components/hexboard/geometry.ts +59 -0
  15. package/src/lib/components/hexboard/haptics.ts +56 -0
  16. package/src/lib/components/hexboard/pieces/Celtic.vue +22 -0
  17. package/src/lib/components/hexboard/pieces/Fantasy.vue +22 -0
  18. package/src/lib/components/hexboard/pieces/Gioco.vue +22 -0
  19. package/src/lib/components/hexboard/pieces/Spatial.vue +22 -0
  20. package/src/lib/components/hexboard/pieces/index.ts +4 -0
  21. package/src/lib/components/hexboard/types.ts +28 -0
  22. package/src/lib/index.ts +1 -0
  23. package/src/sandbox/App.vue +28 -0
  24. package/src/sandbox/components/Button.vue +8 -0
  25. package/src/sandbox/components/icons/Github.vue +3 -0
  26. package/src/sandbox/components/icons/Menu.vue +3 -0
  27. package/src/sandbox/components/icons/X.vue +3 -0
  28. package/src/sandbox/index.ts +5 -0
  29. package/src/sandbox/tailwind.css +59 -0
  30. package/src/sandbox/views/HomeToolbar.vue +80 -0
  31. package/src/tests/example.test.tsx +18 -0
  32. package/src/tests/hexboard.test.tsx +832 -0
  33. package/src/tests/utils.ts +26 -0
  34. package/tsconfig.json +30 -0
  35. package/tsconfig.node.json +10 -0
  36. package/vite.config.ts +42 -0
  37. package/vite.sandbox.config.ts +21 -0
  38. package/vitest.config.ts +35 -0
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <div>
3
+ <!-- Menu button -->
4
+ <button
5
+ aria-controls="sidebar-menu"
6
+ class="fixed right-4 top-4 z-50 rounded-lg bg-gray-200 p-2 dark:bg-gray-700"
7
+ :aria-expanded="isOpen"
8
+ :aria-label="isOpen ? 'Close menu' : 'Open menu'"
9
+ @click="isOpen = !isOpen"
10
+ >
11
+ <Menu
12
+ v-if="!isOpen"
13
+ aria-hidden="true"
14
+ class="size-6 text-gray-700 dark:text-gray-200"
15
+ />
16
+ <X
17
+ v-else
18
+ aria-hidden="true"
19
+ class="size-6 text-gray-700 dark:text-gray-200"
20
+ />
21
+ </button>
22
+
23
+ <!-- Backdrop -->
24
+ <Transition
25
+ enter-active-class="transition-opacity duration-300"
26
+ enter-from-class="opacity-0"
27
+ enter-to-class="opacity-100"
28
+ leave-active-class="transition-opacity duration-300"
29
+ leave-from-class="opacity-100"
30
+ leave-to-class="opacity-0"
31
+ >
32
+ <div
33
+ v-if="isOpen"
34
+ aria-hidden="true"
35
+ class="fixed inset-0 z-40 bg-black/50"
36
+ @click="isOpen = false"
37
+ />
38
+ </Transition>
39
+
40
+ <!-- Slide-out panel -->
41
+ <Transition
42
+ enter-active-class="transition-transform duration-300"
43
+ enter-from-class="translate-x-full"
44
+ enter-to-class="translate-x-0"
45
+ leave-active-class="transition-transform duration-300"
46
+ leave-from-class="translate-x-0"
47
+ leave-to-class="translate-x-full"
48
+ >
49
+ <nav
50
+ v-if="isOpen"
51
+ aria-label="Main menu"
52
+ class="fixed right-0 top-0 z-40 h-full w-72 bg-gray-100 p-4 pt-16 dark:bg-gray-800"
53
+ id="sidebar-menu"
54
+ role="dialog"
55
+ >
56
+ <a
57
+ class="flex items-center gap-3 rounded-lg p-2 text-gray-700 hover:bg-gray-200 dark:text-gray-200 dark:hover:bg-gray-700"
58
+ href="https://github.com/scottbedard/hexboard"
59
+ rel="noopener noreferrer"
60
+ target="_blank"
61
+ >
62
+ <Github
63
+ aria-hidden="true"
64
+ class="size-5"
65
+ />
66
+ <span>Visit Repository</span>
67
+ </a>
68
+ </nav>
69
+ </Transition>
70
+ </div>
71
+ </template>
72
+
73
+ <script setup lang="ts">
74
+ import Github from 'sandbox/components/icons/Github.vue'
75
+ import Menu from 'sandbox/components/icons/Menu.vue'
76
+ import X from 'sandbox/components/icons/X.vue'
77
+ import { ref } from 'vue'
78
+
79
+ const isOpen = ref(false)
80
+ </script>
@@ -0,0 +1,18 @@
1
+ /** @jsxImportSource vue */
2
+ import { expect, test } from 'vitest'
3
+ import { ref } from 'vue'
4
+ import { setup } from './utils'
5
+
6
+ test('hello world', async () => {
7
+ const text = ref('hello')
8
+
9
+ const screen = setup(() => {
10
+ return () => <div data-testid="text">{text.value}</div>
11
+ })
12
+
13
+ await expect.element(screen.getByTestId('text')).toHaveTextContent('hello')
14
+
15
+ text.value = 'world'
16
+
17
+ await expect.element(screen.getByTestId('text')).toHaveTextContent('world')
18
+ })