contain-css-svelte 1.1.19 → 1.1.20
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/Card.svelte +7 -2
- package/dist/layout/Bar.svelte +16 -10
- package/package.json +1 -1
package/dist/Card.svelte
CHANGED
|
@@ -61,8 +61,13 @@ let hasFooter = $derived(Boolean(footer));
|
|
|
61
61
|
visually changes for existing callers -- but now a caller who wants
|
|
62
62
|
a header Card flush against the content below it, say, can set just
|
|
63
63
|
one axis instead of fighting a 4-value margin shorthand. */
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
/* The innermost fallback is the pre-marginBlock/marginInline escape
|
|
65
|
+
hatch (a single --card-margin applied to both axes) rather than a bare
|
|
66
|
+
16px, so anyone already setting --card-margin directly keeps working
|
|
67
|
+
unchanged -- margin-block/margin-inline just give a newer, more
|
|
68
|
+
specific override on top of it. */
|
|
69
|
+
margin-block: var(--card-margin-block, var(--margin-block, var(--card-margin, 16px)));
|
|
70
|
+
margin-inline: var(--card-margin-inline, var(--margin-inline, var(--card-margin, 16px)));
|
|
66
71
|
border-radius: var(--card-border-radius, var(--surface-border-radius, var(--border-radius, 0)));
|
|
67
72
|
border: var(--card-border, var(--surface-border, var(--border, var(--border-width) var(--border-style) var(--border-color))));
|
|
68
73
|
--link-bg: var(--card-link-bg, var(--surface-link-bg, inherit));
|
package/dist/layout/Bar.svelte
CHANGED
|
@@ -4,20 +4,19 @@ let warnedDeprecatedMargin = false;
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts">import { BROWSER, DEV } from "esm-env";
|
|
6
6
|
import { injectVars } from "../util";
|
|
7
|
-
const { children, primary, secondary, marginTop, marginBottom,
|
|
7
|
+
const { children, primary, secondary, marginTop, marginBottom, ...restProps } = $props();
|
|
8
8
|
$effect(() => {
|
|
9
9
|
if (BROWSER && DEV && (marginTop != null || marginBottom != null) && !warnedDeprecatedMargin) {
|
|
10
10
|
warnedDeprecatedMargin = true;
|
|
11
11
|
console.warn('[ContainCSS] Bar\'s marginTop/marginBottom props are deprecated. Use marginBlock instead -- e.g. marginBlock="0 1em" is the same as marginTop="0" marginBottom="1em" (the old default).');
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
/*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
: null));
|
|
14
|
+
/* marginTop/marginBottom become their own CSS vars here (not composed into
|
|
15
|
+
one string in JS) so the CSS fallback chain below can pick them up
|
|
16
|
+
however they arrive -- as these props, OR as someone setting
|
|
17
|
+
--bar-margin-top/--bar-margin-bottom directly as raw CSS custom
|
|
18
|
+
properties, which JS never sees at all. Composing in JS would only ever
|
|
19
|
+
have covered the prop path. */
|
|
21
20
|
const cssKeys = [
|
|
22
21
|
"bg",
|
|
23
22
|
"fg",
|
|
@@ -28,8 +27,10 @@ const cssKeys = [
|
|
|
28
27
|
"align",
|
|
29
28
|
"marginBlock",
|
|
30
29
|
"marginInline",
|
|
30
|
+
"marginTop",
|
|
31
|
+
"marginBottom",
|
|
31
32
|
];
|
|
32
|
-
const style = $derived(injectVars({ ...restProps,
|
|
33
|
+
const style = $derived(injectVars({ ...restProps, marginTop, marginBottom }, "bar", cssKeys));
|
|
33
34
|
const extraStyle = $derived(primary
|
|
34
35
|
? "--bar-bg: var(--primary-bg); --bar-fg: var(--primary-fg);"
|
|
35
36
|
: secondary
|
|
@@ -65,7 +66,12 @@ const extraStyle = $derived(primary
|
|
|
65
66
|
padding: var(--bar-padding, var(--padding, 8px));
|
|
66
67
|
border-bottom: var(--bar-border-bottom, var(--bar-border-width, var(--border-width, 1px)) var(--bar-border-style, var(--border-style, 1px)) var(--bar-border-color, var(--border-color, 1px)));
|
|
67
68
|
border-top: var(--bar-border-top, var(--bar-border-width, var(--border-width, 1px)) var(--bar-border-style, var(--border-style, 1px)) var(--bar-border-color, var(--border-color, 1px)));
|
|
68
|
-
|
|
69
|
+
/* --bar-margin-block wins outright if set (by the marginBlock prop, or by
|
|
70
|
+
anyone setting that CSS var directly). Otherwise composed from
|
|
71
|
+
--bar-margin-top/--bar-margin-bottom -- the deprecated props, or,
|
|
72
|
+
again, someone's raw CSS var -- each independently defaulting to the
|
|
73
|
+
old built-in look (flush on top, 1em clear below). */
|
|
74
|
+
margin-block: var(--bar-margin-block, var(--bar-margin-top, 0) var(--bar-margin-bottom, 1em));
|
|
69
75
|
margin-inline: var(--bar-margin-inline, 0);
|
|
70
76
|
min-height: var(--bar-min-height, var(--bar-height, 3em));
|
|
71
77
|
height: var(--bar-height, auto);
|