vanilla-jui 1.5.24 → 1.5.26
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/dist/index.d.ts +39 -36
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/form.ts +3 -4
- package/src/components/menu.ts +2 -3
- package/src/components/modal.ts +2 -4
- package/src/components/pagination.ts +17 -25
- package/src/css/accordion.css +1 -1
- package/src/css/editor.css +697 -1
- package/src/css/form.css +0 -5
- package/src/css/index.css +2 -4
- package/src/css/pagination.css +1 -5
- package/src/css/swiper.css +42 -7
- package/src/css/themes/default/editor.css +59 -1
- package/src/css/themes/default/index.css +0 -1
- package/src/css/themes/default/swiper.css +1 -1
- package/src/css/toc.css +0 -4
- package/src/css/tokens.css +1 -1
- package/src/index.ts +3 -2
- package/src/locales/index.ts +2 -0
- package/src/primitives/theme.ts +1 -4
- package/src/primitives/toast.ts +4 -8
- package/src/utilities/browser.ts +2 -3
- package/src/utilities/locale.ts +6 -0
- package/src/css/content.css +0 -692
- package/src/css/themes/default/content.css +0 -59
package/src/css/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer tokens, gradient, layout, icon, font, components, themes, animation, status;
|
|
2
2
|
|
|
3
3
|
@import url('./tokens.css');
|
|
4
4
|
@import url('./gradient.css');
|
|
@@ -6,10 +6,8 @@
|
|
|
6
6
|
@import url('./icon.css');
|
|
7
7
|
@import url('./font.css');
|
|
8
8
|
|
|
9
|
-
@import url('./content.css');
|
|
10
|
-
|
|
11
9
|
@import url('./components.css');
|
|
12
10
|
@import url('./themes/index.css');
|
|
13
11
|
|
|
14
12
|
@import url('./animation.css');
|
|
15
|
-
@import url('./status.css');
|
|
13
|
+
@import url('./status.css');
|
package/src/css/pagination.css
CHANGED
package/src/css/swiper.css
CHANGED
|
@@ -2,38 +2,73 @@
|
|
|
2
2
|
.j-swiper {
|
|
3
3
|
position: relative;
|
|
4
4
|
display: block;
|
|
5
|
-
width: 100%;
|
|
6
5
|
overflow: hidden;
|
|
7
6
|
touch-action: pan-y;
|
|
8
7
|
user-select: none;
|
|
8
|
+
width: 100%;
|
|
9
|
+
min-height: var(--swiper-min-height);
|
|
10
|
+
border-radius: var(--radius-md);
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
.j-swiper .swiper-wrapper {
|
|
12
14
|
display: flex;
|
|
13
|
-
width: 100%;
|
|
14
|
-
height: 100%;
|
|
15
15
|
will-change: transform;
|
|
16
16
|
position: relative;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
aspect-ratio: inherit;
|
|
20
|
+
border-radius: inherit;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
.j-swiper .swiper-slide {
|
|
20
24
|
position: relative;
|
|
21
25
|
display: block;
|
|
22
|
-
width: 100%;
|
|
23
|
-
min-width: 100%;
|
|
24
26
|
overflow: hidden;
|
|
25
27
|
color: inherit;
|
|
26
28
|
text-decoration: none;
|
|
27
29
|
user-select: none;
|
|
30
|
+
width: 100%;
|
|
31
|
+
min-width: 100%;
|
|
32
|
+
aspect-ratio: inherit;
|
|
33
|
+
border-radius: inherit;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.j-swiper .swiper-slide::before {
|
|
37
|
+
position: absolute;
|
|
38
|
+
content: 'loading';
|
|
39
|
+
top: 0;
|
|
40
|
+
left: 0;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
aspect-ratio: inherit;
|
|
44
|
+
border-radius: inherit;
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
align-items: center;
|
|
48
|
+
|
|
49
|
+
color: var(--ui-fg-soft);
|
|
50
|
+
font-size: var(--font-size-md);
|
|
51
|
+
letter-spacing: 1px;
|
|
52
|
+
|
|
53
|
+
background-color: var(--tone-wash);
|
|
54
|
+
background-image: radial-gradient(
|
|
55
|
+
circle,
|
|
56
|
+
var(--ui-border) 1px,
|
|
57
|
+
transparent 1px
|
|
58
|
+
);
|
|
59
|
+
background-size: 20px 20px;
|
|
28
60
|
}
|
|
29
61
|
|
|
30
62
|
.j-swiper .swiper-image {
|
|
63
|
+
position: relative;
|
|
31
64
|
display: block;
|
|
65
|
+
object-fit: cover;
|
|
66
|
+
pointer-events: none;
|
|
32
67
|
width: 100%;
|
|
33
68
|
height: 100%;
|
|
34
69
|
min-height: var(--swiper-min-height);
|
|
35
|
-
|
|
36
|
-
|
|
70
|
+
aspect-ratio: inherit;
|
|
71
|
+
border-radius: inherit;
|
|
37
72
|
}
|
|
38
73
|
|
|
39
74
|
.j-swiper .swiper-slide-title {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@layer themes {
|
|
2
|
-
#j-editor {
|
|
2
|
+
#j-editor-container {
|
|
3
3
|
--editor-max-width: 880px;
|
|
4
4
|
--editor-min-height: calc(100vh - 51px);
|
|
5
5
|
--editor-padding: 1.5rem 1.5rem 4rem;
|
|
@@ -7,4 +7,62 @@
|
|
|
7
7
|
--editor-border-style: solid;
|
|
8
8
|
--editor-border-color: var(--ui-border);
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
.j-editor {
|
|
12
|
+
--editor-outline: 0;
|
|
13
|
+
--editor-font-size: var(--font-size-lg);
|
|
14
|
+
--editor-line-height: 1.75;
|
|
15
|
+
--editor-letter-space: 0.01em;
|
|
16
|
+
--editor-word-space: 0.02em;
|
|
17
|
+
--editor-paragraph-space: 1.25em;
|
|
18
|
+
--editor-heading-space: 1.5em;
|
|
19
|
+
--editor-block-space: 1.5em;
|
|
20
|
+
--editor-list-space: 0.5em;
|
|
21
|
+
|
|
22
|
+
--editor-heading-fg: var(--tone-heading);
|
|
23
|
+
--editor-caption-fg: var(--tone-caption);
|
|
24
|
+
--editor-ring: var(--tone-ring);
|
|
25
|
+
--editor-border-tone: var(--tone-border);
|
|
26
|
+
--editor-border-subtle: var(--ui-border-subtle);
|
|
27
|
+
--editor-blockquote-bg: var(--tone-wash);
|
|
28
|
+
--editor-blockquote-fg: var(--tone-subtitle);
|
|
29
|
+
--editor-link: var(--tone-link);
|
|
30
|
+
--editor-link-hover: var(--tone-link-hover);
|
|
31
|
+
--editor-link-visited: var(--tone-link-visited);
|
|
32
|
+
--editor-link-active: var(--tone-link-active);
|
|
33
|
+
--editor-border: var(--ui-border);
|
|
34
|
+
--editor-code-bg: var(--tone-code-bg);
|
|
35
|
+
--editor-code-fg: var(--tone-code-fg);
|
|
36
|
+
--editor-bg-subtle: var(--ui-bg-subtle);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.j-editor.is-sm {
|
|
40
|
+
--editor-font-size: var(--font-size-md);
|
|
41
|
+
--editor-line-height: 1.65;
|
|
42
|
+
--editor-paragraph-space: 1em;
|
|
43
|
+
--editor-heading-space: 1.25em;
|
|
44
|
+
--editor-block-space: 1.25em;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.j-editor.is-lg {
|
|
48
|
+
--editor-font-size: var(--font-size-xl);
|
|
49
|
+
--editor-line-height: 1.8;
|
|
50
|
+
--editor-paragraph-space: 1.5em;
|
|
51
|
+
--editor-heading-space: 1.75em;
|
|
52
|
+
--editor-block-space: 1.75em;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.j-editor.is-xl {
|
|
56
|
+
--editor-font-size: var(--font-size-2xl);
|
|
57
|
+
--editor-line-height: 1.85;
|
|
58
|
+
--editor-paragraph-space: 1.75em;
|
|
59
|
+
--editor-heading-space: 2em;
|
|
60
|
+
--editor-block-space: 2em;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.j-radius-round .j-editor {
|
|
64
|
+
--radius-sm: 0.75rem;
|
|
65
|
+
--radius-md: 1rem;
|
|
66
|
+
--radius-lg: 1.5rem;
|
|
67
|
+
}
|
|
10
68
|
}
|
package/src/css/toc.css
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
.j-toc .toc-list {
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-direction: column;
|
|
9
|
-
gap: 0;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
.j-toc .toc-link {
|
|
@@ -15,9 +14,6 @@
|
|
|
15
14
|
color: var(--tone-caption);
|
|
16
15
|
font-size: var(--font-size-sm);
|
|
17
16
|
text-decoration: none;
|
|
18
|
-
transition:
|
|
19
|
-
color 0.15s,
|
|
20
|
-
border-color 0.15s;
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
.j-toc .toc-link:hover,
|
package/src/css/tokens.css
CHANGED
package/src/index.ts
CHANGED
|
@@ -7,14 +7,15 @@ export * from './utilities/id.ts';
|
|
|
7
7
|
export * from './utilities/dom.ts';
|
|
8
8
|
export * from './utilities/events.ts';
|
|
9
9
|
export * from './utilities/http.ts';
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './utilities/locale.ts';
|
|
11
11
|
export * from './utilities/object.ts';
|
|
12
12
|
export * from './utilities/timer.ts';
|
|
13
13
|
export * from './utilities/types.ts';
|
|
14
|
-
export * from './core/scheduler.ts';
|
|
15
14
|
export * from './utilities/state.ts';
|
|
16
15
|
export * from './utilities/refs.ts';
|
|
16
|
+
export * from './core/scheduler.ts';
|
|
17
17
|
export * from './core/view.ts';
|
|
18
|
+
export * from './core/motion.ts';
|
|
18
19
|
export * from './core/presence.ts';
|
|
19
20
|
|
|
20
21
|
// UI primitives
|
package/src/locales/index.ts
CHANGED
package/src/primitives/theme.ts
CHANGED
|
@@ -7,9 +7,7 @@ import {
|
|
|
7
7
|
flushSync,
|
|
8
8
|
jsx,
|
|
9
9
|
} from 'vanilla-signal';
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import locales from '../locales/index.ts';
|
|
10
|
+
import { translate } from '../utilities/locale.ts';
|
|
13
11
|
import { all, joinClasses } from '../utilities/dom.ts';
|
|
14
12
|
import { createEventManager } from '../utilities/events.ts';
|
|
15
13
|
import { isPlainObject } from '../utilities/object.ts';
|
|
@@ -228,7 +226,6 @@ export function createTheme(options: ThemeOptions = {}): ThemeInstance {
|
|
|
228
226
|
const storage = createThemeStorage();
|
|
229
227
|
const bindings = new Set<() => void>();
|
|
230
228
|
const events = createEventManager();
|
|
231
|
-
const translate = (key: string): string => t(key, locales);
|
|
232
229
|
const scheme = (): string =>
|
|
233
230
|
window.matchMedia?.('(prefers-color-scheme: dark)').matches
|
|
234
231
|
? 'dark'
|
package/src/primitives/toast.ts
CHANGED
|
@@ -6,9 +6,7 @@ import {
|
|
|
6
6
|
insert,
|
|
7
7
|
jsx,
|
|
8
8
|
} from 'vanilla-signal';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import locales from '../locales/index.ts';
|
|
9
|
+
import { translate } from '../utilities/locale.ts';
|
|
12
10
|
import { icon } from '../primitives/icons.ts';
|
|
13
11
|
import { createLoading } from '../primitives/loading.ts';
|
|
14
12
|
import { joinClasses, q } from '../utilities/dom.ts';
|
|
@@ -17,8 +15,6 @@ import { randomId } from '../utilities/id.ts';
|
|
|
17
15
|
import { timer } from '../utilities/timer.ts';
|
|
18
16
|
import { validateParam } from '../utilities/types.ts';
|
|
19
17
|
|
|
20
|
-
const s = (k: string) => t(k, locales);
|
|
21
|
-
|
|
22
18
|
export type ToastTheme = 'info' | 'success' | 'warning' | 'error' | 'primary';
|
|
23
19
|
|
|
24
20
|
export interface ToastClassNames {
|
|
@@ -174,7 +170,7 @@ function toastIconContent(
|
|
|
174
170
|
|
|
175
171
|
function toastMessage(message: string, options: ToastOptions): string {
|
|
176
172
|
return isToastLoading(options)
|
|
177
|
-
? options.text?.loading ||
|
|
173
|
+
? options.text?.loading || translate('Loading...')
|
|
178
174
|
: message;
|
|
179
175
|
}
|
|
180
176
|
|
|
@@ -456,8 +452,8 @@ function confirm(message = '', props: ToastConfirmProps = {}): HTMLElement {
|
|
|
456
452
|
if (toast) return toast;
|
|
457
453
|
}
|
|
458
454
|
validateParam('message', message, 'string', 'Toast.confirm');
|
|
459
|
-
const closeText = props.text?.close ||
|
|
460
|
-
const confirmText = props.text?.confirm ||
|
|
455
|
+
const closeText = props.text?.close || translate('Close');
|
|
456
|
+
const confirmText = props.text?.confirm || translate('Confirm');
|
|
461
457
|
const theme = props.theme || 'info';
|
|
462
458
|
validateParam('once', once, 'boolean', 'Toast.confirm');
|
|
463
459
|
validateParam('theme', theme, TOAST_THEME_RULE, 'Toast.confirm');
|
package/src/utilities/browser.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t } from 'vanilla-signal-i18n';
|
|
2
1
|
import { Toast } from '../primitives/toast';
|
|
3
|
-
import
|
|
2
|
+
import { translate } from '../utilities/locale.ts';
|
|
4
3
|
|
|
5
4
|
declare global {
|
|
6
5
|
interface Navigator {
|
|
@@ -128,7 +127,7 @@ export function isModernBrowser(): SupportES2022 {
|
|
|
128
127
|
}
|
|
129
128
|
export function checkModernBrowser(): SupportES2022 {
|
|
130
129
|
if (!isModernBrowser()) {
|
|
131
|
-
Toast.confirm(
|
|
130
|
+
Toast.confirm(translate('wn'), {
|
|
132
131
|
theme: 'error',
|
|
133
132
|
onConfirm: () => {
|
|
134
133
|
window.open('https://www.google.cn/chrome/fallback/', '_blank');
|