@mintplayer/web-components 1.2.0 → 1.3.0

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.
@@ -7,13 +7,6 @@ export declare function isCardColorName(value: string | null | undefined): value
7
7
  * applying the new one.
8
8
  */
9
9
  export declare function clearPrefixedClasses(el: HTMLElement, prefix: string): void;
10
- /**
11
- * Apply the card root's colour contract to an element: `text-bg-<name>` for
12
- * the filled variant, or `border border-<name> bg-transparent` for outline.
13
- * Used by both `mp-card` and the Angular `bs-card` wrapper so both layers
14
- * stay byte-identical without each duplicating the bootstrap-utility logic.
15
- */
16
- export declare function applyCardColorClasses(el: HTMLElement, color: string | null, outline: boolean): void;
17
10
  /**
18
11
  * Apply the `text-bg-<name>` background to `el`, clearing any prior value.
19
12
  * Used by the header / footer Bootstrap-classed regions, which don't have an
@@ -0,0 +1,2 @@
1
+ export declare const cardGlobalStyles: import('lit').CSSResult;
2
+ export default cardGlobalStyles;
@@ -1,13 +1,4 @@
1
1
  export * from './mp-card.element';
2
- export * from './mp-card-body.element';
3
- export * from './mp-card-footer.element';
4
- export * from './mp-card-group.element';
5
- export * from './mp-card-header.element';
6
- export * from './mp-card-img.element';
7
- export * from './mp-card-link.element';
8
- export * from './mp-card-subtitle.element';
9
- export * from './mp-card-text.element';
10
- export * from './mp-card-title.element';
11
2
  export * from './card-classes';
12
3
  export * from './types/card-image-position';
13
4
  export * from './types/card-header-nav-style';
@@ -1,29 +1,56 @@
1
+ import { LitElement, TemplateResult } from 'lit';
1
2
  /**
2
- * Root of the Bootstrap card family.
3
+ * `<mp-card>` — the single web component of the card family.
3
4
  *
4
- * Light-DOM rendering: this element does NOT use shadow DOM. Bootstrap's
5
- * `_card.scss` relies on parent-child selectors (`.card > .card-header`,
6
- * `.card > .list-group + .card-footer`) which cannot pierce shadow roots, so
7
- * the entire `mp-card*` family stays in light DOM. The compiled card slice
8
- * is injected into `document.head` exactly once on the first connection of
9
- * any `<mp-card>` instance.
5
+ * Renders a shadow DOM with one default `<slot>`; the card "chrome" (border,
6
+ * radius, background, colour contract) lives on `:host`, so it renders
7
+ * correctly wherever the element is placed — including deeply slotted inside
8
+ * another web component (e.g. `<mp-timeline>`), where Bootstrap's inherited
9
+ * `--bs-*` custom properties don't reach light-DOM content (the bug the old
10
+ * light-DOM card hit). This deliberately revisits the issue_308 light-DOM
11
+ * decision: shadow + `<slot>` does NOT clobber slotted children the way a
12
+ * light-DOM `render()` did, so it avoids both that pitfall and the inheritance
13
+ * gap.
14
+ *
15
+ * Card sub-parts (header / body / footer / title / text / img / …) are plain
16
+ * class-carrying elements projected into the slot (by consumers or the
17
+ * framework `BsCard*` wrappers). `mp-card`'s shadow styles the direct regions
18
+ * via `::slotted(.card-header/.card-body/…)`; deeper typography (`.card-title`
19
+ * inside a body, which `::slotted` can't reach) comes from a small global
20
+ * sheet injected once via `ensureCardStylesInjected()`.
10
21
  *
11
22
  * Attributes:
12
- * - `color` — one of the Bootstrap colour names; maps to `text-bg-<name>`.
13
- * - `outline` — boolean (presence = true); flips to `border border-<name>`
14
- * plus a transparent background, instead of the filled variant.
23
+ * - `color` — a Bootstrap colour name; selects the filled `:host([color])`.
24
+ * - `outline` — boolean (presence = true); border-only variant.
15
25
  */
16
- export declare class MpCardElement extends HTMLElement {
17
- static get observedAttributes(): string[];
26
+ export declare class MpCardElement extends LitElement {
27
+ static styles: import('lit').CSSResult[];
28
+ static get properties(): {
29
+ color: {
30
+ type: StringConstructor;
31
+ reflect: boolean;
32
+ };
33
+ outline: {
34
+ type: BooleanConstructor;
35
+ reflect: boolean;
36
+ };
37
+ isServerSide: {
38
+ type: BooleanConstructor;
39
+ attribute: string;
40
+ };
41
+ };
42
+ color: string | null;
43
+ outline: boolean;
44
+ isServerSide: boolean;
18
45
  connectedCallback(): void;
19
- attributeChangedCallback(name: string, _old: string | null, _next: string | null): void;
20
- private applyColor;
46
+ render(): TemplateResult;
21
47
  }
22
48
  /**
23
- * Inject the compiled Bootstrap-card SCSS into `document.head` exactly once
24
- * per page. Called from `MpCardElement.connectedCallback()` and also exported
25
- * for the Angular wrapper (`BsCardComponent`) which doesn't instantiate
26
- * `<mp-card>` itself but needs the same global cascade.
49
+ * Inject the global card typography sheet (`.card-title`, `.card-text`,
50
+ * `.card-link`, the `text-bg-*` utilities, …) into `document.head` exactly
51
+ * once. These rules target content nested inside a card-body, which
52
+ * `mp-card`'s shadow `::slotted()` rules cannot reach. Exported for the
53
+ * framework wrappers, which render the same class-carrying elements.
27
54
  */
28
55
  export declare function ensureCardStylesInjected(): void;
29
56
  declare global {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintplayer/web-components",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Framework-agnostic Lit web components for the @mintplayer/bootstrap design system. Consumed by @mintplayer/ng-bootstrap, @mintplayer/react-bootstrap, and @mintplayer/vue-bootstrap.",
5
5
  "license": "MIT",
6
6
  "repository": {