@histoire/app 0.13.2 → 0.14.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 (89) hide show
  1. package/dist/bundled/App.vue2.js +11 -2
  2. package/dist/bundled/components/base/BaseButton.vue.js +5 -0
  3. package/dist/bundled/components/base/BaseButton.vue2.js +39 -0
  4. package/dist/bundled/components/base/BaseIcon.vue.js +8 -0
  5. package/dist/bundled/components/base/BaseIcon.vue2.js +30 -0
  6. package/dist/bundled/components/base/BaseIcon.vue3.js +4 -0
  7. package/dist/bundled/components/base/BaseKeyboardShortcut.vue.js +5 -0
  8. package/dist/bundled/components/base/BaseKeyboardShortcut.vue2.js +20 -0
  9. package/dist/bundled/components/base/BaseListItem.vue.js +5 -0
  10. package/dist/bundled/components/base/BaseListItem.vue2.js +32 -0
  11. package/dist/bundled/components/command/CommandPrompts.vue.js +5 -0
  12. package/dist/bundled/components/command/CommandPrompts.vue2.js +95 -0
  13. package/dist/bundled/components/command/CommandPromptsModal.vue.js +5 -0
  14. package/dist/bundled/components/command/CommandPromptsModal.vue2.js +44 -0
  15. package/dist/bundled/components/command/PromptSelect.vue.js +5 -0
  16. package/dist/bundled/components/command/PromptSelect.vue2.js +142 -0
  17. package/dist/bundled/components/command/PromptText.vue.js +5 -0
  18. package/dist/bundled/components/command/PromptText.vue2.js +67 -0
  19. package/dist/bundled/components/panel/StoryDocs.vue2.js +25 -3
  20. package/dist/bundled/components/panel/StorySourceCode.vue.js +1 -1
  21. package/dist/bundled/components/panel/StorySourceCode.vue2.js +1 -1
  22. package/dist/bundled/components/panel/StorySourceCode.vue3.js +2 -2
  23. package/dist/bundled/components/search/SearchItem.vue.js +1 -1
  24. package/dist/bundled/components/search/SearchItem.vue2.js +42 -62
  25. package/dist/bundled/components/search/SearchItem.vue3.js +2 -2
  26. package/dist/bundled/components/search/SearchItemContent.vue.js +5 -0
  27. package/dist/bundled/components/search/SearchItemContent.vue2.js +72 -0
  28. package/dist/bundled/components/search/SearchModal.vue2.js +2 -2
  29. package/dist/bundled/components/search/SearchPane.vue2.js +46 -24
  30. package/dist/bundled/components/story/StoryVariantGrid.vue2.js +10 -2
  31. package/dist/bundled/components/story/StoryVariantGridItem.vue.js +1 -1
  32. package/dist/bundled/components/story/StoryVariantGridItem.vue2.js +8 -4
  33. package/dist/bundled/components/story/StoryVariantGridItem.vue3.js +2 -2
  34. package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue2.js +5 -1
  35. package/dist/bundled/components/story/StoryVariantSingleView.vue2.js +13 -6
  36. package/dist/bundled/components/story/StoryView.vue2.js +1 -0
  37. package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue.js +5 -0
  38. package/dist/bundled/components/toolbar/DevOnlyToolbarOpenInEditor.vue2.js +31 -0
  39. package/dist/bundled/index.js +3 -1
  40. package/dist/bundled/plugin.js +50 -0
  41. package/dist/bundled/sandbox.js +6 -0
  42. package/dist/bundled/stores/command.js +26 -0
  43. package/dist/bundled/style.css +22 -18
  44. package/dist/bundled/util/commands.js +59 -0
  45. package/dist/bundled/util/dark.js +2 -1
  46. package/dist/bundled/util/keyboard.js +3 -0
  47. package/dist/bundled/util/open-in-editor.js +6 -0
  48. package/dist/bundled/util/select.js +28 -0
  49. package/dist/bundled/util/tooltip.js +1 -1
  50. package/dist/style.css +116 -63
  51. package/package.json +4 -4
  52. package/src/app/App.vue +10 -1
  53. package/src/app/components/base/BaseButton.vue +33 -0
  54. package/src/app/components/base/BaseIcon.vue +31 -0
  55. package/src/app/components/base/BaseKeyboardShortcut.vue +16 -0
  56. package/src/app/components/base/BaseListItem.vue +30 -0
  57. package/src/app/components/command/CommandPrompts.vue +97 -0
  58. package/src/app/components/command/CommandPromptsModal.vue +40 -0
  59. package/src/app/components/command/PromptSelect.vue +140 -0
  60. package/src/app/components/command/PromptText.vue +64 -0
  61. package/src/app/components/panel/StoryDocs.vue +25 -2
  62. package/src/app/components/panel/StorySourceCode.vue +0 -1
  63. package/src/app/components/search/SearchItem.vue +29 -52
  64. package/src/app/components/search/SearchItemContent.vue +67 -0
  65. package/src/app/components/search/SearchModal.vue +2 -2
  66. package/src/app/components/search/SearchPane.vue +50 -22
  67. package/src/app/components/search/search-docs-data.ts +0 -1
  68. package/src/app/components/search/search-title-data.ts +0 -1
  69. package/src/app/components/story/GenericMountStory.vue +0 -1
  70. package/src/app/components/story/GenericRenderStory.vue +0 -1
  71. package/src/app/components/story/StoryVariantGrid.vue +7 -0
  72. package/src/app/components/story/StoryVariantGridItem.vue +4 -0
  73. package/src/app/components/story/StoryVariantSinglePreviewNative.vue +4 -1
  74. package/src/app/components/story/StoryVariantSingleView.vue +7 -0
  75. package/src/app/components/story/StoryView.vue +1 -0
  76. package/src/app/components/toolbar/DevOnlyToolbarOpenInEditor.vue +23 -0
  77. package/src/app/index.ts +5 -1
  78. package/src/app/plugin.ts +58 -0
  79. package/src/app/sandbox.ts +10 -3
  80. package/src/app/stores/command.ts +25 -0
  81. package/src/app/types.ts +26 -4
  82. package/src/app/util/commands.ts +56 -0
  83. package/src/app/util/config.ts +0 -1
  84. package/src/app/util/dark.ts +2 -1
  85. package/src/app/util/keyboard.ts +3 -0
  86. package/src/app/util/open-in-editor.ts +3 -0
  87. package/src/app/util/select.ts +29 -0
  88. package/src/app/util/tooltip.ts +1 -1
  89. package/src/virtual.d.ts +6 -0
