@vizejs/fresco 0.719.0 → 0.721.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/{accessibility-DwzT925M.d.mts → accessibility-D7iuITvU.d.mts} +4 -3
- package/dist/{accessibility-DwzT925M.d.mts.map → accessibility-D7iuITvU.d.mts.map} +1 -1
- package/dist/{app-_QmZ-PoH.d.mts → app-CJh9qfJI.d.mts} +3 -3
- package/dist/{app-_QmZ-PoH.d.mts.map → app-CJh9qfJI.d.mts.map} +1 -1
- package/dist/{app-C_wFlWSV.mjs → app-CjfLCWic.mjs} +110 -16
- package/dist/app-CjfLCWic.mjs.map +1 -0
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.mjs +2 -2
- package/dist/{components-DzkL-yHj.mjs → components-B-HgL5id.mjs} +1032 -139
- package/dist/components-B-HgL5id.mjs.map +1 -0
- package/dist/composables/index.d.mts +1 -1
- package/dist/composables/index.mjs +3 -3
- package/dist/{composables-BJeirPSH.mjs → composables-BxxLIBdJ.mjs} +3 -3
- package/dist/{composables-BJeirPSH.mjs.map → composables-BxxLIBdJ.mjs.map} +1 -1
- package/dist/{index-Ddp2Txtm.d.mts → index-BOV-0YqV.d.mts} +2 -2
- package/dist/{index-Ddp2Txtm.d.mts.map → index-BOV-0YqV.d.mts.map} +1 -1
- package/dist/{index-BCxB_ZLV.d.mts → index-C0U_GDW-.d.mts} +324 -498
- package/dist/index-C0U_GDW-.d.mts.map +1 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +5 -5
- package/dist/{protocol-DavoeNLn.d.mts → protocol-C1DHP36Z.d.mts} +5 -2
- package/dist/protocol-C1DHP36Z.d.mts.map +1 -0
- package/dist/testing/index.d.mts +4 -2
- package/dist/testing/index.d.mts.map +1 -1
- package/dist/testing/index.mjs +2 -1
- package/dist/testing/index.mjs.map +1 -1
- package/dist/{useBoxMetrics-lF5Myjc7.mjs → useBoxMetrics-BMD1acRU.mjs} +2 -2
- package/dist/{useBoxMetrics-lF5Myjc7.mjs.map → useBoxMetrics-BMD1acRU.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/app-C_wFlWSV.mjs.map +0 -1
- package/dist/components-DzkL-yHj.mjs.map +0 -1
- package/dist/index-BCxB_ZLV.d.mts.map +0 -1
- package/dist/protocol-DavoeNLn.d.mts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as useFocusManager, O as provideFocusScope, k as useFocus, m as getLastRenderLayout } from "./app-
|
|
2
|
-
import { a as useInput, c as useIsScreenReaderEnabled, i as useMouse, n as createVirtualViewport, t as useBoxMetrics } from "./useBoxMetrics-
|
|
3
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, h, mergeProps, nextTick, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, unref, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
1
|
+
import { A as useFocusManager, O as provideFocusScope, k as useFocus, m as getLastRenderLayout } from "./app-CjfLCWic.mjs";
|
|
2
|
+
import { a as useInput, c as useIsScreenReaderEnabled, i as useMouse, n as createVirtualViewport, t as useBoxMetrics } from "./useBoxMetrics-BMD1acRU.mjs";
|
|
3
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, h, mergeProps, nextTick, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, unref, useSlots, useTemplateRef, watch, withCtx } from "vue";
|
|
4
4
|
//#region src/components/Box.ts
|
|
5
5
|
/**
|
|
6
6
|
* Box Component - Container with flexbox layout
|
|
@@ -56,6 +56,7 @@ const Box = defineComponent({
|
|
|
56
56
|
overflow: String,
|
|
57
57
|
overflowX: String,
|
|
58
58
|
overflowY: String,
|
|
59
|
+
focusId: String,
|
|
59
60
|
border: String,
|
|
60
61
|
borderStyle: String,
|
|
61
62
|
borderTop: Boolean,
|
|
@@ -145,7 +146,8 @@ const Box = defineComponent({
|
|
|
145
146
|
"aria-label": props.ariaLabel,
|
|
146
147
|
"aria-hidden": props.ariaHidden,
|
|
147
148
|
"aria-role": props.ariaRole,
|
|
148
|
-
"aria-state": props.ariaState
|
|
149
|
+
"aria-state": props.ariaState,
|
|
150
|
+
focusId: props.focusId
|
|
149
151
|
}, children);
|
|
150
152
|
};
|
|
151
153
|
}
|
|
@@ -166,11 +168,11 @@ var FrescoSpacer_default = /* @__PURE__ */ defineComponent({
|
|
|
166
168
|
});
|
|
167
169
|
//#endregion
|
|
168
170
|
//#region src/components/FrescoDivider.vue?vue&type=script&setup=true&lang.ts
|
|
169
|
-
const _hoisted_1$
|
|
170
|
-
const _hoisted_2$
|
|
171
|
-
const _hoisted_3$
|
|
172
|
-
const _hoisted_4$
|
|
173
|
-
const _hoisted_5$
|
|
171
|
+
const _hoisted_1$10 = ["fg"];
|
|
172
|
+
const _hoisted_2$7 = ["fg"];
|
|
173
|
+
const _hoisted_3$6 = ["fg"];
|
|
174
|
+
const _hoisted_4$2 = ["fg"];
|
|
175
|
+
const _hoisted_5$1 = ["fg"];
|
|
174
176
|
//#endregion
|
|
175
177
|
//#region src/components/FrescoDivider.vue
|
|
176
178
|
var FrescoDivider_default = /* @__PURE__ */ defineComponent({
|
|
@@ -211,20 +213,20 @@ var FrescoDivider_default = /* @__PURE__ */ defineComponent({
|
|
|
211
213
|
return __props.direction === "vertical" ? (openBlock(), createElementBlock("text", {
|
|
212
214
|
key: 0,
|
|
213
215
|
fg: __props.fg
|
|
214
|
-
}, toDisplayString(dividerChar.value), 9, _hoisted_1$
|
|
216
|
+
}, toDisplayString(dividerChar.value), 9, _hoisted_1$10)) : __props.title ? (openBlock(), createElementBlock("div", {
|
|
215
217
|
key: 1,
|
|
216
218
|
style: titleRowStyle
|
|
217
219
|
}, [
|
|
218
|
-
createElementVNode("text", { fg: __props.fg }, toDisplayString(dividerChar.value.repeat(3)), 9, _hoisted_2$
|
|
220
|
+
createElementVNode("text", { fg: __props.fg }, toDisplayString(dividerChar.value.repeat(3)), 9, _hoisted_2$7),
|
|
219
221
|
createElementVNode("text", {
|
|
220
222
|
fg: __props.titleFg ?? __props.fg,
|
|
221
223
|
bold: true
|
|
222
|
-
}, toDisplayString(titleLabel.value), 9, _hoisted_3$
|
|
223
|
-
createElementVNode("text", { fg: __props.fg }, toDisplayString(dividerChar.value.repeat(3)), 9, _hoisted_4$
|
|
224
|
+
}, toDisplayString(titleLabel.value), 9, _hoisted_3$6),
|
|
225
|
+
createElementVNode("text", { fg: __props.fg }, toDisplayString(dividerChar.value.repeat(3)), 9, _hoisted_4$2)
|
|
224
226
|
])) : (openBlock(), createElementBlock("text", {
|
|
225
227
|
key: 2,
|
|
226
228
|
fg: __props.fg
|
|
227
|
-
}, toDisplayString(dividerChar.value.repeat(40)), 9, _hoisted_5$
|
|
229
|
+
}, toDisplayString(dividerChar.value.repeat(40)), 9, _hoisted_5$1));
|
|
228
230
|
};
|
|
229
231
|
}
|
|
230
232
|
});
|
|
@@ -417,17 +419,17 @@ const Grid = defineComponent({
|
|
|
417
419
|
});
|
|
418
420
|
//#endregion
|
|
419
421
|
//#region src/components/FrescoCard.vue?vue&type=script&setup=true&lang.ts
|
|
420
|
-
const _hoisted_1$
|
|
422
|
+
const _hoisted_1$9 = [
|
|
421
423
|
"border",
|
|
422
424
|
"fg",
|
|
423
425
|
"bg"
|
|
424
426
|
];
|
|
425
|
-
const _hoisted_2$
|
|
426
|
-
const _hoisted_3$
|
|
427
|
+
const _hoisted_2$6 = ["fg"];
|
|
428
|
+
const _hoisted_3$5 = {
|
|
427
429
|
key: 1,
|
|
428
430
|
dim: true
|
|
429
431
|
};
|
|
430
|
-
const _hoisted_4$
|
|
432
|
+
const _hoisted_4$1 = { dim: true };
|
|
431
433
|
//#endregion
|
|
432
434
|
//#region src/components/FrescoCard.vue
|
|
433
435
|
var FrescoCard_default = /* @__PURE__ */ defineComponent({
|
|
@@ -499,13 +501,13 @@ var FrescoCard_default = /* @__PURE__ */ defineComponent({
|
|
|
499
501
|
key: 0,
|
|
500
502
|
fg: __props.titleFg,
|
|
501
503
|
bold: true
|
|
502
|
-
}, toDisplayString(__props.title), 9, _hoisted_2$
|
|
504
|
+
}, toDisplayString(__props.title), 9, _hoisted_2$6)) : createCommentVNode("v-if", true), __props.subtitle ? (openBlock(), createElementBlock("text", _hoisted_3$5, toDisplayString(subtitleLabel.value), 1)) : createCommentVNode("v-if", true)])) : createCommentVNode("v-if", true),
|
|
503
505
|
createElementVNode("div", { style: contentStyle }, [renderSlot(_ctx.$slots, "default")]),
|
|
504
506
|
hasFooter.value ? (openBlock(), createElementBlock("div", {
|
|
505
507
|
key: 1,
|
|
506
508
|
style: footerStyle
|
|
507
|
-
}, [renderSlot(_ctx.$slots, "footer", {}, () => [createElementVNode("text", _hoisted_4$
|
|
508
|
-
], 12, _hoisted_1$
|
|
509
|
+
}, [renderSlot(_ctx.$slots, "footer", {}, () => [createElementVNode("text", _hoisted_4$1, toDisplayString(__props.footer), 1)])])) : createCommentVNode("v-if", true)
|
|
510
|
+
], 12, _hoisted_1$9);
|
|
509
511
|
};
|
|
510
512
|
}
|
|
511
513
|
});
|
|
@@ -1020,7 +1022,7 @@ var ScrollBox_default = /* @__PURE__ */ defineComponent({
|
|
|
1020
1022
|
});
|
|
1021
1023
|
//#endregion
|
|
1022
1024
|
//#region src/components/FrescoNewline.vue?vue&type=script&setup=true&lang.ts
|
|
1023
|
-
const _hoisted_1$
|
|
1025
|
+
const _hoisted_1$8 = ["text"];
|
|
1024
1026
|
//#endregion
|
|
1025
1027
|
//#region src/components/FrescoNewline.vue
|
|
1026
1028
|
var FrescoNewline_default = /* @__PURE__ */ defineComponent({
|
|
@@ -1034,7 +1036,7 @@ var FrescoNewline_default = /* @__PURE__ */ defineComponent({
|
|
|
1034
1036
|
setup(__props) {
|
|
1035
1037
|
const content = computed(() => "\n".repeat(Math.max(0, __props.count)));
|
|
1036
1038
|
return (_ctx, _cache) => {
|
|
1037
|
-
return openBlock(), createElementBlock("text", { text: content.value }, null, 8, _hoisted_1$
|
|
1039
|
+
return openBlock(), createElementBlock("text", { text: content.value }, null, 8, _hoisted_1$8);
|
|
1038
1040
|
};
|
|
1039
1041
|
}
|
|
1040
1042
|
});
|
|
@@ -1085,7 +1087,7 @@ var FrescoStatic_default = /* @__PURE__ */ defineComponent({
|
|
|
1085
1087
|
});
|
|
1086
1088
|
//#endregion
|
|
1087
1089
|
//#region src/components/FrescoTransform.vue?vue&type=script&setup=true&lang.ts
|
|
1088
|
-
const _hoisted_1$
|
|
1090
|
+
const _hoisted_1$7 = ["text", "aria-label"];
|
|
1089
1091
|
//#endregion
|
|
1090
1092
|
//#region src/components/FrescoTransform.vue
|
|
1091
1093
|
var FrescoTransform_default = /* @__PURE__ */ defineComponent({
|
|
@@ -1113,7 +1115,7 @@ var FrescoTransform_default = /* @__PURE__ */ defineComponent({
|
|
|
1113
1115
|
return openBlock(), createElementBlock("text", {
|
|
1114
1116
|
text: content.value,
|
|
1115
1117
|
"aria-label": __props.accessibilityLabel
|
|
1116
|
-
}, null, 8, _hoisted_1$
|
|
1118
|
+
}, null, 8, _hoisted_1$7);
|
|
1117
1119
|
};
|
|
1118
1120
|
}
|
|
1119
1121
|
});
|
|
@@ -1846,7 +1848,7 @@ function renderMarkdown(source, options = {}, renderer = defaultMarkdownRenderer
|
|
|
1846
1848
|
}
|
|
1847
1849
|
//#endregion
|
|
1848
1850
|
//#region src/components/FrescoMarkdown.vue?vue&type=script&setup=true&lang.ts
|
|
1849
|
-
const _hoisted_1$
|
|
1851
|
+
const _hoisted_1$6 = [
|
|
1850
1852
|
"text",
|
|
1851
1853
|
"fg",
|
|
1852
1854
|
"bold",
|
|
@@ -1914,7 +1916,7 @@ var FrescoMarkdown_default = /* @__PURE__ */ defineComponent({
|
|
|
1914
1916
|
italic: span.italic,
|
|
1915
1917
|
underline: span.underline,
|
|
1916
1918
|
dim: span.dim
|
|
1917
|
-
}, null, 8, _hoisted_1$
|
|
1919
|
+
}, null, 8, _hoisted_1$6);
|
|
1918
1920
|
}), 128))]);
|
|
1919
1921
|
}), 128))]);
|
|
1920
1922
|
};
|
|
@@ -2452,8 +2454,8 @@ const Diff = defineComponent({
|
|
|
2452
2454
|
});
|
|
2453
2455
|
//#endregion
|
|
2454
2456
|
//#region src/components/FrescoLink.vue?vue&type=script&setup=true&lang.ts
|
|
2455
|
-
const _hoisted_1$
|
|
2456
|
-
const _hoisted_2$
|
|
2457
|
+
const _hoisted_1$5 = ["fg", "underline"];
|
|
2458
|
+
const _hoisted_2$5 = {
|
|
2457
2459
|
key: 0,
|
|
2458
2460
|
dim: true
|
|
2459
2461
|
};
|
|
@@ -2493,7 +2495,7 @@ var FrescoLink_default = /* @__PURE__ */ defineComponent({
|
|
|
2493
2495
|
return openBlock(), createElementBlock("div", { style: rowStyle }, [createElementVNode("text", {
|
|
2494
2496
|
fg: __props.fg,
|
|
2495
2497
|
underline: __props.underline
|
|
2496
|
-
}, toDisplayString(__props.text), 9, _hoisted_1$
|
|
2498
|
+
}, toDisplayString(__props.text), 9, _hoisted_1$5), __props.showUrl && __props.url ? (openBlock(), createElementBlock("text", _hoisted_2$5, " (" + toDisplayString(__props.url) + ")", 1)) : createCommentVNode("v-if", true)]);
|
|
2497
2499
|
};
|
|
2498
2500
|
}
|
|
2499
2501
|
});
|
|
@@ -3337,10 +3339,23 @@ function visibleCollectionOffset(highlightedIndex, currentOffset, windowSize, it
|
|
|
3337
3339
|
return Math.min(currentOffset, maximumOffset);
|
|
3338
3340
|
}
|
|
3339
3341
|
//#endregion
|
|
3342
|
+
//#region src/components/collection-values.ts
|
|
3343
|
+
/** Compare collection values by identity, an object key, or a custom comparator. */
|
|
3344
|
+
function collectionValuesEqual(left, right, by) {
|
|
3345
|
+
if (typeof by === "function") return by(left, right);
|
|
3346
|
+
if (by !== void 0 && typeof left === "object" && left !== null && typeof right === "object" && right !== null) return Object.is(Reflect.get(left, by), Reflect.get(right, by));
|
|
3347
|
+
return Object.is(left, right);
|
|
3348
|
+
}
|
|
3349
|
+
//#endregion
|
|
3340
3350
|
//#region src/components/Select.ts
|
|
3341
3351
|
/**
|
|
3342
3352
|
* Select Component - Dropdown/menu selection
|
|
3343
3353
|
*/
|
|
3354
|
+
function optionKey(option, index) {
|
|
3355
|
+
if (option.key !== void 0) return option.key;
|
|
3356
|
+
const value = option.value;
|
|
3357
|
+
return typeof value === "string" || typeof value === "number" || typeof value === "symbol" ? value : index;
|
|
3358
|
+
}
|
|
3344
3359
|
const Select = defineComponent({
|
|
3345
3360
|
name: "Select",
|
|
3346
3361
|
props: {
|
|
@@ -3348,11 +3363,18 @@ const Select = defineComponent({
|
|
|
3348
3363
|
type: Array,
|
|
3349
3364
|
required: true
|
|
3350
3365
|
},
|
|
3351
|
-
modelValue:
|
|
3366
|
+
modelValue: null,
|
|
3367
|
+
by: [
|
|
3368
|
+
String,
|
|
3369
|
+
Number,
|
|
3370
|
+
Symbol,
|
|
3371
|
+
Function
|
|
3372
|
+
],
|
|
3352
3373
|
placeholder: {
|
|
3353
3374
|
type: String,
|
|
3354
3375
|
default: "Select an option"
|
|
3355
3376
|
},
|
|
3377
|
+
maxHeight: Number,
|
|
3356
3378
|
focused: {
|
|
3357
3379
|
type: Boolean,
|
|
3358
3380
|
default: false
|
|
@@ -3375,20 +3397,33 @@ const Select = defineComponent({
|
|
|
3375
3397
|
},
|
|
3376
3398
|
emits: ["update:modelValue", "select"],
|
|
3377
3399
|
setup(props, { emit }) {
|
|
3400
|
+
const scrollOffset = ref(0);
|
|
3378
3401
|
const highlightedIndex = ref(-1);
|
|
3379
3402
|
const typeahead = createTypeaheadBuffer();
|
|
3380
|
-
|
|
3381
|
-
|
|
3403
|
+
const viewportSize = computed(() => {
|
|
3404
|
+
if (props.maxHeight === void 0 || !Number.isFinite(props.maxHeight)) return void 0;
|
|
3405
|
+
return props.maxHeight > 0 ? Math.max(1, Math.floor(props.maxHeight)) : void 0;
|
|
3406
|
+
});
|
|
3407
|
+
watch([() => props.modelValue, () => props.by], (value) => {
|
|
3408
|
+
const selectedIndex = props.options.findIndex((option) => collectionValuesEqual(option.value, value[0], value[1]) && !option.disabled);
|
|
3382
3409
|
highlightedIndex.value = selectedIndex >= 0 ? selectedIndex : firstEnabledIndex(props.options);
|
|
3383
3410
|
}, { immediate: true });
|
|
3384
3411
|
watch(() => props.options, (options) => {
|
|
3385
3412
|
if (highlightedIndex.value < 0 || highlightedIndex.value >= options.length || options[highlightedIndex.value]?.disabled) highlightedIndex.value = firstEnabledIndex(options);
|
|
3386
3413
|
}, { deep: true });
|
|
3414
|
+
watch([
|
|
3415
|
+
highlightedIndex,
|
|
3416
|
+
viewportSize,
|
|
3417
|
+
() => props.options.length
|
|
3418
|
+
], ([index, windowSize]) => {
|
|
3419
|
+
scrollOffset.value = visibleCollectionOffset(index, scrollOffset.value, windowSize, props.options.length);
|
|
3420
|
+
}, { immediate: true });
|
|
3387
3421
|
const activate = () => {
|
|
3388
3422
|
const option = props.options[highlightedIndex.value];
|
|
3389
3423
|
if (!option || option.disabled) return;
|
|
3390
|
-
|
|
3391
|
-
emit("
|
|
3424
|
+
const value = toRaw(option.value);
|
|
3425
|
+
emit("update:modelValue", value);
|
|
3426
|
+
emit("select", value);
|
|
3392
3427
|
};
|
|
3393
3428
|
useInput({
|
|
3394
3429
|
isActive: computed(() => props.focused),
|
|
@@ -3405,20 +3440,49 @@ const Select = defineComponent({
|
|
|
3405
3440
|
},
|
|
3406
3441
|
onSubmit: activate
|
|
3407
3442
|
});
|
|
3443
|
+
const visibleOptions = computed(() => {
|
|
3444
|
+
const windowSize = viewportSize.value;
|
|
3445
|
+
const start = windowSize === void 0 ? 0 : scrollOffset.value;
|
|
3446
|
+
const end = windowSize === void 0 ? props.options.length : start + windowSize;
|
|
3447
|
+
return props.options.slice(start, end).map((option, visibleIndex) => ({
|
|
3448
|
+
option,
|
|
3449
|
+
index: start + visibleIndex
|
|
3450
|
+
}));
|
|
3451
|
+
});
|
|
3452
|
+
const scrollIndicator = computed(() => {
|
|
3453
|
+
const windowSize = viewportSize.value;
|
|
3454
|
+
if (windowSize === void 0 || props.options.length <= windowSize) return {
|
|
3455
|
+
showUp: false,
|
|
3456
|
+
showDown: false
|
|
3457
|
+
};
|
|
3458
|
+
return {
|
|
3459
|
+
showUp: scrollOffset.value > 0,
|
|
3460
|
+
showDown: scrollOffset.value + windowSize < props.options.length
|
|
3461
|
+
};
|
|
3462
|
+
});
|
|
3408
3463
|
return () => {
|
|
3409
|
-
const children =
|
|
3464
|
+
const children = [];
|
|
3465
|
+
if (scrollIndicator.value.showUp) children.push(h("text", {
|
|
3466
|
+
key: "scroll-up",
|
|
3467
|
+
dim: true
|
|
3468
|
+
}, " ..."));
|
|
3469
|
+
for (const { option, index } of visibleOptions.value) {
|
|
3410
3470
|
const isHighlighted = index === highlightedIndex.value;
|
|
3411
|
-
const isSelected = option.value
|
|
3471
|
+
const isSelected = collectionValuesEqual(option.value, props.modelValue, props.by);
|
|
3412
3472
|
const indicator = isHighlighted ? props.indicator : props.indicatorEmpty;
|
|
3413
|
-
|
|
3414
|
-
key: option
|
|
3473
|
+
children.push(h("box", {
|
|
3474
|
+
key: optionKey(option, index),
|
|
3415
3475
|
style: { flex_direction: "row" }
|
|
3416
3476
|
}, [h("text", {
|
|
3417
3477
|
fg: isHighlighted ? props.selectedFg : props.fg,
|
|
3418
3478
|
bg: isHighlighted ? props.selectedBg : props.bg,
|
|
3419
3479
|
dim: option.disabled
|
|
3420
|
-
}, `${indicator}${option.label}${isSelected ? " (selected)" : ""}`)]);
|
|
3421
|
-
}
|
|
3480
|
+
}, `${indicator}${option.label}${isSelected ? " (selected)" : ""}`)]));
|
|
3481
|
+
}
|
|
3482
|
+
if (scrollIndicator.value.showDown) children.push(h("text", {
|
|
3483
|
+
key: "scroll-down",
|
|
3484
|
+
dim: true
|
|
3485
|
+
}, " ..."));
|
|
3422
3486
|
return h("box", {
|
|
3423
3487
|
style: { flex_direction: "column" },
|
|
3424
3488
|
fg: props.fg,
|
|
@@ -3428,6 +3492,95 @@ const Select = defineComponent({
|
|
|
3428
3492
|
}
|
|
3429
3493
|
});
|
|
3430
3494
|
//#endregion
|
|
3495
|
+
//#region src/components/FrescoSelect.vue
|
|
3496
|
+
var FrescoSelect_default = /* @__PURE__ */ defineComponent({
|
|
3497
|
+
name: "FrescoSelect",
|
|
3498
|
+
__name: "FrescoSelect",
|
|
3499
|
+
props: {
|
|
3500
|
+
options: {
|
|
3501
|
+
type: Array,
|
|
3502
|
+
required: true
|
|
3503
|
+
},
|
|
3504
|
+
modelValue: {
|
|
3505
|
+
type: null,
|
|
3506
|
+
required: false
|
|
3507
|
+
},
|
|
3508
|
+
by: {
|
|
3509
|
+
type: Function,
|
|
3510
|
+
required: false,
|
|
3511
|
+
skipCheck: true
|
|
3512
|
+
},
|
|
3513
|
+
placeholder: {
|
|
3514
|
+
type: String,
|
|
3515
|
+
required: false
|
|
3516
|
+
},
|
|
3517
|
+
maxHeight: {
|
|
3518
|
+
type: Number,
|
|
3519
|
+
required: false
|
|
3520
|
+
},
|
|
3521
|
+
focused: {
|
|
3522
|
+
type: Boolean,
|
|
3523
|
+
required: false
|
|
3524
|
+
},
|
|
3525
|
+
indicator: {
|
|
3526
|
+
type: String,
|
|
3527
|
+
required: false
|
|
3528
|
+
},
|
|
3529
|
+
indicatorEmpty: {
|
|
3530
|
+
type: String,
|
|
3531
|
+
required: false
|
|
3532
|
+
},
|
|
3533
|
+
fg: {
|
|
3534
|
+
type: String,
|
|
3535
|
+
required: false
|
|
3536
|
+
},
|
|
3537
|
+
bg: {
|
|
3538
|
+
type: String,
|
|
3539
|
+
required: false
|
|
3540
|
+
},
|
|
3541
|
+
selectedFg: {
|
|
3542
|
+
type: String,
|
|
3543
|
+
required: false
|
|
3544
|
+
},
|
|
3545
|
+
selectedBg: {
|
|
3546
|
+
type: String,
|
|
3547
|
+
required: false
|
|
3548
|
+
}
|
|
3549
|
+
},
|
|
3550
|
+
emits: ["update:modelValue", "select"],
|
|
3551
|
+
setup(__props, { emit: __emit }) {
|
|
3552
|
+
const emit = __emit;
|
|
3553
|
+
const runtimeProps = computed(() => {
|
|
3554
|
+
return {
|
|
3555
|
+
options: __props.options,
|
|
3556
|
+
modelValue: __props.modelValue,
|
|
3557
|
+
by: typeof __props.by === "function" ? (left, right) => __props.by(left, right) : __props.by,
|
|
3558
|
+
placeholder: __props.placeholder,
|
|
3559
|
+
maxHeight: __props.maxHeight,
|
|
3560
|
+
focused: __props.focused,
|
|
3561
|
+
indicator: __props.indicator,
|
|
3562
|
+
indicatorEmpty: __props.indicatorEmpty,
|
|
3563
|
+
fg: __props.fg,
|
|
3564
|
+
bg: __props.bg,
|
|
3565
|
+
selectedFg: __props.selectedFg,
|
|
3566
|
+
selectedBg: __props.selectedBg
|
|
3567
|
+
};
|
|
3568
|
+
});
|
|
3569
|
+
function updateModelValue(value) {
|
|
3570
|
+
emit("update:modelValue", value);
|
|
3571
|
+
}
|
|
3572
|
+
function selectValue(value) {
|
|
3573
|
+
emit("select", value);
|
|
3574
|
+
}
|
|
3575
|
+
return (_ctx, _cache) => {
|
|
3576
|
+
return openBlock(), createBlock(unref(Select), mergeProps(runtimeProps.value, {
|
|
3577
|
+
"onUpdate:modelValue": updateModelValue,
|
|
3578
|
+
onSelect: selectValue
|
|
3579
|
+
}), null, 16);
|
|
3580
|
+
};
|
|
3581
|
+
}
|
|
3582
|
+
});
|
|
3583
|
+
//#endregion
|
|
3431
3584
|
//#region src/components/Checkbox.ts
|
|
3432
3585
|
/**
|
|
3433
3586
|
* Checkbox Component - Toggle checkbox
|
|
@@ -4410,9 +4563,9 @@ const avatarStatusIcons = {
|
|
|
4410
4563
|
};
|
|
4411
4564
|
//#endregion
|
|
4412
4565
|
//#region src/components/FrescoAlert.vue?vue&type=script&setup=true&lang.ts
|
|
4413
|
-
const _hoisted_1$
|
|
4414
|
-
const _hoisted_2$
|
|
4415
|
-
const _hoisted_3$
|
|
4566
|
+
const _hoisted_1$4 = ["border", "fg"];
|
|
4567
|
+
const _hoisted_2$4 = ["fg"];
|
|
4568
|
+
const _hoisted_3$4 = ["fg"];
|
|
4416
4569
|
//#endregion
|
|
4417
4570
|
//#region src/components/FrescoAlert.vue
|
|
4418
4571
|
var FrescoAlert_default = /* @__PURE__ */ defineComponent({
|
|
@@ -4461,18 +4614,18 @@ var FrescoAlert_default = /* @__PURE__ */ defineComponent({
|
|
|
4461
4614
|
}, [createElementVNode("div", { style: headerStyle }, [__props.showIcon ? (openBlock(), createElementBlock("text", {
|
|
4462
4615
|
key: 0,
|
|
4463
4616
|
fg: config.value.fg
|
|
4464
|
-
}, toDisplayString(iconLabel.value), 9, _hoisted_2$
|
|
4617
|
+
}, toDisplayString(iconLabel.value), 9, _hoisted_2$4)) : createCommentVNode("v-if", true), createElementVNode("text", {
|
|
4465
4618
|
fg: config.value.fg,
|
|
4466
4619
|
bold: true
|
|
4467
|
-
}, toDisplayString(heading.value), 9, _hoisted_3$
|
|
4620
|
+
}, toDisplayString(heading.value), 9, _hoisted_3$4)]), createElementVNode("text", { style: messageStyle }, toDisplayString(__props.message), 1)], 8, _hoisted_1$4);
|
|
4468
4621
|
};
|
|
4469
4622
|
}
|
|
4470
4623
|
});
|
|
4471
4624
|
//#endregion
|
|
4472
4625
|
//#region src/components/FrescoBadge.vue?vue&type=script&setup=true&lang.ts
|
|
4473
|
-
const _hoisted_1$
|
|
4474
|
-
const _hoisted_2$
|
|
4475
|
-
const _hoisted_3$
|
|
4626
|
+
const _hoisted_1$3 = ["fg", "bg"];
|
|
4627
|
+
const _hoisted_2$3 = ["fg", "bg"];
|
|
4628
|
+
const _hoisted_3$3 = ["fg", "bg"];
|
|
4476
4629
|
//#endregion
|
|
4477
4630
|
//#region src/components/FrescoBadge.vue
|
|
4478
4631
|
var FrescoBadge_default = /* @__PURE__ */ defineComponent({
|
|
@@ -4520,12 +4673,12 @@ var FrescoBadge_default = /* @__PURE__ */ defineComponent({
|
|
|
4520
4673
|
}, [createElementVNode("text", {
|
|
4521
4674
|
fg: foreground.value,
|
|
4522
4675
|
bg: background.value
|
|
4523
|
-
}, toDisplayString(__props.label), 9, _hoisted_2$
|
|
4676
|
+
}, toDisplayString(__props.label), 9, _hoisted_2$3)], 8, _hoisted_1$3)) : (openBlock(), createElementBlock("text", {
|
|
4524
4677
|
key: 1,
|
|
4525
4678
|
fg: foreground.value,
|
|
4526
4679
|
bg: background.value,
|
|
4527
4680
|
bold: true
|
|
4528
|
-
}, "[" + toDisplayString(__props.label) + "]", 9, _hoisted_3$
|
|
4681
|
+
}, "[" + toDisplayString(__props.label) + "]", 9, _hoisted_3$3));
|
|
4529
4682
|
};
|
|
4530
4683
|
}
|
|
4531
4684
|
});
|
|
@@ -4648,17 +4801,6 @@ const Timer = defineComponent({
|
|
|
4648
4801
|
}
|
|
4649
4802
|
});
|
|
4650
4803
|
//#endregion
|
|
4651
|
-
//#region src/components/FrescoTooltip.vue?vue&type=script&setup=true&lang.ts
|
|
4652
|
-
const _hoisted_1$3 = { key: 0 };
|
|
4653
|
-
const _hoisted_2$3 = [
|
|
4654
|
-
"border",
|
|
4655
|
-
"bg",
|
|
4656
|
-
"fg"
|
|
4657
|
-
];
|
|
4658
|
-
const _hoisted_3$3 = ["fg", "bg"];
|
|
4659
|
-
const _hoisted_4$1 = { key: 1 };
|
|
4660
|
-
const _hoisted_5$1 = { key: 1 };
|
|
4661
|
-
//#endregion
|
|
4662
4804
|
//#region src/components/FrescoTooltip.vue
|
|
4663
4805
|
var FrescoTooltip_default = /* @__PURE__ */ defineComponent({
|
|
4664
4806
|
name: "FrescoTooltip",
|
|
@@ -4678,6 +4820,11 @@ var FrescoTooltip_default = /* @__PURE__ */ defineComponent({
|
|
|
4678
4820
|
required: false,
|
|
4679
4821
|
default: "top"
|
|
4680
4822
|
},
|
|
4823
|
+
offset: {
|
|
4824
|
+
type: Number,
|
|
4825
|
+
required: false,
|
|
4826
|
+
default: 0
|
|
4827
|
+
},
|
|
4681
4828
|
border: {
|
|
4682
4829
|
type: String,
|
|
4683
4830
|
required: false,
|
|
@@ -4695,29 +4842,70 @@ var FrescoTooltip_default = /* @__PURE__ */ defineComponent({
|
|
|
4695
4842
|
}
|
|
4696
4843
|
},
|
|
4697
4844
|
setup(__props) {
|
|
4698
|
-
const
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4845
|
+
const panelPosition = computed(() => {
|
|
4846
|
+
const gap = Number.isFinite(__props.offset) ? Math.max(0, __props.offset) : 0;
|
|
4847
|
+
switch (__props.position) {
|
|
4848
|
+
case "bottom": return {
|
|
4849
|
+
top: "100%",
|
|
4850
|
+
marginTop: gap
|
|
4851
|
+
};
|
|
4852
|
+
case "right": return {
|
|
4853
|
+
left: "100%",
|
|
4854
|
+
marginLeft: gap
|
|
4855
|
+
};
|
|
4856
|
+
case "left": return {
|
|
4857
|
+
right: "100%",
|
|
4858
|
+
marginRight: gap
|
|
4859
|
+
};
|
|
4860
|
+
default: return {
|
|
4861
|
+
bottom: "100%",
|
|
4862
|
+
marginBottom: gap
|
|
4863
|
+
};
|
|
4864
|
+
}
|
|
4865
|
+
});
|
|
4704
4866
|
return (_ctx, _cache) => {
|
|
4705
|
-
return
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4867
|
+
return openBlock(), createBlock(unref(Box), { position: "relative" }, {
|
|
4868
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default"), __props.visible ? (openBlock(), createBlock(unref(Box), {
|
|
4869
|
+
key: 0,
|
|
4870
|
+
position: "absolute",
|
|
4871
|
+
top: panelPosition.value.top,
|
|
4872
|
+
right: panelPosition.value.right,
|
|
4873
|
+
bottom: panelPosition.value.bottom,
|
|
4874
|
+
left: panelPosition.value.left,
|
|
4875
|
+
"margin-top": panelPosition.value.marginTop,
|
|
4876
|
+
"margin-right": panelPosition.value.marginRight,
|
|
4877
|
+
"margin-bottom": panelPosition.value.marginBottom,
|
|
4878
|
+
"margin-left": panelPosition.value.marginLeft,
|
|
4711
4879
|
border: __props.border === "none" ? void 0 : __props.border,
|
|
4712
4880
|
bg: __props.bg,
|
|
4713
4881
|
fg: __props.fg,
|
|
4714
|
-
|
|
4715
|
-
},
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4882
|
+
"padding-x": 1
|
|
4883
|
+
}, {
|
|
4884
|
+
default: withCtx(() => [createVNode(unref(Text), {
|
|
4885
|
+
content: __props.text,
|
|
4886
|
+
fg: __props.fg,
|
|
4887
|
+
bg: __props.bg
|
|
4888
|
+
}, null, 8, [
|
|
4889
|
+
"content",
|
|
4890
|
+
"fg",
|
|
4891
|
+
"bg"
|
|
4892
|
+
])]),
|
|
4893
|
+
_: 1
|
|
4894
|
+
}, 8, [
|
|
4895
|
+
"top",
|
|
4896
|
+
"right",
|
|
4897
|
+
"bottom",
|
|
4898
|
+
"left",
|
|
4899
|
+
"margin-top",
|
|
4900
|
+
"margin-right",
|
|
4901
|
+
"margin-bottom",
|
|
4902
|
+
"margin-left",
|
|
4903
|
+
"border",
|
|
4904
|
+
"bg",
|
|
4905
|
+
"fg"
|
|
4906
|
+
])) : createCommentVNode("v-if", true)]),
|
|
4907
|
+
_: 3
|
|
4908
|
+
});
|
|
4721
4909
|
};
|
|
4722
4910
|
}
|
|
4723
4911
|
});
|
|
@@ -4726,6 +4914,9 @@ var FrescoTooltip_default = /* @__PURE__ */ defineComponent({
|
|
|
4726
4914
|
/**
|
|
4727
4915
|
* List Component - Scrollable list of items
|
|
4728
4916
|
*/
|
|
4917
|
+
function listItemValue(item) {
|
|
4918
|
+
return Object.hasOwn(item, "value") ? item.value : item.key;
|
|
4919
|
+
}
|
|
4729
4920
|
const List = defineComponent({
|
|
4730
4921
|
name: "List",
|
|
4731
4922
|
props: {
|
|
@@ -4733,7 +4924,13 @@ const List = defineComponent({
|
|
|
4733
4924
|
type: Array,
|
|
4734
4925
|
required: true
|
|
4735
4926
|
},
|
|
4736
|
-
modelValue:
|
|
4927
|
+
modelValue: null,
|
|
4928
|
+
by: [
|
|
4929
|
+
String,
|
|
4930
|
+
Number,
|
|
4931
|
+
Symbol,
|
|
4932
|
+
Function
|
|
4933
|
+
],
|
|
4737
4934
|
maxHeight: Number,
|
|
4738
4935
|
focused: {
|
|
4739
4936
|
type: Boolean,
|
|
@@ -4760,11 +4957,15 @@ const List = defineComponent({
|
|
|
4760
4957
|
const highlightedIndex = ref(-1);
|
|
4761
4958
|
const typeahead = createTypeaheadBuffer();
|
|
4762
4959
|
const syncHighlight = () => {
|
|
4763
|
-
const selectedIndex = props.items.findIndex((item) => item
|
|
4960
|
+
const selectedIndex = props.items.findIndex((item) => collectionValuesEqual(listItemValue(item), props.modelValue, props.by) && !item.disabled);
|
|
4764
4961
|
if (selectedIndex >= 0) highlightedIndex.value = selectedIndex;
|
|
4765
4962
|
else if (highlightedIndex.value < 0 || highlightedIndex.value >= props.items.length || props.items[highlightedIndex.value]?.disabled) highlightedIndex.value = firstEnabledIndex(props.items);
|
|
4766
4963
|
};
|
|
4767
|
-
watch([
|
|
4964
|
+
watch([
|
|
4965
|
+
() => props.modelValue,
|
|
4966
|
+
() => props.items,
|
|
4967
|
+
() => props.by
|
|
4968
|
+
], syncHighlight, {
|
|
4768
4969
|
deep: true,
|
|
4769
4970
|
immediate: true
|
|
4770
4971
|
});
|
|
@@ -4788,8 +4989,9 @@ const List = defineComponent({
|
|
|
4788
4989
|
const activate = () => {
|
|
4789
4990
|
const item = props.items[highlightedIndex.value];
|
|
4790
4991
|
if (!item || item.disabled) return;
|
|
4791
|
-
|
|
4792
|
-
emit("
|
|
4992
|
+
const value = toRaw(listItemValue(item));
|
|
4993
|
+
emit("update:modelValue", value);
|
|
4994
|
+
emit("select", value);
|
|
4793
4995
|
};
|
|
4794
4996
|
useInput({
|
|
4795
4997
|
isActive: computed(() => props.focused),
|
|
@@ -4832,7 +5034,7 @@ const List = defineComponent({
|
|
|
4832
5034
|
}, " ..."));
|
|
4833
5035
|
visibleItems.value.forEach((item, visibleIndex) => {
|
|
4834
5036
|
const isHighlighted = scrollOffset.value + visibleIndex === highlightedIndex.value;
|
|
4835
|
-
const isSelected = item.
|
|
5037
|
+
const isSelected = collectionValuesEqual(listItemValue(item), props.modelValue, props.by);
|
|
4836
5038
|
const indicator = isHighlighted ? props.indicator : props.indicatorEmpty;
|
|
4837
5039
|
children.push(h("text", {
|
|
4838
5040
|
key: item.key,
|
|
@@ -4854,6 +5056,85 @@ const List = defineComponent({
|
|
|
4854
5056
|
}
|
|
4855
5057
|
});
|
|
4856
5058
|
//#endregion
|
|
5059
|
+
//#region src/components/FrescoList.vue
|
|
5060
|
+
var FrescoList_default = /* @__PURE__ */ defineComponent({
|
|
5061
|
+
name: "FrescoList",
|
|
5062
|
+
__name: "FrescoList",
|
|
5063
|
+
props: {
|
|
5064
|
+
items: {
|
|
5065
|
+
type: Array,
|
|
5066
|
+
required: true
|
|
5067
|
+
},
|
|
5068
|
+
modelValue: {
|
|
5069
|
+
type: null,
|
|
5070
|
+
required: false
|
|
5071
|
+
},
|
|
5072
|
+
by: {
|
|
5073
|
+
type: Function,
|
|
5074
|
+
required: false,
|
|
5075
|
+
skipCheck: true
|
|
5076
|
+
},
|
|
5077
|
+
maxHeight: {
|
|
5078
|
+
type: Number,
|
|
5079
|
+
required: false
|
|
5080
|
+
},
|
|
5081
|
+
focused: {
|
|
5082
|
+
type: Boolean,
|
|
5083
|
+
required: false
|
|
5084
|
+
},
|
|
5085
|
+
indicator: {
|
|
5086
|
+
type: String,
|
|
5087
|
+
required: false
|
|
5088
|
+
},
|
|
5089
|
+
indicatorEmpty: {
|
|
5090
|
+
type: String,
|
|
5091
|
+
required: false
|
|
5092
|
+
},
|
|
5093
|
+
fg: {
|
|
5094
|
+
type: String,
|
|
5095
|
+
required: false
|
|
5096
|
+
},
|
|
5097
|
+
selectedFg: {
|
|
5098
|
+
type: String,
|
|
5099
|
+
required: false
|
|
5100
|
+
},
|
|
5101
|
+
selectedBg: {
|
|
5102
|
+
type: String,
|
|
5103
|
+
required: false
|
|
5104
|
+
}
|
|
5105
|
+
},
|
|
5106
|
+
emits: ["update:modelValue", "select"],
|
|
5107
|
+
setup(__props, { emit: __emit }) {
|
|
5108
|
+
const emit = __emit;
|
|
5109
|
+
const runtimeProps = computed(() => {
|
|
5110
|
+
return {
|
|
5111
|
+
items: __props.items,
|
|
5112
|
+
modelValue: __props.modelValue,
|
|
5113
|
+
by: typeof __props.by === "function" ? (left, right) => __props.by(left, right) : __props.by,
|
|
5114
|
+
maxHeight: __props.maxHeight,
|
|
5115
|
+
focused: __props.focused,
|
|
5116
|
+
indicator: __props.indicator,
|
|
5117
|
+
indicatorEmpty: __props.indicatorEmpty,
|
|
5118
|
+
fg: __props.fg,
|
|
5119
|
+
selectedFg: __props.selectedFg,
|
|
5120
|
+
selectedBg: __props.selectedBg
|
|
5121
|
+
};
|
|
5122
|
+
});
|
|
5123
|
+
function updateModelValue(value) {
|
|
5124
|
+
emit("update:modelValue", value);
|
|
5125
|
+
}
|
|
5126
|
+
function selectValue(value) {
|
|
5127
|
+
emit("select", value);
|
|
5128
|
+
}
|
|
5129
|
+
return (_ctx, _cache) => {
|
|
5130
|
+
return openBlock(), createBlock(unref(List), mergeProps(runtimeProps.value, {
|
|
5131
|
+
"onUpdate:modelValue": updateModelValue,
|
|
5132
|
+
onSelect: selectValue
|
|
5133
|
+
}), null, 16);
|
|
5134
|
+
};
|
|
5135
|
+
}
|
|
5136
|
+
});
|
|
5137
|
+
//#endregion
|
|
4857
5138
|
//#region src/components/table-utils.ts
|
|
4858
5139
|
function finiteInteger(value, fallback) {
|
|
4859
5140
|
return Number.isFinite(value) ? Math.trunc(value) : fallback;
|
|
@@ -5130,6 +5411,9 @@ const Table = defineComponent({
|
|
|
5130
5411
|
/**
|
|
5131
5412
|
* Tree Component - Tree view for hierarchical data
|
|
5132
5413
|
*/
|
|
5414
|
+
function treeNodeValue(node) {
|
|
5415
|
+
return Object.hasOwn(node, "value") ? node.value : node.key;
|
|
5416
|
+
}
|
|
5133
5417
|
const Tree = defineComponent({
|
|
5134
5418
|
name: "Tree",
|
|
5135
5419
|
props: {
|
|
@@ -5141,11 +5425,18 @@ const Tree = defineComponent({
|
|
|
5141
5425
|
type: Array,
|
|
5142
5426
|
default: () => []
|
|
5143
5427
|
},
|
|
5144
|
-
selected:
|
|
5428
|
+
selected: null,
|
|
5429
|
+
by: [
|
|
5430
|
+
String,
|
|
5431
|
+
Number,
|
|
5432
|
+
Symbol,
|
|
5433
|
+
Function
|
|
5434
|
+
],
|
|
5145
5435
|
focused: {
|
|
5146
5436
|
type: Boolean,
|
|
5147
5437
|
default: false
|
|
5148
5438
|
},
|
|
5439
|
+
maxHeight: Number,
|
|
5149
5440
|
showLines: {
|
|
5150
5441
|
type: Boolean,
|
|
5151
5442
|
default: true
|
|
@@ -5204,22 +5495,34 @@ const Tree = defineComponent({
|
|
|
5204
5495
|
return visible;
|
|
5205
5496
|
});
|
|
5206
5497
|
const highlightedKey = ref();
|
|
5498
|
+
const scrollOffset = ref(0);
|
|
5207
5499
|
const typeahead = createTypeaheadBuffer();
|
|
5500
|
+
const viewportSize = computed(() => {
|
|
5501
|
+
if (props.maxHeight === void 0 || !Number.isFinite(props.maxHeight)) return void 0;
|
|
5502
|
+
return props.maxHeight > 0 ? Math.max(1, Math.floor(props.maxHeight)) : void 0;
|
|
5503
|
+
});
|
|
5208
5504
|
const navigableNodes = computed(() => visibleNodes.value.map(({ node }) => ({ disabled: node.disabled })));
|
|
5209
5505
|
const highlightedIndex = computed(() => visibleNodes.value.findIndex(({ node }) => node.key === highlightedKey.value));
|
|
5210
5506
|
const syncVisibleHighlight = () => {
|
|
5211
5507
|
const currentIndex = highlightedIndex.value;
|
|
5212
5508
|
if (currentIndex >= 0 && !visibleNodes.value[currentIndex]?.node.disabled) return;
|
|
5213
|
-
const selectedIndex = visibleNodes.value.findIndex(({ node }) => node
|
|
5509
|
+
const selectedIndex = visibleNodes.value.findIndex(({ node }) => collectionValuesEqual(treeNodeValue(node), props.selected, props.by) && !node.disabled);
|
|
5214
5510
|
const nextIndex = selectedIndex >= 0 ? selectedIndex : firstEnabledIndex(navigableNodes.value);
|
|
5215
5511
|
highlightedKey.value = visibleNodes.value[nextIndex]?.node.key;
|
|
5216
5512
|
};
|
|
5217
|
-
watch(() => props.selected, (selected) => {
|
|
5218
|
-
const selectedIndex = visibleNodes.value.findIndex(({ node }) => node
|
|
5513
|
+
watch([() => props.selected, () => props.by], ([selected, by]) => {
|
|
5514
|
+
const selectedIndex = visibleNodes.value.findIndex(({ node }) => collectionValuesEqual(treeNodeValue(node), selected, by) && !node.disabled);
|
|
5219
5515
|
if (selectedIndex >= 0) highlightedKey.value = visibleNodes.value[selectedIndex]?.node.key;
|
|
5220
5516
|
else syncVisibleHighlight();
|
|
5221
5517
|
}, { immediate: true });
|
|
5222
5518
|
watch(visibleNodes, syncVisibleHighlight, { deep: true });
|
|
5519
|
+
watch([
|
|
5520
|
+
highlightedIndex,
|
|
5521
|
+
viewportSize,
|
|
5522
|
+
() => visibleNodes.value.length
|
|
5523
|
+
], ([index, windowSize]) => {
|
|
5524
|
+
scrollOffset.value = visibleCollectionOffset(index, scrollOffset.value, windowSize, visibleNodes.value.length);
|
|
5525
|
+
}, { immediate: true });
|
|
5223
5526
|
const setHighlight = (index) => {
|
|
5224
5527
|
const entry = visibleNodes.value[index];
|
|
5225
5528
|
if (!entry || entry.node.disabled) return;
|
|
@@ -5235,8 +5538,9 @@ const Tree = defineComponent({
|
|
|
5235
5538
|
const activate = () => {
|
|
5236
5539
|
const entry = visibleNodes.value[highlightedIndex.value];
|
|
5237
5540
|
if (!entry || entry.node.disabled) return;
|
|
5238
|
-
|
|
5239
|
-
emit("
|
|
5541
|
+
const value = toRaw(treeNodeValue(entry.node));
|
|
5542
|
+
emit("update:selected", value);
|
|
5543
|
+
emit("select", value);
|
|
5240
5544
|
};
|
|
5241
5545
|
const moveToParent = (parentKey) => {
|
|
5242
5546
|
let key = parentKey;
|
|
@@ -5280,47 +5584,187 @@ const Tree = defineComponent({
|
|
|
5280
5584
|
},
|
|
5281
5585
|
onSubmit: activate
|
|
5282
5586
|
});
|
|
5283
|
-
|
|
5284
|
-
const
|
|
5285
|
-
const
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5587
|
+
const viewportNodes = computed(() => {
|
|
5588
|
+
const windowSize = viewportSize.value;
|
|
5589
|
+
const start = windowSize === void 0 ? 0 : scrollOffset.value;
|
|
5590
|
+
const end = windowSize === void 0 ? visibleNodes.value.length : start + windowSize;
|
|
5591
|
+
return visibleNodes.value.slice(start, end);
|
|
5592
|
+
});
|
|
5593
|
+
const scrollIndicator = computed(() => {
|
|
5594
|
+
const windowSize = viewportSize.value;
|
|
5595
|
+
if (windowSize === void 0 || visibleNodes.value.length <= windowSize) return {
|
|
5596
|
+
showUp: false,
|
|
5597
|
+
showDown: false
|
|
5598
|
+
};
|
|
5599
|
+
return {
|
|
5600
|
+
showUp: scrollOffset.value > 0,
|
|
5601
|
+
showDown: scrollOffset.value + windowSize < visibleNodes.value.length
|
|
5602
|
+
};
|
|
5603
|
+
});
|
|
5604
|
+
return () => {
|
|
5605
|
+
const children = [];
|
|
5606
|
+
if (scrollIndicator.value.showUp) children.push(h("text", {
|
|
5607
|
+
key: "scroll-up",
|
|
5608
|
+
dim: true
|
|
5609
|
+
}, " ..."));
|
|
5610
|
+
for (const { node, prefix, icon } of viewportNodes.value) {
|
|
5611
|
+
const isSelected = collectionValuesEqual(treeNodeValue(node), props.selected, props.by);
|
|
5612
|
+
const isHighlighted = node.key === highlightedKey.value;
|
|
5613
|
+
children.push(h("text", {
|
|
5614
|
+
key: node.key,
|
|
5615
|
+
fg: isSelected || isHighlighted ? props.selectedFg : props.fg,
|
|
5616
|
+
bold: isSelected,
|
|
5617
|
+
underline: props.focused && isHighlighted,
|
|
5618
|
+
dim: node.disabled
|
|
5619
|
+
}, `${prefix}${icon} ${node.label}`));
|
|
5620
|
+
}
|
|
5621
|
+
if (scrollIndicator.value.showDown) children.push(h("text", {
|
|
5622
|
+
key: "scroll-down",
|
|
5623
|
+
dim: true
|
|
5624
|
+
}, " ..."));
|
|
5625
|
+
return h("box", { style: { flex_direction: "column" } }, children);
|
|
5626
|
+
};
|
|
5294
5627
|
}
|
|
5295
5628
|
});
|
|
5296
5629
|
//#endregion
|
|
5297
|
-
//#region src/components/
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
const Menu = defineComponent({
|
|
5302
|
-
name: "Menu",
|
|
5630
|
+
//#region src/components/FrescoTree.vue
|
|
5631
|
+
var FrescoTree_default = /* @__PURE__ */ defineComponent({
|
|
5632
|
+
name: "FrescoTree",
|
|
5633
|
+
__name: "FrescoTree",
|
|
5303
5634
|
props: {
|
|
5304
|
-
|
|
5635
|
+
data: {
|
|
5305
5636
|
type: Array,
|
|
5306
5637
|
required: true
|
|
5307
5638
|
},
|
|
5308
|
-
|
|
5309
|
-
type:
|
|
5310
|
-
|
|
5639
|
+
expanded: {
|
|
5640
|
+
type: Array,
|
|
5641
|
+
required: false
|
|
5642
|
+
},
|
|
5643
|
+
selected: {
|
|
5644
|
+
type: null,
|
|
5645
|
+
required: false
|
|
5646
|
+
},
|
|
5647
|
+
by: {
|
|
5648
|
+
type: Function,
|
|
5649
|
+
required: false,
|
|
5650
|
+
skipCheck: true
|
|
5311
5651
|
},
|
|
5312
5652
|
focused: {
|
|
5313
5653
|
type: Boolean,
|
|
5314
|
-
|
|
5654
|
+
required: false
|
|
5315
5655
|
},
|
|
5316
|
-
|
|
5317
|
-
type:
|
|
5318
|
-
|
|
5656
|
+
maxHeight: {
|
|
5657
|
+
type: Number,
|
|
5658
|
+
required: false
|
|
5319
5659
|
},
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5660
|
+
showLines: {
|
|
5661
|
+
type: Boolean,
|
|
5662
|
+
required: false
|
|
5663
|
+
},
|
|
5664
|
+
indent: {
|
|
5665
|
+
type: Number,
|
|
5666
|
+
required: false
|
|
5667
|
+
},
|
|
5668
|
+
expandedIcon: {
|
|
5669
|
+
type: String,
|
|
5670
|
+
required: false
|
|
5671
|
+
},
|
|
5672
|
+
collapsedIcon: {
|
|
5673
|
+
type: String,
|
|
5674
|
+
required: false
|
|
5675
|
+
},
|
|
5676
|
+
leafIcon: {
|
|
5677
|
+
type: String,
|
|
5678
|
+
required: false
|
|
5679
|
+
},
|
|
5680
|
+
fg: {
|
|
5681
|
+
type: String,
|
|
5682
|
+
required: false
|
|
5683
|
+
},
|
|
5684
|
+
selectedFg: {
|
|
5685
|
+
type: String,
|
|
5686
|
+
required: false
|
|
5687
|
+
}
|
|
5688
|
+
},
|
|
5689
|
+
emits: [
|
|
5690
|
+
"select",
|
|
5691
|
+
"update:selected",
|
|
5692
|
+
"toggle",
|
|
5693
|
+
"update:expanded"
|
|
5694
|
+
],
|
|
5695
|
+
setup(__props, { emit: __emit }) {
|
|
5696
|
+
const emit = __emit;
|
|
5697
|
+
const runtimeProps = computed(() => {
|
|
5698
|
+
return {
|
|
5699
|
+
data: __props.data,
|
|
5700
|
+
expanded: __props.expanded,
|
|
5701
|
+
selected: __props.selected,
|
|
5702
|
+
by: typeof __props.by === "function" ? (left, right) => __props.by(left, right) : __props.by,
|
|
5703
|
+
focused: __props.focused,
|
|
5704
|
+
maxHeight: __props.maxHeight,
|
|
5705
|
+
showLines: __props.showLines,
|
|
5706
|
+
indent: __props.indent,
|
|
5707
|
+
expandedIcon: __props.expandedIcon,
|
|
5708
|
+
collapsedIcon: __props.collapsedIcon,
|
|
5709
|
+
leafIcon: __props.leafIcon,
|
|
5710
|
+
fg: __props.fg,
|
|
5711
|
+
selectedFg: __props.selectedFg
|
|
5712
|
+
};
|
|
5713
|
+
});
|
|
5714
|
+
function selectValue(value) {
|
|
5715
|
+
emit("select", value);
|
|
5716
|
+
}
|
|
5717
|
+
function updateSelected(value) {
|
|
5718
|
+
emit("update:selected", value);
|
|
5719
|
+
}
|
|
5720
|
+
function toggle(key, expanded) {
|
|
5721
|
+
emit("toggle", key, expanded);
|
|
5722
|
+
}
|
|
5723
|
+
function updateExpanded(keys) {
|
|
5724
|
+
emit("update:expanded", keys);
|
|
5725
|
+
}
|
|
5726
|
+
return (_ctx, _cache) => {
|
|
5727
|
+
return openBlock(), createBlock(unref(Tree), mergeProps(runtimeProps.value, {
|
|
5728
|
+
onSelect: selectValue,
|
|
5729
|
+
"onUpdate:selected": updateSelected,
|
|
5730
|
+
onToggle: toggle,
|
|
5731
|
+
"onUpdate:expanded": updateExpanded
|
|
5732
|
+
}), null, 16);
|
|
5733
|
+
};
|
|
5734
|
+
}
|
|
5735
|
+
});
|
|
5736
|
+
//#endregion
|
|
5737
|
+
//#region src/components/Menu.ts
|
|
5738
|
+
/**
|
|
5739
|
+
* Menu Component - Command menu/palette
|
|
5740
|
+
*/
|
|
5741
|
+
function menuItemValue(item) {
|
|
5742
|
+
return Object.hasOwn(item, "value") ? item.value : item.key;
|
|
5743
|
+
}
|
|
5744
|
+
const Menu = defineComponent({
|
|
5745
|
+
name: "Menu",
|
|
5746
|
+
props: {
|
|
5747
|
+
items: {
|
|
5748
|
+
type: Array,
|
|
5749
|
+
required: true
|
|
5750
|
+
},
|
|
5751
|
+
focusedIndex: {
|
|
5752
|
+
type: Number,
|
|
5753
|
+
default: 0
|
|
5754
|
+
},
|
|
5755
|
+
focused: {
|
|
5756
|
+
type: Boolean,
|
|
5757
|
+
default: false
|
|
5758
|
+
},
|
|
5759
|
+
maxHeight: Number,
|
|
5760
|
+
border: {
|
|
5761
|
+
type: String,
|
|
5762
|
+
default: "single"
|
|
5763
|
+
},
|
|
5764
|
+
width: Number,
|
|
5765
|
+
fg: String,
|
|
5766
|
+
focusedFg: {
|
|
5767
|
+
type: String,
|
|
5324
5768
|
default: "black"
|
|
5325
5769
|
},
|
|
5326
5770
|
focusedBg: {
|
|
@@ -5334,8 +5778,13 @@ const Menu = defineComponent({
|
|
|
5334
5778
|
},
|
|
5335
5779
|
emits: ["select", "update:focusedIndex"],
|
|
5336
5780
|
setup(props, { emit }) {
|
|
5781
|
+
const scrollOffset = ref(0);
|
|
5337
5782
|
const highlightedIndex = ref(-1);
|
|
5338
5783
|
const typeahead = createTypeaheadBuffer();
|
|
5784
|
+
const viewportSize = computed(() => {
|
|
5785
|
+
if (props.maxHeight === void 0 || !Number.isFinite(props.maxHeight)) return void 0;
|
|
5786
|
+
return props.maxHeight > 0 ? Math.max(1, Math.floor(props.maxHeight)) : void 0;
|
|
5787
|
+
});
|
|
5339
5788
|
const syncHighlight = () => {
|
|
5340
5789
|
const requested = props.focusedIndex;
|
|
5341
5790
|
const requestedItem = props.items[requested];
|
|
@@ -5345,6 +5794,13 @@ const Menu = defineComponent({
|
|
|
5345
5794
|
deep: true,
|
|
5346
5795
|
immediate: true
|
|
5347
5796
|
});
|
|
5797
|
+
watch([
|
|
5798
|
+
highlightedIndex,
|
|
5799
|
+
viewportSize,
|
|
5800
|
+
() => props.items.length
|
|
5801
|
+
], ([index, windowSize]) => {
|
|
5802
|
+
scrollOffset.value = visibleCollectionOffset(index, scrollOffset.value, windowSize, props.items.length);
|
|
5803
|
+
}, { immediate: true });
|
|
5348
5804
|
const setHighlight = (index) => {
|
|
5349
5805
|
if (index < 0 || index === highlightedIndex.value) return;
|
|
5350
5806
|
highlightedIndex.value = index;
|
|
@@ -5353,7 +5809,7 @@ const Menu = defineComponent({
|
|
|
5353
5809
|
const activate = () => {
|
|
5354
5810
|
const item = props.items[highlightedIndex.value];
|
|
5355
5811
|
if (!item || item.disabled || item.separator) return;
|
|
5356
|
-
emit("select", item
|
|
5812
|
+
emit("select", toRaw(menuItemValue(item)));
|
|
5357
5813
|
};
|
|
5358
5814
|
useInput({
|
|
5359
5815
|
isActive: computed(() => props.focused),
|
|
@@ -5374,9 +5830,33 @@ const Menu = defineComponent({
|
|
|
5374
5830
|
},
|
|
5375
5831
|
onSubmit: activate
|
|
5376
5832
|
});
|
|
5833
|
+
const visibleItems = computed(() => {
|
|
5834
|
+
const windowSize = viewportSize.value;
|
|
5835
|
+
const start = windowSize === void 0 ? 0 : scrollOffset.value;
|
|
5836
|
+
const end = windowSize === void 0 ? props.items.length : start + windowSize;
|
|
5837
|
+
return props.items.slice(start, end).map((item, visibleIndex) => ({
|
|
5838
|
+
item,
|
|
5839
|
+
index: start + visibleIndex
|
|
5840
|
+
}));
|
|
5841
|
+
});
|
|
5842
|
+
const scrollIndicator = computed(() => {
|
|
5843
|
+
const windowSize = viewportSize.value;
|
|
5844
|
+
if (windowSize === void 0 || props.items.length <= windowSize) return {
|
|
5845
|
+
showUp: false,
|
|
5846
|
+
showDown: false
|
|
5847
|
+
};
|
|
5848
|
+
return {
|
|
5849
|
+
showUp: scrollOffset.value > 0,
|
|
5850
|
+
showDown: scrollOffset.value + windowSize < props.items.length
|
|
5851
|
+
};
|
|
5852
|
+
});
|
|
5377
5853
|
return () => {
|
|
5378
5854
|
const children = [];
|
|
5379
|
-
|
|
5855
|
+
if (scrollIndicator.value.showUp) children.push(h("text", {
|
|
5856
|
+
key: "scroll-up",
|
|
5857
|
+
dim: true
|
|
5858
|
+
}, " ..."));
|
|
5859
|
+
visibleItems.value.forEach(({ item, index }) => {
|
|
5380
5860
|
if (item.separator) {
|
|
5381
5861
|
children.push(h("text", {
|
|
5382
5862
|
key: `sep-${index}`,
|
|
@@ -5409,6 +5889,10 @@ const Menu = defineComponent({
|
|
|
5409
5889
|
bg: isFocused ? props.focusedBg : void 0
|
|
5410
5890
|
}, itemContent));
|
|
5411
5891
|
});
|
|
5892
|
+
if (scrollIndicator.value.showDown) children.push(h("text", {
|
|
5893
|
+
key: "scroll-down",
|
|
5894
|
+
dim: true
|
|
5895
|
+
}, " ..."));
|
|
5412
5896
|
return h("box", {
|
|
5413
5897
|
border: props.border === "none" ? void 0 : props.border,
|
|
5414
5898
|
style: {
|
|
@@ -5420,10 +5904,89 @@ const Menu = defineComponent({
|
|
|
5420
5904
|
}
|
|
5421
5905
|
});
|
|
5422
5906
|
//#endregion
|
|
5907
|
+
//#region src/components/FrescoMenu.vue
|
|
5908
|
+
var FrescoMenu_default = /* @__PURE__ */ defineComponent({
|
|
5909
|
+
name: "FrescoMenu",
|
|
5910
|
+
__name: "FrescoMenu",
|
|
5911
|
+
props: {
|
|
5912
|
+
items: {
|
|
5913
|
+
type: Array,
|
|
5914
|
+
required: true
|
|
5915
|
+
},
|
|
5916
|
+
focusedIndex: {
|
|
5917
|
+
type: Number,
|
|
5918
|
+
required: false
|
|
5919
|
+
},
|
|
5920
|
+
focused: {
|
|
5921
|
+
type: Boolean,
|
|
5922
|
+
required: false
|
|
5923
|
+
},
|
|
5924
|
+
maxHeight: {
|
|
5925
|
+
type: Number,
|
|
5926
|
+
required: false
|
|
5927
|
+
},
|
|
5928
|
+
border: {
|
|
5929
|
+
type: String,
|
|
5930
|
+
required: false
|
|
5931
|
+
},
|
|
5932
|
+
width: {
|
|
5933
|
+
type: Number,
|
|
5934
|
+
required: false
|
|
5935
|
+
},
|
|
5936
|
+
fg: {
|
|
5937
|
+
type: String,
|
|
5938
|
+
required: false
|
|
5939
|
+
},
|
|
5940
|
+
focusedFg: {
|
|
5941
|
+
type: String,
|
|
5942
|
+
required: false
|
|
5943
|
+
},
|
|
5944
|
+
focusedBg: {
|
|
5945
|
+
type: String,
|
|
5946
|
+
required: false
|
|
5947
|
+
},
|
|
5948
|
+
shortcutFg: {
|
|
5949
|
+
type: String,
|
|
5950
|
+
required: false
|
|
5951
|
+
}
|
|
5952
|
+
},
|
|
5953
|
+
emits: ["select", "update:focusedIndex"],
|
|
5954
|
+
setup(__props, { emit: __emit }) {
|
|
5955
|
+
const emit = __emit;
|
|
5956
|
+
const runtimeProps = computed(() => ({
|
|
5957
|
+
items: __props.items,
|
|
5958
|
+
focusedIndex: __props.focusedIndex,
|
|
5959
|
+
focused: __props.focused,
|
|
5960
|
+
maxHeight: __props.maxHeight,
|
|
5961
|
+
border: __props.border,
|
|
5962
|
+
width: __props.width,
|
|
5963
|
+
fg: __props.fg,
|
|
5964
|
+
focusedFg: __props.focusedFg,
|
|
5965
|
+
focusedBg: __props.focusedBg,
|
|
5966
|
+
shortcutFg: __props.shortcutFg
|
|
5967
|
+
}));
|
|
5968
|
+
function selectValue(value) {
|
|
5969
|
+
emit("select", value);
|
|
5970
|
+
}
|
|
5971
|
+
function updateFocusedIndex(index) {
|
|
5972
|
+
emit("update:focusedIndex", index);
|
|
5973
|
+
}
|
|
5974
|
+
return (_ctx, _cache) => {
|
|
5975
|
+
return openBlock(), createBlock(unref(Menu), mergeProps(runtimeProps.value, {
|
|
5976
|
+
onSelect: selectValue,
|
|
5977
|
+
"onUpdate:focusedIndex": updateFocusedIndex
|
|
5978
|
+
}), null, 16);
|
|
5979
|
+
};
|
|
5980
|
+
}
|
|
5981
|
+
});
|
|
5982
|
+
//#endregion
|
|
5423
5983
|
//#region src/components/Tabs.ts
|
|
5424
5984
|
/**
|
|
5425
5985
|
* Tabs Component - Tab navigation
|
|
5426
5986
|
*/
|
|
5987
|
+
function tabValue(tab) {
|
|
5988
|
+
return Object.hasOwn(tab, "value") ? tab.value : tab.key;
|
|
5989
|
+
}
|
|
5427
5990
|
const Tabs = defineComponent({
|
|
5428
5991
|
name: "Tabs",
|
|
5429
5992
|
props: {
|
|
@@ -5431,11 +5994,18 @@ const Tabs = defineComponent({
|
|
|
5431
5994
|
type: Array,
|
|
5432
5995
|
required: true
|
|
5433
5996
|
},
|
|
5434
|
-
modelValue:
|
|
5997
|
+
modelValue: null,
|
|
5998
|
+
by: [
|
|
5999
|
+
String,
|
|
6000
|
+
Number,
|
|
6001
|
+
Symbol,
|
|
6002
|
+
Function
|
|
6003
|
+
],
|
|
5435
6004
|
focused: {
|
|
5436
6005
|
type: Boolean,
|
|
5437
6006
|
default: false
|
|
5438
6007
|
},
|
|
6008
|
+
maxItems: Number,
|
|
5439
6009
|
position: {
|
|
5440
6010
|
type: String,
|
|
5441
6011
|
default: "top"
|
|
@@ -5457,22 +6027,39 @@ const Tabs = defineComponent({
|
|
|
5457
6027
|
},
|
|
5458
6028
|
emits: ["update:modelValue", "change"],
|
|
5459
6029
|
setup(props, { slots, emit }) {
|
|
6030
|
+
const scrollOffset = ref(0);
|
|
5460
6031
|
const highlightedIndex = ref(-1);
|
|
5461
6032
|
const typeahead = createTypeaheadBuffer();
|
|
6033
|
+
const viewportSize = computed(() => {
|
|
6034
|
+
if (props.maxItems === void 0 || !Number.isFinite(props.maxItems)) return void 0;
|
|
6035
|
+
return props.maxItems > 0 ? Math.max(1, Math.floor(props.maxItems)) : void 0;
|
|
6036
|
+
});
|
|
5462
6037
|
const syncHighlight = () => {
|
|
5463
|
-
const activeIndex = props.tabs.findIndex((tab) => tab
|
|
6038
|
+
const activeIndex = props.tabs.findIndex((tab) => collectionValuesEqual(tabValue(tab), props.modelValue, props.by) && !tab.disabled);
|
|
5464
6039
|
if (activeIndex >= 0) highlightedIndex.value = activeIndex;
|
|
5465
6040
|
else if (highlightedIndex.value < 0 || highlightedIndex.value >= props.tabs.length || props.tabs[highlightedIndex.value]?.disabled) highlightedIndex.value = firstEnabledIndex(props.tabs);
|
|
5466
6041
|
};
|
|
5467
|
-
watch([
|
|
6042
|
+
watch([
|
|
6043
|
+
() => props.modelValue,
|
|
6044
|
+
() => props.by,
|
|
6045
|
+
() => props.tabs
|
|
6046
|
+
], syncHighlight, {
|
|
5468
6047
|
deep: true,
|
|
5469
6048
|
immediate: true
|
|
5470
6049
|
});
|
|
6050
|
+
watch([
|
|
6051
|
+
highlightedIndex,
|
|
6052
|
+
viewportSize,
|
|
6053
|
+
() => props.tabs.length
|
|
6054
|
+
], ([index, windowSize]) => {
|
|
6055
|
+
scrollOffset.value = visibleCollectionOffset(index, scrollOffset.value, windowSize, props.tabs.length);
|
|
6056
|
+
}, { immediate: true });
|
|
5471
6057
|
const activate = () => {
|
|
5472
6058
|
const tab = props.tabs[highlightedIndex.value];
|
|
5473
6059
|
if (!tab || tab.disabled) return;
|
|
5474
|
-
|
|
5475
|
-
emit("
|
|
6060
|
+
const value = toRaw(tabValue(tab));
|
|
6061
|
+
emit("update:modelValue", value);
|
|
6062
|
+
emit("change", value);
|
|
5476
6063
|
};
|
|
5477
6064
|
useInput({
|
|
5478
6065
|
isActive: computed(() => props.focused),
|
|
@@ -5493,14 +6080,38 @@ const Tabs = defineComponent({
|
|
|
5493
6080
|
},
|
|
5494
6081
|
onSubmit: activate
|
|
5495
6082
|
});
|
|
6083
|
+
const visibleTabs = computed(() => {
|
|
6084
|
+
const windowSize = viewportSize.value;
|
|
6085
|
+
const start = windowSize === void 0 ? 0 : scrollOffset.value;
|
|
6086
|
+
const end = windowSize === void 0 ? props.tabs.length : start + windowSize;
|
|
6087
|
+
return props.tabs.slice(start, end).map((tab, visibleIndex) => ({
|
|
6088
|
+
tab,
|
|
6089
|
+
index: start + visibleIndex
|
|
6090
|
+
}));
|
|
6091
|
+
});
|
|
6092
|
+
const scrollIndicator = computed(() => {
|
|
6093
|
+
const windowSize = viewportSize.value;
|
|
6094
|
+
if (windowSize === void 0 || props.tabs.length <= windowSize) return {
|
|
6095
|
+
showBefore: false,
|
|
6096
|
+
showAfter: false
|
|
6097
|
+
};
|
|
6098
|
+
return {
|
|
6099
|
+
showBefore: scrollOffset.value > 0,
|
|
6100
|
+
showAfter: scrollOffset.value + windowSize < props.tabs.length
|
|
6101
|
+
};
|
|
6102
|
+
});
|
|
5496
6103
|
return () => {
|
|
5497
6104
|
const tabItems = [];
|
|
5498
|
-
|
|
5499
|
-
|
|
6105
|
+
if (scrollIndicator.value.showBefore) tabItems.push(h("text", {
|
|
6106
|
+
key: "scroll-before",
|
|
6107
|
+
dim: true
|
|
6108
|
+
}, "…"));
|
|
6109
|
+
visibleTabs.value.forEach(({ tab, index }, visibleIndex) => {
|
|
6110
|
+
if (visibleIndex > 0) tabItems.push(h("text", {
|
|
5500
6111
|
key: `sep-${index}`,
|
|
5501
6112
|
dim: true
|
|
5502
6113
|
}, props.separator));
|
|
5503
|
-
const isActive = tab.
|
|
6114
|
+
const isActive = collectionValuesEqual(tabValue(tab), props.modelValue, props.by);
|
|
5504
6115
|
const isHighlighted = index === highlightedIndex.value;
|
|
5505
6116
|
tabItems.push(h("text", {
|
|
5506
6117
|
key: tab.key,
|
|
@@ -5508,9 +6119,14 @@ const Tabs = defineComponent({
|
|
|
5508
6119
|
bg: isActive || props.focused && isHighlighted ? props.activeBg : void 0,
|
|
5509
6120
|
bold: isActive,
|
|
5510
6121
|
underline: isActive && props.underline || props.focused && isHighlighted,
|
|
5511
|
-
dim: tab.disabled
|
|
6122
|
+
dim: tab.disabled,
|
|
6123
|
+
"data-tab-index": index
|
|
5512
6124
|
}, tab.label));
|
|
5513
6125
|
});
|
|
6126
|
+
if (scrollIndicator.value.showAfter) tabItems.push(h("text", {
|
|
6127
|
+
key: "scroll-after",
|
|
6128
|
+
dim: true
|
|
6129
|
+
}, "…"));
|
|
5514
6130
|
const tabBar = h("box", {
|
|
5515
6131
|
key: "tab-bar",
|
|
5516
6132
|
style: {
|
|
@@ -5531,6 +6147,93 @@ const Tabs = defineComponent({
|
|
|
5531
6147
|
}
|
|
5532
6148
|
});
|
|
5533
6149
|
//#endregion
|
|
6150
|
+
//#region src/components/FrescoTabs.vue
|
|
6151
|
+
var FrescoTabs_default = /* @__PURE__ */ defineComponent({
|
|
6152
|
+
name: "FrescoTabs",
|
|
6153
|
+
__name: "FrescoTabs",
|
|
6154
|
+
props: {
|
|
6155
|
+
tabs: {
|
|
6156
|
+
type: Array,
|
|
6157
|
+
required: true
|
|
6158
|
+
},
|
|
6159
|
+
modelValue: {
|
|
6160
|
+
type: null,
|
|
6161
|
+
required: false
|
|
6162
|
+
},
|
|
6163
|
+
by: {
|
|
6164
|
+
type: Function,
|
|
6165
|
+
required: false,
|
|
6166
|
+
skipCheck: true
|
|
6167
|
+
},
|
|
6168
|
+
focused: {
|
|
6169
|
+
type: Boolean,
|
|
6170
|
+
required: false
|
|
6171
|
+
},
|
|
6172
|
+
maxItems: {
|
|
6173
|
+
type: Number,
|
|
6174
|
+
required: false
|
|
6175
|
+
},
|
|
6176
|
+
position: {
|
|
6177
|
+
type: String,
|
|
6178
|
+
required: false
|
|
6179
|
+
},
|
|
6180
|
+
separator: {
|
|
6181
|
+
type: String,
|
|
6182
|
+
required: false
|
|
6183
|
+
},
|
|
6184
|
+
activeFg: {
|
|
6185
|
+
type: String,
|
|
6186
|
+
required: false
|
|
6187
|
+
},
|
|
6188
|
+
activeBg: {
|
|
6189
|
+
type: String,
|
|
6190
|
+
required: false
|
|
6191
|
+
},
|
|
6192
|
+
inactiveFg: {
|
|
6193
|
+
type: String,
|
|
6194
|
+
required: false
|
|
6195
|
+
},
|
|
6196
|
+
underline: {
|
|
6197
|
+
type: Boolean,
|
|
6198
|
+
required: false
|
|
6199
|
+
}
|
|
6200
|
+
},
|
|
6201
|
+
emits: ["update:modelValue", "change"],
|
|
6202
|
+
setup(__props, { emit: __emit }) {
|
|
6203
|
+
const emit = __emit;
|
|
6204
|
+
const runtimeProps = computed(() => {
|
|
6205
|
+
return {
|
|
6206
|
+
tabs: __props.tabs,
|
|
6207
|
+
modelValue: __props.modelValue,
|
|
6208
|
+
by: typeof __props.by === "function" ? (left, right) => __props.by(left, right) : __props.by,
|
|
6209
|
+
focused: __props.focused,
|
|
6210
|
+
maxItems: __props.maxItems,
|
|
6211
|
+
position: __props.position,
|
|
6212
|
+
separator: __props.separator,
|
|
6213
|
+
activeFg: __props.activeFg,
|
|
6214
|
+
activeBg: __props.activeBg,
|
|
6215
|
+
inactiveFg: __props.inactiveFg,
|
|
6216
|
+
underline: __props.underline
|
|
6217
|
+
};
|
|
6218
|
+
});
|
|
6219
|
+
function updateModelValue(value) {
|
|
6220
|
+
emit("update:modelValue", value);
|
|
6221
|
+
}
|
|
6222
|
+
function changeValue(value) {
|
|
6223
|
+
emit("change", value);
|
|
6224
|
+
}
|
|
6225
|
+
return (_ctx, _cache) => {
|
|
6226
|
+
return openBlock(), createBlock(unref(Tabs), mergeProps(runtimeProps.value, {
|
|
6227
|
+
"onUpdate:modelValue": updateModelValue,
|
|
6228
|
+
onChange: changeValue
|
|
6229
|
+
}), {
|
|
6230
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
6231
|
+
_: 3
|
|
6232
|
+
}, 16);
|
|
6233
|
+
};
|
|
6234
|
+
}
|
|
6235
|
+
});
|
|
6236
|
+
//#endregion
|
|
5534
6237
|
//#region src/components/FrescoBreadcrumb.vue?vue&type=script&setup=true&lang.ts
|
|
5535
6238
|
const _hoisted_1$2 = ["fg"];
|
|
5536
6239
|
const _hoisted_2$2 = [
|
|
@@ -5794,13 +6497,14 @@ var FrescoModal_default = /* @__PURE__ */ defineComponent({
|
|
|
5794
6497
|
watch(isVisible, (next, previous) => {
|
|
5795
6498
|
if (next && !previous) wasFocusedBeforeOpen.value = manager.activeId.value;
|
|
5796
6499
|
}, { flush: "sync" });
|
|
5797
|
-
|
|
6500
|
+
const modalFocus = useFocus({
|
|
5798
6501
|
id: __props.focusId,
|
|
5799
6502
|
isActive: isVisible,
|
|
5800
6503
|
autoFocus: true,
|
|
5801
6504
|
delegateFocusTo: computed(() => __props.initialFocusId),
|
|
5802
6505
|
trapFocus: trapsFocus
|
|
5803
|
-
})
|
|
6506
|
+
});
|
|
6507
|
+
provideFocusScope(modalFocus.id);
|
|
5804
6508
|
function focusInitialTarget() {
|
|
5805
6509
|
if (!__props.visible || !__props.initialFocusId || !manager.focusableIds.value.includes(__props.initialFocusId)) return;
|
|
5806
6510
|
manager.focus(__props.initialFocusId);
|
|
@@ -5834,7 +6538,8 @@ var FrescoModal_default = /* @__PURE__ */ defineComponent({
|
|
|
5834
6538
|
"justify-content": "center",
|
|
5835
6539
|
"align-items": "center",
|
|
5836
6540
|
width: "100%",
|
|
5837
|
-
height: "100%"
|
|
6541
|
+
height: "100%",
|
|
6542
|
+
"focus-id": unref(modalFocus).id
|
|
5838
6543
|
}, accessibilityProps.value), {
|
|
5839
6544
|
default: withCtx(() => [__props.visible ? (openBlock(), createBlock(unref(Box), {
|
|
5840
6545
|
key: 0,
|
|
@@ -5870,7 +6575,195 @@ var FrescoModal_default = /* @__PURE__ */ defineComponent({
|
|
|
5870
6575
|
"bg"
|
|
5871
6576
|
])) : createCommentVNode("v-if", true)]),
|
|
5872
6577
|
_: 3
|
|
5873
|
-
}, 16, ["display"]);
|
|
6578
|
+
}, 16, ["display", "focus-id"]);
|
|
6579
|
+
};
|
|
6580
|
+
}
|
|
6581
|
+
});
|
|
6582
|
+
//#endregion
|
|
6583
|
+
//#region src/components/FrescoPopover.vue
|
|
6584
|
+
var FrescoPopover_default = /* @__PURE__ */ defineComponent({
|
|
6585
|
+
name: "FrescoPopover",
|
|
6586
|
+
__name: "FrescoPopover",
|
|
6587
|
+
props: {
|
|
6588
|
+
open: {
|
|
6589
|
+
type: Boolean,
|
|
6590
|
+
required: false,
|
|
6591
|
+
default: false
|
|
6592
|
+
},
|
|
6593
|
+
placement: {
|
|
6594
|
+
type: String,
|
|
6595
|
+
required: false,
|
|
6596
|
+
default: "bottom"
|
|
6597
|
+
},
|
|
6598
|
+
offset: {
|
|
6599
|
+
type: Number,
|
|
6600
|
+
required: false,
|
|
6601
|
+
default: 0
|
|
6602
|
+
},
|
|
6603
|
+
width: {
|
|
6604
|
+
type: [Number, String],
|
|
6605
|
+
required: false
|
|
6606
|
+
},
|
|
6607
|
+
height: {
|
|
6608
|
+
type: [Number, String],
|
|
6609
|
+
required: false
|
|
6610
|
+
},
|
|
6611
|
+
border: {
|
|
6612
|
+
type: String,
|
|
6613
|
+
required: false,
|
|
6614
|
+
default: "rounded"
|
|
6615
|
+
},
|
|
6616
|
+
fg: {
|
|
6617
|
+
type: String,
|
|
6618
|
+
required: false
|
|
6619
|
+
},
|
|
6620
|
+
bg: {
|
|
6621
|
+
type: String,
|
|
6622
|
+
required: false
|
|
6623
|
+
},
|
|
6624
|
+
focusId: {
|
|
6625
|
+
type: String,
|
|
6626
|
+
required: false,
|
|
6627
|
+
default: `popover-${Math.random().toString(36).slice(2)}`
|
|
6628
|
+
},
|
|
6629
|
+
initialFocusId: {
|
|
6630
|
+
type: String,
|
|
6631
|
+
required: false
|
|
6632
|
+
},
|
|
6633
|
+
trapFocus: {
|
|
6634
|
+
type: Boolean,
|
|
6635
|
+
required: false,
|
|
6636
|
+
default: true
|
|
6637
|
+
},
|
|
6638
|
+
restoreFocus: {
|
|
6639
|
+
type: Boolean,
|
|
6640
|
+
required: false,
|
|
6641
|
+
default: true
|
|
6642
|
+
},
|
|
6643
|
+
closeOnEscape: {
|
|
6644
|
+
type: Boolean,
|
|
6645
|
+
required: false,
|
|
6646
|
+
default: true
|
|
6647
|
+
},
|
|
6648
|
+
accessibilityRole: {
|
|
6649
|
+
type: String,
|
|
6650
|
+
required: false,
|
|
6651
|
+
default: "dialog"
|
|
6652
|
+
},
|
|
6653
|
+
accessibilityLabel: {
|
|
6654
|
+
type: String,
|
|
6655
|
+
required: false,
|
|
6656
|
+
default: "Popover"
|
|
6657
|
+
}
|
|
6658
|
+
},
|
|
6659
|
+
emits: ["close"],
|
|
6660
|
+
setup(__props, { emit: __emit }) {
|
|
6661
|
+
const emit = __emit;
|
|
6662
|
+
const manager = useFocusManager();
|
|
6663
|
+
const wasFocusedBeforeOpen = ref();
|
|
6664
|
+
const isOpen = computed(() => __props.open);
|
|
6665
|
+
const trapsFocus = computed(() => __props.open && __props.trapFocus);
|
|
6666
|
+
if (__props.open) wasFocusedBeforeOpen.value = manager.activeId.value;
|
|
6667
|
+
watch(isOpen, (next, previous) => {
|
|
6668
|
+
if (next && !previous) wasFocusedBeforeOpen.value = manager.activeId.value;
|
|
6669
|
+
}, { flush: "sync" });
|
|
6670
|
+
const popoverFocus = useFocus({
|
|
6671
|
+
id: __props.focusId,
|
|
6672
|
+
isActive: isOpen,
|
|
6673
|
+
autoFocus: true,
|
|
6674
|
+
delegateFocusTo: computed(() => __props.initialFocusId),
|
|
6675
|
+
trapFocus: trapsFocus
|
|
6676
|
+
});
|
|
6677
|
+
provideFocusScope(popoverFocus.id);
|
|
6678
|
+
function focusInitialTarget() {
|
|
6679
|
+
if (!__props.open || !__props.initialFocusId || !manager.focusableIds.value.includes(__props.initialFocusId)) return;
|
|
6680
|
+
manager.focus(__props.initialFocusId);
|
|
6681
|
+
}
|
|
6682
|
+
watch([isOpen, manager.focusableIds], () => {
|
|
6683
|
+
nextTick(focusInitialTarget);
|
|
6684
|
+
}, {
|
|
6685
|
+
deep: true,
|
|
6686
|
+
flush: "post"
|
|
6687
|
+
});
|
|
6688
|
+
watch(isOpen, (next, previous) => {
|
|
6689
|
+
if (next || !previous || !__props.restoreFocus) return;
|
|
6690
|
+
const target = wasFocusedBeforeOpen.value;
|
|
6691
|
+
if (target && manager.focusableIds.value.includes(target)) manager.focus(target);
|
|
6692
|
+
wasFocusedBeforeOpen.value = void 0;
|
|
6693
|
+
}, { flush: "post" });
|
|
6694
|
+
onMounted(() => void nextTick(focusInitialTarget));
|
|
6695
|
+
useInput({
|
|
6696
|
+
isActive: computed(() => __props.open && __props.closeOnEscape),
|
|
6697
|
+
onEscape: () => emit("close")
|
|
6698
|
+
});
|
|
6699
|
+
function panelPosition(selected) {
|
|
6700
|
+
const gap = Number.isFinite(__props.offset) ? Math.max(0, __props.offset) : 0;
|
|
6701
|
+
switch (selected) {
|
|
6702
|
+
case "top": return {
|
|
6703
|
+
bottom: "100%",
|
|
6704
|
+
marginBottom: gap
|
|
6705
|
+
};
|
|
6706
|
+
case "right": return {
|
|
6707
|
+
left: "100%",
|
|
6708
|
+
marginLeft: gap
|
|
6709
|
+
};
|
|
6710
|
+
case "left": return {
|
|
6711
|
+
right: "100%",
|
|
6712
|
+
marginRight: gap
|
|
6713
|
+
};
|
|
6714
|
+
default: return {
|
|
6715
|
+
top: "100%",
|
|
6716
|
+
marginTop: gap
|
|
6717
|
+
};
|
|
6718
|
+
}
|
|
6719
|
+
}
|
|
6720
|
+
const position = computed(() => panelPosition(__props.placement));
|
|
6721
|
+
const accessibilityProps = computed(() => ({
|
|
6722
|
+
ariaRole: __props.accessibilityRole,
|
|
6723
|
+
ariaLabel: __props.accessibilityLabel,
|
|
6724
|
+
ariaState: { expanded: __props.open }
|
|
6725
|
+
}));
|
|
6726
|
+
return (_ctx, _cache) => {
|
|
6727
|
+
return openBlock(), createBlock(unref(Box), { position: "relative" }, {
|
|
6728
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "anchor"), __props.open ? (openBlock(), createBlock(unref(Box), mergeProps({
|
|
6729
|
+
key: 0,
|
|
6730
|
+
position: "absolute",
|
|
6731
|
+
top: position.value.top,
|
|
6732
|
+
right: position.value.right,
|
|
6733
|
+
bottom: position.value.bottom,
|
|
6734
|
+
left: position.value.left,
|
|
6735
|
+
"margin-top": position.value.marginTop,
|
|
6736
|
+
"margin-right": position.value.marginRight,
|
|
6737
|
+
"margin-bottom": position.value.marginBottom,
|
|
6738
|
+
"margin-left": position.value.marginLeft,
|
|
6739
|
+
width: __props.width,
|
|
6740
|
+
height: __props.height,
|
|
6741
|
+
border: __props.border === "none" ? void 0 : __props.border,
|
|
6742
|
+
fg: __props.fg,
|
|
6743
|
+
bg: __props.bg,
|
|
6744
|
+
padding: 1,
|
|
6745
|
+
"focus-id": unref(popoverFocus).id
|
|
6746
|
+
}, accessibilityProps.value), {
|
|
6747
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
6748
|
+
_: 3
|
|
6749
|
+
}, 16, [
|
|
6750
|
+
"top",
|
|
6751
|
+
"right",
|
|
6752
|
+
"bottom",
|
|
6753
|
+
"left",
|
|
6754
|
+
"margin-top",
|
|
6755
|
+
"margin-right",
|
|
6756
|
+
"margin-bottom",
|
|
6757
|
+
"margin-left",
|
|
6758
|
+
"width",
|
|
6759
|
+
"height",
|
|
6760
|
+
"border",
|
|
6761
|
+
"fg",
|
|
6762
|
+
"bg",
|
|
6763
|
+
"focus-id"
|
|
6764
|
+
])) : createCommentVNode("v-if", true)]),
|
|
6765
|
+
_: 3
|
|
6766
|
+
});
|
|
5874
6767
|
};
|
|
5875
6768
|
}
|
|
5876
6769
|
});
|
|
@@ -6160,6 +7053,6 @@ var FrescoAvatar_default = /* @__PURE__ */ defineComponent({
|
|
|
6160
7053
|
}
|
|
6161
7054
|
});
|
|
6162
7055
|
//#endregion
|
|
6163
|
-
export {
|
|
7056
|
+
export { FrescoFrameBuffer_default as A, FrescoNewline_default as B, RadioGroup as C, TextInput as D, TextArea as E, Code as F, Grid as G, ScrollBar_default as H, createCodeBuffer as I, FrescoStack_default as J, FrescoVStack_default as K, LineNumber as L, defaultMarkdownRenderer as M, parseMarkdown as N, FrescoLink_default as O, renderMarkdown as P, FrescoTransform_default as R, Confirm as S, FrescoSelect_default as T, Text as U, ScrollBox_default as V, FrescoCard_default as W, FrescoSpacer_default as X, FrescoDivider_default as Y, Box as Z, FrescoAlert_default as _, FrescoPopover_default as a, Form as b, FrescoBreadcrumb_default as c, FrescoTree_default as d, Table as f, FrescoBadge_default as g, Timer as h, StatusBar as i, FrescoMarkdown_default as j, Diff as k, FrescoTabs_default as l, FrescoTooltip_default as m, KeyHint as n, FrescoModal_default as o, FrescoList_default as p, FrescoHStack_default as q, FrescoHeader_default as r, Stepper as s, FrescoAvatar_default as t, FrescoMenu_default as u, ProgressBar as v, Checkbox as w, FrescoSlider_default as x, FrescoSpinner_default as y, FrescoStatic_default as z };
|
|
6164
7057
|
|
|
6165
|
-
//# sourceMappingURL=components-
|
|
7058
|
+
//# sourceMappingURL=components-B-HgL5id.mjs.map
|