@histoire/app 0.16.5 → 0.17.4

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.
@@ -1,9 +1,13 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, createElementVNode } from "@histoire/vendors/vue";
1
+ import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, createVNode } from "@histoire/vendors/vue";
2
2
  import { histoireConfig, customLogos } from "../util/config.js";
3
3
  import HistoireLogo from "../assets/histoire.svg.js";
4
+ import { useStoryStore } from "../stores/story.js";
5
+ import "./app/HomeCounter.vue.js";
6
+ import _sfc_main$1 from "./app/HomeCounter.vue2.js";
4
7
  "use strict";
5
- const _hoisted_1 = { class: "histoire-home-view htw-flex htw-items-center htw-justify-center htw-h-full" };
8
+ const _hoisted_1 = { class: "histoire-home-view htw-flex md:htw-flex-col htw-gap-12 htw-items-center htw-justify-center htw-h-full" };
6
9
  const _hoisted_2 = ["src"];
10
+ const _hoisted_3 = { class: "htw-flex !md:htw-flex-col htw-flex-wrap htw-justify-evenly htw-gap-2 htw-px-4 htw-py-2 htw-bg-gray-100 dark:htw-bg-gray-750 htw-rounded htw-border htw-border-gray-500/30" };
7
11
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
12
  __name: "HomeView",
9
13
  setup(__props) {
@@ -11,13 +15,51 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11
15
  var _a, _b;
12
16
  return ((_b = (_a = histoireConfig.theme) == null ? void 0 : _a.logo) == null ? void 0 : _b.square) ? customLogos.square : HistoireLogo;
13
17
  });
18
+ const storyStore = useStoryStore();
19
+ const stats = computed(() => {
20
+ let storyCount = 0;
21
+ let variantCount = 0;
22
+ let docsCount = 0;
23
+ (storyStore.stories || []).forEach((story) => {
24
+ if (story.docsOnly) {
25
+ docsCount++;
26
+ } else {
27
+ storyCount++;
28
+ if (story.variants) {
29
+ variantCount += story.variants.length;
30
+ }
31
+ }
32
+ });
33
+ return {
34
+ storyCount,
35
+ variantCount,
36
+ docsCount
37
+ };
38
+ });
14
39
  return (_ctx, _cache) => {
15
40
  return openBlock(), createElementBlock("div", _hoisted_1, [
16
41
  createElementVNode("img", {
17
42
  src: logoUrl.value,
18
43
  alt: "Logo",
19
- class: "htw-w-64 htw-h-64 htw-opacity-25"
20
- }, null, 8, _hoisted_2)
44
+ class: "htw-w-64 htw-h-64 htw-opacity-25 htw-mb-8 htw-hidden md:htw-block"
45
+ }, null, 8, _hoisted_2),
46
+ createElementVNode("div", _hoisted_3, [
47
+ createVNode(_sfc_main$1, {
48
+ title: "Stories",
49
+ icon: "carbon:cube",
50
+ count: stats.value.storyCount
51
+ }, null, 8, ["count"]),
52
+ createVNode(_sfc_main$1, {
53
+ title: "Variants",
54
+ icon: "carbon:cube-view",
55
+ count: stats.value.variantCount
56
+ }, null, 8, ["count"]),
57
+ createVNode(_sfc_main$1, {
58
+ title: "Documents",
59
+ icon: "carbon:document-blank",
60
+ count: stats.value.docsCount
61
+ }, null, 8, ["count"])
62
+ ])
21
63
  ]);
22
64
  };
