vanilla-jui 1.5.5 → 1.5.7
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 +0 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/src/components/accordion.ts +5 -4
- package/src/components/flow.ts +108 -93
- package/src/components/form.ts +40 -15
- package/src/components/modal.ts +7 -2
- package/src/components/offcanvas.ts +8 -6
- package/src/components/swiper.ts +45 -39
- package/src/components/tabs.ts +3 -3
- package/src/css/content.css +8 -8
- package/src/primitives/drop.ts +2 -1
- package/src/primitives/popup.ts +4 -4
- package/src/utilities/dom.ts +7 -0
package/src/css/content.css
CHANGED
|
@@ -296,6 +296,10 @@
|
|
|
296
296
|
/* ============================================
|
|
297
297
|
Code - 代码
|
|
298
298
|
============================================ */
|
|
299
|
+
code {
|
|
300
|
+
box-decoration-break: clone;
|
|
301
|
+
}
|
|
302
|
+
|
|
299
303
|
.j-content code:not([class*='language-']) {
|
|
300
304
|
font-family:
|
|
301
305
|
'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
|
|
@@ -331,24 +335,21 @@
|
|
|
331
335
|
background: none;
|
|
332
336
|
color: inherit;
|
|
333
337
|
font-size: inherit;
|
|
334
|
-
white-space: pre;
|
|
335
338
|
}
|
|
336
339
|
|
|
337
340
|
.j-content pre.j-code-editor {
|
|
338
341
|
position: relative;
|
|
339
342
|
margin-block: 1rem;
|
|
340
|
-
overflow: auto;
|
|
341
343
|
border-radius: var(--radius-md);
|
|
342
344
|
border: 1px solid var(--content-border);
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
345
|
+
overflow: auto;
|
|
346
|
+
scrollbar-width: thin;
|
|
347
|
+
scrollbar-color: var(--ui-border) transparent;
|
|
346
348
|
color: var(--ui-fg);
|
|
347
349
|
background: var(--content-bg-subtle);
|
|
348
|
-
white-space: break-spaces;
|
|
349
350
|
}
|
|
350
351
|
|
|
351
|
-
|
|
352
|
+
.j-radius-round .j-content pre.j-code-editor {
|
|
352
353
|
border-radius: 1.25rem;
|
|
353
354
|
}
|
|
354
355
|
|
|
@@ -389,7 +390,6 @@
|
|
|
389
390
|
|
|
390
391
|
.j-content pre code[class*='language-'] {
|
|
391
392
|
display: block;
|
|
392
|
-
overflow-x: auto;
|
|
393
393
|
padding: 1.25em 1.5em;
|
|
394
394
|
}
|
|
395
395
|
|
package/src/primitives/drop.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRoot, createSignal, insert, jsx } from 'vanilla-signal';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
asRenderable,
|
|
4
5
|
type DOMReference,
|
|
5
6
|
type RenderableContent,
|
|
6
7
|
resolveElement,
|
|
@@ -245,7 +246,7 @@ export function createDrop(
|
|
|
245
246
|
'aria-live': () =>
|
|
246
247
|
typeof props.content === 'function' ? 'polite' : null,
|
|
247
248
|
'aria-busy': () => String(loading()),
|
|
248
|
-
children: renderContent,
|
|
249
|
+
children: () => asRenderable(renderContent()),
|
|
249
250
|
});
|
|
250
251
|
return {
|
|
251
252
|
root: jsx('div', {
|
package/src/primitives/popup.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx } from 'vanilla-signal';
|
|
1
|
+
import { type ElementProps, jsx } from 'vanilla-signal';
|
|
2
2
|
|
|
3
|
-
import { type RenderableContent } from '../utilities/dom.ts';
|
|
3
|
+
import { asRenderable, type RenderableContent } from '../utilities/dom.ts';
|
|
4
4
|
import { type ResolveSchema, resolveProps } from '../utilities/types.ts';
|
|
5
5
|
|
|
6
6
|
export interface PopupProps extends Record<string, unknown> {
|
|
@@ -45,10 +45,10 @@ function normalizeProps(input: PopupProps): ResolvedPopupProps {
|
|
|
45
45
|
export function createPopup(props: PopupProps = {}): HTMLElement {
|
|
46
46
|
const { className, position, component, labelledby, content } =
|
|
47
47
|
normalizeProps(props);
|
|
48
|
-
const attrs:
|
|
48
|
+
const attrs: ElementProps<HTMLDivElement> = {
|
|
49
49
|
className: `${className} is-${position}`,
|
|
50
50
|
role: 'dialog',
|
|
51
|
-
children: content,
|
|
51
|
+
children: asRenderable(content),
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
if (component) {
|
package/src/utilities/dom.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Renderable } from 'vanilla-signal';
|
|
1
2
|
import {
|
|
2
3
|
isDomElementValue,
|
|
3
4
|
isDomNodeValue,
|
|
@@ -32,6 +33,12 @@ export type RenderableContent<TContext = unknown> =
|
|
|
32
33
|
| readonly RenderableContent<TContext>[]
|
|
33
34
|
| ((context: TContext) => RenderableContent<TContext>);
|
|
34
35
|
|
|
36
|
+
export function asRenderable<TContext>(
|
|
37
|
+
value: RenderableContent<TContext>
|
|
38
|
+
): Renderable {
|
|
39
|
+
return value as Renderable;
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
export interface LazyRenderOptions {
|
|
36
43
|
threshold?: number | number[];
|
|
37
44
|
rootMargin?: string;
|