histoire 0.3.1 → 0.3.2

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 (96) hide show
  1. package/dist/client/app/codegen/vue3.js +1 -0
  2. package/dist/client/app/codegen/vue3.js.map +1 -0
  3. package/dist/client/app/components/base/BaseOverflowMenu.vue +118 -0
  4. package/dist/client/app/components/base/BaseOverflowTab.vue +46 -0
  5. package/dist/client/app/components/exposed/Story.vue +12 -1
  6. package/dist/client/app/components/exposed/Variant.vue +6 -0
  7. package/dist/client/app/components/panel/PaneTabs.vue +64 -0
  8. package/dist/client/app/components/{story → panel}/StoryControls.vue +1 -1
  9. package/dist/client/app/components/{story → panel}/StoryDocs.vue +0 -0
  10. package/dist/client/app/components/{story → panel}/StoryEvent.vue +0 -0
  11. package/dist/client/app/components/{story → panel}/StoryEvents.vue +0 -0
  12. package/dist/client/app/components/{story → panel}/StorySidePanel.vue +3 -31
  13. package/dist/client/app/components/{story → panel}/StorySourceCode.vue +0 -0
  14. package/dist/client/app/components/sandbox/SandboxVue3.vue +10 -0
  15. package/dist/client/app/components/search/search-data.js +1 -0
  16. package/dist/client/app/components/search/search-data.js.map +1 -0
  17. package/dist/client/app/components/story/StoryResponsivePreview.vue +9 -131
  18. package/dist/client/app/components/story/StoryVariantSingle.vue +109 -0
  19. package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +39 -0
  20. package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +153 -0
  21. package/dist/client/app/components/story/StoryVariantSingleView.vue +13 -6
  22. package/dist/client/app/components/story/StoryView.vue +2 -2
  23. package/dist/client/app/components/story/StoryViewer.vue +2 -92
  24. package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantBackground.vue +3 -3
  25. package/dist/client/app/components/{story/toolbar → toolbar}/StoryVariantNewTab.vue +2 -2
  26. package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantResponsiveSize.vue +3 -3
  27. package/{src/client/app/components/story → dist/client/app/components}/toolbar/StoryVariantTitle.vue +1 -1
  28. package/dist/client/app/global-components.js +1 -0
  29. package/dist/client/app/global-components.js.map +1 -0
  30. package/dist/client/app/index.js +1 -0
  31. package/dist/client/app/index.js.map +1 -0
  32. package/dist/client/app/sandbox.js +1 -0
  33. package/dist/client/app/sandbox.js.map +1 -0
  34. package/dist/client/app/stores/events.d.ts +1 -1
  35. package/dist/client/app/stores/events.js +1 -0
  36. package/dist/client/app/stores/events.js.map +1 -0
  37. package/dist/client/app/stores/folder.js +1 -0
  38. package/dist/client/app/stores/folder.js.map +1 -0
  39. package/dist/client/app/stores/story.d.ts +27 -0
  40. package/dist/client/app/stores/story.js +1 -0
  41. package/dist/client/app/stores/story.js.map +1 -0
  42. package/dist/client/app/style/transitions.pcss +13 -0
  43. package/dist/client/app/types.d.ts +3 -0
  44. package/dist/client/app/types.js +1 -0
  45. package/dist/client/app/types.js.map +1 -0
  46. package/dist/client/app/util/events.js +1 -0
  47. package/dist/client/app/util/events.js.map +1 -0
  48. package/dist/client/app/util/keyboard.js +1 -0
  49. package/dist/client/app/util/keyboard.js.map +1 -0
  50. package/dist/client/app/util/mapping.js +3 -0
  51. package/dist/client/app/util/mapping.js.map +1 -0
  52. package/dist/client/app/util/preview-settings.js +1 -0
  53. package/dist/client/app/util/preview-settings.js.map +1 -0
  54. package/dist/client/app/util/reactivity.js +1 -0
  55. package/dist/client/app/util/reactivity.js.map +1 -0
  56. package/dist/client/app/util/scroll.js +1 -0
  57. package/dist/client/app/util/scroll.js.map +1 -0
  58. package/dist/client/app/util/variant.js +1 -0
  59. package/dist/client/app/util/variant.js.map +1 -0
  60. package/dist/client/index.js +1 -0
  61. package/dist/client/index.js.map +1 -0
  62. package/dist/client/server/vue3/Story.vue +1 -1
  63. package/dist/client/server/vue3/run.js +1 -0
  64. package/dist/client/server/vue3/run.js.map +1 -0
  65. package/dist/controls.js +1 -0
  66. package/dist/controls.js.map +1 -0
  67. package/dist/style.css +93 -69
  68. package/package.json +2 -2
  69. package/src/client/app/components/base/BaseOverflowMenu.vue +118 -0
  70. package/src/client/app/components/base/BaseOverflowTab.vue +46 -0
  71. package/src/client/app/components/exposed/Story.vue +12 -1
  72. package/src/client/app/components/exposed/Variant.vue +6 -0
  73. package/src/client/app/components/panel/PaneTabs.vue +64 -0
  74. package/src/client/app/components/{story → panel}/StoryControls.vue +1 -1
  75. package/src/client/app/components/{story → panel}/StoryDocs.vue +0 -0
  76. package/src/client/app/components/{story → panel}/StoryEvent.vue +0 -0
  77. package/src/client/app/components/{story → panel}/StoryEvents.vue +0 -0
  78. package/src/client/app/components/{story → panel}/StorySidePanel.vue +3 -31
  79. package/src/client/app/components/{story → panel}/StorySourceCode.vue +0 -0
  80. package/src/client/app/components/sandbox/SandboxVue3.vue +10 -0
  81. package/src/client/app/components/story/StoryResponsivePreview.vue +9 -131
  82. package/src/client/app/components/story/StoryVariantSingle.vue +109 -0
  83. package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +39 -0
  84. package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +153 -0
  85. package/src/client/app/components/story/StoryVariantSingleView.vue +13 -6
  86. package/src/client/app/components/story/StoryView.vue +2 -2
  87. package/src/client/app/components/story/StoryViewer.vue +2 -92
  88. package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantBackground.vue +3 -3
  89. package/src/client/app/components/{story/toolbar → toolbar}/StoryVariantNewTab.vue +2 -2
  90. package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantResponsiveSize.vue +3 -3
  91. package/{dist/client/app/components/story → src/client/app/components}/toolbar/StoryVariantTitle.vue +1 -1
  92. package/src/client/app/sandbox.ts +1 -1
  93. package/src/client/app/style/transitions.pcss +13 -0
  94. package/src/client/app/types.ts +4 -0
  95. package/src/client/app/util/mapping.ts +2 -0
  96. package/src/client/server/vue3/Story.vue +1 -1
