lapikit 0.0.0-insiders.bb9ffdb → 0.0.0-insiders.bc63587
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/actions/index.d.ts +1 -0
- package/dist/actions/index.js +1 -0
- package/dist/actions/use-theme.d.ts +1 -0
- package/dist/actions/use-theme.js +18 -0
- package/dist/components/app/app.css +12 -1
- package/dist/components/app/app.svelte +49 -14
- 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/chip/chip.css +13 -13
- package/dist/components/dropdown/dropdown.svelte +0 -1
- 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/toolbar/toolbar.css +0 -11
- package/dist/entry-bundler.d.ts +9 -0
- package/dist/entry-bundler.js +64 -0
- package/dist/internal/config/presets.d.ts +0 -1
- package/dist/internal/config/presets.js +0 -1
- package/dist/internal/core/animations/ripple.js +1 -1
- package/dist/internal/core/formatter/theme.js +0 -1
- package/dist/internal/helpers/scroll.js +1 -2
- package/dist/internal/types/configuration.d.ts +1 -0
- 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/themes.d.ts +0 -1
- package/dist/stores/themes.js +0 -17
- 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
package/dist/actions/index.d.ts
CHANGED
package/dist/actions/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useTheme(name: string, key?: string): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { theme } from '../stores/themes.js';
|
|
2
|
+
// states
|
|
3
|
+
const isBrowser = typeof window !== 'undefined';
|
|
4
|
+
export function useTheme(name, key = '@lapikit/theme') {
|
|
5
|
+
theme.update(() => {
|
|
6
|
+
if (isBrowser) {
|
|
7
|
+
const html = document.documentElement;
|
|
8
|
+
html.classList.forEach((cls) => {
|
|
9
|
+
if (cls.startsWith('kit-theme--')) {
|
|
10
|
+
html.classList.remove(cls);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
html.classList.add(`kit-theme--${name}`);
|
|
14
|
+
localStorage.setItem(key, name);
|
|
15
|
+
}
|
|
16
|
+
return name;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -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
|
|
4
|
-
import { useTheme } from '../../stores/themes.js';
|
|
2
|
+
const BROWSER = typeof window !== 'undefined';
|
|
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>
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
.kit-chip[breakpoint]kit-chip--variant-outline {
|
|
112
|
-
--chip-color: var(--
|
|
112
|
+
--chip-color: var(--chip-color, var(--kit-label-primary));
|
|
113
113
|
background-color: var(--chip-background);
|
|
114
114
|
}
|
|
115
115
|
.kit-chip[breakpoint]kit-chip--variant-outline::before {
|
|
@@ -142,35 +142,35 @@
|
|
|
142
142
|
|
|
143
143
|
/* state */
|
|
144
144
|
.kit-chip.kit-chip--info[class*='chip--variant-filled'] {
|
|
145
|
-
--
|
|
146
|
-
--
|
|
145
|
+
--chip-color: var(--kit-on-info);
|
|
146
|
+
--chip-background: var(--kit-accent-info);
|
|
147
147
|
}
|
|
148
148
|
.kit-chip.kit-chip--info[class*='chip--variant-']:not([class*='variant-filled']) {
|
|
149
|
-
--
|
|
149
|
+
--chip-background: var(--kit-accent-info);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
.kit-chip.kit-chip--success[class*='chip--variant-filled'] {
|
|
153
|
-
--
|
|
154
|
-
--
|
|
153
|
+
--chip-color: var(--kit-on-success);
|
|
154
|
+
--chip-background: var(--kit-accent-success);
|
|
155
155
|
}
|
|
156
156
|
.kit-chip.kit-chip--success[class*='chip--variant-']:not([class*='variant-filled']) {
|
|
157
|
-
--
|
|
157
|
+
--chip-background: var(--kit-accent-success);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
.kit-chip.kit-chip--warning[class*='chip--variant-filled'] {
|
|
161
|
-
--
|
|
162
|
-
--
|
|
161
|
+
--chip-color: var(--kit-on-warning);
|
|
162
|
+
--chip-background: var(--kit-accent-warning);
|
|
163
163
|
}
|
|
164
164
|
.kit-chip.kit-chip--warning[class*='chip--variant-']:not([class*='variant-filled']) {
|
|
165
|
-
--
|
|
165
|
+
--chip-background: var(--kit-accent-warning);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
.kit-chip.kit-chip--error[class*='chip--variant-filled'] {
|
|
169
|
-
--
|
|
170
|
-
--
|
|
169
|
+
--chip-color: var(--kit-on-error);
|
|
170
|
+
--chip-background: var(--kit-accent-destructive);
|
|
171
171
|
}
|
|
172
172
|
.kit-chip.kit-chip--error[class*='chip--variant-']:not([class*='variant-filled']) {
|
|
173
|
-
--
|
|
173
|
+
--chip-background: var(--kit-accent-destructive);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/* events */
|
|
@@ -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 {};
|
|
@@ -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,64 @@
|
|
|
1
|
+
const components = ['btn'];
|
|
2
|
+
function componentName(shortName) {
|
|
3
|
+
return 'Kit' + shortName.charAt(0).toUpperCase() + shortName.slice(1);
|
|
4
|
+
}
|
|
5
|
+
function lapikitPreprocess() {
|
|
6
|
+
return {
|
|
7
|
+
markup({ content }) {
|
|
8
|
+
const hasComponent = components.some((comp) => content.includes(`<lpk:${comp}`));
|
|
9
|
+
if (!hasComponent)
|
|
10
|
+
return;
|
|
11
|
+
let processedContent = content;
|
|
12
|
+
const importedComponents = new Set();
|
|
13
|
+
let hasChanges = true;
|
|
14
|
+
while (hasChanges) {
|
|
15
|
+
hasChanges = false;
|
|
16
|
+
for (const shortName of components) {
|
|
17
|
+
const componentNameStr = componentName(shortName);
|
|
18
|
+
const regex = new RegExp(`<lpk:${shortName}([\\s\\S]*?)>([\\s\\S]*?)<\\/lpk:${shortName}\\s*>`, 'g');
|
|
19
|
+
const newContent = processedContent.replace(regex, (fullMatch, attrs, children) => {
|
|
20
|
+
hasChanges = true;
|
|
21
|
+
importedComponents.add(componentNameStr);
|
|
22
|
+
return `<${componentNameStr}${attrs}>${children}</${componentNameStr}>`;
|
|
23
|
+
});
|
|
24
|
+
if (newContent !== processedContent) {
|
|
25
|
+
processedContent = newContent;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (processedContent === content)
|
|
30
|
+
return;
|
|
31
|
+
if (importedComponents.size > 0) {
|
|
32
|
+
const imports = Array.from(importedComponents).join(', ');
|
|
33
|
+
const scriptRegex = /<script(?![^>]*\bmodule\b)([^>]*)>/;
|
|
34
|
+
const scriptMatch = processedContent.match(scriptRegex);
|
|
35
|
+
if (scriptMatch && scriptMatch.index !== undefined) {
|
|
36
|
+
const insertPos = scriptMatch.index + scriptMatch[0].length;
|
|
37
|
+
processedContent =
|
|
38
|
+
processedContent.slice(0, insertPos) +
|
|
39
|
+
`\n\timport { ${imports} } from 'lapikit/labs/components';` +
|
|
40
|
+
processedContent.slice(insertPos);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const moduleScriptMatch = processedContent.match(/<script[^>]*\bmodule\b[^>]*>/);
|
|
44
|
+
if (moduleScriptMatch && moduleScriptMatch.index !== undefined) {
|
|
45
|
+
const moduleScriptEnd = processedContent.indexOf('</script>', moduleScriptMatch.index) + '</script>'.length;
|
|
46
|
+
processedContent =
|
|
47
|
+
processedContent.slice(0, moduleScriptEnd) +
|
|
48
|
+
`\n\n<script>\n\timport { ${imports} } from 'lapikit/labs/components';\n</script>` +
|
|
49
|
+
processedContent.slice(moduleScriptEnd);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
processedContent =
|
|
53
|
+
`<script>\n\timport { ${imports} } from 'lapikit/labs/components';\n</script>\n\n` +
|
|
54
|
+
processedContent;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
code: processedContent
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export { lapikitPreprocess };
|