webcoreui 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/astro.d.ts +6 -0
- package/astro.js +4 -0
- package/components/Accordion/Accordion.astro +1 -0
- package/components/Accordion/Accordion.svelte +1 -1
- package/components/Accordion/Accordion.tsx +1 -1
- package/components/Accordion/accordion.ts +1 -0
- package/components/Avatar/Avatar.astro +4 -2
- package/components/Avatar/Avatar.svelte +6 -4
- package/components/Avatar/Avatar.tsx +4 -2
- package/components/Checkbox/Checkbox.svelte +2 -0
- package/components/Checkbox/Checkbox.tsx +0 -2
- package/components/Checkbox/checkbox.ts +3 -1
- package/components/Collapsible/collapsible.ts +1 -1
- package/components/DataTable/DataTable.astro +4 -4
- package/components/DataTable/DataTable.svelte +1 -1
- package/components/DataTable/DataTable.tsx +1 -1
- package/components/Image/Image.astro +45 -0
- package/components/Image/Image.svelte +51 -0
- package/components/Image/Image.tsx +52 -0
- package/components/Image/image.module.scss +47 -0
- package/components/Image/image.ts +13 -0
- package/components/ImageLoader/ImageLoader.astro +82 -0
- package/components/ImageLoader/ImageLoader.svelte +72 -0
- package/components/ImageLoader/ImageLoader.tsx +82 -0
- package/components/ImageLoader/imageloader.module.scss +13 -0
- package/components/ImageLoader/imageloader.ts +6 -0
- package/components/Input/input.ts +2 -2
- package/components/Popover/popover.module.scss +4 -2
- package/components/RangeSlider/RangeSlider.svelte +3 -3
- package/components/RangeSlider/RangeSlider.tsx +1 -1
- package/components/Switch/Switch.svelte +2 -0
- package/components/Switch/Switch.tsx +0 -2
- package/components/Switch/switch.module.scss +1 -0
- package/components/Switch/switch.ts +3 -1
- package/components/Textarea/Textarea.svelte +2 -0
- package/components/Textarea/textarea.ts +7 -6
- package/components/ThemeSwitcher/themeswitcher.module.scss +1 -0
- package/components/ThemeSwitcher/themeswitcher.ts +1 -0
- package/index.d.ts +12 -5
- package/package.json +22 -22
- package/react.d.ts +6 -0
- package/react.js +4 -0
- package/scss/resets.scss +2 -0
- package/svelte.d.ts +6 -0
- package/svelte.js +4 -0
- package/utils/DOMUtils.ts +3 -3
- package/utils/modal.ts +2 -2
- package/utils/popover.ts +87 -46
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte'
|
|
3
|
+
import type { ImageLoaderProps } from './imageloader'
|
|
4
|
+
|
|
5
|
+
import Image from '../Image/Image.svelte'
|
|
6
|
+
import Skeleton from '../Skeleton/Skeleton.svelte'
|
|
7
|
+
|
|
8
|
+
import { classNames } from '../../utils/classNames'
|
|
9
|
+
|
|
10
|
+
import styles from './imageloader.module.scss'
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
fallback,
|
|
14
|
+
animate,
|
|
15
|
+
type,
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
color,
|
|
19
|
+
waveColor,
|
|
20
|
+
className,
|
|
21
|
+
...rest
|
|
22
|
+
}: ImageLoaderProps = $props()
|
|
23
|
+
|
|
24
|
+
let container: HTMLDivElement
|
|
25
|
+
|
|
26
|
+
const styleVariables = classNames([
|
|
27
|
+
`width: ${width}px;`,
|
|
28
|
+
`height: ${height}px;`
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
onMount(() => {
|
|
32
|
+
const img = container.querySelector<HTMLImageElement>('img')
|
|
33
|
+
const skeleton = container.querySelector<HTMLDivElement>('div')
|
|
34
|
+
|
|
35
|
+
if (!img) {
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const handleError = () => {
|
|
40
|
+
img.src = img.dataset.fallback || img.src
|
|
41
|
+
skeleton?.remove()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (img.complete) {
|
|
45
|
+
img.naturalWidth === 0 ? handleError() : skeleton?.remove()
|
|
46
|
+
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
img.addEventListener('load', () => skeleton?.remove(), { once: true })
|
|
51
|
+
img.addEventListener('error', handleError, { once: true })
|
|
52
|
+
})
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<div class={styles.loader} style={styleVariables} bind:this={container}>
|
|
56
|
+
<Skeleton
|
|
57
|
+
animate={animate}
|
|
58
|
+
type={type}
|
|
59
|
+
width={Number(width)}
|
|
60
|
+
height={Number(height)}
|
|
61
|
+
color={color}
|
|
62
|
+
waveColor={waveColor}
|
|
63
|
+
className={className}
|
|
64
|
+
/>
|
|
65
|
+
<Image
|
|
66
|
+
width={width}
|
|
67
|
+
height={height}
|
|
68
|
+
className={className}
|
|
69
|
+
data-fallback={fallback}
|
|
70
|
+
{...rest}
|
|
71
|
+
/>
|
|
72
|
+
</div>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react'
|
|
2
|
+
import type { ImageLoaderProps } from './imageloader'
|
|
3
|
+
|
|
4
|
+
import Image from '../Image/Image.tsx'
|
|
5
|
+
import Skeleton from '../Skeleton/Skeleton.tsx'
|
|
6
|
+
|
|
7
|
+
import styles from './imageloader.module.scss'
|
|
8
|
+
|
|
9
|
+
const ImageLoader = ({
|
|
10
|
+
fallback,
|
|
11
|
+
animate,
|
|
12
|
+
type,
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
color,
|
|
16
|
+
waveColor,
|
|
17
|
+
className,
|
|
18
|
+
...rest
|
|
19
|
+
}: ImageLoaderProps) => {
|
|
20
|
+
const containerRef = useRef<HTMLDivElement>(null)
|
|
21
|
+
const styleVariables = {
|
|
22
|
+
width,
|
|
23
|
+
height
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!containerRef.current) {
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const img = containerRef.current.querySelector<HTMLImageElement>('img')
|
|
32
|
+
const skeleton = containerRef.current.querySelector<HTMLDivElement>('div')
|
|
33
|
+
|
|
34
|
+
if (!img) {
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const removeSkeleton = () => skeleton?.remove()
|
|
39
|
+
|
|
40
|
+
const handleError = () => {
|
|
41
|
+
img.src = img.dataset.fallback || img.src
|
|
42
|
+
removeSkeleton()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (img.complete) {
|
|
46
|
+
img.naturalWidth === 0 ? handleError() : removeSkeleton()
|
|
47
|
+
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
img.addEventListener('load', removeSkeleton, { once: true })
|
|
52
|
+
img.addEventListener('error', handleError, { once: true })
|
|
53
|
+
|
|
54
|
+
return () => {
|
|
55
|
+
img.removeEventListener('load', removeSkeleton)
|
|
56
|
+
img.removeEventListener('error', handleError)
|
|
57
|
+
}
|
|
58
|
+
}, [containerRef])
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className={styles.loader} style={styleVariables} ref={containerRef}>
|
|
62
|
+
<Skeleton
|
|
63
|
+
animate={animate}
|
|
64
|
+
type={type}
|
|
65
|
+
width={Number(width)}
|
|
66
|
+
height={Number(height)}
|
|
67
|
+
color={color}
|
|
68
|
+
waveColor={waveColor}
|
|
69
|
+
className={className}
|
|
70
|
+
/>
|
|
71
|
+
<Image
|
|
72
|
+
width={width}
|
|
73
|
+
height={height}
|
|
74
|
+
className={className}
|
|
75
|
+
data-fallback={fallback}
|
|
76
|
+
{...rest}
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default ImageLoader
|
|
@@ -48,7 +48,7 @@ export type InputProps = {
|
|
|
48
48
|
export type SvelteInputProps = {
|
|
49
49
|
onChange?: (event: Event & InputTarget) => void
|
|
50
50
|
onKeyUp?: (event: KeyboardEvent & InputTarget) => void
|
|
51
|
-
onInput?: (event:
|
|
51
|
+
onInput?: (event: Event & InputTarget) => void
|
|
52
52
|
onClick?: (event: MouseEvent & InputTarget) => void
|
|
53
53
|
children?: Snippet
|
|
54
54
|
} & InputProps
|
|
@@ -56,7 +56,7 @@ export type SvelteInputProps = {
|
|
|
56
56
|
export type ReactInputProps = {
|
|
57
57
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
58
58
|
onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void
|
|
59
|
-
onInput?: (event: React.
|
|
59
|
+
onInput?: (event: React.InputEvent<HTMLInputElement>) => void
|
|
60
60
|
onClick?: (event: React.MouseEvent<HTMLInputElement>) => void
|
|
61
61
|
children?: React.ReactNode
|
|
62
62
|
} & InputProps
|
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
@include border-radius(md);
|
|
11
11
|
@include size(w300px);
|
|
12
12
|
@include position('t-100%');
|
|
13
|
+
@include transition();
|
|
13
14
|
|
|
14
15
|
transform: translateY(-5px);
|
|
15
16
|
pointer-events: none;
|
|
17
|
+
will-change: transform, opacity;
|
|
16
18
|
|
|
17
19
|
&.transparent {
|
|
18
20
|
@include spacing(p0);
|
|
@@ -20,8 +22,8 @@
|
|
|
20
22
|
@include border(0);
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
&[data-
|
|
24
|
-
@include transition();
|
|
25
|
+
&[data-no-transition] {
|
|
26
|
+
@include transition(none);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
&[data-show="true"] {
|
|
@@ -173,12 +173,12 @@
|
|
|
173
173
|
condition={!!interactiveLabels}
|
|
174
174
|
onclick={(e: Event) => handleClick(e, 'right')}
|
|
175
175
|
>
|
|
176
|
-
{#if maxIcon}
|
|
177
|
-
{@html maxIcon}
|
|
178
|
-
{/if}
|
|
179
176
|
{#if dynamicMaxLabel}
|
|
180
177
|
<span style={labelStyle}>{dynamicMaxLabel}</span>
|
|
181
178
|
{/if}
|
|
179
|
+
{#if maxIcon}
|
|
180
|
+
{@html maxIcon}
|
|
181
|
+
{/if}
|
|
182
182
|
</ConditionalWrapper>
|
|
183
183
|
</div>
|
|
184
184
|
|
|
@@ -187,13 +187,13 @@ const RangeSlider = ({
|
|
|
187
187
|
<button onClick={(e: React.MouseEvent) => handleClick(e, 'right')}>{children}</button>
|
|
188
188
|
)}
|
|
189
189
|
>
|
|
190
|
+
{dynamicMaxLabel && <span style={labelStyle}>{dynamicMaxLabel}</span>}
|
|
190
191
|
{maxIcon && (
|
|
191
192
|
<span
|
|
192
193
|
dangerouslySetInnerHTML={{ __html: maxIcon }}
|
|
193
194
|
style={{ height: 18 }}
|
|
194
195
|
/>
|
|
195
196
|
)}
|
|
196
|
-
{dynamicMaxLabel && <span style={labelStyle}>{dynamicMaxLabel}</span>}
|
|
197
197
|
</ConditionalWrapper>
|
|
198
198
|
</div>
|
|
199
199
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
disabled,
|
|
17
17
|
className,
|
|
18
18
|
onClick,
|
|
19
|
+
onChange,
|
|
19
20
|
...rest
|
|
20
21
|
}: SvelteSwitchProps = $props()
|
|
21
22
|
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
checked={toggled}
|
|
41
42
|
disabled={disabled}
|
|
42
43
|
onclick={onClick}
|
|
44
|
+
onchange={onChange}
|
|
43
45
|
{...rest}
|
|
44
46
|
/>
|
|
45
47
|
<span class={styles.toggle}></span>
|
|
@@ -15,7 +15,6 @@ const Switch = ({
|
|
|
15
15
|
square,
|
|
16
16
|
disabled,
|
|
17
17
|
className,
|
|
18
|
-
onClick,
|
|
19
18
|
...rest
|
|
20
19
|
}: ReactSwitchProps) => {
|
|
21
20
|
const classes = classNames([
|
|
@@ -38,7 +37,6 @@ const Switch = ({
|
|
|
38
37
|
type="checkbox"
|
|
39
38
|
defaultChecked={toggled}
|
|
40
39
|
disabled={disabled}
|
|
41
|
-
onClick={onClick}
|
|
42
40
|
{...rest}
|
|
43
41
|
/>
|
|
44
42
|
<span className={styles.toggle}></span>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MouseEventHandler } from 'svelte/elements'
|
|
1
|
+
import type { ChangeEventHandler, MouseEventHandler } from 'svelte/elements'
|
|
2
2
|
|
|
3
3
|
export type SwitchProps = {
|
|
4
4
|
label?: string
|
|
@@ -14,9 +14,11 @@ export type SwitchProps = {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export type SvelteSwitchProps = {
|
|
17
|
+
onChange?: ChangeEventHandler<HTMLInputElement>
|
|
17
18
|
onClick?: MouseEventHandler<HTMLInputElement>
|
|
18
19
|
} & SwitchProps
|
|
19
20
|
|
|
20
21
|
export type ReactSwitchProps = {
|
|
22
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>
|
|
21
23
|
onClick?: React.MouseEventHandler<HTMLInputElement>
|
|
22
24
|
} & SwitchProps
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
className,
|
|
17
17
|
onChange,
|
|
18
18
|
onKeyUp,
|
|
19
|
+
onInput,
|
|
19
20
|
...rest
|
|
20
21
|
}: SvelteTextareaProps = $props()
|
|
21
22
|
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
placeholder={placeholder}
|
|
40
41
|
disabled={disabled}
|
|
41
42
|
class={classes}
|
|
43
|
+
oninput={onInput}
|
|
42
44
|
onchange={onChange}
|
|
43
45
|
onkeyup={onKeyUp}
|
|
44
46
|
{...rest}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
type
|
|
2
|
-
target: HTMLTextAreaElement
|
|
1
|
+
export type TextareaTarget = {
|
|
3
2
|
currentTarget: HTMLTextAreaElement
|
|
4
3
|
}
|
|
5
4
|
|
|
@@ -14,11 +13,13 @@ export type TextareaProps = {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export type SvelteTextareaProps = {
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
onInput?: (event: Event & TextareaTarget) => void
|
|
17
|
+
onChange?: (event: Event & TextareaTarget) => void
|
|
18
|
+
onKeyUp?: (event: KeyboardEvent & TextareaTarget) => void
|
|
19
19
|
} & TextareaProps
|
|
20
20
|
|
|
21
21
|
export type ReactTextareaProps = {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
onInput?: (event: React.InputEvent<HTMLTextAreaElement>) => void
|
|
23
|
+
onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void
|
|
24
|
+
onKeyUp?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void
|
|
24
25
|
} & TextareaProps
|
package/index.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export type ModalCallback = {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
export type Modal = {
|
|
89
|
-
trigger
|
|
89
|
+
trigger?: string
|
|
90
90
|
modal: string
|
|
91
91
|
onOpen?: (args: ModalCallback) => unknown
|
|
92
92
|
onClose?: (args: ModalCallback) => unknown
|
|
@@ -105,6 +105,12 @@ export type PopoverPosition = 'top'
|
|
|
105
105
|
| 'bottom-start'
|
|
106
106
|
| 'bottom-end'
|
|
107
107
|
|
|
108
|
+
export type PopoverInstance = {
|
|
109
|
+
close: () => void
|
|
110
|
+
destroy: () => void
|
|
111
|
+
remove: () => void
|
|
112
|
+
}
|
|
113
|
+
|
|
108
114
|
export type PopoverCallback = {
|
|
109
115
|
trigger: HTMLElement
|
|
110
116
|
popover: HTMLElement
|
|
@@ -152,7 +158,10 @@ declare module 'webcoreui' {
|
|
|
152
158
|
cancel: () => void
|
|
153
159
|
}
|
|
154
160
|
|
|
155
|
-
export const get:
|
|
161
|
+
export const get: <T extends Element = Element>(
|
|
162
|
+
selector: string,
|
|
163
|
+
all?: boolean
|
|
164
|
+
) => T | NodeListOf<T> | null
|
|
156
165
|
export const on: (
|
|
157
166
|
selector: string | HTMLElement | Document,
|
|
158
167
|
event: string,
|
|
@@ -189,9 +198,7 @@ declare module 'webcoreui' {
|
|
|
189
198
|
export const modal: (config: Modal | string) => ModalInstance | undefined
|
|
190
199
|
export const closeModal: (modal: string) => void
|
|
191
200
|
|
|
192
|
-
export const popover: (config: Popover) =>
|
|
193
|
-
remove: () => void
|
|
194
|
-
} | void
|
|
201
|
+
export const popover: (config: Popover) => PopoverInstance | undefined
|
|
195
202
|
export const closePopover: (selector: string) => void
|
|
196
203
|
|
|
197
204
|
export const setDefaultTimeout: (time: number) => number
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webcoreui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "husky",
|
|
7
7
|
"pre-commit": "lint-staged",
|
|
@@ -22,33 +22,33 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@astrojs/check": "0.9.6",
|
|
25
|
-
"@astrojs/node": "9.5.
|
|
25
|
+
"@astrojs/node": "9.5.4",
|
|
26
26
|
"@astrojs/react": "4.4.2",
|
|
27
|
-
"@astrojs/svelte": "7.2.
|
|
28
|
-
"@eslint/js": "9.39.
|
|
29
|
-
"@playwright/test": "1.
|
|
30
|
-
"@types/node": "
|
|
31
|
-
"@typescript-eslint/parser": "8.
|
|
32
|
-
"astro": "5.
|
|
33
|
-
"astro-eslint-parser": "1.
|
|
34
|
-
"eslint": "9.39.
|
|
35
|
-
"eslint-plugin-astro": "1.
|
|
27
|
+
"@astrojs/svelte": "7.2.5",
|
|
28
|
+
"@eslint/js": "9.39.3",
|
|
29
|
+
"@playwright/test": "1.58.2",
|
|
30
|
+
"@types/node": "25.3.0",
|
|
31
|
+
"@typescript-eslint/parser": "8.56.1",
|
|
32
|
+
"astro": "5.17.3",
|
|
33
|
+
"astro-eslint-parser": "1.3.0",
|
|
34
|
+
"eslint": "9.39.3",
|
|
35
|
+
"eslint-plugin-astro": "1.6.0",
|
|
36
36
|
"eslint-plugin-react": "7.37.5",
|
|
37
37
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
38
|
-
"eslint-plugin-svelte": "3.
|
|
38
|
+
"eslint-plugin-svelte": "3.15.0",
|
|
39
39
|
"husky": "9.1.7",
|
|
40
|
-
"jsdom": "
|
|
40
|
+
"jsdom": "28.1.0",
|
|
41
41
|
"lint-staged": "16.2.7",
|
|
42
|
-
"react": "19.2.
|
|
43
|
-
"react-dom": "19.2.
|
|
44
|
-
"sass": "1.
|
|
45
|
-
"sass-true": "10.0
|
|
46
|
-
"svelte": "5.
|
|
47
|
-
"svelte-eslint-parser": "1.
|
|
42
|
+
"react": "19.2.4",
|
|
43
|
+
"react-dom": "19.2.4",
|
|
44
|
+
"sass": "1.97.3",
|
|
45
|
+
"sass-true": "10.1.0",
|
|
46
|
+
"svelte": "5.53.3",
|
|
47
|
+
"svelte-eslint-parser": "1.5.1",
|
|
48
48
|
"typescript": "5.9.3",
|
|
49
|
-
"typescript-eslint": "8.
|
|
50
|
-
"vite-tsconfig-paths": "
|
|
51
|
-
"vitest": "4.0.
|
|
49
|
+
"typescript-eslint": "8.56.1",
|
|
50
|
+
"vite-tsconfig-paths": "6.1.1",
|
|
51
|
+
"vitest": "4.0.18"
|
|
52
52
|
},
|
|
53
53
|
"exports": {
|
|
54
54
|
".": "./index.js",
|
package/react.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ import type { ReactFooterProps as WReactFooterProps } from './components/Footer/
|
|
|
22
22
|
import type { ReactGridProps as WReactGridProps } from './components/Grid/grid'
|
|
23
23
|
import type { ReactGroupProps as WReactGroupProps } from './components/Group/group'
|
|
24
24
|
import type { IconProps as WIconProps } from './components/Icon/icon'
|
|
25
|
+
import type { ImageProps as WImageProps } from './components/Image/image'
|
|
26
|
+
import type { ImageLoaderProps as WImageLoaderProps } from './components/ImageLoader/imageloader'
|
|
25
27
|
import type { ReactInputProps as WReactInputProps } from './components/Input/input'
|
|
26
28
|
import type { ReactKbdProps as WReactKbdProps } from './components/Kbd/kbd'
|
|
27
29
|
import type { ReactListProps as WReactListProps } from './components/List/list'
|
|
@@ -84,6 +86,8 @@ declare module 'webcoreui/react' {
|
|
|
84
86
|
export const Grid: FC<WReactGridProps>
|
|
85
87
|
export const Group: FC<WReactGroupProps>
|
|
86
88
|
export const Icon: FC<WIconProps>
|
|
89
|
+
export const Image: FC<WImageProps>
|
|
90
|
+
export const ImageLoader: FC<WImageLoaderProps>
|
|
87
91
|
export const Input: FC<WReactInputProps>
|
|
88
92
|
export const Kbd: FC<WReactKbdProps>
|
|
89
93
|
export const List: FC<WReactListProps>
|
|
@@ -139,6 +143,8 @@ declare module 'webcoreui/react' {
|
|
|
139
143
|
export type GridProps = WReactGridProps
|
|
140
144
|
export type GroupProps = WReactGroupProps
|
|
141
145
|
export type IconProps = WIconProps
|
|
146
|
+
export type ImageProps = WImageProps
|
|
147
|
+
export type ImageLoaderProps = WImageLoaderProps
|
|
142
148
|
export type InputProps = WReactInputProps
|
|
143
149
|
export type KbdProps = WReactKbdProps
|
|
144
150
|
export type ListProps = WReactListProps
|
package/react.js
CHANGED
|
@@ -21,6 +21,8 @@ import FooterComponent from './components/Footer/Footer.tsx'
|
|
|
21
21
|
import GridComponent from './components/Grid/Grid.tsx'
|
|
22
22
|
import GroupComponent from './components/Group/Group.tsx'
|
|
23
23
|
import IconComponent from './components/Icon/Icon.tsx'
|
|
24
|
+
import ImageComponent from './components/Image/Image.tsx'
|
|
25
|
+
import ImageLoaderComponent from './components/ImageLoader/ImageLoader.tsx'
|
|
24
26
|
import InputComponent from './components/Input/Input.tsx'
|
|
25
27
|
import KbdComponent from './components/Kbd/Kbd.tsx'
|
|
26
28
|
import ListComponent from './components/List/List.tsx'
|
|
@@ -76,6 +78,8 @@ export const Footer = FooterComponent
|
|
|
76
78
|
export const Grid = GridComponent
|
|
77
79
|
export const Group = GroupComponent
|
|
78
80
|
export const Icon = IconComponent
|
|
81
|
+
export const Image = ImageComponent
|
|
82
|
+
export const ImageLoader = ImageLoaderComponent
|
|
79
83
|
export const Input = InputComponent
|
|
80
84
|
export const Kbd = KbdComponent
|
|
81
85
|
export const List = ListComponent
|
package/scss/resets.scss
CHANGED
package/svelte.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ import type { SvelteFooterProps as WSvelteFooterProps } from './components/Foote
|
|
|
22
22
|
import type { SvelteGridProps as WSvelteGridProps } from './components/Grid/grid'
|
|
23
23
|
import type { SvelteGroupProps as WSvelteGroupProps } from './components/Group/group'
|
|
24
24
|
import type { IconProps as WIconProps } from './components/Icon/icon'
|
|
25
|
+
import type { ImageProps as WImageProps } from './components/Image/image'
|
|
26
|
+
import type { ImageLoaderProps as WImageLoaderProps } from './components/ImageLoader/imageloader'
|
|
25
27
|
import type { SvelteInputProps as WSvelteInputProps } from './components/Input/input'
|
|
26
28
|
import type { SvelteKbdProps as WSvelteKbdProps } from './components/Kbd/kbd'
|
|
27
29
|
import type { SvelteListProps as WSvelteListProps } from './components/List/list'
|
|
@@ -84,6 +86,8 @@ declare module 'webcoreui/svelte' {
|
|
|
84
86
|
export const Grid: Component<WSvelteGridProps>
|
|
85
87
|
export const Group: Component<WSvelteGroupProps>
|
|
86
88
|
export const Icon: Component<WIconProps>
|
|
89
|
+
export const Image: Component<WImageProps>
|
|
90
|
+
export const ImageLoader: Component<WImageLoaderProps>
|
|
87
91
|
export const Input: Component<WSvelteInputProps>
|
|
88
92
|
export const Kbd: Component<WSvelteKbdProps>
|
|
89
93
|
export const List: Component<WSvelteListProps>
|
|
@@ -139,6 +143,8 @@ declare module 'webcoreui/svelte' {
|
|
|
139
143
|
export type GridProps = WSvelteGridProps
|
|
140
144
|
export type GroupProps = WSvelteGroupProps
|
|
141
145
|
export type IconProps = WIconProps
|
|
146
|
+
export type ImageProps = WImageProps
|
|
147
|
+
export type ImageLoaderProps = WImageLoaderProps
|
|
142
148
|
export type InputProps = WSvelteInputProps
|
|
143
149
|
export type KbdProps = WSvelteKbdProps
|
|
144
150
|
export type ListProps = WSvelteListProps
|
package/svelte.js
CHANGED
|
@@ -21,6 +21,8 @@ import FooterComponent from './components/Footer/Footer.svelte'
|
|
|
21
21
|
import GridComponent from './components/Grid/Grid.svelte'
|
|
22
22
|
import GroupComponent from './components/Group/Group.svelte'
|
|
23
23
|
import IconComponent from './components/Icon/Icon.svelte'
|
|
24
|
+
import ImageComponent from './components/Image/Image.svelte'
|
|
25
|
+
import ImageLoaderComponent from './components/ImageLoader/ImageLoader.svelte'
|
|
24
26
|
import InputComponent from './components/Input/Input.svelte'
|
|
25
27
|
import KbdComponent from './components/Kbd/Kbd.svelte'
|
|
26
28
|
import ListComponent from './components/List/List.svelte'
|
|
@@ -76,6 +78,8 @@ export const Footer = FooterComponent
|
|
|
76
78
|
export const Grid = GridComponent
|
|
77
79
|
export const Group = GroupComponent
|
|
78
80
|
export const Icon = IconComponent
|
|
81
|
+
export const Image = ImageComponent
|
|
82
|
+
export const ImageLoader = ImageLoaderComponent
|
|
79
83
|
export const Input = InputComponent
|
|
80
84
|
export const Kbd = KbdComponent
|
|
81
85
|
export const List = ListComponent
|
package/utils/DOMUtils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const get = (selector: string, all?: boolean) => all
|
|
2
|
-
? document?.querySelectorAll(selector)
|
|
3
|
-
: document?.querySelector(selector)
|
|
1
|
+
export const get = <T extends Element = Element>(selector: string, all?: boolean): T | NodeListOf<T> | null => all
|
|
2
|
+
? document?.querySelectorAll<T>(selector)
|
|
3
|
+
: document?.querySelector<T>(selector)
|
|
4
4
|
|
|
5
5
|
export const on = (
|
|
6
6
|
selector: string | HTMLElement | Document,
|
package/utils/modal.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type ModalCallback = {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export type Modal = {
|
|
16
|
-
trigger
|
|
16
|
+
trigger?: string
|
|
17
17
|
modal: string
|
|
18
18
|
onOpen?: (args: ModalCallback) => unknown
|
|
19
19
|
onClose?: (args: ModalCallback) => unknown
|
|
@@ -29,7 +29,7 @@ export const modal = (config: Modal | string): ModalInstance | undefined => {
|
|
|
29
29
|
|
|
30
30
|
const modalSelector = typeof config === 'string' ? config : modal
|
|
31
31
|
|
|
32
|
-
const triggerDOM = document.querySelector(trigger)
|
|
32
|
+
const triggerDOM = trigger ? document.querySelector(trigger) : null
|
|
33
33
|
const modalDOM = document.querySelector(modalSelector)
|
|
34
34
|
|
|
35
35
|
if (modalDOM instanceof HTMLElement) {
|