@histoire/app 0.10.7 → 0.11.0
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 +11 -0
- package/dist/bundled/App.js +4 -148
- package/dist/bundled/App.vue_vue_type_script_setup_true_lang.js +156 -0
- package/dist/bundled/_virtual/{plugin-vue_export-helper.js → _plugin-vue_export-helper.js} +4 -2
- package/dist/bundled/api.js +4 -1
- package/dist/bundled/assets/histoire-text-dark.js +4 -2
- package/dist/bundled/assets/histoire-text.js +4 -2
- package/dist/bundled/assets/histoire.js +4 -2
- package/dist/bundled/components/HomeView.js +5 -24
- package/dist/bundled/components/HomeView.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/bundled/components/app/AppHeader.js +5 -67
- package/dist/bundled/components/app/AppHeader.vue_vue_type_script_setup_true_lang.js +70 -0
- package/dist/bundled/components/app/AppLogo.js +5 -26
- package/dist/bundled/components/app/AppLogo.vue_vue_type_script_setup_true_lang.js +28 -0
- package/dist/bundled/components/app/Breadcrumb.js +7 -95
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_script_setup_true_lang.js +95 -0
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_afeba72b_lang.js +4 -0
- package/dist/bundled/components/app/InitialLoading.js +5 -48
- package/dist/bundled/components/app/InitialLoading.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/bundled/components/app/MobileOverlay.js +4 -40
- package/dist/bundled/components/app/MobileOverlay.vue_vue_type_script_setup_true_lang.js +43 -0
- package/dist/bundled/components/base/BaseCheckbox.js +4 -74
- package/dist/bundled/components/base/BaseCheckbox.vue_vue_type_script_setup_true_lang.js +77 -0
- package/dist/bundled/components/base/BaseEmpty.js +7 -5
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_af3328a6_lang.js +4 -0
- package/dist/bundled/components/base/BaseListItemLink.js +7 -25
- package/dist/bundled/components/base/BaseListItemLink.vue_vue_type_script_lang.js +25 -0
- package/dist/bundled/components/base/BaseOverflowMenu.js +4 -96
- package/dist/bundled/components/base/BaseOverflowMenu.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/bundled/components/base/BaseOverflowTab.js +7 -17
- package/dist/bundled/components/base/BaseOverflowTab.vue_vue_type_script_lang.js +17 -0
- package/dist/bundled/components/base/BaseSelect.js +5 -69
- package/dist/bundled/components/base/BaseSelect.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/bundled/components/base/BaseSplitPane.js +7 -184
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_script_setup_true_lang.js +183 -0
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_bb6c600c_lang.js +4 -0
- package/dist/bundled/components/base/BaseTab.js +7 -17
- package/dist/bundled/components/base/BaseTab.vue_vue_type_script_lang.js +17 -0
- package/dist/bundled/components/misc/CheckerboardPattern.js +5 -3
- package/dist/bundled/components/misc/HatchedPattern.js +7 -5
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_91561117_lang.js +4 -0
- package/dist/bundled/components/panel/ControlsComponentPropItem.js +5 -98
- package/dist/bundled/components/panel/ControlsComponentPropItem.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/bundled/components/panel/ControlsComponentProps.js +5 -42
- package/dist/bundled/components/panel/ControlsComponentProps.vue_vue_type_script_setup_true_lang.js +45 -0
- package/dist/bundled/components/panel/PaneTabs.js +4 -111
- package/dist/bundled/components/panel/PaneTabs.vue_vue_type_script_setup_true_lang.js +110 -0
- package/dist/bundled/components/panel/StatePresets.js +4 -189
- package/dist/bundled/components/panel/StatePresets.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/bundled/components/panel/StoryControls.js +4 -72
- package/dist/bundled/components/panel/StoryControls.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/bundled/components/panel/StoryDocs.js +6 -72
- package/dist/bundled/components/panel/StoryDocs.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/bundled/components/panel/StoryEvent.js +4 -55
- package/dist/bundled/components/panel/StoryEvent.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/bundled/components/panel/StoryEvents.js +5 -49
- package/dist/bundled/components/panel/StoryEvents.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/bundled/components/panel/StorySidePanel.js +5 -72
- package/dist/bundled/components/panel/StorySidePanel.vue_vue_type_script_setup_true_lang.js +78 -0
- package/dist/bundled/components/panel/StorySourceCode.js +6 -130
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_0d096b10_lang.js +4 -0
- package/dist/bundled/components/search/SearchItem.js +6 -112
- package/dist/bundled/components/search/SearchItem.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_b819ed97_lang.js +4 -0
- package/dist/bundled/components/search/SearchLoading.js +5 -19
- package/dist/bundled/components/search/SearchLoading.vue_vue_type_script_setup_true_lang.js +20 -0
- package/dist/bundled/components/search/SearchModal.js +4 -45
- package/dist/bundled/components/search/SearchModal.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/bundled/components/search/SearchPane.js +4 -268
- package/dist/bundled/components/search/SearchPane.vue_vue_type_script_setup_true_lang.js +270 -0
- package/dist/bundled/components/search/search-docs-data.js +5 -2
- package/dist/bundled/components/search/search-title-data.js +5 -2
- package/dist/bundled/components/story/GenericMountStory.js +4 -30
- package/dist/bundled/components/story/GenericMountStory.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/bundled/components/story/GenericRenderStory.js +4 -30
- package/dist/bundled/components/story/GenericRenderStory.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/bundled/components/story/StoryResponsivePreview.js +6 -180
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_script_setup_true_lang.js +183 -0
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_1375d05a_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantGrid.js +5 -94
- package/dist/bundled/components/story/StoryVariantGrid.vue_vue_type_script_setup_true_lang.js +96 -0
- package/dist/bundled/components/story/StoryVariantGridItem.js +7 -108
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +108 -0
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_be3a417b_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantListItem.js +7 -58
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_cc25ec8b_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSingle.js +6 -114
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_afe0bbc2_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.js +5 -45
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.js +5 -122
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue_vue_type_script_setup_true_lang.js +124 -0
- package/dist/bundled/components/story/StoryVariantSingleView.js +4 -48
- package/dist/bundled/components/story/StoryVariantSingleView.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/bundled/components/story/StoryView.js +4 -89
- package/dist/bundled/components/story/StoryView.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/bundled/components/story/StoryViewer.js +7 -57
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_54d5a557_lang.js +4 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.js +7 -85
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_8dc02d19_lang.js +4 -0
- package/dist/bundled/components/toolbar/StoryVariantNewTab.js +5 -33
- package/dist/bundled/components/toolbar/StoryVariantNewTab.vue_vue_type_script_setup_true_lang.js +35 -0
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.js +5 -129
- package/dist/bundled/components/toolbar/StoryVariantResponsiveSize.vue_vue_type_script_setup_true_lang.js +131 -0
- package/dist/bundled/components/toolbar/StoryVariantTitle.js +5 -24
- package/dist/bundled/components/toolbar/StoryVariantTitle.vue_vue_type_script_setup_true_lang.js +26 -0
- package/dist/bundled/components/tree/StoryGroup.js +4 -73
- package/dist/bundled/components/tree/StoryGroup.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/bundled/components/tree/StoryList.js +5 -37
- package/dist/bundled/components/tree/StoryList.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/bundled/components/tree/StoryListFolder.js +7 -89
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_script_setup_true_lang.js +88 -0
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_41fb5f7e_lang.js +4 -0
- package/dist/bundled/components/tree/StoryListItem.js +6 -71
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_313a2f42_lang.js +4 -0
- package/dist/bundled/index.js +6 -3
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/common.js +13 -1
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/en.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/advanced.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/balance.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang/latin/simple.js +7 -2
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/lang.js +11 -1
- package/dist/bundled/node_modules/.pnpm/flexsearch@0.7.21/node_modules/flexsearch/dist/module/type.js +4 -1
- package/dist/bundled/router.js +4 -1
- package/dist/bundled/sandbox.js +5 -3
- package/dist/bundled/stores/events.js +3 -1
- package/dist/bundled/stores/folder.js +6 -2
- package/dist/bundled/stores/preview-settings.js +3 -1
- package/dist/bundled/stores/story.js +3 -1
- package/dist/bundled/style.css +37 -46
- package/dist/bundled/util/config.js +5 -2
- package/dist/bundled/util/const.js +6 -1
- package/dist/bundled/util/dark.js +4 -1
- package/dist/bundled/util/env.js +3 -1
- package/dist/bundled/util/events.js +4 -2
- package/dist/bundled/util/keyboard.js +4 -1
- package/dist/bundled/util/mapping.js +4 -1
- package/dist/bundled/util/preview-settings.js +4 -1
- package/dist/bundled/util/responsive.js +3 -1
- package/dist/bundled/util/sandbox.js +3 -1
- package/dist/bundled/util/scroll.js +3 -1
- package/dist/bundled/util/state.js +3 -1
- package/dist/bundled/util/tooltip.js +3 -1
- package/dist/bundled/util/variant.js +3 -1
- package/dist/style.css +145 -119
- package/package.json +6 -6
- package/src/app/App.vue +2 -2
- package/src/app/api.ts +1 -1
- package/src/app/components/base/BaseSplitPane.vue +2 -2
- package/src/app/components/panel/StorySourceCode.vue +134 -26
- package/src/app/components/search/search-docs-data.ts +1 -1
- package/src/app/components/search/search-title-data.ts +1 -1
- package/src/app/components/story/StoryResponsivePreview.vue +55 -54
- package/src/app/components/story/StoryVariantSingle.vue +2 -2
- package/src/app/index.ts +1 -1
- package/src/app/sandbox.ts +1 -1
- package/src/app/stores/folder.ts +3 -1
- package/src/app/style/main.pcss +11 -0
- package/src/app/util/config.ts +1 -1
- package/src/app/util/events.ts +1 -1
- package/tailwind.config.cjs +12 -0
- package/tsconfig.json +0 -1
- package/dist/bundled/components/app/Breadcrumb.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/base/BaseEmpty.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/misc/HatchedPattern.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/search/SearchItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryResponsivePreview.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/story/StoryViewer.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/toolbar/StoryVariantBackground.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/tree/StoryListFolder.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
- package/dist/bundled/components/tree/StoryListItem.vue_vue_type_style_index_0_scoped_true_lang.js +0 -2
|
@@ -1,184 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./BaseSplitPane.
|
|
3
|
-
import _export_sfc from "../../_virtual/
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
props: {
|
|
9
|
-
orientation: {
|
|
10
|
-
type: String,
|
|
11
|
-
default: "landscape",
|
|
12
|
-
validator: (value) => ["landscape", "portrait"].includes(value)
|
|
13
|
-
},
|
|
14
|
-
defaultSplit: {
|
|
15
|
-
type: Number,
|
|
16
|
-
default: 50
|
|
17
|
-
},
|
|
18
|
-
split: {
|
|
19
|
-
type: Number,
|
|
20
|
-
default: void 0
|
|
21
|
-
},
|
|
22
|
-
min: {
|
|
23
|
-
type: Number,
|
|
24
|
-
default: 20
|
|
25
|
-
},
|
|
26
|
-
max: {
|
|
27
|
-
type: Number,
|
|
28
|
-
default: 80
|
|
29
|
-
},
|
|
30
|
-
draggerOffset: {
|
|
31
|
-
type: String,
|
|
32
|
-
default: "center",
|
|
33
|
-
validator: (value) => ["before", "center", "after"].includes(value)
|
|
34
|
-
},
|
|
35
|
-
saveId: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: null
|
|
38
|
-
},
|
|
39
|
-
fixed: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: false
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
emits: {
|
|
45
|
-
"update:split": (value) => true
|
|
46
|
-
},
|
|
47
|
-
setup(__props, { emit }) {
|
|
48
|
-
const props = __props;
|
|
49
|
-
const SAVE_PREFIX = "__histoire";
|
|
50
|
-
const currentSplit = ref(props.defaultSplit);
|
|
51
|
-
watch(() => props.split, (value) => {
|
|
52
|
-
if (value !== void 0) {
|
|
53
|
-
currentSplit.value = value;
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
immediate: true
|
|
57
|
-
});
|
|
58
|
-
if (props.saveId) {
|
|
59
|
-
const storageKey = `${SAVE_PREFIX}-split-pane-${props.saveId}`;
|
|
60
|
-
const savedValue = localStorage.getItem(storageKey);
|
|
61
|
-
if (savedValue != null) {
|
|
62
|
-
let parsedValue;
|
|
63
|
-
try {
|
|
64
|
-
parsedValue = JSON.parse(savedValue);
|
|
65
|
-
} catch (e) {
|
|
66
|
-
console.error(e);
|
|
67
|
-
}
|
|
68
|
-
if (typeof parsedValue === "number") {
|
|
69
|
-
currentSplit.value = parsedValue;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
watch(currentSplit, (value) => {
|
|
73
|
-
localStorage.setItem(storageKey, JSON.stringify(value));
|
|
74
|
-
});
|
|
75
|
-
watch(currentSplit, (value) => {
|
|
76
|
-
if (value !== props.split) {
|
|
77
|
-
emit("update:split", value);
|
|
78
|
-
}
|
|
79
|
-
}, {
|
|
80
|
-
immediate: true
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
const boundSplit = computed(() => {
|
|
84
|
-
if (currentSplit.value < props.min) {
|
|
85
|
-
return props.min;
|
|
86
|
-
} else if (currentSplit.value > props.max) {
|
|
87
|
-
return props.max;
|
|
88
|
-
} else {
|
|
89
|
-
return currentSplit.value;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
const leftStyle = computed(() => ({
|
|
93
|
-
[props.orientation === "landscape" ? "width" : "height"]: props.fixed ? `${boundSplit.value}px` : `${boundSplit.value}%`
|
|
94
|
-
}));
|
|
95
|
-
const rightStyle = computed(() => ({
|
|
96
|
-
[props.orientation === "landscape" ? "width" : "height"]: props.fixed ? null : `${100 - boundSplit.value}%`
|
|
97
|
-
}));
|
|
98
|
-
const dragging = ref(false);
|
|
99
|
-
let startPosition = 0;
|
|
100
|
-
let startSplit = 0;
|
|
101
|
-
const el = ref(null);
|
|
102
|
-
function dragStart(e) {
|
|
103
|
-
dragging.value = true;
|
|
104
|
-
startPosition = props.orientation === "landscape" ? e.pageX : e.pageY;
|
|
105
|
-
startSplit = boundSplit.value;
|
|
106
|
-
window.addEventListener("mousemove", dragMove);
|
|
107
|
-
window.addEventListener("mouseup", dragEnd);
|
|
108
|
-
}
|
|
109
|
-
function dragMove(e) {
|
|
110
|
-
if (dragging.value) {
|
|
111
|
-
let position;
|
|
112
|
-
let totalSize;
|
|
113
|
-
if (props.orientation === "landscape") {
|
|
114
|
-
position = e.pageX;
|
|
115
|
-
totalSize = el.value.offsetWidth;
|
|
116
|
-
} else {
|
|
117
|
-
position = e.pageY;
|
|
118
|
-
totalSize = el.value.offsetHeight;
|
|
119
|
-
}
|
|
120
|
-
const dPosition = position - startPosition;
|
|
121
|
-
if (props.fixed) {
|
|
122
|
-
currentSplit.value = startSplit + dPosition;
|
|
123
|
-
} else {
|
|
124
|
-
currentSplit.value = startSplit + ~~(dPosition / totalSize * 200) / 2;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function dragEnd() {
|
|
129
|
-
dragging.value = false;
|
|
130
|
-
removeDragListeners();
|
|
131
|
-
}
|
|
132
|
-
function removeDragListeners() {
|
|
133
|
-
window.removeEventListener("mousemove", dragMove);
|
|
134
|
-
window.removeEventListener("mouseup", dragEnd);
|
|
135
|
-
}
|
|
136
|
-
onUnmounted(() => {
|
|
137
|
-
removeDragListeners();
|
|
138
|
-
});
|
|
139
|
-
return (_ctx, _cache) => {
|
|
140
|
-
return openBlock(), createElementBlock("div", {
|
|
141
|
-
ref_key: "el",
|
|
142
|
-
ref: el,
|
|
143
|
-
class: normalizeClass(["htw-flex htw-h-full htw-isolate htw-overflow-auto", {
|
|
144
|
-
"htw-flex-col": __props.orientation === "portrait",
|
|
145
|
-
"htw-cursor-ew-resize": dragging.value && __props.orientation === "landscape",
|
|
146
|
-
"htw-cursor-ns-resize": dragging.value && __props.orientation === "portrait",
|
|
147
|
-
[__props.orientation]: true
|
|
148
|
-
}])
|
|
149
|
-
}, [
|
|
150
|
-
createElementVNode("div", {
|
|
151
|
-
class: normalizeClass(["htw-relative htw-top-0 htw-left-0 htw-z-20", {
|
|
152
|
-
"htw-pointer-events-none": dragging.value,
|
|
153
|
-
"htw-border-r htw-border-gray-200 dark:htw-border-gray-850": __props.orientation === "landscape",
|
|
154
|
-
"htw-flex-none": __props.fixed
|
|
155
|
-
}]),
|
|
156
|
-
style: normalizeStyle(unref(leftStyle))
|
|
157
|
-
}, [
|
|
158
|
-
renderSlot(_ctx.$slots, "first", {}, void 0, true),
|
|
159
|
-
createElementVNode("div", {
|
|
160
|
-
class: normalizeClass(["dragger htw-absolute htw-z-100 hover:htw-bg-primary-500/50 htw-transition-colors htw-duration-150 htw-delay-150", {
|
|
161
|
-
"htw-top-0 htw-bottom-0 htw-cursor-ew-resize": __props.orientation === "landscape",
|
|
162
|
-
"htw-left-0 htw-right-0 htw-cursor-ns-resize": __props.orientation === "portrait",
|
|
163
|
-
[`dragger-offset-${__props.draggerOffset}`]: true,
|
|
164
|
-
"htw-bg-primary-500/25": dragging.value
|
|
165
|
-
}]),
|
|
166
|
-
onMousedown: withModifiers(dragStart, ["prevent"])
|
|
167
|
-
}, null, 42, _hoisted_1)
|
|
168
|
-
], 6),
|
|
169
|
-
createElementVNode("div", {
|
|
170
|
-
class: normalizeClass(["htw-relative htw-bottom-0 htw-right-0", {
|
|
171
|
-
"htw-pointer-events-none": dragging.value,
|
|
172
|
-
"htw-border-t htw-border-gray-200 dark:htw-border-gray-850": __props.orientation === "portrait",
|
|
173
|
-
"htw-flex-1": __props.fixed
|
|
174
|
-
}]),
|
|
175
|
-
style: normalizeStyle(unref(rightStyle))
|
|
176
|
-
}, [
|
|
177
|
-
renderSlot(_ctx.$slots, "last", {}, void 0, true)
|
|
178
|
-
], 6)
|
|
179
|
-
], 2);
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
var BaseSplitPane = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-328ea07c"]]);
|
|
184
|
-
export { BaseSplitPane as default };
|
|
1
|
+
import _sfc_main from "./BaseSplitPane.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
import "./BaseSplitPane.vue_vue_type_style_index_0_scoped_bb6c600c_lang.js";
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const BaseSplitPane = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-bb6c600c"]]);
|
|
5
|
+
export {
|
|
6
|
+
BaseSplitPane as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { defineComponent, ref, watch, computed, onUnmounted, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, unref, renderSlot, withModifiers, pushScopeId, popScopeId } from "@histoire/vendors/vue";
|
|
2
|
+
const _withScopeId = (n) => (pushScopeId("data-v-bb6c600c"), n = n(), popScopeId(), n);
|
|
3
|
+
const _hoisted_1 = ["onMousedown"];
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "BaseSplitPane",
|
|
6
|
+
props: {
|
|
7
|
+
orientation: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "landscape",
|
|
10
|
+
validator: (value) => ["landscape", "portrait"].includes(value)
|
|
11
|
+
},
|
|
12
|
+
defaultSplit: {
|
|
13
|
+
type: Number,
|
|
14
|
+
default: 50
|
|
15
|
+
},
|
|
16
|
+
split: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: void 0
|
|
19
|
+
},
|
|
20
|
+
min: {
|
|
21
|
+
type: Number,
|
|
22
|
+
default: 20
|
|
23
|
+
},
|
|
24
|
+
max: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 80
|
|
27
|
+
},
|
|
28
|
+
draggerOffset: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "center",
|
|
31
|
+
validator: (value) => ["before", "center", "after"].includes(value)
|
|
32
|
+
},
|
|
33
|
+
saveId: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: null
|
|
36
|
+
},
|
|
37
|
+
fixed: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: {
|
|
43
|
+
"update:split": (value) => true
|
|
44
|
+
},
|
|
45
|
+
setup(__props, { emit }) {
|
|
46
|
+
const props = __props;
|
|
47
|
+
const SAVE_PREFIX = "__histoire";
|
|
48
|
+
const currentSplit = ref(props.defaultSplit);
|
|
49
|
+
watch(() => props.split, (value) => {
|
|
50
|
+
if (value !== void 0) {
|
|
51
|
+
currentSplit.value = value;
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
immediate: true
|
|
55
|
+
});
|
|
56
|
+
if (props.saveId) {
|
|
57
|
+
const storageKey = `${SAVE_PREFIX}-split-pane-${props.saveId}`;
|
|
58
|
+
const savedValue = localStorage.getItem(storageKey);
|
|
59
|
+
if (savedValue != null) {
|
|
60
|
+
let parsedValue;
|
|
61
|
+
try {
|
|
62
|
+
parsedValue = JSON.parse(savedValue);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
console.error(e);
|
|
65
|
+
}
|
|
66
|
+
if (typeof parsedValue === "number") {
|
|
67
|
+
currentSplit.value = parsedValue;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
watch(currentSplit, (value) => {
|
|
71
|
+
localStorage.setItem(storageKey, JSON.stringify(value));
|
|
72
|
+
});
|
|
73
|
+
watch(currentSplit, (value) => {
|
|
74
|
+
if (value !== props.split) {
|
|
75
|
+
emit("update:split", value);
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
immediate: true
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const boundSplit = computed(() => {
|
|
82
|
+
if (currentSplit.value < props.min) {
|
|
83
|
+
return props.min;
|
|
84
|
+
} else if (currentSplit.value > props.max) {
|
|
85
|
+
return props.max;
|
|
86
|
+
} else {
|
|
87
|
+
return currentSplit.value;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const leftStyle = computed(() => ({
|
|
91
|
+
[props.orientation === "landscape" ? "width" : "height"]: props.fixed ? `${boundSplit.value}px` : `${boundSplit.value}%`
|
|
92
|
+
}));
|
|
93
|
+
const rightStyle = computed(() => ({
|
|
94
|
+
[props.orientation === "landscape" ? "width" : "height"]: props.fixed ? null : `${100 - boundSplit.value}%`
|
|
95
|
+
}));
|
|
96
|
+
const dragging = ref(false);
|
|
97
|
+
let startPosition = 0;
|
|
98
|
+
let startSplit = 0;
|
|
99
|
+
const el = ref(null);
|
|
100
|
+
function dragStart(e) {
|
|
101
|
+
dragging.value = true;
|
|
102
|
+
startPosition = props.orientation === "landscape" ? e.pageX : e.pageY;
|
|
103
|
+
startSplit = boundSplit.value;
|
|
104
|
+
window.addEventListener("mousemove", dragMove);
|
|
105
|
+
window.addEventListener("mouseup", dragEnd);
|
|
106
|
+
}
|
|
107
|
+
function dragMove(e) {
|
|
108
|
+
if (dragging.value) {
|
|
109
|
+
let position;
|
|
110
|
+
let totalSize;
|
|
111
|
+
if (props.orientation === "landscape") {
|
|
112
|
+
position = e.pageX;
|
|
113
|
+
totalSize = el.value.offsetWidth;
|
|
114
|
+
} else {
|
|
115
|
+
position = e.pageY;
|
|
116
|
+
totalSize = el.value.offsetHeight;
|
|
117
|
+
}
|
|
118
|
+
const dPosition = position - startPosition;
|
|
119
|
+
if (props.fixed) {
|
|
120
|
+
currentSplit.value = startSplit + dPosition;
|
|
121
|
+
} else {
|
|
122
|
+
currentSplit.value = startSplit + ~~(dPosition / totalSize * 200) / 2;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function dragEnd() {
|
|
127
|
+
dragging.value = false;
|
|
128
|
+
removeDragListeners();
|
|
129
|
+
}
|
|
130
|
+
function removeDragListeners() {
|
|
131
|
+
window.removeEventListener("mousemove", dragMove);
|
|
132
|
+
window.removeEventListener("mouseup", dragEnd);
|
|
133
|
+
}
|
|
134
|
+
onUnmounted(() => {
|
|
135
|
+
removeDragListeners();
|
|
136
|
+
});
|
|
137
|
+
return (_ctx, _cache) => {
|
|
138
|
+
return openBlock(), createElementBlock("div", {
|
|
139
|
+
ref_key: "el",
|
|
140
|
+
ref: el,
|
|
141
|
+
class: normalizeClass(["htw-flex htw-h-full htw-isolate htw-overflow-auto", {
|
|
142
|
+
"htw-flex-col": __props.orientation === "portrait",
|
|
143
|
+
"htw-cursor-ew-resize": dragging.value && __props.orientation === "landscape",
|
|
144
|
+
"htw-cursor-ns-resize": dragging.value && __props.orientation === "portrait",
|
|
145
|
+
[__props.orientation]: true
|
|
146
|
+
}])
|
|
147
|
+
}, [
|
|
148
|
+
createElementVNode("div", {
|
|
149
|
+
class: normalizeClass(["htw-relative htw-top-0 htw-left-0 htw-z-20", {
|
|
150
|
+
"htw-pointer-events-none": dragging.value,
|
|
151
|
+
"htw-border-r htw-border-gray-300/30 dark:htw-border-gray-800": __props.orientation === "landscape",
|
|
152
|
+
"htw-flex-none": __props.fixed
|
|
153
|
+
}]),
|
|
154
|
+
style: normalizeStyle(unref(leftStyle))
|
|
155
|
+
}, [
|
|
156
|
+
renderSlot(_ctx.$slots, "first", {}, void 0, true),
|
|
157
|
+
createElementVNode("div", {
|
|
158
|
+
class: normalizeClass(["dragger htw-absolute htw-z-100 hover:htw-bg-primary-500/50 htw-transition-colors htw-duration-150 htw-delay-150", {
|
|
159
|
+
"htw-top-0 htw-bottom-0 htw-cursor-ew-resize": __props.orientation === "landscape",
|
|
160
|
+
"htw-left-0 htw-right-0 htw-cursor-ns-resize": __props.orientation === "portrait",
|
|
161
|
+
[`dragger-offset-${__props.draggerOffset}`]: true,
|
|
162
|
+
"htw-bg-primary-500/25": dragging.value
|
|
163
|
+
}]),
|
|
164
|
+
onMousedown: withModifiers(dragStart, ["prevent"])
|
|
165
|
+
}, null, 42, _hoisted_1)
|
|
166
|
+
], 6),
|
|
167
|
+
createElementVNode("div", {
|
|
168
|
+
class: normalizeClass(["htw-relative htw-bottom-0 htw-right-0", {
|
|
169
|
+
"htw-pointer-events-none": dragging.value,
|
|
170
|
+
"htw-border-t htw-border-gray-300/30 dark:htw-border-gray-800": __props.orientation === "portrait",
|
|
171
|
+
"htw-flex-1": __props.fixed
|
|
172
|
+
}]),
|
|
173
|
+
style: normalizeStyle(unref(rightStyle))
|
|
174
|
+
}, [
|
|
175
|
+
renderSlot(_ctx.$slots, "last", {}, void 0, true)
|
|
176
|
+
], 6)
|
|
177
|
+
], 2);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
export {
|
|
182
|
+
_sfc_main as default
|
|
183
|
+
};
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
inheritAttrs: false,
|
|
5
|
-
props: {
|
|
6
|
-
exact: {
|
|
7
|
-
type: Boolean,
|
|
8
|
-
default: false
|
|
9
|
-
},
|
|
10
|
-
matched: {
|
|
11
|
-
type: Boolean,
|
|
12
|
-
default: null
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
1
|
+
import _sfc_main from "./BaseTab.vue_vue_type_script_lang.js";
|
|
2
|
+
import { resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementVNode, renderSlot, createVNode, Transition, createElementBlock, createCommentVNode } from "@histoire/vendors/vue";
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
16
4
|
const _hoisted_1 = ["href", "onClick"];
|
|
17
5
|
const _hoisted_2 = {
|
|
18
6
|
key: 0,
|
|
@@ -41,5 +29,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
41
29
|
_: 3
|
|
42
30
|
}, 16);
|
|
43
31
|
}
|
|
44
|
-
|
|
45
|
-
export {
|
|
32
|
+
const BaseTab = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
33
|
+
export {
|
|
34
|
+
BaseTab as default
|
|
35
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineComponent } from "@histoire/vendors/vue";
|
|
2
|
+
const _sfc_main = defineComponent({
|
|
3
|
+
inheritAttrs: false,
|
|
4
|
+
props: {
|
|
5
|
+
exact: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: false
|
|
8
|
+
},
|
|
9
|
+
matched: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export {
|
|
16
|
+
_sfc_main as default
|
|
17
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElementVNode, openBlock, createElementBlock } from "@histoire/vendors/vue";
|
|
2
|
-
import _export_sfc from "../../_virtual/
|
|
2
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
3
3
|
const _sfc_main = {};
|
|
4
4
|
const _hoisted_1 = { fill: "none" };
|
|
5
5
|
const _hoisted_2 = /* @__PURE__ */ createElementVNode("pattern", {
|
|
@@ -37,5 +37,7 @@ const _hoisted_4 = [
|
|
|
37
37
|
function _sfc_render(_ctx, _cache) {
|
|
38
38
|
return openBlock(), createElementBlock("svg", _hoisted_1, _hoisted_4);
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
export {
|
|
40
|
+
const CheckerboardPattern = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
41
|
+
export {
|
|
42
|
+
CheckerboardPattern as default
|
|
43
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { pushScopeId, popScopeId, openBlock, createElementBlock } from "@histoire/vendors/vue";
|
|
2
|
-
import "./HatchedPattern.
|
|
3
|
-
import _export_sfc from "../../_virtual/
|
|
2
|
+
import "./HatchedPattern.vue_vue_type_style_index_0_scoped_91561117_lang.js";
|
|
3
|
+
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
4
|
const _sfc_main = {};
|
|
5
|
-
const _withScopeId = (n) => (pushScopeId("data-v-
|
|
5
|
+
const _withScopeId = (n) => (pushScopeId("data-v-91561117"), n = n(), popScopeId(), n);
|
|
6
6
|
const _hoisted_1 = { class: "__histoire-hatched-pattern" };
|
|
7
7
|
function _sfc_render(_ctx, _cache) {
|
|
8
8
|
return openBlock(), createElementBlock("div", _hoisted_1);
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
10
|
+
const HatchedPattern = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-91561117"]]);
|
|
11
|
+
export {
|
|
12
|
+
HatchedPattern as default
|
|
13
|
+
};
|
|
@@ -1,98 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
props: {
|
|
7
|
-
variant: null,
|
|
8
|
-
component: null,
|
|
9
|
-
definition: null
|
|
10
|
-
},
|
|
11
|
-
setup(__props) {
|
|
12
|
-
const props = __props;
|
|
13
|
-
const comp = computed(() => {
|
|
14
|
-
var _a;
|
|
15
|
-
switch ((_a = props.definition.types) == null ? void 0 : _a[0]) {
|
|
16
|
-
case "string":
|
|
17
|
-
return HstText;
|
|
18
|
-
case "number":
|
|
19
|
-
return HstNumber;
|
|
20
|
-
case "boolean":
|
|
21
|
-
return HstCheckbox;
|
|
22
|
-
case "object":
|
|
23
|
-
default:
|
|
24
|
-
return HstTextarea;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const isJSON = computed(() => comp.value === HstTextarea);
|
|
28
|
-
const invalidValue = ref("");
|
|
29
|
-
const model = computed({
|
|
30
|
-
get: () => {
|
|
31
|
-
var _a;
|
|
32
|
-
if (invalidValue.value) {
|
|
33
|
-
return invalidValue.value;
|
|
34
|
-
}
|
|
35
|
-
let val = (_a = props.variant.state._hPropState[props.component.index]) == null ? void 0 : _a[props.definition.name];
|
|
36
|
-
if (val && isJSON.value) {
|
|
37
|
-
val = JSON.stringify(val, null, 2);
|
|
38
|
-
}
|
|
39
|
-
return val;
|
|
40
|
-
},
|
|
41
|
-
set: (value) => {
|
|
42
|
-
invalidValue.value = "";
|
|
43
|
-
if (isJSON.value) {
|
|
44
|
-
try {
|
|
45
|
-
value = JSON.parse(value);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
invalidValue.value = value;
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (!props.variant.state._hPropState[props.component.index]) {
|
|
52
|
-
props.variant.state._hPropState[props.component.index] = {};
|
|
53
|
-
}
|
|
54
|
-
props.variant.state._hPropState[props.component.index][props.definition.name] = value;
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
function reset() {
|
|
58
|
-
if (props.variant.state._hPropState[props.component.index]) {
|
|
59
|
-
delete props.variant.state._hPropState[props.component.index][props.definition.name];
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
const canReset = computed(() => {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
return ((_b = (_a = props.variant.state) == null ? void 0 : _a._hPropState) == null ? void 0 : _b[props.component.index]) && props.definition.name in props.variant.state._hPropState[props.component.index];
|
|
65
|
-
});
|
|
66
|
-
return (_ctx, _cache) => {
|
|
67
|
-
const _directive_tooltip = resolveDirective("tooltip");
|
|
68
|
-
return unref(comp) ? (openBlock(), createBlock(resolveDynamicComponent(unref(comp)), {
|
|
69
|
-
key: 0,
|
|
70
|
-
modelValue: unref(model),
|
|
71
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(model) ? model.value = $event : null),
|
|
72
|
-
title: `${__props.definition.name}${unref(canReset) ? " *" : ""}`,
|
|
73
|
-
placeholder: unref(isJSON) ? "Enter JSON" : null
|
|
74
|
-
}, {
|
|
75
|
-
actions: withCtx(() => [
|
|
76
|
-
invalidValue.value ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
77
|
-
key: 0,
|
|
78
|
-
icon: "carbon:warning-alt",
|
|
79
|
-
class: "htw-text-orange-500"
|
|
80
|
-
}, null, 512)), [
|
|
81
|
-
[_directive_tooltip, "JSON error"]
|
|
82
|
-
]) : createCommentVNode("", true),
|
|
83
|
-
withDirectives(createVNode(unref(Icon), {
|
|
84
|
-
icon: "carbon:erase",
|
|
85
|
-
class: normalizeClass(["htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100", [
|
|
86
|
-
unref(canReset) ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
|
|
87
|
-
]]),
|
|
88
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => reset(), ["stop"]))
|
|
89
|
-
}, null, 8, ["class"]), [
|
|
90
|
-
[_directive_tooltip, "Remove override"]
|
|
91
|
-
])
|
|
92
|
-
]),
|
|
93
|
-
_: 1
|
|
94
|
-
}, 8, ["modelValue", "title", "placeholder"])) : createCommentVNode("", true);
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
export { _sfc_main as default };
|
|
1
|
+
import _sfc_main from "./ControlsComponentPropItem.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
import { default as default2 } from "./ControlsComponentPropItem.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
export {
|
|
4
|
+
default2 as default
|
|
5
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, resolveDirective, unref, openBlock, createBlock, resolveDynamicComponent, isRef, withCtx, withDirectives, createCommentVNode, createVNode, normalizeClass, withModifiers } from "@histoire/vendors/vue";
|
|
2
|
+
import { Icon } from "@histoire/vendors/iconify";
|
|
3
|
+
import { HstTextarea, HstCheckbox, HstNumber, HstText } from "@histoire/controls";
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "ControlsComponentPropItem",
|
|
6
|
+
props: {
|
|
7
|
+
variant: null,
|
|
8
|
+
component: null,
|
|
9
|
+
definition: null
|
|
10
|
+
},
|
|
11
|
+
setup(__props) {
|
|
12
|
+
const props = __props;
|
|
13
|
+
const comp = computed(() => {
|
|
14
|
+
var _a;
|
|
15
|
+
switch ((_a = props.definition.types) == null ? void 0 : _a[0]) {
|
|
16
|
+
case "string":
|
|
17
|
+
return HstText;
|
|
18
|
+
case "number":
|
|
19
|
+
return HstNumber;
|
|
20
|
+
case "boolean":
|
|
21
|
+
return HstCheckbox;
|
|
22
|
+
case "object":
|
|
23
|
+
default:
|
|
24
|
+
return HstTextarea;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const isJSON = computed(() => comp.value === HstTextarea);
|
|
28
|
+
const invalidValue = ref("");
|
|
29
|
+
const model = computed({
|
|
30
|
+
get: () => {
|
|
31
|
+
var _a;
|
|
32
|
+
if (invalidValue.value) {
|
|
33
|
+
return invalidValue.value;
|
|
34
|
+
}
|
|
35
|
+
let val = (_a = props.variant.state._hPropState[props.component.index]) == null ? void 0 : _a[props.definition.name];
|
|
36
|
+
if (val && isJSON.value) {
|
|
37
|
+
val = JSON.stringify(val, null, 2);
|
|
38
|
+
}
|
|
39
|
+
return val;
|
|
40
|
+
},
|
|
41
|
+
set: (value) => {
|
|
42
|
+
invalidValue.value = "";
|
|
43
|
+
if (isJSON.value) {
|
|
44
|
+
try {
|
|
45
|
+
value = JSON.parse(value);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
invalidValue.value = value;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (!props.variant.state._hPropState[props.component.index]) {
|
|
52
|
+
props.variant.state._hPropState[props.component.index] = {};
|
|
53
|
+
}
|
|
54
|
+
props.variant.state._hPropState[props.component.index][props.definition.name] = value;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
function reset() {
|
|
58
|
+
if (props.variant.state._hPropState[props.component.index]) {
|
|
59
|
+
delete props.variant.state._hPropState[props.component.index][props.definition.name];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const canReset = computed(() => {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
return ((_b = (_a = props.variant.state) == null ? void 0 : _a._hPropState) == null ? void 0 : _b[props.component.index]) && props.definition.name in props.variant.state._hPropState[props.component.index];
|
|
65
|
+
});
|
|
66
|
+
return (_ctx, _cache) => {
|
|
67
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
68
|
+
return unref(comp) ? (openBlock(), createBlock(resolveDynamicComponent(unref(comp)), {
|
|
69
|
+
key: 0,
|
|
70
|
+
modelValue: unref(model),
|
|
71
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(model) ? model.value = $event : null),
|
|
72
|
+
title: `${__props.definition.name}${unref(canReset) ? " *" : ""}`,
|
|
73
|
+
placeholder: unref(isJSON) ? "Enter JSON" : null
|
|
74
|
+
}, {
|
|
75
|
+
actions: withCtx(() => [
|
|
76
|
+
invalidValue.value ? withDirectives((openBlock(), createBlock(unref(Icon), {
|
|
77
|
+
key: 0,
|
|
78
|
+
icon: "carbon:warning-alt",
|
|
79
|
+
class: "htw-text-orange-500"
|
|
80
|
+
}, null, 512)), [
|
|
81
|
+
[_directive_tooltip, "JSON error"]
|
|
82
|
+
]) : createCommentVNode("", true),
|
|
83
|
+
withDirectives(createVNode(unref(Icon), {
|
|
84
|
+
icon: "carbon:erase",
|
|
85
|
+
class: normalizeClass(["htw-cursor-pointer htw-w-4 htw-h-4 hover:htw-text-primary-500 dark:hover:htw-text-primary-400 htw-text-gray-900 dark:htw-text-gray-100", [
|
|
86
|
+
unref(canReset) ? "htw-opacity-50 hover:htw-opacity-100" : "htw-opacity-25 htw-pointer-events-none"
|
|
87
|
+
]]),
|
|
88
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => reset(), ["stop"]))
|
|
89
|
+
}, null, 8, ["class"]), [
|
|
90
|
+
[_directive_tooltip, "Remove override"]
|
|
91
|
+
])
|
|
92
|
+
]),
|
|
93
|
+
_: 1
|
|
94
|
+
}, 8, ["modelValue", "title", "placeholder"])) : createCommentVNode("", true);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
export {
|
|
99
|
+
_sfc_main as default
|
|
100
|
+
};
|