@snowui-design-system/components 0.3.0-alpha.13 → 0.3.0-alpha.15
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/AGENTS.md +2 -36
- package/README.md +19 -130
- package/THIRD_PARTY_NOTICES.md +85 -0
- package/component-catalog.json +65 -0
- package/dist/client/components/Accordion.js +1 -1
- package/dist/client/components/AccordionItem.js +1 -1
- package/dist/client/components/Avatar.js +122 -63
- package/dist/client/components/Button.js +1 -1
- package/dist/client/components/Card.js +10 -0
- package/dist/client/components/CodeBlock.js +38 -10
- package/dist/client/components/Dialog.js +3 -13
- package/dist/client/components/Icon.js +92 -24
- package/dist/client/components/Image.js +21 -10
- package/dist/client/components/Indicator.js +77 -6
- package/dist/client/components/Input.js +192 -94
- package/dist/client/components/MetricCard.d.ts +13 -0
- package/dist/client/components/MetricCard.js +179 -0
- package/dist/client/components/OTPInput.d.ts +2 -1
- package/dist/client/components/OTPInput.js +117 -63
- package/dist/client/components/PasswordStrength.d.ts +20 -0
- package/dist/client/components/PasswordStrength.js +147 -0
- package/dist/client/components/SnowUILogo.d.ts +1 -0
- package/dist/client/components/SnowUILogo.js +11 -7
- package/dist/client/components/StyleButton.js +2 -0
- package/dist/client/i18n/messages.d.ts +1 -1
- package/dist/client/i18n/messages.js +16 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +2 -0
- package/dist/client/internal/component-icon/builtin-icon-data.js +14 -0
- package/dist/client/lib/text-motion/split.d.ts +7 -0
- package/dist/client/lib/text-motion/split.js +49 -0
- package/dist/client/styles/components.css +5 -1
- package/dist/client/styles/scale.css +16 -16
- package/dist/server/components/Accordion.js +1 -1
- package/dist/server/components/AccordionItem.js +1 -1
- package/dist/server/components/Avatar.js +42 -7
- package/dist/server/components/Button.js +1 -1
- package/dist/server/components/Card.js +2 -0
- package/dist/server/components/CodeBlock.js +29 -6
- package/dist/server/components/Dialog.js +3 -10
- package/dist/server/components/Icon.js +37 -2
- package/dist/server/components/Image.js +3 -1
- package/dist/server/components/Indicator.js +6 -3
- package/dist/server/components/Input.js +63 -5
- package/dist/server/components/MetricCard.d.ts +13 -0
- package/dist/server/components/MetricCard.js +104 -0
- package/dist/server/components/OTPInput.d.ts +2 -1
- package/dist/server/components/OTPInput.js +66 -35
- package/dist/server/components/PasswordStrength.d.ts +20 -0
- package/dist/server/components/PasswordStrength.js +107 -0
- package/dist/server/components/SnowUILogo.d.ts +1 -0
- package/dist/server/components/SnowUILogo.js +5 -3
- package/dist/server/components/StyleButton.js +2 -0
- package/dist/server/i18n/messages.d.ts +1 -1
- package/dist/server/i18n/messages.js +16 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +2 -0
- package/dist/server/internal/component-icon/builtin-icon-data.js +14 -0
- package/dist/server/lib/text-motion/split.d.ts +7 -0
- package/dist/server/lib/text-motion/split.js +49 -0
- package/dist/server/styles/components.css +5 -1
- package/dist/server/styles/scale.css +16 -16
- package/llms.txt +3 -6
- package/package.json +3 -2
|
@@ -19,13 +19,7 @@ import {
|
|
|
19
19
|
} from "../logic/dialog.js";
|
|
20
20
|
|
|
21
21
|
import { useOverlayPresence } from "../logic/overlay-presence.js";
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
DIALOG_BACKDROP_MOTION_STYLE,
|
|
25
|
-
MODAL_DIALOG_APPEAR_MOTION,
|
|
26
|
-
MODAL_DIALOG_DISAPPEAR_MOTION
|
|
27
|
-
} from "../motion/presets/dialog.js";
|
|
28
|
-
|
|
22
|
+
import { DIALOG_BACKDROP_MOTION_STYLE, MODAL_DIALOG_DISAPPEAR_MOTION } from "../motion/presets/dialog.js";
|
|
29
23
|
import { getMotionTotalDurationMs } from "../motion/presets/utils.js";
|
|
30
24
|
import { getSize } from "../context.js";
|
|
31
25
|
|
|
@@ -67,7 +61,7 @@ var root_4 = $.from_html(`<!> <!>`, 1);
|
|
|
67
61
|
|
|
68
62
|
const $$css = {
|
|
69
63
|
hash: 'svelte-1kwbck4',
|
|
70
|
-
code: ':where(.snowui-dialog-backdrop) {position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:var(--padding-4);}:where(.snowui-dialog-container) {width:100%;max-height:100%;display:flex;align-items:center;justify-content:center;pointer-events:none;}:where(.snowui-dialog) {width:min(100%, var(--snowui-dialog-max-width));max-height:calc(100vh - var(--size-16));overflow:auto;pointer-events:auto;position:relative;box-sizing:border-box;align-items:stretch;gap:var(--snowui-dialog-gap-override, var(--snowui-dialog-gap));--snowui-dialog-gap: var(--gap-4);--snowui-dialog-title-font-size: var(--text-18);--snowui-dialog-title-line-height: var(--leading-18);--snowui-dialog-close-size: calc(var(--size-6) + var(--size-3));--snowui-dialog-close-offset: var(--padding-4);--snowui-dialog-footer-gap: var(--gap-3);transform-origin:center;
|
|
64
|
+
code: ':where(.snowui-dialog-backdrop) {position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:var(--padding-4);}:where(.snowui-dialog-container) {width:100%;max-height:100%;display:flex;align-items:center;justify-content:center;pointer-events:none;}\n\n /* 保持打开时遮罩祖先完全可见,避免淡入削弱面板毛玻璃。 */:where(.snowui-dialog-backdrop)[data-open="true"] {opacity:1;transition:none;}:where(.snowui-dialog) {backdrop-filter:var(--snowui-backdrop-quick-action, blur(var(--size-10, 40px)));-webkit-backdrop-filter:var(--snowui-backdrop-quick-action, blur(var(--size-10, 40px)));width:min(100%, var(--snowui-dialog-max-width));max-height:calc(100vh - var(--size-16));overflow:auto;pointer-events:auto;position:relative;box-sizing:border-box;align-items:stretch;gap:var(--snowui-dialog-gap-override, var(--snowui-dialog-gap));--snowui-dialog-gap: var(--gap-4);--snowui-dialog-title-font-size: var(--text-18);--snowui-dialog-title-line-height: var(--leading-18);--snowui-dialog-close-size: calc(var(--size-6) + var(--size-3));--snowui-dialog-close-offset: var(--padding-4);--snowui-dialog-footer-gap: var(--gap-3);transform-origin:center;font-size:var(--snowui-dialog-font-size-override, var(--text-14));line-height:var(\n --snowui-dialog-line-height-override,\n var(--leading-14)\n );--snowui-dialog-max-width: var(\n --snowui-dialog-max-width-override,\n 28rem\n );--snowui-dialog-padding: var(--padding-5);--snowui-dialog-radius: var(--radius-6);padding:var(\n --snowui-dialog-padding-override,\n var(--snowui-dialog-padding)\n );border-radius:var(\n --snowui-dialog-radius-override,\n var(--snowui-dialog-radius)\n );}:where(.snowui-dialog[data-closing="true"]) {pointer-events:none;will-change:transform, opacity;}\n\n @media (prefers-reduced-motion: reduce) {:where(.snowui-dialog) {transition:none;}\n }:where(.snowui-dialog[data-size="sm"]) {--snowui-dialog-max-width: var(\n --snowui-dialog-max-width-override,\n 20rem\n );--snowui-dialog-padding: var(--padding-4);--snowui-dialog-radius: var(--radius-5);--snowui-dialog-gap: var(--gap-3);--snowui-dialog-title-font-size: var(--text-16);--snowui-dialog-title-line-height: var(--leading-16);--snowui-dialog-close-size: var(--size-6);--snowui-dialog-footer-gap: var(--gap-2);}:where(.snowui-dialog[data-size="lg"]) {--snowui-dialog-max-width: var(\n --snowui-dialog-max-width-override,\n 40rem\n );--snowui-dialog-padding: var(--padding-6);--snowui-dialog-radius: var(--radius-7);--snowui-dialog-gap: var(--gap-5);--snowui-dialog-close-offset: var(--padding-5);}:where(.snowui-dialog-title, .snowui-dialog > [data-as="title"], .snowui-dialog > .snowui-dialog-content > [data-as="title"]) {order:-3;margin:0;min-width:0;padding-inline:var(--snowui-dialog-text-padding-override, var(--padding-1));font-size:var(--snowui-dialog-title-font-size);line-height:var(--snowui-dialog-title-line-height);font-weight:600;color:var(--black-100, #000);overflow-wrap:anywhere;}:where(.snowui-dialog-title-with-close, .snowui-dialog[data-has-close="true"] > [data-as="title"], .snowui-dialog[data-has-close="true"] > .snowui-dialog-content > [data-as="title"]) {padding-right:calc(var(--snowui-dialog-close-size) + var(--padding-1));}:where(.snowui-dialog-content) {position:static;display:flex;flex-direction:column;min-width:0;flex:0 0 auto;gap:var(--snowui-dialog-content-gap-override, var(--gap-2));padding-inline:var(--snowui-dialog-text-padding-override, var(--padding-1));font-size:inherit;line-height:inherit;overflow-wrap:anywhere;}:where(.snowui-dialog-content[data-close-space="true"]) {padding-top:calc(var(--snowui-dialog-close-size) + var(--padding-2));}:where(.snowui-dialog > [data-as="close"], .snowui-dialog > .snowui-dialog-content > [data-as="close"]) {position:absolute;z-index:1;top:var(--pin-offset-y, var(--pin-offset, var(--snowui-dialog-close-offset)));right:var(--pin-offset-x, var(--pin-offset, var(--snowui-dialog-close-offset)));}:where(.snowui-dialog-content[data-has-footer="true"]) {gap:var(--snowui-dialog-gap-override, var(--snowui-dialog-gap));}:where(.snowui-dialog > [data-as="footer"], .snowui-dialog > .snowui-dialog-content > [data-as="footer"]) {display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:max(4px, var(--snowui-dialog-footer-gap-override, var(--snowui-dialog-footer-gap)));min-width:0;order:1;}:where(.snowui-dialog > [data-as="footer"] ~ [data-as="footer"], .snowui-dialog > .snowui-dialog-content > [data-as="footer"] ~ [data-as="footer"]) {display:none;}:where(.snowui-dialog-content[data-structured="true"]) {display:contents;}:where(.snowui-dialog-separator, .snowui-dialog > [data-as="separator"], .snowui-dialog > .snowui-dialog-content > [data-as="separator"]) {order:-2;}:where(.snowui-dialog > [data-as="content"], .snowui-dialog > .snowui-dialog-content > [data-as="content"]) {display:flex;flex-direction:column;gap:var(--snowui-dialog-content-gap-override, var(--gap-2));padding-inline:var(--snowui-dialog-text-padding-override, var(--padding-1));font-size:inherit;line-height:inherit;min-width:0;overflow-wrap:anywhere;}:where(.snowui-dialog > [data-as="title"] ~ [data-as="title"], .snowui-dialog > .snowui-dialog-content > [data-as="title"] ~ [data-as="title"],\n .snowui-dialog > [data-as="separator"] ~ [data-as="separator"], .snowui-dialog > .snowui-dialog-content > [data-as="separator"] ~ [data-as="separator"],\n .snowui-dialog > [data-as="content"] ~ [data-as="content"], .snowui-dialog > .snowui-dialog-content > [data-as="content"] ~ [data-as="content"]) {display:none;}:where(.snowui-dialog-close) {--snowui-button-opacity-override: 0.4;}:where(.snowui-dialog-close:hover, .snowui-dialog-close:focus-visible) {--snowui-button-opacity-override: 1;}:where(.snowui-dialog-content > [data-as="close"] ~ [data-as="close"], .snowui-dialog > [data-as="close"]:not([data-dialog-builtin-close]) ~ [data-as="close"]:not([data-dialog-builtin-close])) {display:none;}'
|
|
71
65
|
};
|
|
72
66
|
|
|
73
67
|
export default function Dialog($$anchor, $$props) {
|
|
@@ -456,7 +450,7 @@ export default function Dialog($$anchor, $$props) {
|
|
|
456
450
|
var node_3 = $.child(div_1);
|
|
457
451
|
|
|
458
452
|
{
|
|
459
|
-
let $0 = $.derived(() => presence.closing ? "Disappear" :
|
|
453
|
+
let $0 = $.derived(() => presence.closing ? "Disappear" : undefined);
|
|
460
454
|
|
|
461
455
|
let $1 = $.derived(() => rest["aria-label"]
|
|
462
456
|
? undefined
|
|
@@ -487,10 +481,6 @@ export default function Dialog($$anchor, $$props) {
|
|
|
487
481
|
return $.get($0);
|
|
488
482
|
},
|
|
489
483
|
|
|
490
|
-
get whileAppear() {
|
|
491
|
-
return MODAL_DIALOG_APPEAR_MOTION;
|
|
492
|
-
},
|
|
493
|
-
|
|
494
484
|
get whileDisappear() {
|
|
495
485
|
return MODAL_DIALOG_DISAPPEAR_MOTION;
|
|
496
486
|
},
|
|
@@ -3,6 +3,7 @@ import * as $ from 'svelte/internal/client';
|
|
|
3
3
|
import { getContext, setContext } from "svelte";
|
|
4
4
|
import { OPTIONAL_RESOURCE_ICON_CONTEXT_KEY } from "../logic/component-icon.js";
|
|
5
5
|
import Frame from "./Frame.js";
|
|
6
|
+
import Skeleton from "./Skeleton.js";
|
|
6
7
|
import { FRAME_CONTEXT_KEY } from "../keys.js";
|
|
7
8
|
import { resolveParentStateValue } from "../logic/frame-state-value.js";
|
|
8
9
|
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
getIcon,
|
|
14
15
|
getImage,
|
|
15
16
|
getImageViewer,
|
|
17
|
+
getSkeleton,
|
|
16
18
|
getSizeContext,
|
|
17
19
|
getSize
|
|
18
20
|
} from "../context.js";
|
|
@@ -41,14 +43,15 @@ var rest_excludes = new Set([
|
|
|
41
43
|
'children'
|
|
42
44
|
]);
|
|
43
45
|
|
|
44
|
-
var root = $.from_html(`<
|
|
45
|
-
var root_1 = $.from_html(`<
|
|
46
|
-
var root_2 = $.from_html(`<div class="snowui-icon-
|
|
47
|
-
var root_3 = $.from_html(`<div><!></div>`);
|
|
46
|
+
var root = $.from_html(`<div class="snowui-icon-loading" aria-hidden="true"><!></div>`);
|
|
47
|
+
var root_1 = $.from_html(`<img alt=""/> <!>`, 1);
|
|
48
|
+
var root_2 = $.from_html(`<div class="snowui-icon-default snowui-rounded-rectangle"></div>`);
|
|
49
|
+
var root_3 = $.from_html(`<div class="snowui-icon-content"><!></div>`);
|
|
50
|
+
var root_4 = $.from_html(`<div><!></div>`);
|
|
48
51
|
|
|
49
52
|
const $$css = {
|
|
50
53
|
hash: 'svelte-13so817',
|
|
51
|
-
code: ':where(.snowui-icon) {display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;vertical-align:middle;user-select:none;box-sizing:border-box;position:relative; /* Ensure absolute badge is relative to Icon */--snowui-icon-size-default: var(--size-4);--snowui-icon-width: var(\n --snowui-icon-size-override,\n var(\n --snowui-button-icon-size-override,\n var(--snowui-icon-size-default)\n )\n );--snowui-icon-height: var(\n --snowui-icon-size-override,\n var(\n --snowui-button-icon-size-override,\n var(--snowui-icon-size-default)\n )\n );--snowui-icon-min-width: 12px;--snowui-icon-min-height: 12px;width:var(--snowui-icon-width-override, var(--snowui-icon-width));height:var(--snowui-icon-height-override, var(--snowui-icon-height));min-width:var(\n --snowui-icon-min-width-override,\n var(--snowui-icon-min-width)\n );min-height:var(\n --snowui-icon-min-height-override,\n var(--snowui-icon-min-height)\n );font-size:var(--snowui-icon-font-size-override, inherit);line-height:var(--snowui-icon-line-height-override, inherit);font-weight:var(\n --snowui-icon-font-weight-override,\n var(--snowui-icon-font-weight, inherit)\n );}:where(.snowui-icon).snowui-icon-role-badge {--snowui-icon-width: var(\n --snowui-icon-size-override,\n var(--snowui-icon-size-default)\n );--snowui-icon-height: var(\n --snowui-icon-size-override,\n var(--snowui-icon-size-default)\n );--snowui-icon-min-width: 12px;--snowui-icon-min-height: 12px;}:where(.snowui-icon-background) {--snowui-icon-background: var(--black-4, #0000000a);\n /* size 表示内容区尺寸;背景 padding 额外叠加到外框 */box-sizing:content-box;background-color:var(\n --snowui-icon-background-override,\n var(--snowui-icon-background)\n );padding:var(\n --snowui-icon-padding-override,\n var(--snowui-icon-padding, var(--padding-0))\n );border-radius:var(\n --snowui-icon-radius-override,\n var(--snowui-icon-radius, var(--radius-0))\n );}:where(.snowui-icon-content) {display:flex;align-items:center;justify-content:center;width:100%;height:100%;}:where(.snowui-icon-wrapper) {position:relative;display:inline-flex;vertical-align:middle;flex-shrink:0;box-sizing:border-box;}:where(.snowui-icon-wrapper-state-hidden) {display:none;}:where(.snowui-icon-wrapper[data-as^="pin-"]) {position:absolute;}:where(.snowui-icon-wrapper-badge) {margin:0;}:where(.snowui-icon-image),\n :where(.snowui-icon-content > svg) {display:block;width:100%;height:100%;max-width:100%;}:where(.snowui-icon-image) {object-fit:contain;}:where(.snowui-icon-default) {width:100%;height:100%;box-sizing:border-box;border-radius:var(--radius-1);border:var(--border-1) dashed var(--black-80, #000000cc);background:var(--black-4, #0000000a);}'
|
|
54
|
+
code: ':where(.snowui-icon) {display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;vertical-align:middle;user-select:none;box-sizing:border-box;position:relative; /* Ensure absolute badge is relative to Icon */--snowui-icon-size-default: var(--size-4);--snowui-icon-width: var(\n --snowui-icon-size-override,\n var(\n --snowui-button-icon-size-override,\n var(--snowui-icon-size-default)\n )\n );--snowui-icon-height: var(\n --snowui-icon-size-override,\n var(\n --snowui-button-icon-size-override,\n var(--snowui-icon-size-default)\n )\n );--snowui-icon-min-width: 12px;--snowui-icon-min-height: 12px;width:var(--snowui-icon-width-override, var(--snowui-icon-width));height:var(--snowui-icon-height-override, var(--snowui-icon-height));min-width:var(\n --snowui-icon-min-width-override,\n var(--snowui-icon-min-width)\n );min-height:var(\n --snowui-icon-min-height-override,\n var(--snowui-icon-min-height)\n );font-size:var(--snowui-icon-font-size-override, inherit);line-height:var(--snowui-icon-line-height-override, inherit);font-weight:var(\n --snowui-icon-font-weight-override,\n var(--snowui-icon-font-weight, inherit)\n );}:where(.snowui-icon).snowui-icon-role-badge {--snowui-icon-width: var(\n --snowui-icon-size-override,\n var(--snowui-icon-size-default)\n );--snowui-icon-height: var(\n --snowui-icon-size-override,\n var(--snowui-icon-size-default)\n );--snowui-icon-min-width: 12px;--snowui-icon-min-height: 12px;}:where(.snowui-icon-background) {--snowui-icon-background: var(--black-4, #0000000a);\n /* size 表示内容区尺寸;背景 padding 额外叠加到外框 */box-sizing:content-box;background-color:var(\n --snowui-icon-background-override,\n var(--snowui-icon-background)\n );padding:var(\n --snowui-icon-padding-override,\n var(--snowui-icon-padding, var(--padding-0))\n );border-radius:var(\n --snowui-icon-radius-override,\n var(--snowui-icon-radius, var(--radius-0))\n );}:where(.snowui-icon-content) {position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;}:where(.snowui-icon-wrapper) {position:relative;display:inline-flex;vertical-align:middle;flex-shrink:0;box-sizing:border-box;}:where(.snowui-icon-wrapper-state-hidden) {display:none;}:where(.snowui-icon-wrapper[data-as^="pin-"]) {position:absolute;}:where(.snowui-icon-wrapper-badge) {margin:0;}:where(.snowui-icon-image),\n :where(.snowui-icon-content > svg) {display:block;width:100%;height:100%;max-width:100%;}:where(.snowui-icon-image) {object-fit:contain;}:where(.snowui-icon-image-loading) {opacity:0;}:where(.snowui-icon-loading) {position:absolute;inset:0;pointer-events:none;}:where(.snowui-icon-default) {width:100%;height:100%;box-sizing:border-box;border-radius:var(--radius-1);border:var(--border-1) dashed var(--black-80, #000000cc);background:var(--black-4, #0000000a);}'
|
|
52
55
|
};
|
|
53
56
|
|
|
54
57
|
export default function Icon($$anchor, $$props) {
|
|
@@ -260,34 +263,99 @@ export default function Icon($$anchor, $$props) {
|
|
|
260
263
|
radius: userRenderHints()?.radius ?? $.get(bgConfig).radius
|
|
261
264
|
}));
|
|
262
265
|
|
|
266
|
+
const skeletonContext = getSkeleton();
|
|
267
|
+
let mediaStatus = $.state("idle");
|
|
268
|
+
let mediaElement = $.state(void 0);
|
|
269
|
+
|
|
270
|
+
$.user_effect(() => {
|
|
271
|
+
$.set(mediaStatus, src() ? "loading" : "idle", true);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
$.user_effect(() => {
|
|
275
|
+
const image = $.get(mediaElement);
|
|
276
|
+
|
|
277
|
+
if (image?.complete) $.set(mediaStatus, image.naturalWidth > 0 ? "loaded" : "error", true);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
const mediaPending = $.derived(() => {
|
|
281
|
+
const source = src();
|
|
282
|
+
const status = $.get(mediaStatus);
|
|
283
|
+
|
|
284
|
+
return !!source && (status === "idle" || status === "loading");
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
const showMediaSkeleton = $.derived(() => $.get(mediaPending) && ($$props.skeleton ?? skeletonContext?.skeleton ?? true));
|
|
263
288
|
const resolvedIcon = $.derived(() => resolveParentStateValue(stateIcon(), parentFrameCtx, icon()));
|
|
264
289
|
const isStateIconHidden = $.derived(() => stateIcon() !== undefined && $.get(resolvedIcon) === null);
|
|
265
|
-
var div =
|
|
290
|
+
var div = root_4();
|
|
266
291
|
var node = $.child(div);
|
|
267
292
|
|
|
268
293
|
{
|
|
269
294
|
const children = ($$anchor) => {
|
|
270
|
-
var div_1 =
|
|
295
|
+
var div_1 = root_3();
|
|
271
296
|
var node_1 = $.child(div_1);
|
|
272
297
|
|
|
273
298
|
{
|
|
274
|
-
var
|
|
275
|
-
var
|
|
299
|
+
var consequent_1 = ($$anchor) => {
|
|
300
|
+
var fragment = root_1();
|
|
301
|
+
var img = $.first_child(fragment);
|
|
302
|
+
let classes;
|
|
303
|
+
|
|
304
|
+
$.bind_this(img, ($$value) => $.set(mediaElement, $$value), () => $.get(mediaElement));
|
|
305
|
+
|
|
306
|
+
var node_2 = $.sibling(img, 2);
|
|
276
307
|
|
|
277
|
-
|
|
278
|
-
|
|
308
|
+
{
|
|
309
|
+
var consequent = ($$anchor) => {
|
|
310
|
+
var div_2 = root();
|
|
311
|
+
var node_3 = $.child(div_2);
|
|
312
|
+
|
|
313
|
+
{
|
|
314
|
+
let $0 = $.derived(() => ({
|
|
315
|
+
variant: "rect",
|
|
316
|
+
width: userRenderHints()?.width ?? $.get(sizeRem),
|
|
317
|
+
height: userRenderHints()?.height ?? $.get(sizeRem),
|
|
318
|
+
radius: userRenderHints()?.radius ?? $.get(bgConfig).radius
|
|
319
|
+
}));
|
|
320
|
+
|
|
321
|
+
Skeleton(node_3, {
|
|
322
|
+
componentClass: 'snowui-icon',
|
|
323
|
+
get renderHints() {
|
|
324
|
+
return $.get($0);
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
$.reset(div_2);
|
|
330
|
+
$.append($$anchor, div_2);
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
$.if(node_2, ($$render) => {
|
|
334
|
+
if ($.get(showMediaSkeleton)) $$render(consequent);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
$.template_effect(() => {
|
|
339
|
+
$.set_attribute(img, 'src', src());
|
|
340
|
+
classes = $.set_class(img, 1, 'snowui-icon-image', null, classes, { 'snowui-icon-image-loading': $.get(showMediaSkeleton) });
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
$.event('load', img, () => $.set(mediaStatus, "loaded"));
|
|
344
|
+
$.event('error', img, () => $.set(mediaStatus, "error"));
|
|
345
|
+
$.replay_events(img);
|
|
346
|
+
$.append($$anchor, fragment);
|
|
279
347
|
};
|
|
280
348
|
|
|
281
|
-
var
|
|
282
|
-
var
|
|
283
|
-
var
|
|
349
|
+
var consequent_2 = ($$anchor) => {
|
|
350
|
+
var fragment_1 = $.comment();
|
|
351
|
+
var node_4 = $.first_child(fragment_1);
|
|
284
352
|
|
|
285
353
|
{
|
|
286
354
|
let $0 = $.derived(() => typeof $.get(effectiveSize) === "number"
|
|
287
355
|
? Math.round($.get(effectiveSize))
|
|
288
356
|
: $.get(effectiveSize));
|
|
289
357
|
|
|
290
|
-
$.component(
|
|
358
|
+
$.component(node_4, () => $.get(resolvedIcon), ($$anchor, $$component) => {
|
|
291
359
|
$$component($$anchor, {
|
|
292
360
|
get size() {
|
|
293
361
|
return $.get($0);
|
|
@@ -298,25 +366,25 @@ export default function Icon($$anchor, $$props) {
|
|
|
298
366
|
});
|
|
299
367
|
}
|
|
300
368
|
|
|
301
|
-
$.append($$anchor,
|
|
369
|
+
$.append($$anchor, fragment_1);
|
|
302
370
|
};
|
|
303
371
|
|
|
304
|
-
var
|
|
305
|
-
var
|
|
306
|
-
var
|
|
372
|
+
var consequent_3 = ($$anchor) => {
|
|
373
|
+
var fragment_2 = $.comment();
|
|
374
|
+
var node_5 = $.first_child(fragment_2);
|
|
307
375
|
|
|
308
|
-
$.snippet(
|
|
309
|
-
$.append($$anchor,
|
|
376
|
+
$.snippet(node_5, () => $$props.children);
|
|
377
|
+
$.append($$anchor, fragment_2);
|
|
310
378
|
};
|
|
311
379
|
|
|
312
380
|
var alternate = ($$anchor) => {
|
|
313
|
-
var
|
|
381
|
+
var div_3 = root_2();
|
|
314
382
|
|
|
315
|
-
$.append($$anchor,
|
|
383
|
+
$.append($$anchor, div_3);
|
|
316
384
|
};
|
|
317
385
|
|
|
318
386
|
$.if(node_1, ($$render) => {
|
|
319
|
-
if (src()) $$render(
|
|
387
|
+
if (src()) $$render(consequent_1); else if ($.get(resolvedIcon)) $$render(consequent_2, 1); else if ($$props.children) $$render(consequent_3, 2); else $$render(alternate, -1);
|
|
320
388
|
});
|
|
321
389
|
}
|
|
322
390
|
|
|
@@ -168,6 +168,7 @@ export default function Image($$anchor, $$props) {
|
|
|
168
168
|
|
|
169
169
|
let imageStatus = $.state("idle");
|
|
170
170
|
let videoRef = $.state(void 0);
|
|
171
|
+
let imageRef = $.state(void 0);
|
|
171
172
|
let viewerAvailable = $.state(false);
|
|
172
173
|
let previewRegistration = null;
|
|
173
174
|
|
|
@@ -219,13 +220,21 @@ export default function Image($$anchor, $$props) {
|
|
|
219
220
|
$.set(imageStatus, "loading");
|
|
220
221
|
});
|
|
221
222
|
|
|
223
|
+
// 资源可能在事件绑定前已完成;节点卸载不能重新启动失败的加载。
|
|
224
|
+
$.user_effect(() => {
|
|
225
|
+
const image = $.get(imageRef);
|
|
226
|
+
const video = $.get(videoRef);
|
|
227
|
+
|
|
228
|
+
if (image?.complete) $.set(imageStatus, image.naturalWidth > 0 ? "loaded" : "error", true); else if (video && video.readyState >= 1) $.set(imageStatus, "loaded");
|
|
229
|
+
});
|
|
230
|
+
|
|
222
231
|
const resolvedPreviewMode = $.derived(() => {
|
|
223
232
|
return previewMode() ?? imageGroupCtx?.previewMode ?? ($.get(viewerAvailable) ? "viewer" : "window");
|
|
224
233
|
});
|
|
225
234
|
|
|
226
235
|
const canRenderMedia = $.derived(() => !!src() && $.get(imageStatus) !== "error");
|
|
227
236
|
const hasLoadedMedia = $.derived(() => $.get(imageStatus) === "loaded" && !!src());
|
|
228
|
-
const showLoadingSkeleton = $.derived(() => typeof src() === "string" && $.get(imageStatus) === "loading");
|
|
237
|
+
const showLoadingSkeleton = $.derived(() => typeof src() === "string" && !!src() && ($.get(imageStatus) === "idle" || $.get(imageStatus) === "loading"));
|
|
229
238
|
const canOpenInViewer = $.derived(() => $.get(resolvedPreviewMode) === "viewer" && $.get(viewerAvailable));
|
|
230
239
|
const canOpenInWindow = $.derived(() => $.get(resolvedPreviewMode) === "window" && typeof src() === "string");
|
|
231
240
|
const resolvedCanOpen = $.derived(() => !!src() && !disabled() && (!!onOpen() || $.get(canOpenInViewer) || $.get(canOpenInWindow)));
|
|
@@ -373,25 +382,27 @@ export default function Image($$anchor, $$props) {
|
|
|
373
382
|
|
|
374
383
|
{
|
|
375
384
|
var consequent = ($$anchor) => {
|
|
376
|
-
var
|
|
385
|
+
var video_1 = root();
|
|
377
386
|
|
|
378
|
-
|
|
379
|
-
$.bind_this(
|
|
387
|
+
video_1.muted = true;
|
|
388
|
+
$.bind_this(video_1, ($$value) => $.set(videoRef, $$value), () => $.get(videoRef));
|
|
380
389
|
|
|
381
390
|
$.template_effect(() => {
|
|
382
|
-
$.set_attribute(
|
|
383
|
-
$.set_attribute(
|
|
391
|
+
$.set_attribute(video_1, 'src', src());
|
|
392
|
+
$.set_attribute(video_1, 'aria-label', alt() ?? undefined);
|
|
384
393
|
});
|
|
385
394
|
|
|
386
|
-
$.event('loadeddata',
|
|
387
|
-
$.event('loadedmetadata',
|
|
388
|
-
$.event('error',
|
|
389
|
-
$.append($$anchor,
|
|
395
|
+
$.event('loadeddata', video_1, handleStringVideoLoad);
|
|
396
|
+
$.event('loadedmetadata', video_1, handleStringVideoLoad);
|
|
397
|
+
$.event('error', video_1, handleStringMediaError);
|
|
398
|
+
$.append($$anchor, video_1);
|
|
390
399
|
};
|
|
391
400
|
|
|
392
401
|
var alternate = ($$anchor) => {
|
|
393
402
|
var img = root_1();
|
|
394
403
|
|
|
404
|
+
$.bind_this(img, ($$value) => $.set(imageRef, $$value), () => $.get(imageRef));
|
|
405
|
+
|
|
395
406
|
$.template_effect(() => {
|
|
396
407
|
$.set_attribute(img, 'src', src());
|
|
397
408
|
$.set_attribute(img, 'alt', alt() ?? "");
|
|
@@ -3,6 +3,7 @@ import * as $ from 'svelte/internal/client';
|
|
|
3
3
|
import ComponentIcon from "../internal/component-icon/ComponentIcon.js";
|
|
4
4
|
import Frame from "./Frame.js";
|
|
5
5
|
import { resizable } from "../lib/resizable.js";
|
|
6
|
+
import { resizeManager } from "../logic/observer.js";
|
|
6
7
|
import { untrack } from "svelte";
|
|
7
8
|
import { useLocale } from "../i18n/locale.js";
|
|
8
9
|
import { mergeComponentPartProps, useComponentPart } from "../logic/component-parts.js";
|
|
@@ -14,7 +15,7 @@ var root_1 = $.from_html(`<span class="snowui-indicator-visual" aria-hidden="tru
|
|
|
14
15
|
|
|
15
16
|
const $$css = {
|
|
16
17
|
hash: 'svelte-1s2om4h',
|
|
17
|
-
code: ':where(.snowui-indicator) {display:block;box-sizing:border-box;flex:0 0 auto;font-size:var(--text-12);line-height:var(--leading-12);outline:none;touch-action:none;user-select:none;pointer-events:auto;}\n\n /* line 父级:与 pin 一样激活定位上下文,供 absolute 命中带参照 */:where(:has(> .snowui-indicator-line)) {position:relative;}\n\n /*\n * line 命中带:根节点 absolute 铺满边缘(尺寸由 inline style 的 top/bottom 或 left/right 保证)。\n * 视觉层保持短条。corner 仍用 pin + 局部放大命中。\n */:where(.snowui-indicator-line) {z-index:5;}:where(.snowui-indicator-line.snowui-indicator-width) {cursor:col-resize;}:where(.snowui-indicator-line.snowui-indicator-height) {cursor:row-resize;}:where(.snowui-indicator-corner)::before {content:"";position:absolute;inset:calc(var(--size-3) / -4);}:where(.snowui-indicator-visual) {position:absolute;display:block;border-radius:var(--radius-full, 9999px);background-color:currentColor;\n /* visual 自己拥有颜色,避免 Frame 根层的 color: inherit 受加载顺序影响。 */color:var(--snowui-indicator-color-override, var(--black-10, #0000001a));opacity:0;transition:color var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n opacity var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n width var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n height var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}\n\n /*\n * 视觉条:贴 pinOffset(--snowui-indicator-visual-inset),不随命中带中心。\n * 沿边缘方向长度默认 16px,可用 --snowui-indicator-visual-length 覆盖。\n */:where(.snowui-indicator-line.snowui-indicator-width.snowui-indicator-edge-start) > .snowui-indicator-visual {top:50%;left:var(--snowui-indicator-visual-inset, 0);width:calc(var(--size-3) / 6);height:var(--snowui-indicator-visual-length, var(--size-4));transform:translateY(-50%);}:where(.snowui-indicator-line.snowui-indicator-width.snowui-indicator-edge-end) > .snowui-indicator-visual {top:50%;right:var(--snowui-indicator-visual-inset, 0);left:auto;width:calc(var(--size-3) / 6);height:var(--snowui-indicator-visual-length, var(--size-4));transform:translateY(-50%);}:where(.snowui-indicator-line.snowui-indicator-height.snowui-indicator-edge-top) > .snowui-indicator-visual {top:var(--snowui-indicator-visual-inset, 0);left:50%;width:var(--snowui-indicator-visual-length, var(--size-4));height:calc(var(--size-3) / 6);transform:translateX(-50%);}:where(.snowui-indicator-line.snowui-indicator-height.snowui-indicator-edge-bottom) > .snowui-indicator-visual {bottom:var(--snowui-indicator-visual-inset, 0);top:auto;left:50%;width:var(--snowui-indicator-visual-length, var(--size-4));height:calc(var(--size-3) / 6);transform:translateX(-50%);}:where(.snowui-indicator[data-visible="true"]) > .snowui-indicator-visual {opacity:1;}:where(.snowui-indicator:hover) > .snowui-indicator-visual,\n :where(.snowui-indicator:focus-visible) > .snowui-indicator-visual,\n :where(.snowui-indicator[data-dragging="true"]) > .snowui-indicator-visual {color:var(--snowui-indicator-active-color-override, var(--black-20, #00000033));}:where(.snowui-indicator-line.snowui-indicator-width:hover) > .snowui-indicator-visual,\n :where(.snowui-indicator-line.snowui-indicator-width:focus-visible) > .snowui-indicator-visual,\n :where(.snowui-indicator-line.snowui-indicator-width[data-dragging="true"]) > .snowui-indicator-visual {width:calc(var(--size-3) / 3);}:where(.snowui-indicator-line.snowui-indicator-height:hover) > .snowui-indicator-visual,\n :where(.snowui-indicator-line.snowui-indicator-height:focus-visible) > .snowui-indicator-visual,\n :where(.snowui-indicator-line.snowui-indicator-height[data-dragging="true"]) > .snowui-indicator-visual {height:calc(var(--size-3) / 3);}:where(.snowui-indicator-corner) {width:var(--size-4);height:var(--size-4);z-index:6;}:where(.snowui-indicator-corner.snowui-indicator-width) {cursor:ew-resize;}:where(.snowui-indicator-corner.snowui-indicator-height) {cursor:ns-resize;}:where(.snowui-indicator-corner.snowui-indicator-both) {cursor:nwse-resize;}:where(.snowui-indicator-corner) > .snowui-indicator-visual {position:static;display:inline-flex;align-items:center;justify-content:center;border-radius:0;background:transparent;transform:none;}:where(.snowui-indicator-corner) > .snowui-indicator-visual svg:not([data-indicator-filter]) {display:block;width:100%;height:100%;\n /* 先合并不透明的填充与描边,再统一着色,避免透明颜色叠加。 */filter:var(--snowui-indicator-paint);\n /* 原资源在 16px 外框下为 1px 笔画;沿轮廓扩展至 2px / 4px。 */stroke:rgb(from currentColor r g b / 1);stroke-width:var(--snowui-indicator-corner-stroke, calc(var(--size-3) / 6));stroke-linejoin:round;transition:stroke-width var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-indicator-corner) > .snowui-indicator-visual svg:not([data-indicator-filter]) path {fill:rgb(from currentColor r g b / 1);}:where(.snowui-indicator-corner:hover),\n :where(.snowui-indicator-corner:focus-visible),\n :where(.snowui-indicator-corner[data-dragging="true"]) {--snowui-indicator-corner-stroke: calc(var(--size-3) / 2);}:where(.snowui-indicator[data-disabled="true"]) {cursor:default;pointer-events:none;}'
|
|
18
|
+
code: ':where(.snowui-indicator) {display:block;box-sizing:border-box;flex:0 0 auto;font-size:var(--text-12);line-height:var(--leading-12);outline:none;touch-action:none;user-select:none;pointer-events:auto;}\n\n /* line 父级:与 pin 一样激活定位上下文,供 absolute 命中带参照 */:where(:has(> .snowui-indicator-line)) {position:relative;}\n\n /*\n * line 命中带:根节点 absolute 铺满边缘(尺寸由 inline style 的 top/bottom 或 left/right 保证)。\n * 视觉层保持短条。corner 仍用 pin + 局部放大命中。\n */:where(.snowui-indicator-line) {z-index:5;}:where(.snowui-indicator[data-scrollbar-overlap="true"]) {pointer-events:none;}:where(.snowui-indicator)[data-scrollbar-overlap="true"] > .snowui-indicator-visual {opacity:0;}:where(.snowui-indicator-line.snowui-indicator-width) {cursor:col-resize;}:where(.snowui-indicator-line.snowui-indicator-height) {cursor:row-resize;}:where(.snowui-indicator-corner)::before {content:"";position:absolute;inset:calc(var(--size-3) / -4);}:where(.snowui-indicator-visual) {position:absolute;display:block;border-radius:var(--radius-full, 9999px);background-color:currentColor;\n /* visual 自己拥有颜色,避免 Frame 根层的 color: inherit 受加载顺序影响。 */color:var(--snowui-indicator-color-override, var(--black-10, #0000001a));opacity:0;transition:color var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n opacity var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n width var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out),\n height var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}\n\n /*\n * 视觉条:贴 pinOffset(--snowui-indicator-visual-inset),不随命中带中心。\n * 沿边缘方向长度默认 16px,可用 --snowui-indicator-visual-length 覆盖。\n */:where(.snowui-indicator-line.snowui-indicator-width.snowui-indicator-edge-start) > .snowui-indicator-visual {top:50%;left:var(--snowui-indicator-visual-inset, 0);width:calc(var(--size-3) / 6);height:var(--snowui-indicator-visual-length, var(--size-4));transform:translateY(-50%);}:where(.snowui-indicator-line.snowui-indicator-width.snowui-indicator-edge-end) > .snowui-indicator-visual {top:50%;right:var(--snowui-indicator-visual-inset, 0);left:auto;width:calc(var(--size-3) / 6);height:var(--snowui-indicator-visual-length, var(--size-4));transform:translateY(-50%);}:where(.snowui-indicator-line.snowui-indicator-height.snowui-indicator-edge-top) > .snowui-indicator-visual {top:var(--snowui-indicator-visual-inset, 0);left:50%;width:var(--snowui-indicator-visual-length, var(--size-4));height:calc(var(--size-3) / 6);transform:translateX(-50%);}:where(.snowui-indicator-line.snowui-indicator-height.snowui-indicator-edge-bottom) > .snowui-indicator-visual {bottom:var(--snowui-indicator-visual-inset, 0);top:auto;left:50%;width:var(--snowui-indicator-visual-length, var(--size-4));height:calc(var(--size-3) / 6);transform:translateX(-50%);}:where(.snowui-indicator[data-visible="true"]) > .snowui-indicator-visual {opacity:1;}:where(.snowui-indicator:hover) > .snowui-indicator-visual,\n :where(.snowui-indicator:focus-visible) > .snowui-indicator-visual,\n :where(.snowui-indicator[data-dragging="true"]) > .snowui-indicator-visual {color:var(--snowui-indicator-active-color-override, var(--black-20, #00000033));}:where(.snowui-indicator-line.snowui-indicator-width:hover) > .snowui-indicator-visual,\n :where(.snowui-indicator-line.snowui-indicator-width:focus-visible) > .snowui-indicator-visual,\n :where(.snowui-indicator-line.snowui-indicator-width[data-dragging="true"]) > .snowui-indicator-visual {width:calc(var(--size-3) / 3);}:where(.snowui-indicator-line.snowui-indicator-height:hover) > .snowui-indicator-visual,\n :where(.snowui-indicator-line.snowui-indicator-height:focus-visible) > .snowui-indicator-visual,\n :where(.snowui-indicator-line.snowui-indicator-height[data-dragging="true"]) > .snowui-indicator-visual {height:calc(var(--size-3) / 3);}:where(.snowui-indicator-corner) {width:var(--size-4);height:var(--size-4);z-index:6;}:where(.snowui-indicator-corner.snowui-indicator-width) {cursor:ew-resize;}:where(.snowui-indicator-corner.snowui-indicator-height) {cursor:ns-resize;}:where(.snowui-indicator-corner.snowui-indicator-both) {cursor:nwse-resize;}:where(.snowui-indicator-corner) > .snowui-indicator-visual {position:static;display:inline-flex;align-items:center;justify-content:center;border-radius:0;background:transparent;transform:none;}:where(.snowui-indicator-corner) > .snowui-indicator-visual svg:not([data-indicator-filter]) {display:block;width:100%;height:100%;\n /* 先合并不透明的填充与描边,再统一着色,避免透明颜色叠加。 */filter:var(--snowui-indicator-paint);\n /* 原资源在 16px 外框下为 1px 笔画;沿轮廓扩展至 2px / 4px。 */stroke:rgb(from currentColor r g b / 1);stroke-width:var(--snowui-indicator-corner-stroke, calc(var(--size-3) / 6));stroke-linejoin:round;transition:stroke-width var(--snowui-frame-color-motion-duration, 0.15s)\n var(--snowui-frame-color-motion-easing, ease-out);}:where(.snowui-indicator-corner) > .snowui-indicator-visual svg:not([data-indicator-filter]) path {fill:rgb(from currentColor r g b / 1);}:where(.snowui-indicator-corner:hover),\n :where(.snowui-indicator-corner:focus-visible),\n :where(.snowui-indicator-corner[data-dragging="true"]) {--snowui-indicator-corner-stroke: calc(var(--size-3) / 2);}:where(.snowui-indicator[data-disabled="true"]) {cursor:default;pointer-events:none;}'
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export default function Indicator($$anchor, $$props) {
|
|
@@ -94,6 +95,7 @@ export default function Indicator($$anchor, $$props) {
|
|
|
94
95
|
const indicatorId = `snowui-indicator-${++indicatorSeed}`;
|
|
95
96
|
let element = $.state(void 0);
|
|
96
97
|
let hostHovered = $.state(false);
|
|
98
|
+
let scrollbarOverlap = $.state(false);
|
|
97
99
|
let focused = $.state(false);
|
|
98
100
|
let dragging = $.state(false);
|
|
99
101
|
let resizeActions = [];
|
|
@@ -113,7 +115,7 @@ export default function Indicator($$anchor, $$props) {
|
|
|
113
115
|
const resolvedPinOffset = $.derived(() => $.get(pinOffset) ?? "var(--padding-1)");
|
|
114
116
|
const resolvedTarget = $.derived(() => $.get(target) ?? $.get(element)?.parentElement ?? undefined);
|
|
115
117
|
const resolvedRevealTarget = $.derived(() => $.get(revealTarget) ?? $.get(resolvedTarget));
|
|
116
|
-
const isVisible = $.derived(() => $.get(hostHovered) || $.get(focused) || $.get(dragging));
|
|
118
|
+
const isVisible = $.derived(() => !$.get(scrollbarOverlap) && ($.get(hostHovered) || $.get(focused) || $.get(dragging)));
|
|
117
119
|
|
|
118
120
|
const resolvedAriaLabel = $.derived(() => $.get(ariaLabel) ?? localeContext.t($.get(resolvedAxis) === "width"
|
|
119
121
|
? "indicator.resizeWidth"
|
|
@@ -242,6 +244,70 @@ export default function Indicator($$anchor, $$props) {
|
|
|
242
244
|
};
|
|
243
245
|
});
|
|
244
246
|
|
|
247
|
+
$.user_effect(() => {
|
|
248
|
+
const host = $.get(resolvedTarget);
|
|
249
|
+
const handle = $.get(element);
|
|
250
|
+
|
|
251
|
+
if (!host || !handle) return;
|
|
252
|
+
|
|
253
|
+
let frame = 0;
|
|
254
|
+
|
|
255
|
+
const update = () => {
|
|
256
|
+
frame = 0;
|
|
257
|
+
|
|
258
|
+
const rect = handle.getBoundingClientRect();
|
|
259
|
+
|
|
260
|
+
$.set(
|
|
261
|
+
scrollbarOverlap,
|
|
262
|
+
Array.from(host.querySelectorAll('.snowui-overlay-scrollbar[data-visible="true"] .snowui-overlay-scrollbar-thumb')).some((thumb) => {
|
|
263
|
+
const track = thumb.closest('.snowui-overlay-scrollbar');
|
|
264
|
+
|
|
265
|
+
if (!track || getComputedStyle(track).pointerEvents === 'none') return false;
|
|
266
|
+
|
|
267
|
+
const other = thumb.getBoundingClientRect();
|
|
268
|
+
|
|
269
|
+
return rect.left < other.right && rect.right > other.left && rect.top < other.bottom && rect.bottom > other.top;
|
|
270
|
+
}),
|
|
271
|
+
true
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
const schedule = () => {
|
|
276
|
+
if (!frame) frame = requestAnimationFrame(update);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const stopHostResize = resizeManager.watch(host, schedule);
|
|
280
|
+
const stopHandleResize = resizeManager.watch(handle, schedule);
|
|
281
|
+
const mutations = new MutationObserver(schedule);
|
|
282
|
+
|
|
283
|
+
mutations.observe(host, {
|
|
284
|
+
subtree: true,
|
|
285
|
+
childList: true,
|
|
286
|
+
attributes: true,
|
|
287
|
+
attributeFilter: ['style', 'class', 'data-visible', 'data-dragging']
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
host.addEventListener('scroll', schedule, true);
|
|
291
|
+
host.addEventListener('pointermove', schedule, true);
|
|
292
|
+
host.addEventListener('pointerenter', schedule, true);
|
|
293
|
+
host.addEventListener('pointerleave', schedule, true);
|
|
294
|
+
host.addEventListener('transitionend', schedule, true);
|
|
295
|
+
schedule();
|
|
296
|
+
|
|
297
|
+
return () => {
|
|
298
|
+
cancelAnimationFrame(frame);
|
|
299
|
+
stopHostResize();
|
|
300
|
+
stopHandleResize();
|
|
301
|
+
mutations.disconnect();
|
|
302
|
+
host.removeEventListener('scroll', schedule, true);
|
|
303
|
+
host.removeEventListener('pointermove', schedule, true);
|
|
304
|
+
host.removeEventListener('pointerenter', schedule, true);
|
|
305
|
+
host.removeEventListener('pointerleave', schedule, true);
|
|
306
|
+
host.removeEventListener('transitionend', schedule, true);
|
|
307
|
+
$.set(scrollbarOverlap, false);
|
|
308
|
+
};
|
|
309
|
+
});
|
|
310
|
+
|
|
245
311
|
$.user_effect(() => {
|
|
246
312
|
const host = $.get(resolvedTarget);
|
|
247
313
|
const handle = $.get(element);
|
|
@@ -289,12 +355,13 @@ export default function Indicator($$anchor, $$props) {
|
|
|
289
355
|
let $0 = $.derived(() => $.get(isVisible) ? "true" : undefined);
|
|
290
356
|
let $1 = $.derived(() => $.get(dragging) ? "true" : undefined);
|
|
291
357
|
let $2 = $.derived(() => $.get(disabled) ? "true" : undefined);
|
|
358
|
+
let $3 = $.derived(() => $.get(scrollbarOverlap) ? "true" : undefined);
|
|
292
359
|
|
|
293
|
-
let $
|
|
360
|
+
let $4 = $.derived(() => $.get(resolvedAxis) === "width"
|
|
294
361
|
? "vertical"
|
|
295
362
|
: $.get(resolvedAxis) === "height" ? "horizontal" : undefined);
|
|
296
363
|
|
|
297
|
-
let $
|
|
364
|
+
let $5 = $.derived(() => $.get(disabled) || $.get(scrollbarOverlap) ? -1 : 0);
|
|
298
365
|
|
|
299
366
|
Frame($$anchor, $.spread_props(() => $.get(rest), {
|
|
300
367
|
tag: 'span',
|
|
@@ -345,17 +412,21 @@ export default function Indicator($$anchor, $$props) {
|
|
|
345
412
|
get 'data-disabled'() {
|
|
346
413
|
return $.get($2);
|
|
347
414
|
},
|
|
415
|
+
|
|
416
|
+
get 'data-scrollbar-overlap'() {
|
|
417
|
+
return $.get($3);
|
|
418
|
+
},
|
|
348
419
|
role: 'separator',
|
|
349
420
|
get 'aria-label'() {
|
|
350
421
|
return $.get(resolvedAriaLabel);
|
|
351
422
|
},
|
|
352
423
|
|
|
353
424
|
get 'aria-orientation'() {
|
|
354
|
-
return $.get($
|
|
425
|
+
return $.get($4);
|
|
355
426
|
},
|
|
356
427
|
|
|
357
428
|
get tabindex() {
|
|
358
|
-
return $.get($
|
|
429
|
+
return $.get($5);
|
|
359
430
|
},
|
|
360
431
|
enableAutoLayout: false,
|
|
361
432
|
get enableResponsive() {
|