vanilla-jui 1.7.7 → 1.7.9
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 +10 -15
- 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 +1 -41
- package/src/components/toc.ts +134 -86
- package/src/css/form.css +8 -41
- package/src/css/themes/default/form.css +0 -6
- package/src/css/themes/default/tip.css +21 -17
- package/src/css/themes/default/toc.css +3 -15
- package/src/css/tip.css +1 -0
- package/src/primitives/loading.ts +2 -2
package/package.json
CHANGED
package/src/components/form.ts
CHANGED
|
@@ -50,10 +50,6 @@ type FormControlType =
|
|
|
50
50
|
|
|
51
51
|
export interface FormClassNames {
|
|
52
52
|
form: string;
|
|
53
|
-
vertical: string;
|
|
54
|
-
horizontal: string;
|
|
55
|
-
itemVertical: string;
|
|
56
|
-
itemHorizontal: string;
|
|
57
53
|
item: string;
|
|
58
54
|
label: string;
|
|
59
55
|
required: string;
|
|
@@ -68,8 +64,6 @@ export interface FormClassNames {
|
|
|
68
64
|
select: string;
|
|
69
65
|
radio: string;
|
|
70
66
|
checkbox: string;
|
|
71
|
-
choiceVertical: string;
|
|
72
|
-
choiceHorizontal: string;
|
|
73
67
|
choiceGroup: string;
|
|
74
68
|
radioLabel: string;
|
|
75
69
|
radioText: string;
|
|
@@ -117,7 +111,6 @@ export interface FormField {
|
|
|
117
111
|
readonly?: boolean;
|
|
118
112
|
autocomplete?: string;
|
|
119
113
|
multiple?: boolean;
|
|
120
|
-
vertical?: boolean;
|
|
121
114
|
group?: boolean;
|
|
122
115
|
size?: string;
|
|
123
116
|
variant?: string;
|
|
@@ -145,8 +138,6 @@ export type FormTextConfig = Partial<FormText>;
|
|
|
145
138
|
|
|
146
139
|
export interface FormProps extends Record<string, unknown> {
|
|
147
140
|
id?: string | null;
|
|
148
|
-
vertical?: boolean;
|
|
149
|
-
itemVertical?: boolean;
|
|
150
141
|
size?: string;
|
|
151
142
|
style?: FormStyle;
|
|
152
143
|
fields?: readonly FormItem<FormField>[];
|
|
@@ -163,8 +154,6 @@ export interface FormProps extends Record<string, unknown> {
|
|
|
163
154
|
|
|
164
155
|
interface ResolvedFormProps extends Record<string, unknown> {
|
|
165
156
|
id: string;
|
|
166
|
-
vertical: boolean;
|
|
167
|
-
itemVertical: boolean;
|
|
168
157
|
size: string;
|
|
169
158
|
style: FormStyle;
|
|
170
159
|
fields: FormItem<FormField>[];
|
|
@@ -203,10 +192,6 @@ interface FormControlContext {
|
|
|
203
192
|
|
|
204
193
|
const DEFAULT_CLASS_NAMES: FormClassNames = {
|
|
205
194
|
form: 'j-form',
|
|
206
|
-
vertical: 'is-vertical',
|
|
207
|
-
horizontal: 'is-horizontal',
|
|
208
|
-
itemVertical: 'is-item-vertical',
|
|
209
|
-
itemHorizontal: 'is-item-horizontal',
|
|
210
195
|
item: 'form-field',
|
|
211
196
|
label: 'field-legend',
|
|
212
197
|
required: 'is-required',
|
|
@@ -221,8 +206,6 @@ const DEFAULT_CLASS_NAMES: FormClassNames = {
|
|
|
221
206
|
select: 'j-select',
|
|
222
207
|
radio: 'j-radio',
|
|
223
208
|
checkbox: 'j-checkbox',
|
|
224
|
-
choiceVertical: 'is-vertical',
|
|
225
|
-
choiceHorizontal: 'is-horizontal',
|
|
226
209
|
choiceGroup: 'is-group',
|
|
227
210
|
radioLabel: 'radio-label',
|
|
228
211
|
radioText: 'radio-text',
|
|
@@ -249,8 +232,6 @@ const FORM_PROPS_SCHEMA = {
|
|
|
249
232
|
return value;
|
|
250
233
|
},
|
|
251
234
|
},
|
|
252
|
-
vertical: { default: true, type: 'boolean' },
|
|
253
|
-
itemVertical: { default: true, type: 'boolean' },
|
|
254
235
|
size: { default: 'md', type: 'string' },
|
|
255
236
|
style: { default: '', types: ['string', 'object', 'null'] },
|
|
256
237
|
fields: { default: [], type: 'array' },
|
|
@@ -429,8 +410,6 @@ function normalizeProps(input: FormProps): ResolvedFormProps {
|
|
|
429
410
|
return {
|
|
430
411
|
...props,
|
|
431
412
|
id: String(props.id),
|
|
432
|
-
vertical: Boolean(props.vertical),
|
|
433
|
-
itemVertical: Boolean(props.itemVertical),
|
|
434
413
|
size: props.size as string,
|
|
435
414
|
style: props.style as FormStyle,
|
|
436
415
|
fields,
|
|
@@ -713,21 +692,15 @@ export function createForm(input: FormProps = {}): Form {
|
|
|
713
692
|
return jsx('div', {
|
|
714
693
|
className: () => {
|
|
715
694
|
const field = fieldAccessor();
|
|
716
|
-
const direction = field.vertical ? 'vertical' : 'horizontal';
|
|
717
695
|
const names = props.className;
|
|
718
696
|
return joinClasses(
|
|
719
697
|
type === 'radio' ? names.radio : names.checkbox,
|
|
720
|
-
direction === 'vertical'
|
|
721
|
-
? names.choiceVertical
|
|
722
|
-
: names.choiceHorizontal,
|
|
723
698
|
field.group ? names.choiceGroup : '',
|
|
724
699
|
field.size ? `is-${field.size}` : ''
|
|
725
700
|
);
|
|
726
701
|
},
|
|
727
702
|
'data-field-choice-group': () => fieldAccessor().name || id,
|
|
728
703
|
'data-choice-type': type,
|
|
729
|
-
'data-choice-layout': () =>
|
|
730
|
-
fieldAccessor().vertical ? 'vertical' : 'horizontal',
|
|
731
704
|
children: () =>
|
|
732
705
|
(fieldAccessor().options || []).map((option, optionIndex) => {
|
|
733
706
|
const item = normalizeOption(option);
|
|
@@ -1090,23 +1063,10 @@ export function createForm(input: FormProps = {}): Form {
|
|
|
1090
1063
|
},
|
|
1091
1064
|
view: () => {
|
|
1092
1065
|
const element = jsx('form', {
|
|
1093
|
-
className: joinClasses(
|
|
1094
|
-
props.className.form,
|
|
1095
|
-
props.vertical
|
|
1096
|
-
? props.className.vertical
|
|
1097
|
-
: props.className.horizontal,
|
|
1098
|
-
props.itemVertical
|
|
1099
|
-
? props.className.itemVertical
|
|
1100
|
-
: props.className.itemHorizontal,
|
|
1101
|
-
formSizeClass()
|
|
1102
|
-
),
|
|
1066
|
+
className: joinClasses(props.className.form, formSizeClass()),
|
|
1103
1067
|
id: props.id,
|
|
1104
1068
|
novalidate: props.validator.vanilla === false,
|
|
1105
1069
|
'data-form': 'root',
|
|
1106
|
-
'data-form-layout': props.vertical ? 'vertical' : 'horizontal',
|
|
1107
|
-
'data-form-field-layout': props.itemVertical
|
|
1108
|
-
? 'vertical'
|
|
1109
|
-
: 'horizontal',
|
|
1110
1070
|
onSubmit: (event: Event) => void handleSubmit(event),
|
|
1111
1071
|
onReset: (event: Event) => {
|
|
1112
1072
|
resetValidationState();
|
package/src/components/toc.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
For,
|
|
3
|
+
Show,
|
|
3
4
|
createDeepStore,
|
|
4
5
|
createEffect,
|
|
5
6
|
createMemo,
|
|
6
7
|
flushSync,
|
|
8
|
+
insert,
|
|
7
9
|
jsx,
|
|
8
10
|
untrack,
|
|
9
11
|
} from 'vanilla-signal';
|
|
@@ -27,6 +29,16 @@ interface TocClassNames {
|
|
|
27
29
|
|
|
28
30
|
type TocClassNameConfig = Partial<TocClassNames>;
|
|
29
31
|
|
|
32
|
+
interface TocIndicatorConfig {
|
|
33
|
+
width: string;
|
|
34
|
+
heightRatio: number;
|
|
35
|
+
radius: string;
|
|
36
|
+
left: string;
|
|
37
|
+
color: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type TocIndicatorConfigInput = Partial<TocIndicatorConfig>;
|
|
41
|
+
|
|
30
42
|
export interface TocItem {
|
|
31
43
|
id: string;
|
|
32
44
|
text: string;
|
|
@@ -52,8 +64,7 @@ interface TocProps extends Record<string, unknown> {
|
|
|
52
64
|
offset?: number;
|
|
53
65
|
reactive?: boolean;
|
|
54
66
|
title?: boolean;
|
|
55
|
-
|
|
56
|
-
indicatorHeightRatio?: number;
|
|
67
|
+
indicator?: TocIndicatorConfigInput;
|
|
57
68
|
className?: TocClassNameConfig;
|
|
58
69
|
onChange?:
|
|
59
70
|
| ((item: TocItem | null, index: number, toc: TocInstance) => void)
|
|
@@ -66,8 +77,7 @@ interface ResolvedTocProps extends Record<string, unknown> {
|
|
|
66
77
|
offset: number;
|
|
67
78
|
reactive: boolean;
|
|
68
79
|
title: boolean;
|
|
69
|
-
|
|
70
|
-
indicatorHeightRatio: number;
|
|
80
|
+
indicator: TocIndicatorConfig;
|
|
71
81
|
className: TocClassNames;
|
|
72
82
|
onChange:
|
|
73
83
|
| ((item: TocItem | null, index: number, toc: TocInstance) => void)
|
|
@@ -119,6 +129,14 @@ const DEFAULT_CLASS_NAMES: TocClassNames = {
|
|
|
119
129
|
indicator: 'toc-indicator',
|
|
120
130
|
};
|
|
121
131
|
|
|
132
|
+
const DEFAULT_INDICATOR_CONFIG: TocIndicatorConfig = {
|
|
133
|
+
width: '2px',
|
|
134
|
+
heightRatio: 5,
|
|
135
|
+
radius: '2px',
|
|
136
|
+
left: '0',
|
|
137
|
+
color: 'var(--tone-solid)',
|
|
138
|
+
};
|
|
139
|
+
|
|
122
140
|
const TOC_PROPS_SCHEMA = {
|
|
123
141
|
target: { default: '.j-content' },
|
|
124
142
|
headings: { default: 'h2, h3', type: 'string' },
|
|
@@ -129,12 +147,22 @@ const TOC_PROPS_SCHEMA = {
|
|
|
129
147
|
},
|
|
130
148
|
reactive: { default: false, type: 'boolean' },
|
|
131
149
|
title: { default: false, type: 'boolean' },
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
150
|
+
indicator: {
|
|
151
|
+
default: DEFAULT_INDICATOR_CONFIG,
|
|
152
|
+
type: 'plainObject',
|
|
153
|
+
merge: 'shallow',
|
|
154
|
+
schema: {
|
|
155
|
+
width: { default: DEFAULT_INDICATOR_CONFIG.width, type: 'string' },
|
|
156
|
+
heightRatio: {
|
|
157
|
+
default: DEFAULT_INDICATOR_CONFIG.heightRatio,
|
|
158
|
+
type: 'number',
|
|
159
|
+
min: 1,
|
|
160
|
+
max: 10,
|
|
161
|
+
},
|
|
162
|
+
radius: { default: DEFAULT_INDICATOR_CONFIG.radius, type: 'string' },
|
|
163
|
+
left: { default: DEFAULT_INDICATOR_CONFIG.left, type: 'string' },
|
|
164
|
+
color: { default: DEFAULT_INDICATOR_CONFIG.color, type: 'string' },
|
|
165
|
+
},
|
|
138
166
|
},
|
|
139
167
|
className: {
|
|
140
168
|
default: DEFAULT_CLASS_NAMES,
|
|
@@ -159,8 +187,7 @@ function normalizeProps(input: TocProps): ResolvedTocProps {
|
|
|
159
187
|
offset: props.offset as number,
|
|
160
188
|
reactive: props.reactive as boolean,
|
|
161
189
|
title: props.title as boolean,
|
|
162
|
-
|
|
163
|
-
indicatorHeightRatio: props.indicatorHeightRatio as number,
|
|
190
|
+
indicator: props.indicator as TocIndicatorConfig,
|
|
164
191
|
className: props.className as TocClassNames,
|
|
165
192
|
onChange: props.onChange as ResolvedTocProps['onChange'],
|
|
166
193
|
};
|
|
@@ -238,7 +265,10 @@ export function createToc(props: TocProps = {}): TocInstance {
|
|
|
238
265
|
let activeLinkId: string | null = null;
|
|
239
266
|
let listHeight = 0;
|
|
240
267
|
const linkRefs = new Map<string, HTMLElement>();
|
|
241
|
-
const
|
|
268
|
+
const getItems = (): TocItem[] =>
|
|
269
|
+
Array.isArray(state.items) ? state.items : [];
|
|
270
|
+
const hasItems = (): boolean => getItems().length > 0;
|
|
271
|
+
const renderableItems = createMemo(getItems);
|
|
242
272
|
|
|
243
273
|
const setIndicator = (indicator: TocIndicator): void => {
|
|
244
274
|
if (
|
|
@@ -307,7 +337,7 @@ export function createToc(props: TocProps = {}): TocInstance {
|
|
|
307
337
|
const linkRect = link.getBoundingClientRect();
|
|
308
338
|
const linkHeight = link.offsetHeight || linkRect.height;
|
|
309
339
|
const linkTop = link.offsetTop;
|
|
310
|
-
const height = (linkHeight * settings.
|
|
340
|
+
const height = (linkHeight * settings.indicator.heightRatio) / 10;
|
|
311
341
|
const top = linkTop + (linkHeight - height) / 2;
|
|
312
342
|
const distance = state.indicator.visible
|
|
313
343
|
? Math.abs(top - state.indicator.top)
|
|
@@ -333,15 +363,16 @@ export function createToc(props: TocProps = {}): TocInstance {
|
|
|
333
363
|
};
|
|
334
364
|
|
|
335
365
|
const syncListLayout = (): void => {
|
|
336
|
-
|
|
366
|
+
const items = getItems();
|
|
367
|
+
if (!toc.runtime.built || !listElement || items.length === 0) {
|
|
337
368
|
listHeight = 0;
|
|
338
369
|
setIndicator(hiddenIndicator());
|
|
339
370
|
return;
|
|
340
371
|
}
|
|
341
|
-
pruneLinkRefs(
|
|
372
|
+
pruneLinkRefs(items);
|
|
342
373
|
const listRect = listElement.getBoundingClientRect();
|
|
343
374
|
listHeight = listElement.offsetHeight || listRect.height;
|
|
344
|
-
const current =
|
|
375
|
+
const current = items[state.current.index] || null;
|
|
345
376
|
updateIndicatorForItem(current);
|
|
346
377
|
};
|
|
347
378
|
|
|
@@ -400,13 +431,14 @@ export function createToc(props: TocProps = {}): TocInstance {
|
|
|
400
431
|
};
|
|
401
432
|
|
|
402
433
|
const setActive = (index: number): number => {
|
|
434
|
+
const items = getItems();
|
|
403
435
|
if (index === state.current.index) {
|
|
404
|
-
const current =
|
|
436
|
+
const current = items[index] || null;
|
|
405
437
|
const duration = updateIndicatorForItem(current);
|
|
406
438
|
if (duration < 0) scheduleListLayoutSync();
|
|
407
439
|
return duration;
|
|
408
440
|
}
|
|
409
|
-
const current =
|
|
441
|
+
const current = items[index] || null;
|
|
410
442
|
flushSync(() => {
|
|
411
443
|
state.current = { index, item: current };
|
|
412
444
|
});
|
|
@@ -487,13 +519,14 @@ export function createToc(props: TocProps = {}): TocInstance {
|
|
|
487
519
|
};
|
|
488
520
|
|
|
489
521
|
const activate = (index: number): TocInstance => {
|
|
522
|
+
const items = getItems();
|
|
490
523
|
if (
|
|
491
524
|
toc.runtime.built &&
|
|
492
525
|
Number.isInteger(index) &&
|
|
493
526
|
index >= 0 &&
|
|
494
|
-
index <
|
|
527
|
+
index < items.length
|
|
495
528
|
) {
|
|
496
|
-
scrollToItem(
|
|
529
|
+
scrollToItem(items[index], { activeIndex: index });
|
|
497
530
|
}
|
|
498
531
|
return toc;
|
|
499
532
|
};
|
|
@@ -505,80 +538,95 @@ export function createToc(props: TocProps = {}): TocInstance {
|
|
|
505
538
|
actions: { activate },
|
|
506
539
|
view: () => {
|
|
507
540
|
createEffect(() => {
|
|
508
|
-
const items =
|
|
541
|
+
const items = getItems();
|
|
509
542
|
void items.map((item) => item.id).join('\0');
|
|
510
543
|
untrack(() => {
|
|
511
544
|
pruneLinkRefs(items);
|
|
545
|
+
if (items.length === 0) {
|
|
546
|
+
listElement = null;
|
|
547
|
+
listHeight = 0;
|
|
548
|
+
linkRefs.clear();
|
|
549
|
+
syncActiveMarker(null);
|
|
550
|
+
setIndicator(hiddenIndicator());
|
|
551
|
+
}
|
|
512
552
|
scheduleListLayoutSync();
|
|
513
553
|
});
|
|
514
554
|
});
|
|
515
|
-
const
|
|
516
|
-
? jsx('div', {
|
|
517
|
-
className: settings.className.title,
|
|
518
|
-
'data-toc-title': '',
|
|
519
|
-
children: translate('toc'),
|
|
520
|
-
})
|
|
521
|
-
: null;
|
|
522
|
-
const listView = jsx('div', {
|
|
523
|
-
ref: (element: HTMLElement) => {
|
|
524
|
-
listElement = element;
|
|
525
|
-
scheduleListLayoutSync();
|
|
526
|
-
},
|
|
527
|
-
className: settings.className.list,
|
|
528
|
-
'data-toc-list': 'root',
|
|
529
|
-
children: [
|
|
530
|
-
For({
|
|
531
|
-
each: renderableItems,
|
|
532
|
-
key: (item: TocItem) => item.id,
|
|
533
|
-
children: (
|
|
534
|
-
itemAccessor: () => TocItem,
|
|
535
|
-
indexAccessor: () => number
|
|
536
|
-
) =>
|
|
537
|
-
jsx('a', {
|
|
538
|
-
ref: (element: HTMLElement) =>
|
|
539
|
-
bindLinkRef(itemAccessor(), element),
|
|
540
|
-
className: settings.className.link,
|
|
541
|
-
href: () => `#${itemAccessor().id}`,
|
|
542
|
-
'data-toc-link': () => String(indexAccessor()),
|
|
543
|
-
'data-toc-target': () => itemAccessor().id,
|
|
544
|
-
'data-toc-level': () => String(itemAccessor().level),
|
|
545
|
-
onClick: (event: Event) => {
|
|
546
|
-
event.preventDefault();
|
|
547
|
-
const item = itemAccessor();
|
|
548
|
-
scrollToItem(item, {
|
|
549
|
-
activeIndex: state.items.findIndex(
|
|
550
|
-
(current) => current.id === item.id
|
|
551
|
-
),
|
|
552
|
-
updateHash: true,
|
|
553
|
-
});
|
|
554
|
-
},
|
|
555
|
-
children: () => itemAccessor().text,
|
|
556
|
-
}),
|
|
557
|
-
}),
|
|
558
|
-
For({
|
|
559
|
-
each: () => (state.items.length > 0 ? [true] : []),
|
|
560
|
-
key: () => 'toc-indicator',
|
|
561
|
-
children: () =>
|
|
562
|
-
jsx('div', {
|
|
563
|
-
className: settings.className.indicator,
|
|
564
|
-
'data-toc-indicator': '',
|
|
565
|
-
hidden: () => !state.indicator.visible,
|
|
566
|
-
style: () => ({
|
|
567
|
-
top: `${state.indicator.top}px`,
|
|
568
|
-
width: settings.indicatorWidth,
|
|
569
|
-
height: `${state.indicator.height}px`,
|
|
570
|
-
transitionDuration: `${state.indicator.duration}ms`,
|
|
571
|
-
transitionTimingFunction: state.indicator.timingFunction,
|
|
572
|
-
}),
|
|
573
|
-
}),
|
|
574
|
-
}),
|
|
575
|
-
],
|
|
576
|
-
});
|
|
577
|
-
return jsx('nav', {
|
|
555
|
+
const root = jsx('nav', {
|
|
578
556
|
className: settings.className.toc,
|
|
579
557
|
'data-toc': 'root',
|
|
580
|
-
children: settings.title ? [titleElement, listView] : listView,
|
|
581
558
|
}) as HTMLElement;
|
|
559
|
+
insert(
|
|
560
|
+
root,
|
|
561
|
+
Show({
|
|
562
|
+
when: hasItems,
|
|
563
|
+
children: () => {
|
|
564
|
+
const titleElement = settings.title
|
|
565
|
+
? jsx('div', {
|
|
566
|
+
className: settings.className.title,
|
|
567
|
+
'data-toc-title': '',
|
|
568
|
+
children: translate('toc'),
|
|
569
|
+
})
|
|
570
|
+
: null;
|
|
571
|
+
const listView = jsx('div', {
|
|
572
|
+
ref: (element: HTMLElement) => {
|
|
573
|
+
listElement = element;
|
|
574
|
+
scheduleListLayoutSync();
|
|
575
|
+
},
|
|
576
|
+
className: settings.className.list,
|
|
577
|
+
'data-toc-list': 'root',
|
|
578
|
+
children: For({
|
|
579
|
+
each: renderableItems,
|
|
580
|
+
key: (item: TocItem) => item.id,
|
|
581
|
+
children: (itemAccessor: () => TocItem) =>
|
|
582
|
+
jsx('a', {
|
|
583
|
+
ref: (element: HTMLElement) =>
|
|
584
|
+
bindLinkRef(itemAccessor(), element),
|
|
585
|
+
className: settings.className.link,
|
|
586
|
+
href: () => `#${itemAccessor().id}`,
|
|
587
|
+
'data-toc-level': () => String(itemAccessor().level),
|
|
588
|
+
onClick: (event: Event) => {
|
|
589
|
+
event.preventDefault();
|
|
590
|
+
const item = itemAccessor();
|
|
591
|
+
scrollToItem(item, {
|
|
592
|
+
activeIndex: getItems().findIndex(
|
|
593
|
+
(current) => current.id === item.id
|
|
594
|
+
),
|
|
595
|
+
updateHash: true,
|
|
596
|
+
});
|
|
597
|
+
},
|
|
598
|
+
children: () => itemAccessor().text,
|
|
599
|
+
}),
|
|
600
|
+
}),
|
|
601
|
+
}) as HTMLElement;
|
|
602
|
+
insert(
|
|
603
|
+
listView,
|
|
604
|
+
Show({
|
|
605
|
+
when: hasItems,
|
|
606
|
+
children: () =>
|
|
607
|
+
jsx('div', {
|
|
608
|
+
className: settings.className.indicator,
|
|
609
|
+
'data-toc-indicator': '',
|
|
610
|
+
hidden: () => !state.indicator.visible,
|
|
611
|
+
style: () => ({
|
|
612
|
+
pointerEvents: 'none',
|
|
613
|
+
position: 'absolute',
|
|
614
|
+
left: settings.indicator.left,
|
|
615
|
+
top: `${state.indicator.top}px`,
|
|
616
|
+
width: settings.indicator.width,
|
|
617
|
+
height: `${state.indicator.height}px`,
|
|
618
|
+
transition: `top ${state.indicator.duration}ms ${state.indicator.timingFunction}`,
|
|
619
|
+
borderRadius: settings.indicator.radius,
|
|
620
|
+
backgroundColor: settings.indicator.color,
|
|
621
|
+
}),
|
|
622
|
+
}),
|
|
623
|
+
})
|
|
624
|
+
);
|
|
625
|
+
return settings.title ? [titleElement, listView] : listView;
|
|
626
|
+
},
|
|
627
|
+
})
|
|
628
|
+
);
|
|
629
|
+
return root;
|
|
582
630
|
},
|
|
583
631
|
onBuild(context) {
|
|
584
632
|
target = requireContainer(settings.target, 'Toc.target');
|
package/src/css/form.css
CHANGED
|
@@ -5,14 +5,9 @@
|
|
|
5
5
|
display: flex;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.j-form
|
|
8
|
+
.j-form {
|
|
9
9
|
flex-direction: column;
|
|
10
|
-
gap: var(--
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.j-form.is-horizontal {
|
|
14
|
-
flex-direction: row;
|
|
15
|
-
gap: var(--s2);
|
|
10
|
+
gap: var(--s3);
|
|
16
11
|
}
|
|
17
12
|
|
|
18
13
|
.j-form .form-field {
|
|
@@ -23,47 +18,24 @@
|
|
|
23
18
|
.j-form fieldset.form-field {
|
|
24
19
|
border: 0;
|
|
25
20
|
padding: 0;
|
|
26
|
-
min-inline-size: 0;
|
|
27
21
|
}
|
|
28
22
|
|
|
29
|
-
.j-form
|
|
23
|
+
.j-form .form-field {
|
|
30
24
|
flex-direction: column;
|
|
31
25
|
}
|
|
32
26
|
|
|
33
|
-
.j-form.is-item-horizontal .form-field {
|
|
34
|
-
flex-direction: row;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
27
|
.j-form .form-field .field-legend {
|
|
28
|
+
justify-content: space-between;
|
|
38
29
|
color: var(--ui-fg-muted);
|
|
39
30
|
font-size: var(--font-size-sm);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.j-form .form-field > legend.field-legend {
|
|
43
|
-
padding: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.j-form .form-field .field-legend,
|
|
47
|
-
.j-form .form-field .field-control {
|
|
48
31
|
gap: var(--space);
|
|
49
32
|
}
|
|
50
33
|
|
|
51
|
-
.j-form.is-horizontal .form-field .field-legend {
|
|
52
|
-
align-items: center;
|
|
53
|
-
height: var(--el-height-md);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
34
|
.j-form .field-legend.is-required::after {
|
|
57
35
|
content: '*';
|
|
58
36
|
color: var(--state-danger);
|
|
59
37
|
}
|
|
60
38
|
|
|
61
|
-
.j-form .form-field .field-control {
|
|
62
|
-
display: flex;
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
margin: 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
39
|
.j-form .form-field .field-control .help-block {
|
|
68
40
|
font-size: var(--font-size-sm);
|
|
69
41
|
color: var(--ui-fg-soft);
|
|
@@ -77,17 +49,13 @@
|
|
|
77
49
|
.j-form .form-buttons {
|
|
78
50
|
display: flex;
|
|
79
51
|
gap: var(--s2);
|
|
80
|
-
margin-top:
|
|
52
|
+
margin-top: var(--s2);
|
|
81
53
|
}
|
|
82
54
|
|
|
83
55
|
.j-form [data-field-buttons] button {
|
|
84
56
|
position: relative;
|
|
85
57
|
}
|
|
86
58
|
|
|
87
|
-
.j-form.is-horizontal .form-buttons {
|
|
88
|
-
margin: 0;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
59
|
/* input */
|
|
92
60
|
.j-input {
|
|
93
61
|
font-size: var(--input-font-size);
|
|
@@ -96,7 +64,6 @@
|
|
|
96
64
|
}
|
|
97
65
|
|
|
98
66
|
.j-input:not([type='checkbox']) {
|
|
99
|
-
/* display: block; */
|
|
100
67
|
border-width: 1px;
|
|
101
68
|
border-style: solid;
|
|
102
69
|
border-color: var(--ui-border);
|
|
@@ -520,9 +487,9 @@
|
|
|
520
487
|
cursor: not-allowed;
|
|
521
488
|
}
|
|
522
489
|
|
|
523
|
-
.j-form
|
|
524
|
-
.j-form
|
|
525
|
-
.j-form
|
|
490
|
+
.j-form input.j-input:not([type='checkbox']):not([type='radio']),
|
|
491
|
+
.j-form select.j-select,
|
|
492
|
+
.j-form textarea.j-textarea {
|
|
526
493
|
width: 100%;
|
|
527
494
|
}
|
|
528
495
|
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
@layer themes {
|
|
2
|
-
.j-form.is-lg {
|
|
3
|
-
--form-gap-vertical: var(--s3);
|
|
4
|
-
--form-gap-horizontal: var(--s3);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
2
|
.j-input {
|
|
8
3
|
--input-font-size: var(--font-size-md);
|
|
9
4
|
--input-bg: inherit;
|
|
@@ -87,7 +82,6 @@
|
|
|
87
82
|
--btn-fg: var(--ui-fg-muted);
|
|
88
83
|
--btn-bg: var(--ui-bg-muted);
|
|
89
84
|
--btn-padding: 0 var(--s2);
|
|
90
|
-
/* --btn-box-shadow: none; */
|
|
91
85
|
}
|
|
92
86
|
|
|
93
87
|
.input-group .el-addon .is-text {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
@layer themes {
|
|
2
2
|
.j-tip {
|
|
3
3
|
--tip-border-color: var(--ui-border);
|
|
4
|
-
--tip-fg: var(--ui-fg);
|
|
5
4
|
--tip-bg: var(--ui-bg);
|
|
6
5
|
|
|
7
6
|
row-gap: var(--s2);
|
|
@@ -12,17 +11,21 @@
|
|
|
12
11
|
border-radius: var(--radius-md);
|
|
13
12
|
padding: var(--s3) var(--s4);
|
|
14
13
|
font-size: var(--font-size-md);
|
|
15
|
-
color: var(--tip-fg);
|
|
16
14
|
background: var(--tip-bg);
|
|
17
|
-
box-shadow: var(--shadow-
|
|
15
|
+
box-shadow: var(--shadow-xs);
|
|
16
|
+
backdrop-filter: blur(2px);
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
.j-tip .tip-icon {
|
|
21
|
-
color: var(--tip-fg);
|
|
22
20
|
transform: translateY(calc(var(--space, 0.25rem) * 0.5));
|
|
23
21
|
margin: 0;
|
|
24
22
|
}
|
|
25
23
|
|
|
24
|
+
.j-tip .tip-icon,
|
|
25
|
+
.j-tip .tip-title {
|
|
26
|
+
color: var(--tip-fg);
|
|
27
|
+
}
|
|
28
|
+
|
|
26
29
|
.j-tip .tip-icon,
|
|
27
30
|
.j-tip .tip-icon svg {
|
|
28
31
|
width: var(--font-size-xl);
|
|
@@ -30,29 +33,30 @@
|
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
.j-tip .tip-title {
|
|
33
|
-
/* line-height: var(--line-height-paragraph); */
|
|
34
36
|
font-weight: var(--font-medium);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
.j-tip.is-primary {
|
|
40
|
+
--tip-border-color: var(--state-info-border);
|
|
41
|
+
--tip-bg: var(--state-info-soft);
|
|
42
|
+
--tip-fg: var(--state-info-text);
|
|
43
|
+
}
|
|
40
44
|
|
|
41
45
|
.j-tip.is-success {
|
|
42
|
-
--tip-border-color: var(--state-success);
|
|
43
|
-
--tip-bg: var(--state-success-
|
|
44
|
-
--tip-fg: var(--state-success);
|
|
46
|
+
--tip-border-color: var(--state-success-border);
|
|
47
|
+
--tip-bg: var(--state-success-soft);
|
|
48
|
+
--tip-fg: var(--state-success-text);
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
.j-tip.is-warning {
|
|
48
|
-
--tip-border-color: var(--state-warning);
|
|
49
|
-
--tip-bg: var(--state-warning-
|
|
50
|
-
--tip-fg: var(--state-warning);
|
|
52
|
+
--tip-border-color: var(--state-warning-border);
|
|
53
|
+
--tip-bg: var(--state-warning-soft);
|
|
54
|
+
--tip-fg: var(--state-warning-text);
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
.j-tip.is-danger {
|
|
54
|
-
--tip-border-color: var(--state-danger);
|
|
55
|
-
--tip-bg: var(--state-danger-
|
|
56
|
-
--tip-fg: var(--state-danger);
|
|
58
|
+
--tip-border-color: var(--state-danger-border);
|
|
59
|
+
--tip-bg: var(--state-danger-soft);
|
|
60
|
+
--tip-fg: var(--state-danger-text);
|
|
57
61
|
}
|
|
58
62
|
}
|