@santi020k/lumen-astro 1.3.0 → 1.6.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/components/Backdrop.astro +35 -0
- package/components/Graphic.astro +43 -0
- package/components/Illustration.astro +67 -0
- package/index.ts +3 -0
- package/package.json +6 -6
- package/runtime/UIPrimitives.astro +19 -13
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
|
|
4
|
+
import { resolveLumenAstroProps } from '@santi020k/lumen-core'
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
7
|
+
class?: string | null
|
|
8
|
+
className?: string
|
|
9
|
+
intensity?: 'medium' | 'strong' | 'subtle'
|
|
10
|
+
tone?: 'accent' | 'brand' | 'neutral'
|
|
11
|
+
variant?: 'aurora' | 'dots' | 'grid' | 'rays'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
class: classProp = '',
|
|
16
|
+
className = '',
|
|
17
|
+
intensity = 'medium',
|
|
18
|
+
tone = 'brand',
|
|
19
|
+
variant = 'aurora',
|
|
20
|
+
...rest
|
|
21
|
+
} = Astro.props
|
|
22
|
+
|
|
23
|
+
const { classList, passthrough } = resolveLumenAstroProps(rest, [
|
|
24
|
+
'ui-backdrop',
|
|
25
|
+
`ui-backdrop--${variant}`,
|
|
26
|
+
`ui-backdrop--${tone}`,
|
|
27
|
+
`ui-backdrop--${intensity}`
|
|
28
|
+
], classProp, className)
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
<div class:list={classList} {...passthrough}>
|
|
32
|
+
<div class="ui-backdrop__content">
|
|
33
|
+
<slot />
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
|
|
4
|
+
import { resolveLumenAstroProps } from '@santi020k/lumen-core'
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<'div'> {
|
|
7
|
+
class?: string | null
|
|
8
|
+
className?: string
|
|
9
|
+
label?: string
|
|
10
|
+
size?: 'lg' | 'md' | 'sm'
|
|
11
|
+
tone?: 'accent' | 'brand' | 'neutral'
|
|
12
|
+
variant?: 'glow' | 'grid' | 'orbit'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
class: classProp = '',
|
|
17
|
+
className = '',
|
|
18
|
+
label,
|
|
19
|
+
size = 'md',
|
|
20
|
+
tone = 'brand',
|
|
21
|
+
variant = 'orbit',
|
|
22
|
+
...rest
|
|
23
|
+
} = Astro.props
|
|
24
|
+
|
|
25
|
+
const { classList, passthrough } = resolveLumenAstroProps(rest, [
|
|
26
|
+
'ui-graphic',
|
|
27
|
+
`ui-graphic--${variant}`,
|
|
28
|
+
`ui-graphic--${tone}`,
|
|
29
|
+
`ui-graphic--${size}`
|
|
30
|
+
], classProp, className)
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<div
|
|
34
|
+
aria-hidden={label ? undefined : 'true'}
|
|
35
|
+
aria-label={label}
|
|
36
|
+
class:list={classList}
|
|
37
|
+
role={label ? 'img' : undefined}
|
|
38
|
+
{...passthrough}
|
|
39
|
+
>
|
|
40
|
+
<div class="ui-graphic__content">
|
|
41
|
+
<slot />
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
|
|
4
|
+
import { resolveLumenAstroProps } from '@santi020k/lumen-core'
|
|
5
|
+
|
|
6
|
+
interface Props extends HTMLAttributes<'span'> {
|
|
7
|
+
class?: string | null
|
|
8
|
+
className?: string
|
|
9
|
+
label?: string
|
|
10
|
+
size?: 'lg' | 'md' | 'sm'
|
|
11
|
+
tone?: 'accent' | 'auto' | 'brand' | 'neutral'
|
|
12
|
+
variant?: 'empty' | 'error' | 'offline' | 'success'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
class: classProp = '',
|
|
17
|
+
className = '',
|
|
18
|
+
label,
|
|
19
|
+
size = 'md',
|
|
20
|
+
tone = 'auto',
|
|
21
|
+
variant = 'empty',
|
|
22
|
+
...rest
|
|
23
|
+
} = Astro.props
|
|
24
|
+
|
|
25
|
+
const { classList, passthrough } = resolveLumenAstroProps(rest, [
|
|
26
|
+
'ui-illustration',
|
|
27
|
+
`ui-illustration--${variant}`,
|
|
28
|
+
`ui-illustration--${tone}`,
|
|
29
|
+
`ui-illustration--${size}`
|
|
30
|
+
], classProp, className)
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
<span
|
|
34
|
+
aria-hidden={label ? undefined : 'true'}
|
|
35
|
+
aria-label={label}
|
|
36
|
+
class:list={classList}
|
|
37
|
+
role={label ? 'img' : undefined}
|
|
38
|
+
{...passthrough}
|
|
39
|
+
>
|
|
40
|
+
<svg aria-hidden="true" fill="none" viewBox="0 0 120 120">
|
|
41
|
+
<circle class="ui-illustration__wash" cx="60" cy="60" r="48" />
|
|
42
|
+
{variant === 'empty' && (
|
|
43
|
+
<g>
|
|
44
|
+
<path d="M32 48h56l-7 35H39l-7-35Z" />
|
|
45
|
+
<path d="M43 48 49 36h22l6 12M47 66h26" />
|
|
46
|
+
</g>
|
|
47
|
+
)}
|
|
48
|
+
{variant === 'success' && (
|
|
49
|
+
<g>
|
|
50
|
+
<circle cx="60" cy="60" r="28" />
|
|
51
|
+
<path d="m45 60 10 10 21-23" />
|
|
52
|
+
</g>
|
|
53
|
+
)}
|
|
54
|
+
{variant === 'error' && (
|
|
55
|
+
<g>
|
|
56
|
+
<circle cx="60" cy="60" r="28" />
|
|
57
|
+
<path d="m49 49 22 22m0-22L49 71" />
|
|
58
|
+
</g>
|
|
59
|
+
)}
|
|
60
|
+
{variant === 'offline' && (
|
|
61
|
+
<g>
|
|
62
|
+
<path d="M37 74h44a14 14 0 0 0 1-28 23 23 0 0 0-42-4 16 16 0 0 0-3 32Z" />
|
|
63
|
+
<path d="m38 34 44 52" />
|
|
64
|
+
</g>
|
|
65
|
+
)}
|
|
66
|
+
</svg>
|
|
67
|
+
</span>
|
package/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { default as AspectRatio } from './components/AspectRatio.astro'
|
|
|
11
11
|
export { default as Attachment } from './components/Attachment.astro'
|
|
12
12
|
export { default as Autocomplete } from './components/Autocomplete.astro'
|
|
13
13
|
export { default as Avatar } from './components/Avatar.astro'
|
|
14
|
+
export { default as Backdrop } from './components/Backdrop.astro'
|
|
14
15
|
export { default as BackToTop } from './components/BackToTop.astro'
|
|
15
16
|
export { default as Badge } from './components/Badge.astro'
|
|
16
17
|
export { default as BarChart } from './components/BarChart.astro'
|
|
@@ -65,9 +66,11 @@ export { default as FloatingBadge } from './components/FloatingBadge.astro'
|
|
|
65
66
|
export { default as Form } from './components/Form.astro'
|
|
66
67
|
export { default as FormattedDate } from './components/FormattedDate.astro'
|
|
67
68
|
export { default as GradientDivider } from './components/GradientDivider.astro'
|
|
69
|
+
export { default as Graphic } from './components/Graphic.astro'
|
|
68
70
|
export { default as Grid } from './components/Grid.astro'
|
|
69
71
|
export { default as HoverCard } from './components/HoverCard.astro'
|
|
70
72
|
export { default as Icon } from './components/Icon.astro'
|
|
73
|
+
export { default as Illustration } from './components/Illustration.astro'
|
|
71
74
|
export { default as Image } from './components/Image.astro'
|
|
72
75
|
export { default as Input } from './components/Input.astro'
|
|
73
76
|
export { default as InputGroup } from './components/InputGroup.astro'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@santi020k/lumen-astro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"uqr": "^0.1.3",
|
|
40
|
-
"@santi020k/lumen": "^1.
|
|
41
|
-
"@santi020k/lumen
|
|
40
|
+
"@santi020k/lumen-core": "^1.4.0",
|
|
41
|
+
"@santi020k/lumen": "^1.6.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@astrojs/ts-plugin": "^1.10.
|
|
45
|
-
"astro": "^7.2.
|
|
44
|
+
"@astrojs/ts-plugin": "^1.10.11",
|
|
45
|
+
"astro": "^7.2.6",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
|
-
"vitest": "^4.1.
|
|
47
|
+
"vitest": "^4.1.11"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"astro": ">=5"
|
|
@@ -3375,13 +3375,13 @@ const kanbanColumnSelector = '[data-ui-kanban-column]'
|
|
|
3375
3375
|
|
|
3376
3376
|
const initKanbanBoards = (scope: ParentNode): void => {
|
|
3377
3377
|
for (const root of scope.querySelectorAll<HTMLElement>('[data-ui-kanban]')) {
|
|
3378
|
+
for (const handle of root.querySelectorAll<HTMLElement>('[data-ui-kanban-handle]'))
|
|
3379
|
+
handle.draggable = true
|
|
3380
|
+
|
|
3378
3381
|
if (root.dataset.uiKanbanBound === 'true') continue
|
|
3379
3382
|
|
|
3380
3383
|
root.dataset.uiKanbanBound = 'true'
|
|
3381
3384
|
|
|
3382
|
-
for (const handle of root.querySelectorAll<HTMLElement>('[data-ui-kanban-handle]'))
|
|
3383
|
-
handle.draggable = true
|
|
3384
|
-
|
|
3385
3385
|
let pointer: {
|
|
3386
3386
|
active: boolean
|
|
3387
3387
|
handle: HTMLElement
|
|
@@ -3391,13 +3391,21 @@ const initKanbanBoards = (scope: ParentNode): void => {
|
|
|
3391
3391
|
startY: number
|
|
3392
3392
|
} | undefined
|
|
3393
3393
|
|
|
3394
|
-
const itemFor = (target: EventTarget | null): HTMLElement | null =>
|
|
3395
|
-
|
|
3396
|
-
|
|
3394
|
+
const itemFor = (target: EventTarget | null): HTMLElement | null => {
|
|
3395
|
+
const item = target instanceof Element ?
|
|
3396
|
+
target.closest<HTMLElement>('[data-ui-kanban-item]') :
|
|
3397
|
+
null
|
|
3398
|
+
|
|
3399
|
+
return item?.closest<HTMLElement>('[data-ui-kanban]') === root ? item : null
|
|
3400
|
+
}
|
|
3397
3401
|
|
|
3398
|
-
const columnFor = (target: EventTarget | null): HTMLElement | null =>
|
|
3399
|
-
target
|
|
3400
|
-
|
|
3402
|
+
const columnFor = (target: EventTarget | null): HTMLElement | null => {
|
|
3403
|
+
const column = target instanceof Element ?
|
|
3404
|
+
target.closest<HTMLElement>(kanbanColumnSelector) :
|
|
3405
|
+
null
|
|
3406
|
+
|
|
3407
|
+
return column?.closest<HTMLElement>('[data-ui-kanban]') === root ? column : null
|
|
3408
|
+
}
|
|
3401
3409
|
|
|
3402
3410
|
const clearState = (): void => {
|
|
3403
3411
|
pointer = undefined
|
|
@@ -3580,8 +3588,7 @@ const initKanbanBoards = (scope: ParentNode): void => {
|
|
|
3580
3588
|
|
|
3581
3589
|
pointer.item.dataset.state = 'dragging'
|
|
3582
3590
|
|
|
3583
|
-
const target = document.elementFromPoint(event.clientX, event.clientY)
|
|
3584
|
-
?.closest<HTMLElement>(kanbanColumnSelector)
|
|
3591
|
+
const target = columnFor(document.elementFromPoint(event.clientX, event.clientY))
|
|
3585
3592
|
|
|
3586
3593
|
for (const column of root.querySelectorAll<HTMLElement>(kanbanColumnSelector)) {
|
|
3587
3594
|
if (column === target) column.dataset.state = 'drop-target'
|
|
@@ -3592,8 +3599,7 @@ const initKanbanBoards = (scope: ParentNode): void => {
|
|
|
3592
3599
|
root.addEventListener('pointerup', event => {
|
|
3593
3600
|
if (!pointer || pointer.pointerId !== event.pointerId) return
|
|
3594
3601
|
|
|
3595
|
-
const target = document.elementFromPoint(event.clientX, event.clientY)
|
|
3596
|
-
?.closest<HTMLElement>(kanbanColumnSelector)
|
|
3602
|
+
const target = columnFor(document.elementFromPoint(event.clientX, event.clientY))
|
|
3597
3603
|
|
|
3598
3604
|
if (pointer.active && target) requestMove(pointer.item, target, 'pointer')
|
|
3599
3605
|
|