histoire 0.7.8 → 0.8.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/App.js +166 -0
- package/dist/bundled/_virtual/plugin-vue_export-helper.js +8 -0
- package/dist/bundled/api.js +1 -32
- package/dist/bundled/assets/histoire-text-dark.js +2 -0
- package/dist/bundled/assets/histoire-text.js +2 -0
- package/dist/bundled/{HomeView.js → assets/histoire.js} +1 -23
- package/dist/bundled/components/HomeView.js +24 -0
- package/dist/bundled/components/app/AppHeader.js +67 -0
- package/dist/bundled/components/app/AppLogo.js +26 -0
- package/dist/bundled/components/app/Breadcrumb.js +95 -0
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/app/InitialLoading.js +48 -0
- package/dist/bundled/components/app/MobileOverlay.js +41 -0
- package/dist/bundled/components/base/BaseCheckbox.js +75 -0
- package/dist/bundled/{BaseEmpty.js → components/base/BaseEmpty.js} +4 -4
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/base/BaseListItemLink.js +50 -0
- package/dist/bundled/components/base/BaseOverflowMenu.js +97 -0
- package/dist/bundled/components/base/BaseOverflowTab.js +45 -0
- package/dist/bundled/components/base/BaseSelect.js +88 -0
- package/dist/bundled/{MobileOverlay.js → components/base/BaseSplitPane.js} +9 -130
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/base/BaseTab.js +45 -0
- package/dist/bundled/components/misc/CheckerboardPattern.js +41 -0
- package/dist/bundled/components/misc/HatchedPattern.js +11 -0
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.js +98 -0
- package/dist/bundled/components/panel/ControlsComponentProps.js +42 -0
- package/dist/bundled/components/panel/PaneTabs.js +110 -0
- package/dist/bundled/components/panel/StatePresets.js +184 -0
- package/dist/bundled/components/panel/StoryControls.js +66 -0
- package/dist/bundled/components/panel/StoryDocs.js +48 -0
- package/dist/bundled/components/panel/StoryEvent.js +56 -0
- package/dist/bundled/components/panel/StoryEvents.js +49 -0
- package/dist/bundled/components/panel/StorySidePanel.js +68 -0
- package/dist/bundled/components/panel/StorySourceCode.js +110 -0
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/search/SearchItem.js +113 -0
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/search/SearchLoading.js +19 -0
- package/dist/bundled/components/search/SearchModal.js +46 -0
- package/dist/bundled/components/search/SearchPane.js +263 -0
- package/dist/bundled/{search-docs-data.js → components/search/search-docs-data.js} +1 -1
- package/dist/bundled/components/search/search-title-data.js +7 -0
- package/dist/bundled/components/story/StoryResponsivePreview.js +180 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantGrid.js +94 -0
- package/dist/bundled/components/story/StoryVariantGridItem.js +106 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantListItem.js +58 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantSingle.js +115 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.js +43 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.js +119 -0
- package/dist/bundled/components/story/StoryVariantSingleView.js +49 -0
- package/dist/bundled/components/story/StoryView.js +107 -0
- package/dist/bundled/components/story/StoryViewer.js +57 -0
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.js +85 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/toolbar/StoryVariantNewTab.js +33 -0
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +129 -0
- package/dist/bundled/components/toolbar/StoryVariantTitle.js +24 -0
- package/dist/bundled/components/tree/StoryGroup.js +74 -0
- package/dist/bundled/components/tree/StoryList.js +37 -0
- package/dist/bundled/components/tree/StoryListFolder.js +89 -0
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/components/tree/StoryListItem.js +72 -0
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_true_lang.js +2 -0
- package/dist/bundled/index.js +28 -5
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +40 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +5 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +11 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +26 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +10 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +50 -0
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +8 -0
- package/dist/bundled/router.js +28 -0
- package/dist/bundled/sandbox.js +11 -14
- package/dist/bundled/{events.js → stores/events.js} +3 -3
- package/dist/bundled/stores/folder.js +46 -0
- package/dist/bundled/stores/preview-settings.js +15 -0
- package/dist/bundled/{story.js → stores/story.js} +4 -30
- package/dist/bundled/style.css +55 -55
- package/dist/bundled/{config.js → util/config.js} +1 -1
- package/dist/bundled/{const.js → util/const.js} +1 -1
- package/dist/bundled/util/dark.js +4 -0
- package/dist/bundled/util/env.js +2 -0
- package/dist/bundled/util/events.js +32 -0
- package/dist/bundled/util/keyboard.js +84 -0
- package/dist/bundled/{mapping.js → util/mapping.js} +5 -5
- package/dist/bundled/util/preview-settings.js +6 -0
- package/dist/bundled/util/responsive.js +3 -0
- package/dist/bundled/util/sandbox.js +8 -0
- package/dist/bundled/util/scroll.js +28 -0
- package/dist/bundled/{state.js → util/state.js} +4 -3
- package/dist/bundled/util/tooltip.js +12 -0
- package/dist/bundled/util/variant.js +35 -0
- package/dist/client/app/App.vue +0 -1
- package/dist/client/app/components/app/Breadcrumb.vue +1 -1
- package/dist/client/app/components/app/MobileOverlay.vue +1 -1
- package/dist/client/app/components/base/BaseCheckbox.vue +2 -1
- package/dist/client/app/components/base/BaseCopyIcon.vue +34 -0
- package/dist/client/app/components/base/BaseOverflowMenu.vue +1 -0
- package/dist/client/app/components/base/BaseSplitPane.vue +1 -0
- package/dist/client/app/components/panel/StatePresets.vue +3 -3
- package/dist/client/app/components/panel/StorySidePanel.vue +1 -1
- package/dist/client/app/components/story/StoryVariantGridItem.vue +1 -0
- package/dist/client/app/components/story/StoryVariantSingle.vue +5 -7
- package/dist/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -6
- package/dist/client/app/components/story/StoryViewer.vue +2 -2
- package/dist/client/app/components/tree/StoryList.vue +1 -1
- package/dist/client/app/components/tree/StoryListItem.vue +2 -2
- package/dist/client/app/index.js +1 -3
- package/dist/client/app/sandbox.js +3 -2
- package/dist/client/app/stores/story.d.ts +30 -30
- package/dist/client/app/util/dark.d.ts +1 -1
- package/dist/client/app/util/mapping.js +3 -3
- package/dist/client/app/util/responsive.d.ts +1 -1
- package/dist/client/app/util/scroll.js +1 -1
- package/dist/client/app/util/state.js +2 -1
- package/dist/node/build.js +1 -1
- package/dist/node/vite.d.ts +1 -1
- package/dist/node/vite.js +6 -2
- package/dist/style.css +21 -0
- package/package.json +8 -14
- package/src/client/app/App.vue +0 -1
- package/src/client/app/components/app/Breadcrumb.vue +1 -1
- package/src/client/app/components/app/MobileOverlay.vue +1 -1
- package/src/client/app/components/base/BaseCheckbox.vue +2 -1
- package/src/client/app/components/base/BaseCopyIcon.vue +34 -0
- package/src/client/app/components/base/BaseOverflowMenu.vue +1 -0
- package/src/client/app/components/base/BaseSplitPane.vue +1 -0
- package/src/client/app/components/panel/StatePresets.vue +3 -3
- package/src/client/app/components/panel/StorySidePanel.vue +1 -1
- package/src/client/app/components/story/StoryVariantGridItem.vue +1 -0
- package/src/client/app/components/story/StoryVariantSingle.vue +5 -7
- package/src/client/app/components/story/StoryVariantSinglePreviewRemote.vue +3 -6
- package/src/client/app/components/story/StoryViewer.vue +2 -2
- package/src/client/app/components/tree/StoryList.vue +1 -1
- package/src/client/app/components/tree/StoryListItem.vue +2 -2
- package/src/client/app/index.ts +1 -5
- package/src/client/app/sandbox.ts +3 -2
- package/src/client/app/util/mapping.ts +3 -3
- package/src/client/app/util/scroll.ts +1 -1
- package/src/client/app/util/state.ts +2 -1
- package/src/node/build.ts +1 -1
- package/src/node/vite.ts +6 -2
- package/tsconfig.json +11 -0
- package/vite.config.ts +20 -10
- package/dist/bundled/SearchPane.js +0 -506
- package/dist/bundled/StoryView.js +0 -2264
- package/dist/bundled/dark.js +0 -4
- package/dist/bundled/index2.js +0 -843
|
@@ -1,506 +0,0 @@
|
|
|
1
|
-
import { pushScopeId, popScopeId, defineComponent, useCssVars, ref, toRefs, openBlock, createElementBlock, unref, createVNode, withCtx, normalizeClass, createElementVNode, createTextVNode, toDisplayString, Fragment, renderList, createBlock, createCommentVNode, markRaw, watch, computed, withDirectives, withKeys, withModifiers, vModelText } from "vue";
|
|
2
|
-
import { useFocus, useDebounce } from "@vueuse/core";
|
|
3
|
-
import { Icon } from "@iconify/vue";
|
|
4
|
-
import flexsearch from "flexsearch";
|
|
5
|
-
import { u as useStoryStore } from "./story.js";
|
|
6
|
-
import { B as BaseEmpty } from "./BaseEmpty.js";
|
|
7
|
-
import { useRouter } from "vue-router";
|
|
8
|
-
import { o as onKeyboardShortcut } from "./index2.js";
|
|
9
|
-
import { u as useScrollOnActive, B as BaseListItemLink, _ as _export_sfc } from "./MobileOverlay.js";
|
|
10
|
-
import { searchData as searchData$1, onUpdate as onUpdate$1 } from "$histoire-search-title-data";
|
|
11
|
-
function IndexInterface() {
|
|
12
|
-
this.cache = null, this.matcher = null, this.stemmer = null, this.filter = null;
|
|
13
|
-
}
|
|
14
|
-
IndexInterface.prototype.add, IndexInterface.prototype.append, IndexInterface.prototype.search, IndexInterface.prototype.update, IndexInterface.prototype.remove;
|
|
15
|
-
function DocumentInterface() {
|
|
16
|
-
this.field = null, this.index = null;
|
|
17
|
-
}
|
|
18
|
-
function parse_option(a, b) {
|
|
19
|
-
return typeof a == "undefined" ? b : a;
|
|
20
|
-
}
|
|
21
|
-
function create_object_array(a) {
|
|
22
|
-
const b = Array(a);
|
|
23
|
-
for (let c = 0; c < a; c++)
|
|
24
|
-
b[c] = create_object();
|
|
25
|
-
return b;
|
|
26
|
-
}
|
|
27
|
-
function create_arrays(a) {
|
|
28
|
-
const b = Array(a);
|
|
29
|
-
for (let c = 0; c < a; c++)
|
|
30
|
-
b[c] = [];
|
|
31
|
-
return b;
|
|
32
|
-
}
|
|
33
|
-
function get_keys(a) {
|
|
34
|
-
return Object.keys(a);
|
|
35
|
-
}
|
|
36
|
-
function create_object() {
|
|
37
|
-
return /* @__PURE__ */ Object.create(null);
|
|
38
|
-
}
|
|
39
|
-
function concat(a) {
|
|
40
|
-
return [].concat.apply([], a);
|
|
41
|
-
}
|
|
42
|
-
function sort_by_length_down(c, a) {
|
|
43
|
-
return a.length - c.length;
|
|
44
|
-
}
|
|
45
|
-
function is_array(a) {
|
|
46
|
-
return a.constructor === Array;
|
|
47
|
-
}
|
|
48
|
-
function is_string(a) {
|
|
49
|
-
return typeof a == "string";
|
|
50
|
-
}
|
|
51
|
-
function is_object(a) {
|
|
52
|
-
return typeof a == "object";
|
|
53
|
-
}
|
|
54
|
-
function is_function(a) {
|
|
55
|
-
return typeof a == "function";
|
|
56
|
-
}
|
|
57
|
-
function pipeline(a, b, c, d) {
|
|
58
|
-
if (a && (b && (a = replace(a, b)), this.matcher && (a = replace(a, this.matcher)), this.stemmer && 1 < a.length && (a = replace(a, this.stemmer)), d && 1 < a.length && (a = collapse(a)), c || c === "")) {
|
|
59
|
-
const b2 = a.split(c);
|
|
60
|
-
return this.filter ? filter$1(b2, this.filter) : b2;
|
|
61
|
-
}
|
|
62
|
-
return a;
|
|
63
|
-
}
|
|
64
|
-
const regex_whitespace = /[\p{Z}\p{S}\p{P}\p{C}]+/u;
|
|
65
|
-
const regex_normalize = /[\u0300-\u036f]/g;
|
|
66
|
-
function normalize(a) {
|
|
67
|
-
return a.normalize && (a = a.normalize("NFD").replace(regex_normalize, "")), a;
|
|
68
|
-
}
|
|
69
|
-
function init_filter(a) {
|
|
70
|
-
const b = create_object();
|
|
71
|
-
for (let c = 0, d = a.length; c < d; c++)
|
|
72
|
-
b[a[c]] = 1;
|
|
73
|
-
return b;
|
|
74
|
-
}
|
|
75
|
-
function init_stemmer_or_matcher(a, b) {
|
|
76
|
-
const c = get_keys(a), d = c.length, e = [];
|
|
77
|
-
let f = "", g = 0;
|
|
78
|
-
for (let h, j, k = 0; k < d; k++)
|
|
79
|
-
h = c[k], j = a[h], j ? (e[g++] = regex(b ? "(?!\\b)" + h + "(\\b|_)" : h), e[g++] = j) : f += (f ? "|" : "") + h;
|
|
80
|
-
return f && (e[g++] = regex(b ? "(?!\\b)(" + f + ")(\\b|_)" : "(" + f + ")"), e[g] = ""), e;
|
|
81
|
-
}
|
|
82
|
-
function replace(a, b) {
|
|
83
|
-
for (let c = 0, d = b.length; c < d && (a = a.replace(b[c], b[c + 1]), !!a); c += 2)
|
|
84
|
-
;
|
|
85
|
-
return a;
|
|
86
|
-
}
|
|
87
|
-
function regex(a) {
|
|
88
|
-
return new RegExp(a, "g");
|
|
89
|
-
}
|
|
90
|
-
function collapse(a) {
|
|
91
|
-
let b = "", c = "";
|
|
92
|
-
for (let d, e = 0, f = a.length; e < f; e++)
|
|
93
|
-
(d = a[e]) !== c && (b += c = d);
|
|
94
|
-
return b;
|
|
95
|
-
}
|
|
96
|
-
function filter$1(a, b) {
|
|
97
|
-
const c = a.length, d = [];
|
|
98
|
-
for (let e = 0, f = 0; e < c; e++) {
|
|
99
|
-
const c2 = a[e];
|
|
100
|
-
c2 && !b[c2] && (d[f++] = c2);
|
|
101
|
-
}
|
|
102
|
-
return d;
|
|
103
|
-
}
|
|
104
|
-
const rtl$2 = false;
|
|
105
|
-
const tokenize$2 = "";
|
|
106
|
-
var simple = { encode: encode$2, rtl: false, tokenize: "" };
|
|
107
|
-
const regex_a = regex("[\xE0\xE1\xE2\xE3\xE4\xE5]"), regex_e = regex("[\xE8\xE9\xEA\xEB]"), regex_i = regex("[\xEC\xED\xEE\xEF]"), regex_o = regex("[\xF2\xF3\xF4\xF5\xF6\u0151]"), regex_u = regex("[\xF9\xFA\xFB\xFC\u0171]"), regex_y = regex("[\xFD\u0177\xFF]"), regex_n = regex("\xF1"), regex_c = regex("[\xE7c]"), regex_s = regex("\xDF"), regex_and = regex(" & "), pairs$1 = [regex_a, "a", regex_e, "e", regex_i, "i", regex_o, "o", regex_u, "u", regex_y, "y", regex_n, "n", regex_c, "k", regex_s, "s", regex_and, " and "];
|
|
108
|
-
function encode$2(a) {
|
|
109
|
-
return a = "" + a, pipeline.call(this, normalize(a).toLowerCase(), !a.normalize && pairs$1, regex_whitespace, false);
|
|
110
|
-
}
|
|
111
|
-
const rtl$1 = false;
|
|
112
|
-
const tokenize$1 = "strict";
|
|
113
|
-
var balance = { encode: encode$1, rtl: false, tokenize: "strict" };
|
|
114
|
-
const regex_strip = /[^a-z0-9]+/, soundex = { b: "p", v: "f", w: "f", z: "s", x: "s", \u00DF: "s", d: "t", n: "m", c: "k", g: "k", j: "k", q: "k", i: "e", y: "e", u: "o" };
|
|
115
|
-
function encode$1(a) {
|
|
116
|
-
a = encode$2.call(this, a).join(" ");
|
|
117
|
-
const b = [];
|
|
118
|
-
if (a) {
|
|
119
|
-
const c = a.split(regex_strip), d = c.length;
|
|
120
|
-
for (let e, f = 0, g = 0; f < d; f++)
|
|
121
|
-
if ((a = c[f]) && (!this.filter || !this.filter[a])) {
|
|
122
|
-
e = a[0];
|
|
123
|
-
let c2 = soundex[e] || e, d2 = c2;
|
|
124
|
-
for (let b2 = 1; b2 < a.length; b2++) {
|
|
125
|
-
e = a[b2];
|
|
126
|
-
const f2 = soundex[e] || e;
|
|
127
|
-
f2 && f2 !== d2 && (c2 += f2, d2 = f2);
|
|
128
|
-
}
|
|
129
|
-
b[g++] = c2;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return b;
|
|
133
|
-
}
|
|
134
|
-
const rtl = false;
|
|
135
|
-
const tokenize = "";
|
|
136
|
-
var charset = { encode, rtl: false, tokenize: "" };
|
|
137
|
-
const regex_ae = regex("ae"), regex_oe = regex("oe"), regex_sh = regex("sh"), regex_th = regex("th"), regex_ph = regex("ph"), regex_pf = regex("pf"), pairs = [regex_ae, "a", regex_oe, "o", regex_sh, "s", regex_th, "t", regex_ph, "f", regex_pf, "f", regex("(?![aeo])h(?![aeo])"), "", regex("(?!^[aeo])h(?!^[aeo])"), ""];
|
|
138
|
-
function encode(a, b) {
|
|
139
|
-
return a && (a = encode$1.call(this, a).join(" "), 2 < a.length && (a = replace(a, pairs)), !b && (1 < a.length && (a = collapse(a)), a && (a = a.split(" ")))), a;
|
|
140
|
-
}
|
|
141
|
-
const filter = ["a", "about", "above", "after", "again", "against", "all", "also", "am", "an", "and", "any", "are", "aren't", "as", "at", "be", "because", "been", "before", "being", "below", "both", "but", "by", "can", "cannot", "can't", "come", "could", "couldn't", "did", "didn't", "do", "does", "doesn't", "doing", "dont", "down", "during", "each", "even", "few", "first", "for", "from", "further", "get", "go", "had", "hadn't", "has", "hasn't", "have", "haven't", "having", "he", "hed", "her", "here", "here's", "hers", "herself", "hes", "him", "himself", "his", "how", "how's", "i", "id", "if", "ill", "im", "in", "into", "is", "isn't", "it", "it's", "itself", "i've", "just", "know", "let's", "like", "make", "me", "more", "most", "mustn't", "my", "myself", "new", "no", "nor", "not", "now", "of", "off", "on", "once", "only", "or", "other", "ought", "our", "our's", "ourselves", "out", "over", "own", "same", "say", "see", "shan't", "she", "she'd", "shell", "shes", "should", "shouldn't", "so", "some", "such", "than", "that", "that's", "the", "their", "theirs", "them", "themselves", "then", "there", "there's", "these", "they", "they'd", "they'll", "they're", "they've", "this", "those", "through", "time", "to", "too", "until", "up", "us", "very", "want", "was", "wasn't", "way", "we", "wed", "well", "were", "weren't", "we've", "what", "what's", "when", "when's", "where", "where's", "which", "while", "who", "whom", "who's", "why", "why's", "will", "with", "won't", "would", "wouldn't", "you", "you'd", "you'll", "your", "you're", "your's", "yourself", "yourselves", "you've"];
|
|
142
|
-
const stemmer = { ational: "ate", iveness: "ive", fulness: "ful", ousness: "ous", ization: "ize", tional: "tion", biliti: "ble", icate: "ic", ative: "", alize: "al", iciti: "ic", entli: "ent", ousli: "ous", alism: "al", ation: "ate", aliti: "al", iviti: "ive", ement: "", enci: "ence", anci: "ance", izer: "ize", alli: "al", ator: "ate", logi: "log", ical: "ic", ance: "", ence: "", ness: "", able: "", ible: "", ment: "", eli: "e", bli: "ble", ful: "", ant: "", ent: "", ism: "", ate: "", iti: "", ous: "", ive: "", ize: "", al: "", ou: "", er: "", ic: "" };
|
|
143
|
-
const matcher = {};
|
|
144
|
-
var language = { filter, stemmer, matcher };
|
|
145
|
-
var SearchItem_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
146
|
-
const _withScopeId = (n) => (pushScopeId("data-v-7856c5b0"), n = n(), popScopeId(), n);
|
|
147
|
-
const _hoisted_1$1 = ["data-selected"];
|
|
148
|
-
const _hoisted_2$1 = { class: "htw-flex-1" };
|
|
149
|
-
const _hoisted_3 = { class: "htw-flex" };
|
|
150
|
-
const _hoisted_4 = { class: "htw-ml-auto htw-opacity-40" };
|
|
151
|
-
const _hoisted_5 = {
|
|
152
|
-
key: 0,
|
|
153
|
-
class: "htw-flex htw-items-center htw-gap-0.5 htw-opacity-60"
|
|
154
|
-
};
|
|
155
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
156
|
-
name: "SearchItem",
|
|
157
|
-
props: {
|
|
158
|
-
result: {
|
|
159
|
-
type: Object,
|
|
160
|
-
required: true
|
|
161
|
-
},
|
|
162
|
-
selected: {
|
|
163
|
-
type: Boolean,
|
|
164
|
-
default: false
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
emits: {
|
|
168
|
-
close: () => true
|
|
169
|
-
},
|
|
170
|
-
setup(__props, { emit }) {
|
|
171
|
-
const props = __props;
|
|
172
|
-
useCssVars((_ctx) => ({
|
|
173
|
-
"0e1c785e": __props.result.iconColor
|
|
174
|
-
}));
|
|
175
|
-
const el = ref();
|
|
176
|
-
const { selected } = toRefs(props);
|
|
177
|
-
useScrollOnActive(selected, el);
|
|
178
|
-
const router = useRouter();
|
|
179
|
-
onKeyboardShortcut(["enter"], () => {
|
|
180
|
-
if (!props.selected)
|
|
181
|
-
return;
|
|
182
|
-
router.push(props.result.route);
|
|
183
|
-
emit("close");
|
|
184
|
-
});
|
|
185
|
-
const defaultIcons = {
|
|
186
|
-
story: "carbon:cube",
|
|
187
|
-
variant: "carbon:cube"
|
|
188
|
-
};
|
|
189
|
-
const kindLabels = {
|
|
190
|
-
story: "Story",
|
|
191
|
-
variant: "Variant"
|
|
192
|
-
};
|
|
193
|
-
return (_ctx, _cache) => {
|
|
194
|
-
return openBlock(), createElementBlock("div", {
|
|
195
|
-
ref_key: "el",
|
|
196
|
-
ref: el,
|
|
197
|
-
"data-test-id": "search-item",
|
|
198
|
-
"data-selected": unref(selected) ? "" : void 0
|
|
199
|
-
}, [
|
|
200
|
-
createVNode(BaseListItemLink, {
|
|
201
|
-
to: __props.result.route,
|
|
202
|
-
"is-active": unref(selected),
|
|
203
|
-
class: "htw-px-6 htw-py-4 htw-gap-4",
|
|
204
|
-
onNavigate: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
|
|
205
|
-
}, {
|
|
206
|
-
default: withCtx(() => {
|
|
207
|
-
var _a, _b;
|
|
208
|
-
return [
|
|
209
|
-
createVNode(unref(Icon), {
|
|
210
|
-
icon: (_a = __props.result.icon) != null ? _a : defaultIcons[__props.result.kind],
|
|
211
|
-
class: normalizeClass(["htw-w-4 htw-h-4", [
|
|
212
|
-
!unref(selected) ? [
|
|
213
|
-
__props.result.iconColor ? "bind-icon-color" : {
|
|
214
|
-
"htw-text-primary-500": __props.result.kind === "story",
|
|
215
|
-
"htw-text-gray-500": __props.result.kind === "variant"
|
|
216
|
-
}
|
|
217
|
-
] : []
|
|
218
|
-
]])
|
|
219
|
-
}, null, 8, ["icon", "class"]),
|
|
220
|
-
createElementVNode("div", _hoisted_2$1, [
|
|
221
|
-
createElementVNode("div", _hoisted_3, [
|
|
222
|
-
createTextVNode(toDisplayString(__props.result.title) + " ", 1),
|
|
223
|
-
createElementVNode("span", _hoisted_4, toDisplayString(kindLabels[__props.result.kind]), 1)
|
|
224
|
-
]),
|
|
225
|
-
((_b = __props.result.path) == null ? void 0 : _b.length) ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
226
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.result.path, (p, index) => {
|
|
227
|
-
return openBlock(), createElementBlock("div", {
|
|
228
|
-
key: index,
|
|
229
|
-
class: "htw-flex htw-items-center htw-gap-0.5"
|
|
230
|
-
}, [
|
|
231
|
-
index > 0 ? (openBlock(), createBlock(unref(Icon), {
|
|
232
|
-
key: 0,
|
|
233
|
-
icon: "carbon:chevron-right",
|
|
234
|
-
class: "htw-w-4 htw-h-4 htw-mt-0.5 htw-opacity-50"
|
|
235
|
-
})) : createCommentVNode("", true),
|
|
236
|
-
createElementVNode("span", null, toDisplayString(p), 1)
|
|
237
|
-
]);
|
|
238
|
-
}), 128))
|
|
239
|
-
])) : createCommentVNode("", true)
|
|
240
|
-
])
|
|
241
|
-
];
|
|
242
|
-
}),
|
|
243
|
-
_: 1
|
|
244
|
-
}, 8, ["to", "is-active"])
|
|
245
|
-
], 8, _hoisted_1$1);
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
var SearchItem = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-7856c5b0"]]);
|
|
250
|
-
const searchData = markRaw(searchData$1);
|
|
251
|
-
function onUpdate(cb) {
|
|
252
|
-
onUpdate$1(cb);
|
|
253
|
-
}
|
|
254
|
-
const _hoisted_1 = /* @__PURE__ */ createTextVNode(" No results ");
|
|
255
|
-
const _hoisted_2 = {
|
|
256
|
-
key: 1,
|
|
257
|
-
class: "htw-max-h-[400px] htw-overflow-y-auto htw-rounded-b-lg"
|
|
258
|
-
};
|
|
259
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
260
|
-
name: "SearchPane",
|
|
261
|
-
props: {
|
|
262
|
-
shown: {
|
|
263
|
-
type: Boolean,
|
|
264
|
-
default: false
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
emits: {
|
|
268
|
-
close: () => true
|
|
269
|
-
},
|
|
270
|
-
setup(__props, { emit }) {
|
|
271
|
-
const props = __props;
|
|
272
|
-
const DocSearchData = () => import("./search-docs-data.js");
|
|
273
|
-
function close() {
|
|
274
|
-
emit("close");
|
|
275
|
-
}
|
|
276
|
-
const input = ref();
|
|
277
|
-
const { focused } = useFocus(input, {
|
|
278
|
-
initialValue: true
|
|
279
|
-
});
|
|
280
|
-
watch(() => props.shown, (value) => {
|
|
281
|
-
if (value) {
|
|
282
|
-
requestAnimationFrame(() => {
|
|
283
|
-
focused.value = true;
|
|
284
|
-
input.value.select();
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
const searchInputText = ref("");
|
|
289
|
-
const rateLimitedSearch = useDebounce(searchInputText, 50);
|
|
290
|
-
const storyStore = useStoryStore();
|
|
291
|
-
let titleSearchIndex;
|
|
292
|
-
let titleIdMap;
|
|
293
|
-
function createIndex() {
|
|
294
|
-
return new flexsearch.Document({
|
|
295
|
-
preset: "match",
|
|
296
|
-
document: {
|
|
297
|
-
id: "id",
|
|
298
|
-
index: [
|
|
299
|
-
"text"
|
|
300
|
-
]
|
|
301
|
-
},
|
|
302
|
-
worker: true,
|
|
303
|
-
charset,
|
|
304
|
-
language,
|
|
305
|
-
tokenize: "forward"
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
async function loadSearchIndex(data) {
|
|
309
|
-
titleSearchIndex = createIndex();
|
|
310
|
-
for (const key of Object.keys(data.index)) {
|
|
311
|
-
await titleSearchIndex.import(key, data.index[key]);
|
|
312
|
-
}
|
|
313
|
-
titleIdMap = data.idMap;
|
|
314
|
-
}
|
|
315
|
-
loadSearchIndex(searchData);
|
|
316
|
-
onUpdate((searchData2) => {
|
|
317
|
-
loadSearchIndex(searchData2);
|
|
318
|
-
});
|
|
319
|
-
let docSearchIndex;
|
|
320
|
-
let docIdMap;
|
|
321
|
-
async function loadDocSearchIndex() {
|
|
322
|
-
async function load(data) {
|
|
323
|
-
docSearchIndex = createIndex();
|
|
324
|
-
for (const key of Object.keys(data.index)) {
|
|
325
|
-
await docSearchIndex.import(key, data.index[key]);
|
|
326
|
-
}
|
|
327
|
-
docIdMap = data.idMap;
|
|
328
|
-
if (rateLimitedSearch.value) {
|
|
329
|
-
searchOnDocField(rateLimitedSearch.value);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
const searchDataModule = await DocSearchData();
|
|
333
|
-
load(searchDataModule.searchData);
|
|
334
|
-
searchDataModule.onUpdate((searchData2) => {
|
|
335
|
-
load(searchData2);
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
loadDocSearchIndex();
|
|
339
|
-
const titleResults = ref([]);
|
|
340
|
-
watch(rateLimitedSearch, async (value) => {
|
|
341
|
-
const list = [];
|
|
342
|
-
const raw = await titleSearchIndex.search(value);
|
|
343
|
-
let rank = 0;
|
|
344
|
-
for (const field of raw) {
|
|
345
|
-
for (const id of field.result) {
|
|
346
|
-
const idMapData = titleIdMap[id];
|
|
347
|
-
if (!idMapData)
|
|
348
|
-
continue;
|
|
349
|
-
switch (idMapData.kind) {
|
|
350
|
-
case "story": {
|
|
351
|
-
list.push(storyResultFactory(storyStore.getStoryById(idMapData.id), rank));
|
|
352
|
-
rank++;
|
|
353
|
-
break;
|
|
354
|
-
}
|
|
355
|
-
case "variant": {
|
|
356
|
-
const [storyId] = idMapData.id.split(":");
|
|
357
|
-
const story = storyStore.getStoryById(storyId);
|
|
358
|
-
const variant = storyStore.getVariantById(idMapData.id);
|
|
359
|
-
list.push(variantResultFactory(story, variant, rank));
|
|
360
|
-
rank++;
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
titleResults.value = list;
|
|
367
|
-
});
|
|
368
|
-
const docsResults = ref([]);
|
|
369
|
-
async function searchOnDocField(query) {
|
|
370
|
-
if (docSearchIndex) {
|
|
371
|
-
const list = [];
|
|
372
|
-
const raw = await docSearchIndex.search(query);
|
|
373
|
-
let rank = 0;
|
|
374
|
-
for (const field of raw) {
|
|
375
|
-
for (const id of field.result) {
|
|
376
|
-
const idMapData = docIdMap[id];
|
|
377
|
-
if (!idMapData)
|
|
378
|
-
continue;
|
|
379
|
-
switch (idMapData.kind) {
|
|
380
|
-
case "story": {
|
|
381
|
-
list.push(storyResultFactory(storyStore.getStoryById(idMapData.id), rank));
|
|
382
|
-
rank++;
|
|
383
|
-
break;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
docsResults.value = list;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
watch(rateLimitedSearch, searchOnDocField);
|
|
392
|
-
function storyResultFactory(story, rank) {
|
|
393
|
-
return {
|
|
394
|
-
kind: "story",
|
|
395
|
-
rank,
|
|
396
|
-
id: `story:${story.id}`,
|
|
397
|
-
title: story.title,
|
|
398
|
-
route: {
|
|
399
|
-
name: "story",
|
|
400
|
-
params: {
|
|
401
|
-
storyId: story.id
|
|
402
|
-
}
|
|
403
|
-
},
|
|
404
|
-
path: story.file.path.slice(0, -1),
|
|
405
|
-
icon: story.icon,
|
|
406
|
-
iconColor: story.iconColor
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
function variantResultFactory(story, variant, rank) {
|
|
410
|
-
var _a;
|
|
411
|
-
return {
|
|
412
|
-
kind: "variant",
|
|
413
|
-
rank,
|
|
414
|
-
id: `variant:${story.id}:${variant.id}`,
|
|
415
|
-
title: variant.title,
|
|
416
|
-
route: {
|
|
417
|
-
name: "story",
|
|
418
|
-
params: {
|
|
419
|
-
storyId: story.id
|
|
420
|
-
},
|
|
421
|
-
query: {
|
|
422
|
-
variantId: variant.id
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
path: [...(_a = story.file.path) != null ? _a : [], story.title],
|
|
426
|
-
icon: variant.icon,
|
|
427
|
-
iconColor: variant.iconColor
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
const results = computed(() => {
|
|
431
|
-
const list = [...titleResults.value];
|
|
432
|
-
const seen = {};
|
|
433
|
-
for (const r of titleResults.value) {
|
|
434
|
-
seen[r.id] = true;
|
|
435
|
-
}
|
|
436
|
-
for (const r of docsResults.value) {
|
|
437
|
-
if (!seen[r.id]) {
|
|
438
|
-
list.push(r);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
return list;
|
|
442
|
-
});
|
|
443
|
-
const selectedIndex = ref(0);
|
|
444
|
-
watch(results, () => {
|
|
445
|
-
selectedIndex.value = 0;
|
|
446
|
-
});
|
|
447
|
-
function selectNext() {
|
|
448
|
-
selectedIndex.value++;
|
|
449
|
-
if (selectedIndex.value > results.value.length - 1) {
|
|
450
|
-
selectedIndex.value = 0;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
function selectPrevious() {
|
|
454
|
-
selectedIndex.value--;
|
|
455
|
-
if (selectedIndex.value < 0) {
|
|
456
|
-
selectedIndex.value = results.value.length - 1;
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
return (_ctx, _cache) => {
|
|
460
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
461
|
-
createElementVNode("div", {
|
|
462
|
-
class: "htw-flex htw-items-center htw-gap-4 htw-pl-6 htw-border htw-border-transparent focus-visible:htw-border-primary-500",
|
|
463
|
-
onClick: _cache[4] || (_cache[4] = ($event) => focused.value = true)
|
|
464
|
-
}, [
|
|
465
|
-
createVNode(unref(Icon), {
|
|
466
|
-
icon: "carbon:search",
|
|
467
|
-
class: "flex-none htw-w-4 htw-h-4"
|
|
468
|
-
}),
|
|
469
|
-
withDirectives(createElementVNode("input", {
|
|
470
|
-
ref_key: "input",
|
|
471
|
-
ref: input,
|
|
472
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchInputText.value = $event),
|
|
473
|
-
placeholder: "Search for stories, variants...",
|
|
474
|
-
class: "htw-bg-transparent htw-w-full htw-flex-1 htw-pl-0 htw-pr-6 htw-py-4 htw-outline-none",
|
|
475
|
-
onKeydown: [
|
|
476
|
-
_cache[1] || (_cache[1] = withKeys(withModifiers(($event) => selectNext(), ["prevent"]), ["down"])),
|
|
477
|
-
_cache[2] || (_cache[2] = withKeys(withModifiers(($event) => selectPrevious(), ["prevent"]), ["up"])),
|
|
478
|
-
_cache[3] || (_cache[3] = withKeys(($event) => close(), ["escape"]))
|
|
479
|
-
]
|
|
480
|
-
}, null, 544), [
|
|
481
|
-
[vModelText, searchInputText.value]
|
|
482
|
-
])
|
|
483
|
-
]),
|
|
484
|
-
unref(rateLimitedSearch) && !unref(results).length ? (openBlock(), createBlock(BaseEmpty, {
|
|
485
|
-
key: 0,
|
|
486
|
-
class: "no-animation"
|
|
487
|
-
}, {
|
|
488
|
-
default: withCtx(() => [
|
|
489
|
-
_hoisted_1
|
|
490
|
-
]),
|
|
491
|
-
_: 1
|
|
492
|
-
})) : unref(results).length ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
493
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(results), (result, index) => {
|
|
494
|
-
return openBlock(), createBlock(SearchItem, {
|
|
495
|
-
key: result.id,
|
|
496
|
-
result,
|
|
497
|
-
selected: index === selectedIndex.value,
|
|
498
|
-
onClose: _cache[5] || (_cache[5] = ($event) => close())
|
|
499
|
-
}, null, 8, ["result", "selected"]);
|
|
500
|
-
}), 128))
|
|
501
|
-
])) : createCommentVNode("", true)
|
|
502
|
-
], 64);
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
});
|
|
506
|
-
export { _sfc_main as default };
|