@histoire/app 0.11.0 → 0.11.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.
- package/dist/app/style/main.pcss +1 -1
- package/dist/bundled/components/panel/StoryControls.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/bundled/components/story/StoryVariantGrid.vue_vue_type_script_setup_true_lang.js +56 -22
- package/dist/bundled/components/story/StoryVariantGridItem.js +2 -2
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +43 -17
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_5ded7495_lang.js +4 -0
- package/dist/bundled/style.css +9 -6
- package/dist/style.css +60 -5
- package/package.json +4 -4
- package/src/app/components/panel/StoryControls.vue +5 -3
- package/src/app/components/story/StoryVariantGrid.vue +57 -18
- package/src/app/components/story/StoryVariantGridItem.vue +37 -10
- package/src/app/style/main.pcss +1 -1
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_be3a417b_lang.js +0 -4
package/dist/app/style/main.pcss
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, openBlock, createElementBlock, createElementVNode, createBlock, createCommentVNode, withCtx, createVNode,
|
|
1
|
+
import { defineComponent, ref, watch, computed, openBlock, createElementBlock, createElementVNode, unref, createBlock, createCommentVNode, withCtx, createVNode, Fragment, renderList } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import "../story/GenericRenderStory.js";
|
|
4
4
|
import BaseEmpty from "../base/BaseEmpty.js";
|
|
@@ -32,17 +32,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
32
32
|
watch(() => props.variant, () => {
|
|
33
33
|
ready.value = false;
|
|
34
34
|
});
|
|
35
|
+
const hasCustomControls = computed(() => props.variant.slots().controls || props.story.slots().controls);
|
|
35
36
|
return (_ctx, _cache) => {
|
|
36
37
|
var _a, _b, _c, _d;
|
|
37
38
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
38
39
|
createElementVNode("div", _hoisted_2, [
|
|
39
|
-
ready.value ? (openBlock(), createBlock(_sfc_main$1, {
|
|
40
|
+
ready.value || !unref(hasCustomControls) ? (openBlock(), createBlock(_sfc_main$1, {
|
|
40
41
|
key: 0,
|
|
41
42
|
story: __props.story,
|
|
42
43
|
variant: __props.variant
|
|
43
44
|
}, null, 8, ["story", "variant"])) : createCommentVNode("", true)
|
|
44
45
|
]),
|
|
45
|
-
|
|
46
|
+
unref(hasCustomControls) ? (openBlock(), createBlock(_sfc_main$2, {
|
|
46
47
|
key: `${__props.story.id}-${__props.variant.id}`,
|
|
47
48
|
"slot-name": "controls",
|
|
48
49
|
variant: __props.variant,
|
package/dist/bundled/components/story/StoryVariantGrid.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, watch, openBlock, createElementBlock, createElementVNode, normalizeStyle,
|
|
1
|
+
import { defineComponent, computed, ref, watch, onMounted, openBlock, createElementBlock, unref, createVNode, createCommentVNode, createElementVNode, normalizeStyle, Fragment, renderList, createBlock } from "@histoire/vendors/vue";
|
|
2
2
|
import { useResizeObserver } from "@histoire/vendors/vue-use";
|
|
3
3
|
import { useStoryStore } from "../../stores/story.js";
|
|
4
|
+
import { isMobile } from "../../util/responsive.js";
|
|
4
5
|
import StoryVariantGridItem from "./StoryVariantGridItem.js";
|
|
6
|
+
import StoryVariantBackground from "../toolbar/StoryVariantBackground.js";
|
|
7
|
+
const _hoisted_1 = { class: "htw-flex htw-flex-col htw-items-stretch htw-h-full" };
|
|
8
|
+
const _hoisted_2 = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "htw-flex-none htw-flex htw-items-center htw-justify-end htw-h-8 htw-mx-2 htw-mt-1"
|
|
11
|
+
};
|
|
5
12
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
6
13
|
__name: "StoryVariantGrid",
|
|
7
14
|
setup(__props) {
|
|
@@ -29,6 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
29
36
|
const el = ref(null);
|
|
30
37
|
useResizeObserver(el, () => {
|
|
31
38
|
updateMaxCount();
|
|
39
|
+
updateSize();
|
|
32
40
|
});
|
|
33
41
|
function updateMaxCount() {
|
|
34
42
|
if (!maxItemHeight.value)
|
|
@@ -59,35 +67,61 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
59
67
|
watch(() => storyStore.currentVariant, () => {
|
|
60
68
|
updateMaxCount();
|
|
61
69
|
});
|
|
70
|
+
const gridEl = ref(null);
|
|
71
|
+
const gridColumnWidth = ref(1);
|
|
72
|
+
const viewWidth = ref(1);
|
|
73
|
+
function updateSize() {
|
|
74
|
+
if (!el.value)
|
|
75
|
+
return;
|
|
76
|
+
viewWidth.value = el.value.clientWidth;
|
|
77
|
+
if (!gridEl.value)
|
|
78
|
+
return;
|
|
79
|
+
const firstCellEl = gridEl.value.children[0];
|
|
80
|
+
if (!firstCellEl)
|
|
81
|
+
return;
|
|
82
|
+
gridColumnWidth.value = firstCellEl.clientWidth;
|
|
83
|
+
}
|
|
84
|
+
onMounted(() => {
|
|
85
|
+
updateSize();
|
|
86
|
+
});
|
|
87
|
+
const columnCount = computed(() => Math.min(storyStore.currentStory.variants.length, Math.floor((viewWidth.value + gap) / (gridColumnWidth.value + gap))));
|
|
62
88
|
return (_ctx, _cache) => {
|
|
63
|
-
return openBlock(), createElementBlock("div",
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
onScroll: _cache[0] || (_cache[0] = ($event) => updateMaxCount())
|
|
68
|
-
}, [
|
|
89
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
90
|
+
!unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
91
|
+
createVNode(StoryVariantBackground)
|
|
92
|
+
])) : createCommentVNode("", true),
|
|
69
93
|
createElementVNode("div", {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
94
|
+
ref_key: "el",
|
|
95
|
+
ref: el,
|
|
96
|
+
class: "htw-overflow-y-auto __histoire-pane-shadow-from-right htw-flex htw-flex-1",
|
|
97
|
+
onScroll: _cache[0] || (_cache[0] = ($event) => updateMaxCount())
|
|
73
98
|
}, [
|
|
74
99
|
createElementVNode("div", {
|
|
75
|
-
class: "htw-
|
|
100
|
+
class: "htw-m-auto",
|
|
76
101
|
style: normalizeStyle({
|
|
77
|
-
|
|
102
|
+
minHeight: `${unref(storyStore).currentStory.variants.length / countPerRow.value * (maxItemHeight.value + gap) - gap}px`
|
|
78
103
|
})
|
|
79
104
|
}, [
|
|
80
|
-
(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
}
|
|
105
|
+
createElementVNode("div", {
|
|
106
|
+
ref_key: "gridEl",
|
|
107
|
+
ref: gridEl,
|
|
108
|
+
class: "htw-grid htw-gap-4 htw-m-4",
|
|
109
|
+
style: normalizeStyle({
|
|
110
|
+
gridTemplateColumns: `repeat(${unref(columnCount)}, ${unref(gridTemplateWidth)})`
|
|
111
|
+
})
|
|
112
|
+
}, [
|
|
113
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(storyStore).currentStory.variants.slice(0, maxCount.value), (variant, index) => {
|
|
114
|
+
return openBlock(), createBlock(StoryVariantGridItem, {
|
|
115
|
+
key: index,
|
|
116
|
+
variant,
|
|
117
|
+
story: unref(storyStore).currentStory,
|
|
118
|
+
onResize: onItemResize
|
|
119
|
+
}, null, 8, ["variant", "story"]);
|
|
120
|
+
}), 128))
|
|
121
|
+
], 4)
|
|
88
122
|
], 4)
|
|
89
|
-
],
|
|
90
|
-
]
|
|
123
|
+
], 544)
|
|
124
|
+
]);
|
|
91
125
|
};
|
|
92
126
|
}
|
|
93
127
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _sfc_main from "./StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
-
import "./StoryVariantGridItem.
|
|
2
|
+
import "./StoryVariantGridItem.vue_vue_type_style_index_0_scoped_5ded7495_lang.js";
|
|
3
3
|
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
4
|
+
const StoryVariantGridItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5ded7495"]]);
|
|
5
5
|
export {
|
|
6
6
|
StoryVariantGridItem as default
|
|
7
7
|
};
|
package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
import { defineComponent, useCssVars, unref, toRefs, ref, resolveComponent, openBlock, createElementBlock, createElementVNode,
|
|
1
|
+
import { defineComponent, useCssVars, unref, toRefs, ref, resolveComponent, resolveDirective, openBlock, createElementBlock, createElementVNode, withDirectives, createBlock, normalizeClass, withCtx, createVNode, toDisplayString, withModifiers, createCommentVNode, pushScopeId, popScopeId } from "@histoire/vendors/vue";
|
|
2
2
|
import { Icon } from "@histoire/vendors/iconify";
|
|
3
3
|
import { useRouter } from "@histoire/vendors/vue-router";
|
|
4
4
|
import { useResizeObserver } from "@histoire/vendors/vue-use";
|
|
5
|
-
import "./GenericRenderStory.js";
|
|
6
5
|
import { useCurrentVariantRoute } from "../../util/variant.js";
|
|
7
6
|
import { useScrollOnActive } from "../../util/scroll.js";
|
|
8
|
-
import
|
|
9
|
-
|
|
7
|
+
import { usePreviewSettingsStore } from "../../stores/preview-settings.js";
|
|
8
|
+
import "./GenericRenderStory.js";
|
|
9
|
+
import "../toolbar/StoryVariantNewTab.js";
|
|
10
|
+
import CheckerboardPattern from "../misc/CheckerboardPattern.js";
|
|
11
|
+
import _sfc_main$1 from "../toolbar/StoryVariantNewTab.vue_vue_type_script_setup_true_lang.js";
|
|
12
|
+
import _sfc_main$2 from "./GenericRenderStory.vue_vue_type_script_setup_true_lang.js";
|
|
13
|
+
const _withScopeId = (n) => (pushScopeId("data-v-5ded7495"), n = n(), popScopeId(), n);
|
|
10
14
|
const _hoisted_1 = { class: "htw-flex-none htw-flex htw-items-center" };
|
|
15
|
+
const _hoisted_2 = { class: "htw-truncate htw-flex-1" };
|
|
16
|
+
const _hoisted_3 = { class: "htw-flex-none htw-ml-auto htw-hidden group-hover:htw-flex htw-items-center" };
|
|
17
|
+
const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "htw-absolute htw-inset-0 htw-rounded bind-preview-bg" }, null, -1));
|
|
18
|
+
const _hoisted_5 = { class: "htw-relative htw-h-full" };
|
|
11
19
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
20
|
__name: "StoryVariantGridItem",
|
|
13
21
|
props: {
|
|
@@ -26,7 +34,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
26
34
|
setup(__props, { emit }) {
|
|
27
35
|
const props = __props;
|
|
28
36
|
useCssVars((_ctx) => ({
|
|
29
|
-
"
|
|
37
|
+
"35fad884": unref(variant).iconColor,
|
|
38
|
+
"4dbef967": unref(settings).backgroundColor
|
|
30
39
|
}));
|
|
31
40
|
const { variant } = toRefs(props);
|
|
32
41
|
const { isActive, targetRoute } = useCurrentVariantRoute(variant);
|
|
@@ -52,17 +61,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
52
61
|
}
|
|
53
62
|
}
|
|
54
63
|
});
|
|
64
|
+
const settings = usePreviewSettingsStore().currentSettings;
|
|
55
65
|
return (_ctx, _cache) => {
|
|
56
66
|
const _component_RouterLink = resolveComponent("RouterLink");
|
|
67
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
57
68
|
return openBlock(), createElementBlock("div", {
|
|
58
69
|
ref_key: "el",
|
|
59
70
|
ref: el,
|
|
60
|
-
class: "htw-cursor-default htw-flex htw-flex-col htw-gap-y-1"
|
|
71
|
+
class: "htw-cursor-default htw-flex htw-flex-col htw-gap-y-1 htw-group"
|
|
61
72
|
}, [
|
|
62
73
|
createElementVNode("div", _hoisted_1, [
|
|
63
|
-
|
|
74
|
+
withDirectives((openBlock(), createBlock(_component_RouterLink, {
|
|
64
75
|
to: unref(targetRoute),
|
|
65
|
-
class: normalizeClass(["htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1", {
|
|
76
|
+
class: normalizeClass(["htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1 htw-flex-shrink", {
|
|
66
77
|
"hover:htw-bg-gray-200 htw-text-gray-500 dark:hover:htw-bg-gray-800": !unref(isActive),
|
|
67
78
|
"htw-bg-primary-200 hover:htw-bg-primary-300 htw-text-primary-800 dark:htw-bg-primary-700 dark:hover:htw-bg-primary-800 dark:htw-text-primary-200": unref(isActive)
|
|
68
79
|
}])
|
|
@@ -77,14 +88,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
77
88
|
"bind-icon-color": !unref(isActive) && unref(variant).iconColor
|
|
78
89
|
}])
|
|
79
90
|
}, null, 8, ["icon", "class"]),
|
|
80
|
-
createElementVNode("span",
|
|
91
|
+
createElementVNode("span", _hoisted_2, toDisplayString(unref(variant).title), 1)
|
|
81
92
|
];
|
|
82
93
|
}),
|
|
83
94
|
_: 1
|
|
84
|
-
}, 8, ["to", "class"])
|
|
95
|
+
}, 8, ["to", "class"])), [
|
|
96
|
+
[_directive_tooltip, unref(variant).title]
|
|
97
|
+
]),
|
|
98
|
+
createElementVNode("div", _hoisted_3, [
|
|
99
|
+
createVNode(_sfc_main$1, {
|
|
100
|
+
variant: unref(variant),
|
|
101
|
+
story: __props.story
|
|
102
|
+
}, null, 8, ["variant", "story"])
|
|
103
|
+
])
|
|
85
104
|
]),
|
|
86
105
|
createElementVNode("div", {
|
|
87
|
-
class: normalizeClass(["htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded
|
|
106
|
+
class: normalizeClass(["htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded htw-flex-1 htw-p-4 htw-relative", {
|
|
88
107
|
"htw-border-gray-100 dark:htw-border-gray-800": !unref(isActive),
|
|
89
108
|
"htw-border-primary-200 dark:htw-border-primary-900": unref(isActive)
|
|
90
109
|
}]),
|
|
@@ -92,12 +111,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
92
111
|
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => selectVariant(), ["stop"])),
|
|
93
112
|
onKeyup: _cache[1] || (_cache[1] = ($event) => selectVariant())
|
|
94
113
|
}, [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
114
|
+
_hoisted_4,
|
|
115
|
+
unref(settings).checkerboard ? (openBlock(), createBlock(CheckerboardPattern, {
|
|
116
|
+
key: 0,
|
|
117
|
+
class: "htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
118
|
+
})) : createCommentVNode("", true),
|
|
119
|
+
createElementVNode("div", _hoisted_5, [
|
|
120
|
+
(openBlock(), createBlock(_sfc_main$2, {
|
|
121
|
+
key: `${__props.story.id}-${unref(variant).id}`,
|
|
122
|
+
variant: unref(variant),
|
|
123
|
+
story: __props.story,
|
|
124
|
+
onReady
|
|
125
|
+
}, null, 8, ["variant", "story"]))
|
|
126
|
+
])
|
|
101
127
|
], 34)
|
|
102
128
|
], 512);
|
|
103
129
|
};
|
package/dist/bundled/style.css
CHANGED
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
.bind-icon-color[data-v-54d5a557] {
|
|
44
|
+
color: var(--249174dc);
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
.bind-tree-margin[data-v-313a2f42] {
|
|
44
48
|
margin-left: var(--83b95dbe);
|
|
45
49
|
}
|
|
@@ -51,10 +55,6 @@
|
|
|
51
55
|
padding-left: var(--a50b6116);
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
.bind-icon-color[data-v-54d5a557] {
|
|
55
|
-
color: var(--249174dc);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
58
|
.__histoire-code-placeholder[data-v-0d096b10] {
|
|
59
59
|
color: inherit;
|
|
60
60
|
font-size: inherit;
|
|
@@ -72,8 +72,11 @@
|
|
|
72
72
|
color: var(--b88798ec);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.bind-icon-color[data-v-
|
|
76
|
-
color: var(--
|
|
75
|
+
.bind-icon-color[data-v-5ded7495] {
|
|
76
|
+
color: var(--35fad884);
|
|
77
|
+
}
|
|
78
|
+
.bind-preview-bg[data-v-5ded7495] {
|
|
79
|
+
background-color: var(--4dbef967);
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
.bind-preview-bg[data-v-8dc02d19] {
|
package/dist/style.css
CHANGED
|
@@ -398,7 +398,7 @@ a {
|
|
|
398
398
|
text-decoration: inherit;
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
input {
|
|
401
|
+
input, button {
|
|
402
402
|
font-family: inherit;
|
|
403
403
|
}
|
|
404
404
|
|
|
@@ -1240,6 +1240,10 @@ button {
|
|
|
1240
1240
|
margin:0px
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
1243
|
+
.htw-m-auto{
|
|
1244
|
+
margin:auto
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1243
1247
|
.htw-m-4{
|
|
1244
1248
|
margin:1rem
|
|
1245
1249
|
}
|
|
@@ -1303,6 +1307,10 @@ button {
|
|
|
1303
1307
|
margin-top:0px
|
|
1304
1308
|
}
|
|
1305
1309
|
|
|
1310
|
+
.htw-mt-1{
|
|
1311
|
+
margin-top:0.25rem
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1306
1314
|
.-htw-mt-1{
|
|
1307
1315
|
margin-top:-0.25rem
|
|
1308
1316
|
}
|
|
@@ -1311,14 +1319,14 @@ button {
|
|
|
1311
1319
|
margin-right:auto
|
|
1312
1320
|
}
|
|
1313
1321
|
|
|
1314
|
-
.htw-mb-2{
|
|
1315
|
-
margin-bottom:0.5rem
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
1322
|
.htw-mr-2{
|
|
1319
1323
|
margin-right:0.5rem
|
|
1320
1324
|
}
|
|
1321
1325
|
|
|
1326
|
+
.htw-mb-2{
|
|
1327
|
+
margin-bottom:0.5rem
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1322
1330
|
.htw-box-border{
|
|
1323
1331
|
box-sizing:border-box
|
|
1324
1332
|
}
|
|
@@ -1424,6 +1432,10 @@ button {
|
|
|
1424
1432
|
height:1px
|
|
1425
1433
|
}
|
|
1426
1434
|
|
|
1435
|
+
.htw-h-\[22px\]{
|
|
1436
|
+
height:22px
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1427
1439
|
.htw-h-\[100px\]{
|
|
1428
1440
|
height:100px
|
|
1429
1441
|
}
|
|
@@ -1578,6 +1590,10 @@ button {
|
|
|
1578
1590
|
flex:1 1 0%
|
|
1579
1591
|
}
|
|
1580
1592
|
|
|
1593
|
+
.htw-flex-shrink{
|
|
1594
|
+
flex-shrink:1
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1581
1597
|
.htw-shrink-0{
|
|
1582
1598
|
flex-shrink:0
|
|
1583
1599
|
}
|
|
@@ -1657,6 +1673,10 @@ button {
|
|
|
1657
1673
|
flex-wrap:wrap
|
|
1658
1674
|
}
|
|
1659
1675
|
|
|
1676
|
+
.htw-flex-nowrap{
|
|
1677
|
+
flex-wrap:nowrap
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1660
1680
|
.htw-place-content-between{
|
|
1661
1681
|
place-content:space-between
|
|
1662
1682
|
}
|
|
@@ -1677,6 +1697,10 @@ button {
|
|
|
1677
1697
|
align-items:stretch
|
|
1678
1698
|
}
|
|
1679
1699
|
|
|
1700
|
+
.htw-justify-end{
|
|
1701
|
+
justify-content:flex-end
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1680
1704
|
.htw-justify-center{
|
|
1681
1705
|
justify-content:center
|
|
1682
1706
|
}
|
|
@@ -1781,6 +1805,10 @@ button {
|
|
|
1781
1805
|
border-radius:0.375rem
|
|
1782
1806
|
}
|
|
1783
1807
|
|
|
1808
|
+
.\!htw-rounded-\[3px\]{
|
|
1809
|
+
border-radius:3px !important
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1784
1812
|
.htw-rounded-l{
|
|
1785
1813
|
border-top-left-radius:0.375rem;
|
|
1786
1814
|
border-bottom-left-radius:0.375rem
|
|
@@ -1978,6 +2006,11 @@ button {
|
|
|
1978
2006
|
background-color:rgb(var(--_histoire-color-gray-800) / var(--tw-bg-opacity))
|
|
1979
2007
|
}
|
|
1980
2008
|
|
|
2009
|
+
.htw-bg-gray-200{
|
|
2010
|
+
--tw-bg-opacity:1;
|
|
2011
|
+
background-color:rgb(var(--_histoire-color-gray-200) / var(--tw-bg-opacity))
|
|
2012
|
+
}
|
|
2013
|
+
|
|
1981
2014
|
.htw-bg-gray-500\/50{
|
|
1982
2015
|
background-color:rgb(var(--_histoire-color-gray-500) / 0.5)
|
|
1983
2016
|
}
|
|
@@ -2024,6 +2057,10 @@ button {
|
|
|
2024
2057
|
padding:2rem
|
|
2025
2058
|
}
|
|
2026
2059
|
|
|
2060
|
+
.htw-p-px{
|
|
2061
|
+
padding:1px
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2027
2064
|
.htw-px-1{
|
|
2028
2065
|
padding-left:0.25rem;
|
|
2029
2066
|
padding-right:0.25rem
|
|
@@ -2427,6 +2464,15 @@ body {
|
|
|
2427
2464
|
background-color:rgb(var(--_histoire-color-primary-300) / var(--tw-bg-opacity))
|
|
2428
2465
|
}
|
|
2429
2466
|
|
|
2467
|
+
.hover\:htw-bg-primary-200:hover{
|
|
2468
|
+
--tw-bg-opacity:1;
|
|
2469
|
+
background-color:rgb(var(--_histoire-color-primary-200) / var(--tw-bg-opacity))
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
.hover\:htw-bg-gray-500\/20:hover{
|
|
2473
|
+
background-color:rgb(var(--_histoire-color-gray-500) / 0.2)
|
|
2474
|
+
}
|
|
2475
|
+
|
|
2430
2476
|
.hover\:htw-text-primary-500:hover{
|
|
2431
2477
|
--tw-text-opacity:1;
|
|
2432
2478
|
color:rgb(var(--_histoire-color-primary-500) / var(--tw-text-opacity))
|
|
@@ -2458,6 +2504,10 @@ body {
|
|
|
2458
2504
|
background-color:rgb(var(--_histoire-color-gray-100) / 0.5)
|
|
2459
2505
|
}
|
|
2460
2506
|
|
|
2507
|
+
.htw-group:hover .group-hover\:htw-flex{
|
|
2508
|
+
display:flex
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2461
2511
|
.htw-group:hover .group-hover\:htw-border-primary-500{
|
|
2462
2512
|
--tw-border-opacity:1;
|
|
2463
2513
|
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
@@ -2657,6 +2707,11 @@ body {
|
|
|
2657
2707
|
background-color:rgb(var(--_histoire-color-gray-750) / 0.4)
|
|
2658
2708
|
}
|
|
2659
2709
|
|
|
2710
|
+
.htw-group:hover .htw-dark .group-hover\:dark\:htw-border-primary-500{
|
|
2711
|
+
--tw-border-opacity:1;
|
|
2712
|
+
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2660
2715
|
.htw-dark .htw-group:hover .dark\:group-hover\:htw-bg-primary-700{
|
|
2661
2716
|
--tw-bg-opacity:1;
|
|
2662
2717
|
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.11.
|
|
3
|
+
"version": "0.11.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.11.
|
|
28
|
-
"@histoire/shared": "^0.11.
|
|
29
|
-
"@histoire/vendors": "^0.11.
|
|
27
|
+
"@histoire/controls": "^0.11.1",
|
|
28
|
+
"@histoire/shared": "^0.11.1",
|
|
29
|
+
"@histoire/vendors": "^0.11.1",
|
|
30
30
|
"@types/flexsearch": "^0.7.3",
|
|
31
31
|
"flexsearch": "^0.7.21",
|
|
32
32
|
"shiki": "0.10.1"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { PropType, ref, watch } from 'vue'
|
|
2
|
+
import { computed, PropType, ref, watch } from 'vue'
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import GenericRenderStory from '../story/GenericRenderStory.vue'
|
|
5
5
|
import type { Story, Variant } from '../../types'
|
|
@@ -25,6 +25,8 @@ const ready = ref(false)
|
|
|
25
25
|
watch(() => props.variant, () => {
|
|
26
26
|
ready.value = false
|
|
27
27
|
})
|
|
28
|
+
|
|
29
|
+
const hasCustomControls = computed(() => props.variant.slots().controls || props.story.slots().controls)
|
|
28
30
|
</script>
|
|
29
31
|
|
|
30
32
|
<template>
|
|
@@ -37,7 +39,7 @@ watch(() => props.variant, () => {
|
|
|
37
39
|
class="htw-h-9 htw-flex-none htw-px-2 htw-flex htw-items-center"
|
|
38
40
|
>
|
|
39
41
|
<StatePresets
|
|
40
|
-
v-if="ready"
|
|
42
|
+
v-if="ready || !hasCustomControls"
|
|
41
43
|
:story="story"
|
|
42
44
|
:variant="variant"
|
|
43
45
|
/>
|
|
@@ -45,7 +47,7 @@ watch(() => props.variant, () => {
|
|
|
45
47
|
|
|
46
48
|
<!-- Custom controls -->
|
|
47
49
|
<GenericRenderStory
|
|
48
|
-
v-if="
|
|
50
|
+
v-if="hasCustomControls"
|
|
49
51
|
:key="`${story.id}-${variant.id}`"
|
|
50
52
|
slot-name="controls"
|
|
51
53
|
:variant="variant"
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { useResizeObserver } from '@vueuse/core'
|
|
3
|
-
import { computed, ref, watch } from 'vue'
|
|
3
|
+
import { computed, onMounted, ref, watch } from 'vue'
|
|
4
4
|
import { useStoryStore } from '../../stores/story'
|
|
5
|
+
import { isMobile } from '../../util/responsive'
|
|
5
6
|
import StoryVariantGridItem from './StoryVariantGridItem.vue'
|
|
7
|
+
import StoryVariantBackground from '../toolbar/StoryVariantBackground.vue'
|
|
6
8
|
|
|
7
9
|
const storyStore = useStoryStore()
|
|
8
10
|
|
|
@@ -37,6 +39,7 @@ const el = ref<HTMLDivElement>(null)
|
|
|
37
39
|
|
|
38
40
|
useResizeObserver(el, () => {
|
|
39
41
|
updateMaxCount()
|
|
42
|
+
updateSize()
|
|
40
43
|
})
|
|
41
44
|
|
|
42
45
|
function updateMaxCount () {
|
|
@@ -80,32 +83,68 @@ function onItemResize (w: number, h: number) {
|
|
|
80
83
|
watch(() => storyStore.currentVariant, () => {
|
|
81
84
|
updateMaxCount()
|
|
82
85
|
})
|
|
86
|
+
|
|
87
|
+
// Grid size
|
|
88
|
+
|
|
89
|
+
const gridEl = ref<HTMLDivElement>(null)
|
|
90
|
+
const gridColumnWidth = ref(1)
|
|
91
|
+
const viewWidth = ref(1)
|
|
92
|
+
|
|
93
|
+
function updateSize () {
|
|
94
|
+
if (!el.value) return
|
|
95
|
+
viewWidth.value = el.value.clientWidth
|
|
96
|
+
|
|
97
|
+
if (!gridEl.value) return
|
|
98
|
+
|
|
99
|
+
const firstCellEl = gridEl.value.children[0] as HTMLDivElement
|
|
100
|
+
if (!firstCellEl) return
|
|
101
|
+
|
|
102
|
+
gridColumnWidth.value = firstCellEl.clientWidth
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
onMounted(() => {
|
|
106
|
+
updateSize()
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
const columnCount = computed(() => Math.min(storyStore.currentStory.variants.length, Math.floor((viewWidth.value + gap) / (gridColumnWidth.value + gap))))
|
|
83
110
|
</script>
|
|
84
111
|
|
|
85
112
|
<template>
|
|
86
|
-
<div
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
113
|
+
<div class="htw-flex htw-flex-col htw-items-stretch htw-h-full">
|
|
114
|
+
<!-- Toolbar -->
|
|
115
|
+
<div
|
|
116
|
+
v-if="!isMobile"
|
|
117
|
+
class="htw-flex-none htw-flex htw-items-center htw-justify-end htw-h-8 htw-mx-2 htw-mt-1"
|
|
118
|
+
>
|
|
119
|
+
<StoryVariantBackground />
|
|
120
|
+
</div>
|
|
121
|
+
|
|
91
122
|
<div
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
ref="el"
|
|
124
|
+
class="htw-overflow-y-auto __histoire-pane-shadow-from-right htw-flex htw-flex-1"
|
|
125
|
+
@scroll="updateMaxCount()"
|
|
95
126
|
>
|
|
96
127
|
<div
|
|
97
|
-
class="htw-
|
|
128
|
+
class="htw-m-auto"
|
|
98
129
|
:style="{
|
|
99
|
-
|
|
130
|
+
minHeight: `${(storyStore.currentStory.variants.length / countPerRow) * (maxItemHeight + gap) - gap}px`,
|
|
100
131
|
}"
|
|
101
132
|
>
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
133
|
+
<div
|
|
134
|
+
ref="gridEl"
|
|
135
|
+
class="htw-grid htw-gap-4 htw-m-4"
|
|
136
|
+
:style="{
|
|
137
|
+
gridTemplateColumns: `repeat(${columnCount}, ${gridTemplateWidth})`,
|
|
138
|
+
}"
|
|
139
|
+
>
|
|
140
|
+
<StoryVariantGridItem
|
|
141
|
+
v-for="(variant, index) of storyStore.currentStory.variants.slice(0, maxCount)"
|
|
142
|
+
:key="index"
|
|
143
|
+
:variant="variant"
|
|
144
|
+
:story="storyStore.currentStory"
|
|
145
|
+
@resize="onItemResize"
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
109
148
|
</div>
|
|
110
149
|
</div>
|
|
111
150
|
</div>
|
|
@@ -3,10 +3,13 @@ import { PropType, ref, toRefs } from 'vue'
|
|
|
3
3
|
import { Icon } from '@iconify/vue'
|
|
4
4
|
import { useRouter } from 'vue-router'
|
|
5
5
|
import { useResizeObserver } from '@vueuse/core'
|
|
6
|
-
import GenericRenderStory from './GenericRenderStory.vue'
|
|
7
6
|
import { useCurrentVariantRoute } from '../../util/variant'
|
|
8
7
|
import type { Story, Variant } from '../../types'
|
|
9
8
|
import { useScrollOnActive } from '../../util/scroll'
|
|
9
|
+
import { usePreviewSettingsStore } from '../../stores/preview-settings'
|
|
10
|
+
import GenericRenderStory from './GenericRenderStory.vue'
|
|
11
|
+
import StoryVariantNewTab from '../toolbar/StoryVariantNewTab.vue'
|
|
12
|
+
import CheckerboardPattern from '../misc/CheckerboardPattern.vue'
|
|
10
13
|
|
|
11
14
|
const props = defineProps({
|
|
12
15
|
variant: {
|
|
@@ -55,18 +58,21 @@ useResizeObserver(el, () => {
|
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
})
|
|
61
|
+
|
|
62
|
+
const settings = usePreviewSettingsStore().currentSettings
|
|
58
63
|
</script>
|
|
59
64
|
|
|
60
65
|
<template>
|
|
61
66
|
<div
|
|
62
67
|
ref="el"
|
|
63
|
-
class="htw-cursor-default htw-flex htw-flex-col htw-gap-y-1"
|
|
68
|
+
class="htw-cursor-default htw-flex htw-flex-col htw-gap-y-1 htw-group"
|
|
64
69
|
>
|
|
65
70
|
<!-- Header -->
|
|
66
71
|
<div class="htw-flex-none htw-flex htw-items-center">
|
|
67
72
|
<RouterLink
|
|
73
|
+
v-tooltip="variant.title"
|
|
68
74
|
:to="targetRoute"
|
|
69
|
-
class="htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1"
|
|
75
|
+
class="htw-rounded htw-w-max htw-px-2 htw-py-0.5 htw-min-w-16 htw-cursor-pointer htw-flex htw-items-center htw-gap-1 htw-flex-shrink"
|
|
70
76
|
:class="{
|
|
71
77
|
'hover:htw-bg-gray-200 htw-text-gray-500 dark:hover:htw-bg-gray-800': !isActive,
|
|
72
78
|
'htw-bg-primary-200 hover:htw-bg-primary-300 htw-text-primary-800 dark:htw-bg-primary-700 dark:hover:htw-bg-primary-800 dark:htw-text-primary-200': isActive,
|
|
@@ -80,13 +86,21 @@ useResizeObserver(el, () => {
|
|
|
80
86
|
'bind-icon-color': !isActive && variant.iconColor,
|
|
81
87
|
}"
|
|
82
88
|
/>
|
|
83
|
-
<span>{{ variant.title }}</span>
|
|
89
|
+
<span class="htw-truncate htw-flex-1">{{ variant.title }}</span>
|
|
84
90
|
</RouterLink>
|
|
91
|
+
|
|
92
|
+
<!-- Toolbar -->
|
|
93
|
+
<div class="htw-flex-none htw-ml-auto htw-hidden group-hover:htw-flex htw-items-center">
|
|
94
|
+
<StoryVariantNewTab
|
|
95
|
+
:variant="variant"
|
|
96
|
+
:story="story"
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
85
99
|
</div>
|
|
86
100
|
|
|
87
101
|
<!-- Body -->
|
|
88
102
|
<div
|
|
89
|
-
class="htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded
|
|
103
|
+
class="htw-border htw-bg-white dark:htw-bg-gray-700 htw-rounded htw-flex-1 htw-p-4 htw-relative"
|
|
90
104
|
:class="{
|
|
91
105
|
'htw-border-gray-100 dark:htw-border-gray-800': !isActive,
|
|
92
106
|
'htw-border-primary-200 dark:htw-border-primary-900': isActive,
|
|
@@ -95,12 +109,21 @@ useResizeObserver(el, () => {
|
|
|
95
109
|
@click.stop="selectVariant()"
|
|
96
110
|
@keyup="selectVariant()"
|
|
97
111
|
>
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
112
|
+
<div class="htw-absolute htw-inset-0 htw-rounded bind-preview-bg" />
|
|
113
|
+
|
|
114
|
+
<CheckerboardPattern
|
|
115
|
+
v-if="settings.checkerboard"
|
|
116
|
+
class="htw-absolute htw-inset-0 htw-w-full htw-h-full htw-text-gray-500/20"
|
|
103
117
|
/>
|
|
118
|
+
|
|
119
|
+
<div class="htw-relative htw-h-full">
|
|
120
|
+
<GenericRenderStory
|
|
121
|
+
:key="`${story.id}-${variant.id}`"
|
|
122
|
+
:variant="variant"
|
|
123
|
+
:story="story"
|
|
124
|
+
@ready="onReady"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
104
127
|
</div>
|
|
105
128
|
</div>
|
|
106
129
|
</template>
|
|
@@ -109,4 +132,8 @@ useResizeObserver(el, () => {
|
|
|
109
132
|
.bind-icon-color {
|
|
110
133
|
color: v-bind('variant.iconColor');
|
|
111
134
|
}
|
|
135
|
+
|
|
136
|
+
.bind-preview-bg {
|
|
137
|
+
background-color: v-bind('settings.backgroundColor');
|
|
138
|
+
}
|
|
112
139
|
</style>
|
package/src/app/style/main.pcss
CHANGED