histoire 0.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.
Files changed (100) hide show
  1. package/bin.mjs +4 -0
  2. package/dist/client/app/App.vue +51 -0
  3. package/dist/client/app/components/HomeView.vue +3 -0
  4. package/dist/client/app/components/SandboxVue.vue +57 -0
  5. package/dist/client/app/components/StoryControls.vue +29 -0
  6. package/dist/client/app/components/StoryList.vue +22 -0
  7. package/dist/client/app/components/StoryListItem.vue +34 -0
  8. package/dist/client/app/components/StoryVariantGridItem.vue +56 -0
  9. package/dist/client/app/components/StoryVariantItem.vue +29 -0
  10. package/dist/client/app/components/StoryVariantSingleView.vue +43 -0
  11. package/dist/client/app/components/StoryView.vue +132 -0
  12. package/dist/client/app/components/base/BaseEmpty.vue +5 -0
  13. package/dist/client/app/components/base/BaseSplitPane.vue +203 -0
  14. package/dist/client/app/components/exposed/Story.vue +77 -0
  15. package/dist/client/app/components/exposed/Variant.vue +75 -0
  16. package/dist/client/app/composable/variant.d.ts +18 -0
  17. package/dist/client/app/composable/variant.js +18 -0
  18. package/dist/client/app/composable/variant.js.map +1 -0
  19. package/dist/client/app/global-components.d.ts +2 -0
  20. package/dist/client/app/global-components.js +9 -0
  21. package/dist/client/app/global-components.js.map +1 -0
  22. package/dist/client/app/index.d.ts +1 -0
  23. package/dist/client/app/index.js +14 -0
  24. package/dist/client/app/index.js.map +1 -0
  25. package/dist/client/app/router.d.ts +1 -0
  26. package/dist/client/app/router.js +17 -0
  27. package/dist/client/app/router.js.map +1 -0
  28. package/dist/client/app/stores/story.d.ts +161 -0
  29. package/dist/client/app/stores/story.js +29 -0
  30. package/dist/client/app/stores/story.js.map +1 -0
  31. package/dist/client/app/style/floating-vue.css +1 -0
  32. package/dist/client/app/style/main.css +37 -0
  33. package/dist/client/app/types.d.ts +20 -0
  34. package/dist/client/app/types.js +2 -0
  35. package/dist/client/app/types.js.map +1 -0
  36. package/dist/node/alias.d.ts +2 -0
  37. package/dist/node/alias.js +6 -0
  38. package/dist/node/alias.js.map +1 -0
  39. package/dist/node/bin.d.ts +1 -0
  40. package/dist/node/bin.js +17 -0
  41. package/dist/node/bin.js.map +1 -0
  42. package/dist/node/commands/dev.d.ts +4 -0
  43. package/dist/node/commands/dev.js +15 -0
  44. package/dist/node/commands/dev.js.map +1 -0
  45. package/dist/node/config.d.ts +4 -0
  46. package/dist/node/config.js +2 -0
  47. package/dist/node/config.js.map +1 -0
  48. package/dist/node/context.d.ts +4 -0
  49. package/dist/node/context.js +2 -0
  50. package/dist/node/context.js.map +1 -0
  51. package/dist/node/index.d.ts +0 -0
  52. package/dist/node/index.js +2 -0
  53. package/dist/node/index.js.map +1 -0
  54. package/dist/node/plugin.d.ts +5 -0
  55. package/dist/node/plugin.js +83 -0
  56. package/dist/node/plugin.js.map +1 -0
  57. package/dist/node/server.d.ts +2 -0
  58. package/dist/node/server.js +36 -0
  59. package/dist/node/server.js.map +1 -0
  60. package/dist/node/stories.d.ts +10 -0
  61. package/dist/node/stories.js +43 -0
  62. package/dist/node/stories.js.map +1 -0
  63. package/dist/style.css +607 -0
  64. package/package.json +60 -0
  65. package/postcss.config.cjs +8 -0
  66. package/scripts/watchAndCopy.mjs +15 -0
  67. package/src/client/app/App.vue +51 -0
  68. package/src/client/app/components/HomeView.vue +3 -0
  69. package/src/client/app/components/SandboxVue.vue +57 -0
  70. package/src/client/app/components/StoryControls.vue +29 -0
  71. package/src/client/app/components/StoryList.vue +22 -0
  72. package/src/client/app/components/StoryListItem.vue +34 -0
  73. package/src/client/app/components/StoryVariantGridItem.vue +56 -0
  74. package/src/client/app/components/StoryVariantItem.vue +29 -0
  75. package/src/client/app/components/StoryVariantSingleView.vue +43 -0
  76. package/src/client/app/components/StoryView.vue +132 -0
  77. package/src/client/app/components/base/BaseEmpty.vue +5 -0
  78. package/src/client/app/components/base/BaseSplitPane.vue +203 -0
  79. package/src/client/app/components/exposed/Story.vue +77 -0
  80. package/src/client/app/components/exposed/Variant.vue +75 -0
  81. package/src/client/app/composable/variant.ts +20 -0
  82. package/src/client/app/global-components.ts +10 -0
  83. package/src/client/app/index.ts +15 -0
  84. package/src/client/app/router.ts +17 -0
  85. package/src/client/app/stores/story.ts +34 -0
  86. package/src/client/app/style/floating-vue.css +1 -0
  87. package/src/client/app/style/main.css +37 -0
  88. package/src/client/app/types.ts +21 -0
  89. package/src/client/shim.d.ts +5 -0
  90. package/src/node/alias.ts +7 -0
  91. package/src/node/bin.ts +21 -0
  92. package/src/node/commands/dev.ts +21 -0
  93. package/src/node/config.ts +4 -0
  94. package/src/node/context.ts +5 -0
  95. package/src/node/index.ts +0 -0
  96. package/src/node/plugin.ts +92 -0
  97. package/src/node/server.ts +37 -0
  98. package/src/node/stories.ts +55 -0
  99. package/tailwind.config.cjs +9 -0
  100. package/tsconfig.json +39 -0