package/dist/style.css CHANGED
@@ -1219,6 +1219,10 @@ body {
1219
1219
  margin-left:auto
1220
1220
  }
1221
1221
 
1222
+ .htw-mb-2{
1223
+ margin-bottom:0.5rem
1224
+ }
1225
+
1222
1226
  .htw-mb-6{
1223
1227
  margin-bottom:1.5rem
1224
1228
  }
@@ -1243,10 +1247,6 @@ body {
1243
1247
  margin-right:auto
1244
1248
  }
1245
1249
 
1246
- .htw-mb-2{
1247
- margin-bottom:0.5rem
1248
- }
1249
-
1250
1250
  .htw-ml-4{
1251
1251
  margin-left:1rem
1252
1252
  }
@@ -1388,6 +1388,10 @@ body {
1388
1388
  max-height:100%
1389
1389
  }
1390
1390
 
1391
+ .htw-max-h-\[80vh\]{
1392
+ max-height:80vh
1393
+ }
1394
+
1391
1395
  .htw-max-h-\[400px\]{
1392
1396
  max-height:400px
1393
1397
  }
@@ -1498,6 +1502,10 @@ body {
1498
1502
  max-width:100%
1499
1503
  }
1500
1504
 
1505
+ .htw-max-w-\[512px\]{
1506
+ max-width:512px
1507
+ }
1508
+
1501
1509
  .htw-max-w-none{
1502
1510
  max-width:none
1503
1511
  }
@@ -1518,10 +1526,6 @@ body {
1518
1526
  max-width:63px
1519
1527
  }
1520
1528
 
1521
- .htw-max-w-\[512px\]{
1522
- max-width:512px
1523
- }
1524
-
1525
1529
  .htw-flex-none{
1526
1530
  flex:none
1527
1531
  }
@@ -1621,6 +1625,10 @@ body {
1621
1625
  place-content:space-between
1622
1626
  }
1623
1627
 
1628
+ .htw-items-start{
1629
+ align-items:flex-start
1630
+ }
1631
+
1624
1632
  .htw-items-end{
1625
1633
  align-items:flex-end
1626
1634
  }
@@ -1715,6 +1723,10 @@ body {
1715
1723
  overflow-y:scroll
1716
1724
  }
