@unofficialbox/box-open-elements 0.10.0 → 0.12.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 (50) hide show
  1. package/dist/components/feedback/alert.js +2 -22
  2. package/dist/components/feedback/nudge.js +0 -1
  3. package/dist/components/feedback/path.d.ts +84 -0
  4. package/dist/components/feedback/path.js +455 -0
  5. package/dist/components/feedback/skeleton.d.ts +70 -0
  6. package/dist/components/feedback/skeleton.js +231 -1
  7. package/dist/components/feedback/toast.d.ts +37 -0
  8. package/dist/components/feedback/toast.js +182 -17
  9. package/dist/components/feedback/tone.d.ts +16 -0
  10. package/dist/components/feedback/tone.js +31 -0
  11. package/dist/components/layout/grid.d.ts +41 -0
  12. package/dist/components/layout/grid.js +152 -0
  13. package/dist/element-maps.d.ts +7 -3
  14. package/dist/entries/comment-thread.d.ts +1 -0
  15. package/dist/entries/comment-thread.js +1 -0
  16. package/dist/entries/grid.d.ts +1 -0
  17. package/dist/entries/grid.js +1 -0
  18. package/dist/entries/path.d.ts +1 -0
  19. package/dist/entries/path.js +1 -0
  20. package/dist/foundations/layout/grid.d.ts +70 -0
  21. package/dist/foundations/layout/grid.js +84 -0
  22. package/dist/foundations/layout/index.d.ts +1 -0
  23. package/dist/foundations/layout/index.js +3 -0
  24. package/dist/index.d.ts +5 -1
  25. package/dist/index.js +6 -1
  26. package/dist/patterns/audit/audit-log.js +0 -1
  27. package/dist/patterns/comments/comment-thread.d.ts +79 -0
  28. package/dist/patterns/comments/comment-thread.js +561 -0
  29. package/dist/patterns/comments/index.d.ts +2 -0
  30. package/dist/patterns/comments/index.js +5 -0
  31. package/dist/patterns/comments/types.d.ts +39 -0
  32. package/dist/patterns/comments/types.js +8 -0
  33. package/dist/patterns/lineage/lineage-graph.d.ts +7 -0
  34. package/dist/patterns/lineage/lineage-graph.js +67 -6
  35. package/dist/patterns/lineage/provenance-strip.js +106 -15
  36. package/dist/patterns/notifications/notification-inbox.js +2 -18
  37. package/dist/patterns/preview/annotation-thread.d.ts +67 -48
  38. package/dist/patterns/preview/annotation-thread.js +96 -440
  39. package/dist/patterns/timeline/timeline.js +44 -12
  40. package/dist/patterns/versions/graph-arrows.d.ts +22 -0
  41. package/dist/patterns/versions/graph-arrows.js +13 -0
  42. package/dist/patterns/versions/index.d.ts +1 -0
  43. package/dist/patterns/versions/index.js +1 -0
  44. package/dist/patterns/versions/version-graph.d.ts +7 -0
  45. package/dist/patterns/versions/version-graph.js +54 -6
  46. package/package.json +1 -1
  47. package/dist/components/feedback/stage-path.d.ts +0 -44
  48. package/dist/components/feedback/stage-path.js +0 -235
  49. package/dist/entries/stage-path.d.ts +0 -1
  50. package/dist/entries/stage-path.js +0 -1
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Adobe Spectrum's responsive grid, as a foundation.
3
+ *
4
+ * Two surfaces build on this: `box-grid`, which lays out slotted content, and
5
+ * `box-skeleton`'s grid variant, which fills the same regions with shimmer
6
+ * bars. They must agree on what a column is worth and how wide a gutter is at
7
+ * a given viewport, so the model lives here rather than in either of them.
8
+ */
9
+ /**
10
+ * Columns in the grid.
11
+ *
12
+ * Twelve divides by 2, 3, 4 and 6, so halves, thirds, quarters and
13
+ * sidebar-plus-content all land on whole columns.
14
+ */
15
+ export declare const BOE_GRID_COLUMNS = 12;
16
+ /**
17
+ * Spectrum's breakpoints and their gutters.
18
+ *
19
+ * Breakpoints are min-widths, so a viewport between two of them inherits the
20
+ * smaller one's dimensions. Gutters are fixed values per breakpoint rather
21
+ * than a proportion of the grid — that is Spectrum's rule, and it is why the
22
+ * gutter cannot simply be a percentage.
23
+ */
24
+ export declare const BOE_GRID_BREAKPOINTS: readonly {
25
+ minWidth: number;
26
+ gutter: number;
27
+ }[];
28
+ /** The custom property every grid surface reads its gutter from. */
29
+ export declare const BOE_GRID_GUTTER_PROPERTY = "--boe-grid-gutter";
30
+ /**
31
+ * The gutter scale as CSS, scoped to a selector.
32
+ *
33
+ * Emitted rather than hand-written in each component so the two cannot drift,
34
+ * and so adding a breakpoint is one edit. A consumer overriding the property
35
+ * replaces the whole scale in one declaration.
36
+ */
37
+ export declare const boeGridGutterStyles: (selector?: string) => string;
38
+ /**
39
+ * One region of the grid: a block spanning some columns and rows, optionally
40
+ * pushed right by an offset. Spectrum calls these layout regions.
41
+ */
42
+ export interface BoeGridPlacement {
43
+ /** Columns to span. Clamped to what is left after `offset`. */
44
+ span?: number;
45
+ /** Rows to span. Clamped to the grid's `rows`, so a region cannot exceed it. */
46
+ rowSpan?: number;
47
+ /** Empty columns before this region. Clamped to leave room for one column. */
48
+ offset?: number;
49
+ }
50
+ /** A resolved region: every field present, every value in range. */
51
+ export interface ResolvedBoeGridPlacement {
52
+ span: number;
53
+ rowSpan: number;
54
+ offset: number;
55
+ }
56
+ /** Attribute payloads are author input — validate every record. */
57
+ export declare const isBoeGridPlacementRecord: (value: unknown) => value is BoeGridPlacement;
58
+ /**
59
+ * Fit a region to the grid.
60
+ *
61
+ * Every value is clamped rather than rejected. A layout that renders slightly
62
+ * wrong is recoverable; one that vanishes because a number was out of range is
63
+ * not, and the caller usually cannot tell which region was dropped. The clamps
64
+ * are what confine a region to the totals the author declared: a span of 9 in a
65
+ * three-column grid becomes 3, and a `rowSpan` of 5 in a three-row grid
66
+ * becomes 3.
67
+ */
68
+ export declare const resolveBoeGridPlacement: (item: BoeGridPlacement, columns: number, rows: number) => ResolvedBoeGridPlacement;
69
+ /** Parse a positive integer attribute, falling back when it is absent or junk. */
70
+ export declare const resolveGridCount: (raw: string | null, fallback: number) => number;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Adobe Spectrum's responsive grid, as a foundation.
3
+ *
4
+ * Two surfaces build on this: `box-grid`, which lays out slotted content, and
5
+ * `box-skeleton`'s grid variant, which fills the same regions with shimmer
6
+ * bars. They must agree on what a column is worth and how wide a gutter is at
7
+ * a given viewport, so the model lives here rather than in either of them.
8
+ */
9
+ /**
10
+ * Columns in the grid.
11
+ *
12
+ * Twelve divides by 2, 3, 4 and 6, so halves, thirds, quarters and
13
+ * sidebar-plus-content all land on whole columns.
14
+ */
15
+ export const BOE_GRID_COLUMNS = 12;
16
+ /**
17
+ * Spectrum's breakpoints and their gutters.
18
+ *
19
+ * Breakpoints are min-widths, so a viewport between two of them inherits the
20
+ * smaller one's dimensions. Gutters are fixed values per breakpoint rather
21
+ * than a proportion of the grid — that is Spectrum's rule, and it is why the
22
+ * gutter cannot simply be a percentage.
23
+ */
24
+ export const BOE_GRID_BREAKPOINTS = [
25
+ { minWidth: 0, gutter: 16 },
26
+ { minWidth: 768, gutter: 24 },
27
+ { minWidth: 1280, gutter: 32 },
28
+ { minWidth: 1768, gutter: 40 },
29
+ { minWidth: 2160, gutter: 48 },
30
+ ];
31
+ /** The custom property every grid surface reads its gutter from. */
32
+ export const BOE_GRID_GUTTER_PROPERTY = "--boe-grid-gutter";
33
+ /**
34
+ * The gutter scale as CSS, scoped to a selector.
35
+ *
36
+ * Emitted rather than hand-written in each component so the two cannot drift,
37
+ * and so adding a breakpoint is one edit. A consumer overriding the property
38
+ * replaces the whole scale in one declaration.
39
+ */
40
+ export const boeGridGutterStyles = (selector = ":host") => BOE_GRID_BREAKPOINTS.map(({ minWidth, gutter }) => {
41
+ const declaration = `${selector} {\n ${BOE_GRID_GUTTER_PROPERTY}: ${gutter}px;\n }`;
42
+ return minWidth === 0
43
+ ? ` ${declaration}`
44
+ : ` @media (min-width: ${minWidth}px) {\n ${declaration}\n }`;
45
+ }).join("\n\n");
46
+ /** Attribute payloads are author input — validate every record. */
47
+ export const isBoeGridPlacementRecord = (value) => {
48
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
49
+ return false;
50
+ }
51
+ const item = value;
52
+ // Absent is fine — each field has a default. Present-but-not-a-number is not:
53
+ // it means the host built the payload wrong, and silently substituting a
54
+ // default would hide that.
55
+ return ["span", "rowSpan", "offset"].every(key => {
56
+ const raw = item[key];
57
+ return raw === undefined || (typeof raw === "number" && Number.isFinite(raw));
58
+ });
59
+ };
60
+ const clamp = (value, min, max) => Math.min(Math.max(Math.trunc(value), min), max);
61
+ /**
62
+ * Fit a region to the grid.
63
+ *
64
+ * Every value is clamped rather than rejected. A layout that renders slightly
65
+ * wrong is recoverable; one that vanishes because a number was out of range is
66
+ * not, and the caller usually cannot tell which region was dropped. The clamps
67
+ * are what confine a region to the totals the author declared: a span of 9 in a
68
+ * three-column grid becomes 3, and a `rowSpan` of 5 in a three-row grid
69
+ * becomes 3.
70
+ */
71
+ export const resolveBoeGridPlacement = (item, columns, rows) => {
72
+ // Leave at least one column for the region itself.
73
+ const offset = clamp(item.offset ?? 0, 0, Math.max(columns - 1, 0));
74
+ return {
75
+ offset,
76
+ span: clamp(item.span ?? 1, 1, Math.max(columns - offset, 1)),
77
+ rowSpan: clamp(item.rowSpan ?? 1, 1, Math.max(rows, 1)),
78
+ };
79
+ };
80
+ /** Parse a positive integer attribute, falling back when it is absent or junk. */
81
+ export const resolveGridCount = (raw, fallback) => {
82
+ const parsed = Number.parseInt(raw ?? "", 10);
83
+ return Number.isFinite(parsed) ? Math.max(parsed, 1) : fallback;
84
+ };
@@ -0,0 +1 @@
1
+ export * from "./grid.js";
@@ -0,0 +1,3 @@
1
+ // Adobe Spectrum's responsive grid: columns, breakpoint gutters, and the
2
+ // clamping that confines a region to the totals its host declared.
3
+ export * from "./grid.js";
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export type { ResolvedTheme, ThemeChangeDetail, ThemeController, ThemeController
8
8
  export { DESIGN_PROFILE_CHANGE_EVENT, DESIGN_PROFILE_VARIABLES, DEFAULT_DESIGN_PROFILE_STORAGE_KEY, applyDesignProfile, boxDefaultDesignProfile, compactNeutralDesignProfile, createDesignProfileController, createDesignProfileStyleText, getDesignProfile, listDesignProfiles, registerBuiltInDesignProfiles, registerDesignProfile, resolveDesignProfileProperties, } from "./foundations/profiles/index.js";
9
9
  export type { ApplyDesignProfileOptions, DesignProfileChangeDetail, DesignProfileController, DesignProfileControllerOptions, DesignProfileDefinition, DesignProfileDensity, DesignProfileElevation, DesignProfileMotion, DesignProfileRadius, DesignProfileSpacing, DesignProfileTypography, } from "./foundations/profiles/index.js";
10
10
  export { boxIconography, boxIconographyAliases } from "./foundations/icons/index.js";
11
+ export * from "./foundations/layout/index.js";
11
12
  export { anchorFloating, parsePlacement, resolvePosition, trackAnchor, } from "./foundations/overlay/index.js";
12
13
  export type { OverlayAlign, OverlayPlacement, OverlaySide, PositionOptions, PositionResult, } from "./foundations/overlay/index.js";
13
14
  export * from "./components/actions/button.js";
@@ -42,10 +43,11 @@ export * from "./components/feedback/progress-ring.js";
42
43
  export * from "./components/feedback/progress-steps.js";
43
44
  export * from "./components/feedback/skeleton.js";
44
45
  export * from "./components/feedback/spinner.js";
45
- export * from "./components/feedback/stage-path.js";
46
+ export * from "./components/feedback/path.js";
46
47
  export * from "./components/feedback/toast.js";
47
48
  export * from "./components/files/drop-zone.js";
48
49
  export * from "./components/identity/avatar.js";
50
+ export * from "./components/identity/contact-datalist-item.js";
49
51
  export * from "./components/identity/persona.js";
50
52
  export * from "./components/navigation/accordion.js";
51
53
  export * from "./components/navigation/breadcrumb.js";
@@ -80,6 +82,7 @@ export * from "./components/forms/text-area.js";
80
82
  export * from "./components/forms/text-field.js";
81
83
  export * from "./components/layout/app-shell.js";
82
84
  export * from "./components/layout/divider.js";
85
+ export * from "./components/layout/grid.js";
83
86
  export * from "./components/layout/nav-sidebar.js";
84
87
  export * from "./components/layout/section.js";
85
88
  export * from "./components/layout/sidebar-toggle-button.js";
@@ -107,6 +110,7 @@ export * from "./patterns/versions/index.js";
107
110
  export * from "./patterns/lineage/index.js";
108
111
  export * from "./patterns/agent-chat/index.js";
109
112
  export * from "./patterns/audit/index.js";
113
+ export * from "./patterns/comments/index.js";
110
114
  export * from "./patterns/notifications/index.js";
111
115
  export * from "./patterns/search/index.js";
112
116
  export * from "./patterns/item/index.js";
package/dist/index.js CHANGED
@@ -5,6 +5,8 @@ export { DESIGN_SYSTEM_CHANGE_EVENT, SEMANTIC_TOKEN_ALIASES, applyDesignTokens,
5
5
  export { DARK_MODE_MEDIA_QUERY, DEFAULT_THEME_STORAGE_KEY, THEME_CHANGE_EVENT, createThemeController, createThemeInitializationScript, } from "./foundations/theming/index.js";
6
6
  export { DESIGN_PROFILE_CHANGE_EVENT, DESIGN_PROFILE_VARIABLES, DEFAULT_DESIGN_PROFILE_STORAGE_KEY, applyDesignProfile, boxDefaultDesignProfile, compactNeutralDesignProfile, createDesignProfileController, createDesignProfileStyleText, getDesignProfile, listDesignProfiles, registerBuiltInDesignProfiles, registerDesignProfile, resolveDesignProfileProperties, } from "./foundations/profiles/index.js";
7
7
  export { boxIconography, boxIconographyAliases } from "./foundations/icons/index.js";
8
+ // Foundations: Adobe Spectrum's responsive grid (shared by box-grid and box-skeleton)
9
+ export * from "./foundations/layout/index.js";
8
10
  // Foundations: viewport-aware overlay positioning (for building custom overlays)
9
11
  export { anchorFloating, parsePlacement, resolvePosition, trackAnchor, } from "./foundations/overlay/index.js";
10
12
  // Components: actions
@@ -42,12 +44,13 @@ export * from "./components/feedback/progress-ring.js";
42
44
  export * from "./components/feedback/progress-steps.js";
43
45
  export * from "./components/feedback/skeleton.js";
44
46
  export * from "./components/feedback/spinner.js";
45
- export * from "./components/feedback/stage-path.js";
47
+ export * from "./components/feedback/path.js";
46
48
  export * from "./components/feedback/toast.js";
47
49
  // Components: files
48
50
  export * from "./components/files/drop-zone.js";
49
51
  // Components: identity
50
52
  export * from "./components/identity/avatar.js";
53
+ export * from "./components/identity/contact-datalist-item.js";
51
54
  export * from "./components/identity/persona.js";
52
55
  // Components: navigation
53
56
  export * from "./components/navigation/accordion.js";
@@ -86,6 +89,7 @@ export * from "./components/forms/text-field.js";
86
89
  // Components: layout
87
90
  export * from "./components/layout/app-shell.js";
88
91
  export * from "./components/layout/divider.js";
92
+ export * from "./components/layout/grid.js";
89
93
  export * from "./components/layout/nav-sidebar.js";
90
94
  export * from "./components/layout/section.js";
91
95
  export * from "./components/layout/sidebar-toggle-button.js";
@@ -115,6 +119,7 @@ export * from "./patterns/versions/index.js";
115
119
  export * from "./patterns/lineage/index.js";
116
120
  export * from "./patterns/agent-chat/index.js";
117
121
  export * from "./patterns/audit/index.js";
122
+ export * from "./patterns/comments/index.js";
118
123
  export * from "./patterns/notifications/index.js";
119
124
  // Patterns: compositions and workflow areas
120
125
  export * from "./patterns/search/index.js";
@@ -221,7 +221,6 @@ const elementStyles = `
221
221
  gap: 0.25rem;
222
222
  padding: 0.5rem 0.65rem;
223
223
  border-top: 1px solid color-mix(in srgb, var(--boe-token-stroke-stroke, #e8e8e8) 55%, transparent);
224
- border-left: 3px solid var(--audit-tone, transparent);
225
224
  }
226
225
 
227
226
  [part="event-topline"] {
@@ -0,0 +1,79 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ import type { CommentAction, CommentEntry } from "./types.js";
3
+ /**
4
+ * A comment thread: authored entries, selection, actions, and a composer.
5
+ *
6
+ * Comments are a standalone concept. They hang off a file, a folder, a task or
7
+ * a contract clause just as readily as off a region of a document, so the
8
+ * thread does not know what it is attached to — a host that needs an anchor
9
+ * composes one on top. `box-annotation-thread` is exactly that: this component
10
+ * plus the document anchor, which is the only thing that makes an annotation an
11
+ * annotation.
12
+ *
13
+ * The extension points below (`threadStyles`, `headerExtras`, `defaultHeading`,
14
+ * `emptyText`, `entryBadge`, and the composer copy) exist so a subclass can
15
+ * specialise the chrome without reimplementing entry rendering, selection
16
+ * patching, or the composer.
17
+ */
18
+ export declare class CommentThread extends BaseElement {
19
+ static readonly tagName: string;
20
+ static get observedAttributes(): string[];
21
+ protected titleEl: HTMLElement;
22
+ protected messageEl: HTMLElement;
23
+ protected entriesEl: HTMLElement;
24
+ protected emptyEl: HTMLElement;
25
+ protected actionsEl: HTMLElement;
26
+ protected composerEl: HTMLElement;
27
+ protected composerLabelEl: HTMLElement;
28
+ protected composerSubmitEl: HTMLElement;
29
+ protected composerInputEl: HTMLTextAreaElement;
30
+ private entriesSignature;
31
+ private actionsSignature;
32
+ /** Styles for the thread. Subclasses append rather than replace. */
33
+ protected threadStyles(): string;
34
+ /** Extra markup inside the header, after the message. Empty by default. */
35
+ protected headerExtras(): string;
36
+ /** Heading when the host sets none. */
37
+ protected defaultHeading(): string;
38
+ /** Text shown when there are no entries. */
39
+ protected emptyText(): string;
40
+ /** Label on the composer, and on its submit button. */
41
+ protected defaultComposerLabel(): string;
42
+ /** Placeholder in the composer input. */
43
+ protected defaultPlaceholder(): string;
44
+ /**
45
+ * The pill beside the author. Reads the generic `badge`; a subclass with its
46
+ * own vocabulary overrides this rather than forcing hosts to rename fields.
47
+ */
48
+ protected entryBadge(entry: CommentEntry): string | undefined;
49
+ get actions(): CommentAction[];
50
+ set actions(value: CommentAction[]);
51
+ get composable(): boolean;
52
+ set composable(value: boolean);
53
+ get entries(): CommentEntry[];
54
+ set entries(value: CommentEntry[]);
55
+ get message(): string;
56
+ set message(value: string);
57
+ get selectedEntryId(): string;
58
+ set selectedEntryId(value: string);
59
+ get heading(): string;
60
+ set heading(value: string);
61
+ /** Composer label and submit-button text. */
62
+ get composerLabel(): string;
63
+ set composerLabel(value: string);
64
+ get placeholder(): string;
65
+ set placeholder(value: string);
66
+ protected parseJsonAttribute<T>(name: string, fallback: T): T;
67
+ private emitAction;
68
+ private emitEntrySelected;
69
+ private submitComposer;
70
+ private entriesKey;
71
+ private actionsKey;
72
+ private rebuildEntries;
73
+ private patchEntrySelection;
74
+ private rebuildActions;
75
+ private patchActionLabels;
76
+ protected renderTemplate(): void;
77
+ protected setupListeners(): void;
78
+ protected update(): void;
79
+ }