@hkdigital/lib-sveltekit 0.2.8 → 0.2.10
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 +135 -135
- package/dist/assets/autospuiten/car-paint-picker.js +41 -41
- package/dist/assets/autospuiten/labels.js +7 -7
- package/dist/classes/cache/IndexedDbCache.js +1407 -1407
- package/dist/classes/cache/MemoryResponseCache.js +138 -138
- package/dist/classes/cache/index.js +5 -5
- package/dist/classes/cache/typedef.js +41 -41
- package/dist/classes/data/IterableTree.js +243 -243
- package/dist/classes/data/Selector.js +190 -190
- package/dist/classes/data/index.js +2 -2
- package/dist/classes/events/EventEmitter.js +275 -275
- package/dist/classes/events/index.js +2 -2
- package/dist/classes/index.js +4 -4
- package/dist/classes/logging/Logger.js +158 -158
- package/dist/classes/logging/constants.js +18 -18
- package/dist/classes/logging/index.js +4 -4
- package/dist/classes/promise/HkPromise.js +377 -377
- package/dist/classes/promise/index.js +1 -1
- package/dist/classes/services/ServiceBase.js +409 -409
- package/dist/classes/services/ServiceManager.js +1114 -1114
- package/dist/classes/services/constants.js +12 -12
- package/dist/classes/services/index.js +5 -5
- package/dist/classes/stores/SubscribersCount.js +107 -107
- package/dist/classes/stores/index.js +1 -1
- package/dist/classes/streams/LogTransformStream.js +19 -19
- package/dist/classes/streams/ServerEventsStore.js +110 -110
- package/dist/classes/streams/TimeStampSource.js +26 -26
- package/dist/classes/streams/index.js +3 -3
- package/dist/classes/svelte/audio/AudioLoader.svelte.js +58 -58
- package/dist/classes/svelte/audio/AudioScene.svelte.js +324 -324
- package/dist/classes/svelte/audio/mocks.js +35 -35
- package/dist/classes/svelte/finite-state-machine/FiniteStateMachine.svelte.js +133 -133
- package/dist/classes/svelte/finite-state-machine/index.js +1 -1
- package/dist/classes/svelte/image/ImageLoader.svelte.js +45 -45
- package/dist/classes/svelte/image/ImageScene.svelte.js +249 -249
- package/dist/classes/svelte/image/ImageVariantsLoader.svelte.js +152 -152
- package/dist/classes/svelte/image/index.js +4 -4
- package/dist/classes/svelte/image/mocks.js +35 -35
- package/dist/classes/svelte/image/typedef.js +8 -8
- package/dist/classes/svelte/index.js +14 -14
- package/dist/classes/svelte/loading-state-machine/LoadingStateMachine.svelte.js +109 -109
- package/dist/classes/svelte/loading-state-machine/constants.js +16 -16
- package/dist/classes/svelte/loading-state-machine/index.js +3 -3
- package/dist/classes/svelte/network-loader/NetworkLoader.svelte.js +338 -338
- package/dist/classes/svelte/network-loader/constants.js +3 -3
- package/dist/classes/svelte/network-loader/index.js +3 -3
- package/dist/classes/svelte/network-loader/mocks.js +30 -30
- package/dist/classes/svelte/network-loader/typedef.js +8 -8
- package/dist/components/area/HkArea.svelte +49 -49
- package/dist/components/area/HkGridArea.svelte +77 -77
- package/dist/components/area/index.js +2 -2
- package/dist/components/buttons/button/Button.svelte +82 -82
- package/dist/components/buttons/button-icon-steeze/SteezeIconButton.svelte +30 -30
- package/dist/components/buttons/button-text/TextButton.svelte +21 -21
- package/dist/components/buttons/index.js +3 -3
- package/dist/components/debug/debug-panel-design-scaling/DebugPanelDesignScaling.svelte +146 -146
- package/dist/components/debug/index.js +1 -1
- package/dist/components/drag-drop/DragController.js +44 -44
- package/dist/components/drag-drop/DragDropContext.svelte +111 -110
- package/dist/components/drag-drop/Draggable.svelte +502 -512
- package/dist/components/drag-drop/{Dropzone.svelte → DropZone.svelte} +258 -258
- package/dist/components/drag-drop/DropZoneArea.svelte +119 -119
- package/dist/components/drag-drop/DropZoneList.svelte +125 -125
- package/dist/components/drag-drop/actions.d.ts +9 -0
- package/dist/components/drag-drop/actions.js +26 -0
- package/dist/components/drag-drop/drag-state.svelte.d.ts +3 -1
- package/dist/components/drag-drop/drag-state.svelte.js +322 -319
- package/dist/components/drag-drop/drag-state.svelte.js__ +319 -0
- package/dist/components/drag-drop/index.js +7 -7
- package/dist/components/drag-drop/util.d.ts +0 -32
- package/dist/components/drag-drop/util.js +85 -85
- package/dist/components/hkdev/blocks/TextBlock.svelte +46 -46
- package/dist/components/hkdev/buttons/CheckButton.svelte +62 -62
- package/dist/components/icons/HkIcon.svelte +86 -86
- package/dist/components/icons/HkTabIcon.svelte +116 -116
- package/dist/components/icons/SteezeIcon.svelte +97 -97
- package/dist/components/icons/index.js +6 -6
- package/dist/components/icons/typedef.js +16 -16
- package/dist/components/index.js +2 -2
- package/dist/components/inputs/index.js +1 -1
- package/dist/components/inputs/text-input/TestTextInput.svelte__ +102 -102
- package/dist/components/inputs/text-input/TextInput.svelte +223 -223
- package/dist/components/inputs/text-input/TextInput.svelte___ +83 -83
- package/dist/components/inputs/text-input/assets/IconInvalid.svelte +14 -14
- package/dist/components/inputs/text-input/assets/IconValid.svelte +12 -12
- package/dist/components/layout/grid-layers/GridLayers.svelte +63 -63
- package/dist/components/layout/grid-layers/GridLayers.svelte__heightFrom__ +372 -0
- package/dist/components/layout/grid-layers/util.js +74 -74
- package/dist/components/layout/index.js +1 -1
- package/dist/components/panels/index.js +1 -1
- package/dist/components/panels/panel/Panel.svelte +43 -43
- package/dist/components/rows/index.js +3 -3
- package/dist/components/rows/panel-grid-row/PanelGridRow.svelte +104 -104
- package/dist/components/rows/panel-row-2/PanelRow2.svelte +40 -40
- package/dist/components/tab-bar/HkTabBar.state.svelte.js +149 -149
- package/dist/components/tab-bar/HkTabBar.svelte +74 -74
- package/dist/components/tab-bar/HkTabBarSelector.state.svelte.js +93 -93
- package/dist/components/tab-bar/HkTabBarSelector.svelte +49 -49
- package/dist/components/tab-bar/index.js +17 -17
- package/dist/components/tab-bar/typedef.js +11 -11
- package/dist/config/imagetools-config.js +189 -189
- package/dist/config/imagetools.d.ts +72 -72
- package/dist/constants/bases.js +13 -13
- package/dist/constants/errors/api.js +9 -9
- package/dist/constants/errors/generic.js +5 -5
- package/dist/constants/errors/index.js +3 -3
- package/dist/constants/errors/jwt.js +5 -5
- package/dist/constants/http/headers.js +6 -6
- package/dist/constants/http/index.js +2 -2
- package/dist/constants/http/methods.js +2 -2
- package/dist/constants/index.js +3 -3
- package/dist/constants/mime/application.js +5 -5
- package/dist/constants/mime/audio.js +13 -13
- package/dist/constants/mime/image.js +3 -3
- package/dist/constants/mime/index.js +4 -4
- package/dist/constants/mime/text.js +2 -2
- package/dist/constants/regexp/index.js +31 -31
- package/dist/constants/regexp/inspiratie.js__ +95 -95
- package/dist/constants/regexp/text.js +49 -49
- package/dist/constants/regexp/user.js +32 -32
- package/dist/constants/regexp/web.js +3 -3
- package/dist/constants/state-labels/drag-states.js +6 -6
- package/dist/constants/state-labels/drop-states.js +6 -6
- package/dist/constants/state-labels/input-states.js +11 -11
- package/dist/constants/state-labels/submit-states.js +4 -4
- package/dist/constants/time.js +28 -28
- package/dist/css/utilities.css +43 -43
- package/dist/design/design-config.js +73 -73
- package/dist/design/tailwind-theme-extend.js +158 -158
- package/dist/features/button-group/ButtonGroup.svelte +82 -82
- package/dist/features/button-group/typedef.js +10 -10
- package/dist/features/compare-left-right/CompareLeftRight.svelte +179 -179
- package/dist/features/compare-left-right/index.js +1 -1
- package/dist/features/game-box/GameBox.svelte +577 -577
- package/dist/features/game-box/gamebox.util.js +83 -83
- package/dist/features/hk-app-layout/HkAppLayout.state.svelte.js +25 -25
- package/dist/features/hk-app-layout/HkAppLayout.svelte +251 -251
- package/dist/features/image-box/ImageBox.svelte +210 -210
- package/dist/features/image-box/index.js +5 -5
- package/dist/features/image-box/typedef.js +32 -32
- package/dist/features/index.js +23 -23
- package/dist/features/presenter/ImageSlide.svelte +64 -64
- package/dist/features/presenter/Presenter.state.svelte.js +638 -638
- package/dist/features/presenter/Presenter.svelte +142 -142
- package/dist/features/presenter/constants.js +7 -7
- package/dist/features/presenter/index.js +10 -10
- package/dist/features/presenter/typedef.js +106 -106
- package/dist/features/presenter/util.js +210 -210
- package/dist/features/virtual-viewport/VirtualViewport.svelte +196 -196
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/validate-url.js +180 -180
- package/dist/server/index.js +1 -1
- package/dist/server/logger.js +94 -94
- package/dist/states/index.js +1 -1
- package/dist/states/navigation.svelte.js +55 -55
- package/dist/stores/index.js +1 -1
- package/dist/stores/theme.js +80 -80
- package/dist/themes/hkdev/components/blocks/text-block.css +41 -41
- package/dist/themes/hkdev/components/boxes/game-box.css +12 -12
- package/dist/themes/hkdev/components/buttons/button-icon-steeze.css +22 -22
- package/dist/themes/hkdev/components/buttons/button-text.css +32 -32
- package/dist/themes/hkdev/components/buttons/button.css +146 -146
- package/dist/themes/hkdev/components/buttons/skip-button.css +6 -6
- package/dist/themes/hkdev/components/drag-drop/draggable.css +73 -73
- package/dist/themes/hkdev/components/drag-drop/drop-zone.css +48 -48
- package/dist/themes/hkdev/components/icons/icon-steeze.css +22 -22
- package/dist/themes/hkdev/components/inputs/text-input.css +104 -104
- package/dist/themes/hkdev/components/panels/panel.css +27 -27
- package/dist/themes/hkdev/components/rows/panel-grid-row.css +6 -6
- package/dist/themes/hkdev/components/rows/panel-row-2.css +7 -7
- package/dist/themes/hkdev/components.css +53 -53
- package/dist/themes/hkdev/debug.css +1 -1
- package/dist/themes/hkdev/global/layout.css +39 -39
- package/dist/themes/hkdev/global/on-colors.css +53 -53
- package/dist/themes/hkdev/globals.css +11 -11
- package/dist/themes/hkdev/responsive.css +12 -12
- package/dist/themes/hkdev/theme-ext.js +15 -15
- package/dist/themes/hkdev/theme.js +235 -235
- package/dist/themes/index.js +1 -1
- package/dist/typedef/context.js +6 -6
- package/dist/typedef/drag.js +25 -25
- package/dist/typedef/drop.js +12 -12
- package/dist/typedef/image.js +38 -38
- package/dist/typedef/index.js +4 -4
- package/dist/util/array/index.js +436 -436
- package/dist/util/bases/base58.js +262 -262
- package/dist/util/bases/index.js +1 -1
- package/dist/util/compare/index.js +247 -247
- package/dist/util/css/css-vars.js +83 -83
- package/dist/util/css/index.js +1 -1
- package/dist/util/design-system/components/states.js +22 -22
- package/dist/util/design-system/css/clamp.js +66 -66
- package/dist/util/design-system/css/root-design-vars.js +102 -102
- package/dist/util/design-system/index.js +5 -5
- package/dist/util/design-system/layout/scaling.js +228 -228
- package/dist/util/design-system/skeleton.js +208 -208
- package/dist/util/design-system/tailwind.js +288 -288
- package/dist/util/env/index.js +9 -9
- package/dist/util/expect/arrays.js +47 -47
- package/dist/util/expect/index.js +259 -259
- package/dist/util/expect/primitives.js +55 -55
- package/dist/util/expect/url.js +60 -60
- package/dist/util/function/index.js +218 -218
- package/dist/util/geo/index.js +26 -26
- package/dist/util/http/caching.js +263 -263
- package/dist/util/http/errors.js +97 -97
- package/dist/util/http/headers.js +75 -75
- package/dist/util/http/http-request.js +379 -379
- package/dist/util/http/index.js +22 -22
- package/dist/util/http/json-request.js +224 -224
- package/dist/util/http/mocks.js +65 -65
- package/dist/util/http/response.js +294 -294
- package/dist/util/http/test-data__/content-length-test-hkdigital-small.V4HfZyBQ.avif +0 -0
- package/dist/util/http/typedef.js +93 -93
- package/dist/util/http/url.js +52 -52
- package/dist/util/image/index.js +86 -86
- package/dist/util/index.js +2 -2
- package/dist/util/is/index.js +140 -140
- package/dist/util/iterate/index.js +234 -234
- package/dist/util/object/index.js +1361 -1361
- package/dist/util/singleton/index.js +97 -97
- package/dist/util/string/array-path.js +75 -75
- package/dist/util/string/convert.js +54 -54
- package/dist/util/string/fs.js +226 -226
- package/dist/util/string/index.js +5 -5
- package/dist/util/string/interpolate.js +61 -61
- package/dist/util/string/pad.js +10 -10
- package/dist/util/svelte/index.js +4 -4
- package/dist/util/svelte/loading/loading-tracker.svelte.js +108 -108
- package/dist/util/svelte/observe/index.js +49 -49
- package/dist/util/svelte/state-context/index.js +117 -117
- package/dist/util/svelte/wait/index.js +38 -38
- package/dist/util/sveltekit/index.js +1 -1
- package/dist/util/sveltekit/route-folders/index.js +101 -101
- package/dist/util/time/index.js +323 -323
- package/dist/util/unique/index.js +249 -249
- package/dist/valibot/date.js__ +10 -10
- package/dist/valibot/index.js +9 -9
- package/dist/valibot/url.js +95 -95
- package/dist/valibot/user.js +23 -23
- package/dist/zod/all.js +33 -33
- package/dist/zod/generic.js +11 -11
- package/dist/zod/javascript.js +32 -32
- package/dist/zod/user.js +16 -16
- package/dist/zod/web.js +52 -52
- package/package.json +112 -112
@@ -1,119 +1,119 @@
|
|
1
|
-
<script>
|
2
|
-
import { DropZone } from './index.js';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* @type {{
|
6
|
-
* zone?: string,
|
7
|
-
* group?: string,
|
8
|
-
* disabled?: boolean,
|
9
|
-
* accepts?: (item: any) => boolean,
|
10
|
-
* fillContainer?: boolean,
|
11
|
-
* aspectRatio?: string,
|
12
|
-
* overflow?: 'auto' | 'hidden' | 'visible' | 'scroll',
|
13
|
-
* base?: string,
|
14
|
-
* classes?: string,
|
15
|
-
* children?: import('svelte').Snippet,
|
16
|
-
* contextKey?: import('../../typedef').ContextKey,
|
17
|
-
* dropPreviewSnippet?: import('svelte').Snippet<[import('../../typedef').DragData]>,
|
18
|
-
* isDragOver?: boolean,
|
19
|
-
* canDrop?: boolean,
|
20
|
-
* onDragEnter?: (detail: {
|
21
|
-
* event: DragEvent,
|
22
|
-
* zone: string,
|
23
|
-
* canDrop: boolean
|
24
|
-
* }) => void,
|
25
|
-
* onDragOver?: (detail: {
|
26
|
-
* event: DragEvent,
|
27
|
-
* zone: string
|
28
|
-
* }) => void,
|
29
|
-
* onDragLeave?: (detail: {
|
30
|
-
* event: DragEvent,
|
31
|
-
* zone: string
|
32
|
-
* }) => void,
|
33
|
-
* onDrop?: (detail: import('../../typedef').DropData) => any | Promise<any>,
|
34
|
-
* onDropStart?: (detail: {
|
35
|
-
* event: DragEvent,
|
36
|
-
* zone: string,
|
37
|
-
* data: any
|
38
|
-
* }) => void,
|
39
|
-
* onDropEnd?: (detail: {
|
40
|
-
* event: DragEvent,
|
41
|
-
* zone: string,
|
42
|
-
* data: any,
|
43
|
-
* success: boolean,
|
44
|
-
* error?: Error
|
45
|
-
* }) => void,
|
46
|
-
* [key: string]: any
|
47
|
-
* }}
|
48
|
-
*/
|
49
|
-
let {
|
50
|
-
zone = 'default',
|
51
|
-
group = 'default',
|
52
|
-
disabled = false,
|
53
|
-
accepts = () => true,
|
54
|
-
fillContainer = true,
|
55
|
-
aspectRatio = '',
|
56
|
-
overflow = 'hidden',
|
57
|
-
base = '',
|
58
|
-
classes = '',
|
59
|
-
children,
|
60
|
-
contextKey,
|
61
|
-
dropPreviewSnippet,
|
62
|
-
isDragOver = $bindable(false),
|
63
|
-
canDrop = $bindable(false),
|
64
|
-
onDragEnter,
|
65
|
-
onDragOver,
|
66
|
-
onDragLeave,
|
67
|
-
onDrop,
|
68
|
-
onDropStart,
|
69
|
-
onDropEnd,
|
70
|
-
...attrs
|
71
|
-
} = $props();
|
72
|
-
|
73
|
-
// Build overflow classes based on prop
|
74
|
-
let overflowClasses = $derived.by(() => {
|
75
|
-
switch (overflow) {
|
76
|
-
case 'auto':
|
77
|
-
return 'overflow-auto';
|
78
|
-
case 'scroll':
|
79
|
-
return 'overflow-scroll';
|
80
|
-
case 'visible':
|
81
|
-
return 'overflow-visible';
|
82
|
-
case 'hidden':
|
83
|
-
default:
|
84
|
-
return 'overflow-hidden';
|
85
|
-
}
|
86
|
-
});
|
87
|
-
|
88
|
-
// Combine all classes for the drop zone
|
89
|
-
let combinedClasses = $derived(
|
90
|
-
`${overflowClasses} ${aspectRatio} ${classes}`.trim()
|
91
|
-
);
|
92
|
-
</script>
|
93
|
-
|
94
|
-
<DropZone
|
95
|
-
data-component="drop-zone"
|
96
|
-
data-type="area"
|
97
|
-
{zone}
|
98
|
-
{group}
|
99
|
-
{disabled}
|
100
|
-
{accepts}
|
101
|
-
heightMode={fillContainer ? 'fill' : 'fixed'}
|
102
|
-
{base}
|
103
|
-
classes={combinedClasses}
|
104
|
-
{contextKey}
|
105
|
-
{dropPreviewSnippet}
|
106
|
-
bind:isDragOver
|
107
|
-
bind:canDrop
|
108
|
-
{onDragEnter}
|
109
|
-
{onDragOver}
|
110
|
-
{onDragLeave}
|
111
|
-
{onDrop}
|
112
|
-
{onDropStart}
|
113
|
-
{onDropEnd}
|
114
|
-
{...attrs}
|
115
|
-
>
|
116
|
-
{#if children}
|
117
|
-
{@render children()}
|
118
|
-
{/if}
|
119
|
-
</DropZone>
|
1
|
+
<script>
|
2
|
+
import { DropZone } from './index.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @type {{
|
6
|
+
* zone?: string,
|
7
|
+
* group?: string,
|
8
|
+
* disabled?: boolean,
|
9
|
+
* accepts?: (item: any) => boolean,
|
10
|
+
* fillContainer?: boolean,
|
11
|
+
* aspectRatio?: string,
|
12
|
+
* overflow?: 'auto' | 'hidden' | 'visible' | 'scroll',
|
13
|
+
* base?: string,
|
14
|
+
* classes?: string,
|
15
|
+
* children?: import('svelte').Snippet,
|
16
|
+
* contextKey?: import('../../typedef').ContextKey,
|
17
|
+
* dropPreviewSnippet?: import('svelte').Snippet<[import('../../typedef').DragData]>,
|
18
|
+
* isDragOver?: boolean,
|
19
|
+
* canDrop?: boolean,
|
20
|
+
* onDragEnter?: (detail: {
|
21
|
+
* event: DragEvent,
|
22
|
+
* zone: string,
|
23
|
+
* canDrop: boolean
|
24
|
+
* }) => void,
|
25
|
+
* onDragOver?: (detail: {
|
26
|
+
* event: DragEvent,
|
27
|
+
* zone: string
|
28
|
+
* }) => void,
|
29
|
+
* onDragLeave?: (detail: {
|
30
|
+
* event: DragEvent,
|
31
|
+
* zone: string
|
32
|
+
* }) => void,
|
33
|
+
* onDrop?: (detail: import('../../typedef').DropData) => any | Promise<any>,
|
34
|
+
* onDropStart?: (detail: {
|
35
|
+
* event: DragEvent,
|
36
|
+
* zone: string,
|
37
|
+
* data: any
|
38
|
+
* }) => void,
|
39
|
+
* onDropEnd?: (detail: {
|
40
|
+
* event: DragEvent,
|
41
|
+
* zone: string,
|
42
|
+
* data: any,
|
43
|
+
* success: boolean,
|
44
|
+
* error?: Error
|
45
|
+
* }) => void,
|
46
|
+
* [key: string]: any
|
47
|
+
* }}
|
48
|
+
*/
|
49
|
+
let {
|
50
|
+
zone = 'default',
|
51
|
+
group = 'default',
|
52
|
+
disabled = false,
|
53
|
+
accepts = () => true,
|
54
|
+
fillContainer = true,
|
55
|
+
aspectRatio = '',
|
56
|
+
overflow = 'hidden',
|
57
|
+
base = '',
|
58
|
+
classes = '',
|
59
|
+
children,
|
60
|
+
contextKey,
|
61
|
+
dropPreviewSnippet,
|
62
|
+
isDragOver = $bindable(false),
|
63
|
+
canDrop = $bindable(false),
|
64
|
+
onDragEnter,
|
65
|
+
onDragOver,
|
66
|
+
onDragLeave,
|
67
|
+
onDrop,
|
68
|
+
onDropStart,
|
69
|
+
onDropEnd,
|
70
|
+
...attrs
|
71
|
+
} = $props();
|
72
|
+
|
73
|
+
// Build overflow classes based on prop
|
74
|
+
let overflowClasses = $derived.by(() => {
|
75
|
+
switch (overflow) {
|
76
|
+
case 'auto':
|
77
|
+
return 'overflow-auto';
|
78
|
+
case 'scroll':
|
79
|
+
return 'overflow-scroll';
|
80
|
+
case 'visible':
|
81
|
+
return 'overflow-visible';
|
82
|
+
case 'hidden':
|
83
|
+
default:
|
84
|
+
return 'overflow-hidden';
|
85
|
+
}
|
86
|
+
});
|
87
|
+
|
88
|
+
// Combine all classes for the drop zone
|
89
|
+
let combinedClasses = $derived(
|
90
|
+
`${overflowClasses} ${aspectRatio} ${classes}`.trim()
|
91
|
+
);
|
92
|
+
</script>
|
93
|
+
|
94
|
+
<DropZone
|
95
|
+
data-component="drop-zone"
|
96
|
+
data-type="area"
|
97
|
+
{zone}
|
98
|
+
{group}
|
99
|
+
{disabled}
|
100
|
+
{accepts}
|
101
|
+
heightMode={fillContainer ? 'fill' : 'fixed'}
|
102
|
+
{base}
|
103
|
+
classes={combinedClasses}
|
104
|
+
{contextKey}
|
105
|
+
{dropPreviewSnippet}
|
106
|
+
bind:isDragOver
|
107
|
+
bind:canDrop
|
108
|
+
{onDragEnter}
|
109
|
+
{onDragOver}
|
110
|
+
{onDragLeave}
|
111
|
+
{onDrop}
|
112
|
+
{onDropStart}
|
113
|
+
{onDropEnd}
|
114
|
+
{...attrs}
|
115
|
+
>
|
116
|
+
{#if children}
|
117
|
+
{@render children()}
|
118
|
+
{/if}
|
119
|
+
</DropZone>
|
@@ -1,125 +1,125 @@
|
|
1
|
-
<script>
|
2
|
-
import { DropZone } from './index.js';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* @type {{
|
6
|
-
* zone?: string,
|
7
|
-
* group?: string,
|
8
|
-
* disabled?: boolean,
|
9
|
-
* accepts?: (item: any) => boolean,
|
10
|
-
* minHeight?: string,
|
11
|
-
* maxHeight?: string,
|
12
|
-
* gap?: string,
|
13
|
-
* direction?: 'vertical' | 'horizontal',
|
14
|
-
* base?: string,
|
15
|
-
* classes?: string,
|
16
|
-
* children?: import('svelte').Snippet,
|
17
|
-
* contextKey?: import('../../typedef').ContextKey,
|
18
|
-
* dropPreviewSnippet?: import('svelte').Snippet<[import('../../typedef').DragData]>,
|
19
|
-
* isDragOver?: boolean,
|
20
|
-
* canDrop?: boolean,
|
21
|
-
* onDragEnter?: (detail: {
|
22
|
-
* event: DragEvent,
|
23
|
-
* zone: string,
|
24
|
-
* canDrop: boolean
|
25
|
-
* }) => void,
|
26
|
-
* onDragOver?: (detail: {
|
27
|
-
* event: DragEvent,
|
28
|
-
* zone: string
|
29
|
-
* }) => void,
|
30
|
-
* onDragLeave?: (detail: {
|
31
|
-
* event: DragEvent,
|
32
|
-
* zone: string
|
33
|
-
* }) => void,
|
34
|
-
* onDrop?: (detail: import('../../typedef').DropData) => any | Promise<any>,
|
35
|
-
* onDropStart?: (detail: {
|
36
|
-
* event: DragEvent,
|
37
|
-
* zone: string,
|
38
|
-
* data: any
|
39
|
-
* }) => void,
|
40
|
-
* onDropEnd?: (detail: {
|
41
|
-
* event: DragEvent,
|
42
|
-
* zone: string,
|
43
|
-
* data: any,
|
44
|
-
* success: boolean,
|
45
|
-
* error?: Error
|
46
|
-
* }) => void,
|
47
|
-
* [key: string]: any
|
48
|
-
* }}
|
49
|
-
*/
|
50
|
-
let {
|
51
|
-
zone = 'default',
|
52
|
-
group = 'default',
|
53
|
-
disabled = false,
|
54
|
-
accepts = () => true,
|
55
|
-
minHeight = 'min-h-[200px]',
|
56
|
-
maxHeight = '',
|
57
|
-
gap = 'gap-2',
|
58
|
-
direction = 'vertical',
|
59
|
-
base = '',
|
60
|
-
classes = '',
|
61
|
-
children,
|
62
|
-
contextKey,
|
63
|
-
dropPreviewSnippet,
|
64
|
-
isDragOver = $bindable(false),
|
65
|
-
canDrop = $bindable(false),
|
66
|
-
onDragEnter,
|
67
|
-
onDragOver,
|
68
|
-
onDragLeave,
|
69
|
-
onDrop,
|
70
|
-
onDropStart,
|
71
|
-
onDropEnd,
|
72
|
-
...attrs
|
73
|
-
} = $props();
|
74
|
-
|
75
|
-
// Build flex layout classes based on direction
|
76
|
-
let layoutClasses = $derived.by(() => {
|
77
|
-
const layoutParts = ['flex'];
|
78
|
-
|
79
|
-
if (direction === 'vertical') {
|
80
|
-
layoutParts.push('flex-col');
|
81
|
-
} else {
|
82
|
-
layoutParts.push('flex-row', 'flex-wrap');
|
83
|
-
}
|
84
|
-
|
85
|
-
if (gap) {
|
86
|
-
layoutParts.push(gap);
|
87
|
-
}
|
88
|
-
|
89
|
-
return layoutParts.join(' ');
|
90
|
-
});
|
91
|
-
|
92
|
-
// Combine all classes for the drop zone
|
93
|
-
let combinedClasses = $derived(
|
94
|
-
`${layoutClasses} ${classes}`.trim()
|
95
|
-
);
|
96
|
-
</script>
|
97
|
-
|
98
|
-
<DropZone
|
99
|
-
data-component="drop-zone"
|
100
|
-
data-type="list"
|
101
|
-
{zone}
|
102
|
-
{group}
|
103
|
-
{disabled}
|
104
|
-
{accepts}
|
105
|
-
{minHeight}
|
106
|
-
{maxHeight}
|
107
|
-
heightMode="flexible"
|
108
|
-
{base}
|
109
|
-
classes={combinedClasses}
|
110
|
-
{contextKey}
|
111
|
-
{dropPreviewSnippet}
|
112
|
-
bind:isDragOver
|
113
|
-
bind:canDrop
|
114
|
-
{onDragEnter}
|
115
|
-
{onDragOver}
|
116
|
-
{onDragLeave}
|
117
|
-
{onDrop}
|
118
|
-
{onDropStart}
|
119
|
-
{onDropEnd}
|
120
|
-
{...attrs}
|
121
|
-
>
|
122
|
-
{#if children}
|
123
|
-
{@render children()}
|
124
|
-
{/if}
|
125
|
-
</DropZone>
|
1
|
+
<script>
|
2
|
+
import { DropZone } from './index.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @type {{
|
6
|
+
* zone?: string,
|
7
|
+
* group?: string,
|
8
|
+
* disabled?: boolean,
|
9
|
+
* accepts?: (item: any) => boolean,
|
10
|
+
* minHeight?: string,
|
11
|
+
* maxHeight?: string,
|
12
|
+
* gap?: string,
|
13
|
+
* direction?: 'vertical' | 'horizontal',
|
14
|
+
* base?: string,
|
15
|
+
* classes?: string,
|
16
|
+
* children?: import('svelte').Snippet,
|
17
|
+
* contextKey?: import('../../typedef').ContextKey,
|
18
|
+
* dropPreviewSnippet?: import('svelte').Snippet<[import('../../typedef').DragData]>,
|
19
|
+
* isDragOver?: boolean,
|
20
|
+
* canDrop?: boolean,
|
21
|
+
* onDragEnter?: (detail: {
|
22
|
+
* event: DragEvent,
|
23
|
+
* zone: string,
|
24
|
+
* canDrop: boolean
|
25
|
+
* }) => void,
|
26
|
+
* onDragOver?: (detail: {
|
27
|
+
* event: DragEvent,
|
28
|
+
* zone: string
|
29
|
+
* }) => void,
|
30
|
+
* onDragLeave?: (detail: {
|
31
|
+
* event: DragEvent,
|
32
|
+
* zone: string
|
33
|
+
* }) => void,
|
34
|
+
* onDrop?: (detail: import('../../typedef').DropData) => any | Promise<any>,
|
35
|
+
* onDropStart?: (detail: {
|
36
|
+
* event: DragEvent,
|
37
|
+
* zone: string,
|
38
|
+
* data: any
|
39
|
+
* }) => void,
|
40
|
+
* onDropEnd?: (detail: {
|
41
|
+
* event: DragEvent,
|
42
|
+
* zone: string,
|
43
|
+
* data: any,
|
44
|
+
* success: boolean,
|
45
|
+
* error?: Error
|
46
|
+
* }) => void,
|
47
|
+
* [key: string]: any
|
48
|
+
* }}
|
49
|
+
*/
|
50
|
+
let {
|
51
|
+
zone = 'default',
|
52
|
+
group = 'default',
|
53
|
+
disabled = false,
|
54
|
+
accepts = () => true,
|
55
|
+
minHeight = 'min-h-[200px]',
|
56
|
+
maxHeight = '',
|
57
|
+
gap = 'gap-2',
|
58
|
+
direction = 'vertical',
|
59
|
+
base = '',
|
60
|
+
classes = '',
|
61
|
+
children,
|
62
|
+
contextKey,
|
63
|
+
dropPreviewSnippet,
|
64
|
+
isDragOver = $bindable(false),
|
65
|
+
canDrop = $bindable(false),
|
66
|
+
onDragEnter,
|
67
|
+
onDragOver,
|
68
|
+
onDragLeave,
|
69
|
+
onDrop,
|
70
|
+
onDropStart,
|
71
|
+
onDropEnd,
|
72
|
+
...attrs
|
73
|
+
} = $props();
|
74
|
+
|
75
|
+
// Build flex layout classes based on direction
|
76
|
+
let layoutClasses = $derived.by(() => {
|
77
|
+
const layoutParts = ['flex'];
|
78
|
+
|
79
|
+
if (direction === 'vertical') {
|
80
|
+
layoutParts.push('flex-col');
|
81
|
+
} else {
|
82
|
+
layoutParts.push('flex-row', 'flex-wrap');
|
83
|
+
}
|
84
|
+
|
85
|
+
if (gap) {
|
86
|
+
layoutParts.push(gap);
|
87
|
+
}
|
88
|
+
|
89
|
+
return layoutParts.join(' ');
|
90
|
+
});
|
91
|
+
|
92
|
+
// Combine all classes for the drop zone
|
93
|
+
let combinedClasses = $derived(
|
94
|
+
`${layoutClasses} ${classes}`.trim()
|
95
|
+
);
|
96
|
+
</script>
|
97
|
+
|
98
|
+
<DropZone
|
99
|
+
data-component="drop-zone"
|
100
|
+
data-type="list"
|
101
|
+
{zone}
|
102
|
+
{group}
|
103
|
+
{disabled}
|
104
|
+
{accepts}
|
105
|
+
{minHeight}
|
106
|
+
{maxHeight}
|
107
|
+
heightMode="flexible"
|
108
|
+
{base}
|
109
|
+
classes={combinedClasses}
|
110
|
+
{contextKey}
|
111
|
+
{dropPreviewSnippet}
|
112
|
+
bind:isDragOver
|
113
|
+
bind:canDrop
|
114
|
+
{onDragEnter}
|
115
|
+
{onDragOver}
|
116
|
+
{onDragLeave}
|
117
|
+
{onDrop}
|
118
|
+
{onDropStart}
|
119
|
+
{onDropEnd}
|
120
|
+
{...attrs}
|
121
|
+
>
|
122
|
+
{#if children}
|
123
|
+
{@render children()}
|
124
|
+
{/if}
|
125
|
+
</DropZone>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
export function activeTouchMove(node, handler) {
|
2
|
+
node.addEventListener('touchmove', handler, { passive: false });
|
3
|
+
return {
|
4
|
+
destroy() {
|
5
|
+
node.removeEventListener('touchmove', handler, { passive: false });
|
6
|
+
}
|
7
|
+
};
|
8
|
+
}
|
9
|
+
|
10
|
+
export function activeDragOver(node, handler) {
|
11
|
+
node.addEventListener('dragover', handler, { passive: false });
|
12
|
+
return {
|
13
|
+
destroy() {
|
14
|
+
node.removeEventListener('dragover', handler, { passive: false });
|
15
|
+
}
|
16
|
+
};
|
17
|
+
}
|
18
|
+
|
19
|
+
export function activeDrop(node, handler) {
|
20
|
+
node.addEventListener('drop', handler, { passive: false });
|
21
|
+
return {
|
22
|
+
destroy() {
|
23
|
+
node.removeEventListener('drop', handler, { passive: false });
|
24
|
+
}
|
25
|
+
};
|
26
|
+
}
|
@@ -5,6 +5,7 @@ export type SimulatedDragEvent = import("../../typedef").SimulatedDragEvent;
|
|
5
5
|
/** @typedef {import('../../typedef').SimulatedDragEvent} SimulatedDragEvent */
|
6
6
|
declare class DragState {
|
7
7
|
draggables: Map<any, any>;
|
8
|
+
draggableIdCount: number;
|
8
9
|
dropZones: Map<any, any>;
|
9
10
|
activeDropZone: any;
|
10
11
|
lastActiveDropZone: any;
|
@@ -67,6 +68,7 @@ declare class DragState {
|
|
67
68
|
* @param {string} draggableId
|
68
69
|
*/
|
69
70
|
end(draggableId: string): void;
|
71
|
+
newDraggableId(): string;
|
70
72
|
/**
|
71
73
|
* Get a drag data by draggable id
|
72
74
|
*
|
@@ -79,7 +81,7 @@ declare class DragState {
|
|
79
81
|
*
|
80
82
|
* @param {DragEvent|SimulatedDragEvent} event
|
81
83
|
*
|
82
|
-
* @returns {Object|null} The drag data, or null for file drops
|
84
|
+
* @returns {Object|null} The drag data, or null for file drops or not found
|
83
85
|
*/
|
84
86
|
getDraggable(event: DragEvent | SimulatedDragEvent): any | null;
|
85
87
|
/**
|