@histoire/app 0.11.6 → 0.11.8

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.
@@ -64,8 +64,9 @@ button {
64
64
  }
65
65
  }
66
66
 
67
- .__histoire-sandbox {
68
- contain: content;
67
+ .__histoire-render-story {
68
+ overflow: auto;
69
+ min-height: 100%;
69
70
  }
70
71
 
71
72
  .__histoire-code .shiki {
@@ -17,3 +17,8 @@ html {
17
17
  .htw-sandbox-hidden {
18
18
  display: none;
19
19
  }
20
+
21
+ .__histoire-render-story {
22
+ overflow: auto;
23
+ min-height: 100%;
24
+ }
@@ -29,7 +29,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29
29
  return (_ctx, _cache) => {
30
30
  return openBlock(), createBlock(unref(Dropdown), {
31
31
  class: "histoire-base-select",
32
- "auto-size": ""
32
+ "auto-size": "",
33
+ "auto-boundary-max-size": ""
33
34
  }, {
34
35
  popper: withCtx(({ hide }) => [
35
36
  createElementVNode("div", _hoisted_3, [
@@ -23,7 +23,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
23
23
  return (_ctx, _cache) => {
24
24
  return mountComponent.value ? (openBlock(), createBlock(resolveDynamicComponent(mountComponent.value), mergeProps({
25
25
  key: 0,
26
- class: "histoire-generic-render-story",
26
+ class: "histoire-generic-render-story __histoire-render-story",
27
27
  story: __props.story
28
28
  }, _ctx.$attrs), null, 16, ["story"])) : createCommentVNode("", true);
29
29
  };
@@ -11,6 +11,7 @@ const _hoisted_2 = {
11
11
  key: 0,
12
12
  class: "htw-flex-none htw-flex htw-items-center htw-justify-end htw-h-8 htw-mx-2 htw-mt-1"
13
13
  };
14
+ const _hoisted_3 = { class: "htw-overflow-y-auto htw-flex htw-flex-1" };
14
15
  const _sfc_main = /* @__PURE__ */ defineComponent({
15
16
  __name: "StoryVariantGrid",
16
17
  setup(__props) {
@@ -67,6 +68,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
67
68
  }
68
69
  }
69
70
  watch(() => storyStore.currentVariant, () => {
71
+ maxItemHeight.value = 0;
70
72
  updateMaxCount();
71
73
  });
72
74
  const gridEl = ref(null);
@@ -78,10 +80,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
78
80
  viewWidth.value = el.value.clientWidth;
79
81
  if (!gridEl.value)
80
82
  return;
81
- const firstCellEl = gridEl.value.children[0];
82
- if (!firstCellEl)
83
- return;
84
- gridColumnWidth.value = firstCellEl.clientWidth;
83
+ if (gridTemplateWidth.value.endsWith("%")) {
84
+ gridColumnWidth.value = viewWidth.value * parseInt(gridTemplateWidth.value) / 100 - gap;
85
+ } else {
86
+ gridColumnWidth.value = parseInt(gridTemplateWidth.value);
87
+ }
85
88
  }
86
89
  onMounted(() => {
87
90
  updateSize();
@@ -96,37 +99,39 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
96
99
  createVNode(ToolbarBackground),
97
100
  createVNode(_sfc_main$1)
98
101
  ])) : createCommentVNode("", true),
99
- createElementVNode("div", {
100
- ref_key: "el",
101
- ref: el,
102
- class: "htw-overflow-y-auto htw-flex htw-flex-1",
103
- onScroll: _cache[0] || (_cache[0] = ($event) => updateMaxCount())
104
- }, [
102
+ createElementVNode("div", _hoisted_3, [
105
103
  createElementVNode("div", {
106
- class: "htw-m-auto",
107
- style: normalizeStyle({
108
- minHeight: `${unref(storyStore).currentStory.variants.length / countPerRow.value * (maxItemHeight.value + gap) - gap}px`
109
- })
104
+ ref_key: "el",
105
+ ref: el,
106
+ class: "htw-flex htw-w-0 htw-flex-1 htw-mx-4",
107
+ onScroll: _cache[0] || (_cache[0] = ($event) => updateMaxCount())
110
108
  }, [
111
109
  createElementVNode("div", {
112
- ref_key: "gridEl",
113
- ref: gridEl,
114
- class: "htw-grid htw-gap-4 htw-m-4",
110
+ class: "htw-m-auto",
115
111
  style: normalizeStyle({
116
- gridTemplateColumns: `repeat(${unref(columnCount)}, ${unref(gridTemplateWidth)})`
112
+ minHeight: `${unref(storyStore).currentStory.variants.length / countPerRow.value * (maxItemHeight.value + gap) - gap}px`
117
113
  })
118
114
  }, [
119
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants.slice(0, maxCount.value), (variant, index) => {
120
- return openBlock(), createBlock(StoryVariantGridItem, {
121
- key: index,
122
- variant,
123
- story: unref(storyStore).currentStory,
124
- onResize: onItemResize
125
- }, null, 8, ["variant", "story"]);
126
- }), 128))
115
+ createElementVNode("div", {
116
+ ref_key: "gridEl",
117
+ ref: gridEl,
118
+ class: "htw-grid htw-gap-4 htw-my-4",
119
+ style: normalizeStyle({
120
+ gridTemplateColumns: `repeat(${unref(columnCount)}, ${gridColumnWidth.value}px)`
121
+ })
122
+ }, [
123
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants.slice(0, maxCount.value), (variant, index) => {
124
+ return openBlock(), createBlock(StoryVariantGridItem, {
125
+ key: index,
126
+ variant,
127
+ story: unref(storyStore).currentStory,
128
+ onResize: onItemResize
129
+ }, null, 8, ["variant", "story"]);
130
+ }), 128))
131
+ ], 4)
127
132
  ], 4)
128
- ], 4)
129
- ], 544)
133
+ ], 544)
134
+ ])
130
135
  ]);
