lapikit 0.5.0 → 0.5.2
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/bin/{helper.js → helpers.js} +41 -0
- package/bin/hooks.js +68 -0
- package/bin/index.js +30 -6
- package/dist/components/accordion/accordion.svelte +6 -19
- package/dist/components/accordion/accordion.types.d.ts +0 -4
- package/dist/components/accordion/modules/accordion-item.svelte +8 -24
- package/dist/components/alert/alert.svelte +3 -10
- package/dist/components/app/app.svelte +4 -51
- package/dist/components/appbar/appbar.svelte +12 -27
- package/dist/components/appbar/appbar.types.d.ts +1 -3
- package/dist/components/avatar/avatar.svelte +22 -12
- package/dist/components/btn/btn.svelte +71 -89
- package/dist/components/card/card.svelte +31 -44
- package/dist/components/chip/chip.svelte +57 -66
- package/dist/components/dropdown/dropdown.svelte +8 -23
- package/dist/components/dropdown/dropdown.types.d.ts +0 -2
- package/dist/components/list/list.svelte +44 -24
- package/dist/components/list/modules/list-item.svelte +10 -10
- package/dist/components/popover/popover.svelte +8 -23
- package/dist/components/popover/popover.types.d.ts +0 -2
- package/dist/components/separator/separator.svelte +0 -12
- package/dist/components/separator/separator.types.d.ts +0 -2
- package/dist/components/textfield/textfield.svelte +10 -25
- package/dist/components/textfield/textfield.types.d.ts +0 -2
- package/dist/components/toolbar/toolbar.svelte +12 -27
- package/dist/components/toolbar/toolbar.types.d.ts +0 -2
- package/dist/components/tooltip/tooltip.svelte +12 -27
- package/dist/components/tooltip/tooltip.types.d.ts +0 -2
- package/package.json +2 -5
- package/bin/configuration.js +0 -303
- package/bin/presets.js +0 -26
- package/bin/prompts.js +0 -67
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import readline from 'node:readline/promises';
|
|
2
|
+
|
|
1
3
|
const color = {
|
|
2
4
|
red: (text) => `\x1b[31m${text}\x1b[0m`,
|
|
3
5
|
green: (text) => `\x1b[32m${text}\x1b[0m`,
|
|
@@ -57,3 +59,42 @@ export const terminal = (type = 'info', msg) => {
|
|
|
57
59
|
else if (type === 'none') console.log(msg);
|
|
58
60
|
else console.log(name, ansi.bold.blue('[info]'), msg);
|
|
59
61
|
};
|
|
62
|
+
|
|
63
|
+
export function createRL() {
|
|
64
|
+
return readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function toggle(rl, message, initial = true) {
|
|
68
|
+
const hint = initial ? 'Y/n' : 'y/N';
|
|
69
|
+
const answer = (await rl.question(`${message} (${hint}): `)).trim().toLowerCase();
|
|
70
|
+
if (answer === '') return initial;
|
|
71
|
+
return answer === 'y';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export async function text(rl, message, initial = '', validate) {
|
|
75
|
+
while (true) {
|
|
76
|
+
const hint = initial ? ` (${initial})` : '';
|
|
77
|
+
const answer = (await rl.question(`${message}${hint}: `)).trim();
|
|
78
|
+
const value = answer === '' ? initial : answer;
|
|
79
|
+
if (validate) {
|
|
80
|
+
const result = validate(value);
|
|
81
|
+
if (result !== true) {
|
|
82
|
+
terminal('warn', result);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export async function select(rl, message, choices) {
|
|
91
|
+
console.log(`\n${message}`);
|
|
92
|
+
choices.forEach((c, i) => console.log(` ${i + 1}. ${c.title}`));
|
|
93
|
+
|
|
94
|
+
while (true) {
|
|
95
|
+
const answer = (await rl.question(`Choice (1): `)).trim();
|
|
96
|
+
const index = answer === '' ? 0 : parseInt(answer, 10) - 1;
|
|
97
|
+
if (index >= 0 && index < choices.length) return choices[index].value;
|
|
98
|
+
terminal('warn', `Please enter a number between 1 and ${choices.length}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
package/bin/hooks.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { promises as fs } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { terminal } from './helpers.js';
|
|
5
|
+
|
|
6
|
+
export async function findSvelteConfigFile(projectPath) {
|
|
7
|
+
for (const ext of ['js', 'ts']) {
|
|
8
|
+
const file = path.join(projectPath, `svelte.config.${ext}`);
|
|
9
|
+
try {
|
|
10
|
+
await fs.access(file);
|
|
11
|
+
return file;
|
|
12
|
+
} catch {
|
|
13
|
+
// lapikit other step
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
throw new Error('No svelte.config.js or svelte.config.ts file found');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function addLiliPreprocess(svelteConfigFile) {
|
|
20
|
+
let content = await fs.readFile(svelteConfigFile, 'utf-8');
|
|
21
|
+
const lapikitImport = `import { lapikitPreprocess } from 'lapikit/labs/preprocess';`;
|
|
22
|
+
|
|
23
|
+
if (content.includes(`from 'lapikit/labs/preprocess'`)) {
|
|
24
|
+
terminal('info', `lapikitPreprocess already imported in ${svelteConfigFile}`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const lines = content.split('\n');
|
|
29
|
+
let importInsertIndex = 0;
|
|
30
|
+
for (let i = 0; i < lines.length; i++) {
|
|
31
|
+
if (lines[i].trim().startsWith('import ')) importInsertIndex = i + 1;
|
|
32
|
+
}
|
|
33
|
+
lines.splice(importInsertIndex, 0, lapikitImport);
|
|
34
|
+
content = lines.join('\n');
|
|
35
|
+
|
|
36
|
+
if (!content.match(/preprocess\s*:/)) {
|
|
37
|
+
content = content.replace(
|
|
38
|
+
/(const\s+\w+\s*=\s*\{|export\s+default\s*\{)/,
|
|
39
|
+
(m) => `${m}\n\tpreprocess: [lapikitPreprocess()],`
|
|
40
|
+
);
|
|
41
|
+
} else if (content.match(/preprocess\s*:\s*\[/)) {
|
|
42
|
+
content = content.replace(/preprocess\s*:\s*\[([\s\S]*?)\]/, (_, inner) => {
|
|
43
|
+
const trimmed = inner.trim();
|
|
44
|
+
if (!trimmed) return `preprocess: [lapikitPreprocess()]`;
|
|
45
|
+
|
|
46
|
+
if (inner.includes('\n')) {
|
|
47
|
+
const firstItemMatch = inner.match(/\n(\s*)\S/);
|
|
48
|
+
const indent = firstItemMatch ? firstItemMatch[1] : '\t\t';
|
|
49
|
+
const closingMatch = inner.match(/\n(\s*)$/);
|
|
50
|
+
const closingIndent = closingMatch ? closingMatch[1] : '\t';
|
|
51
|
+
const innerTrimmed = inner.trimEnd();
|
|
52
|
+
const sep = innerTrimmed.endsWith(',') ? '' : ',';
|
|
53
|
+
return `preprocess: [${innerTrimmed}${sep}\n${indent}lapikitPreprocess()\n${closingIndent}]`;
|
|
54
|
+
} else {
|
|
55
|
+
const sep = trimmed.endsWith(',') ? ' ' : ', ';
|
|
56
|
+
return `preprocess: [${trimmed}${sep}lapikitPreprocess()]`;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
content = content.replace(
|
|
61
|
+
/preprocess\s*:\s*([^,\n\]{}]+)/,
|
|
62
|
+
(_, val) => `preprocess: [${val.trim()}, lapikitPreprocess()]`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
await fs.writeFile(svelteConfigFile, content);
|
|
67
|
+
terminal('success', `lapikitPreprocess added to ${svelteConfigFile}`);
|
|
68
|
+
}
|
package/bin/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { initPrompts } from './prompts.js';
|
|
2
|
+
import { ansi, terminal, createRL, toggle } from './helpers.js';
|
|
3
|
+
import { addLiliPreprocess, findSvelteConfigFile } from './hooks.js';
|
|
5
4
|
|
|
6
5
|
async function run() {
|
|
6
|
+
const rl = createRL();
|
|
7
|
+
|
|
7
8
|
console.log(' _ _ _ _ _ ');
|
|
8
9
|
console.log(' | | (_) | (_) | ');
|
|
9
10
|
console.log(' | | __ _ _ __ _| | ___| |_ ');
|
|
@@ -15,14 +16,37 @@ async function run() {
|
|
|
15
16
|
|
|
16
17
|
terminal('none', `${ansi.bold.blue('Lapikit')} - Component Library for Svelte\n\n`);
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
console.log(
|
|
20
|
+
'This installer will guide you through the process of installing Lapikit on your Svelte project.\n'
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
console.log('List actions that will be done:');
|
|
24
|
+
console.log(
|
|
25
|
+
ansi.color.green('✓') +
|
|
26
|
+
' Add lili preprocess (named: lapikitPreprocess) on your svelte.config.js file\n'
|
|
27
|
+
);
|
|
28
|
+
console.log(ansi.underline.purple('Setup will take less than 5 seconds\n'));
|
|
29
|
+
|
|
30
|
+
const confirm = await toggle(rl, 'Launch install Lapikit on your project?');
|
|
31
|
+
if (!confirm) {
|
|
32
|
+
terminal('warn', `installation canceled.`);
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
console.log('\n');
|
|
19
37
|
|
|
20
|
-
|
|
38
|
+
try {
|
|
39
|
+
const svelteConfigFile = await findSvelteConfigFile(process.cwd());
|
|
40
|
+
await addLiliPreprocess(svelteConfigFile);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
terminal('warn', `Warning: Could not update svelte.config file: ${error.message}`);
|
|
43
|
+
}
|
|
21
44
|
}
|
|
22
45
|
|
|
23
46
|
run()
|
|
24
47
|
.then(() => {
|
|
25
|
-
terminal('none', `\n\n
|
|
48
|
+
terminal('none', `\n\nThank's for installing Lapikit!\n`);
|
|
49
|
+
terminal('none', `Website: https://lapikit.dev`);
|
|
26
50
|
terminal('none', `Github: https://github.com/lapikit/lapikit`);
|
|
27
51
|
terminal('none', `Support the developement: https://buymeacoffee.com/nycolaide`);
|
|
28
52
|
process.exit(0);
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
's-class': sClass,
|
|
13
13
|
's-style': sStyle,
|
|
14
14
|
text = undefined,
|
|
15
|
-
dark = false,
|
|
16
|
-
light = false,
|
|
17
15
|
color = undefined,
|
|
18
16
|
background = undefined,
|
|
19
17
|
rounded = undefined,
|
|
@@ -46,8 +44,8 @@
|
|
|
46
44
|
let mergedStyle = $derived(
|
|
47
45
|
[
|
|
48
46
|
componentStyle,
|
|
49
|
-
color ? `--kit-accordion-
|
|
50
|
-
background ? `--kit-accordion-
|
|
47
|
+
color ? `--kit-accordion-fg:${color}` : '',
|
|
48
|
+
background ? `--kit-accordion-bg:${background}` : ''
|
|
51
49
|
]
|
|
52
50
|
.filter(Boolean)
|
|
53
51
|
.join('; ')
|
|
@@ -61,8 +59,6 @@
|
|
|
61
59
|
style={mergedStyle}
|
|
62
60
|
{...restProps}
|
|
63
61
|
data-text={text ? true : undefined}
|
|
64
|
-
data-dark={dark}
|
|
65
|
-
data-light={light}
|
|
66
62
|
data-spacer={spacer}
|
|
67
63
|
data-hide-icon={hideIcon}
|
|
68
64
|
data-rounded={rounded}
|
|
@@ -74,8 +70,8 @@
|
|
|
74
70
|
.kit-accordion {
|
|
75
71
|
--kit-accordion-radius: 8px;
|
|
76
72
|
--kit-accordion-gap: 0;
|
|
77
|
-
--kit-accordion-
|
|
78
|
-
--kit-accordion-
|
|
73
|
+
--kit-accordion-fg: var(--kit-fg);
|
|
74
|
+
--kit-accordion-bg: transparent;
|
|
79
75
|
|
|
80
76
|
display: flex;
|
|
81
77
|
flex-wrap: wrap;
|
|
@@ -86,8 +82,8 @@
|
|
|
86
82
|
position: relative;
|
|
87
83
|
z-index: 1;
|
|
88
84
|
gap: var(--kit-accordion-gap);
|
|
89
|
-
color: var(--kit-accordion-
|
|
90
|
-
background: var(--kit-accordion-
|
|
85
|
+
color: var(--kit-accordion-fg);
|
|
86
|
+
background: var(--kit-accordion-bg);
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
.kit-accordion[data-spacer='true'] {
|
|
@@ -118,15 +114,6 @@
|
|
|
118
114
|
--kit-accordion-radius: 99999px;
|
|
119
115
|
}
|
|
120
116
|
|
|
121
|
-
.kit-accordion[data-dark='true'] {
|
|
122
|
-
--kit-accordion-background: var(--kit-surface-3);
|
|
123
|
-
--kit-accordion-color: var(--kit-fg);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.kit-accordion[data-light='true'] {
|
|
127
|
-
--kit-accordion-background: var(--kit-surface-1);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
117
|
.kit-accordion[data-hide-icon='true'] :global(.kit-accordion-item__indicator) {
|
|
131
118
|
display: none;
|
|
132
119
|
}
|
|
@@ -4,8 +4,6 @@ export interface AccordionProps extends Component {
|
|
|
4
4
|
ref?: HTMLElement | null;
|
|
5
5
|
is?: 'div';
|
|
6
6
|
text?: string;
|
|
7
|
-
dark?: boolean;
|
|
8
|
-
light?: boolean;
|
|
9
7
|
color?: string;
|
|
10
8
|
background?: string;
|
|
11
9
|
rounded?: RoundedType;
|
|
@@ -20,8 +18,6 @@ export interface AccordionItemProps extends Component {
|
|
|
20
18
|
is?: 'div';
|
|
21
19
|
index: number | string;
|
|
22
20
|
text?: string;
|
|
23
|
-
dark?: boolean;
|
|
24
|
-
light?: boolean;
|
|
25
21
|
rounded?: RoundedType;
|
|
26
22
|
color?: string;
|
|
27
23
|
background?: string;
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
activator = undefined,
|
|
15
15
|
indicator = undefined,
|
|
16
16
|
text = undefined,
|
|
17
|
-
dark = false,
|
|
18
|
-
light = false,
|
|
19
17
|
rounded = undefined,
|
|
20
18
|
color = undefined,
|
|
21
19
|
background = undefined,
|
|
@@ -51,8 +49,8 @@
|
|
|
51
49
|
let mergedStyle = $derived(
|
|
52
50
|
[
|
|
53
51
|
componentStyle,
|
|
54
|
-
color ? `--kit-accordion-item-
|
|
55
|
-
background ? `--kit-accordion-item-
|
|
52
|
+
color ? `--kit-accordion-item-fg:${color}` : '',
|
|
53
|
+
background ? `--kit-accordion-item-bg:${background}` : ''
|
|
56
54
|
]
|
|
57
55
|
.filter(Boolean)
|
|
58
56
|
.join('; ')
|
|
@@ -79,8 +77,6 @@
|
|
|
79
77
|
{...restProps}
|
|
80
78
|
data-open={safeOpen}
|
|
81
79
|
data-disabled={disabled}
|
|
82
|
-
data-dark={dark}
|
|
83
|
-
data-light={light}
|
|
84
80
|
data-rounded={rounded}
|
|
85
81
|
>
|
|
86
82
|
<button
|
|
@@ -132,13 +128,9 @@
|
|
|
132
128
|
|
|
133
129
|
.kit-accordion-item {
|
|
134
130
|
--kit-accordion-item-radius: var(--kit-accordion-radius, 8px);
|
|
135
|
-
--kit-accordion-item-
|
|
136
|
-
--kit-accordion-item-
|
|
137
|
-
--kit-accordion-item-
|
|
138
|
-
in oklab,
|
|
139
|
-
var(--kit-accordion-item-background),
|
|
140
|
-
var(--kit-fg) 12%
|
|
141
|
-
);
|
|
131
|
+
--kit-accordion-item-fg: var(--kit-accordion-fg, var(--kit-fg));
|
|
132
|
+
--kit-accordion-item-bg: var(--kit-surface-2);
|
|
133
|
+
--kit-accordion-item-bd: color-mix(in oklab, var(--kit-accordion-item-bg), var(--kit-fg) 12%);
|
|
142
134
|
--kit-accordion-item-trigger-y: 1rem;
|
|
143
135
|
--kit-accordion-item-trigger-x: 1.25rem;
|
|
144
136
|
|
|
@@ -146,9 +138,9 @@
|
|
|
146
138
|
max-width: 100%;
|
|
147
139
|
position: relative;
|
|
148
140
|
border-radius: var(--kit-accordion-item-radius);
|
|
149
|
-
background: var(--kit-accordion-item-
|
|
150
|
-
color: var(--kit-accordion-item-
|
|
151
|
-
border: 1px solid var(--kit-accordion-item-
|
|
141
|
+
background: var(--kit-accordion-item-bg);
|
|
142
|
+
color: var(--kit-accordion-item-fg);
|
|
143
|
+
border: 1px solid var(--kit-accordion-item-bd);
|
|
152
144
|
transition:
|
|
153
145
|
border-color 150ms ease,
|
|
154
146
|
background 150ms ease,
|
|
@@ -184,14 +176,6 @@
|
|
|
184
176
|
box-shadow: 0 10px 28px color-mix(in oklab, var(--kit-fg), transparent 90%);
|
|
185
177
|
}
|
|
186
178
|
|
|
187
|
-
.kit-accordion-item[data-dark='true'] {
|
|
188
|
-
--kit-accordion-item-background: var(--kit-surface-3);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.kit-accordion-item[data-light='true'] {
|
|
192
|
-
--kit-accordion-item-background: var(--kit-surface-1);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
179
|
.kit-accordion-item__trigger {
|
|
196
180
|
width: 100%;
|
|
197
181
|
display: flex;
|
|
@@ -147,15 +147,14 @@
|
|
|
147
147
|
|
|
148
148
|
<style>
|
|
149
149
|
.kit-alert {
|
|
150
|
-
--kit-alert-bg:
|
|
151
|
-
--kit-alert-fg:
|
|
152
|
-
--kit-alert-bd:
|
|
150
|
+
--kit-alert-bg: var(--kit-surface-2);
|
|
151
|
+
--kit-alert-fg: var(--kit-fg);
|
|
152
|
+
--kit-alert-bd: var(--kit-border);
|
|
153
153
|
--kit-alert-radius: 8px;
|
|
154
154
|
--kit-alert-py: 0.75rem;
|
|
155
155
|
--kit-alert-px: 0.875rem;
|
|
156
156
|
--kit-alert-gap: 0.625rem;
|
|
157
157
|
--outline-color: var(--kit-alert-bd);
|
|
158
|
-
--btn-radius: var(--kit-alert-radius);
|
|
159
158
|
|
|
160
159
|
position: relative;
|
|
161
160
|
display: grid;
|
|
@@ -169,12 +168,6 @@
|
|
|
169
168
|
border: 1px solid var(--kit-alert-bd);
|
|
170
169
|
}
|
|
171
170
|
|
|
172
|
-
.kit-alert[data-variant='filled'] {
|
|
173
|
-
background: var(--kit-alert-bg);
|
|
174
|
-
color: var(--kit-alert-fg);
|
|
175
|
-
border-color: var(--kit-alert-bd);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
171
|
.kit-alert[data-variant='outline'] {
|
|
179
172
|
background: transparent;
|
|
180
173
|
color: var(--kit-alert-fg);
|
|
@@ -43,61 +43,14 @@
|
|
|
43
43
|
'Segoe UI Symbol', 'Noto Color Emoji';
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
:root {
|
|
47
|
-
--kit-neutral-bg: color-mix(in oklab, var(--kit-neutral), var(--kit-bg) 85%);
|
|
48
|
-
--kit-neutral-bd: color-mix(in oklab, var(--kit-neutral), var(--kit-border) 70%);
|
|
49
|
-
--kit-neutral-fg: var(--kit-fg);
|
|
50
|
-
|
|
51
|
-
--kit-success-bg: color-mix(in oklab, var(--kit-success), var(--kit-bg) 85%);
|
|
52
|
-
--kit-success-bd: color-mix(in oklab, var(--kit-success), var(--kit-border) 70%);
|
|
53
|
-
--kit-success-fg: var(--kit-fg);
|
|
54
|
-
|
|
55
|
-
--kit-warning-bg: color-mix(in oklab, var(--kit-warning), var(--kit-bg) 85%);
|
|
56
|
-
--kit-warning-bd: color-mix(in oklab, var(--kit-warning), var(--kit-border) 70%);
|
|
57
|
-
--kit-warning-fg: var(--kit-fg);
|
|
58
|
-
|
|
59
|
-
--kit-danger-bg: color-mix(in oklab, var(--kit-danger), var(--kit-bg) 85%);
|
|
60
|
-
--kit-danger-bd: color-mix(in oklab, var(--kit-danger), var(--kit-border) 70%);
|
|
61
|
-
--kit-danger-fg: var(--kit-fg);
|
|
62
|
-
|
|
63
|
-
--kit-info-bg: color-mix(in oklab, var(--kit-info), var(--kit-bg) 85%);
|
|
64
|
-
--kit-info-bd: color-mix(in oklab, var(--kit-info), var(--kit-border) 70%);
|
|
65
|
-
--kit-info-fg: var(--kit-fg);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
:root {
|
|
69
|
-
--kit-outline-w: 1px;
|
|
70
|
-
--btn-radius: 8px;
|
|
71
|
-
|
|
72
|
-
--kit-btn-gap: 8px;
|
|
73
|
-
|
|
74
|
-
--bg: #111827;
|
|
75
|
-
--fg: #ffffff;
|
|
76
|
-
--bg-hover: #0b1220;
|
|
77
|
-
--border: rgba(255, 255, 255, 0.08);
|
|
78
|
-
--focus: blue;
|
|
79
|
-
--font:
|
|
80
|
-
ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
|
|
81
|
-
'Segoe UI Symbol', 'Noto Color Emoji';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
46
|
:global(.outline) {
|
|
85
|
-
--container-shape-start-start: var(--btn-radius);
|
|
86
|
-
--container-shape-start-end: var(--btn-radius);
|
|
87
|
-
--container-shape-end-start: var(--btn-radius);
|
|
88
|
-
--container-shape-end-end: var(--btn-radius);
|
|
89
|
-
|
|
90
|
-
border-width: var(--kit-outline-w);
|
|
91
|
-
inset: 0;
|
|
92
|
-
border-style: solid;
|
|
93
47
|
position: absolute;
|
|
48
|
+
inset: 0;
|
|
49
|
+
border: 1px solid var(--outline-color);
|
|
50
|
+
border-radius: inherit;
|
|
94
51
|
box-sizing: border-box;
|
|
95
|
-
border-color: var(--outline-color);
|
|
96
52
|
z-index: 1;
|
|
97
|
-
|
|
98
|
-
border-start-end-radius: var(--container-shape-start-end);
|
|
99
|
-
border-end-start-radius: var(--container-shape-end-start);
|
|
100
|
-
border-end-end-radius: var(--container-shape-end-end);
|
|
53
|
+
pointer-events: none;
|
|
101
54
|
}
|
|
102
55
|
|
|
103
56
|
:global(.kit-ripple) {
|
|
@@ -12,10 +12,8 @@
|
|
|
12
12
|
's-class': sClass,
|
|
13
13
|
's-style': sStyle,
|
|
14
14
|
classContent,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
variant = 'outline',
|
|
18
|
-
rounded,
|
|
15
|
+
variant = 'filled',
|
|
16
|
+
rounded = 0,
|
|
19
17
|
background,
|
|
20
18
|
color,
|
|
21
19
|
density = 'default',
|
|
@@ -25,7 +23,7 @@
|
|
|
25
23
|
let safeVariant = $derived(
|
|
26
24
|
typeof variant === 'string' && (variant === 'outline' || variant === 'text')
|
|
27
25
|
? variant
|
|
28
|
-
: '
|
|
26
|
+
: 'filled'
|
|
29
27
|
);
|
|
30
28
|
|
|
31
29
|
let safeDensity = $derived(
|
|
@@ -70,8 +68,8 @@
|
|
|
70
68
|
let mergedStyle = $derived(
|
|
71
69
|
[
|
|
72
70
|
componentStyle,
|
|
73
|
-
background ? `--kit-appbar-
|
|
74
|
-
color ? `--kit-appbar-
|
|
71
|
+
background ? `--kit-appbar-bg:${background}` : '',
|
|
72
|
+
color ? `--kit-appbar-fg:${color}` : '',
|
|
75
73
|
typeof rounded === 'string' && rounded.includes('px') ? `--kit-appbar-radius:${rounded}` : ''
|
|
76
74
|
]
|
|
77
75
|
.filter(Boolean)
|
|
@@ -87,8 +85,6 @@
|
|
|
87
85
|
{...restProps}
|
|
88
86
|
data-variant={safeVariant}
|
|
89
87
|
data-density={safeDensity}
|
|
90
|
-
data-light={light || undefined}
|
|
91
|
-
data-dark={dark || undefined}
|
|
92
88
|
data-rounded={rounded}
|
|
93
89
|
>
|
|
94
90
|
{#if safeVariant === 'outline'}
|
|
@@ -102,13 +98,13 @@
|
|
|
102
98
|
|
|
103
99
|
<style>
|
|
104
100
|
.kit-appbar {
|
|
105
|
-
--kit-appbar-
|
|
106
|
-
--kit-appbar-
|
|
101
|
+
--kit-appbar-bg: var(--kit-surface-2);
|
|
102
|
+
--kit-appbar-fg: var(--kit-fg);
|
|
107
103
|
--kit-appbar-radius: 1rem;
|
|
108
104
|
--kit-appbar-size: 4rem;
|
|
109
105
|
--kit-appbar-padding-x: 1rem;
|
|
110
106
|
--kit-appbar-padding-wrapper: 0;
|
|
111
|
-
--kit-appbar-
|
|
107
|
+
--kit-appbar-bd: color-mix(in oklab, var(--kit-appbar-fg), transparent 88%);
|
|
112
108
|
|
|
113
109
|
display: flex;
|
|
114
110
|
align-items: center;
|
|
@@ -118,13 +114,13 @@
|
|
|
118
114
|
min-height: var(--kit-appbar-size);
|
|
119
115
|
padding-inline: var(--kit-appbar-padding-x);
|
|
120
116
|
border-radius: var(--kit-appbar-radius);
|
|
121
|
-
color: var(--kit-appbar-
|
|
122
|
-
background-color: var(--kit-appbar-
|
|
117
|
+
color: var(--kit-appbar-fg);
|
|
118
|
+
background-color: var(--kit-appbar-bg);
|
|
123
119
|
overflow: hidden;
|
|
124
120
|
}
|
|
125
121
|
|
|
126
122
|
.kit-appbar[data-variant='text'] {
|
|
127
|
-
--kit-appbar-
|
|
123
|
+
--kit-appbar-bd: transparent;
|
|
128
124
|
}
|
|
129
125
|
|
|
130
126
|
.kit-appbar[data-density='compact'] {
|
|
@@ -142,17 +138,6 @@
|
|
|
142
138
|
--kit-appbar-padding-x: 1.5rem;
|
|
143
139
|
}
|
|
144
140
|
|
|
145
|
-
.kit-appbar[data-light='true'] {
|
|
146
|
-
--kit-appbar-background: color-mix(in oklab, white 88%, var(--kit-surface-1));
|
|
147
|
-
--kit-appbar-color: var(--kit-fg);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.kit-appbar[data-dark='true'] {
|
|
151
|
-
--kit-appbar-background: color-mix(in oklab, black 72%, var(--kit-surface-3));
|
|
152
|
-
--kit-appbar-color: white;
|
|
153
|
-
--kit-appbar-border: color-mix(in oklab, white, transparent 78%);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
141
|
.kit-appbar[data-rounded='0'] {
|
|
157
142
|
--kit-appbar-radius: 0;
|
|
158
143
|
}
|
|
@@ -189,7 +174,7 @@
|
|
|
189
174
|
}
|
|
190
175
|
|
|
191
176
|
.kit-appbar .outline {
|
|
192
|
-
--outline-color: var(--kit-appbar-
|
|
177
|
+
--outline-color: var(--kit-appbar-bd);
|
|
193
178
|
|
|
194
179
|
pointer-events: none;
|
|
195
180
|
}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { Component, RoundedType } from '../../@types';
|
|
2
2
|
type Density = 'compact' | 'comfortable' | 'default';
|
|
3
|
-
type Variant = 'outline' | 'text';
|
|
3
|
+
type Variant = 'filled' | 'outline' | 'text';
|
|
4
4
|
export interface AppbarProps extends Component {
|
|
5
5
|
ref?: HTMLElement | null;
|
|
6
6
|
is?: 'div' | 'header' | 'nav';
|
|
7
7
|
variant?: Variant;
|
|
8
8
|
rounded?: RoundedType | string;
|
|
9
9
|
density?: Density | Record<string, Density>;
|
|
10
|
-
dark?: boolean;
|
|
11
|
-
light?: boolean;
|
|
12
10
|
color?: string;
|
|
13
11
|
background?: string;
|
|
14
12
|
classContent?: string | string[] | undefined;
|
|
@@ -74,8 +74,18 @@
|
|
|
74
74
|
|
|
75
75
|
<style>
|
|
76
76
|
.kit-avatar {
|
|
77
|
-
--kit-avatar-size:
|
|
78
|
-
--kit-avatar-
|
|
77
|
+
--kit-avatar-size-xs: 1.75rem;
|
|
78
|
+
--kit-avatar-size-sm: 2rem;
|
|
79
|
+
--kit-avatar-size-md: 2.25rem;
|
|
80
|
+
--kit-avatar-size-lg: 2.5rem;
|
|
81
|
+
--kit-avatar-size-xl: 2.75rem;
|
|
82
|
+
--kit-avatar-font-xs: 0.75rem;
|
|
83
|
+
--kit-avatar-font-sm: 0.8125rem;
|
|
84
|
+
--kit-avatar-font-md: 0.875rem;
|
|
85
|
+
--kit-avatar-font-lg: 1rem;
|
|
86
|
+
--kit-avatar-font-xl: 1.125rem;
|
|
87
|
+
--kit-avatar-size: var(--kit-avatar-size-md);
|
|
88
|
+
--kit-avatar-font-size: var(--kit-avatar-font-md);
|
|
79
89
|
--kit-avatar-density-scale: 1;
|
|
80
90
|
|
|
81
91
|
display: inline-flex;
|
|
@@ -98,24 +108,24 @@
|
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
.kit-avatar[data-size='xs'] {
|
|
101
|
-
--kit-avatar-size:
|
|
102
|
-
--kit-avatar-font-size:
|
|
111
|
+
--kit-avatar-size: var(--kit-avatar-size-xs);
|
|
112
|
+
--kit-avatar-font-size: var(--kit-avatar-font-xs);
|
|
103
113
|
}
|
|
104
114
|
.kit-avatar[data-size='sm'] {
|
|
105
|
-
--kit-avatar-size:
|
|
106
|
-
--kit-avatar-font-size:
|
|
115
|
+
--kit-avatar-size: var(--kit-avatar-size-sm);
|
|
116
|
+
--kit-avatar-font-size: var(--kit-avatar-font-sm);
|
|
107
117
|
}
|
|
108
118
|
.kit-avatar[data-size='md'] {
|
|
109
|
-
--kit-avatar-size:
|
|
110
|
-
--kit-avatar-font-size:
|
|
119
|
+
--kit-avatar-size: var(--kit-avatar-size-md);
|
|
120
|
+
--kit-avatar-font-size: var(--kit-avatar-font-md);
|
|
111
121
|
}
|
|
112
122
|
.kit-avatar[data-size='lg'] {
|
|
113
|
-
--kit-avatar-size:
|
|
114
|
-
--kit-avatar-font-size:
|
|
123
|
+
--kit-avatar-size: var(--kit-avatar-size-lg);
|
|
124
|
+
--kit-avatar-font-size: var(--kit-avatar-font-lg);
|
|
115
125
|
}
|
|
116
126
|
.kit-avatar[data-size='xl'] {
|
|
117
|
-
--kit-avatar-size:
|
|
118
|
-
--kit-avatar-font-size:
|
|
127
|
+
--kit-avatar-size: var(--kit-avatar-size-xl);
|
|
128
|
+
--kit-avatar-font-size: var(--kit-avatar-font-xl);
|
|
119
129
|
}
|
|
120
130
|
|
|
121
131
|
.kit-avatar[data-density='compact'] {
|