@mintplayer/web-components 1.1.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.
Files changed (39) hide show
  1. package/accordion/src/styles/accordion.styles.d.ts +2 -0
  2. package/card/index.mjs +246 -363
  3. package/card/src/card-classes.d.ts +0 -7
  4. package/card/src/card-global.styles.d.ts +2 -0
  5. package/card/src/index.d.ts +0 -9
  6. package/card/src/mp-card.element.d.ts +45 -18
  7. package/chunks/mp-datatable-Con0yQue.mjs +1125 -0
  8. package/datatable/index.mjs +1 -1
  9. package/datatable/src/components/mp-datatable.d.ts +105 -1
  10. package/datatable/src/index.d.ts +1 -1
  11. package/datatable/src/types/column-def.d.ts +12 -1
  12. package/datatable/src/types/index.d.ts +2 -1
  13. package/datatable/src/types/tree.d.ts +42 -0
  14. package/file-manager/index.mjs +1 -1
  15. package/package.json +1 -1
  16. package/timeline/index.mjs +716 -0
  17. package/timeline/src/components/index.d.ts +2 -0
  18. package/timeline/src/components/mp-timeline-item.d.ts +63 -0
  19. package/timeline/src/components/mp-timeline.d.ts +85 -0
  20. package/timeline/src/index.d.ts +5 -0
  21. package/timeline/src/styles/index.d.ts +2 -0
  22. package/timeline/src/styles/timeline-item.styles.d.ts +2 -0
  23. package/timeline/src/styles/timeline.styles.d.ts +2 -0
  24. package/timeline-core/index.mjs +23 -0
  25. package/timeline-core/src/index.d.ts +2 -0
  26. package/timeline-core/src/models/context.d.ts +39 -0
  27. package/timeline-core/src/models/index.d.ts +2 -0
  28. package/timeline-core/src/models/timeline-item.d.ts +44 -0
  29. package/timeline-core/src/resolve-sides.d.ts +12 -0
  30. package/card/src/mp-card-body.element.d.ts +0 -12
  31. package/card/src/mp-card-footer.element.d.ts +0 -14
  32. package/card/src/mp-card-group.element.d.ts +0 -9
  33. package/card/src/mp-card-header.element.d.ts +0 -24
  34. package/card/src/mp-card-img.element.d.ts +0 -28
  35. package/card/src/mp-card-link.element.d.ts +0 -24
  36. package/card/src/mp-card-subtitle.element.d.ts +0 -9
  37. package/card/src/mp-card-text.element.d.ts +0 -9
  38. package/card/src/mp-card-title.element.d.ts +0 -13
  39. package/chunks/mp-datatable-CpAu8JJD.mjs +0 -750