1717
1725
 
1726
+ .htw-scroll-smooth{
1727
+ scroll-behavior:smooth
1728
+ }
1729
+
1718
1730
  .htw-truncate{
1719
1731
  overflow:hidden;
1720
1732
  text-overflow:ellipsis;
@@ -1737,14 +1749,14 @@ body {
1737
1749
  border-radius:9999px
1738
1750
  }
1739
1751
 
1740
- .htw-rounded-lg{
1741
- border-radius:0.75rem
1742
- }
1743
-
1744
1752
  .htw-rounded{
1745
1753
  border-radius:0.375rem
1746
1754
  }
1747
1755
 
1756
+ .htw-rounded-lg{
1757
+ border-radius:0.75rem
1758
+ }
1759
+
1748
1760
  .\!htw-rounded-\[3px\]{
1749
1761
  border-radius:3px !important
1750
1762
  }
@@ -1785,10 +1797,6 @@ body {
1785
1797
  border-width:0px
1786
1798
  }
1787
1799
 
1788
- .htw-border-b-2{
1789
- border-bottom-width:2px
1790
- }
1791
-
1792
1800
  .htw-border-b{
1793
1801
  border-bottom-width:1px
1794
1802
  }
@@ -1828,6 +1836,10 @@ body {
1828
1836
  border-color:rgb(0 0 0 / 0.25)
1829
1837
  }
1830
1838
 
1839
+ .htw-border-current{
1840
+ border-color:currentColor
1841
+ }
1842
+
1831
1843
  .htw-border-gray-300\/30{
1832
1844
  border-color:rgb(var(--_histoire-color-gray-300) / 0.3)
1833
1845
  }
@@ -1837,6 +1849,15 @@ body {
1837
1849
  border-color:rgb(var(--_histoire-color-gray-800) / var(--tw-border-opacity))
1838
1850
  }
1839
1851
 
1852
+ .htw-border-gray-200{
1853
+ --tw-border-opacity:1;
1854
+ border-color:rgb(var(--_histoire-color-gray-200) / var(--tw-border-opacity))
1855
+ }
1856
+
1857
+ .htw-border-gray-500\/50{
1858
+ border-color:rgb(var(--_histoire-color-gray-500) / 0.5)
1859
+ }
1860
+
1840
1861
  .htw-border-gray-500\/5{
1841
1862
  border-color:rgb(var(--_histoire-color-gray-500) / 0.05)
1842
1863
  }
@@ -1845,11 +1866,6 @@ body {
1845
1866
  border-color:transparent
1846
1867
  }
1847
1868
 
1848
- .htw-border-gray-200{
1849
- --tw-border-opacity:1;
1850
- border-color:rgb(var(--_histoire-color-gray-200) / var(--tw-border-opacity))
1851
- }
1852
-
1853
1869
  .htw-border-gray-500\/10{
1854
1870
  border-color:rgb(var(--_histoire-color-gray-500) / 0.1)
1855
1871
  }
@@ -1891,11 +1907,6 @@ body {
1891
1907
  background-color:rgb(var(--_histoire-color-gray-100) / var(--tw-bg-opacity))
1892
1908
  }
1893
1909
 
1894
- .htw-bg-gray-500{
1895
- --tw-bg-opacity:1;
1896
- background-color:rgb(var(--_histoire-color-gray-500) / var(--tw-bg-opacity))
1897
- }
1898
-
1899
1910
  .htw-bg-primary-500\/10{
1900
1911
  background-color:rgb(var(--_histoire-color-primary-500) / 0.1)
1901
1912
  }
@@ -1905,14 +1916,19 @@ body {
1905
1916
  background-color:rgb(var(--_histoire-color-primary-500) / var(--tw-bg-opacity))
1906
1917
  }
1907
1918
 
1908
- .htw-bg-gray-50{
1919
+ .htw-bg-primary-200{
1909
1920
  --tw-bg-opacity:1;
1910
- background-color:rgb(var(--_histoire-color-gray-50) / var(--tw-bg-opacity))
1921
+ background-color:rgb(var(--_histoire-color-primary-200) / var(--tw-bg-opacity))
1911
1922
  }
1912
1923
 
1913
- .htw-bg-primary-200{
1924
+ .htw-bg-primary-700{
1914
1925
  --tw-bg-opacity:1;
1915
- background-color:rgb(var(--_histoire-color-primary-200) / var(--tw-bg-opacity))
1926
+ background-color:rgb(var(--_histoire-color-primary-700) / var(--tw-bg-opacity))
1927
+ }
1928
+
1929
+ .htw-bg-gray-50{
1930
+ --tw-bg-opacity:1;
1931
+ background-color:rgb(var(--_histoire-color-gray-50) / var(--tw-bg-opacity))
1916
1932
  }
1917
1933
 
1918
1934
  .htw-bg-primary-800{
@@ -1924,10 +1940,18 @@ body {
1924
1940
  background-color:rgb(var(--_histoire-color-primary-500) / 0.25)
1925
1941
  }
1926
1942
 
1943
+ .htw-bg-white\/80{
1944
+ background-color:rgb(255 255 255 / 0.8)
1945
+ }
1946
+
1927
1947
  .htw-bg-transparent{
1928
1948
  background-color:transparent
1929
1949
  }
1930
1950
 
1951
+ .htw-bg-primary-500\/20{
1952
+ background-color:rgb(var(--_histoire-color-primary-500) / 0.2)
1953
+ }
1954
+
1931
1955
  .htw-bg-primary-50{
1932
1956
  --tw-bg-opacity:1;
1933
1957
  background-color:rgb(var(--_histoire-color-primary-50) / var(--tw-bg-opacity))
@@ -1937,10 +1961,6 @@ body {
1937
1961
  background-color:rgb(var(--_histoire-color-gray-500) / 0.1)
1938
1962
  }
1939
1963
 
1940
- .htw-bg-white\/80{
1941
- background-color:rgb(255 255 255 / 0.8)
1942
- }
1943
-
1944
1964
  .htw-bg-gray-400\/25{
1945
1965
  background-color:rgb(var(--_histoire-color-gray-400) / 0.25)
1946
1966
  }
@@ -2074,6 +2094,10 @@ body {
2074
2094
  padding-right:0.5rem
2075
2095
  }
2076
2096
 
2097
+ .htw-pt-4{
2098
+ padding-top:1rem
2099
+ }
2100
+
2077
2101
  .htw-pl-6{
2078
2102
  padding-left:1.5rem
2079
2103
  }
@@ -2138,6 +2162,11 @@ body {
2138
2162
  line-height:1.5
2139
2163
  }
2140
2164
 
2165
+ .htw-text-gray-400{
2166
+ --tw-text-opacity:1;
2167
+ color:rgb(var(--_histoire-color-gray-400) / var(--tw-text-opacity))
2168
+ }
2169
+
2141
2170
  .htw-text-gray-900{
2142
2171
  --tw-text-opacity:1;
2143
2172
  color:rgb(var(--_histoire-color-gray-900) / var(--tw-text-opacity))
@@ -2158,11 +2187,6 @@ body {
2158
2187
  color:rgb(255 255 255 / var(--tw-text-opacity))
2159
2188
  }
2160
2189
 
2161
- .htw-text-gray-400{
2162
- --tw-text-opacity:1;
2163
- color:rgb(var(--_histoire-color-gray-400) / var(--tw-text-opacity))
2164
- }
2165
-
2166
2190
  .htw-text-primary-400{
2167
2191
  --tw-text-opacity:1;
2168
2192
  color:rgb(var(--_histoire-color-primary-400) / var(--tw-text-opacity))
@@ -2222,14 +2246,18 @@ body {
2222
2246
  opacity:0.5
2223
2247
  }
2224
2248
 
2225
- .htw-opacity-30{
2226
- opacity:0.3
2227
- }
2228
-
2229
2249
  .htw-opacity-70{
2230
2250
  opacity:0.7
2231
2251
  }
2232
2252
 
2253
+ .htw-opacity-0{
2254
+ opacity:0
2255
+ }
2256
+
2257
+ .htw-opacity-30{
2258
+ opacity:0.3
2259
+ }
2260
+
2233
2261
  .htw-opacity-60{
2234
2262
  opacity:0.6
2235
2263
  }
@@ -2322,11 +2350,20 @@ body {
2322
2350
  border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
2323
2351
  }
2324
2352
 
2353
+ .focus-within\:htw-bg-gray-500\/5:focus-within{
2354
+ background-color:rgb(var(--_histoire-color-gray-500) / 0.05)
2355
+ }
2356
+
2325
2357
  .hover\:htw-border-primary-500:hover{
2326
2358
  --tw-border-opacity:1;
2327
2359
  border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
2328
2360
  }
2329
2361
 
2362
+ .hover\:htw-bg-primary-300:hover{
2363
+ --tw-bg-opacity:1;
2364
+ background-color:rgb(var(--_histoire-color-primary-300) / var(--tw-bg-opacity))
2365
+ }
2366
+
2330
2367
  .hover\:htw-bg-primary-100:hover{
2331
2368
  --tw-bg-opacity:1;
2332
2369
  background-color:rgb(var(--_histoire-color-primary-100) / var(--tw-bg-opacity))
@@ -2346,6 +2383,14 @@ body {
2346
2383
  background-color:rgb(var(--_histoire-color-primary-500) / 0.5)
2347
2384
  }
2348
2385
 
2386
+ .hover\:htw-bg-gray-500\/10:hover{
2387
+ background-color:rgb(var(--_histoire-color-gray-500) / 0.1)
2388
+ }
2389
+
2390
+ .hover\:htw-bg-primary-500\/10:hover{
2391
+ background-color:rgb(var(--_histoire-color-primary-500) / 0.1)
2392
+ }
2393
+
2349
2394
  .hover\:htw-bg-gray-500\/30:hover{
2350
2395
  background-color:rgb(var(--_histoire-color-gray-500) / 0.3)
2351
2396
  }
@@ -2359,11 +2404,6 @@ body {
2359
2404
  background-color:rgb(var(--_histoire-color-gray-200) / var(--tw-bg-opacity))
2360
2405
  }
2361
2406
 
2362
- .hover\:htw-bg-primary-300:hover{
2363
- --tw-bg-opacity:1;
2364
- background-color:rgb(var(--_histoire-color-primary-300) / var(--tw-bg-opacity))
2365
- }
2366
-
2367
2407
  .hover\:htw-bg-primary-200:hover{
2368
2408
  --tw-bg-opacity:1;
2369
2409
  background-color:rgb(var(--_histoire-color-primary-200) / var(--tw-bg-opacity))
@@ -2382,6 +2422,10 @@ body {
2382
2422
  opacity:1
2383
2423
  }
2384
2424
 
2425
+ .focus\:htw-border-primary-500\/50:focus{
2426
+ border-color:rgb(var(--_histoire-color-primary-500) / 0.5)
2427
+ }
2428
+
2385
2429
  .focus\:htw-border-primary-500:focus{
2386
2430
  --tw-border-opacity:1;
2387
2431
  border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
@@ -2408,6 +2452,10 @@ body {
2408
2452
  background-color:rgb(var(--_histoire-color-gray-100) / 0.5)
2409
2453
  }
2410
2454
 
2455
+ .htw-group:focus-within .group-focus-within\:htw-visible{
2456
+ visibility:visible
2457
+ }
2458
+
2411
2459
  .htw-group:hover .group-hover\:htw-flex{
2412
2460
  display:flex
2413
2461
  }
@@ -2439,14 +2487,14 @@ body {
2439
2487
  border-color:rgb(var(--_histoire-color-gray-800) / var(--tw-divide-opacity))
2440
2488
  }
2441
2489
 
2442
- .htw-dark .dark\:htw-divide-gray-750 > :not([hidden]) ~ :not([hidden]){
2490
+ .htw-dark .dark\:htw-divide-gray-850 > :not([hidden]) ~ :not([hidden]){
2443
2491
  --tw-divide-opacity:1;
2444
- border-color:rgb(var(--_histoire-color-gray-750) / var(--tw-divide-opacity))
2492
+ border-color:rgb(var(--_histoire-color-gray-850) / var(--tw-divide-opacity))
2445
2493
  }
2446
2494
 
2447
- .htw-dark .dark\:htw-divide-gray-850 > :not([hidden]) ~ :not([hidden]){
2495
+ .htw-dark .dark\:htw-divide-gray-750 > :not([hidden]) ~ :not([hidden]){
2448
2496
  --tw-divide-opacity:1;
2449
- border-color:rgb(var(--_histoire-color-gray-850) / var(--tw-divide-opacity))
2497
+ border-color:rgb(var(--_histoire-color-gray-750) / var(--tw-divide-opacity))
2450
2498
  }
2451
2499
 
2452
2500
  .htw-dark .dark\:htw-border-gray-800{
@@ -2463,11 +2511,6 @@ body {
2463
2511
  border-color:rgb(var(--_histoire-color-gray-750) / var(--tw-border-opacity))
2464
2512
  }
2465
2513
 
2466
- .htw-dark .dark\:htw-border-gray-850{
2467
- --tw-border-opacity:1;
2468
- border-color:rgb(var(--_histoire-color-gray-850) / var(--tw-border-opacity))
2469
- }
2470
-
2471
2514
  .htw-dark .dark\:htw-border-gray-700\/30{
2472
2515
  border-color:rgb(var(--_histoire-color-gray-700) / 0.3)
2473
2516
  }
@@ -2485,6 +2528,11 @@ body {
2485
2528
  border-color:rgb(255 255 255 / 0.2)
2486
2529
  }
2487
2530
 
2531
+ .htw-dark .dark\:htw-border-gray-850{
2532
+ --tw-border-opacity:1;
2533
+ border-color:rgb(var(--_histoire-color-gray-850) / var(--tw-border-opacity))
2534
+ }
2535
+
2488
2536
  .htw-dark .dark\:htw-bg-gray-700{
2489
2537
  --tw-bg-opacity:1;
2490
2538
  background-color:rgb(var(--_histoire-color-gray-700) / var(--tw-bg-opacity))
@@ -2495,14 +2543,23 @@ body {
2495
2543
  background-color:rgb(var(--_histoire-color-gray-750) / var(--tw-bg-opacity))
2496
2544
  }
2497
2545
 
2546
+ .htw-dark .dark\:htw-bg-primary-800{
2547
+ --tw-bg-opacity:1;
2548
+ background-color:rgb(var(--_histoire-color-primary-800) / var(--tw-bg-opacity))
2549
+ }
2550
+
2498
2551
  .htw-dark .dark\:htw-bg-primary-400{
2499
2552
  --tw-bg-opacity:1;
2500
2553
  background-color:rgb(var(--_histoire-color-primary-400) / var(--tw-bg-opacity))
2501
2554
  }
2502
2555
 
2503
- .htw-dark .dark\:htw-bg-primary-800{
2556
+ .htw-dark .dark\:htw-bg-gray-900\/80{
2557
+ background-color:rgb(var(--_histoire-color-gray-900) / 0.8)
2558
+ }
2559
+
2560
+ .htw-dark .dark\:htw-bg-gray-900{
2504
2561
  --tw-bg-opacity:1;
2505
- background-color:rgb(var(--_histoire-color-primary-800) / var(--tw-bg-opacity))
2562
+ background-color:rgb(var(--_histoire-color-gray-900) / var(--tw-bg-opacity))
2506
2563
  }
2507
2564
 
2508
2565
  .htw-dark .dark\:htw-bg-primary-600{
@@ -2510,10 +2567,6 @@ body {
2510
2567
  background-color:rgb(var(--_histoire-color-primary-600) / var(--tw-bg-opacity))
2511
2568
  }
2512
2569
 
2513
- .htw-dark .dark\:htw-bg-gray-700\/80{
2514
- background-color:rgb(var(--_histoire-color-gray-700) / 0.8)
2515
- }
2516
-
2517
2570
  .htw-dark .dark\:htw-bg-primary-700{
2518
2571
  --tw-bg-opacity:1;
2519
2572
  background-color:rgb(var(--_histoire-color-primary-700) / var(--tw-bg-opacity))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/app",
3
- "version": "0.13.2",
3
+ "version": "0.14.1",
4
4
  "description": "Pre-bundled UI for Histoire",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -24,9 +24,9 @@
24
24
  },
25
25
  "types": "./src/index.ts",
26
26
  "dependencies": {
27
- "@histoire/controls": "^0.13.2",
28
- "@histoire/shared": "^0.13.2",
29
- "@histoire/vendors": "^0.13.2",
27
+ "@histoire/controls": "^0.14.1",
28
+ "@histoire/shared": "^0.14.1",
29
+ "@histoire/vendors": "^0.14.1",
30
30
  "@types/flexsearch": "^0.7.3",
31
31
  "flexsearch": "0.7.21",
32
32
  "shiki-es": "^0.2.0"
package/src/app/App.vue CHANGED
@@ -5,7 +5,6 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script lang="ts" setup>
8
- // @ts-expect-error virtual module
9
8
  import { files as rawFiles, tree as rawTree, onUpdate } from 'virtual:$histoire-stories'
10
9
  import StoryList from './components/tree/StoryList.vue'
11
10
  import BaseSplitPane from './components/base/BaseSplitPane.vue'
@@ -18,8 +17,10 @@ import { useTitle } from '@vueuse/core'
18
17
  import { histoireConfig } from './util/config'
19
18
  import { onKeyboardShortcut } from './util/keyboard'
20
19
  import { isMobile } from './util/responsive'
20
+ import { useCommandStore } from './stores/command'
21
21
  import Breadcrumb from './components/app/Breadcrumb.vue'
22
22
  import SearchModal from './components/search/SearchModal.vue'
23
+ import CommandPromptsModal from './components/command/CommandPromptsModal.vue'
23
24
  import InitialLoading from './components/app/InitialLoading.vue'
24
25
  import GenericMountStory from './components/story/GenericMountStory.vue'
25
26
 
@@ -89,6 +90,8 @@ const mounted = ref(false)
89
90
  onMounted(() => {
90
91
  mounted.value = true
91
92
  })
93
+
94
+ const commandStore = useCommandStore()
92
95
  </script>
93
96
 
94
97
  <template>
@@ -153,6 +156,12 @@ onMounted(() => {
153
156
  :shown="isSearchOpen"
154
157
  @close="isSearchOpen = false"
155
158
  />
159
+
160
+ <CommandPromptsModal
161
+ v-if="__HISTOIRE_DEV__"
162
+ :shown="commandStore.showPromptsModal"
163
+ @close="commandStore.showPromptsModal = false"
164
+ />
156
165
  </div>
157
166
 
158
167
  <transition name="__histoire-fade">
@@ -0,0 +1,33 @@
1
+ <script lang="ts" setup>
2
+ import { computed } from 'vue'
3
+ import { RouterLink } from 'vue-router'
4
+
5
+ const props = defineProps<{
6
+ to?: any
7
+ href?: string
8
+ color?: string
9
+ }>()
10
+
11
+ const comp = computed(() => {
12
+ if (props.to) {
13
+ return RouterLink
14
+ }
15
+ if (props.href) {
16
+ return 'a'
17
+ }
18
+ return 'button'
19
+ })
20
+ </script>
21
+
22
+ <template>
23
+ <component
24
+ :is="comp"
25
+ class="histoire-base-button htw-rounded htw-cursor-pointer"
26
+ :class="{
27
+ 'htw-bg-primary-200 dark:htw-bg-primary-800 hover:htw-bg-primary-300 dark:hover:htw-bg-primary-700': color === 'primary' || !color,
28
+ 'htw-bg-grey-100 dark:htw-bg-grey-900 hover:htw-bg-grey-200 dark:hover:htw-bg-grey-800': color === 'grey',
29
+ }"
30
+ >
31
+ <slot />
32
+ </component>
33
+ </template>
@@ -0,0 +1,31 @@
1
+ <script lang="ts" setup>
2
+ import { Icon } from '@iconify/vue'
3
+ import { computed } from 'vue'
4
+
5
+ const props = defineProps<{
6
+ icon: string
7
+ }>()
8
+
9
+ const isUrl = computed(() => props.icon.startsWith('http') || props.icon.startsWith('data:image') ||
10
+ props.icon.startsWith('.') || props.icon.startsWith('/'))
11
+ </script>
12
+
13
+ <template>
14
+ <img
15
+ v-if="isUrl"
16
+ :src="icon"
17
+ :alt="icon"
18
+ class="histoire-base-icon"
19
+ >
20
+ <Icon
21
+ v-else
22
+ :icon="icon"
23
+ class="histoire-base-icon"
24
+ />
25
+ </template>
26
+
27
+ <style scoped>
28
+ img.colorize-black {
29
+ filter: grayscale(100) brightness(0);
30
+ }
31
+ </style>
@@ -0,0 +1,16 @@
1
+ <script lang="ts" setup>
2
+ import { formatKey } from '../../util/keyboard.js'
3
+ import { computed } from 'vue'
4
+
5
+ const props = defineProps<{
6
+ shortcut: string
7
+ }>()
8
+
9
+ const formatted = computed(() => props.shortcut.split('+').map(k => formatKey(k.trim())).join(' '))
10
+ </script>
11
+
12
+ <template>
13
+ <span class="histoire-base-keyboard-shortcut htw-border htw-border-current htw-opacity-50 htw-px-1 htw-rounded-sm">
14
+ {{ formatted }}
15
+ </span>
16
+ </template>
@@ -0,0 +1,30 @@
1
+ <script lang="ts" setup>
2
+ defineProps<{
3
+ isActive?: boolean
4
+ }>()
5
+
6
+ const emit = defineEmits<{
7
+ (e: 'navigate'): void
8
+ }>()
9
+
10
+ function handleNavigate () {
11
+ emit('navigate')
12
+ }
13
+ </script>
14
+
15
+ <template>
16
+ <a
17
+ class="istoire-base-list-ite htw-flex htw-items-center htw-gap-2 htw-text-gray-900 dark:htw-text-gray-100"
18
+ :class="[
19
+ $attrs.class,
20
+ isActive
21
+ ? 'active htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black'
22
+ : 'hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900'
23
+ ]"
24
+ @click="handleNavigate()"
25
+ @keyup.enter="handleNavigate()"
26
+ @keyup.space="handleNavigate()"
27
+ >
28
+ <slot />
29
+ </a>
30
+ </template>
@@ -0,0 +1,97 @@
1
+ <script lang="ts" setup>
2
+ import { reactive, ref, nextTick, onMounted } from 'vue'
3
+ import type { ClientCommand } from '@histoire/shared'
4
+ import { getCommandContext, executeCommand } from '../../util/commands.js'
5
+ import BaseButton from '../base/BaseButton.vue'
6
+ import BaseKeyboardShortcut from '../base/BaseKeyboardShortcut.vue'
7
+ import PromptText from './PromptText.vue'
8
+ import PromptSelect from './PromptSelect.vue'
9
+
10
+ const props = defineProps<{
11
+ command: ClientCommand
12
+ }>()
13
+
14
+ const emit = defineEmits<{
15
+ (e: 'close'): void
16
+ }>()
17
+
18
+ const promptTypes = {
19
+ text: PromptText,
20
+ select: PromptSelect,
21
+ }
22
+
23
+ const answers = reactive<Record<string, any>>({})
24
+
25
+ // Initial default values
26
+ for (const prompt of props.command.prompts) {
27
+ let defaultValue
28
+ if (typeof prompt.defaultValue === 'function') {
29
+ defaultValue = prompt.defaultValue(answers)
30
+ } else {
31
+ defaultValue = prompt.defaultValue
32
+ }
33
+ answers[prompt.field] = defaultValue
34
+ }
35
+
36
+ function submit () {
37
+ const params = props.command.getParams
38
+ ? props.command.getParams({
39
+ ...getCommandContext(),
40
+ answers,
41
+ })
42
+ : answers
43
+ executeCommand(props.command, params)
44
+ emit('close')
45
+ }
46
+
47
+ // Autofocus
48
+
49
+ const promptComps = ref<any[]>([])
50
+
51
+ function focusPrompt (index: number) {
52
+ nextTick(() => {
53
+ promptComps.value[index]?.focus?.()
54
+ })
55
+ }
56
+
57
+ onMounted(() => {
58
+ focusPrompt(0)
59
+ })
60
+ </script>
61
+
62
+ <template>
63
+ <form
64
+ class="histoire-command-prompts htw-flex htw-flex-col"
65
+ @submit.prevent="submit()"
66
+ @keyup.escape="$emit('close')"
67
+ >
68
+ <div class="htw-p-4 htw-opacity-70">
69
+ {{ command.label }}
70
+ </div>
71
+
72
+ <component
73
+ :is="promptTypes[prompt.type]"
74
+ v-for="(prompt, index) of command.prompts"
75
+ :key="prompt.field"
76
+ ref="promptComps"
77
+ v-model="answers[prompt.field]"
78
+ :prompt="prompt"
79
+ :answers="answers"
80
+ :index="index"
81
+ class="hover:htw-bg-gray-500/10 focus-within:htw-bg-gray-500/5"
82
+ @next="focusPrompt(index + 1)"
83
+ />
84
+
85
+ <div class="htw-flex htw-justify-end htw-gap-2 htw-p-2">
86
+ <BaseButton
87
+ type="submit"
88
+ class="htw-px-4 htw-py-2 htw-flex htw-items-start htw-gap-2"
89
+ >
90
+ <BaseKeyboardShortcut
91
+ shortcut="Enter"
92
+ />
93
+ <span>Submit</span>
94
+ </BaseButton>
95
+ </div>
96
+ </form>
97
+ </template>