131
136
  };
132
137
  }
@@ -55,15 +55,15 @@
55
55
  color: var(--ae892164);
56
56
  }
57
57
 
58
+ .bind-icon-color[data-v-ab890d9c] {
59
+ color: var(--89126aaa);
60
+ }
61
+
58
62
  .__histoire-code-placeholder[data-v-36810e45] {
59
63
  color: inherit;
60
64
  font-size: inherit;
61
65
  }
62
66
 
63
- .bind-icon-color[data-v-ab890d9c] {
64
- color: var(--89126aaa);
65
- }
66
-
67
67
  .bind-icon-color[data-v-ddfc5b4f] {
68
68
  color: var(--4d25d048);
69
69
  }
package/dist/style.css CHANGED
@@ -440,6 +440,11 @@ body {
440
440
  }
441
441
  }
442
442
 
443
+ .__histoire-render-story {
444
+ overflow: auto;
445
+ min-height: 100%;
446
+ }
447
+
443
448
  .__histoire-code .shiki {
444
449
  background: transparent !important;
445
450
  }
@@ -1298,14 +1303,14 @@ body {
1298
1303
  margin:auto
1299
1304
  }
1300
1305
 
1301
- .htw-m-4{
1302
- margin:1rem
1303
- }
1304
-
1305
1306
  .htw-m-1{
1306
1307
  margin:0.25rem
1307
1308
  }
1308
1309
 
