lapikit 0.0.0-insiders.e06d168 → 0.0.0-insiders.e221561
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 +117 -1
- package/bin/helper.js +0 -38
- package/bin/prompts.js +1 -1
- package/dist/components/app/app.css +12 -1
- package/dist/components/app/app.svelte +48 -13
- package/dist/components/app/app.svelte.d.ts +2 -7
- package/dist/components/app/types.d.ts +7 -1
- package/dist/components/card/card.css +2 -2
- package/dist/components/card/card.svelte +4 -0
- package/dist/components/card/types.d.ts +2 -0
- package/dist/components/icon/icon.css +6 -6
- package/dist/components/separator/separator.css +17 -17
- package/dist/components/separator/separator.svelte +1 -1
- package/dist/components/separator/types.d.ts +5 -1
- package/dist/components/textfield/textfield.svelte.d.ts +1 -1
- package/dist/components/toolbar/toolbar.css +0 -11
- package/dist/entry-bundler.d.ts +12 -0
- package/dist/entry-bundler.js +106 -0
- package/dist/internal/core/animations/ripple.js +1 -1
- package/dist/internal/helpers/scroll.js +1 -2
- package/dist/labs/components/button/button.svelte +24 -0
- package/dist/labs/components/button/button.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/index.d.ts +1 -0
- package/dist/stores/index.js +1 -0
- package/dist/stores/viewport.d.ts +7 -0
- package/dist/stores/viewport.js +7 -0
- package/dist/styles.css.d.ts +4 -0
- package/dist/themes.css.d.ts +4 -0
- package/package.json +135 -99
- package/bin/lapikit.js +0 -86
- package/bin/legacy.js +0 -34
- package/bin/modules/adapter.js +0 -52
- package/bin/modules/plugin.js +0 -223
- package/bin/modules/preset.js +0 -11
- package/dist/app.d.ts +0 -13
- package/dist/app.html +0 -12
package/README.md
CHANGED
|
@@ -1 +1,117 @@
|
|
|
1
|
-
|
|
1
|
+
<a href="https://lapikit.dev">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/Nycolaide/lapikit/main/.github/lapikit.svg" alt="Lapikit Logo" width="125">
|
|
3
|
+
</a>
|
|
4
|
+
|
|
5
|
+
# Lapikit - Svelte components library
|
|
6
|
+
|
|
7
|
+
[![][discover-lapikit-npm]](https://www.npmjs.com/package/lapikit)
|
|
8
|
+
[![][subscribe-to-instagram]](https://www.instagram.com/lapikit/)
|
|
9
|
+
[![][join-discord-lapikit]](https://discord.gg/gn9ZGtDtK4)
|
|
10
|
+
|
|
11
|
+
[![][version]](https://github.com/nycolaide/lapikit/releases?q=lapikit&expanded=true)
|
|
12
|
+
[![][installs]](https://www.npmjs.com/package/lapikit)
|
|
13
|
+
[![][installs-this-month]](https://www.npmjs.com/package/lapikit)
|
|
14
|
+
[![][license]](https://github.com/nycolaide/lapikit/blob/main/LICENSE)
|
|
15
|
+
[![][discord]](https://discord.gg/gn9ZGtDtK4)
|
|
16
|
+
|
|
17
|
+
Lapikit is a comprehensive Svelte components library that provides developers with a wide range of pre-built, customizable UI components to streamline the development process. Whether you're building a simple website or a complex web application, Lapikit has the tools you need to create beautiful and functional user interfaces with ease.
|
|
18
|
+
|
|
19
|
+
## 🖥️ Documentation
|
|
20
|
+
|
|
21
|
+
To check out the documentation, visit [lapikit.dev](https://lapikit.dev)
|
|
22
|
+
|
|
23
|
+
## ✨Quick Start
|
|
24
|
+
|
|
25
|
+
Getting started with Lapikit is easy. After create you SvelteKit project, you can install Lapikit using your preferred package manager:
|
|
26
|
+
|
|
27
|
+
Usage [bun](https://bun.sh/):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
bun add -d lapikit
|
|
31
|
+
npx lapikit
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Using [npm](https://www.npmjs.com/):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm i -D lapikit
|
|
38
|
+
npx lapikit
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Using [yarn](https://yarnpkg.com/):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
yarn add -D lapikit
|
|
45
|
+
npx lapikit
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Using [pnpm](https://pnpm.io/):
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pnpm add -D lapikit
|
|
52
|
+
npx lapikit
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 🚩Table of Contents
|
|
56
|
+
|
|
57
|
+
- [Lapikit - Svelte components library](#lapikit---svelte-components-library)
|
|
58
|
+
- [🖥️ Documentation](#️-documentation)
|
|
59
|
+
- [✨Quick Start](#quick-start)
|
|
60
|
+
- [🚩Table of Contents](#table-of-contents)
|
|
61
|
+
- [🤯Motivation](#motivation)
|
|
62
|
+
- [💖Community](#community)
|
|
63
|
+
- [💁♂️Contributing](#️contributing)
|
|
64
|
+
- [🖖Core Team Lapikit](#core-team-lapikit)
|
|
65
|
+
- [📄License](#license)
|
|
66
|
+
- [🪧We support these projects](#we-support-these-projects)
|
|
67
|
+
|
|
68
|
+
## 🤯Motivation
|
|
69
|
+
|
|
70
|
+
Lapikit has created to help Svelte developers save time and effort when building user interfaces. By providing a wide range of pre-built components, Lapikit allows developers to focus on building their applications rather than spending time designing and coding UI elements from scratch.
|
|
71
|
+
|
|
72
|
+
## 💖Community
|
|
73
|
+
|
|
74
|
+
Join our growing community on [Discord](https://discord.gg/gn9ZGtDtK4) and [GitHub Discussions](https://github.com/nycolaide/lapikit/discussions) where we discuss and collaborate on all things Lapikit. Don't be shy, jump right in and be part of the discussion!
|
|
75
|
+
|
|
76
|
+
## 💁♂️Contributing
|
|
77
|
+
|
|
78
|
+
Be part of the next revolution in code editing by contributing to the project. This is a community-led effort, so we welcome as many contributors who can help. Read the Contribution Guide for more information.
|
|
79
|
+
|
|
80
|
+
## 🖖Core Team Lapikit
|
|
81
|
+
|
|
82
|
+
[@Nycolaide](https://github.com/Nycolaide)
|
|
83
|
+
[@Simone](https://github.com/fersimone)
|
|
84
|
+
|
|
85
|
+
## 📄License
|
|
86
|
+
|
|
87
|
+
Licensed under the [MIT license](https://github.com/nycolaide/lapikit/blob/main/LICENSE).
|
|
88
|
+
|
|
89
|
+
Copyright © 2025 Nycolaide
|
|
90
|
+
|
|
91
|
+
## 🪧We support these projects
|
|
92
|
+
|
|
93
|
+
We are proud supporters of the open-source community and contribute to several projects that help make the web a better place. Here are some of the projects we support:
|
|
94
|
+
|
|
95
|
+
<table>
|
|
96
|
+
<tr>
|
|
97
|
+
<td>
|
|
98
|
+
<a href="https://www.w3.org/">
|
|
99
|
+
<img src="https://raw.githubusercontent.com/Nycolaide/lapikit/main/.github/w3c.svg" alt="W3C" width="75">
|
|
100
|
+
</a>
|
|
101
|
+
</td>
|
|
102
|
+
<td>
|
|
103
|
+
<a href="https://humanstxt.org/">
|
|
104
|
+
<img src="https://raw.githubusercontent.com/Nycolaide/lapikit/main/.github/humans.png" alt="Humans.txt" width="115">
|
|
105
|
+
</a>
|
|
106
|
+
</td>
|
|
107
|
+
</tr>
|
|
108
|
+
</table>
|
|
109
|
+
|
|
110
|
+
[discover-lapikit-npm]: https://img.shields.io/badge/Lapikit-black.svg?style=for-the-badge&logo=NPM
|
|
111
|
+
[join-discord-lapikit]: https://img.shields.io/badge/Join%20the%20community-black.svg?style=for-the-badge&logo=Discord
|
|
112
|
+
[subscribe-to-instagram]: https://img.shields.io/badge/Follow%20@Lapikit-black.svg?style=for-the-badge&logo=Instagram
|
|
113
|
+
[version]: https://img.shields.io/npm/v/lapikit.svg?label=Version&color=f58142
|
|
114
|
+
[license]: https://badgen.net/github/license/nycolaide/lapikit?label=License&color=cc5640
|
|
115
|
+
[installs]: https://badgen.net/npm/dt/lapikit?label=NPM%20installs&color=40ba12
|
|
116
|
+
[installs-this-month]: https://badgen.net/npm/dm/lapikit?label=NPM%20installs&color=40ba12
|
|
117
|
+
[discord]: https://img.shields.io/discord/1383879204671721492?color=5865F2&label=Discord&logo=discord&logoColor=white
|
package/bin/helper.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
1
|
const color = {
|
|
5
2
|
red: (text) => `\x1b[31m${text}\x1b[0m`,
|
|
6
3
|
green: (text) => `\x1b[32m${text}\x1b[0m`,
|
|
@@ -60,38 +57,3 @@ export const terminal = (type = 'info', msg) => {
|
|
|
60
57
|
else if (type === 'none') console.log(msg);
|
|
61
58
|
else console.log(name, ansi.bold.blue('[info]'), msg);
|
|
62
59
|
};
|
|
63
|
-
|
|
64
|
-
export function getCssPathFromArgs() {
|
|
65
|
-
const args = process.argv.slice(2);
|
|
66
|
-
return args[1] || 'src/app.css';
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function getLapikitPathFromArgs() {
|
|
70
|
-
const args = process.argv.slice(2);
|
|
71
|
-
// Search argument after --plugin-path or -p
|
|
72
|
-
const pluginPathIndex = args.findIndex((arg) => arg === '--plugin-path' || arg === '-p');
|
|
73
|
-
if (pluginPathIndex !== -1 && args[pluginPathIndex + 1]) {
|
|
74
|
-
return args[pluginPathIndex + 1];
|
|
75
|
-
}
|
|
76
|
-
return 'src/plugin';
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function validatePluginPath(pluginPath) {
|
|
80
|
-
if (!pluginPath.startsWith('src/')) {
|
|
81
|
-
return {
|
|
82
|
-
valid: false,
|
|
83
|
-
error: 'The path must start with "src/"'
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return { valid: true };
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export async function envTypescript() {
|
|
90
|
-
const directory = process.cwd();
|
|
91
|
-
try {
|
|
92
|
-
await fs.readFile(path.resolve(directory, 'tsconfig.json'), 'utf-8');
|
|
93
|
-
return true;
|
|
94
|
-
} catch {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
}
|
package/bin/prompts.js
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
#kit-app,
|
|
2
|
+
.kit-application {
|
|
3
|
+
-webkit-text-size-adjust: 100%;
|
|
4
|
+
tab-size: 4;
|
|
5
|
+
line-height: 1.5;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
font-family: var(--kit-font-sans);
|
|
8
|
+
background-color: var(--kit-background-primary);
|
|
9
|
+
color: var(--kit-label-primary);
|
|
10
|
+
}
|
|
11
|
+
|
|
1
12
|
.kit-overlay {
|
|
2
13
|
position: fixed;
|
|
3
14
|
top: 0;
|
|
4
15
|
left: 0;
|
|
5
16
|
height: 100%;
|
|
6
17
|
width: 100%;
|
|
7
|
-
background-color: color-mix(in oklab,
|
|
18
|
+
background-color: color-mix(in oklab, black 70%, transparent);
|
|
8
19
|
z-index: 9000;
|
|
9
20
|
cursor: default;
|
|
10
21
|
}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
2
|
+
const BROWSER = typeof window !== 'undefined';
|
|
4
3
|
import { useTheme } from '../../actions/use-theme.js';
|
|
5
4
|
import { modalOpen, setOpenModal } from '../../stores/components.js';
|
|
6
5
|
|
|
6
|
+
import { viewport } from '../../stores/viewport.js';
|
|
7
|
+
import type { AppProps } from './types.js';
|
|
8
|
+
|
|
7
9
|
let {
|
|
10
|
+
ref = $bindable(),
|
|
8
11
|
children,
|
|
9
12
|
themes,
|
|
10
|
-
storageKey = '@lapikit/theme'
|
|
11
|
-
|
|
13
|
+
storageKey = '@lapikit/theme',
|
|
14
|
+
light,
|
|
15
|
+
dark,
|
|
16
|
+
...rest
|
|
17
|
+
}: AppProps = $props();
|
|
12
18
|
|
|
13
19
|
$effect.pre(() => {
|
|
14
20
|
if (!BROWSER) return;
|
|
@@ -29,16 +35,45 @@
|
|
|
29
35
|
useTheme(colorScheme);
|
|
30
36
|
}
|
|
31
37
|
}
|
|
38
|
+
|
|
39
|
+
// Met à jour le store viewport à l'init et sur resize
|
|
40
|
+
function updateViewport() {
|
|
41
|
+
viewport.set({
|
|
42
|
+
innerWidth: window.innerWidth,
|
|
43
|
+
outerWidth: window.outerWidth,
|
|
44
|
+
innerHeight: window.innerHeight,
|
|
45
|
+
outerHeight: window.outerHeight
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
updateViewport();
|
|
49
|
+
window.addEventListener('resize', updateViewport);
|
|
50
|
+
return () => {
|
|
51
|
+
window.removeEventListener('resize', updateViewport);
|
|
52
|
+
};
|
|
32
53
|
});
|
|
33
54
|
</script>
|
|
34
55
|
|
|
35
|
-
|
|
56
|
+
<div
|
|
57
|
+
id="kit-app"
|
|
58
|
+
bind:this={ref}
|
|
59
|
+
{...rest}
|
|
60
|
+
class={[
|
|
61
|
+
'kit-application',
|
|
62
|
+
light && 'light',
|
|
63
|
+
dark && 'dark',
|
|
64
|
+
light && 'kit-theme--light',
|
|
65
|
+
dark && 'kit-theme--dark',
|
|
66
|
+
rest.class
|
|
67
|
+
]}
|
|
68
|
+
>
|
|
69
|
+
{@render children?.()}
|
|
36
70
|
|
|
37
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
38
|
-
{#if $modalOpen}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{/if}
|
|
71
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
72
|
+
{#if $modalOpen}
|
|
73
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
74
|
+
<div
|
|
75
|
+
class={['kit-overlay', $modalOpen === 'persistent' && 'kit-overlay--persistent']}
|
|
76
|
+
onclick={() => $modalOpen !== 'persistent' && setOpenModal(false)}
|
|
77
|
+
></div>
|
|
78
|
+
{/if}
|
|
79
|
+
</div>
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
children: Snippet;
|
|
4
|
-
themes?: string | string[];
|
|
5
|
-
storageKey?: string;
|
|
6
|
-
};
|
|
7
|
-
declare const App: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
1
|
+
import type { AppProps } from './types.js';
|
|
2
|
+
declare const App: import("svelte").Component<AppProps, {}, "ref">;
|
|
8
3
|
type App = ReturnType<typeof App>;
|
|
9
4
|
export default App;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
export interface AppProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
ref?: HTMLDivElement;
|
|
3
5
|
children?: Snippet;
|
|
6
|
+
themes?: string | string[];
|
|
7
|
+
storageKey?: string;
|
|
8
|
+
light?: boolean;
|
|
9
|
+
dark?: boolean;
|
|
4
10
|
}
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
.kit-card[breakpoint]kit-card--variant-outline {
|
|
61
|
-
--card-color: var(--
|
|
61
|
+
--card-color: var(--card-background, var(--kit-label-primary));
|
|
62
62
|
background-color: transparent;
|
|
63
63
|
}
|
|
64
64
|
.kit-card[breakpoint]kit-card--variant-outline::before {
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.kit-card[breakpoint]kit-card--variant-text {
|
|
74
|
-
--card-color: var(--
|
|
74
|
+
--card-color: var(--card-background, var(--kit-label-primary));
|
|
75
75
|
background-color: transparent;
|
|
76
76
|
border: none;
|
|
77
77
|
}
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
color,
|
|
21
21
|
background,
|
|
22
22
|
noRipple,
|
|
23
|
+
width,
|
|
24
|
+
height,
|
|
23
25
|
...rest
|
|
24
26
|
}: CardProps = $props();
|
|
25
27
|
|
|
@@ -58,6 +60,8 @@
|
|
|
58
60
|
style:--card-background={assets.color(background)}
|
|
59
61
|
style:--card-color={assets.color(color)}
|
|
60
62
|
style:--card-shape={assets.shape(rounded)}
|
|
63
|
+
style:width
|
|
64
|
+
style:height
|
|
61
65
|
>
|
|
62
66
|
{@render children?.()}
|
|
63
67
|
</svelte:element>
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.kit-icon:before {
|
|
12
|
-
color: var(--icon-color, currentColor);
|
|
12
|
+
color: var(--icon-color-state, var(--icon-color, currentColor)) !important;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.kit-icon svg {
|
|
16
|
-
color: var(--icon-color, currentColor);
|
|
16
|
+
color: var(--icon-color-state, var(--icon-color, currentColor)) !important;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.kit-icon svg,
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
|
|
50
50
|
/* state */
|
|
51
51
|
.kit-icon.kit-icon--info {
|
|
52
|
-
--
|
|
52
|
+
--icon-color-state: var(--kit-accent-info);
|
|
53
53
|
}
|
|
54
54
|
.kit-icon.kit-icon--success {
|
|
55
|
-
--
|
|
55
|
+
--icon-color-state: var(--kit-accent-success);
|
|
56
56
|
}
|
|
57
57
|
.kit-icon.kit-icon--warning {
|
|
58
|
-
--
|
|
58
|
+
--icon-color-state: var(--kit-accent-warning);
|
|
59
59
|
}
|
|
60
60
|
.kit-icon.kit-icon--error {
|
|
61
|
-
--
|
|
61
|
+
--icon-color-state: var(--kit-accent-destructive);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/* disabled */
|
|
@@ -5,15 +5,30 @@
|
|
|
5
5
|
max-height: 0px;
|
|
6
6
|
opacity: var(--separator-opacity, 0.12);
|
|
7
7
|
transition: inherit;
|
|
8
|
-
border-color: var(--separator-color, var(--kit-
|
|
8
|
+
border-color: var(--separator-color, var(--kit-label-primary));
|
|
9
9
|
border-style: solid;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
.kit-separator--inset:not(.kit-separator--orientation-vertical) {
|
|
13
|
+
max-width: calc(100% - 4.5rem);
|
|
14
|
+
margin-inline-start: 4.5rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.kit-separator--inset.kit-separator--orientation-vertical {
|
|
18
|
+
margin-bottom: 0.5rem;
|
|
19
|
+
margin-top: 0.5rem;
|
|
20
|
+
max-height: calc(100% - 1rem);
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
.kit-separator:not(.kit-separator--orientation-vertical) {
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.kit-separator[breakpoint]kit-separator--orientation-horizontal {
|
|
13
28
|
border-width: var(--separator-top-width, thin) 0 0 0;
|
|
14
29
|
}
|
|
15
30
|
|
|
16
|
-
.kit-separator--orientation-vertical {
|
|
31
|
+
.kit-separator[breakpoint]kit-separator--orientation-vertical {
|
|
17
32
|
align-self: stretch;
|
|
18
33
|
border-width: 0 thin 0 0;
|
|
19
34
|
display: inline-flex;
|
|
@@ -25,18 +40,3 @@
|
|
|
25
40
|
width: 0px;
|
|
26
41
|
border-width: 0 var(--separator-right-width, thin) 0 0;
|
|
27
42
|
}
|
|
28
|
-
|
|
29
|
-
.kit-separator--inset:not(.kit-separator--orientation-vertical) {
|
|
30
|
-
max-width: calc(100% - 4.5rem);
|
|
31
|
-
margin-inline-start: 4.5rem;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.kit-separator--inset.kit-separator--orientation-vertical {
|
|
35
|
-
margin-bottom: 0.5rem;
|
|
36
|
-
margin-top: 0.5rem;
|
|
37
|
-
max-height: calc(100% - 1rem);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.kit-separator:not(.kit-separator--orientation-vertical) {
|
|
41
|
-
width: 100%;
|
|
42
|
-
}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
orientation && assets.className('separator', 'orientation', orientation),
|
|
29
29
|
rest.class
|
|
30
30
|
]}
|
|
31
|
-
aria-orientation={orientation}
|
|
31
|
+
aria-orientation={typeof orientation === 'string' ? orientation : undefined}
|
|
32
32
|
role="separator"
|
|
33
33
|
style:--separator-color={assets.color(color)}
|
|
34
34
|
style:--separator-opacity={opacity}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Base } from '../../internal/types/index.js';
|
|
2
|
+
type Orientation = 'horizontal' | 'vertical';
|
|
2
3
|
export interface SeparatorProps extends Base {
|
|
3
4
|
is?: 'div' | 'hr';
|
|
4
5
|
light?: boolean;
|
|
@@ -7,5 +8,8 @@ export interface SeparatorProps extends Base {
|
|
|
7
8
|
thickness?: string;
|
|
8
9
|
opacity?: string | number;
|
|
9
10
|
color?: string;
|
|
10
|
-
orientation?:
|
|
11
|
+
orientation?: Orientation | {
|
|
12
|
+
[key: string]: Orientation;
|
|
13
|
+
};
|
|
11
14
|
}
|
|
15
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { TextfieldProps } from './types.js';
|
|
2
|
-
declare const Textfield: import("svelte").Component<TextfieldProps, {}, "
|
|
2
|
+
declare const Textfield: import("svelte").Component<TextfieldProps, {}, "ref" | "value">;
|
|
3
3
|
type Textfield = ReturnType<typeof Textfield>;
|
|
4
4
|
export default Textfield;
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/* density */
|
|
14
|
-
.kit-toolbar[breakpoint]kit-toolbar--density-default {
|
|
15
|
-
border-radius: calc(var(--system-spacing) * 2.25);
|
|
16
|
-
}
|
|
17
14
|
.kit-toolbar[breakpoint]kit-toolbar--density-default:not([class*='toolbar--orientation-vertical']) {
|
|
18
15
|
height: 3rem;
|
|
19
16
|
padding-inline: calc(var(--system-spacing) * 1.5);
|
|
@@ -24,10 +21,6 @@
|
|
|
24
21
|
padding: calc(var(--system-spacing) * 1.5) 0;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
|
-
.kit-toolbar[breakpoint]kit-toolbar--density-compact {
|
|
28
|
-
border-radius: calc(var(--system-spacing) * 1.75);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
24
|
.kit-toolbar[breakpoint]kit-toolbar--density-compact:not([class*='toolbar--orientation-vertical']) {
|
|
32
25
|
height: 2.625rem;
|
|
33
26
|
padding-inline: calc(var(--system-spacing) * 0.75);
|
|
@@ -38,10 +31,6 @@
|
|
|
38
31
|
padding: calc(var(--system-spacing) * 0.75) 0;
|
|
39
32
|
}
|
|
40
33
|
|
|
41
|
-
.kit-toolbar[breakpoint]kit-toolbar--density-comfortable {
|
|
42
|
-
border-radius: calc(var(--system-spacing) * 3.5);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
34
|
.kit-toolbar[breakpoint]kit-toolbar--density-comfortable:not(
|
|
46
35
|
[class*='toolbar--orientation-vertical']
|
|
47
36
|
) {
|
|
@@ -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,106 @@
|
|
|
1
|
+
const components = ['btn'];
|
|
2
|
+
function componentName(shortName) {
|
|
3
|
+
return 'Kit' + shortName.charAt(0).toUpperCase() + shortName.slice(1);
|
|
4
|
+
}
|
|
5
|
+
const lapikitPlugins = {
|
|
6
|
+
repl: {
|
|
7
|
+
components: ['code'],
|
|
8
|
+
ref: '@lapikit/repl'
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
function lapikitPreprocess(options) {
|
|
12
|
+
return {
|
|
13
|
+
markup({ content }) {
|
|
14
|
+
const allComponents = [...components];
|
|
15
|
+
const componentToRef = new Map();
|
|
16
|
+
components.forEach((comp) => {
|
|
17
|
+
componentToRef.set(comp, 'lapikit/labs/components');
|
|
18
|
+
});
|
|
19
|
+
// plugins
|
|
20
|
+
if (options?.plugins) {
|
|
21
|
+
options.plugins.forEach((pluginKey) => {
|
|
22
|
+
const plugin = lapikitPlugins[pluginKey];
|
|
23
|
+
if (plugin) {
|
|
24
|
+
plugin.components.forEach((comp) => {
|
|
25
|
+
if (!allComponents.includes(comp)) {
|
|
26
|
+
allComponents.push(comp);
|
|
27
|
+
}
|
|
28
|
+
componentToRef.set(comp, plugin.ref);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const hasComponent = allComponents.some((comp) => content.includes(`<lpk:${comp}`));
|
|
34
|
+
if (!hasComponent)
|
|
35
|
+
return;
|
|
36
|
+
let processedContent = content;
|
|
37
|
+
const importedComponents = new Map();
|
|
38
|
+
let hasChanges = true;
|
|
39
|
+
while (hasChanges) {
|
|
40
|
+
hasChanges = false;
|
|
41
|
+
for (const shortName of allComponents) {
|
|
42
|
+
const componentNameStr = componentName(shortName);
|
|
43
|
+
const attrPattern = `(?:[^>"']|"[^"]*"|'[^']*')*?`;
|
|
44
|
+
const selfClosingRegex = new RegExp(`<lpk:${shortName}(${attrPattern})\\s*/>`, 'g');
|
|
45
|
+
const pairRegex = new RegExp(`<lpk:${shortName}(${attrPattern})>([\\s\\S]*?)<\\/lpk:${shortName}\\s*>`, 'g');
|
|
46
|
+
let newContent = processedContent.replace(selfClosingRegex, (fullMatch, attrs) => {
|
|
47
|
+
hasChanges = true;
|
|
48
|
+
const ref = componentToRef.get(shortName) || 'lapikit/labs/components';
|
|
49
|
+
importedComponents.set(componentNameStr, ref);
|
|
50
|
+
return `<${componentNameStr}${attrs} />`;
|
|
51
|
+
});
|
|
52
|
+
newContent = newContent.replace(pairRegex, (fullMatch, attrs, children) => {
|
|
53
|
+
hasChanges = true;
|
|
54
|
+
const ref = componentToRef.get(shortName) || 'lapikit/labs/components';
|
|
55
|
+
importedComponents.set(componentNameStr, ref);
|
|
56
|
+
return `<${componentNameStr}${attrs}>${children}</${componentNameStr}>`;
|
|
57
|
+
});
|
|
58
|
+
if (newContent !== processedContent) {
|
|
59
|
+
processedContent = newContent;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (processedContent === content)
|
|
64
|
+
return;
|
|
65
|
+
if (importedComponents.size > 0) {
|
|
66
|
+
const importsByRef = new Map();
|
|
67
|
+
importedComponents.forEach((ref, component) => {
|
|
68
|
+
if (!importsByRef.has(ref)) {
|
|
69
|
+
importsByRef.set(ref, []);
|
|
70
|
+
}
|
|
71
|
+
importsByRef.get(ref).push(component);
|
|
72
|
+
});
|
|
73
|
+
const importLines = Array.from(importsByRef.entries())
|
|
74
|
+
.map(([ref, components]) => {
|
|
75
|
+
const imports = components.join(', ');
|
|
76
|
+
return `\n\timport { ${imports} } from '${ref}';`;
|
|
77
|
+
})
|
|
78
|
+
.join('');
|
|
79
|
+
const scriptRegex = /<script(?![^>]*\bmodule\b)([^>]*)>/;
|
|
80
|
+
const scriptMatch = processedContent.match(scriptRegex);
|
|
81
|
+
if (scriptMatch && scriptMatch.index !== undefined) {
|
|
82
|
+
const insertPos = scriptMatch.index + scriptMatch[0].length;
|
|
83
|
+
processedContent =
|
|
84
|
+
processedContent.slice(0, insertPos) + importLines + processedContent.slice(insertPos);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
const moduleScriptMatch = processedContent.match(/<script[^>]*\bmodule\b[^>]*>/);
|
|
88
|
+
if (moduleScriptMatch && moduleScriptMatch.index !== undefined) {
|
|
89
|
+
const moduleScriptEnd = processedContent.indexOf('</script>', moduleScriptMatch.index) + '</script>'.length;
|
|
90
|
+
processedContent =
|
|
91
|
+
processedContent.slice(0, moduleScriptEnd) +
|
|
92
|
+
`\n\n<script>${importLines}\n</script>` +
|
|
93
|
+
processedContent.slice(moduleScriptEnd);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
processedContent = `<script>${importLines}\n</script>\n\n` + processedContent;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
code: processedContent
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export { lapikitPreprocess };
|
|
@@ -27,7 +27,7 @@ export function ripple(el, options = {}) {
|
|
|
27
27
|
options.duration = undefined;
|
|
28
28
|
}
|
|
29
29
|
if (options.component) {
|
|
30
|
-
rippleContainer.style.setProperty('--system-ripple-radius', `var(--${options.component}-
|
|
30
|
+
rippleContainer.style.setProperty('--system-ripple-radius', `var(--${options.component}-shape)`);
|
|
31
31
|
}
|
|
32
32
|
if (options.color) {
|
|
33
33
|
rippleContainer.style.setProperty('--system-ripple-color', options.color);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let { children, ...rest } = $props();
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<button {...rest}>
|
|
6
|
+
{@render children()}
|
|
7
|
+
</button>
|
|
8
|
+
|
|
9
|
+
<style>
|
|
10
|
+
button {
|
|
11
|
+
padding: 0.5em 1em;
|
|
12
|
+
border: none;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
background-color: #007bff;
|
|
15
|
+
color: white;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
font-size: 1em;
|
|
18
|
+
transition: background-color 0.3s ease;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
button:hover {
|
|
22
|
+
background-color: #0056b3;
|
|
23
|
+
}
|
|
24
|
+
</style>
|