package/dist/style.css CHANGED
@@ -257,6 +257,17 @@
257
257
  opacity: 0;
258
258
  }
259
259
 
260
+ .__histoire-scale-y-enter-active,
261
+ .__histoire-scale-y-leave-active {
262
+ transition: transform .15s, opacity .15s;
263
+ }
264
+
265
+ .__histoire-scale-y-enter-from,
266
+ .__histoire-scale-y-leave-to {
267
+ transform: scaleY(0);
268
+ opacity: 0;
269
+ }
270
+
260
271
  .__histoire-fade-enter-active,
261
272
  .__histoire-fade-leave-active {
262
273
  transition: transform .15s, opacity .15s;
@@ -923,6 +934,10 @@ button {
923
934
  margin-left:auto
924
935
  }
925
936
 
937
+ .htw-mb-6{
938
+ margin-bottom:1.5rem
939
+ }
940
+
926
941
  .htw-mt-0\.5{
927
942
  margin-top:0.125rem
928
943
  }
@@ -931,10 +946,6 @@ button {
931
946
  margin-top:0px
932
947
  }
933
948
 
934
- .htw-mb-6{
935
- margin-bottom:1.5rem
936
- }
937
-
938
949
  .-htw-mt-1{
939
950
  margin-top:-0.25rem
940
951
  }
@@ -1007,14 +1018,18 @@ button {
1007
1018
  height:16px
1008
1019
  }
1009
1020
 
1010
- .htw-h-\[2px\]{
1011
- height:2px
1012
- }
1013
-
1014
1021
  .htw-h-4{
1015
1022
  height:1rem
1016
1023
  }
1017
1024
 
1025
+ .htw-h-10{
1026
+ height:2.5rem
1027
+ }
1028
+
1029
+ .htw-h-\[2px\]{
1030
+ height:2px
1031
+ }
1032
+
1018
1033
  .htw-h-\[51px\]{
1019
1034
  height:51px
1020
1035
  }
@@ -1033,10 +1048,6 @@ button {
1033
1048
  height:1px
1034
1049
  }
1035
1050
 
1036
- .htw-h-10{
1037
- height:2.5rem
1038
- }
1039
-
1040
1051
  .htw-h-\[1px\]{
1041
1052
  height:1px
1042
1053
  }
@@ -1097,6 +1108,10 @@ button {
1097
1108
  width:1rem
1098
1109
  }
1099
1110
 
1111
+ .htw-w-\[2px\]{
1112
+ width:2px
1113
+ }
1114
+
1100
1115
  .htw-w-fit{
1101
1116
  width:-webkit-fit-content;
1102
1117
  width:-moz-fit-content;
@@ -1133,6 +1148,10 @@ button {
1133
1148
  width:8rem
1134
1149
  }
1135
1150
 
1151
+ .htw-min-w-\[150px\]{
1152
+ min-width:150px
1153
+ }
1154
+
1136
1155
  .htw-min-w-4{
1137
1156
  min-width:1rem
1138
1157
  }
@@ -1149,10 +1168,6 @@ button {
1149
1168
  max-width:100%
1150
1169
  }
1151
1170
 
1152
- .htw-max-w-\[512px\]{
1153
- max-width:512px
1154
- }
1155
-
1156
1171
  .htw-max-w-none{
1157
1172
  max-width:none
1158
1173
  }
@@ -1161,6 +1176,10 @@ button {
1161
1176
  max-width:400px
1162
1177
  }
1163
1178
 
1179
+ .htw-max-w-\[512px\]{
1180
+ max-width:512px
1181
+ }
1182
+
1164
1183
  .htw-flex-none{
1165
1184
  flex:none
1166
1185
  }
@@ -1341,14 +1360,14 @@ button {
1341
1360
  border-radius:0.25rem
1342
1361
  }
1343
1362
 
1344
- .htw-rounded-lg{
1345
- border-radius:0.75rem
1346
- }
1347
-
1348
1363
  .htw-rounded-full{
1349
1364
  border-radius:9999px
1350
1365
  }
1351
1366
 
1367
+ .htw-rounded-lg{
1368
+ border-radius:0.75rem
1369
+ }
1370
+
1352
1371
  .htw-rounded{
1353
1372
  border-radius:0.375rem
1354
1373
  }
@@ -1463,17 +1482,22 @@ button {
1463
1482
  background-color:rgb(var(--_histoire-color-primary-500) / 0.25)
1464
1483
  }
1465
1484
 
1466
- .htw-bg-white\/80{
1467
- background-color:rgb(255 255 255 / 0.8)
1485
+ .htw-bg-primary-50{
1486
+ --tw-bg-opacity:1;
1487
+ background-color:rgb(var(--_histoire-color-primary-50) / var(--tw-bg-opacity))
1488
+ }
1489
+
1490
+ .htw-bg-gray-100{
1491
+ --tw-bg-opacity:1;
1492
+ background-color:rgb(var(--_histoire-color-gray-100) / var(--tw-bg-opacity))
1468
1493
  }
1469
1494
 
1470
1495
  .htw-bg-transparent{
1471
1496
  background-color:transparent
1472
1497
  }
1473
1498
 
1474
- .htw-bg-primary-50{
1475
- --tw-bg-opacity:1;
1476
- background-color:rgb(var(--_histoire-color-primary-50) / var(--tw-bg-opacity))
1499
+ .htw-bg-white\/80{
1500
+ background-color:rgb(255 255 255 / 0.8)
1477
1501
  }
1478
1502
 
1479
1503
  .htw-bg-gray-200{
@@ -1481,11 +1505,6 @@ button {
1481
1505
  background-color:rgb(var(--_histoire-color-gray-200) / var(--tw-bg-opacity))
1482
1506
  }
1483
1507
 
1484
- .htw-bg-gray-100{
1485
- --tw-bg-opacity:1;
1486
- background-color:rgb(var(--_histoire-color-gray-100) / var(--tw-bg-opacity))
1487
- }
1488
-
1489
1508
  .htw-bg-primary-200{
1490
1509
  --tw-bg-opacity:1;
1491
1510
  background-color:rgb(var(--_histoire-color-primary-200) / var(--tw-bg-opacity))
@@ -1549,16 +1568,6 @@ button {
1549
1568
  padding-bottom:3rem
1550
1569
  }
1551
1570
 
1552
- .htw-py-4{
1553
- padding-top:1rem;
1554
- padding-bottom:1rem
1555
- }
1556
-
1557
- .htw-py-2{
1558
- padding-top:0.5rem;
1559
- padding-bottom:0.5rem
1560
- }
1561
-
1562
1571
  .htw-px-0\.5{
1563
1572
  padding-left:0.125rem;
1564
1573
  padding-right:0.125rem
@@ -1569,6 +1578,16 @@ button {
1569
1578
  padding-right:0px
1570
1579
  }
1571
1580
 
1581
+ .htw-py-2{
1582
+ padding-top:0.5rem;
1583
+ padding-bottom:0.5rem
1584
+ }
1585
+
1586
+ .htw-py-4{
1587
+ padding-top:1rem;
1588
+ padding-bottom:1rem
1589
+ }
1590
+
1572
1591
  .htw-px-2{
1573
1592
  padding-left:0.5rem;
1574
1593
  padding-right:0.5rem
@@ -1682,6 +1701,11 @@ button {
1682
1701
  color:rgb(var(--_histoire-color-gray-400) / var(--tw-text-opacity))
1683
1702
  }
1684
1703
 
1704
+ .htw-text-red-500{
1705
+ --tw-text-opacity:1;
1706
+ color:rgb(239 68 68 / var(--tw-text-opacity))
1707
+ }
1708
+
1685
1709
  .htw-text-black\/\[2\%\]{
1686
1710
  color:rgb(0 0 0 / 2%)
1687
1711
  }
@@ -1690,11 +1714,6 @@ button {
1690
1714
  color:rgb(var(--_histoire-color-gray-500) / 0.2)
1691
1715
  }
1692
1716
 
1693
- .htw-text-red-500{
1694
- --tw-text-opacity:1;
1695
- color:rgb(239 68 68 / var(--tw-text-opacity))
1696
- }
1697
-
1698
1717
  .htw-text-primary-800{
1699
1718
  --tw-text-opacity:1;
1700
1719
  color:rgb(var(--_histoire-color-primary-800) / var(--tw-text-opacity))
@@ -1712,14 +1731,14 @@ button {
1712
1731
  opacity:0.4
1713
1732
  }
1714
1733
 
1715
- .htw-opacity-60{
1716
- opacity:0.6
1717
- }
1718
-
1719
1734
  .htw-opacity-50{
1720
1735
  opacity:0.5
1721
1736
  }
1722
1737
 
1738
+ .htw-opacity-60{
1739
+ opacity:0.6
1740
+ }
1741
+
1723
1742
  .htw-opacity-30{
1724
1743
  opacity:0.3
1725
1744
  }
@@ -1853,15 +1872,15 @@ body {
1853
1872
  background-color:rgb(var(--_histoire-color-primary-600) / var(--tw-bg-opacity))
1854
1873
  }
1855
1874
 
1856
- .hover\:htw-bg-primary-500\/50:hover{
1857
- background-color:rgb(var(--_histoire-color-primary-500) / 0.5)
1858
- }
1859
-
1860
1875
  .hover\:htw-bg-primary-50:hover{
1861
1876
  --tw-bg-opacity:1;
1862
1877
  background-color:rgb(var(--_histoire-color-primary-50) / var(--tw-bg-opacity))
1863
1878
  }
1864
1879
 
1880
+ .hover\:htw-bg-primary-500\/50:hover{
1881
+ background-color:rgb(var(--_histoire-color-primary-500) / 0.5)
1882
+ }
1883
+
1865
1884
  .hover\:htw-bg-gray-200:hover{
1866
1885
  --tw-bg-opacity:1;
1867
1886
  background-color:rgb(var(--_histoire-color-gray-200) / var(--tw-bg-opacity))
@@ -1904,14 +1923,14 @@ body {
1904
1923
  background-color:rgb(var(--_histoire-color-primary-100) / var(--tw-bg-opacity))
1905
1924
  }
1906
1925
 
1907
- .htw-group:hover .group-hover\:htw-opacity-90{
1908
- opacity:0.9
1909
- }
1910
-
1911
1926
  .htw-group:hover .group-hover\:htw-opacity-100{
1912
1927
  opacity:1
1913
1928
  }
1914
1929
 
1930
+ .htw-group:hover .group-hover\:htw-opacity-90{
1931
+ opacity:0.9
1932
+ }
1933
+
1915
1934
  .htw-group:active .group-active\:htw-bg-gray-500\/20{
1916
1935
  background-color:rgb(var(--_histoire-color-gray-500) / 0.2)
1917
1936
  }
@@ -1959,15 +1978,15 @@ body {
1959
1978
  border-color:rgb(var(--_histoire-color-gray-850) / var(--tw-border-opacity))
1960
1979
  }
1961
1980
 
1962
- .htw-dark .dark\:htw-border-gray-700\/30{
1963
- border-color:rgb(var(--_histoire-color-gray-700) / 0.3)
1964
- }
1965
-
1966
1981
  .htw-dark .dark\:htw-border-gray-750{
1967
1982
  --tw-border-opacity:1;
1968
1983
  border-color:rgb(var(--_histoire-color-gray-750) / var(--tw-border-opacity))
1969
1984
  }
1970
1985
 
1986
+ .htw-dark .dark\:htw-border-gray-700\/30{
1987
+ border-color:rgb(var(--_histoire-color-gray-700) / 0.3)
1988
+ }
1989
+
1971
1990
  .htw-dark .dark\:htw-border-primary-900{
1972
1991
  --tw-border-opacity:1;
1973
1992
  border-color:rgb(var(--_histoire-color-primary-900) / var(--tw-border-opacity))
@@ -1991,23 +2010,23 @@ body {
1991
2010
  background-color:rgb(var(--_histoire-color-primary-400) / var(--tw-bg-opacity))
1992
2011
  }
1993
2012
 
1994
- .htw-dark .dark\:htw-bg-gray-700\/80{
1995
- background-color:rgb(var(--_histoire-color-gray-700) / 0.8)
1996
- }
1997
-
1998
2013
  .htw-dark .dark\:htw-bg-primary-600{
1999
2014
  --tw-bg-opacity:1;
2000
2015
  background-color:rgb(var(--_histoire-color-primary-600) / var(--tw-bg-opacity))
2001
2016
  }
2002
2017
 
2003
- .htw-dark .dark\:htw-bg-gray-850{
2018
+ .htw-dark .dark\:htw-bg-gray-800{
2004
2019
  --tw-bg-opacity:1;
2005
- background-color:rgb(var(--_histoire-color-gray-850) / var(--tw-bg-opacity))
2020
+ background-color:rgb(var(--_histoire-color-gray-800) / var(--tw-bg-opacity))
2006
2021
  }
2007
2022
 
2008
- .htw-dark .dark\:htw-bg-gray-800{
2023
+ .htw-dark .dark\:htw-bg-gray-700\/80{
2024
+ background-color:rgb(var(--_histoire-color-gray-700) / 0.8)
2025
+ }
2026
+
2027
+ .htw-dark .dark\:htw-bg-gray-850{
2009
2028
  --tw-bg-opacity:1;
2010
- background-color:rgb(var(--_histoire-color-gray-800) / var(--tw-bg-opacity))
2029
+ background-color:rgb(var(--_histoire-color-gray-850) / var(--tw-bg-opacity))
2011
2030
  }
2012
2031
 
2013
2032
  .htw-dark .dark\:htw-bg-primary-700{
@@ -2025,6 +2044,11 @@ body {
2025
2044
  background-color:rgb(0 0 0 / var(--tw-bg-opacity))
2026
2045
  }
2027
2046
 
2047
+ .htw-dark .dark\:htw-bg-gray-600{
2048
+ --tw-bg-opacity:1;
2049
+ background-color:rgb(var(--_histoire-color-gray-600) / var(--tw-bg-opacity))
2050
+ }
2051
+
2028
2052
  .htw-dark .dark\:htw-text-gray-100{
2029
2053
  --tw-text-opacity:1;
2030
2054
  color:rgb(var(--_histoire-color-gray-100) / var(--tw-text-opacity))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "histoire",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "A fast story book powered by Vite",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -33,7 +33,7 @@
33
33
  "histoire": "./bin.mjs"
34
34
  },
35
35
  "dependencies": {
36
- "@histoire/controls": "^0.3.1",
36
+ "@histoire/controls": "^0.3.2",
37
37
  "@iconify/vue": "^3.2.1",
38
38
  "@vitejs/plugin-vue": "^2.3.1",
39
39
  "@vueuse/core": "^8.2.5",
@@ -0,0 +1,118 @@
1
+ <script lang="ts" setup>
2
+ import { ref, h, onBeforeUnmount, reactive, computed } from 'vue'
3
+ import { useResizeObserver } from '@vueuse/core'
4
+ import { Icon } from '@iconify/vue'
5
+
6
+ // Container
7
+
8
+ const overflowButtonWidth = 32
9
+
10
+ const el = ref<HTMLDivElement>()
11
+
12
+ const availableWidth = ref(0)
13
+
14
+ useResizeObserver(el, (entries) => {
15
+ const containerWidth = entries[0].contentRect.width
16
+ availableWidth.value = containerWidth - overflowButtonWidth
17
+ })
18
+
19
+ // Children
20
+
21
+ interface ChildState {
22
+ width: number
23
+ index: number
24
+ }
25
+
26
+ const children = ref(new Map<HTMLElement, ChildState>())
27
+
28
+ const visibleChildrenCount = computed(() => {
29
+ let width = 0
30
+ const c = [...children.value.values()].sort((a, b) => a.index - b.index)
31
+ for (let i = 0; i < c.length; i++) {
32
+ width += c[i].width
33
+ if (width > availableWidth.value) {
34
+ return i
35
+ }
36
+ }
37
+ return c.length
38
+ })
39
+
40
+ /**
41
+ * Watches for the size of each child and automatically hide them
42
+ */
43
+ const ChildWrapper = {
44
+ props: ['index'],
45
+ setup (props, { slots }) {
46
+ const el = ref<HTMLDivElement>()
47
+
48
+ const state = reactive({ width: 0, index: props.index })
49
+
50
+ useResizeObserver(el, (entries) => {
51
+ const width = entries[0].contentRect.width
52
+ if (!children.value.has(el.value)) {
53
+ children.value.set(el.value, state)
54
+ }
55
+ state.width = width
56
+ })
57
+
58
+ onBeforeUnmount(() => {
59
+ children.value.delete(el.value)
60
+ })
61
+
62
+ const visible = computed(() => visibleChildrenCount.value > state.index)
63
+
64
+ return () => h('div', { ref: el, style: { visibility: visible.value ? 'visible' : 'hidden' } }, slots.default())
65
+ },
66
+ }
67
+
68
+ /**
69
+ * Wraps each child with a <ChildWrapper>
70
+ */
71
+ const ChildrenRender = (props, { slots }) => {
72
+ const [fragment] = slots.default()
73
+ return fragment.children.map((vnode, index) => h(ChildWrapper, { index }, [vnode]))
74
+ }
75
+
76
+ /**
77
+ * Only renders a part of a children list
78
+ */
79
+ const ChildrenSlice = (props, { slots }) => {
80
+ const [fragment] = slots.default()
81
+ return fragment.children.slice(props.start, props.end)
82
+ }
83
+ </script>
84
+
85
+ <template>
86
+ <div
87
+ ref="el"
88
+ class="htw-flex htw-overflow-hidden htw-relative"
89
+ >
90
+ <ChildrenRender>
91
+ <slot />
92
+ </ChildrenRender>
93
+
94
+ <VDropdown
95
+ v-if="visibleChildrenCount < children.size"
96
+ >
97
+ <div
98
+ role="button"
99
+ class="htw-cursor-pointer hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-w-8 htw-h-full htw-flex htw-items-center htw-justify-center htw-absolute htw-top-0 htw-right-0"
100
+ >
101
+ <Icon
102
+ icon="carbon:caret-down"
103
+ class="htw-w-4 htw-h-4 htw-opacity-50 group-hover:htw-opacity-100"
104
+ />
105
+ </div>
106
+
107
+ <template #popper>
108
+ <div class="htw-flex htw-flex-col htw-items-stretch">
109
+ <ChildrenSlice
110
+ :start="visibleChildrenCount"
111
+ >
112
+ <slot name="overflow" />
113
+ </ChildrenSlice>
114
+ </div>
115
+ </template>
116
+ </VDropdown>
117
+ </div>
118
+ </template>
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ import { defineComponent } from 'vue'
3
+
4
+ export default defineComponent({
5
+ inheritAttrs: false,
6
+
7
+ props: {
8
+ exact: {
9
+ type: Boolean,
10
+ default: false,
11
+ },
12
+
13
+ matched: {
14
+ type: Boolean,
15
+ default: null,
16
+ },
17
+ },
18
+ })
19
+ </script>
20
+
21
+ <template>
22
+ <router-link
23
+ v-slot="{ isActive, isExactActive, href, navigate }"
24
+ v-bind="$attrs"
25
+ custom
26
+ >
27
+ <a
28
+ v-bind="$attrs"
29
+ :href="href"
30
+ class="htw-px-4 htw-h-10 htw-min-w-[150px] htw-inline-flex htw-items-center hover:htw-bg-primary-50 dark:hover:htw-bg-primary-900 htw-relative htw-text-gray-900 dark:htw-text-gray-100"
31
+ :class="{
32
+ 'htw-text-primary-500 dark:htw-text-primary-400': matched != null ? matched : (exact && isExactActive) || (!exact && isActive),
33
+ }"
34
+ @click="navigate"
35
+ >
36
+ <slot />
37
+
38
+ <transition name="__histoire-scale-y">
39
+ <div
40
+ v-if="matched != null ? matched : (exact && isExactActive) || (!exact && isActive)"
41
+ class="htw-absolute htw-top-0 htw-left-0 htw-h-full htw-w-[2px] htw-bg-primary-500 dark:htw-bg-primary-400"
42
+ />
43
+ </transition>
44
+ </a>
45
+ </router-link>
46
+ </template>
@@ -18,6 +18,8 @@ export default defineComponent({
18
18
  },
19
19
 
20
20
  setup () {
21
+ const vm = getCurrentInstance()
22
+
21
23
  const attrs = useAttrs() as {
22
24
  story: Story
23
25
  }
@@ -25,7 +27,7 @@ export default defineComponent({
25
27
  const story = computed(() => attrs.story)
26
28
  provide('story', story)
27
29
 
28
- const storyComponent: any = getCurrentInstance().parent
30
+ const storyComponent: any = vm.parent
29
31
  // Allows tracking reactivity with watchers to sync state
30
32
  const implicitState = {
31
33
  $data: storyComponent.data,
@@ -46,12 +48,21 @@ export default defineComponent({
46
48
  }
47
49
  provide('implicitState', () => implicitState)
48
50
 
51
+ function updateStory () {
52
+ Object.assign(attrs.story, {
53
+ slots: () => vm.proxy.$slots,
54
+ })
55
+ }
56
+
49
57
  return {
50
58
  story,
59
+ updateStory,
51
60
  }
52
61
  },
53
62
 
54
63
  render () {
64
+ this.updateStory()
65
+
55
66
  const [firstVariant] = this.story.variants
56
67
  if (firstVariant.id === '_default') {
57
68
  return h(Variant, {
@@ -24,6 +24,11 @@ export default defineComponent({
24
24
  type: Boolean,
25
25
  default: false,
26
26
  },
27
+
28
+ setupApp: {
29
+ type: Function,
30
+ default: null,
31
+ },
27
32
  },
28
33
 
29
34
  setup (props) {
@@ -53,6 +58,7 @@ export default defineComponent({
53
58
  slots: () => vm.proxy.$slots,
54
59
  source: props.source,
55
60
  responsiveDisabled: props.responsiveDisabled,
61
+ setupApp: props.setupApp,
56
62
  configReady: true,
57
63
  })
58
64
  }
@@ -0,0 +1,64 @@
1
+ <script lang="ts" setup>
2
+ import BaseTab from '../base/BaseTab.vue'
3
+ import { useEventsStore } from '../../stores/events'
4
+ import BaseOverflowMenu from '../base/BaseOverflowMenu.vue'
5
+ import BaseOverflowTab from '../base/BaseOverflowTab.vue'
6
+
7
+ const eventsStore = useEventsStore()
8
+ </script>
9
+
10
+ <template>
11
+ <BaseOverflowMenu class="htw-h-10 htw-flex-none htw-border-b htw-border-gray-100 dark:htw-border-gray-750">
12
+ <BaseTab
13
+ :to="{ ...$route, query: { ...$route.query, tab: '' } }"
14
+ :matched="!$route.query.tab"
15
+ >
16
+ Controls
17
+ </BaseTab>
18
+ <BaseTab
19
+ :to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
20
+ :matched="$route.query.tab === 'docs'"
21
+ >
22
+ Docs
23
+ </BaseTab>
24
+ <BaseTab
25
+ :to="{ ...$route, query: { ...$route.query, tab: 'events' } }"
26
+ :matched="$route.query.tab === 'events'"
27
+ >
28
+ Events
29
+ <span
30
+ v-if="eventsStore.unseen"
31
+ class="htw-text-center htw-text-xs htw-mx-1 htw-px-0.5 htw-h-4 htw-min-w-4 htw-rounded-full active htw-bg-primary-500 htw-text-white dark:htw-text-black"
32
+ >
33
+ {{ eventsStore.unseen <=99 ? eventsStore.unseen : "99+" }}
34
+ </span>
35
+ </BaseTab>
36
+
37
+ <template #overflow>
38
+ <BaseOverflowTab
39
+ :to="{ ...$route, query: { ...$route.query, tab: '' } }"
40
+ :matched="!$route.query.tab"
41
+ >
42
+ Controls
43
+ </BaseOverflowTab>
44
+ <BaseOverflowTab
45
+ :to="{ ...$route, query: { ...$route.query, tab: 'docs' } }"
46
+ :matched="$route.query.tab === 'docs'"
47
+ >
48
+ Docs
49
+ </BaseOverflowTab>
50
+ <BaseOverflowTab
51
+ :to="{ ...$route, query: { ...$route.query, tab: 'events' } }"
52
+ :matched="$route.query.tab === 'events'"
53
+ >
54
+ Events
55
+ <span
56
+ v-if="eventsStore.unseen"
57
+ class="htw-text-center htw-text-xs htw-mx-1 htw-px-0.5 htw-h-4 htw-min-w-4 htw-rounded-full active htw-bg-primary-500 htw-text-white dark:htw-text-black"
58
+ >
59
+ {{ eventsStore.unseen <=99 ? eventsStore.unseen : "99+" }}
60
+ </span>
61
+ </BaseOverflowTab>
62
+ </template>
63
+ </BaseOverflowMenu>
64
+ </template>
@@ -22,7 +22,7 @@ defineProps({
22
22
  <div data-test-id="story-controls">
23
23
  <!-- Custom controls -->
24
24
  <SandboxVue3
25
- v-if="variant.slots().controls"
25
+ v-if="variant.slots().controls || story.slots().controls"
26
26
  slot-name="controls"
27
27
  :variant="variant"
28
28
  :story="story"