1310
+ .htw-m-4{
1311
+ margin:1rem
1312
+ }
1313
+
1309
1314
  .-htw-my-1{
1310
1315
  margin-top:-0.25rem;
1311
1316
  margin-bottom:-0.25rem
@@ -1326,6 +1331,16 @@ body {
1326
1331
  margin-right:0.5rem
1327
1332
  }
1328
1333
 
1334
+ .htw-mx-4{
1335
+ margin-left:1rem;
1336
+ margin-right:1rem
1337
+ }
1338
+
1339
+ .htw-my-4{
1340
+ margin-top:1rem;
1341
+ margin-bottom:1rem
1342
+ }
1343
+
1329
1344
  .htw-my-0{
1330
1345
  margin-top:0px;
1331
1346
  margin-bottom:0px
@@ -1336,11 +1351,6 @@ body {
1336
1351
  margin-bottom:2rem
1337
1352
  }
1338
1353
 
1339
- .htw-mx-4{
1340
- margin-left:1rem;
1341
- margin-right:1rem
1342
- }
1343
-
1344
1354
  .htw-mt-2{
1345
1355
  margin-top:0.5rem
1346
1356
  }
@@ -1579,6 +1589,10 @@ body {
1579
1589
  width:0.5rem
1580
1590
  }
1581
1591
 
1592
+ .htw-w-0{
1593
+ width:0px
1594
+ }
1595
+
1582
1596
  .htw-w-max{
1583
1597
  width:-moz-max-content;
1584
1598
  width:max-content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/app",
3
- "version": "0.11.6",
3
+ "version": "0.11.8",
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.11.6",
28
- "@histoire/shared": "^0.11.6",
29
- "@histoire/vendors": "^0.11.6",
27
+ "@histoire/controls": "^0.11.8",
28
+ "@histoire/shared": "^0.11.8",
29
+ "@histoire/vendors": "^0.11.8",
30
30
  "@types/flexsearch": "^0.7.3",
31
31
  "flexsearch": "0.7.21",
32
32
  "shiki": "0.10.1"
@@ -33,6 +33,7 @@ function selectValue (value: string, hide: () => void) {
33
33
  <VDropdown
34
34
  class="histoire-base-select"
35
35
  auto-size
36
+ auto-boundary-max-size
36
37
  >
37
38
  <div
38
39
  class="htw-cursor-pointer htw-w-full htw-outline-none htw-px-2 htw-h-[27px] -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 hover:htw-border-primary-500 dark:hover:htw-border-primary-500 htw-rounded-sm htw-flex htw-gap-2 htw-items-center htw-leading-normal"
@@ -29,7 +29,7 @@ watchEffect(async () => {
29
29
  <component
30
30
  :is="mountComponent"
31
31
  v-if="mountComponent"
32
- class="histoire-generic-render-story"
32
+ class="histoire-generic-render-story __histoire-render-story"
33
33
  :story="story"
34
34
  v-bind="$attrs"
35
35
  />
@@ -82,6 +82,7 @@ function onItemResize (w: number, h: number) {
82
82
  }
83
83
 
84
84
  watch(() => storyStore.currentVariant, () => {
85
+ maxItemHeight.value = 0 // Reset max height
85
86
  updateMaxCount()
86
87
  })
87
88
 
@@ -97,10 +98,11 @@ function updateSize () {
97
98
 
98
99
  if (!gridEl.value) return
99
100
 
100
- const firstCellEl = gridEl.value.children[0] as HTMLDivElement
101
- if (!firstCellEl) return
102
-
103
- gridColumnWidth.value = firstCellEl.clientWidth
101
+ if (gridTemplateWidth.value.endsWith('%')) {
102
+ gridColumnWidth.value = viewWidth.value * parseInt(gridTemplateWidth.value) / 100 - gap
103
+ } else {
104
+ gridColumnWidth.value = parseInt(gridTemplateWidth.value)
105
+ }
104
106
  }
105
107
 
106
108
  onMounted(() => {
@@ -125,31 +127,33 @@ const columnCount = computed(() => Math.min(storyStore.currentStory.variants.len
125
127
  <ToolbarTextDirection />
126
128
  </div>
127
129
 
128
- <div
129
- ref="el"
130
- class="htw-overflow-y-auto htw-flex htw-flex-1"
131
- @scroll="updateMaxCount()"
132
- >
130
+ <div class="htw-overflow-y-auto htw-flex htw-flex-1">
133
131
  <div
134
- class="htw-m-auto"
135
- :style="{
136
- minHeight: `${(storyStore.currentStory.variants.length / countPerRow) * (maxItemHeight + gap) - gap}px`,
137
- }"
132
+ ref="el"
133
+ class="htw-flex htw-w-0 htw-flex-1 htw-mx-4"
134
+ @scroll="updateMaxCount()"
138
135
  >
139
136
  <div
140
- ref="gridEl"
141
- class="htw-grid htw-gap-4 htw-m-4"
137
+ class="htw-m-auto"
142
138
  :style="{
143
- gridTemplateColumns: `repeat(${columnCount}, ${gridTemplateWidth})`,
139
+ minHeight: `${(storyStore.currentStory.variants.length / countPerRow) * (maxItemHeight + gap) - gap}px`,
144
140
  }"
145
141
  >
146
- <StoryVariantGridItem
147
- v-for="(variant, index) of storyStore.currentStory.variants.slice(0, maxCount)"
148
- :key="index"
149
- :variant="variant"
150
- :story="storyStore.currentStory"
151
- @resize="onItemResize"
152
- />
142
+ <div
143
+ ref="gridEl"
144
+ class="htw-grid htw-gap-4 htw-my-4"
145
+ :style="{
146
+ gridTemplateColumns: `repeat(${columnCount}, ${gridColumnWidth}px)`,
147
+ }"
148
+ >
149
+ <StoryVariantGridItem
150
+ v-for="(variant, index) of storyStore.currentStory.variants.slice(0, maxCount)"
151
+ :key="index"
152
+ :variant="variant"
153
+ :story="storyStore.currentStory"
154
+ @resize="onItemResize"
155
+ />
156
+ </div>
153
157
  </div>
154
158
  </div>
155
159
  </div>
@@ -64,8 +64,9 @@ button {
64
64
  }
65
65
  }
66
66
 
67
- .__histoire-sandbox {
68
- contain: content;
67
+ .__histoire-render-story {
68
+ overflow: auto;
69
+ min-height: 100%;
69
70
  }
70
71
 
71
72
  .__histoire-code .shiki {
@@ -17,3 +17,8 @@ html {
17
17
  .htw-sandbox-hidden {
18
18
  display: none;
19
19
  }
20
+
21
+ .__histoire-render-story {
22
+ overflow: auto;
23
+ min-height: 100%;
24
+ }