@marianmeres/stuic 1.125.0 → 2.0.0-next.2
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 +2 -8
- package/dist/_shared.css +2 -0
- package/dist/actions/autogrow.svelte.d.ts +6 -0
- package/dist/actions/autogrow.svelte.js +19 -0
- package/dist/actions/highlight-dragover.svelte.d.ts +7 -0
- package/dist/actions/highlight-dragover.svelte.js +38 -0
- package/dist/actions/index.d.ts +7 -0
- package/dist/actions/index.js +7 -0
- package/dist/actions/on-submit-validity-check.svelte.d.ts +15 -0
- package/dist/actions/on-submit-validity-check.svelte.js +58 -0
- package/dist/actions/tooltip/index.css +34 -0
- package/dist/actions/tooltip/tooltip.svelte.d.ts +13 -0
- package/dist/actions/tooltip/tooltip.svelte.js +203 -0
- package/dist/actions/trim.svelte.d.ts +4 -0
- package/dist/actions/trim.svelte.js +17 -0
- package/dist/actions/{validate.d.ts → validate.svelte.d.ts} +8 -8
- package/dist/actions/validate.svelte.js +90 -0
- package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte +59 -385
- package/dist/components/AlertConfirmPrompt/AlertConfirmPrompt.svelte.d.ts +9 -101
- package/dist/components/AlertConfirmPrompt/Current.svelte +202 -0
- package/dist/components/AlertConfirmPrompt/Current.svelte.d.ts +22 -0
- package/dist/components/AlertConfirmPrompt/acp-icons.d.ts +7 -2
- package/dist/components/AlertConfirmPrompt/acp-icons.js +8 -8
- package/dist/components/AlertConfirmPrompt/alert-confirm-prompt-stack.svelte.d.ts +63 -0
- package/dist/components/AlertConfirmPrompt/alert-confirm-prompt-stack.svelte.js +144 -0
- package/dist/components/AlertConfirmPrompt/index.d.ts +2 -0
- package/dist/components/AlertConfirmPrompt/index.js +2 -0
- package/dist/components/AnimatedElipsis/AnimatedEllipsis.svelte +47 -0
- package/dist/components/AnimatedElipsis/AnimatedEllipsis.svelte.d.ts +7 -0
- package/dist/components/AnimatedElipsis/index.d.ts +1 -0
- package/dist/components/AnimatedElipsis/index.js +1 -0
- package/dist/components/AppShell/AppShell.svelte +188 -127
- package/dist/components/AppShell/AppShell.svelte.d.ts +62 -43
- package/dist/components/AppShell/index.d.ts +1 -0
- package/dist/components/AppShell/index.js +1 -0
- package/dist/components/Backdrop/Backdrop.svelte +149 -49
- package/dist/components/Backdrop/Backdrop.svelte.d.ts +22 -37
- package/dist/components/Backdrop/index.d.ts +1 -0
- package/dist/components/Backdrop/index.js +1 -0
- package/dist/components/Button/Button.svelte +122 -146
- package/dist/components/Button/Button.svelte.d.ts +22 -80
- package/dist/components/Button/index.css +16 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +1 -0
- package/dist/components/ColResize/ColResize.svelte +0 -0
- package/dist/components/ColResize/ColResize.svelte.d.ts +26 -0
- package/dist/components/ColorScheme/{LocalColorScheme.svelte → ColorSchemeLocal.svelte} +2 -2
- package/dist/components/ColorScheme/ColorSchemeLocal.svelte.d.ts +26 -0
- package/dist/components/ColorScheme/{SystemAwareColorScheme.svelte → ColorSchemeSystemAware.svelte} +4 -4
- package/dist/components/ColorScheme/ColorSchemeSystemAware.svelte.d.ts +26 -0
- package/dist/components/ColorScheme/color-scheme.d.ts +26 -8
- package/dist/components/ColorScheme/color-scheme.js +40 -16
- package/dist/components/ColorScheme/index.d.ts +3 -0
- package/dist/components/ColorScheme/index.js +3 -0
- package/dist/components/DismissibleMessage/DismissibleMessage.svelte +76 -83
- package/dist/components/DismissibleMessage/DismissibleMessage.svelte.d.ts +16 -37
- package/dist/components/DismissibleMessage/index.css +13 -0
- package/dist/components/DismissibleMessage/index.d.ts +1 -0
- package/dist/components/DismissibleMessage/index.js +1 -0
- package/dist/components/Drawer/Drawer.svelte +155 -84
- package/dist/components/Drawer/Drawer.svelte.d.ts +24 -35
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.js +1 -0
- package/dist/components/HoverExpandableWidth/HoverExpandableWidth.svelte +150 -111
- package/dist/components/HoverExpandableWidth/HoverExpandableWidth.svelte.d.ts +16 -29
- package/dist/components/HoverExpandableWidth/index.d.ts +1 -0
- package/dist/components/HoverExpandableWidth/index.js +1 -0
- package/dist/components/Input/FieldCheckbox.svelte +174 -132
- package/dist/components/Input/FieldCheckbox.svelte.d.ts +28 -64
- package/dist/components/Input/FieldFile.svelte +166 -0
- package/dist/components/Input/FieldFile.svelte.d.ts +41 -0
- package/dist/components/Input/FieldInput.svelte +143 -0
- package/dist/components/Input/FieldInput.svelte.d.ts +41 -0
- package/dist/components/Input/FieldLikeButton.svelte +206 -0
- package/dist/components/Input/FieldLikeButton.svelte.d.ts +41 -0
- package/dist/components/Input/FieldOptions.svelte +646 -0
- package/dist/components/Input/FieldOptions.svelte.d.ts +58 -0
- package/dist/components/Input/FieldRadios.svelte +126 -77
- package/dist/components/Input/FieldRadios.svelte.d.ts +23 -61
- package/dist/components/Input/FieldSelect.svelte +160 -239
- package/dist/components/Input/FieldSelect.svelte.d.ts +40 -88
- package/dist/components/Input/FieldSwitch.svelte +132 -0
- package/dist/components/Input/FieldSwitch.svelte.d.ts +41 -0
- package/dist/components/Input/FieldTextarea.svelte +146 -0
- package/dist/components/Input/FieldTextarea.svelte.d.ts +44 -0
- package/dist/components/Input/Fieldset.svelte +21 -17
- package/dist/components/Input/Fieldset.svelte.d.ts +10 -27
- package/dist/components/Input/_internal/FieldRadioInternal.svelte +186 -0
- package/dist/components/Input/_internal/FieldRadioInternal.svelte.d.ts +30 -0
- package/dist/components/Input/_internal/InputWrap.svelte +216 -0
- package/dist/components/Input/_internal/InputWrap.svelte.d.ts +36 -0
- package/dist/components/Input/index.css +134 -0
- package/dist/components/Input/index.d.ts +11 -0
- package/dist/components/Input/index.js +11 -0
- package/dist/components/Input/types.d.ts +11 -0
- package/dist/components/KbdShortcut/KbdShortcut.svelte +89 -0
- package/dist/components/KbdShortcut/KbdShortcut.svelte.d.ts +17 -0
- package/dist/components/KbdShortcut/index.d.ts +1 -0
- package/dist/components/KbdShortcut/index.js +1 -0
- package/dist/components/Modal/Modal.svelte +127 -0
- package/dist/components/Modal/Modal.svelte.d.ts +32 -0
- package/dist/components/Modal/index.d.ts +1 -0
- package/dist/components/Modal/index.js +1 -0
- package/dist/components/ModalDialog/ModalDialog.svelte +137 -81
- package/dist/components/ModalDialog/ModalDialog.svelte.d.ts +17 -38
- package/dist/components/ModalDialog/index.d.ts +1 -0
- package/dist/components/ModalDialog/index.js +1 -0
- package/dist/components/Notifications/Notifications.svelte +259 -173
- package/dist/components/Notifications/Notifications.svelte.d.ts +32 -60
- package/dist/components/Notifications/index.css +12 -0
- package/dist/components/Notifications/index.d.ts +2 -0
- package/dist/components/Notifications/index.js +2 -0
- package/dist/components/Notifications/notifications-icons.d.ts +1 -1
- package/dist/components/Notifications/notifications-icons.js +4 -4
- package/dist/components/Notifications/notifications-stack.svelte.d.ts +89 -0
- package/dist/components/Notifications/notifications-stack.svelte.js +161 -0
- package/dist/components/Progress/Progress.svelte +26 -0
- package/dist/components/Progress/Progress.svelte.d.ts +10 -0
- package/dist/components/Progress/_internal/Bar.svelte +31 -0
- package/dist/components/Progress/_internal/Bar.svelte.d.ts +10 -0
- package/dist/components/Progress/_internal/Circle.svelte +10 -0
- package/dist/components/Progress/_internal/Circle.svelte.d.ts +7 -0
- package/dist/components/Progress/index.css +7 -0
- package/dist/components/Progress/index.d.ts +1 -0
- package/dist/components/Progress/index.js +1 -0
- package/dist/components/Spinner/Spinner.svelte +52 -37
- package/dist/components/Spinner/Spinner.svelte.d.ts +10 -22
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +1 -0
- package/dist/components/Switch/Switch.svelte +158 -118
- package/dist/components/Switch/Switch.svelte.d.ts +25 -66
- package/dist/components/Switch/SwitchButton.svelte +131 -0
- package/dist/components/Switch/SwitchButton.svelte.d.ts +21 -0
- package/dist/components/Switch/index.css +7 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Thc/Thc.svelte +67 -10
- package/dist/components/Thc/Thc.svelte.d.ts +18 -22
- package/dist/components/Thc/index.d.ts +1 -0
- package/dist/components/Thc/index.js +1 -0
- package/dist/components/TwCheck/TwCheck.svelte +34 -0
- package/dist/components/TwCheck/TwCheck.svelte.d.ts +10 -0
- package/dist/components/TwCheck/index.css +5 -0
- package/dist/components/TwCheck/index.d.ts +1 -0
- package/dist/components/TwCheck/index.js +1 -0
- package/dist/components/X/X.svelte +12 -5
- package/dist/components/X/X.svelte.d.ts +6 -18
- package/dist/components/X/index.d.ts +1 -0
- package/dist/components/X/index.js +1 -0
- package/dist/index.css +26 -0
- package/dist/index.d.ts +21 -39
- package/dist/index.js +23 -54
- package/dist/types.d.ts +251 -2
- package/dist/types.js +248 -0
- package/dist/utils/breakpoint.svelte.d.ts +19 -0
- package/dist/utils/breakpoint.svelte.js +42 -0
- package/dist/utils/debounce.d.ts +13 -0
- package/dist/utils/debounce.js +22 -0
- package/dist/utils/device-pointer.svelte.d.ts +11 -0
- package/dist/utils/device-pointer.svelte.js +26 -0
- package/dist/utils/event-modifiers.d.ts +4 -0
- package/dist/utils/event-modifiers.js +29 -0
- package/dist/utils/get-id.d.ts +1 -1
- package/dist/utils/get-id.js +3 -1
- package/dist/utils/index.d.ts +21 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/is-browser.d.ts +1 -0
- package/dist/utils/is-browser.js +5 -0
- package/dist/utils/is-mac.d.ts +1 -0
- package/dist/utils/is-mac.js +11 -0
- package/dist/utils/maybe-json-parse.d.ts +1 -0
- package/dist/utils/maybe-json-parse.js +12 -0
- package/dist/utils/maybe-json-stringify.d.ts +1 -0
- package/dist/utils/maybe-json-stringify.js +11 -0
- package/dist/utils/move-array-item.d.ts +4 -0
- package/dist/utils/move-array-item.js +20 -0
- package/dist/utils/omit-pick.d.ts +2 -2
- package/dist/utils/omit-pick.js +10 -8
- package/dist/utils/paint.d.ts +18 -0
- package/dist/utils/paint.js +32 -0
- package/dist/utils/persistent-state.svelte.d.ts +23 -0
- package/dist/utils/persistent-state.svelte.js +48 -0
- package/dist/utils/prefers-reduced-motion.svelte.d.ts +2 -0
- package/dist/utils/prefers-reduced-motion.svelte.js +4 -0
- package/dist/utils/qsa.d.ts +1 -0
- package/dist/utils/qsa.js +3 -0
- package/dist/utils/sleep.d.ts +28 -0
- package/dist/utils/sleep.js +33 -0
- package/dist/utils/storage-abstraction.d.ts +35 -0
- package/dist/utils/storage-abstraction.js +136 -0
- package/dist/utils/str-hash.d.ts +7 -0
- package/dist/utils/str-hash.js +35 -0
- package/dist/utils/throttle.d.ts +1 -0
- package/dist/utils/throttle.js +47 -0
- package/dist/utils/to-integer.d.ts +1 -0
- package/dist/utils/to-integer.js +11 -0
- package/dist/utils/tr.d.ts +5 -0
- package/dist/utils/tr.js +13 -0
- package/dist/utils/tw-merge.d.ts +10 -0
- package/dist/utils/tw-merge.js +16 -0
- package/dist/utils/ucfirst.d.ts +1 -0
- package/dist/utils/ucfirst.js +6 -0
- package/package.json +66 -73
- package/dist/actions/autogrow.d.ts +0 -8
- package/dist/actions/autogrow.js +0 -22
- package/dist/actions/autoscroll.d.ts +0 -21
- package/dist/actions/autoscroll.js +0 -60
- package/dist/actions/drag-drop.d.ts +0 -28
- package/dist/actions/drag-drop.js +0 -152
- package/dist/actions/on-outside.d.ts +0 -9
- package/dist/actions/on-outside.js +0 -27
- package/dist/actions/pre-submit-validity-check.d.ts +0 -3
- package/dist/actions/pre-submit-validity-check.js +0 -21
- package/dist/actions/tooltip/_make-visible.d.ts +0 -3
- package/dist/actions/tooltip/_make-visible.js +0 -25
- package/dist/actions/tooltip/_maybe-pick-safe-placement.d.ts +0 -3
- package/dist/actions/tooltip/_maybe-pick-safe-placement.js +0 -86
- package/dist/actions/tooltip/_set-position.d.ts +0 -2
- package/dist/actions/tooltip/_set-position.js +0 -125
- package/dist/actions/tooltip/tooltip.d.ts +0 -42
- package/dist/actions/tooltip/tooltip.js +0 -299
- package/dist/actions/trim.d.ts +0 -4
- package/dist/actions/trim.js +0 -18
- package/dist/actions/validate.js +0 -80
- package/dist/components/AlertConfirmPrompt/alert-confirm-prompt.d.ts +0 -58
- package/dist/components/AlertConfirmPrompt/alert-confirm-prompt.js +0 -141
- package/dist/components/ColorScheme/LocalColorScheme.svelte.d.ts +0 -25
- package/dist/components/ColorScheme/SystemAwareColorScheme.svelte.d.ts +0 -25
- package/dist/components/Input/Field.svelte +0 -315
- package/dist/components/Input/Field.svelte.d.ts +0 -102
- package/dist/components/Input/PinInput.svelte +0 -151
- package/dist/components/Input/PinInput.svelte.d.ts +0 -51
- package/dist/components/Input/XFieldRadioInternal.svelte +0 -143
- package/dist/components/Input/XFieldRadioInternal.svelte.d.ts +0 -45
- package/dist/components/Notifications/notifications.d.ts +0 -78
- package/dist/components/Notifications/notifications.js +0 -215
- package/dist/components/Popover/Popover.svelte +0 -24
- package/dist/components/Popover/Popover.svelte.d.ts +0 -22
- package/dist/components/Spinner/Spinner.v5.svelte +0 -114
- package/dist/components/Spinner/Spinner.v5.svelte.d.ts +0 -16
- package/dist/utils/calculate-alignment.d.ts +0 -68
- package/dist/utils/calculate-alignment.js +0 -183
- package/dist/utils/device-pointer.d.ts +0 -5
- package/dist/utils/device-pointer.js +0 -10
- package/dist/utils/prefers-reduced-motion.d.ts +0 -6
- package/dist/utils/prefers-reduced-motion.js +0 -26
- package/dist/utils/tw-merge2.d.ts +0 -3
- package/dist/utils/tw-merge2.js +0 -9
- package/dist/utils/tw-types.d.ts +0 -1
- package/dist/utils/window-size.d.ts +0 -22
- package/dist/utils/window-size.js +0 -35
- /package/dist/{utils/tw-types.js → components/Input/types.js} +0 -0
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export interface AreaLike {
|
|
2
|
-
width: number;
|
|
3
|
-
height: number;
|
|
4
|
-
}
|
|
5
|
-
export interface PositionLike {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
}
|
|
9
|
-
export interface RectLike extends AreaLike, PositionLike {
|
|
10
|
-
}
|
|
11
|
-
export type Alignment = 'top' | 'topRight' | 'topLeft' | 'right' | 'rightTop' | 'rightBottom' | 'bottom' | 'bottomRight' | 'bottomLeft' | 'left' | 'leftTop' | 'leftBottom';
|
|
12
|
-
export declare const calculateAlignment: (boundaryRoot: RectLike, anchor: RectLike, el: AreaLike, offset?: number) => {
|
|
13
|
-
origin: {
|
|
14
|
-
top: {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
};
|
|
18
|
-
topRight: {
|
|
19
|
-
x: number;
|
|
20
|
-
y: number;
|
|
21
|
-
};
|
|
22
|
-
topLeft: {
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
};
|
|
26
|
-
bottom: {
|
|
27
|
-
x: number;
|
|
28
|
-
y: number;
|
|
29
|
-
};
|
|
30
|
-
bottomRight: {
|
|
31
|
-
x: number;
|
|
32
|
-
y: number;
|
|
33
|
-
};
|
|
34
|
-
bottomLeft: {
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
};
|
|
38
|
-
left: {
|
|
39
|
-
x: number;
|
|
40
|
-
y: number;
|
|
41
|
-
};
|
|
42
|
-
leftTop: {
|
|
43
|
-
x: number;
|
|
44
|
-
y: number;
|
|
45
|
-
};
|
|
46
|
-
leftBottom: {
|
|
47
|
-
x: number;
|
|
48
|
-
y: number;
|
|
49
|
-
};
|
|
50
|
-
right: {
|
|
51
|
-
x: number;
|
|
52
|
-
y: number;
|
|
53
|
-
};
|
|
54
|
-
rightTop: {
|
|
55
|
-
x: number;
|
|
56
|
-
y: number;
|
|
57
|
-
};
|
|
58
|
-
rightBottom: {
|
|
59
|
-
x: number;
|
|
60
|
-
y: number;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
position: Record<Alignment, PositionLike & {
|
|
64
|
-
safeY: boolean;
|
|
65
|
-
safeX: boolean;
|
|
66
|
-
safe: boolean;
|
|
67
|
-
}>;
|
|
68
|
-
};
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
const clog = console.log;
|
|
2
|
-
// just basic plus/minus stuff
|
|
3
|
-
export const calculateAlignment = (boundaryRoot,
|
|
4
|
-
// anchor box
|
|
5
|
-
anchor,
|
|
6
|
-
// element to be placed (the one we're calculating position for)
|
|
7
|
-
el,
|
|
8
|
-
// in px
|
|
9
|
-
offset = 5) => {
|
|
10
|
-
const anchorHalfWidth = anchor.width / 2;
|
|
11
|
-
const anchorHalfHeight = anchor.height / 2;
|
|
12
|
-
// x/y of the origin (center of the anchor with applied offset) position
|
|
13
|
-
const originTop = { x: anchor.x + anchorHalfWidth, y: anchor.y - offset };
|
|
14
|
-
const originBottom = {
|
|
15
|
-
x: anchor.x + anchorHalfWidth,
|
|
16
|
-
y: anchor.y + anchor.height + offset,
|
|
17
|
-
};
|
|
18
|
-
const originLeft = { x: anchor.x - offset, y: anchor.y + anchorHalfHeight };
|
|
19
|
-
const originRight = {
|
|
20
|
-
x: anchor.x + anchor.width + offset,
|
|
21
|
-
y: anchor.y + anchorHalfHeight,
|
|
22
|
-
};
|
|
23
|
-
const origin = {
|
|
24
|
-
top: originTop,
|
|
25
|
-
topRight: originTop,
|
|
26
|
-
topLeft: originTop,
|
|
27
|
-
//
|
|
28
|
-
bottom: originBottom,
|
|
29
|
-
bottomRight: originBottom,
|
|
30
|
-
bottomLeft: originBottom,
|
|
31
|
-
//
|
|
32
|
-
left: originLeft,
|
|
33
|
-
leftTop: originLeft,
|
|
34
|
-
leftBottom: originLeft,
|
|
35
|
-
//
|
|
36
|
-
right: originRight,
|
|
37
|
-
rightTop: originRight,
|
|
38
|
-
rightBottom: originRight,
|
|
39
|
-
};
|
|
40
|
-
const elHalfWidth = el.width / 2;
|
|
41
|
-
const elHalfHeigh = el.height / 2;
|
|
42
|
-
// position is named from the "anchor alignment" relative perspective
|
|
43
|
-
const position = {
|
|
44
|
-
//
|
|
45
|
-
top: {
|
|
46
|
-
x: origin.top.x - elHalfWidth,
|
|
47
|
-
y: origin.top.y - el.height,
|
|
48
|
-
safeX: true,
|
|
49
|
-
safeY: true,
|
|
50
|
-
safe: true,
|
|
51
|
-
},
|
|
52
|
-
topRight: {
|
|
53
|
-
x: origin.top.x + anchorHalfWidth - el.width,
|
|
54
|
-
y: origin.top.y - el.height,
|
|
55
|
-
safeX: true,
|
|
56
|
-
safeY: true,
|
|
57
|
-
safe: true,
|
|
58
|
-
},
|
|
59
|
-
topLeft: {
|
|
60
|
-
x: origin.top.x - anchorHalfWidth,
|
|
61
|
-
y: origin.top.y - el.height,
|
|
62
|
-
safeX: true,
|
|
63
|
-
safeY: true,
|
|
64
|
-
safe: true,
|
|
65
|
-
},
|
|
66
|
-
right: {
|
|
67
|
-
x: origin.right.x,
|
|
68
|
-
y: origin.right.y - elHalfHeigh,
|
|
69
|
-
safeX: true,
|
|
70
|
-
safeY: true,
|
|
71
|
-
safe: true,
|
|
72
|
-
},
|
|
73
|
-
rightTop: {
|
|
74
|
-
x: origin.right.x,
|
|
75
|
-
y: origin.right.y - anchorHalfHeight,
|
|
76
|
-
safeX: true,
|
|
77
|
-
safeY: true,
|
|
78
|
-
safe: true,
|
|
79
|
-
},
|
|
80
|
-
rightBottom: {
|
|
81
|
-
x: origin.right.x,
|
|
82
|
-
y: origin.right.y + anchorHalfHeight - el.height,
|
|
83
|
-
safeX: true,
|
|
84
|
-
safeY: true,
|
|
85
|
-
safe: true,
|
|
86
|
-
},
|
|
87
|
-
//
|
|
88
|
-
bottom: {
|
|
89
|
-
x: origin.bottom.x - elHalfWidth,
|
|
90
|
-
y: origin.bottom.y,
|
|
91
|
-
safeX: true,
|
|
92
|
-
safeY: true,
|
|
93
|
-
safe: true,
|
|
94
|
-
},
|
|
95
|
-
bottomLeft: {
|
|
96
|
-
x: origin.bottom.x - anchorHalfWidth,
|
|
97
|
-
y: origin.bottom.y,
|
|
98
|
-
safeX: true,
|
|
99
|
-
safeY: true,
|
|
100
|
-
safe: true,
|
|
101
|
-
},
|
|
102
|
-
bottomRight: {
|
|
103
|
-
x: origin.bottom.x + anchorHalfWidth - el.width,
|
|
104
|
-
y: origin.bottom.y,
|
|
105
|
-
safeX: true,
|
|
106
|
-
safeY: true,
|
|
107
|
-
safe: true,
|
|
108
|
-
},
|
|
109
|
-
//
|
|
110
|
-
left: {
|
|
111
|
-
x: origin.left.x - el.width,
|
|
112
|
-
y: origin.left.y - elHalfHeigh,
|
|
113
|
-
safeX: true,
|
|
114
|
-
safeY: true,
|
|
115
|
-
safe: true,
|
|
116
|
-
},
|
|
117
|
-
leftTop: {
|
|
118
|
-
x: origin.left.x - el.width,
|
|
119
|
-
y: origin.left.y - anchorHalfHeight,
|
|
120
|
-
safeX: true,
|
|
121
|
-
safeY: true,
|
|
122
|
-
safe: true,
|
|
123
|
-
},
|
|
124
|
-
leftBottom: {
|
|
125
|
-
x: origin.left.x - el.width,
|
|
126
|
-
y: origin.left.y + anchorHalfHeight - el.height,
|
|
127
|
-
safeX: true,
|
|
128
|
-
safeY: true,
|
|
129
|
-
safe: true,
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
const isSafeX = (x) => x >= boundaryRoot.x && x + el.width <= boundaryRoot.x + boundaryRoot.width;
|
|
133
|
-
const isSafeY = (y) => y >= boundaryRoot.y && y + el.height <= boundaryRoot.y + boundaryRoot.height;
|
|
134
|
-
//
|
|
135
|
-
Object.entries(position).forEach((entry) => {
|
|
136
|
-
const [plc, { x, y }] = entry;
|
|
137
|
-
position[plc].safeX = isSafeX(x);
|
|
138
|
-
position[plc].safeY = isSafeY(y);
|
|
139
|
-
position[plc].safe = position[plc].safeX && position[plc].safeY;
|
|
140
|
-
});
|
|
141
|
-
// now, the positions were calculated, but so far, we're too strict, so there will
|
|
142
|
-
// be unnecessary false negatives, which can be relaxed using "fluid" approach
|
|
143
|
-
// must come below safety check above
|
|
144
|
-
const fluid = {
|
|
145
|
-
x: {
|
|
146
|
-
top: Math.max(0, position.top.x),
|
|
147
|
-
topLeft: position.topLeft.x - (position.topLeft.x + el.width - boundaryRoot.width),
|
|
148
|
-
topRight: Math.max(0, position.topRight.x),
|
|
149
|
-
//
|
|
150
|
-
bottom: Math.max(0, position.bottom.x),
|
|
151
|
-
bottomLeft: position.bottomLeft.x - (position.bottomLeft.x + el.width - boundaryRoot.width),
|
|
152
|
-
bottomRight: Math.max(0, position.bottomRight.x),
|
|
153
|
-
},
|
|
154
|
-
y: {
|
|
155
|
-
// right: position.top.y - (position.top.y + el.height - boundaryRoot.height),
|
|
156
|
-
right: Math.max(0, position.right.y),
|
|
157
|
-
rightTop: Math.max(0, position.rightTop.y),
|
|
158
|
-
rightBottom: Math.max(0, position.rightBottom.y),
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
// x axis
|
|
162
|
-
if (el.width < boundaryRoot.width && anchor.x > 0) {
|
|
163
|
-
['top', 'topLeft', 'topRight', 'bottom', 'bottomLeft', 'bottomRight'].forEach((k) => {
|
|
164
|
-
if (!position[k].safeX && fluid.x?.[k] !== undefined) {
|
|
165
|
-
position[k].x = fluid.x[k];
|
|
166
|
-
position[k].safeX = isSafeX(position[k].x);
|
|
167
|
-
position[k].safe = position[k].safeX && position[k].safeY;
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
// y
|
|
172
|
-
if (el.height < boundaryRoot.height && anchor.y > 0) {
|
|
173
|
-
['right', 'rightTop', 'rightBottom', 'left', 'leftTop', 'leftBottom'].forEach((k) => {
|
|
174
|
-
if (!position[k].safeY && fluid.y?.[k] !== undefined) {
|
|
175
|
-
position[k].y = fluid.y[k];
|
|
176
|
-
position[k].safeY = isSafeY(position[k].y);
|
|
177
|
-
position[k].safe = position[k].safeX && position[k].safeY;
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
// todo y fluids
|
|
182
|
-
return { origin, position };
|
|
183
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const _window = typeof window !== 'undefined' ? window : null;
|
|
2
|
-
export class DevicePointer {
|
|
3
|
-
// none - The primary input mechanism does not include a pointing device.
|
|
4
|
-
static isNone = _window?.matchMedia('(any-pointer:none)').matches;
|
|
5
|
-
// coarse - The primary input mechanism includes a pointing device of limited accuracy,
|
|
6
|
-
// such as a finger on a touchscreen.
|
|
7
|
-
static isCoarse = _window?.matchMedia('(any-pointer:coarse)').matches;
|
|
8
|
-
// fine - The primary input mechanism includes an accurate pointing device, such as a mouse.
|
|
9
|
-
static isFine = _window?.matchMedia('(any-pointer:fine)').matches;
|
|
10
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { readable } from 'svelte/store';
|
|
2
|
-
import { BROWSER } from 'esm-env';
|
|
3
|
-
/** Prefers reduced motion */
|
|
4
|
-
const reducedMotionQuery = '(prefers-reduced-motion: reduce)';
|
|
5
|
-
function prefersReducedMotion() {
|
|
6
|
-
if (!BROWSER)
|
|
7
|
-
return false;
|
|
8
|
-
return window.matchMedia(reducedMotionQuery).matches;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Indicates that the user has enabled reduced motion on their device.
|
|
12
|
-
*
|
|
13
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
|
|
14
|
-
*/
|
|
15
|
-
export const prefersReducedMotionStore = readable(prefersReducedMotion(), (set) => {
|
|
16
|
-
if (BROWSER) {
|
|
17
|
-
const setReducedMotion = (event) => {
|
|
18
|
-
set(event.matches);
|
|
19
|
-
};
|
|
20
|
-
const mediaQueryList = window.matchMedia(reducedMotionQuery);
|
|
21
|
-
mediaQueryList.addEventListener('change', setReducedMotion);
|
|
22
|
-
return () => {
|
|
23
|
-
mediaQueryList.removeEventListener('change', setReducedMotion);
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
});
|
package/dist/utils/tw-merge2.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { twMerge } from 'tailwind-merge';
|
|
2
|
-
export const clsClean = (s) => {
|
|
3
|
-
if (Array.isArray(s))
|
|
4
|
-
s = s.join(' ');
|
|
5
|
-
return `${s || ''}`.replace(/\s+/g, ' ').trim();
|
|
6
|
-
};
|
|
7
|
-
// twMerge does not seem to handle "\r", "\n" and/or "\t" within the input strings correctly,
|
|
8
|
-
// so we need to do the cleanup ourselves
|
|
9
|
-
export const twMerge2 = (...args) => twMerge(...args.map(clsClean));
|
package/dist/utils/tw-types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type TW_COLORS = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const windowSize: {
|
|
2
|
-
touch: () => void;
|
|
3
|
-
subscribe(this: void, run: import("svelte/store").Subscriber<{
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
scale: number;
|
|
7
|
-
}>, invalidate?: import("svelte/store").Invalidator<{
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
scale: number;
|
|
11
|
-
}> | undefined): import("svelte/store").Unsubscriber;
|
|
12
|
-
};
|
|
13
|
-
interface Breakpoint {
|
|
14
|
-
__current__: null | string;
|
|
15
|
-
sm: boolean;
|
|
16
|
-
md: boolean;
|
|
17
|
-
lg: boolean;
|
|
18
|
-
xl: boolean;
|
|
19
|
-
'2xl': boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare const breakpoint: import("svelte/store").Readable<Breakpoint>;
|
|
22
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { derived, writable } from 'svelte/store';
|
|
2
|
-
const _window = typeof window !== 'undefined' ? window : null;
|
|
3
|
-
const getWindowSize = () => {
|
|
4
|
-
const { width, height, scale } = _window?.visualViewport || {
|
|
5
|
-
width: 0,
|
|
6
|
-
height: 0,
|
|
7
|
-
scale: 1,
|
|
8
|
-
};
|
|
9
|
-
return { width, height, scale };
|
|
10
|
-
};
|
|
11
|
-
let _trigger = writable(0);
|
|
12
|
-
export const windowSize = {
|
|
13
|
-
...derived([_trigger], ([_]) => getWindowSize()),
|
|
14
|
-
touch: () => _trigger.set(Date.now()),
|
|
15
|
-
};
|
|
16
|
-
// init now!
|
|
17
|
-
windowSize.touch();
|
|
18
|
-
// intentionally not debounced
|
|
19
|
-
_window?.visualViewport?.addEventListener('resize', windowSize.touch);
|
|
20
|
-
_window?.visualViewport?.addEventListener('scroll', windowSize.touch);
|
|
21
|
-
export const breakpoint = derived([windowSize], ([{ width: w }]) => {
|
|
22
|
-
const list = [
|
|
23
|
-
['sm', 640],
|
|
24
|
-
['md', 768],
|
|
25
|
-
['lg', 1024],
|
|
26
|
-
['xl', 1280],
|
|
27
|
-
['2xl', 1536],
|
|
28
|
-
];
|
|
29
|
-
// return list.reduce<string | null>((m, [k, v]) => (w && w >= v ? k : m), null);
|
|
30
|
-
return list.reduce((m, [k, v]) => {
|
|
31
|
-
const flag = w && w >= v;
|
|
32
|
-
m = { ...m, [k]: flag, __current__: flag ? k : m.__current__ };
|
|
33
|
-
return m;
|
|
34
|
-
}, { __current__: null, sm: false, md: false, lg: false, xl: false, '2xl': false });
|
|
35
|
-
});
|
|
File without changes
|