@@ -0,0 +1,51 @@
1
+ <script lang="ts" setup>
2
+ // @ts-expect-error virtual module
3
+ import { files as rawFiles, onUpdate } from '$histoire-stories'
4
+ import { useStoryStore } from './stores/story'
5
+ import StoryList from './components/StoryList.vue'
6
+ import BaseSplitPane from './components/base/BaseSplitPane.vue'
7
+ import { shallowRef } from 'vue'
8
+
9
+ const storyStore = useStoryStore()
10
+
11
+ const files = shallowRef(rawFiles)
12
+
13
+ onUpdate((newValue) => {
14
+ files.value = newValue
15
+ })
16
+ </script>
17
+
18
+ <template>
19
+ <div class="htw-hidden">
20
+ <template
21
+ v-for="storyData of files"
22
+ :key="storyData.id"
23
+ >
24
+ <component
25
+ :is="storyData.component"
26
+ :data="storyData"
27
+ />
28
+ </template>
29
+ </div>
30
+
31
+ <div class="htw-h-full">
32
+ <BaseSplitPane
33
+ save-id="main-horiz"
34
+ :min="5"
35
+ :max="50"
36
+ :default-split="15"
37
+ class="htw-h-full"
38
+ >
39
+ <template #first>
40
+ <StoryList
41
+ :stories="storyStore.stories"
42
+ class="htw-h-full"
43
+ />
44
+ </template>
45
+
46
+ <template #last>
47
+ <RouterView />
48
+ </template>
49
+ </BaseSplitPane>
50
+ </div>
51
+ </template>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ Home
3
+ </template>
@@ -0,0 +1,57 @@
1
+ <script lang="ts" setup>
2
+ import { App, createApp, onMounted, onUnmounted, PropType, ref } from 'vue'
3
+ import { Story, Variant } from '../types'
4
+
5
+ const props = defineProps({
6
+ variant: {
7
+ type: Object as PropType<Variant>,
8
+ required: true,
9
+ },
10
+
11
+ story: {
12
+ type: Object as PropType<Story>,
13
+ required: true,
14
+ },
15
+
16
+ slotName: {
17
+ type: String,
18
+ default: 'default',
19
+ },
20
+ })
21
+
22
+ const sandbox = ref<HTMLDivElement>()
23
+ let app: App
24
+ const appRenderForcer = ref(0)
25
+
26
+ onMounted(async () => {
27
+ await props.variant.initState()
28
+
29
+ app = createApp({
30
+ render: () => {
31
+ // eslint-disable-next-line no-unused-expressions
32
+ appRenderForcer.value
33
+ return props.variant.slots()?.[props.slotName]({
34
+ state: props.variant.state,
35
+ })
36
+ },
37
+ })
38
+ const target = document.createElement('div')
39
+ sandbox.value.appendChild(target)
40
+ app.mount(target)
41
+ })
42
+
43
+ onUnmounted(() => {
44
+ app.unmount()
45
+ })
46
+
47
+ function onReload () {
48
+ appRenderForcer.value++
49
+ }
50
+ </script>
51
+
52
+ <template>
53
+ <div
54
+ ref="sandbox"
55
+ class="__histoire-sandbox htw-overflow-auto"
56
+ />
57
+ </template>
@@ -0,0 +1,29 @@
1
+ <script lang="ts" setup>
2
+ import { PropType } from 'vue'
3
+ import { Story, Variant } from '../types'
4
+ import SandboxVue from './SandboxVue.vue'
5
+
6
+ defineProps({
7
+ variant: {
8
+ type: Object as PropType<Variant>,
9
+ required: true,
10
+ },
11
+
12
+ story: {
13
+ type: Object as PropType<Story>,
14
+ required: true,
15
+ },
16
+ })
17
+ </script>
18
+
19
+ <template>
20
+ <div>
21
+ <!-- Custom controls -->
22
+ <SandboxVue
23
+ v-if="variant.slots().controls"
24
+ slot-name="controls"
25
+ :variant="variant"
26
+ :story="story"
27
+ />
28
+ </div>
29
+ </template>
@@ -0,0 +1,22 @@
1
+ <script lang="ts" setup>
2
+ import { PropType } from 'vue'
3
+ import { Story } from '../types'
4
+ import StoryListItem from './StoryListItem.vue'
5
+
6
+ const props = defineProps({
7
+ stories: {
8
+ type: Array as PropType<Story[]>,
9
+ required: true,
10
+ },
11
+ })
12
+ </script>
13
+
14
+ <template>
15
+ <div class="htw-overflow-y-auto">
16
+ <StoryListItem
17
+ v-for="story of stories"
18
+ :key="story.id"
19
+ :story="story"
20
+ />
21
+ </div>
22
+ </template>
@@ -0,0 +1,34 @@
1
+ <script lang="ts" setup>
2
+ import { PropType } from 'vue'
3
+ import { Story } from '../types'
4
+
5
+ defineProps({
6
+ story: {
7
+ type: Object as PropType<Story>,
8
+ required: true,
9
+ },
10
+ })
11
+ </script>
12
+
13
+ <template>
14
+ <div>
15
+ <RouterLink
16
+ :to="{
17
+ name: 'story',
18
+ params: {
19
+ storyId: story.id,
20
+ },
21
+ }"
22
+ class="htw-p-2 htw-flex htw-space-x-2 hover:htw-bg-primary-100 dark:htw-bg-primary-900"
23
+ active-class="htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white htw-font-bold"
24
+ >
25
+ <span>
26
+ {{ story.title }}
27
+ </span>
28
+
29
+ <span class="htw-opacity-40 htw-text-sm">
30
+ {{ story.variants.length }}
31
+ </span>
32
+ </RouterLink>
33
+ </div>
34
+ </template>
@@ -0,0 +1,56 @@
1
+ <script lang="ts" setup>
2
+ import { PropType, toRefs } from 'vue'
3
+ import { useCurrentVariantRoute } from '../composable/variant'
4
+ import { Story, Variant } from '../types'
5
+ import SandboxVue from './SandboxVue.vue'
6
+
7
+ const props = defineProps({
8
+ variant: {
9
+ type: Object as PropType<Variant>,
10
+ required: true,
11
+ },
12
+
13
+ story: {
14
+ type: Object as PropType<Story>,
15
+ required: true,
16
+ },
17
+ })
18
+
19
+ const { variant } = toRefs(props)
20
+ const { isActive, targetRoute } = useCurrentVariantRoute(variant)
21
+ </script>
22
+
23
+ <template>
24
+ <RouterLink
25
+ :to="targetRoute"
26
+ class="htw-cursor-default htw-flex htw-flex-col htw-space-y-1"
27
+ >
28
+ <!-- Header -->
29
+ <div>
30
+ <div
31
+ :to="targetRoute"
32
+ class="htw-rounded htw-w-max htw-px-1.5 htw-cursor-pointer"
33
+ :class="{
34
+ 'hover:htw-bg-gray-200 htw-text-gray-500': !isActive,
35
+ 'htw-bg-primary-200 hover:htw-bg-primary-300 htw-text-primary-800': isActive,
36
+ }"
37
+ >
38
+ {{ variant.title }}
39
+ </div>
40
+ </div>
41
+
42
+ <!-- Body -->
43
+ <div
44
+ class="htw-border htw-border-gray-100 htw-bg-white htw-rounded-lg htw-h-full htw-p-4"
45
+ :class="{
46
+ 'htw-border-primary-200': isActive,
47
+ }"
48
+ @click.stop.prevent
49
+ >
50
+ <SandboxVue
51
+ :variant="variant"
52
+ :story="story"
53
+ />
54
+ </div>
55
+ </RouterLink>
56
+ </template>
@@ -0,0 +1,29 @@
1
+ <script lang="ts" setup>
2
+ import { PropType, toRefs } from 'vue'
3
+ import { useCurrentVariantRoute } from '../composable/variant'
4
+ import { Variant } from '../types'
5
+
6
+ const props = defineProps({
7
+ variant: {
8
+ type: Object as PropType<Variant>,
9
+ required: true,
10
+ },
11
+ })
12
+
13
+ const { variant } = toRefs(props)
14
+ const { isActive, targetRoute } = useCurrentVariantRoute(variant)
15
+ </script>
16
+
17
+ <template>
18
+ <div>
19
+ <RouterLink
20
+ :to="targetRoute"
21
+ class="htw-p-2 htw-flex htw-space-x-2 hover:htw-bg-primary-100 dark:htw-bg-primary-900"
22
+ :class="{
23
+ 'htw-bg-primary-200 hover:htw-bg-primary-300 htw-text-primary-800': isActive,
24
+ }"
25
+ >
26
+ {{ variant.title }}
27
+ </RouterLink>
28
+ </div>
29
+ </template>
@@ -0,0 +1,43 @@
1
+ <script lang="ts" setup>
2
+ import { PropType } from 'vue'
3
+ import { Story, Variant } from '../types'
4
+ import SandboxVue from './SandboxVue.vue'
5
+ import BaseSplitPane from './base/BaseSplitPane.vue'
6
+
7
+ defineProps({
8
+ variant: {
9
+ type: Object as PropType<Variant>,
10
+ required: true,
11
+ },
12
+
13
+ story: {
14
+ type: Object as PropType<Story>,
15
+ required: true,
16
+ },
17
+ })
18
+ </script>
19
+
20
+ <template>
21
+ <div class="htw-border htw-border-gray-100 htw-rounded-lg htw-h-full">
22
+ <BaseSplitPane
23
+ save-id="story-single-responsive"
24
+ :min="1"
25
+ :max="99"
26
+ :default-split="99"
27
+ dragger-offset="before"
28
+ class="htw-w-full"
29
+ >
30
+ <template #first>
31
+ <div class="htw-p-4 htw-h-full htw-overflow-auto htw-bg-white htw-rounded-l-lg">
32
+ <SandboxVue
33
+ :variant="variant"
34
+ :story="story"
35
+ />
36
+ </div>
37
+ </template>
38
+ <template #last>
39
+ <div class="htw-w-full htw-h-full htw-bg-gray-200 dark:htw-bg-gray-800 htw-rounded-r-lg htw-border-l-2 htw-border-gray-500/10" />
40
+ </template>
41
+ </BaseSplitPane>
42
+ </div>
43
+ </template>
@@ -0,0 +1,132 @@
1
+ <script lang="ts" setup>
2
+ import { useStoryStore } from '../stores/story'
3
+ import BaseSplitPane from './base/BaseSplitPane.vue'
4
+ import StoryVariantItem from './StoryVariantItem.vue'
5
+ import StoryVariantGridItem from './StoryVariantGridItem.vue'
6
+ import { computed, watch } from 'vue'
7
+ import { useRoute, useRouter } from 'vue-router'
8
+ import StoryVariantSingleView from './StoryVariantSingleView.vue'
9
+ import BaseEmpty from './base/BaseEmpty.vue'
10
+ import StoryControls from './StoryControls.vue'
11
+
12
+ const storyStore = useStoryStore()
13
+
14
+ // Selected variant
15
+
16
+ const route = useRoute()
17
+
18
+ const currentVariant = computed(() => storyStore.currentStory?.variants.find(v => v.id === route.query.variantId))
19
+
20
+ // Restore variant selection
21
+
22
+ watch(currentVariant, value => {
23
+ if (value) {
24
+ storyStore.currentStory.lastSelectedVariant = value
25
+ }
26
+ }, {
27
+ immediate: true,
28
+ })
29
+
30
+ const router = useRouter()
31
+
32
+ watch(() => storyStore.currentStory, () => {
33
+ if (!currentVariant.value && storyStore.currentStory?.lastSelectedVariant) {
34
+ router.replace({
35
+ ...route,
36
+ query: {
37
+ ...route.query,
38
+ variantId: storyStore.currentStory.lastSelectedVariant.id,
39
+ },
40
+ })
41
+ }
42
+ })
43
+ </script>
44
+
45
+ <template>
46
+ <BaseEmpty v-if="!storyStore.currentStory">
47
+ <span>Story not found</span>
48
+ </BaseEmpty>
49
+
50
+ <div
51
+ v-else
52
+ :key="storyStore.currentStory.mountTime"
53
+ class="htw-h-full"
54
+ >
55
+ <BaseSplitPane
56
+ save-id="story-main"
57
+ :min="30"
58
+ :max="95"
59
+ :default-split="75"
60
+ class="htw-h-full"
61
+ >
62
+ <template #first>
63
+ <div class="htw-bg-gray-50 htw-h-full">
64
+ <div
65
+ v-if="storyStore.currentStory.layout.type === 'grid'"
66
+ class="htw-bg-gray-50 htw-h-full htw-overflow-y-auto"
67
+ >
68
+ <div
69
+ class="htw-grid htw-gap-4 htw-m-4"
70
+ :style="{
71
+ gridTemplateColumns: `repeat(auto-fill, ${storyStore.currentStory.layout.width ?? 200}px)`,
72
+ }"
73
+ >
74
+ <StoryVariantGridItem
75
+ v-for="(variant, index) of storyStore.currentStory.variants"
76
+ :key="index"
77
+ :variant="variant"
78
+ :story="storyStore.currentStory"
79
+ />
80
+ </div>
81
+ </div>
82
+
83
+ <BaseSplitPane
84
+ v-else-if="storyStore.currentStory.layout.type === 'single'"
85
+ save-id="story-single-main-split"
86
+ :min="5"
87
+ :max="40"
88
+ :default-split="17"
89
+ >
90
+ <template #first>
91
+ <div class="htw-bg-white htw-h-full htw-overflow-y-auto">
92
+ <StoryVariantItem
93
+ v-for="(variant, index) of storyStore.currentStory.variants"
94
+ :key="index"
95
+ :variant="variant"
96
+ />
97
+ </div>
98
+ </template>
99
+
100
+ <template #last>
101
+ <div
102
+ v-if="currentVariant"
103
+ class="htw-p-2 htw-h-full"
104
+ >
105
+ <StoryVariantSingleView
106
+ :variant="currentVariant"
107
+ :story="storyStore.currentStory"
108
+ />
109
+ </div>
110
+ </template>
111
+ </BaseSplitPane>
112
+ </div>
113
+ </template>
114
+
115
+ <template #last>
116
+ <BaseEmpty v-if="!currentVariant">
117
+ <span>Select a variant</span>
118
+ </BaseEmpty>
119
+
120
+ <div
121
+ v-else
122
+ class="htw-h-full"
123
+ >
124
+ <StoryControls
125
+ :story="storyStore.currentStory"
126
+ :variant="currentVariant"
127
+ />
128
+ </div>
129
+ </template>
130
+ </BaseSplitPane>
131
+ </div>
132
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="htw-flex htw-flex-col htw-items-center htw-justify-center htw-space-y-4 htw-py-12 htw-h-full htw-text-center htw-text-gray-400 dark:htw-text-gray-600 htw-text-lg">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,203 @@
1
+ <script lang="ts" setup>
2
+ import { ref, computed, watch, onUnmounted } from 'vue'
3
+
4
+ const SAVE_PREFIX = '__histoire'
5
+
6
+ const props = defineProps({
7
+ orientation: {
8
+ type: String,
9
+ default: 'landscape',
10
+ validator: (value: string) => ['landscape', 'portrait'].includes(value),
11
+ },
12
+
13
+ defaultSplit: {
14
+ type: Number,
15
+ default: 50,
16
+ },
17
+
18
+ min: {
19
+ type: Number,
20
+ default: 20,
21
+ },
22
+
23
+ max: {
24
+ type: Number,
25
+ default: 80,
26
+ },
27
+
28
+ draggerOffset: {
29
+ type: String,
30
+ default: 'center',
31
+ validator: (value: string) => ['before', 'center', 'after'].includes(value),
32
+ },
33
+
34
+ saveId: {
35
+ type: String,
36
+ default: null,
37
+ },
38
+ })
39
+
40
+ const split = ref(props.defaultSplit)
41
+
42
+ if (props.saveId) {
43
+ const storageKey = `${SAVE_PREFIX}-split-pane-${props.saveId}`
44
+
45
+ const savedValue = localStorage.getItem(storageKey)
46
+ if (savedValue != null) {
47
+ let parsedValue
48
+ try {
49
+ parsedValue = JSON.parse(savedValue)
50
+ } catch (e) {
51
+ console.error(e)
52
+ }
53
+
54
+ if (typeof parsedValue === 'number') {
55
+ split.value = parsedValue
56
+ }
57
+ }
58
+
59
+ watch(split, value => {
60
+ localStorage.setItem(storageKey, JSON.stringify(value))
61
+ })
62
+ }
63
+
64
+ const boundSplit = computed(() => {
65
+ if (split.value < props.min) {
66
+ return props.min
67
+ } else if (split.value > props.max) {
68
+ return props.max
69
+ } else {
70
+ return split.value
71
+ }
72
+ })
73
+
74
+ const leftStyle = computed(() => ({
75
+ [props.orientation === 'landscape' ? 'width' : 'height']: `${boundSplit.value}%`,
76
+ }))
77
+
78
+ const rightStyle = computed(() => ({
79
+ [props.orientation === 'landscape' ? 'width' : 'height']: `${100 - boundSplit.value}%`,
80
+ }))
81
+
82
+ const dragging = ref(false)
83
+ let startPosition = 0
84
+ let startSplit = 0
85
+ const el = ref(null)
86
+
87
+ function dragStart (e) {
88
+ dragging.value = true
89
+ startPosition = props.orientation === 'landscape' ? e.pageX : e.pageY
90
+ startSplit = boundSplit.value
91
+ window.addEventListener('mousemove', dragMove)
92
+ window.addEventListener('mouseup', dragEnd)
93
+ }
94
+
95
+ function dragMove (e) {
96
+ if (dragging.value) {
97
+ let position
98
+ let totalSize
99
+ if (props.orientation === 'landscape') {
100
+ position = e.pageX
101
+ totalSize = el.value.offsetWidth
102
+ } else {
103
+ position = e.pageY
104
+ totalSize = el.value.offsetHeight
105
+ }
106
+ const dPosition = position - startPosition
107
+ split.value = startSplit + ~~(dPosition / totalSize * 200) / 2
108
+ }
109
+ }
110
+
111
+ function dragEnd () {
112
+ dragging.value = false
113
+ removeDragListeners()
114
+ }
115
+
116
+ function removeDragListeners () {
117
+ window.removeEventListener('mousemove', dragMove)
118
+ window.removeEventListener('mouseup', dragEnd)
119
+ }
120
+
121
+ onUnmounted(() => {
122
+ removeDragListeners()
123
+ })
124
+ </script>
125
+
126
+ <template>
127
+ <div
128
+ ref="el"
129
+ class="htw-flex htw-h-full htw-isolate"
130
+ :class="{
131
+ 'htw-flex-col': orientation === 'portrait',
132
+ 'htw-cursor-ew-resize': dragging && orientation === 'landscape',
133
+ 'htw-cursor-ns-resize': dragging && orientation === 'portrait',
134
+ [orientation]: true
135
+ }"
136
+ >
137
+ <div
138
+ class="htw-relative htw-top-0 htw-left-0 htw-z-20"
139
+ :class="{
140
+ 'htw-pointer-events-none': dragging,
141
+ 'htw-border-r htw-border-gray-200 dark:htw-border-gray-800': orientation === 'landscape'
142
+ }"
143
+ :style="leftStyle"
144
+ >
145
+ <slot name="first" />
146
+
147
+ <div
148
+ class="dragger htw-absolute htw-z-100 hover:htw-bg-primary-500/25 htw-transition-colors htw-duration-150 htw-delay-150"
149
+ :class="{
150
+ 'htw-top-0 htw-bottom-0 htw-cursor-ew-resize': orientation === 'landscape',
151
+ 'htw-left-0 htw-right-0 htw-cursor-ns-resize': orientation === 'portrait',
152
+ [`dragger-offset-${draggerOffset}`]: true,
153
+ 'htw-bg-primary-500/25': dragging,
154
+ }"
155
+ @mousedown.prevent="dragStart"
156
+ />
157
+ </div>
158
+ <div
159
+ class="htw-relative htw-bottom-0 htw-right-0"
160
+ :class="{
161
+ 'htw-pointer-events-none': dragging,
162
+ 'htw-border-t htw-border-gray-200 dark:htw-border-gray-800': orientation === 'portrait'
163
+ }"
164
+ :style="rightStyle"
165
+ >
166
+ <slot name="last" />
167
+ </div>
168
+ </div>
169
+ </template>
170
+
171
+ <style lang="postcss" scoped>
172
+ .landscape .dragger {
173
+ width: 10px;
174
+ }
175
+
176
+ .portrait .dragger {
177
+ height: 10px;
178
+ }
179
+
180
+ .landscape .dragger.dragger-offset-before {
181
+ right: 0;
182
+ }
183
+
184
+ .portrait .dragger.dragger-offset-before {
185
+ bottom: 0;
186
+ }
187
+
188
+ .landscape .dragger.dragger-offset-center {
189
+ right: -5px;
190
+ }
191
+
192
+ .portrait .dragger.dragger-offset-center {
193
+ bottom: -5px;
194
+ }
195
+
196
+ .landscape .dragger.dragger-offset-after {
197
+ right: -10px;
198
+ }
199
+
200
+ .portrait .dragger.dragger-offset-after {
201
+ bottom: -10px;
202
+ }
203
+ </style>