lapikit 0.0.0-insiders.fd1a829 → 0.0.0-insiders.fd9617d
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/LICENSE +21 -0
- package/README.md +117 -1
- package/bin/configuration.js +303 -0
- package/bin/helper.js +59 -0
- package/bin/index.js +33 -0
- package/bin/presets.js +26 -0
- package/bin/prompts.js +67 -0
- package/dist/actions/accordion.svelte.d.ts +9 -0
- package/dist/actions/accordion.svelte.js +24 -0
- package/dist/actions/index.d.ts +2 -0
- package/dist/actions/index.js +2 -0
- package/dist/actions/use-theme.d.ts +1 -0
- package/dist/actions/use-theme.js +18 -0
- package/dist/assets/icons/arrow-down.svelte +12 -0
- package/dist/assets/icons/arrow-down.svelte.d.ts +18 -0
- package/dist/assets/icons/arrow-up.svelte +12 -0
- package/dist/assets/icons/arrow-up.svelte.d.ts +18 -0
- package/dist/assets/icons/close-fill.svelte +12 -0
- package/dist/assets/icons/close-fill.svelte.d.ts +18 -0
- package/dist/assets/icons/loading-fill.svelte +31 -0
- package/dist/assets/icons/loading-fill.svelte.d.ts +18 -0
- package/dist/components/accordion/accordion.css +36 -0
- package/dist/components/accordion/accordion.svelte +39 -0
- package/dist/components/accordion/accordion.svelte.d.ts +4 -0
- package/dist/components/accordion/modules/accordion-item.css +68 -0
- package/dist/components/accordion/modules/accordion-item.svelte +94 -0
- package/dist/components/accordion/modules/accordion-item.svelte.d.ts +4 -0
- package/dist/components/accordion/types.d.ts +33 -0
- package/dist/components/accordion/types.js +1 -0
- package/dist/components/alert/alert.css +130 -0
- package/dist/components/alert/alert.svelte +89 -0
- package/dist/components/alert/alert.svelte.d.ts +4 -0
- package/dist/components/alert/types.d.ts +28 -0
- package/dist/components/alert/types.js +1 -0
- package/dist/components/app/app.css +26 -0
- package/dist/components/app/app.svelte +79 -0
- package/dist/components/app/app.svelte.d.ts +4 -0
- package/dist/components/app/types.d.ts +10 -0
- package/dist/components/app/types.js +1 -0
- package/dist/components/appbar/appbar.css +38 -0
- package/dist/components/appbar/appbar.svelte +40 -0
- package/dist/components/appbar/appbar.svelte.d.ts +4 -0
- package/dist/components/appbar/types.d.ts +15 -0
- package/dist/components/appbar/types.js +1 -0
- package/dist/components/aspect-ratio/aspect-ratio.css +19 -0
- package/dist/components/aspect-ratio/aspect-ratio.svelte +25 -0
- package/dist/components/aspect-ratio/aspect-ratio.svelte.d.ts +4 -0
- package/dist/components/aspect-ratio/types.d.ts +5 -0
- package/dist/components/aspect-ratio/types.js +1 -0
- package/dist/components/avatar/avatar.css +102 -0
- package/dist/components/avatar/avatar.svelte +46 -0
- package/dist/components/avatar/avatar.svelte.d.ts +4 -0
- package/dist/components/avatar/types.d.ts +22 -0
- package/dist/components/avatar/types.js +1 -0
- package/dist/components/button/button.css +240 -0
- package/dist/components/button/button.svelte +102 -0
- package/dist/components/button/button.svelte.d.ts +4 -0
- package/dist/components/button/types.d.ts +29 -0
- package/dist/components/button/types.js +1 -0
- package/dist/components/card/card.css +105 -0
- package/dist/components/card/card.svelte +67 -0
- package/dist/components/card/card.svelte.d.ts +4 -0
- package/dist/components/card/types.d.ts +20 -0
- package/dist/components/card/types.js +1 -0
- package/dist/components/chip/chip.css +224 -0
- package/dist/components/chip/chip.svelte +131 -0
- package/dist/components/chip/chip.svelte.d.ts +4 -0
- package/dist/components/chip/types.d.ts +32 -0
- package/dist/components/chip/types.js +1 -0
- package/dist/components/dialog/dialog.css +129 -0
- package/dist/components/dialog/dialog.svelte +67 -0
- package/dist/components/dialog/dialog.svelte.d.ts +4 -0
- package/dist/components/dialog/types.d.ts +24 -0
- package/dist/components/dialog/types.js +1 -0
- package/dist/components/dropdown/dropdown.css +13 -0
- package/dist/components/dropdown/dropdown.svelte +115 -0
- package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
- package/dist/components/dropdown/types.d.ts +26 -0
- package/dist/components/dropdown/types.js +1 -0
- package/dist/components/icon/icon.css +78 -0
- package/dist/components/icon/icon.svelte +49 -0
- package/dist/components/icon/icon.svelte.d.ts +4 -0
- package/dist/components/icon/types.d.ts +16 -0
- package/dist/components/icon/types.js +1 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.js +23 -0
- package/dist/components/list/list.css +149 -0
- package/dist/components/list/list.svelte +44 -0
- package/dist/components/list/list.svelte.d.ts +4 -0
- package/dist/components/list/modules/list-item.css +67 -0
- package/dist/components/list/modules/list-item.svelte +76 -0
- package/dist/components/list/modules/list-item.svelte.d.ts +4 -0
- package/dist/components/list/types.d.ts +33 -0
- package/dist/components/list/types.js +1 -0
- package/dist/components/modal/modal.css +137 -0
- package/dist/components/modal/modal.svelte +112 -0
- package/dist/components/modal/modal.svelte.d.ts +4 -0
- package/dist/components/modal/types.d.ts +26 -0
- package/dist/components/modal/types.js +1 -0
- package/dist/components/popover/popover.css +13 -0
- package/dist/components/popover/popover.svelte +73 -0
- package/dist/components/popover/popover.svelte.d.ts +4 -0
- package/dist/components/popover/types.d.ts +20 -0
- package/dist/components/popover/types.js +1 -0
- package/dist/components/separator/separator.css +42 -0
- package/dist/components/separator/separator.svelte +37 -0
- package/dist/components/separator/separator.svelte.d.ts +4 -0
- package/dist/components/separator/types.d.ts +15 -0
- package/dist/components/separator/types.js +1 -0
- package/dist/components/spacer/spacer.css +3 -0
- package/dist/components/spacer/spacer.svelte +7 -0
- package/dist/components/spacer/spacer.svelte.d.ts +4 -0
- package/dist/components/spacer/types.d.ts +4 -0
- package/dist/components/spacer/types.js +1 -0
- package/dist/components/textfield/textfield.css +298 -0
- package/dist/components/textfield/textfield.svelte +193 -0
- package/dist/components/textfield/textfield.svelte.d.ts +4 -0
- package/dist/components/textfield/types.d.ts +37 -0
- package/dist/components/textfield/types.js +1 -0
- package/dist/components/toolbar/toolbar.css +106 -0
- package/dist/components/toolbar/toolbar.svelte +47 -0
- package/dist/components/toolbar/toolbar.svelte.d.ts +4 -0
- package/dist/components/toolbar/types.d.ts +27 -0
- package/dist/components/toolbar/types.js +1 -0
- package/dist/components/tooltip/tooltip.css +116 -0
- package/dist/components/tooltip/tooltip.svelte +113 -0
- package/dist/components/tooltip/tooltip.svelte.d.ts +4 -0
- package/dist/components/tooltip/types.d.ts +23 -0
- package/dist/components/tooltip/types.js +1 -0
- package/dist/entry-bundler.d.ts +12 -0
- package/dist/entry-bundler.js +107 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +23 -3
- package/dist/internal/config/presets.d.ts +149 -0
- package/dist/internal/config/presets.js +169 -0
- package/dist/internal/config/variables.d.ts +3 -0
- package/dist/internal/config/variables.js +3 -0
- package/dist/internal/core/actions/assets.svelte.d.ts +8 -0
- package/dist/internal/core/actions/assets.svelte.js +54 -0
- package/dist/internal/core/actions/dropdown.svelte.d.ts +7 -0
- package/dist/internal/core/actions/dropdown.svelte.js +148 -0
- package/dist/internal/core/actions/popover.svelte.d.ts +7 -0
- package/dist/internal/core/actions/popover.svelte.js +134 -0
- package/dist/internal/core/actions/tooltip.svelte.d.ts +7 -0
- package/dist/internal/core/actions/tooltip.svelte.js +131 -0
- package/dist/internal/core/animations/ripple.d.ts +12 -0
- package/dist/internal/core/animations/ripple.js +93 -0
- package/dist/{server/modules → internal/core/bin}/ansi.d.ts +0 -1
- package/dist/{server/modules → internal/core/bin}/ansi.js +0 -11
- package/dist/internal/core/bin/terminal.d.ts +1 -0
- package/dist/internal/core/bin/terminal.js +12 -0
- package/dist/internal/core/css.d.ts +1 -0
- package/dist/internal/core/css.js +16 -0
- package/dist/internal/core/formatter/component.d.ts +5 -0
- package/dist/internal/core/formatter/component.js +60 -0
- package/dist/internal/core/formatter/device.d.ts +5 -0
- package/dist/internal/core/formatter/device.js +66 -0
- package/dist/internal/core/formatter/index.d.ts +7 -0
- package/dist/internal/core/formatter/index.js +35 -0
- package/dist/internal/core/formatter/style.d.ts +4 -0
- package/dist/internal/core/formatter/style.js +15 -0
- package/dist/internal/core/formatter/theme.d.ts +5 -0
- package/dist/internal/core/formatter/theme.js +44 -0
- package/dist/internal/core/formatter/typography.d.ts +5 -0
- package/dist/internal/core/formatter/typography.js +12 -0
- package/dist/internal/core/standard-colors.d.ts +75 -0
- package/dist/internal/core/standard-colors.js +75 -0
- package/dist/{server/modules/x11.d.ts → internal/core/x11-colors.d.ts} +1 -1
- package/dist/internal/helpers/colors.d.ts +1 -0
- package/dist/{server/modules → internal/helpers}/colors.js +2 -2
- package/dist/internal/helpers/convert.d.ts +1 -0
- package/dist/internal/helpers/convert.js +17 -0
- package/dist/internal/helpers/deep-merge.d.ts +44 -0
- package/dist/internal/helpers/deep-merge.js +80 -0
- package/dist/internal/helpers/outside.d.ts +9 -0
- package/dist/internal/helpers/outside.js +34 -0
- package/dist/internal/helpers/parser.d.ts +10 -0
- package/dist/internal/helpers/parser.js +93 -0
- package/dist/internal/helpers/scroll.d.ts +1 -0
- package/dist/internal/helpers/scroll.js +5 -0
- package/dist/internal/plugins/vite.d.ts +8 -0
- package/dist/internal/plugins/vite.js +33 -0
- package/dist/internal/types/components.d.ts +14 -0
- package/dist/internal/types/components.js +1 -0
- package/dist/internal/types/configuration.d.ts +63 -0
- package/dist/internal/types/configuration.js +1 -0
- package/dist/internal/types/index.d.ts +2 -0
- package/dist/internal/types/index.js +2 -0
- package/dist/labs/components/btn/btn.svelte +13 -0
- package/dist/labs/components/btn/btn.svelte.d.ts +5 -0
- package/dist/labs/components/index.d.ts +1 -0
- package/dist/labs/components/index.js +2 -0
- package/dist/stores/breakpoints.d.ts +6 -0
- package/dist/stores/breakpoints.js +14 -0
- package/dist/stores/components.d.ts +8 -0
- package/dist/stores/components.js +26 -0
- package/dist/stores/devices.d.ts +6 -0
- package/dist/stores/devices.js +9 -0
- package/dist/stores/index.d.ts +5 -0
- package/dist/stores/index.js +5 -0
- package/dist/stores/themes.d.ts +2 -0
- package/dist/stores/themes.js +4 -0
- package/dist/stores/viewport.d.ts +7 -0
- package/dist/stores/viewport.js +7 -0
- package/dist/styles/animation.css +33 -0
- package/dist/styles/keyframes.css +30 -0
- package/dist/styles/{normalize.css → reset.css} +15 -5
- package/dist/styles.css.d.ts +4 -0
- package/dist/themes.css +0 -0
- package/dist/themes.css.d.ts +4 -0
- package/package.json +135 -74
- package/dist/app.d.ts +0 -13
- package/dist/app.html +0 -12
- package/dist/server/modules/colors.d.ts +0 -1
- package/dist/server/modules/css.d.ts +0 -1
- package/dist/server/modules/css.js +0 -144
- package/dist/server/modules/devices.d.ts +0 -1
- package/dist/server/modules/devices.js +0 -43
- package/dist/server/modules/importer.d.ts +0 -1
- package/dist/server/modules/importer.js +0 -13
- package/dist/server/modules/themes.d.ts +0 -4
- package/dist/server/modules/themes.js +0 -94
- package/dist/server/vite.d.ts +0 -11
- package/dist/server/vite.js +0 -17
- package/dist/styles/variables.css +0 -7
- /package/dist/{server/modules → internal/core}/minify.d.ts +0 -0
- /package/dist/{server/modules → internal/core}/minify.js +0 -0
- /package/dist/{server/modules/x11.js → internal/core/x11-colors.js} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types/index.js';
|
|
2
|
+
type Variant = 'outline' | 'text' | 'dash';
|
|
3
|
+
type Density = 'compact' | 'comfortable' | 'default';
|
|
4
|
+
type Orientation = 'horizontal' | 'vertical';
|
|
5
|
+
type Location = 'top' | 'bottom';
|
|
6
|
+
export interface ToolbarProps extends Component {
|
|
7
|
+
is?: 'div' | 'header' | 'nav';
|
|
8
|
+
variant?: Variant | {
|
|
9
|
+
[key: string]: Variant;
|
|
10
|
+
};
|
|
11
|
+
rounded?: string;
|
|
12
|
+
density?: Density | {
|
|
13
|
+
[key: string]: Density;
|
|
14
|
+
};
|
|
15
|
+
dark?: boolean;
|
|
16
|
+
light?: boolean;
|
|
17
|
+
color?: string;
|
|
18
|
+
orientation?: Orientation | {
|
|
19
|
+
[key: string]: Orientation;
|
|
20
|
+
};
|
|
21
|
+
background?: string;
|
|
22
|
+
location?: Location | {
|
|
23
|
+
[key: string]: Location;
|
|
24
|
+
};
|
|
25
|
+
classContent?: string | string[] | undefined;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
.kit-tooltip {
|
|
2
|
+
inset: 0px auto auto 0px;
|
|
3
|
+
margin: 0px;
|
|
4
|
+
position: fixed;
|
|
5
|
+
z-index: 2000;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.kit-tooltip-content {
|
|
9
|
+
background-color: var(--tooltip-background, var(--kit-background-grouped-primary));
|
|
10
|
+
color: var(--tooltip-color, var(--kit-label-primary));
|
|
11
|
+
border-radius: var(--tooltip-shape, var(--system-shape-md));
|
|
12
|
+
border: 1px solid var(--tooltip-background, var(--kit-background-grouped-primary));
|
|
13
|
+
font-size: 0.875rem;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
width: auto;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
overflow-wrap: break-word;
|
|
18
|
+
box-shadow: 0px 16px 29px -10px color-mix(in oklab, var(--kit-state-shadow) 60%, transparent);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* density */
|
|
22
|
+
.kit-tooltip-content[breakpoint]kit-tooltip-content--density-default {
|
|
23
|
+
padding: 0.15rem 0.625rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.kit-tooltip-content[breakpoint]kit-tooltip-content--density-compact {
|
|
27
|
+
padding: 0.125rem 0.5rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.kit-tooltip-content[breakpoint]kit-tooltip-content--density-comfortable {
|
|
31
|
+
padding: 0.35rem 0.75rem;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.kit-tooltip-content--arrow::after {
|
|
35
|
+
content: ' ';
|
|
36
|
+
position: absolute;
|
|
37
|
+
border-style: solid;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.kit-tooltip-content--arrow.kit-tooltip-content--bottom::after,
|
|
41
|
+
.kit-tooltip-content--arrow.kit-tooltip-content--top::after {
|
|
42
|
+
left: 50%;
|
|
43
|
+
margin-left: -0.35rem;
|
|
44
|
+
border-width: 0.35rem;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.kit-tooltip-content--arrow.kit-tooltip-content--bottom::after {
|
|
48
|
+
bottom: 100%;
|
|
49
|
+
border-color: transparent transparent var(--tooltip-background) transparent;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.kit-tooltip-content--arrow.kit-tooltip-content--top::after {
|
|
53
|
+
top: 100%;
|
|
54
|
+
border-color: var(--tooltip-background) transparent transparent transparent;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.kit-tooltip-content--arrow.kit-tooltip-content--left::after,
|
|
58
|
+
.kit-tooltip-content--arrow.kit-tooltip-content--right::after {
|
|
59
|
+
top: 50%;
|
|
60
|
+
margin-top: -0.35rem;
|
|
61
|
+
border-width: 0.35rem;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.kit-tooltip-content--arrow.kit-tooltip-content--right::after {
|
|
65
|
+
right: 100%;
|
|
66
|
+
border-color: transparent var(--tooltip-background) transparent transparent;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.kit-tooltip-content--arrow.kit-tooltip-content--left::after {
|
|
70
|
+
left: 100%;
|
|
71
|
+
border-color: transparent transparent transparent var(--tooltip-background);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.kit-tooltip-content--top,
|
|
75
|
+
.kit-tooltip-content--bottom,
|
|
76
|
+
.kit-tooltip-content--right,
|
|
77
|
+
.kit-tooltip-content--left {
|
|
78
|
+
animation-duration: 150ms;
|
|
79
|
+
animation-name: enter;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.kit-tooltip-content--top {
|
|
83
|
+
--animate-enter-pos1: 0;
|
|
84
|
+
--animate-enter-pos2: 0.5rem;
|
|
85
|
+
--animate-enter-pos3: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.kit-tooltip-content--bottom {
|
|
89
|
+
--animate-enter-pos1: 0;
|
|
90
|
+
--animate-enter-pos2: -0.5rem;
|
|
91
|
+
--animate-enter-pos3: 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.kit-tooltip-content--right {
|
|
95
|
+
--animate-enter-pos1: -0.5rem;
|
|
96
|
+
--animate-enter-pos2: 0;
|
|
97
|
+
--animate-enter-pos3: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.kit-tooltip-content--left {
|
|
101
|
+
--animate-enter-pos1: 0.5rem;
|
|
102
|
+
--animate-enter-pos2: 0;
|
|
103
|
+
--animate-enter-pos3: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@keyframes enter {
|
|
107
|
+
0% {
|
|
108
|
+
opacity: 0;
|
|
109
|
+
transform: translate3d(
|
|
110
|
+
var(--animate-enter-pos1),
|
|
111
|
+
var(--animate-enter-pos2),
|
|
112
|
+
var(--animate-enter-pos3)
|
|
113
|
+
)
|
|
114
|
+
scale3d(0.95, 0.95, 0.95) rotate(0);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getAssets } from '../../internal/core/actions/assets.svelte.js';
|
|
3
|
+
import { getPositionsTooltip } from '../../internal/core/actions/tooltip.svelte.js';
|
|
4
|
+
import type { PositionElement, TooltipProps } from './types.js';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
tooltip,
|
|
9
|
+
open = $bindable(),
|
|
10
|
+
label,
|
|
11
|
+
dark,
|
|
12
|
+
light,
|
|
13
|
+
rounded,
|
|
14
|
+
color,
|
|
15
|
+
background,
|
|
16
|
+
location = 'bottom',
|
|
17
|
+
delayDuration = 850,
|
|
18
|
+
density = 'default',
|
|
19
|
+
variant,
|
|
20
|
+
disabled,
|
|
21
|
+
avoidCollisions = true,
|
|
22
|
+
forceMount,
|
|
23
|
+
...rest
|
|
24
|
+
}: TooltipProps = $props();
|
|
25
|
+
|
|
26
|
+
const positionAxis = getPositionsTooltip();
|
|
27
|
+
const assets = getAssets();
|
|
28
|
+
|
|
29
|
+
let ref: HTMLElement | null = $state(null);
|
|
30
|
+
let refTooltip: HTMLElement | null = $state(null);
|
|
31
|
+
let timer: ReturnType<typeof setTimeout> | null = $state(null);
|
|
32
|
+
let axis: PositionElement = $state({ x: 0, y: 0, location: null });
|
|
33
|
+
let innerHeight = $state(0);
|
|
34
|
+
let innerWidth = $state(0);
|
|
35
|
+
let scrollX = $state(0);
|
|
36
|
+
let scrollY = $state(0);
|
|
37
|
+
|
|
38
|
+
axis = positionAxis?.values;
|
|
39
|
+
|
|
40
|
+
$effect(() => {
|
|
41
|
+
if (
|
|
42
|
+
open &&
|
|
43
|
+
ref &&
|
|
44
|
+
refTooltip &&
|
|
45
|
+
(scrollX > 0 || scrollY > 0 || innerHeight > 0 || innerWidth > 0)
|
|
46
|
+
) {
|
|
47
|
+
positionAxis.update(ref, refTooltip, location, true, avoidCollisions);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
$effect(() => {
|
|
52
|
+
if (tooltip) forceMount = true;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const handleMouse = (state: string) => {
|
|
56
|
+
if (disabled) return (open = false);
|
|
57
|
+
if (state === 'enter') {
|
|
58
|
+
timer = setTimeout(() => {
|
|
59
|
+
open = true;
|
|
60
|
+
}, delayDuration);
|
|
61
|
+
} else if (state === 'leave') {
|
|
62
|
+
if (timer) {
|
|
63
|
+
clearTimeout(timer);
|
|
64
|
+
timer = null;
|
|
65
|
+
}
|
|
66
|
+
open = false;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<svelte:window bind:innerHeight bind:innerWidth bind:scrollX bind:scrollY />
|
|
72
|
+
|
|
73
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
74
|
+
<span
|
|
75
|
+
bind:this={ref}
|
|
76
|
+
onmouseenter={() => handleMouse('enter')}
|
|
77
|
+
onmouseleave={() => handleMouse('leave')}
|
|
78
|
+
style:display="inline-flex"
|
|
79
|
+
>
|
|
80
|
+
{@render children?.()}
|
|
81
|
+
</span>
|
|
82
|
+
|
|
83
|
+
{#if open || forceMount}
|
|
84
|
+
<div
|
|
85
|
+
bind:this={refTooltip}
|
|
86
|
+
class={['kit-tooltip']}
|
|
87
|
+
role="tooltip"
|
|
88
|
+
aria-label={label}
|
|
89
|
+
style={`transform: translate(${axis.x}px, ${axis.y}px);display: ${open ? 'initial' : 'none'}`}
|
|
90
|
+
>
|
|
91
|
+
<div
|
|
92
|
+
class={[
|
|
93
|
+
'kit-tooltip-content animate-in',
|
|
94
|
+
light && 'light',
|
|
95
|
+
dark && 'dark',
|
|
96
|
+
rounded && assets.shape(rounded),
|
|
97
|
+
axis?.location && `kit-tooltip-content--${axis?.location}`,
|
|
98
|
+
variant && `kit-tooltip-content--${variant}`,
|
|
99
|
+
density && assets.className('tooltip-content', 'density', density),
|
|
100
|
+
rest.class
|
|
101
|
+
]}
|
|
102
|
+
style:--tooltip-background={assets.color(background)}
|
|
103
|
+
style:--tooltip-color={assets.color(color)}
|
|
104
|
+
style:--tooltip-shape={assets.shape(rounded)}
|
|
105
|
+
>
|
|
106
|
+
{#if tooltip}
|
|
107
|
+
{@render tooltip?.()}
|
|
108
|
+
{:else}
|
|
109
|
+
{label}
|
|
110
|
+
{/if}
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
{/if}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Component } from '../../internal/types/index.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export interface TooltipProps extends Component {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
dark?: boolean;
|
|
6
|
+
light?: boolean;
|
|
7
|
+
rounded?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
location?: 'top' | 'bottom' | 'left' | 'right';
|
|
10
|
+
color?: string;
|
|
11
|
+
background?: string;
|
|
12
|
+
delayDuration?: number;
|
|
13
|
+
variant?: 'arrow';
|
|
14
|
+
density?: 'compact' | 'comfortable' | 'default';
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
avoidCollisions?: boolean;
|
|
17
|
+
tooltip?: Snippet;
|
|
18
|
+
}
|
|
19
|
+
export type PositionElement = {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
location: string | null;
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type LapikitPreprocessOptions = {
|
|
2
|
+
plugins?: string[];
|
|
3
|
+
};
|
|
4
|
+
declare function lapikitPreprocess(options?: LapikitPreprocessOptions): {
|
|
5
|
+
markup({ content }: {
|
|
6
|
+
content: string;
|
|
7
|
+
filename?: string;
|
|
8
|
+
}): {
|
|
9
|
+
code: string;
|
|
10
|
+
} | undefined;
|
|
11
|
+
};
|
|
12
|
+
export { lapikitPreprocess };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const components = ['btn'];
|
|
2
|
+
function componentName(shortName) {
|
|
3
|
+
return 'Kit' + shortName.charAt(0).toUpperCase() + shortName.slice(1);
|
|
4
|
+
}
|
|
5
|
+
// plugins lapikit
|
|
6
|
+
const lapikitPlugins = {
|
|
7
|
+
repl: {
|
|
8
|
+
components: ['repl'],
|
|
9
|
+
ref: '@lapikit/repl'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
function lapikitPreprocess(options) {
|
|
13
|
+
return {
|
|
14
|
+
markup({ content }) {
|
|
15
|
+
const allComponents = [...components];
|
|
16
|
+
const componentToRef = new Map();
|
|
17
|
+
components.forEach((comp) => {
|
|
18
|
+
componentToRef.set(comp, 'lapikit/labs/components');
|
|
19
|
+
});
|
|
20
|
+
// plugins
|
|
21
|
+
if (options?.plugins) {
|
|
22
|
+
options.plugins.forEach((pluginKey) => {
|
|
23
|
+
const plugin = lapikitPlugins[pluginKey];
|
|
24
|
+
if (plugin) {
|
|
25
|
+
plugin.components.forEach((comp) => {
|
|
26
|
+
if (!allComponents.includes(comp)) {
|
|
27
|
+
allComponents.push(comp);
|
|
28
|
+
}
|
|
29
|
+
componentToRef.set(comp, plugin.ref);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const hasComponent = allComponents.some((comp) => content.includes(`<kit:${comp}`));
|
|
35
|
+
if (!hasComponent)
|
|
36
|
+
return;
|
|
37
|
+
let processedContent = content;
|
|
38
|
+
const importedComponents = new Map();
|
|
39
|
+
let hasChanges = true;
|
|
40
|
+
while (hasChanges) {
|
|
41
|
+
hasChanges = false;
|
|
42
|
+
for (const shortName of allComponents) {
|
|
43
|
+
const componentNameStr = componentName(shortName);
|
|
44
|
+
const attrPattern = `(?:[^>"']|"[^"]*"|'[^']*')*?`;
|
|
45
|
+
const selfClosingRegex = new RegExp(`<kit:${shortName}(${attrPattern})\\s*/>`, 'g');
|
|
46
|
+
const pairRegex = new RegExp(`<kit:${shortName}(${attrPattern})>([\\s\\S]*?)<\\/kit:${shortName}\\s*>`, 'g');
|
|
47
|
+
let newContent = processedContent.replace(selfClosingRegex, (fullMatch, attrs) => {
|
|
48
|
+
hasChanges = true;
|
|
49
|
+
const ref = componentToRef.get(shortName) || 'lapikit/labs/components';
|
|
50
|
+
importedComponents.set(componentNameStr, ref);
|
|
51
|
+
return `<${componentNameStr}${attrs} />`;
|
|
52
|
+
});
|
|
53
|
+
newContent = newContent.replace(pairRegex, (fullMatch, attrs, children) => {
|
|
54
|
+
hasChanges = true;
|
|
55
|
+
const ref = componentToRef.get(shortName) || 'lapikit/labs/components';
|
|
56
|
+
importedComponents.set(componentNameStr, ref);
|
|
57
|
+
return `<${componentNameStr}${attrs}>${children}</${componentNameStr}>`;
|
|
58
|
+
});
|
|
59
|
+
if (newContent !== processedContent) {
|
|
60
|
+
processedContent = newContent;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (processedContent === content)
|
|
65
|
+
return;
|
|
66
|
+
if (importedComponents.size > 0) {
|
|
67
|
+
const importsByRef = new Map();
|
|
68
|
+
importedComponents.forEach((ref, component) => {
|
|
69
|
+
if (!importsByRef.has(ref)) {
|
|
70
|
+
importsByRef.set(ref, []);
|
|
71
|
+
}
|
|
72
|
+
importsByRef.get(ref).push(component);
|
|
73
|
+
});
|
|
74
|
+
const importLines = Array.from(importsByRef.entries())
|
|
75
|
+
.map(([ref, components]) => {
|
|
76
|
+
const imports = components.join(', ');
|
|
77
|
+
return `\n\timport { ${imports} } from '${ref}';`;
|
|
78
|
+
})
|
|
79
|
+
.join('');
|
|
80
|
+
const scriptRegex = /<script(?![^>]*\bmodule\b)([^>]*)>/;
|
|
81
|
+
const scriptMatch = processedContent.match(scriptRegex);
|
|
82
|
+
if (scriptMatch && scriptMatch.index !== undefined) {
|
|
83
|
+
const insertPos = scriptMatch.index + scriptMatch[0].length;
|
|
84
|
+
processedContent =
|
|
85
|
+
processedContent.slice(0, insertPos) + importLines + processedContent.slice(insertPos);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const moduleScriptMatch = processedContent.match(/<script[^>]*\bmodule\b[^>]*>/);
|
|
89
|
+
if (moduleScriptMatch && moduleScriptMatch.index !== undefined) {
|
|
90
|
+
const moduleScriptEnd = processedContent.indexOf('</script>', moduleScriptMatch.index) + '</script>'.length;
|
|
91
|
+
processedContent =
|
|
92
|
+
processedContent.slice(0, moduleScriptEnd) +
|
|
93
|
+
`\n\n<script>${importLines}\n</script>` +
|
|
94
|
+
processedContent.slice(moduleScriptEnd);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
processedContent = `<script>${importLines}\n</script>\n\n` + processedContent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
code: processedContent
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export { lapikitPreprocess };
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { deepMerge } from './internal/helpers/deep-merge.js';
|
|
2
|
+
import { breakpoints } from './stores/breakpoints.js';
|
|
3
|
+
import { get } from 'svelte/store';
|
|
4
|
+
import { devices } from './stores/devices.js';
|
|
5
|
+
import { valueToPx } from './internal/helpers/convert.js';
|
|
6
|
+
function createLapikit(lapikit) {
|
|
7
|
+
if (lapikit?.breakpoints?.thresholds) {
|
|
8
|
+
const currentBreakpoints = get(breakpoints);
|
|
9
|
+
const breakpointMerged = deepMerge(currentBreakpoints, lapikit.breakpoints.thresholds);
|
|
10
|
+
const formattedBreakpoints = Object.fromEntries(Object.entries(breakpointMerged).map(([key, value]) => [key, valueToPx(value)]));
|
|
11
|
+
breakpoints.set(formattedBreakpoints);
|
|
12
|
+
}
|
|
13
|
+
if (lapikit?.breakpoints?.devices) {
|
|
14
|
+
const currentDevices = get(devices);
|
|
15
|
+
const currentBreakpoints = get(breakpoints);
|
|
16
|
+
const deviceMerged = deepMerge(currentDevices, lapikit.breakpoints.devices);
|
|
17
|
+
const formattedDevices = Object.fromEntries(Object.entries(deviceMerged).map(([key, deviceKey]) => {
|
|
18
|
+
const breakpointValue = currentBreakpoints[deviceKey];
|
|
19
|
+
return [key, valueToPx(breakpointValue)];
|
|
20
|
+
}));
|
|
21
|
+
devices.set(formattedDevices);
|
|
22
|
+
}
|
|
4
23
|
}
|
|
24
|
+
export default createLapikit;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
export declare const preset: {
|
|
2
|
+
breakpoints: {
|
|
3
|
+
devices: {
|
|
4
|
+
desktop: number;
|
|
5
|
+
tablet: number;
|
|
6
|
+
mobile: number;
|
|
7
|
+
};
|
|
8
|
+
thresholds: {
|
|
9
|
+
base: number;
|
|
10
|
+
xs: number;
|
|
11
|
+
sm: number;
|
|
12
|
+
md: number;
|
|
13
|
+
lg: number;
|
|
14
|
+
xl: number;
|
|
15
|
+
'2xl': number;
|
|
16
|
+
'3xl': number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
theme: {
|
|
20
|
+
defaultTheme: string;
|
|
21
|
+
colorScheme: boolean;
|
|
22
|
+
themes: {
|
|
23
|
+
light: {
|
|
24
|
+
dark: boolean;
|
|
25
|
+
colors: {
|
|
26
|
+
label: {
|
|
27
|
+
primary: string;
|
|
28
|
+
secondary: string;
|
|
29
|
+
tertiary: string;
|
|
30
|
+
quaternary: string;
|
|
31
|
+
};
|
|
32
|
+
accent: {
|
|
33
|
+
primary: string;
|
|
34
|
+
success: string;
|
|
35
|
+
warning: string;
|
|
36
|
+
destructive: string;
|
|
37
|
+
info: string;
|
|
38
|
+
};
|
|
39
|
+
separator: {
|
|
40
|
+
default: string;
|
|
41
|
+
opaque: string;
|
|
42
|
+
};
|
|
43
|
+
state: {
|
|
44
|
+
placeholder: string;
|
|
45
|
+
disabled: string;
|
|
46
|
+
link: string;
|
|
47
|
+
highlight: string;
|
|
48
|
+
shadow: string;
|
|
49
|
+
};
|
|
50
|
+
background: {
|
|
51
|
+
primary: string;
|
|
52
|
+
secondary: string;
|
|
53
|
+
tertiary: string;
|
|
54
|
+
grouped: {
|
|
55
|
+
primary: string;
|
|
56
|
+
secondary: string;
|
|
57
|
+
tertiary: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
variables: {
|
|
62
|
+
'test-variable': string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
dark: {
|
|
66
|
+
dark: boolean;
|
|
67
|
+
colors: {
|
|
68
|
+
pink: string;
|
|
69
|
+
label: {
|
|
70
|
+
primary: string;
|
|
71
|
+
secondary: string;
|
|
72
|
+
tertiary: string;
|
|
73
|
+
quaternary: string;
|
|
74
|
+
};
|
|
75
|
+
accent: {
|
|
76
|
+
primary: string;
|
|
77
|
+
success: string;
|
|
78
|
+
warning: string;
|
|
79
|
+
destructive: string;
|
|
80
|
+
info: string;
|
|
81
|
+
};
|
|
82
|
+
separator: {
|
|
83
|
+
default: string;
|
|
84
|
+
opaque: string;
|
|
85
|
+
};
|
|
86
|
+
state: {
|
|
87
|
+
placeholder: string;
|
|
88
|
+
disabled: string;
|
|
89
|
+
link: string;
|
|
90
|
+
highlight: string;
|
|
91
|
+
shadow: string;
|
|
92
|
+
};
|
|
93
|
+
background: {
|
|
94
|
+
primary: string;
|
|
95
|
+
secondary: string;
|
|
96
|
+
tertiary: string;
|
|
97
|
+
grouped: {
|
|
98
|
+
primary: string;
|
|
99
|
+
secondary: string;
|
|
100
|
+
tertiary: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
variables: {
|
|
105
|
+
'test-variable': string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
typography: {
|
|
111
|
+
defaultTypography: string;
|
|
112
|
+
fonts: {
|
|
113
|
+
default: {
|
|
114
|
+
sans: string[];
|
|
115
|
+
mono: string[];
|
|
116
|
+
serif: string[];
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
styles: {
|
|
121
|
+
spacing: string;
|
|
122
|
+
shape: {
|
|
123
|
+
sm: string;
|
|
124
|
+
md: string;
|
|
125
|
+
lg: string;
|
|
126
|
+
xl: string;
|
|
127
|
+
'2xl': string;
|
|
128
|
+
'3xl': string;
|
|
129
|
+
full: string;
|
|
130
|
+
};
|
|
131
|
+
dialog: {
|
|
132
|
+
xs: string;
|
|
133
|
+
sm: string;
|
|
134
|
+
md: string;
|
|
135
|
+
lg: string;
|
|
136
|
+
xl: string;
|
|
137
|
+
};
|
|
138
|
+
modal: {
|
|
139
|
+
xs: string;
|
|
140
|
+
sm: string;
|
|
141
|
+
md: string;
|
|
142
|
+
lg: string;
|
|
143
|
+
xl: string;
|
|
144
|
+
};
|
|
145
|
+
animation: {
|
|
146
|
+
'ripple-duration': string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
};
|