23
65
  }
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./HomeCounter.vue2.js";
2
+ "use strict";
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,47 @@
1
+ import { defineComponent, toRefs, ref, openBlock, createElementBlock, createVNode, unref, createElementVNode, toDisplayString } from "@histoire/vendors/vue";
2
+ import { useTransition, syncRefs } from "@histoire/vendors/vue-use";
3
+ import { Icon } from "@histoire/vendors/iconify";
4
+ "use strict";
5
+ const _hoisted_1 = { class: "htw-p-2 htw-flex htw-items-center htw-gap-x-2" };
6
+ const _hoisted_2 = { class: "htw-flex htw-flex-col htw-leading-none" };
7
+ const _hoisted_3 = { class: "htw-text-primary-500 htw-min-w-[80px] htw-font-bold" };
8
+ const _hoisted_4 = { class: "htw-text-sm htw-text-gray-900 dark:htw-text-gray-100" };
9
+ const _sfc_main = /* @__PURE__ */ defineComponent({
10
+ __name: "HomeCounter",
11
+ props: {
12
+ icon: {
13
+ type: String,
14
+ default: "carbon:cube"
15
+ },
16
+ title: {
17
+ type: String,
18
+ default: ""
19
+ },
20
+ count: {
21
+ type: Number,
22
+ default: 0
23
+ }
24
+ },
25
+ setup(__props) {
26
+ const props = __props;
27
+ const { count } = toRefs(props);
28
+ const delayedCount = ref(0);
29
+ const animatedCount = useTransition(delayedCount, { delay: 100, duration: 700 });
30
+ syncRefs(count, delayedCount);
31
+ return (_ctx, _cache) => {
32
+ return openBlock(), createElementBlock("div", _hoisted_1, [
33
+ createVNode(unref(Icon), {
34
+ icon: props.icon,
35
+ class: "htw-text-2xl htw-text-gray-700 dark:htw-text-gray-300 htw-flex-none"
36
+ }, null, 8, ["icon"]),
37
+ createElementVNode("div", _hoisted_2, [
38
+ createElementVNode("span", _hoisted_3, toDisplayString(unref(animatedCount).toFixed()), 1),
39
+ createElementVNode("span", _hoisted_4, toDisplayString(__props.title), 1)
40
+ ])
41
+ ]);
42
+ };
43
+ }
44
+ });
45
+ export {
46
+ _sfc_main as default
47
+ };
@@ -44,6 +44,10 @@
44
44
  color: var(--663732b6);
45
45
  }
46
46
 
47
+ .bind-tree-padding[data-v-2d2e4786] {
48
+ padding-left: var(--6851b0a7);
49
+ }
50
+
47
51
  .bind-tree-margin[data-v-19810958] {
48
52
  margin-left: var(--444efc12);
49
53
  }
@@ -51,23 +55,19 @@
51
55
  color: var(--ae892164);
52
56
  }
53
57
 
54
- .bind-tree-padding[data-v-2d2e4786] {
55
- padding-left: var(--6851b0a7);
56
- }
57
-
58
58
  .bind-icon-color[data-v-ab890d9c] {
59
59
  color: var(--89126aaa);
60
60
  }
61
61
 
62
- .bind-icon-color[data-v-ddfc5b4f] {
63
- color: var(--4d25d048);
64
- }
65
-
66
62
  .__histoire-code-placeholder[data-v-1bdf9905] {
67
63
  color: inherit;
68
64
  font-size: inherit;
69
65
  }
70
66
 
67
+ .bind-icon-color[data-v-ddfc5b4f] {
68
+ color: var(--4d25d048);
69
+ }
70
+
71
71
  .bind-icon-color[data-v-6c8e9661] {
72
72
  color: var(--a8c1277e);
73
73
  }
package/dist/style.css CHANGED
@@ -1228,6 +1228,10 @@ body {
1228
1228
  margin-bottom:1.5rem
1229
1229
  }
1230
1230
 
1231
+ .htw-mb-8{
1232
+ margin-bottom:2rem
1233
+ }
1234
+
1231
1235
  .htw-ml-4{
1232
1236
  margin-left:1rem
1233
1237
  }
@@ -1280,6 +1284,10 @@ body {
1280
1284
  display:grid
1281
1285
  }
1282
1286
 
1287
+ .\!htw-hidden{
1288
+ display:none !important
1289
+ }
1290
+
1283
1291
  .htw-hidden{
1284
1292
  display:none
1285
1293
  }
@@ -1503,6 +1511,10 @@ body {
1503
1511
  min-width:150px
1504
1512
  }
1505
1513
 
1514
+ .htw-min-w-\[80px\]{
1515
+ min-width:80px
1516
+ }
1517
+
1506
1518
  .htw-max-w-6{
1507
1519
  max-width:1.5rem
1508
1520
  }
@@ -1662,6 +1674,10 @@ body {
1662
1674
  justify-content:center
1663
1675
  }
1664
1676
 
1677
+ .htw-justify-evenly{
1678
+ justify-content:space-evenly
1679
+ }
1680
+
1665
1681
  .htw-gap-0{
1666
1682
  gap:0px
1667
1683
  }
@@ -1674,6 +1690,10 @@ body {
1674
1690
  gap:0.25rem
1675
1691
  }
1676
1692
 
1693
+ .htw-gap-12{
1694
+ gap:3rem
1695
+ }
1696
+
1677
1697
  .htw-gap-2{
1678
1698
  gap:0.5rem
1679
1699
  }