@@ -0,0 +1,63 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ /**
3
+ * `<mp-timeline-item>` — one row of a `<mp-timeline>`.
4
+ *
5
+ * Renders its **own** row (marker / content / opposite + a trailing connector)
6
+ * in its own shadow DOM, fed by named slots with attribute fallbacks. One
7
+ * shadow boundary between authored content and its rendered region, so
8
+ * render-props / scoped-slots / plain HTML all project cleanly (and SSR via
9
+ * DSD).
10
+ *
11
+ * Authoring (vanilla):
12
+ *
13
+ * <mp-timeline-item item-id="ship" title="Shipped" color="#198754">
14
+ * <i slot="marker" class="bi bi-check"></i>
15
+ * <small slot="opposite">2026-05-01</small>
16
+ * Released the first public build.
17
+ * </mp-timeline-item>
18
+ *
19
+ * Data fields are exposed as both attributes and properties. Layout state
20
+ * (`side`, `last`, `orientation`) is set as attributes by the parent
21
+ * `<mp-timeline>` and consumed by CSS.
22
+ */
23
+ export declare class MpTimelineItem extends LitElement {
24
+ static styles: import('lit').CSSResult[];
25
+ static get observedAttributes(): string[];
26
+ private _itemId;
27
+ private _title;
28
+ private _description;
29
+ private _time;
30
+ private _icon;
31
+ private _color;
32
+ private _itemClass;
33
+ private _disabled;
34
+ private _selected;
35
+ get itemId(): string | number | null;
36
+ set itemId(value: string | number | null);
37
+ get description(): string | null;
38
+ set description(value: string | null);
39
+ get time(): string | null;
40
+ set time(value: string | null);
41
+ get icon(): string | null;
42
+ set icon(value: string | null);
43
+ get color(): string | null;
44
+ set color(value: string | null);
45
+ get itemClass(): string | null;
46
+ set itemClass(value: string | null);
47
+ get disabled(): boolean;
48
+ set disabled(value: boolean);
49
+ get selected(): boolean;
50
+ set selected(value: boolean);
51
+ connectedCallback(): void;
52
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
53
+ /** Mirror the per-item accent colour onto a CSS custom property. */
54
+ protected updated(): void;
55
+ private reflectString;
56
+ private reflectBoolean;
57
+ render(): TemplateResult;
58
+ }
59
+ declare global {
60
+ interface HTMLElementTagNameMap {
61
+ 'mp-timeline-item': MpTimelineItem;
62
+ }
63
+ }
@@ -0,0 +1,85 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ import { TimelineAlign, TimelineItem, TimelineOrientation, TimelineSelectable } from '@mintplayer/web-components/timeline-core';
3
+ /**
4
+ * `<mp-timeline>` — a sequence of events along a connecting line, vertical or
5
+ * horizontal, with two authoring modes:
6
+ *
7
+ * - **Data-driven:** set the `items` property; rows render in the shadow tree.
8
+ * - **Declarative:** author `<mp-timeline-item>` children; they project
9
+ * through the default slot.
10
+ *
11
+ * Non-empty `items` wins over declarative children. The container owns
12
+ * orientation / align / reverse / selection; layout is CSS-driven so it stays
13
+ * correct without enumerating children on the server.
14
+ *
15
+ * Emits `item-click` always, and `selection-change` when `selectable !== none`.
16
+ */
17
+ export declare class MpTimeline extends LitElement {
18
+ static styles: import('lit').CSSResult[];
19
+ static get observedAttributes(): string[];
20
+ private _items;
21
+ private _selectedSet;
22
+ private _orientation;
23
+ private _align;
24
+ private _reverse;
25
+ private _selectable;
26
+ private _isServerSide;
27
+ /** True once a consumer assigns `selectedIds` — suppresses declarative seeding. */
28
+ private _selectionExplicit;
29
+ private _selectionSeeded;
30
+ /** Roving-tabindex active source index; -1 means "first focusable". */
31
+ private _activeIndex;
32
+ /** Anchor for shift-range selection. */
33
+ private _anchorIndex;
34
+ /** Declarative-mode observer for runtime child add/remove/attr changes. */
35
+ private _observer;
36
+ get items(): TimelineItem[];
37
+ set items(value: TimelineItem[] | null | undefined);
38
+ get selectedIds(): (string | number)[];
39
+ set selectedIds(value: (string | number)[] | null | undefined);
40
+ get orientation(): TimelineOrientation;
41
+ set orientation(value: TimelineOrientation);
42
+ get align(): TimelineAlign;
43
+ set align(value: TimelineAlign);
44
+ get reverse(): boolean;
45
+ set reverse(value: boolean);
46
+ get selectable(): TimelineSelectable;
47
+ set selectable(value: TimelineSelectable);
48
+ get isServerSide(): boolean;
49
+ set isServerSide(value: boolean);
50
+ connectedCallback(): void;
51
+ disconnectedCallback(): void;
52
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
53
+ protected updated(): void;
54
+ private reflectString;
55
+ private reflectBoolean;
56
+ private idForItem;
57
+ private idForElement;
58
+ private isSelected;
59
+ render(): TemplateResult;
60
+ private renderDataItems;
61
+ private onSlotChange;
62
+ private get declarativeItems();
63
+ private get itemElements();
64
+ private seedDeclarativeSelection;
65
+ private enhanceDeclarativeItems;
66
+ private onClick;
67
+ private onKeydown;
68
+ private itemFromEvent;
69
+ private modelFor;
70
+ private applySelection;
71
+ private idForId;
72
+ private emitSelectionChange;
73
+ private modelById;
74
+ private resolvedActiveIndex;
75
+ private setActiveIndex;
76
+ private moveFocus;
77
+ private moveFocusTo;
78
+ private firstFocusable;
79
+ private lastFocusable;
80
+ }
81
+ declare global {
82
+ interface HTMLElementTagNameMap {
83
+ 'mp-timeline': MpTimeline;
84
+ }
85
+ }
@@ -0,0 +1,5 @@
1
+ export { MpTimeline } from './components';
2
+ export { MpTimelineItem } from './components';
3
+ export { timelineStyles, timelineItemStyles } from './styles';
4
+ export type { TimelineItem, TimelineOrientation, TimelineAlign, TimelineSide, TimelineSelectable, TimelineItemContext, TimelineConnectorContext, ItemRenderer, ConnectorRenderer, TimelineItemClickDetail, TimelineSelectionChangeDetail, } from '@mintplayer/web-components/timeline-core';
5
+ export { resolveSides } from '@mintplayer/web-components/timeline-core';
@@ -0,0 +1,2 @@
1
+ export { timelineStyles } from './timeline.styles';
2
+ export { timelineItemStyles } from './timeline-item.styles';
@@ -0,0 +1,2 @@
1
+ export declare const timelineItemStyles: import('lit').CSSResult;
2
+ export default timelineItemStyles;
@@ -0,0 +1,2 @@
1
+ export declare const timelineStyles: import('lit').CSSResult;
2
+ export default timelineStyles;
@@ -0,0 +1,23 @@
1
+ function d(e, r, n) {
2
+ return Array.from({ length: Math.max(0, e) }, (u, t) => {
3
+ const a = n ? e - 1 - t : t;
4
+ return s(r, a);
5
+ });
6
+ }
7
+ function s(e, r) {
8
+ switch (e) {
9
+ case "start":
10
+ return "start";
11
+ case "end":
12
+ return "end";
13
+ case "alternate":
14
+ return r % 2 === 0 ? "start" : "end";
15
+ case "alternate-reverse":
16
+ return r % 2 === 0 ? "end" : "start";
17
+ default:
18
+ return "start";
19
+ }
20
+ }
21
+ export {
22
+ d as resolveSides
23
+ };
@@ -0,0 +1,2 @@
1
+ export * from './models';
2
+ export { resolveSides } from './resolve-sides';
@@ -0,0 +1,39 @@
1
+ import { TimelineItem, TimelineOrientation, TimelineSide } from './timeline-item';
2
+ /** Context passed to per-item renderers / template outlets. */
3
+ export interface TimelineItemContext {
4
+ /** Source index (position in the `items` array / document order). */
5
+ index: number;
6
+ /** Render order after `reverse` is applied. */
7
+ visualIndex: number;
8
+ /** First in render order. */
9
+ isFirst: boolean;
10
+ /** Last in render order — draws no trailing connector. */
11
+ isLast: boolean;
12
+ orientation: TimelineOrientation;
13
+ /** Resolved side; may be provisional when `dir` is inherited at runtime. */
14
+ side: TimelineSide;
15
+ }
16
+ /** Context passed to a connector renderer (the segment trailing item[index]). */
17
+ export interface TimelineConnectorContext {
18
+ /** The connector trails item[index] toward item[index + 1]. */
19
+ index: number;
20
+ fromItem: TimelineItem;
21
+ toItem: TimelineItem;
22
+ orientation: TimelineOrientation;
23
+ }
24
+ /** A renderer that returns light-DOM node(s) for one item region. */
25
+ export type ItemRenderer = (item: TimelineItem, ctx: TimelineItemContext) => Node | Node[];
26
+ /** A renderer that returns light-DOM node(s) for a connector segment. */
27
+ export type ConnectorRenderer = (ctx: TimelineConnectorContext) => Node | Node[];
28
+ /** `detail` of the `item-click` CustomEvent. */
29
+ export interface TimelineItemClickDetail {
30
+ item: TimelineItem;
31
+ index: number;
32
+ originalEvent: Event;
33
+ }
34
+ /** `detail` of the `selection-change` CustomEvent. */
35
+ export interface TimelineSelectionChangeDetail {
36
+ selected: TimelineItem[];
37
+ added: TimelineItem[];
38
+ removed: TimelineItem[];
39
+ }
@@ -0,0 +1,2 @@
1
+ export * from './timeline-item';
2
+ export * from './context';
@@ -0,0 +1,44 @@
1
+ /** Axis of the timeline line. */
2
+ export type TimelineOrientation = 'vertical' | 'horizontal';
3
+ /**
4
+ * Which side of the line an item's content sits on.
5
+ * - `start` — left (vertical) / top (horizontal)
6
+ * - `end` — the opposite physical side
7
+ * - `alternate` / `alternate-reverse` — zig-zag, the second starting from the
8
+ * other side.
9
+ * Resolved per orientation and RTL-aware (physical mapping is a CSS concern;
10
+ * the logical `start`/`end` names are dir-agnostic).
11
+ */
12
+ export type TimelineAlign = 'start' | 'end' | 'alternate' | 'alternate-reverse';
13
+ /** Resolved logical side of a single item (after align + alternate + reverse). */
14
+ export type TimelineSide = 'start' | 'end';
15
+ /** Opt-in selection mode. `none` keeps the timeline presentational. */
16
+ export type TimelineSelectable = 'none' | 'single' | 'multiple';
17
+ /**
18
+ * One event on the timeline. Typed but open — unknown extra fields pass
19
+ * through untouched to custom templates via the item object.
20
+ */
21
+ export interface TimelineItem {
22
+ /**
23
+ * Stable identity for selection + trackBy + event payloads. Falls back to
24
+ * the source index. STRONGLY RECOMMENDED whenever the timeline is selectable
25
+ * or reorderable.
26
+ */
27
+ id?: string | number;
28
+ /** Default title text (used by the built-in row layout). */
29
+ title?: string;
30
+ /** Default body text / description. */
31
+ description?: string;
32
+ /** Timestamp; rendered in the opposite region by default. */
33
+ time?: string | Date;
34
+ /** Icon class for the default marker (e.g. a Bootstrap-icons class). */
35
+ icon?: string;
36
+ /** Accent color for the default marker + the trailing connector. */
37
+ color?: string;
38
+ /** Dims the item and skips selection/click. */
39
+ disabled?: boolean;
40
+ /** Extra class on the rendered row. */
41
+ cssClass?: string;
42
+ /** Free-form passthrough for custom templates. */
43
+ [key: string]: unknown;
44
+ }
@@ -0,0 +1,12 @@
1
+ import { TimelineAlign, TimelineSide } from './models/timeline-item';
2
+ /**
3
+ * Resolve the logical side (`start` / `end`) of every item, indexed by SOURCE
4
+ * order. The single source of truth consumed by both `<mp-timeline>` and the
5
+ * framework wrappers so they never disagree under `reverse` + `alternate`.
6
+ *
7
+ * `reverse` only changes each item's *visual* index (and therefore its
8
+ * alternate parity); it never reorders the source list. The returned sides are
9
+ * logical and dir-agnostic — mapping `start`/`end` to physical left/right is a
10
+ * CSS concern handled per `dir`.
11
+ */
12
+ export declare function resolveSides(count: number, align: TimelineAlign, reverse: boolean): TimelineSide[];
@@ -1,12 +0,0 @@
1
- /**
2
- * Card body. Pure structural wrapper — adds `card-body` to itself so
3
- * Bootstrap's body padding / flex layout apply.
4
- */
5
- export declare class MpCardBodyElement extends HTMLElement {
6
- connectedCallback(): void;
7
- }
8
- declare global {
9
- interface HTMLElementTagNameMap {
10
- 'mp-card-body': MpCardBodyElement;
11
- }
12
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * Card footer. Mirrors `mp-card-header`'s colour handling; no nav-style
3
- * variant exists at this position upstream in Bootstrap.
4
- */
5
- export declare class MpCardFooterElement extends HTMLElement {
6
- static get observedAttributes(): string[];
7
- connectedCallback(): void;
8
- attributeChangedCallback(name: string, _old: string | null, _next: string | null): void;
9
- }
10
- declare global {
11
- interface HTMLElementTagNameMap {
12
- 'mp-card-footer': MpCardFooterElement;
13
- }
14
- }
@@ -1,9 +0,0 @@
1
- /** Card group — Bootstrap's connected-card layout primitive. */
2
- export declare class MpCardGroupElement extends HTMLElement {
3
- connectedCallback(): void;
4
- }
5
- declare global {
6
- interface HTMLElementTagNameMap {
7
- 'mp-card-group': MpCardGroupElement;
8
- }
9
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Card header. Slotted content stays in light DOM; this element only adds
3
- * Bootstrap classes to itself and (when `nav-style` is set) to a nested
4
- * `nav` or `ul` so `card-header-tabs` / `card-header-pills` styling applies.
5
- *
6
- * Attributes:
7
- * - `color` — Bootstrap colour name, maps to `text-bg-<name>`.
8
- * - `nav-style` — `'tabs'` or `'pills'`. Adds the matching `card-header-*`
9
- * class to the first slotted `nav` / `ul`.
10
- */
11
- export declare class MpCardHeaderElement extends HTMLElement {
12
- static get observedAttributes(): string[];
13
- private mutationObserver;
14
- connectedCallback(): void;
15
- disconnectedCallback(): void;
16
- attributeChangedCallback(name: string, _old: string | null, _next: string | null): void;
17
- private applyColor;
18
- private applyNavStyle;
19
- }
20
- declare global {
21
- interface HTMLElementTagNameMap {
22
- 'mp-card-header': MpCardHeaderElement;
23
- }
24
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * Card image. Switches between three Bootstrap positions:
3
- * - `position="top"` → host gets `card-img-top`, inner `<img>` too
4
- * - `position="bottom"` → host gets `card-img-bottom`, inner `<img>` too
5
- * - `position="overlay"` → host gets `card-img`, inner `<img>` too, AND
6
- * slotted children get wrapped in `<div class="card-img-overlay">`
7
- *
8
- * The class is duplicated on both host and inner img so that Bootstrap's
9
- * `.card-group > .card > .card-img-top` corner-rounding selector matches
10
- * (host is the direct child of `.card`) AND `.card-img-top { width: 100% }`
11
- * sizes the actual `<img>` element. Pair with `overflow: hidden` on the
12
- * host in `mp-card.element.scss` so the host's border-radius clips the img.
13
- *
14
- * Position is read once on connection — changes after first render are not
15
- * supported. `src` and `alt` are reactive.
16
- */
17
- export declare class MpCardImgElement extends HTMLElement {
18
- static get observedAttributes(): string[];
19
- private imgEl;
20
- connectedCallback(): void;
21
- attributeChangedCallback(name: string, _old: string | null, _next: string | null): void;
22
- private applyImgAttrs;
23
- }
24
- declare global {
25
- interface HTMLElementTagNameMap {
26
- 'mp-card-img': MpCardImgElement;
27
- }
28
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Card link — wraps slotted text content in an `<a class="card-link">`.
3
- *
4
- * The actual `<a>` is the styled element (Bootstrap targets `.card-link`).
5
- * Bootstrap's adjacency rule `.card-link + .card-link { margin-left: ... }`
6
- * does not match across wrapper boundaries; we compensate with a sibling
7
- * selector on `mp-card-link + mp-card-link > .card-link` in
8
- * `mp-card.element.scss`.
9
- *
10
- * Attributes:
11
- * - `href` — forwarded to the inner `<a>`.
12
- */
13
- export declare class MpCardLinkElement extends HTMLElement {
14
- static get observedAttributes(): string[];
15
- private anchor;
16
- connectedCallback(): void;
17
- attributeChangedCallback(name: string, _old: string | null, _next: string | null): void;
18
- private applyHref;
19
- }
20
- declare global {
21
- interface HTMLElementTagNameMap {
22
- 'mp-card-link': MpCardLinkElement;
23
- }
24
- }
@@ -1,9 +0,0 @@
1
- /** Card subtitle — adds `card-subtitle`. */
2
- export declare class MpCardSubtitleElement extends HTMLElement {
3
- connectedCallback(): void;
4
- }
5
- declare global {
6
- interface HTMLElementTagNameMap {
7
- 'mp-card-subtitle': MpCardSubtitleElement;
8
- }
9
- }
@@ -1,9 +0,0 @@
1
- /** Card text — adds `card-text` for Bootstrap's last-child margin reset. */
2
- export declare class MpCardTextElement extends HTMLElement {
3
- connectedCallback(): void;
4
- }
5
- declare global {
6
- interface HTMLElementTagNameMap {
7
- 'mp-card-text': MpCardTextElement;
8
- }
9
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Card title — adds `card-title` for Bootstrap's title spacing/colour vars.
3
- * Render as a heading in the consuming app if heading semantics matter; the
4
- * WC stays element-agnostic to avoid forcing an h-level.
5
- */
6
- export declare class MpCardTitleElement extends HTMLElement {
7
- connectedCallback(): void;
8
- }
9
- declare global {
10
- interface HTMLElementTagNameMap {
11
- 'mp-card-title': MpCardTitleElement;
12
- }
13
- }