@sdata/web-vue 2.3.1 → 2.8.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/README.md +1 -1
- package/dist/sd.css +133 -187
- package/dist/sd.min.css +1 -1
- package/es/_hooks/use-responsive.d.ts +2 -2
- package/es/_hooks/use-theme-mode.d.ts +3 -0
- package/es/{calendar/hooks/use-calendar-theme.js → _hooks/use-theme-mode.js} +14 -10
- package/es/_utils/responsive-observe.d.ts +5 -4
- package/es/_utils/responsive-observe.js +2 -1
- package/es/alert/index.d.ts +3 -3
- package/es/anchor/index.d.ts +3 -3
- package/es/avatar/index.d.ts +20 -20
- package/es/border-beam/border-beam.js +5 -0
- package/es/border-beam/border-beam.vue.d.ts +52 -0
- package/es/border-beam/border-beam.vue_vue_type_script_setup_true_lang.js +623 -0
- package/es/border-beam/index.d.ts +106 -0
- package/es/border-beam/index.js +10 -0
- package/es/border-beam/pulseDriver.d.ts +2 -0
- package/es/border-beam/pulseDriver.js +74 -0
- package/es/border-beam/style/css.js +2 -0
- package/es/border-beam/style/index.css +21 -0
- package/es/border-beam/style/index.d.ts +2 -0
- package/es/border-beam/style/index.js +2 -0
- package/es/border-beam/style/index.scss +12 -0
- package/es/border-beam/style/token.scss +12 -0
- package/es/border-beam/styles.d.ts +42 -0
- package/es/border-beam/styles.js +3545 -0
- package/es/border-beam/types.d.ts +27 -0
- package/es/button/index.d.ts +24 -24
- package/es/calendar/components/index.vue.d.ts +1 -1
- package/es/calendar/components/index.vue_vue_type_script_setup_true_lang.js +3 -2
- package/es/calendar/index.d.ts +5 -5
- package/es/carousel/index.d.ts +3 -3
- package/es/checkbox/checkbox.d.ts +3 -3
- package/es/collapse/collapse-item.d.ts +5 -5
- package/es/collapse/index.d.ts +3 -3
- package/es/components.d.ts +1 -0
- package/es/config-provider/index.d.ts +21 -21
- package/es/date-picker/index.d.ts +14 -14
- package/es/date-picker/picker.vue.d.ts +2 -2
- package/es/date-picker/range-picker.vue.d.ts +2 -2
- package/es/descriptions/index.d.ts +24 -24
- package/es/drawer/index.d.ts +16 -15
- package/es/dropdown/index.d.ts +15 -15
- package/es/form/form-item.vue_vue_type_script_setup_true_lang.js +3 -3
- package/es/form/index.d.ts +3 -3
- package/es/grid/grid-col.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/grid/grid.vue_vue_type_script_setup_true_lang.js +10 -10
- package/es/icon/icon-menu/icon-menu.js +5 -0
- package/es/icon/icon-menu/icon-menu.vue_vue_type_script_setup_true_lang.js +52 -0
- package/es/icon/icon-menu/index.js +9 -0
- package/es/index.css +133 -187
- package/es/index.d.ts +4 -2
- package/es/index.js +3 -2
- package/es/index.scss +1 -0
- package/es/input/index.d.ts +7 -7
- package/es/json-form/index.d.ts +9 -9
- package/es/json-form/json-form-item.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/json-form/json-form.vue.d.ts +3 -3
- package/es/layout/content.vue.d.ts +2 -2
- package/es/layout/content.vue_vue_type_script_setup_true_lang.js +8 -3
- package/es/layout/context.d.ts +12 -9
- package/es/layout/context.js +11 -3
- package/es/layout/footer.vue.d.ts +2 -2
- package/es/layout/footer.vue_vue_type_script_setup_true_lang.js +8 -3
- package/es/layout/header.vue.d.ts +3 -30
- package/es/layout/header.vue_vue_type_script_setup_true_lang.js +9 -339
- package/es/layout/hooks/use-has-sider.d.ts +2 -0
- package/es/layout/hooks/use-has-sider.js +38 -0
- package/es/layout/index.d.ts +120 -371
- package/es/layout/index.js +2 -2
- package/es/layout/interface.d.ts +16 -46
- package/es/layout/layout.vue.d.ts +4 -2
- package/es/layout/layout.vue_vue_type_script_setup_true_lang.js +38 -14
- package/es/layout/sider.vue.d.ts +68 -178
- package/es/layout/sider.vue_vue_type_script_setup_true_lang.js +243 -363
- package/es/layout/style/index.css +128 -186
- package/es/layout/style/index.scss +146 -234
- package/es/layout/style/token.scss +46 -26
- package/es/link/index.d.ts +6 -6
- package/es/list/index.d.ts +18 -18
- package/es/menu/base-menu.vue.d.ts +1 -1
- package/es/menu/base-menu.vue_vue_type_script_setup_true_lang.js +14 -14
- package/es/menu/item.d.ts +1 -1
- package/es/menu/menu.d.ts +12 -12
- package/es/menu/menu.js +3 -3
- package/es/modal/index.d.ts +15 -15
- package/es/popconfirm/index.d.ts +12 -12
- package/es/popover/index.d.ts +12 -12
- package/es/progress/index.d.ts +6 -6
- package/es/qr-code/index.d.ts +3 -3
- package/es/radio/radio.d.ts +3 -3
- package/es/resize-box/resize-box.vue_vue_type_script_setup_true_lang.js +7 -7
- package/es/result/index.d.ts +3 -3
- package/es/scrollbar/style/index.css +1 -1
- package/es/scrollbar/style/index.scss +4 -1
- package/es/sd-vue.js +3 -1
- package/es/select/select.d.ts +17 -17
- package/es/slider/index.d.ts +3 -3
- package/es/split/split.vue_vue_type_script_setup_true_lang.js +6 -6
- package/es/steps/index.d.ts +6 -6
- package/es/tabs/index.d.ts +6 -6
- package/es/tag/index.d.ts +6 -6
- package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/theme-provider/index.d.ts +9 -9
- package/es/time-picker/index.d.ts +6 -6
- package/es/timeline/index.d.ts +3 -3
- package/es/timeline/timeline.d.ts +1 -1
- package/es/tooltip/index.d.ts +3 -3
- package/es/tour/index.d.ts +3 -3
- package/es/tour/tour.vue_vue_type_script_setup_true_lang.js +6 -6
- package/es/tree/node-switcher.vue.d.ts +1 -1
- package/es/tree/tree.vue_vue_type_script_setup_true_lang.js +23 -23
- package/json/vetur-attributes.json +27 -153
- package/json/vetur-tags.json +13 -43
- package/json/web-types.json +43 -293
- package/package.json +10 -10
- package/es/calendar/hooks/use-calendar-theme.d.ts +0 -4
- package/es/layout/utils.d.ts +0 -1
- package/es/layout/utils.js +0 -11
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.133.0/helpers/esm/objectSpread2.js";
|
|
2
|
+
import { getPrefixCls } from "../_utils/global-config.js";
|
|
3
|
+
import { registerPulseInstance } from "./pulseDriver.js";
|
|
4
|
+
import { generateBeamCSS, getPulseDriverConfig, sizePresets, sizeThemePresets } from "./styles.js";
|
|
5
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderSlot, shallowRef, watch, withModifiers } from "vue";
|
|
6
|
+
//#region components/border-beam/border-beam.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var _hoisted_1 = [
|
|
8
|
+
"data-active",
|
|
9
|
+
"data-fading",
|
|
10
|
+
"data-flowing",
|
|
11
|
+
"data-paused"
|
|
12
|
+
];
|
|
13
|
+
var _hoisted_2 = ["viewBox"];
|
|
14
|
+
var _hoisted_3 = ["id"];
|
|
15
|
+
var _hoisted_4 = ["seed"];
|
|
16
|
+
var _hoisted_5 = ["scale"];
|
|
17
|
+
var _hoisted_6 = [
|
|
18
|
+
"id",
|
|
19
|
+
"cx",
|
|
20
|
+
"cy",
|
|
21
|
+
"r"
|
|
22
|
+
];
|
|
23
|
+
var _hoisted_7 = ["stop-color"];
|
|
24
|
+
var _hoisted_8 = ["stop-color"];
|
|
25
|
+
var _hoisted_9 = ["stop-color"];
|
|
26
|
+
var _hoisted_10 = ["stop-color"];
|
|
27
|
+
var _hoisted_11 = ["stop-color"];
|
|
28
|
+
var _hoisted_12 = [
|
|
29
|
+
"id",
|
|
30
|
+
"x",
|
|
31
|
+
"y",
|
|
32
|
+
"width",
|
|
33
|
+
"height"
|
|
34
|
+
];
|
|
35
|
+
var _hoisted_13 = ["filter"];
|
|
36
|
+
var _hoisted_14 = [
|
|
37
|
+
"cx",
|
|
38
|
+
"cy",
|
|
39
|
+
"r"
|
|
40
|
+
];
|
|
41
|
+
var _hoisted_15 = [
|
|
42
|
+
"cx",
|
|
43
|
+
"cy",
|
|
44
|
+
"r"
|
|
45
|
+
];
|
|
46
|
+
var _hoisted_16 = [
|
|
47
|
+
"cx",
|
|
48
|
+
"cy",
|
|
49
|
+
"r"
|
|
50
|
+
];
|
|
51
|
+
var _hoisted_17 = [
|
|
52
|
+
"width",
|
|
53
|
+
"height",
|
|
54
|
+
"rx",
|
|
55
|
+
"fill",
|
|
56
|
+
"mask"
|
|
57
|
+
];
|
|
58
|
+
var _hoisted_18 = ["filter"];
|
|
59
|
+
var _hoisted_19 = [
|
|
60
|
+
"cx",
|
|
61
|
+
"cy",
|
|
62
|
+
"r",
|
|
63
|
+
"stroke",
|
|
64
|
+
"stroke-width"
|
|
65
|
+
];
|
|
66
|
+
var _hoisted_20 = [
|
|
67
|
+
"cx",
|
|
68
|
+
"cy",
|
|
69
|
+
"r",
|
|
70
|
+
"stroke",
|
|
71
|
+
"stroke-width"
|
|
72
|
+
];
|
|
73
|
+
var _hoisted_21 = [
|
|
74
|
+
"cx",
|
|
75
|
+
"cy",
|
|
76
|
+
"r",
|
|
77
|
+
"fill"
|
|
78
|
+
];
|
|
79
|
+
var instanceCounter = 0;
|
|
80
|
+
var border_beam_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, { name: "BorderBeam" }), {}, {
|
|
81
|
+
__name: "border-beam",
|
|
82
|
+
props: {
|
|
83
|
+
size: { default: "md" },
|
|
84
|
+
colorVariant: { default: "colorful" },
|
|
85
|
+
theme: { default: "dark" },
|
|
86
|
+
staticColors: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false
|
|
89
|
+
},
|
|
90
|
+
duration: {},
|
|
91
|
+
active: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
default: true
|
|
94
|
+
},
|
|
95
|
+
borderRadius: {},
|
|
96
|
+
brightness: {},
|
|
97
|
+
saturation: {},
|
|
98
|
+
hueRange: { default: 30 },
|
|
99
|
+
strength: { default: 1 },
|
|
100
|
+
density: { default: 1 }
|
|
101
|
+
},
|
|
102
|
+
emits: ["activate", "deactivate"],
|
|
103
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
104
|
+
const props = __props;
|
|
105
|
+
const emit = __emit;
|
|
106
|
+
const id = `bb-${++instanceCounter}`;
|
|
107
|
+
const prefixCls = getPrefixCls("border-beam");
|
|
108
|
+
const cls = computed(() => [prefixCls]);
|
|
109
|
+
const systemTheme = ref("dark");
|
|
110
|
+
function updateSystemTheme() {
|
|
111
|
+
if (typeof window === "undefined") return;
|
|
112
|
+
systemTheme.value = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
113
|
+
}
|
|
114
|
+
let mediaQueryCleanup = null;
|
|
115
|
+
onMounted(() => {
|
|
116
|
+
updateSystemTheme();
|
|
117
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
118
|
+
const handler = (e) => {
|
|
119
|
+
systemTheme.value = e.matches ? "dark" : "light";
|
|
120
|
+
};
|
|
121
|
+
mq.addEventListener("change", handler);
|
|
122
|
+
mediaQueryCleanup = () => mq.removeEventListener("change", handler);
|
|
123
|
+
});
|
|
124
|
+
onUnmounted(() => {
|
|
125
|
+
mediaQueryCleanup === null || mediaQueryCleanup === void 0 || mediaQueryCleanup();
|
|
126
|
+
});
|
|
127
|
+
function resolveTheme(theme, sysTheme) {
|
|
128
|
+
return theme === "auto" ? sysTheme : theme;
|
|
129
|
+
}
|
|
130
|
+
const wrapperRef = ref(null);
|
|
131
|
+
const isActive = ref(props.active);
|
|
132
|
+
const isFading = ref(false);
|
|
133
|
+
const isVisible = ref(true);
|
|
134
|
+
const detectedRadius = ref(null);
|
|
135
|
+
const pulseGlowScale = ref({
|
|
136
|
+
x: 1,
|
|
137
|
+
y: 1
|
|
138
|
+
});
|
|
139
|
+
const isFlowing = shallowRef(false);
|
|
140
|
+
const flowKey = shallowRef(0);
|
|
141
|
+
const flowPoint = shallowRef({
|
|
142
|
+
x: 0,
|
|
143
|
+
y: 0
|
|
144
|
+
});
|
|
145
|
+
const flowRadius = shallowRef(0);
|
|
146
|
+
const flowBox = shallowRef({
|
|
147
|
+
width: 1,
|
|
148
|
+
height: 1
|
|
149
|
+
});
|
|
150
|
+
const flowSeed = shallowRef(1);
|
|
151
|
+
let flowTimer = null;
|
|
152
|
+
function clearFlowTimer() {
|
|
153
|
+
if (!flowTimer) return;
|
|
154
|
+
window.clearTimeout(flowTimer);
|
|
155
|
+
flowTimer = null;
|
|
156
|
+
}
|
|
157
|
+
function finishFlow() {
|
|
158
|
+
clearFlowTimer();
|
|
159
|
+
isFlowing.value = false;
|
|
160
|
+
}
|
|
161
|
+
function resolveFlowPoint(coordinate, rect) {
|
|
162
|
+
const value = coordinate !== null && coordinate !== void 0 ? coordinate : "top-right";
|
|
163
|
+
if (typeof value !== "string") return {
|
|
164
|
+
x: value.x,
|
|
165
|
+
y: value.y
|
|
166
|
+
};
|
|
167
|
+
switch (value) {
|
|
168
|
+
case "top-left": return {
|
|
169
|
+
x: 0,
|
|
170
|
+
y: 0
|
|
171
|
+
};
|
|
172
|
+
case "bottom-left": return {
|
|
173
|
+
x: 0,
|
|
174
|
+
y: rect.height
|
|
175
|
+
};
|
|
176
|
+
case "bottom-right": return {
|
|
177
|
+
x: rect.width,
|
|
178
|
+
y: rect.height
|
|
179
|
+
};
|
|
180
|
+
case "center": return {
|
|
181
|
+
x: rect.width / 2,
|
|
182
|
+
y: rect.height / 2
|
|
183
|
+
};
|
|
184
|
+
default: return {
|
|
185
|
+
x: rect.width,
|
|
186
|
+
y: 0
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function getFlowRadius(point, rect) {
|
|
191
|
+
return Math.max(Math.hypot(point.x, point.y), Math.hypot(rect.width - point.x, point.y), Math.hypot(point.x, rect.height - point.y), Math.hypot(rect.width - point.x, rect.height - point.y)) + 48;
|
|
192
|
+
}
|
|
193
|
+
function getFlowSeed(point) {
|
|
194
|
+
return Math.max(1, Math.round((point.x * 3 + point.y * 5 + flowKey.value * 17) % 997));
|
|
195
|
+
}
|
|
196
|
+
const flowDisplacement = computed(() => Math.max(8, Math.min(24, flowRadius.value * .07)));
|
|
197
|
+
const flowColors = computed(() => {
|
|
198
|
+
const isDark = resolvedTheme.value === "dark";
|
|
199
|
+
const variants = {
|
|
200
|
+
colorful: isDark ? {
|
|
201
|
+
accent: "#65d8ff",
|
|
202
|
+
edge: "#b060ff"
|
|
203
|
+
} : {
|
|
204
|
+
accent: "#2785ff",
|
|
205
|
+
edge: "#8d50d8"
|
|
206
|
+
},
|
|
207
|
+
mono: isDark ? {
|
|
208
|
+
accent: "#f4f4f0",
|
|
209
|
+
edge: "#b7bbb8"
|
|
210
|
+
} : {
|
|
211
|
+
accent: "#4b5250",
|
|
212
|
+
edge: "#8a908d"
|
|
213
|
+
},
|
|
214
|
+
ocean: isDark ? {
|
|
215
|
+
accent: "#68c8ff",
|
|
216
|
+
edge: "#7a77ff"
|
|
217
|
+
} : {
|
|
218
|
+
accent: "#2c76d8",
|
|
219
|
+
edge: "#6356c8"
|
|
220
|
+
},
|
|
221
|
+
sunset: isDark ? {
|
|
222
|
+
accent: "#ffb25f",
|
|
223
|
+
edge: "#ff646f"
|
|
224
|
+
} : {
|
|
225
|
+
accent: "#dd6b22",
|
|
226
|
+
edge: "#c84450"
|
|
227
|
+
}
|
|
228
|
+
}[props.colorVariant];
|
|
229
|
+
return _objectSpread2({
|
|
230
|
+
core: isDark ? "#f8fdff" : "#ffffff",
|
|
231
|
+
mist: isDark ? "#b9f2ff" : "#e9fbff",
|
|
232
|
+
specular: isDark ? "rgba(255, 255, 255, 0.5)" : "rgba(255, 255, 255, 0.38)",
|
|
233
|
+
front: variants.accent
|
|
234
|
+
}, variants);
|
|
235
|
+
});
|
|
236
|
+
function shouldReduceMotion() {
|
|
237
|
+
var _window$matchMedia, _window;
|
|
238
|
+
return typeof window !== "undefined" && ((_window$matchMedia = (_window = window).matchMedia) === null || _window$matchMedia === void 0 ? void 0 : _window$matchMedia.call(_window, "(prefers-reduced-motion: reduce)").matches);
|
|
239
|
+
}
|
|
240
|
+
function flowFrom(coordinate) {
|
|
241
|
+
const el = wrapperRef.value;
|
|
242
|
+
if (!el) return;
|
|
243
|
+
const rect = el.getBoundingClientRect();
|
|
244
|
+
const point = resolveFlowPoint(coordinate, rect);
|
|
245
|
+
flowKey.value += 1;
|
|
246
|
+
flowBox.value = {
|
|
247
|
+
width: Math.max(1, rect.width),
|
|
248
|
+
height: Math.max(1, rect.height)
|
|
249
|
+
};
|
|
250
|
+
flowPoint.value = point;
|
|
251
|
+
flowRadius.value = getFlowRadius(point, rect);
|
|
252
|
+
flowSeed.value = getFlowSeed(point);
|
|
253
|
+
isActive.value = true;
|
|
254
|
+
isFading.value = false;
|
|
255
|
+
if (shouldReduceMotion()) {
|
|
256
|
+
finishFlow();
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
clearFlowTimer();
|
|
260
|
+
isFlowing.value = true;
|
|
261
|
+
flowTimer = window.setTimeout(finishFlow, 760);
|
|
262
|
+
}
|
|
263
|
+
function handleFlowAnimationEnd() {
|
|
264
|
+
finishFlow();
|
|
265
|
+
}
|
|
266
|
+
__expose({ flowFrom });
|
|
267
|
+
let mutationObserver = null;
|
|
268
|
+
onMounted(() => {
|
|
269
|
+
const detect = () => {
|
|
270
|
+
if (props.borderRadius != null) return;
|
|
271
|
+
const el = wrapperRef.value;
|
|
272
|
+
if (!el) return;
|
|
273
|
+
const child = el.firstElementChild;
|
|
274
|
+
if (!child) return;
|
|
275
|
+
const computed = getComputedStyle(child);
|
|
276
|
+
const raw = parseFloat(computed.borderTopLeftRadius);
|
|
277
|
+
if (!isNaN(raw) && raw > 0) detectedRadius.value = raw;
|
|
278
|
+
};
|
|
279
|
+
nextTick(() => {
|
|
280
|
+
detect();
|
|
281
|
+
const el = wrapperRef.value;
|
|
282
|
+
if (!el) return;
|
|
283
|
+
mutationObserver = new MutationObserver(detect);
|
|
284
|
+
mutationObserver.observe(el, {
|
|
285
|
+
childList: true,
|
|
286
|
+
subtree: false
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
onUnmounted(() => {
|
|
291
|
+
clearFlowTimer();
|
|
292
|
+
mutationObserver === null || mutationObserver === void 0 || mutationObserver.disconnect();
|
|
293
|
+
});
|
|
294
|
+
watch(() => props.active, (active) => {
|
|
295
|
+
if (active && !isActive.value && !isFading.value) isActive.value = true;
|
|
296
|
+
else if (!active && isActive.value && !isFading.value) isFading.value = true;
|
|
297
|
+
});
|
|
298
|
+
let intersectionCleanup = null;
|
|
299
|
+
onMounted(() => {
|
|
300
|
+
const el = wrapperRef.value;
|
|
301
|
+
if (!el || typeof IntersectionObserver === "undefined") return;
|
|
302
|
+
const observer = new IntersectionObserver((entries) => {
|
|
303
|
+
for (const entry of entries) isVisible.value = entry.isIntersecting;
|
|
304
|
+
}, { rootMargin: "256px" });
|
|
305
|
+
observer.observe(el);
|
|
306
|
+
intersectionCleanup = () => observer.disconnect();
|
|
307
|
+
});
|
|
308
|
+
onUnmounted(() => {
|
|
309
|
+
intersectionCleanup === null || intersectionCleanup === void 0 || intersectionCleanup();
|
|
310
|
+
});
|
|
311
|
+
let resizeObserverCleanup = null;
|
|
312
|
+
function setupPulseGlowScale() {
|
|
313
|
+
resizeObserverCleanup === null || resizeObserverCleanup === void 0 || resizeObserverCleanup();
|
|
314
|
+
resizeObserverCleanup = null;
|
|
315
|
+
if (props.size !== "pulse-outside") {
|
|
316
|
+
pulseGlowScale.value = {
|
|
317
|
+
x: 1,
|
|
318
|
+
y: 1
|
|
319
|
+
};
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const el = wrapperRef.value;
|
|
323
|
+
if (!el) return;
|
|
324
|
+
const REF_WIDTH = 350;
|
|
325
|
+
const REF_HEIGHT = 140;
|
|
326
|
+
const MIN_SCALE = .35;
|
|
327
|
+
const MAX_SCALE = 4;
|
|
328
|
+
const clamp = (value) => Math.max(MIN_SCALE, Math.min(MAX_SCALE, value));
|
|
329
|
+
const measure = () => {
|
|
330
|
+
const child = el.firstElementChild;
|
|
331
|
+
if (!child) return;
|
|
332
|
+
const rect = child.getBoundingClientRect();
|
|
333
|
+
if (!rect.width || !rect.height) return;
|
|
334
|
+
const x = +clamp(rect.width / REF_WIDTH).toFixed(3);
|
|
335
|
+
const y = +clamp(rect.height / REF_HEIGHT).toFixed(3);
|
|
336
|
+
if (pulseGlowScale.value.x !== x || pulseGlowScale.value.y !== y) pulseGlowScale.value = {
|
|
337
|
+
x,
|
|
338
|
+
y
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
nextTick(() => {
|
|
342
|
+
measure();
|
|
343
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
344
|
+
const child = el.firstElementChild;
|
|
345
|
+
if (!child) return;
|
|
346
|
+
const ro = new ResizeObserver(measure);
|
|
347
|
+
ro.observe(child);
|
|
348
|
+
resizeObserverCleanup = () => ro.disconnect();
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
watch(() => props.size, () => setupPulseGlowScale());
|
|
352
|
+
onMounted(() => setupPulseGlowScale());
|
|
353
|
+
onUnmounted(() => resizeObserverCleanup === null || resizeObserverCleanup === void 0 ? void 0 : resizeObserverCleanup());
|
|
354
|
+
function handleAnimationEnd(e) {
|
|
355
|
+
const animationName = e.animationName || "";
|
|
356
|
+
if (animationName.includes("fade-out")) {
|
|
357
|
+
isActive.value = false;
|
|
358
|
+
isFading.value = false;
|
|
359
|
+
emit("deactivate");
|
|
360
|
+
} else if (animationName.includes("fade-in")) emit("activate");
|
|
361
|
+
}
|
|
362
|
+
const resolvedTheme = computed(() => resolveTheme(props.theme, systemTheme.value));
|
|
363
|
+
const themeConfig = computed(() => sizeThemePresets[props.size][resolvedTheme.value]);
|
|
364
|
+
const sizeConfig = computed(() => sizePresets[props.size]);
|
|
365
|
+
const isPulse = computed(() => props.size === "pulse-inner" || props.size === "pulse-outside");
|
|
366
|
+
const finalBorderRadius = computed(() => {
|
|
367
|
+
var _ref, _props$borderRadius;
|
|
368
|
+
return (_ref = (_props$borderRadius = props.borderRadius) !== null && _props$borderRadius !== void 0 ? _props$borderRadius : detectedRadius.value) !== null && _ref !== void 0 ? _ref : sizeConfig.value.borderRadius;
|
|
369
|
+
});
|
|
370
|
+
function getDefaultDuration(size, isPulse) {
|
|
371
|
+
if (size === "line") return 3.1;
|
|
372
|
+
if (isPulse) return 2.3;
|
|
373
|
+
return 1.96;
|
|
374
|
+
}
|
|
375
|
+
const finalDuration = computed(() => {
|
|
376
|
+
var _props$duration;
|
|
377
|
+
return (_props$duration = props.duration) !== null && _props$duration !== void 0 ? _props$duration : getDefaultDuration(props.size, isPulse.value);
|
|
378
|
+
});
|
|
379
|
+
const finalSaturation = computed(() => {
|
|
380
|
+
var _props$saturation;
|
|
381
|
+
return (_props$saturation = props.saturation) !== null && _props$saturation !== void 0 ? _props$saturation : themeConfig.value.saturation;
|
|
382
|
+
});
|
|
383
|
+
const finalBrightness = computed(() => {
|
|
384
|
+
var _ref2, _props$brightness;
|
|
385
|
+
return (_ref2 = (_props$brightness = props.brightness) !== null && _props$brightness !== void 0 ? _props$brightness : themeConfig.value.brightness) !== null && _ref2 !== void 0 ? _ref2 : 1.3;
|
|
386
|
+
});
|
|
387
|
+
const finalHueRange = computed(() => props.size === "line" ? Math.min(props.hueRange, 13) : props.hueRange);
|
|
388
|
+
const finalStaticColors = computed(() => props.colorVariant === "mono" ? true : props.staticColors);
|
|
389
|
+
const cssStyles = computed(() => generateBeamCSS({
|
|
390
|
+
id,
|
|
391
|
+
borderRadius: finalBorderRadius.value,
|
|
392
|
+
borderWidth: sizeConfig.value.borderWidth,
|
|
393
|
+
duration: finalDuration.value,
|
|
394
|
+
strokeOpacity: themeConfig.value.strokeOpacity,
|
|
395
|
+
innerOpacity: themeConfig.value.innerOpacity,
|
|
396
|
+
bloomOpacity: themeConfig.value.bloomOpacity,
|
|
397
|
+
innerShadow: themeConfig.value.innerShadow,
|
|
398
|
+
size: props.size,
|
|
399
|
+
colorVariant: props.colorVariant,
|
|
400
|
+
staticColors: finalStaticColors.value,
|
|
401
|
+
brightness: finalBrightness.value,
|
|
402
|
+
saturation: finalSaturation.value,
|
|
403
|
+
hueRange: finalHueRange.value,
|
|
404
|
+
theme: resolvedTheme.value,
|
|
405
|
+
hairlineOpacity: themeConfig.value.hairlineOpacity
|
|
406
|
+
}));
|
|
407
|
+
let styleEl = null;
|
|
408
|
+
function ensureStyleEl() {
|
|
409
|
+
if (!styleEl) {
|
|
410
|
+
styleEl = document.createElement("style");
|
|
411
|
+
styleEl.setAttribute("data-beam-style", id);
|
|
412
|
+
document.head.appendChild(styleEl);
|
|
413
|
+
}
|
|
414
|
+
return styleEl;
|
|
415
|
+
}
|
|
416
|
+
onMounted(() => {
|
|
417
|
+
ensureStyleEl().textContent = cssStyles.value;
|
|
418
|
+
});
|
|
419
|
+
watch(cssStyles, (css) => {
|
|
420
|
+
ensureStyleEl().textContent = css;
|
|
421
|
+
});
|
|
422
|
+
onUnmounted(() => {
|
|
423
|
+
styleEl === null || styleEl === void 0 || styleEl.remove();
|
|
424
|
+
styleEl = null;
|
|
425
|
+
});
|
|
426
|
+
const driverConfig = computed(() => isPulse.value ? getPulseDriverConfig(props.size, resolvedTheme.value, finalDuration.value, finalHueRange.value, finalStaticColors.value, id) : null);
|
|
427
|
+
let unregisterPulse = null;
|
|
428
|
+
function syncPulseDriver() {
|
|
429
|
+
var _window$matchMedia2, _window2;
|
|
430
|
+
if (unregisterPulse) {
|
|
431
|
+
unregisterPulse();
|
|
432
|
+
unregisterPulse = null;
|
|
433
|
+
}
|
|
434
|
+
if (!driverConfig.value) return;
|
|
435
|
+
if (!(isActive.value || isFading.value) || !isVisible.value) return;
|
|
436
|
+
const el = wrapperRef.value;
|
|
437
|
+
if (!el) return;
|
|
438
|
+
if (typeof window !== "undefined" && ((_window$matchMedia2 = (_window2 = window).matchMedia) === null || _window$matchMedia2 === void 0 ? void 0 : _window$matchMedia2.call(_window2, "(prefers-reduced-motion: reduce)").matches)) return;
|
|
439
|
+
unregisterPulse = registerPulseInstance(el, driverConfig.value);
|
|
440
|
+
}
|
|
441
|
+
onMounted(() => syncPulseDriver());
|
|
442
|
+
watch([
|
|
443
|
+
driverConfig,
|
|
444
|
+
isActive,
|
|
445
|
+
isFading,
|
|
446
|
+
isVisible
|
|
447
|
+
], () => syncPulseDriver());
|
|
448
|
+
onUnmounted(() => {
|
|
449
|
+
if (unregisterPulse) {
|
|
450
|
+
unregisterPulse();
|
|
451
|
+
unregisterPulse = null;
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
const mergedStyle = computed(() => _objectSpread2({
|
|
455
|
+
"--beam-strength": Math.max(0, Math.min(1, props.strength)),
|
|
456
|
+
"--beam-density": Math.max(.1, props.density),
|
|
457
|
+
"--beam-flow-x": `${flowPoint.value.x}px`,
|
|
458
|
+
"--beam-flow-y": `${flowPoint.value.y}px`,
|
|
459
|
+
"--beam-flow-radius": `${flowRadius.value}px`
|
|
460
|
+
}, props.size === "pulse-outside" ? {
|
|
461
|
+
"--pulse-glow-sx": pulseGlowScale.value.x,
|
|
462
|
+
"--pulse-glow-sy": pulseGlowScale.value.y
|
|
463
|
+
} : {}));
|
|
464
|
+
return (_ctx, _cache) => {
|
|
465
|
+
return openBlock(), createElementBlock("div", {
|
|
466
|
+
ref_key: "wrapperRef",
|
|
467
|
+
ref: wrapperRef,
|
|
468
|
+
"data-beam": id,
|
|
469
|
+
"data-active": isActive.value && !isFading.value ? "" : void 0,
|
|
470
|
+
"data-fading": isFading.value ? "" : void 0,
|
|
471
|
+
"data-flowing": isFlowing.value ? "" : void 0,
|
|
472
|
+
"data-paused": isActive.value && !isFading.value && !isVisible.value ? "" : void 0,
|
|
473
|
+
class: normalizeClass(cls.value),
|
|
474
|
+
style: normalizeStyle(mergedStyle.value),
|
|
475
|
+
onAnimationend: handleAnimationEnd
|
|
476
|
+
}, [
|
|
477
|
+
renderSlot(_ctx.$slots, "default"),
|
|
478
|
+
_cache[2] || (_cache[2] = createElementVNode("div", { "data-beam-bloom": "" }, null, -1)),
|
|
479
|
+
isFlowing.value ? (openBlock(), createElementBlock("svg", {
|
|
480
|
+
key: flowKey.value,
|
|
481
|
+
"data-beam-flow": "",
|
|
482
|
+
viewBox: `0 0 ${flowBox.value.width} ${flowBox.value.height}`,
|
|
483
|
+
preserveAspectRatio: "none",
|
|
484
|
+
"aria-hidden": "true",
|
|
485
|
+
onAnimationend: withModifiers(handleFlowAnimationEnd, ["stop"])
|
|
486
|
+
}, [
|
|
487
|
+
createElementVNode("defs", null, [
|
|
488
|
+
createElementVNode("filter", {
|
|
489
|
+
id: `${id}-flow-warp`,
|
|
490
|
+
x: "-24%",
|
|
491
|
+
y: "-24%",
|
|
492
|
+
width: "148%",
|
|
493
|
+
height: "148%",
|
|
494
|
+
"color-interpolation-filters": "sRGB"
|
|
495
|
+
}, [
|
|
496
|
+
createElementVNode("feTurbulence", {
|
|
497
|
+
type: "fractalNoise",
|
|
498
|
+
baseFrequency: "0.012 0.026",
|
|
499
|
+
seed: flowSeed.value,
|
|
500
|
+
numOctaves: "2",
|
|
501
|
+
result: "flow-noise"
|
|
502
|
+
}, null, 8, _hoisted_4),
|
|
503
|
+
createElementVNode("feDisplacementMap", {
|
|
504
|
+
in: "SourceGraphic",
|
|
505
|
+
in2: "flow-noise",
|
|
506
|
+
scale: flowDisplacement.value,
|
|
507
|
+
xChannelSelector: "R",
|
|
508
|
+
yChannelSelector: "G",
|
|
509
|
+
result: "flow-displaced"
|
|
510
|
+
}, null, 8, _hoisted_5),
|
|
511
|
+
_cache[0] || (_cache[0] = createElementVNode("feGaussianBlur", {
|
|
512
|
+
in: "flow-displaced",
|
|
513
|
+
stdDeviation: "1.1",
|
|
514
|
+
result: "flow-soft"
|
|
515
|
+
}, null, -1)),
|
|
516
|
+
_cache[1] || (_cache[1] = createElementVNode("feColorMatrix", {
|
|
517
|
+
in: "flow-soft",
|
|
518
|
+
type: "saturate",
|
|
519
|
+
values: "1.24"
|
|
520
|
+
}, null, -1))
|
|
521
|
+
], 8, _hoisted_3),
|
|
522
|
+
createElementVNode("radialGradient", {
|
|
523
|
+
id: `${id}-flow-fill`,
|
|
524
|
+
gradientUnits: "userSpaceOnUse",
|
|
525
|
+
cx: flowPoint.value.x,
|
|
526
|
+
cy: flowPoint.value.y,
|
|
527
|
+
r: flowRadius.value
|
|
528
|
+
}, [
|
|
529
|
+
createElementVNode("stop", {
|
|
530
|
+
offset: "0",
|
|
531
|
+
"stop-color": flowColors.value.core,
|
|
532
|
+
"stop-opacity": "0.5"
|
|
533
|
+
}, null, 8, _hoisted_7),
|
|
534
|
+
createElementVNode("stop", {
|
|
535
|
+
offset: "0.18",
|
|
536
|
+
"stop-color": flowColors.value.mist,
|
|
537
|
+
"stop-opacity": "0.42"
|
|
538
|
+
}, null, 8, _hoisted_8),
|
|
539
|
+
createElementVNode("stop", {
|
|
540
|
+
offset: "0.46",
|
|
541
|
+
"stop-color": flowColors.value.accent,
|
|
542
|
+
"stop-opacity": "0.32"
|
|
543
|
+
}, null, 8, _hoisted_9),
|
|
544
|
+
createElementVNode("stop", {
|
|
545
|
+
offset: "0.76",
|
|
546
|
+
"stop-color": flowColors.value.edge,
|
|
547
|
+
"stop-opacity": "0.18"
|
|
548
|
+
}, null, 8, _hoisted_10),
|
|
549
|
+
createElementVNode("stop", {
|
|
550
|
+
offset: "1",
|
|
551
|
+
"stop-color": flowColors.value.edge,
|
|
552
|
+
"stop-opacity": "0"
|
|
553
|
+
}, null, 8, _hoisted_11)
|
|
554
|
+
], 8, _hoisted_6),
|
|
555
|
+
createElementVNode("mask", {
|
|
556
|
+
id: `${id}-flow-mask`,
|
|
557
|
+
maskUnits: "userSpaceOnUse",
|
|
558
|
+
x: -flowRadius.value,
|
|
559
|
+
y: -flowRadius.value,
|
|
560
|
+
width: flowBox.value.width + flowRadius.value * 2,
|
|
561
|
+
height: flowBox.value.height + flowRadius.value * 2
|
|
562
|
+
}, [createElementVNode("g", { filter: `url(#${id}-flow-warp)` }, [
|
|
563
|
+
createElementVNode("circle", {
|
|
564
|
+
"data-beam-flow-blob": "",
|
|
565
|
+
cx: flowPoint.value.x,
|
|
566
|
+
cy: flowPoint.value.y,
|
|
567
|
+
r: flowRadius.value
|
|
568
|
+
}, null, 8, _hoisted_14),
|
|
569
|
+
createElementVNode("circle", {
|
|
570
|
+
"data-beam-flow-blob": "shore-a",
|
|
571
|
+
cx: flowPoint.value.x,
|
|
572
|
+
cy: flowPoint.value.y,
|
|
573
|
+
r: flowRadius.value * .72
|
|
574
|
+
}, null, 8, _hoisted_15),
|
|
575
|
+
createElementVNode("circle", {
|
|
576
|
+
"data-beam-flow-blob": "shore-b",
|
|
577
|
+
cx: flowPoint.value.x,
|
|
578
|
+
cy: flowPoint.value.y,
|
|
579
|
+
r: flowRadius.value * .56
|
|
580
|
+
}, null, 8, _hoisted_16)
|
|
581
|
+
], 8, _hoisted_13)], 8, _hoisted_12)
|
|
582
|
+
]),
|
|
583
|
+
createElementVNode("rect", {
|
|
584
|
+
"data-beam-flow-sheet": "",
|
|
585
|
+
x: "0",
|
|
586
|
+
y: "0",
|
|
587
|
+
width: flowBox.value.width,
|
|
588
|
+
height: flowBox.value.height,
|
|
589
|
+
rx: finalBorderRadius.value,
|
|
590
|
+
fill: `url(#${id}-flow-fill)`,
|
|
591
|
+
mask: `url(#${id}-flow-mask)`
|
|
592
|
+
}, null, 8, _hoisted_17),
|
|
593
|
+
createElementVNode("g", { filter: `url(#${id}-flow-warp)` }, [createElementVNode("circle", {
|
|
594
|
+
"data-beam-flow-front": "",
|
|
595
|
+
cx: flowPoint.value.x,
|
|
596
|
+
cy: flowPoint.value.y,
|
|
597
|
+
r: flowRadius.value,
|
|
598
|
+
fill: "none",
|
|
599
|
+
stroke: flowColors.value.front,
|
|
600
|
+
"stroke-width": Math.max(18, flowRadius.value * .1)
|
|
601
|
+
}, null, 8, _hoisted_19), createElementVNode("circle", {
|
|
602
|
+
"data-beam-flow-front": "highlight",
|
|
603
|
+
cx: flowPoint.value.x,
|
|
604
|
+
cy: flowPoint.value.y,
|
|
605
|
+
r: flowRadius.value * .94,
|
|
606
|
+
fill: "none",
|
|
607
|
+
stroke: flowColors.value.specular,
|
|
608
|
+
"stroke-width": Math.max(8, flowRadius.value * .035)
|
|
609
|
+
}, null, 8, _hoisted_20)], 8, _hoisted_18),
|
|
610
|
+
createElementVNode("circle", {
|
|
611
|
+
"data-beam-flow-specular": "",
|
|
612
|
+
cx: flowPoint.value.x,
|
|
613
|
+
cy: flowPoint.value.y,
|
|
614
|
+
r: Math.max(16, flowRadius.value * .18),
|
|
615
|
+
fill: flowColors.value.specular
|
|
616
|
+
}, null, 8, _hoisted_21)
|
|
617
|
+
], 40, _hoisted_2)) : createCommentVNode("", true)
|
|
618
|
+
], 46, _hoisted_1);
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
}));
|
|
622
|
+
//#endregion
|
|
623
|
+
export { border_beam_vue_vue_type_script_setup_true_lang_default as default };
|