@@ -1690,6 +1710,11 @@ body {
1690
1710
  gap:1px
1691
1711
  }
1692
1712
 
1713
+ .htw-gap-x-2{
1714
+ -moz-column-gap:0.5rem;
1715
+ column-gap:0.5rem
1716
+ }
1717
+
1693
1718
  .htw-gap-y-1{
1694
1719
  row-gap:0.25rem
1695
1720
  }
@@ -1860,6 +1885,10 @@ body {
1860
1885
  border-color:rgb(var(--_histoire-color-gray-500) / 0.1)
1861
1886
  }
1862
1887
 
1888
+ .htw-border-gray-500\/30{
1889
+ border-color:rgb(var(--_histoire-color-gray-500) / 0.3)
1890
+ }
1891
+
1863
1892
  .htw-border-gray-500\/40{
1864
1893
  border-color:rgb(var(--_histoire-color-gray-500) / 0.4)
1865
1894
  }
@@ -2143,6 +2172,11 @@ body {
2143
2172
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace
2144
2173
  }
2145
2174
 
2175
+ .htw-text-2xl{
2176
+ font-size:1.5rem;
2177
+ line-height:2rem
2178
+ }
2179
+
2146
2180
  .htw-text-5xl{
2147
2181
  font-size:3rem;
2148
2182
  line-height:1
@@ -2163,10 +2197,18 @@ body {
2163
2197
  line-height:1rem
2164
2198
  }
2165
2199
 
2200
+ .htw-font-bold{
2201
+ font-weight:700
2202
+ }
2203
+
2166
2204
  .htw-uppercase{
2167
2205
  text-transform:uppercase
2168
2206
  }
2169
2207
 
2208
+ .htw-leading-none{
2209
+ line-height:1
2210
+ }
2211
+
2170
2212
  .htw-leading-normal{
2171
2213
  line-height:1.5
2172
2214
  }
@@ -2620,6 +2662,11 @@ body {
2620
2662
  color:rgb(var(--_histoire-color-gray-100) / var(--tw-text-opacity))
2621
2663
  }
2622
2664
 
2665
+ :is(.htw-dark .dark\:htw-text-gray-300){
2666
+ --tw-text-opacity:1;
2667
+ color:rgb(var(--_histoire-color-gray-300) / var(--tw-text-opacity))
2668
+ }
2669
+
2623
2670
  :is(.htw-dark .dark\:htw-text-primary-200){
2624
2671
  --tw-text-opacity:1;
2625
2672
  color:rgb(var(--_histoire-color-primary-200) / var(--tw-text-opacity))
@@ -2717,10 +2764,18 @@ body {
2717
2764
  margin-top:4rem
2718
2765
  }
2719
2766
 
2767
+ .md\:htw-block{
2768
+ display:block
2769
+ }
2770
+
2720
2771
  .md\:htw-max-w-\[600px\]{
2721
2772
  max-width:600px
2722
2773
  }
2723
2774
 
2775
+ .md\:htw-flex-col{
2776
+ flex-direction:column
2777
+ }
2778
+
2724
2779
  .md\:htw-p-12{
2725
2780
  padding:3rem
2726
2781
  }
@@ -2748,6 +2803,12 @@ body {
2748
2803
  }
2749
2804
  }
2750
2805
 
2806
+ @media (max-width: 767px){
2807
+ .\!md\:htw-flex-col{
2808
+ flex-direction:column
2809
+ }
2810
+ }
2811
+
2751
2812
  .histoire-story-list-folder-button:hover .\[\.histoire-story-list-folder-button\:hover_\&\]\:htw-opacity-100{
2752
2813
  opacity:1
2753
2814
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/app",
3
- "version": "0.16.5",
3
+ "version": "0.17.4",
4
4
  "description": "Pre-bundled UI for Histoire",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -27,9 +27,9 @@
27
27
  "@types/flexsearch": "^0.7.3",
28
28
  "flexsearch": "0.7.21",
29
29
  "shiki-es": "^0.2.0",
30
- "@histoire/controls": "^0.16.5",
31
- "@histoire/vendors": "^0.16.5",
32
- "@histoire/shared": "^0.16.5"
30
+ "@histoire/controls": "^0.17.4",
31
+ "@histoire/shared": "^0.17.4",
32
+ "@histoire/vendors": "^0.17.4"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@tailwindcss/typography": "^0.5.9",
@@ -46,7 +46,7 @@
46
46
  "postcss-import": "^14.1.0",
47
47
  "tailwindcss": "^3.3.3",
48
48
  "typescript": "^4.9.5",
49
- "vite": "^4.4.9",
49
+ "vite": "^4.5.0",
50
50
  "vue": "^3.3.4"
51
51
  },
52
52
  "scripts": {
@@ -2,16 +2,59 @@
2
2
  import { computed } from 'vue'
3
3
  import { histoireConfig, customLogos } from '../util/config'
4
4
  import HistoireLogo from '../assets/histoire.svg'
5
+ import { useStoryStore } from '../stores/story'
6
+ import HomeCounter from './app/HomeCounter.vue'
5
7
 
6
8
  const logoUrl = computed(() => histoireConfig.theme?.logo?.square ? customLogos.square : HistoireLogo)
9
+ const storyStore = useStoryStore()
10
+
11
+ const stats = computed(() => {
12
+ let storyCount = 0
13
+ let variantCount = 0
14
+ let docsCount = 0;
15
+
16
+ (storyStore.stories || []).forEach(story => {
17
+ if (story.docsOnly) {
18
+ docsCount++
19
+ } else {
20
+ storyCount++
21
+ if (story.variants) {
22
+ variantCount += story.variants.length
23
+ }
24
+ }
25
+ })
26
+
27
+ return {
28
+ storyCount,
29
+ variantCount,
30
+ docsCount,
31
+ }
32
+ })
7
33
  </script>
8
34
 
9
35
  <template>
10
- <div class="histoire-home-view htw-flex htw-items-center htw-justify-center htw-h-full">
36
+ <div class="histoire-home-view htw-flex md:htw-flex-col htw-gap-12 htw-items-center htw-justify-center htw-h-full">
11
37
  <img
12
38
  :src="logoUrl"
13
39
  alt="Logo"
14
- class="htw-w-64 htw-h-64 htw-opacity-25"
40
+ class="htw-w-64 htw-h-64 htw-opacity-25 htw-mb-8 htw-hidden md:htw-block"
15
41
  >
42
+ <div class="htw-flex !md:htw-flex-col htw-flex-wrap htw-justify-evenly htw-gap-2 htw-px-4 htw-py-2 htw-bg-gray-100 dark:htw-bg-gray-750 htw-rounded htw-border htw-border-gray-500/30">
43
+ <HomeCounter
44
+ title="Stories"
45
+ icon="carbon:cube"
46
+ :count="stats.storyCount"
47
+ />
48
+ <HomeCounter
49
+ title="Variants"
50
+ icon="carbon:cube-view"
51
+ :count="stats.variantCount"
52
+ />
53
+ <HomeCounter
54
+ title="Documents"
55
+ icon="carbon:document-blank"
56
+ :count="stats.docsCount"
57
+ />
58
+ </div>
16
59
  </div>
17
60
  </template>
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ import { ref, toRefs } from 'vue'
3
+ import { useTransition, syncRefs } from '@vueuse/core'
4
+ import { Icon } from '@iconify/vue'
5
+
6
+ const props = defineProps({
7
+ icon: {
8
+ type: String,
9
+ default: 'carbon:cube',
10
+ },
11
+ title: {
12
+ type: String,
13
+ default: '',
14
+ },
15
+ count: {
16
+ type: Number,
17
+ default: 0,
18
+ },
19
+ })
20
+
21
+ const { count } = toRefs(props)
22
+ const delayedCount = ref(0)
23
+
24
+ const animatedCount = useTransition(delayedCount, { delay: 100, duration: 700 })
25
+
26
+ syncRefs(count, delayedCount)
27
+ </script>
28
+
29
+ <template>
30
+ <div class="htw-p-2 htw-flex htw-items-center htw-gap-x-2">
31
+ <Icon
32
+ :icon="props.icon"
33
+ class="htw-text-2xl htw-text-gray-700 dark:htw-text-gray-300 htw-flex-none"
34
+ />
35
+ <div class="htw-flex htw-flex-col htw-leading-none">
36
+ <span
37
+ class="htw-text-primary-500 htw-min-w-[80px] htw-font-bold"
38
+ >
39
+ {{ animatedCount.toFixed() }}
40
+ </span>
41
+ <span
42
+ class="htw-text-sm htw-text-gray-900 dark:htw-text-gray-100"
43
+ >
44
+ {{ title }}
45
+ </span>
46
+ </div>
47
+ </div>
48
+ </template>