@monospaced/set-core 0.9.0 → 0.10.1
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/components/image/image.d.ts +4 -1
- package/dist/components/image/image.d.ts.map +1 -1
- package/dist/components/poster/poster.d.ts +41 -10
- package/dist/components/poster/poster.d.ts.map +1 -1
- package/dist/core.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +737 -711
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -3,6 +3,7 @@ import type { SetComponentSpec } from "../../spec";
|
|
|
3
3
|
export type SetImageAspectRatio = "1:1" | "4:5" | "3:2" | "16:9" | "21:9";
|
|
4
4
|
export type SetImageFit = "intrinsic" | "fluid" | "cover";
|
|
5
5
|
export type SetImageGravity = "N" | "NE" | "E" | "SE" | "S" | "SW" | "W" | "NW" | "C";
|
|
6
|
+
export type SetImageScheme = "light" | "dark";
|
|
6
7
|
export interface SetImageSource {
|
|
7
8
|
/**
|
|
8
9
|
* The intrinsic height of the source, in pixels.
|
|
@@ -32,6 +33,8 @@ export interface SetImageSource {
|
|
|
32
33
|
width?: number;
|
|
33
34
|
}
|
|
34
35
|
export interface SetImageProps {
|
|
36
|
+
/** Show the light or dark variant to match the surrounding scheme. @default false */
|
|
37
|
+
adaptive?: boolean;
|
|
35
38
|
/** Alternative text. Empty string is valid and used by default. @default "" */
|
|
36
39
|
alt?: string;
|
|
37
40
|
/** Aspect ratio applied to the wrapper. */
|
|
@@ -69,7 +72,7 @@ export interface SetImageProps {
|
|
|
69
72
|
* @param props - Image component props.
|
|
70
73
|
* @returns IR node for image/picture markup.
|
|
71
74
|
*/
|
|
72
|
-
export declare function buildSetImage({ alt, aspectRatio, fit, gravity, height, id, lazy, priority, radius, shadow, sizes, sources, src, srcSet, width, }: SetImageProps): SetNode;
|
|
75
|
+
export declare function buildSetImage({ adaptive, alt, aspectRatio, fit, gravity, height, id, lazy, priority, radius, shadow, sizes, sources, src, srcSet, width, }: SetImageProps): SetNode;
|
|
73
76
|
/**
|
|
74
77
|
* SSR renderer for the Set image component.
|
|
75
78
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/components/image/image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC1E,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;AAC1D,MAAM,MAAM,eAAe,GACvB,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,GAAG,CAAC;AACR,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,wCAAwC;IACxC,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wBAAwB;IACxB,MAAM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AM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,GAAQ,EACR,WAAW,EACX,GAAiB,EACjB,OAAa,EACb,MAAM,EACN,EAAE,EACF,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,KAAK,EACL,OAAO,EACP,GAAG,EACH,MAAM,EACN,KAAK,GACN,EAAE,aAAa,GAAG,OAAO,CAsIzB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAE3D;AAED,yEAAyE;AACzE,eAAO,MAAM,cAAc,EAAE,gBA0M5B,CAAC"}
|
|
@@ -4,16 +4,28 @@ import { type SetImageGravity } from "../image/image";
|
|
|
4
4
|
import type { SetTheme } from "../root/root";
|
|
5
5
|
import type { SetSurfaceVariant } from "../surface/surface";
|
|
6
6
|
export type SetPosterSurface = Exclude<SetSurfaceVariant, "inverse" | "brand-inverse">;
|
|
7
|
-
declare const
|
|
7
|
+
declare const __posterMediaTag: unique symbol;
|
|
8
8
|
/**
|
|
9
|
-
* HTML string returned by `renderSetPosterImage`. The
|
|
9
|
+
* HTML string returned by `renderSetPosterImage`. The tagged type forces
|
|
10
10
|
* consumers through the helper, which locks the cover/priority defaults
|
|
11
11
|
* Poster's layout needs.
|
|
12
12
|
*/
|
|
13
13
|
export type SetPosterMedia = string & {
|
|
14
|
-
readonly [
|
|
14
|
+
readonly [__posterMediaTag]: true;
|
|
15
|
+
};
|
|
16
|
+
declare const __posterAdaptiveMediaTag: unique symbol;
|
|
17
|
+
/**
|
|
18
|
+
* HTML string returned by `renderSetPosterImage` for adaptive media. The
|
|
19
|
+
* separate tag lets Poster reject `contentTheme` at the type level:
|
|
20
|
+
* adaptive media follows the ambient scheme, so a lock would strand the
|
|
21
|
+
* other variant.
|
|
22
|
+
*/
|
|
23
|
+
export type SetPosterAdaptiveMedia = string & {
|
|
24
|
+
readonly [__posterAdaptiveMediaTag]: true;
|
|
15
25
|
};
|
|
16
26
|
export interface SetPosterImageProps {
|
|
27
|
+
/** Show the light or dark variant to match the surrounding scheme. @default false */
|
|
28
|
+
adaptive?: boolean;
|
|
17
29
|
/** Focal gravity for the cover crop. @default "C" */
|
|
18
30
|
gravity?: SetImageGravity;
|
|
19
31
|
/** HTML `sizes` attribute. */
|
|
@@ -31,26 +43,45 @@ export interface SetPosterImageProps {
|
|
|
31
43
|
* @param props - Poster image props.
|
|
32
44
|
* @returns HTML string suitable for Poster's `media` prop.
|
|
33
45
|
*/
|
|
34
|
-
export declare function renderSetPosterImage(props: SetPosterImageProps
|
|
35
|
-
|
|
46
|
+
export declare function renderSetPosterImage(props: SetPosterImageProps & {
|
|
47
|
+
adaptive: true;
|
|
48
|
+
}): SetPosterAdaptiveMedia;
|
|
49
|
+
export declare function renderSetPosterImage(props: SetPosterImageProps & {
|
|
50
|
+
adaptive?: false;
|
|
51
|
+
}): SetPosterMedia;
|
|
52
|
+
interface SetPosterBaseProps {
|
|
36
53
|
/** Foreground HTML content above the media. Caller sanitizes untrusted content. */
|
|
37
54
|
children?: string;
|
|
38
|
-
/** Absolute theme lock for foreground content over non-themeable media. */
|
|
39
|
-
contentTheme?: SetTheme;
|
|
40
55
|
/** DOM id. */
|
|
41
56
|
id?: string;
|
|
42
|
-
/** Background media; build with `renderSetPosterImage`. */
|
|
43
|
-
media: SetPosterMedia;
|
|
44
57
|
/** Surface context. Emits `data-set-surface` when provided. */
|
|
45
58
|
surface?: SetPosterSurface;
|
|
46
59
|
}
|
|
60
|
+
export type SetPosterProps = SetPosterBaseProps & ({
|
|
61
|
+
/** Absolute theme lock for foreground content over non-themeable media. */
|
|
62
|
+
contentTheme?: SetTheme;
|
|
63
|
+
/** Background media; build with `renderSetPosterImage`. */
|
|
64
|
+
media: SetPosterMedia;
|
|
65
|
+
} | {
|
|
66
|
+
/** Adaptive media follows the ambient scheme; a lock is incoherent. */
|
|
67
|
+
contentTheme?: never;
|
|
68
|
+
/** Adaptive background media; build with `renderSetPosterImage`. */
|
|
69
|
+
media: SetPosterAdaptiveMedia;
|
|
70
|
+
});
|
|
47
71
|
/**
|
|
48
72
|
* Builds the IR tree for the Set poster component.
|
|
49
73
|
*
|
|
74
|
+
* Accepts the props union loosely: adapters route media through slots,
|
|
75
|
+
* so the adaptive/contentTheme exclusion is enforced by `SetPosterProps`
|
|
76
|
+
* at authoring surfaces rather than here.
|
|
77
|
+
*
|
|
50
78
|
* @param props - Poster component props.
|
|
51
79
|
* @returns IR node for a poster container.
|
|
52
80
|
*/
|
|
53
|
-
export declare function buildSetPoster({ children, contentTheme, id, media, surface, }:
|
|
81
|
+
export declare function buildSetPoster({ children, contentTheme, id, media, surface, }: SetPosterBaseProps & {
|
|
82
|
+
contentTheme?: SetTheme;
|
|
83
|
+
media: SetPosterMedia | SetPosterAdaptiveMedia;
|
|
84
|
+
}): SetNode;
|
|
54
85
|
/**
|
|
55
86
|
* SSR renderer for the Set poster component.
|
|
56
87
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poster.d.ts","sourceRoot":"","sources":["../../../src/components/poster/poster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,MAAM,gBAAgB,GAAG,OAAO,CACpC,iBAAiB,EACjB,SAAS,GAAG,eAAe,CAC5B,CAAC;AAEF,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"poster.d.ts","sourceRoot":"","sources":["../../../src/components/poster/poster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,OAAO,EA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