histoire 0.3.2 → 0.4.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/bundled/BaseEmpty.js +13 -0
- package/dist/bundled/HomeView.js +23 -0
- package/dist/bundled/MobileOverlay.js +303 -0
- package/dist/bundled/SearchPane.js +504 -0
- package/dist/bundled/StoryView.js +2330 -0
- package/dist/bundled/api.js +32 -0
- package/dist/bundled/config.js +4 -0
- package/dist/bundled/const.js +5 -0
- package/dist/bundled/dark.js +4 -0
- package/dist/bundled/events.js +29 -0
- package/dist/bundled/global-components.js +203 -0
- package/dist/bundled/index.js +7 -0
- package/dist/bundled/index2.js +762 -0
- package/dist/bundled/reactivity.js +96 -0
- package/dist/bundled/sandbox.js +97 -0
- package/dist/bundled/search-docs-data.js +7 -0
- package/dist/bundled/story.js +59 -0
- package/dist/bundled/style.css +102 -0
- package/dist/client/app/App.vue +2 -2
- package/dist/client/app/api.d.ts +1 -0
- package/dist/client/app/api.js +1 -0
- package/dist/client/app/codegen/vue3.js +1 -3
- package/dist/client/app/components/HomeView.vue +1 -1
- package/dist/client/app/components/app/AppLogo.vue +1 -1
- package/dist/client/app/components/app/MobileOverlay.vue +0 -1
- package/dist/client/app/components/base/BaseEmpty.vue +1 -1
- package/dist/client/app/components/base/BaseOverflowMenu.vue +1 -1
- package/dist/client/app/components/exposed/Story.vue +1 -1
- package/dist/client/app/components/panel/StoryEvent.vue +1 -0
- package/dist/client/app/components/search/SearchItem.vue +1 -1
- package/dist/client/app/components/search/SearchPane.vue +108 -25
- package/dist/client/app/components/search/search-docs-data.d.ts +3 -0
- package/dist/client/app/components/search/{search-data.js → search-docs-data.js} +1 -2
- package/dist/client/app/components/search/search-title-data.d.ts +3 -0
- package/dist/client/app/components/search/search-title-data.js +7 -0
- package/dist/client/app/components/search/types.d.ts +7 -0
- package/dist/client/app/components/search/types.js +1 -0
- package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/dist/client/app/components/story/StoryVariantListItem.vue +1 -1
- package/dist/client/app/components/story/StoryVariantSinglePreviewNative.vue +6 -3
- package/dist/client/app/components/tree/StoryListItem.vue +1 -1
- package/dist/client/app/global-components.js +0 -1
- package/dist/client/app/index.d.ts +1 -1
- package/dist/client/app/index.js +21 -19
- package/dist/client/app/sandbox.d.ts +1 -1
- package/dist/client/app/sandbox.js +0 -2
- package/dist/client/app/stores/events.d.ts +1 -1
- package/dist/client/app/stores/events.js +1 -2
- package/dist/client/app/stores/folder.js +0 -1
- package/dist/client/app/stores/story.js +0 -1
- package/dist/client/app/types.js +0 -1
- package/dist/client/app/util/events.d.ts +1 -1
- package/dist/client/app/util/events.js +2 -3
- package/dist/client/app/util/keyboard.js +0 -1
- package/dist/client/app/util/mapping.js +0 -1
- package/dist/client/app/util/preview-settings.js +0 -1
- package/dist/client/app/util/reactivity.js +0 -1
- package/dist/client/app/util/scroll.js +0 -1
- package/dist/client/app/util/variant.js +0 -1
- package/dist/client/bundle-index.js +5 -0
- package/dist/client/bundle-main.js +5 -0
- package/dist/client/bundle-sandbox.js +3 -0
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -2
- package/dist/client/server/vue3/run.js +8 -1
- package/dist/controls.js +0 -1
- package/dist/node/alias.js +1 -1
- package/dist/node/build.js +4 -4
- package/dist/node/builtin-plugins/tailwind-tokens.js +1 -1
- package/dist/node/search.d.ts +15 -1
- package/dist/node/search.js +78 -32
- package/dist/node/server.js +2 -2
- package/dist/node/types.d.ts +1 -0
- package/dist/node/vite.d.ts +4 -2
- package/dist/node/vite.js +24 -28
- package/package.json +11 -10
- package/src/client/app/App.vue +2 -2
- package/src/client/app/api.ts +1 -0
- package/src/client/app/codegen/vue3.ts +1 -2
- package/src/client/app/components/HomeView.vue +1 -1
- package/src/client/app/components/app/AppLogo.vue +1 -1
- package/src/client/app/components/app/MobileOverlay.vue +0 -1
- package/src/client/app/components/base/BaseEmpty.vue +1 -1
- package/src/client/app/components/base/BaseOverflowMenu.vue +1 -1
- package/src/client/app/components/exposed/Story.vue +1 -1
- package/src/client/app/components/panel/StoryEvent.vue +1 -0
- package/src/client/app/components/search/SearchItem.vue +1 -1
- package/src/client/app/components/search/SearchPane.vue +108 -25
- package/src/client/app/components/search/search-docs-data.ts +10 -0
- package/src/client/app/components/search/search-title-data.ts +10 -0
- package/src/client/app/components/search/types.ts +4 -0
- package/src/client/app/components/story/StoryVariantGridItem.vue +1 -1
- package/src/client/app/components/story/StoryVariantListItem.vue +1 -1
- package/src/client/app/components/story/StoryVariantSinglePreviewNative.vue +6 -3
- package/src/client/app/components/tree/StoryListItem.vue +1 -1
- package/src/client/app/index.ts +23 -19
- package/src/client/app/sandbox.ts +0 -1
- package/src/client/app/stores/events.ts +1 -1
- package/src/client/app/util/events.ts +2 -2
- package/src/client/bundle-index.js +5 -0
- package/src/client/bundle-main.js +5 -0
- package/src/client/bundle-sandbox.js +3 -0
- package/src/client/index.ts +1 -1
- package/src/client/server/vue3/run.ts +11 -0
- package/src/node/alias.ts +1 -1
- package/src/node/build.ts +4 -4
- package/src/node/builtin-plugins/tailwind-tokens.ts +1 -1
- package/src/node/search.ts +87 -32
- package/src/node/server.ts +2 -2
- package/src/node/types.ts +1 -0
- package/src/node/vite.ts +24 -29
- package/vite.config.ts +46 -0
- package/dist/client/app/codegen/vue3.js.map +0 -1
- package/dist/client/app/components/search/search-data.d.ts +0 -2
- package/dist/client/app/components/search/search-data.js.map +0 -1
- package/dist/client/app/global-components.js.map +0 -1
- package/dist/client/app/index.js.map +0 -1
- package/dist/client/app/sandbox.js.map +0 -1
- package/dist/client/app/stores/events.js.map +0 -1
- package/dist/client/app/stores/folder.js.map +0 -1
- package/dist/client/app/stores/story.js.map +0 -1
- package/dist/client/app/types.js.map +0 -1
- package/dist/client/app/util/events.js.map +0 -1
- package/dist/client/app/util/keyboard.js.map +0 -1
- package/dist/client/app/util/mapping.js.map +0 -1
- package/dist/client/app/util/preview-settings.js.map +0 -1
- package/dist/client/app/util/reactivity.js.map +0 -1
- package/dist/client/app/util/scroll.js.map +0 -1
- package/dist/client/app/util/variant.js.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/server/vue3/run.js.map +0 -1
- package/dist/controls.js.map +0 -1
- package/src/client/app/components/search/search-data.ts +0 -9
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { pushScopeId, popScopeId, openBlock, createElementBlock, renderSlot } from "vue";
|
|
2
|
+
import { _ as _export_sfc } from "./MobileOverlay.js";
|
|
3
|
+
var BaseEmpty_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
4
|
+
const _sfc_main = {};
|
|
5
|
+
const _withScopeId = (n) => (pushScopeId("data-v-552cc113"), n = n(), popScopeId(), n);
|
|
6
|
+
const _hoisted_1 = { class: "htw-base-empty htw-flex htw-flex-col htw-items-center htw-justify-center htw-space-y-4 htw-py-12 htw-h-full htw-text-center htw-text-gray-400 htw-text-lg" };
|
|
7
|
+
function _sfc_render(_ctx, _cache) {
|
|
8
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
9
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
var BaseEmpty = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-552cc113"]]);
|
|
13
|
+
export { BaseEmpty as B };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, createElementVNode, unref } from "vue";
|
|
2
|
+
import { h as histoireConfig, c as customLogos } from "./config.js";
|
|
3
|
+
var HistoireLogo = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB3aWR0aD0iNTEyIgogIC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sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
setup(__props) {
|
|
8
|
+
const logoUrl = computed(() => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
return ((_b = (_a = histoireConfig.theme) == null ? void 0 : _a.logo) == null ? void 0 : _b.square) ? customLogos.square : HistoireLogo;
|
|
11
|
+
});
|
|
12
|
+
return (_ctx, _cache) => {
|
|
13
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
14
|
+
createElementVNode("img", {
|
|
15
|
+
src: unref(logoUrl),
|
|
16
|
+
alt: "Logo",
|
|
17
|
+
class: "htw-w-64 htw-h-64 htw-opacity-25"
|
|
18
|
+
}, null, 8, _hoisted_2)
|
|
19
|
+
]);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { defineComponent, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementVNode, normalizeClass, withKeys, renderSlot, watch, onMounted, pushScopeId, popScopeId, ref, computed, onUnmounted, createElementBlock, normalizeStyle, unref, withModifiers, Transition, toDisplayString, createVNode, createCommentVNode } from "vue";
|
|
2
|
+
import scrollIntoView from "scroll-into-view-if-needed";
|
|
3
|
+
import { useMediaQuery } from "@vueuse/core";
|
|
4
|
+
import { Icon } from "@iconify/vue";
|
|
5
|
+
var _export_sfc = (sfc, props) => {
|
|
6
|
+
const target = sfc.__vccOpts || sfc;
|
|
7
|
+
for (const [key, val] of props) {
|
|
8
|
+
target[key] = val;
|
|
9
|
+
}
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
const _sfc_main$2 = defineComponent({
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
isActive: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: void 0
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
emits: {
|
|
21
|
+
navigate: () => true
|
|
22
|
+
},
|
|
23
|
+
setup(props, { emit }) {
|
|
24
|
+
function handleNavigate(event, navigate) {
|
|
25
|
+
emit("navigate");
|
|
26
|
+
navigate(event);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
handleNavigate
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const _hoisted_1$2 = ["href", "onClick", "onKeyup"];
|
|
34
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
35
|
+
const _component_RouterLink = resolveComponent("RouterLink");
|
|
36
|
+
return openBlock(), createBlock(_component_RouterLink, mergeProps(_ctx.$attrs, { custom: "" }), {
|
|
37
|
+
default: withCtx(({ isActive: linkIsActive, href, navigate }) => [
|
|
38
|
+
createElementVNode("a", {
|
|
39
|
+
href,
|
|
40
|
+
class: normalizeClass(["htw-flex htw-items-center htw-gap-2 htw-text-gray-900 dark:htw-text-gray-100", [
|
|
41
|
+
_ctx.$attrs.class,
|
|
42
|
+
(_ctx.isActive != null ? _ctx.isActive : linkIsActive) ? "active htw-bg-primary-500 hover:htw-bg-primary-600 htw-text-white dark:htw-text-black" : "hover:htw-bg-primary-100 dark:hover:htw-bg-primary-900"
|
|
43
|
+
]]),
|
|
44
|
+
onClick: ($event) => _ctx.handleNavigate($event, navigate),
|
|
45
|
+
onKeyup: [
|
|
46
|
+
withKeys(($event) => _ctx.handleNavigate($event, navigate), ["enter"]),
|
|
47
|
+
withKeys(($event) => _ctx.handleNavigate($event, navigate), ["space"])
|
|
48
|
+
]
|
|
49
|
+
}, [
|
|
50
|
+
renderSlot(_ctx.$slots, "default", {
|
|
51
|
+
active: _ctx.isActive != null ? _ctx.isActive : linkIsActive
|
|
52
|
+
})
|
|
53
|
+
], 42, _hoisted_1$2)
|
|
54
|
+
]),
|
|
55
|
+
_: 3
|
|
56
|
+
}, 16);
|
|
57
|
+
}
|
|
58
|
+
var BaseListItemLink = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render]]);
|
|
59
|
+
function useScrollOnActive(active, el) {
|
|
60
|
+
watch(active, (value) => {
|
|
61
|
+
if (value) {
|
|
62
|
+
autoScroll();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
function autoScroll() {
|
|
66
|
+
if (el.value) {
|
|
67
|
+
scrollIntoView(el.value, {
|
|
68
|
+
scrollMode: "if-needed",
|
|
69
|
+
block: "center",
|
|
70
|
+
inline: "nearest",
|
|
71
|
+
behavior: "smooth"
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
onMounted(() => {
|
|
76
|
+
if (active.value) {
|
|
77
|
+
autoScroll();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return {
|
|
81
|
+
autoScroll
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
var BaseSplitPane_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
85
|
+
const _withScopeId = (n) => (pushScopeId("data-v-4de97f66"), n = n(), popScopeId(), n);
|
|
86
|
+
const _hoisted_1$1 = ["onMousedown"];
|
|
87
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
88
|
+
props: {
|
|
89
|
+
orientation: {
|
|
90
|
+
type: String,
|
|
91
|
+
default: "landscape",
|
|
92
|
+
validator: (value) => ["landscape", "portrait"].includes(value)
|
|
93
|
+
},
|
|
94
|
+
defaultSplit: {
|
|
95
|
+
type: Number,
|
|
96
|
+
default: 50
|
|
97
|
+
},
|
|
98
|
+
split: {
|
|
99
|
+
type: Number,
|
|
100
|
+
default: void 0
|
|
101
|
+
},
|
|
102
|
+
min: {
|
|
103
|
+
type: Number,
|
|
104
|
+
default: 20
|
|
105
|
+
},
|
|
106
|
+
max: {
|
|
107
|
+
type: Number,
|
|
108
|
+
default: 80
|
|
109
|
+
},
|
|
110
|
+
draggerOffset: {
|
|
111
|
+
type: String,
|
|
112
|
+
default: "center",
|
|
113
|
+
validator: (value) => ["before", "center", "after"].includes(value)
|
|
114
|
+
},
|
|
115
|
+
saveId: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: null
|
|
118
|
+
},
|
|
119
|
+
fixed: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: false
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
emits: {
|
|
125
|
+
"update:split": (value) => true
|
|
126
|
+
},
|
|
127
|
+
setup(__props, { emit }) {
|
|
128
|
+
const props = __props;
|
|
129
|
+
const SAVE_PREFIX = "__histoire";
|
|
130
|
+
const currentSplit = ref(props.defaultSplit);
|
|
131
|
+
watch(() => props.split, (value) => {
|
|
132
|
+
if (value !== void 0) {
|
|
133
|
+
currentSplit.value = value;
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
immediate: true
|
|
137
|
+
});
|
|
138
|
+
if (props.saveId) {
|
|
139
|
+
const storageKey = `${SAVE_PREFIX}-split-pane-${props.saveId}`;
|
|
140
|
+
const savedValue = localStorage.getItem(storageKey);
|
|
141
|
+
if (savedValue != null) {
|
|
142
|
+
let parsedValue;
|
|
143
|
+
try {
|
|
144
|
+
parsedValue = JSON.parse(savedValue);
|
|
145
|
+
} catch (e) {
|
|
146
|
+
console.error(e);
|
|
147
|
+
}
|
|
148
|
+
if (typeof parsedValue === "number") {
|
|
149
|
+
currentSplit.value = parsedValue;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
watch(currentSplit, (value) => {
|
|
153
|
+
localStorage.setItem(storageKey, JSON.stringify(value));
|
|
154
|
+
});
|
|
155
|
+
watch(currentSplit, (value) => {
|
|
156
|
+
if (value !== props.split) {
|
|
157
|
+
emit("update:split", value);
|
|
158
|
+
}
|
|
159
|
+
}, {
|
|
160
|
+
immediate: true
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const boundSplit = computed(() => {
|
|
164
|
+
if (currentSplit.value < props.min) {
|
|
165
|
+
return props.min;
|
|
166
|
+
} else if (currentSplit.value > props.max) {
|
|
167
|
+
return props.max;
|
|
168
|
+
} else {
|
|
169
|
+
return currentSplit.value;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
const leftStyle = computed(() => ({
|
|
173
|
+
[props.orientation === "landscape" ? "width" : "height"]: props.fixed ? `${boundSplit.value}px` : `${boundSplit.value}%`
|
|
174
|
+
}));
|
|
175
|
+
const rightStyle = computed(() => ({
|
|
176
|
+
[props.orientation === "landscape" ? "width" : "height"]: props.fixed ? null : `${100 - boundSplit.value}%`
|
|
177
|
+
}));
|
|
178
|
+
const dragging = ref(false);
|
|
179
|
+
let startPosition = 0;
|
|
180
|
+
let startSplit = 0;
|
|
181
|
+
const el = ref(null);
|
|
182
|
+
function dragStart(e) {
|
|
183
|
+
dragging.value = true;
|
|
184
|
+
startPosition = props.orientation === "landscape" ? e.pageX : e.pageY;
|
|
185
|
+
startSplit = boundSplit.value;
|
|
186
|
+
window.addEventListener("mousemove", dragMove);
|
|
187
|
+
window.addEventListener("mouseup", dragEnd);
|
|
188
|
+
}
|
|
189
|
+
function dragMove(e) {
|
|
190
|
+
if (dragging.value) {
|
|
191
|
+
let position;
|
|
192
|
+
let totalSize;
|
|
193
|
+
if (props.orientation === "landscape") {
|
|
194
|
+
position = e.pageX;
|
|
195
|
+
totalSize = el.value.offsetWidth;
|
|
196
|
+
} else {
|
|
197
|
+
position = e.pageY;
|
|
198
|
+
totalSize = el.value.offsetHeight;
|
|
199
|
+
}
|
|
200
|
+
const dPosition = position - startPosition;
|
|
201
|
+
if (props.fixed) {
|
|
202
|
+
currentSplit.value = startSplit + dPosition;
|
|
203
|
+
} else {
|
|
204
|
+
currentSplit.value = startSplit + ~~(dPosition / totalSize * 200) / 2;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function dragEnd() {
|
|
209
|
+
dragging.value = false;
|
|
210
|
+
removeDragListeners();
|
|
211
|
+
}
|
|
212
|
+
function removeDragListeners() {
|
|
213
|
+
window.removeEventListener("mousemove", dragMove);
|
|
214
|
+
window.removeEventListener("mouseup", dragEnd);
|
|
215
|
+
}
|
|
216
|
+
onUnmounted(() => {
|
|
217
|
+
removeDragListeners();
|
|
218
|
+
});
|
|
219
|
+
return (_ctx, _cache) => {
|
|
220
|
+
return openBlock(), createElementBlock("div", {
|
|
221
|
+
ref_key: "el",
|
|
222
|
+
ref: el,
|
|
223
|
+
class: normalizeClass(["htw-flex htw-h-full htw-isolate htw-overflow-auto", {
|
|
224
|
+
"htw-flex-col": __props.orientation === "portrait",
|
|
225
|
+
"htw-cursor-ew-resize": dragging.value && __props.orientation === "landscape",
|
|
226
|
+
"htw-cursor-ns-resize": dragging.value && __props.orientation === "portrait",
|
|
227
|
+
[__props.orientation]: true
|
|
228
|
+
}])
|
|
229
|
+
}, [
|
|
230
|
+
createElementVNode("div", {
|
|
231
|
+
class: normalizeClass(["htw-relative htw-top-0 htw-left-0 htw-z-20", {
|
|
232
|
+
"htw-pointer-events-none": dragging.value,
|
|
233
|
+
"htw-border-r htw-border-gray-200 dark:htw-border-gray-850": __props.orientation === "landscape",
|
|
234
|
+
"htw-flex-none": __props.fixed
|
|
235
|
+
}]),
|
|
236
|
+
style: normalizeStyle(unref(leftStyle))
|
|
237
|
+
}, [
|
|
238
|
+
renderSlot(_ctx.$slots, "first", {}, void 0, true),
|
|
239
|
+
createElementVNode("div", {
|
|
240
|
+
class: normalizeClass(["dragger htw-absolute htw-z-100 hover:htw-bg-primary-500/50 htw-transition-colors htw-duration-150 htw-delay-150", {
|
|
241
|
+
"htw-top-0 htw-bottom-0 htw-cursor-ew-resize": __props.orientation === "landscape",
|
|
242
|
+
"htw-left-0 htw-right-0 htw-cursor-ns-resize": __props.orientation === "portrait",
|
|
243
|
+
[`dragger-offset-${__props.draggerOffset}`]: true,
|
|
244
|
+
"htw-bg-primary-500/25": dragging.value
|
|
245
|
+
}]),
|
|
246
|
+
onMousedown: withModifiers(dragStart, ["prevent"])
|
|
247
|
+
}, null, 42, _hoisted_1$1)
|
|
248
|
+
], 6),
|
|
249
|
+
createElementVNode("div", {
|
|
250
|
+
class: normalizeClass(["htw-relative htw-bottom-0 htw-right-0", {
|
|
251
|
+
"htw-pointer-events-none": dragging.value,
|
|
252
|
+
"htw-border-t htw-border-gray-200 dark:htw-border-gray-850": __props.orientation === "portrait",
|
|
253
|
+
"htw-flex-1": __props.fixed
|
|
254
|
+
}]),
|
|
255
|
+
style: normalizeStyle(unref(rightStyle))
|
|
256
|
+
}, [
|
|
257
|
+
renderSlot(_ctx.$slots, "last", {}, void 0, true)
|
|
258
|
+
], 6)
|
|
259
|
+
], 2);
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
var BaseSplitPane = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4de97f66"]]);
|
|
264
|
+
const isMobile = useMediaQuery("(max-width: 640px)");
|
|
265
|
+
const _hoisted_1 = {
|
|
266
|
+
key: 0,
|
|
267
|
+
class: "htw-absolute htw-z-10 htw-bg-white dark:htw-bg-gray-700 htw-w-screen htw-h-screen htw-inset-0 htw-overflow-hidden htw-flex htw-flex-col"
|
|
268
|
+
};
|
|
269
|
+
const _hoisted_2 = { class: "htw-p-4 htw-h-16 htw-flex htw-border-b htw-border-gray-100 dark:htw-border-gray-800 htw-items-center htw-place-content-between" };
|
|
270
|
+
const _hoisted_3 = { class: "htw-text-gray-500" };
|
|
271
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
272
|
+
props: {
|
|
273
|
+
title: null,
|
|
274
|
+
opened: { type: Boolean }
|
|
275
|
+
},
|
|
276
|
+
emits: ["close"],
|
|
277
|
+
setup(__props, { emit: emits }) {
|
|
278
|
+
const props = __props;
|
|
279
|
+
return (_ctx, _cache) => {
|
|
280
|
+
return openBlock(), createBlock(Transition, { name: "__histoire-fade" }, {
|
|
281
|
+
default: withCtx(() => [
|
|
282
|
+
__props.opened ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
283
|
+
createElementVNode("div", _hoisted_2, [
|
|
284
|
+
createElementVNode("span", _hoisted_3, toDisplayString(__props.title), 1),
|
|
285
|
+
createElementVNode("a", {
|
|
286
|
+
class: "htw-p-1 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-cursor-pointer",
|
|
287
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emits("close"))
|
|
288
|
+
}, [
|
|
289
|
+
createVNode(unref(Icon), {
|
|
290
|
+
icon: "carbon:close",
|
|
291
|
+
class: "htw-w-8 htw-h-8 htw-shrink-0"
|
|
292
|
+
})
|
|
293
|
+
])
|
|
294
|
+
]),
|
|
295
|
+
renderSlot(_ctx.$slots, "default")
|
|
296
|
+
])) : createCommentVNode("", true)
|
|
297
|
+
]),
|
|
298
|
+
_: 3
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
export { BaseListItemLink as B, _export_sfc as _, _sfc_main as a, BaseSplitPane as b, isMobile as i, useScrollOnActive as u };
|