@unofficialbox/box-open-elements 0.23.0 → 0.25.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 (54) hide show
  1. package/README.md +15 -13
  2. package/dist/components/actions/button.d.ts +1 -0
  3. package/dist/components/actions/button.js +16 -3
  4. package/dist/components/actions/segmented-control.d.ts +1 -0
  5. package/dist/components/actions/segmented-control.js +20 -6
  6. package/dist/components/feedback/alert.js +1 -1
  7. package/dist/components/feedback/progress-bar.js +2 -2
  8. package/dist/components/forms/checkbox.d.ts +1 -0
  9. package/dist/components/forms/checkbox.js +6 -2
  10. package/dist/components/forms/code-editor.d.ts +86 -0
  11. package/dist/components/forms/code-editor.js +447 -0
  12. package/dist/components/forms/combobox.js +7 -8
  13. package/dist/components/forms/number-input.d.ts +1 -0
  14. package/dist/components/forms/number-input.js +8 -2
  15. package/dist/components/forms/select.d.ts +1 -0
  16. package/dist/components/forms/select.js +3 -1
  17. package/dist/components/forms/text-area.js +5 -7
  18. package/dist/components/forms/text-field.d.ts +1 -0
  19. package/dist/components/forms/text-field.js +2 -0
  20. package/dist/components/navigation/accordion.d.ts +7 -0
  21. package/dist/components/navigation/accordion.js +31 -8
  22. package/dist/components/output/code-block.js +3 -1
  23. package/dist/components/overlays/drawer.js +2 -2
  24. package/dist/core/form-associated.d.ts +1 -0
  25. package/dist/core/form-associated.js +3 -0
  26. package/dist/entries/code-editor.d.ts +1 -0
  27. package/dist/entries/code-editor.js +1 -0
  28. package/dist/foundations/geometry/tokens.d.ts +2 -2
  29. package/dist/foundations/geometry/tokens.js +3 -3
  30. package/dist/foundations/icons/box-iconography.generated.js +1 -0
  31. package/dist/foundations/icons/glyphs/constants.d.ts +472 -0
  32. package/dist/foundations/icons/glyphs/constants.js +473 -0
  33. package/dist/foundations/icons/glyphs/index.d.ts +1 -1
  34. package/dist/foundations/icons/glyphs/index.js +1 -1
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +1 -0
  37. package/dist/patterns/flow-builder/flow-builder.d.ts +7 -1
  38. package/dist/patterns/flow-builder/flow-builder.js +32 -15
  39. package/dist/patterns/flow-builder/model.d.ts +2 -0
  40. package/dist/patterns/flow-builder/model.js +3 -3
  41. package/dist/patterns/flow-builder/primitives.d.ts +1 -0
  42. package/dist/patterns/flow-builder/primitives.js +5 -4
  43. package/dist/patterns/insights/metric-card.js +2 -2
  44. package/dist/patterns/process-modeler/bridge.d.ts +10 -0
  45. package/dist/patterns/process-modeler/bridge.js +173 -0
  46. package/dist/patterns/process-modeler/geometry.d.ts +18 -0
  47. package/dist/patterns/process-modeler/geometry.js +307 -0
  48. package/dist/patterns/process-modeler/index.d.ts +4 -0
  49. package/dist/patterns/process-modeler/index.js +4 -0
  50. package/dist/patterns/process-modeler/model.d.ts +135 -0
  51. package/dist/patterns/process-modeler/model.js +113 -0
  52. package/dist/patterns/process-modeler/process-modeler.d.ts +130 -0
  53. package/dist/patterns/process-modeler/process-modeler.js +1507 -0
  54. package/package.json +21 -3
package/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  Browse the full catalog on the **[live docs site](https://unofficialbox.github.io/box-open-elements)** — live previews, an events/properties inspector, per-framework code snippets (React / Angular / Vue / Svelte / HTML), and the foundations pages.
14
14
 
15
- The library is organized around three layers (see [taxonomy](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/taxonomy.md) for the canonical model):
15
+ The library is organized around three layers (see [taxonomy](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/taxonomy.md) for the canonical model):
16
16
 
17
17
  - **Foundations** — design decisions as data: tokens, color, typography, iconography, accessibility, theming
18
18
  - **Components** — accessible Web Components for single controls, organized by category
@@ -21,6 +21,8 @@ The library is organized around three layers (see [taxonomy](https://github.com/
21
21
  Core implementation principles:
22
22
 
23
23
  - plain TypeScript modules, no React requirement in the core package — zero runtime dependencies
24
+ - Optional `code-editor` entrypoint uses CodeMirror 6; its dependencies are not
25
+ loaded by the root catalog or other component imports.
24
26
  - state and business logic separate from rendering: controllers and stores, not framework components
25
27
  - standard DOM events where a UI layer needs them
26
28
  - accessibility semantics and keyboard support as part of the component contract
@@ -75,7 +77,7 @@ selection.toggleSelection("1");
75
77
  - optimized component entrypoints: `@unofficialbox/box-open-elements/<name>`
76
78
  - patterns: `@unofficialbox/box-open-elements/patterns/<area>` and `@unofficialbox/box-open-elements/patterns/<area>/<module>`
77
79
 
78
- See the versioned [API guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/api-guidelines.md).
80
+ See the versioned [API guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/api-guidelines.md).
79
81
 
80
82
  ## Developing
81
83
 
@@ -89,17 +91,17 @@ bun run docs # build + serve the docs site at http://localhost:4600
89
91
 
90
92
  ## Documentation
91
93
 
92
- The versioned docs index is at [docs/README.md](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/README.md). The most important entries:
93
-
94
- - [Taxonomy](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/taxonomy.md)
95
- - [Architecture](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/architecture.md)
96
- - [API Guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/api-guidelines.md)
97
- - [Components catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/components/catalog.md) and [patterns catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/patterns/catalog.md)
98
- - [Using with React, Angular, Vue, and Svelte](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/integration/frameworks.md)
99
- - [Design Tokens](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/foundations/tokens.md)
100
- - [Content Explorer](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/patterns/content-explorer.md)
101
- - [Box Server Integration](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/integration/box-server.md)
102
- - [Agent UI guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/patterns/agent-ui-guidelines.md), [building blocks](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/patterns/agent-ui.md), and [motion](https://github.com/unofficialbox/box-open-elements/blob/v0.23.0/docs/foundations/motion.md)
94
+ The versioned docs index is at [docs/README.md](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/README.md). The most important entries:
95
+
96
+ - [Taxonomy](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/taxonomy.md)
97
+ - [Architecture](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/architecture.md)
98
+ - [API Guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/api-guidelines.md)
99
+ - [Components catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/components/catalog.md) and [patterns catalog](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/patterns/catalog.md)
100
+ - [Using with React, Angular, Vue, and Svelte](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/integration/frameworks.md)
101
+ - [Design Tokens](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/foundations/tokens.md)
102
+ - [Content Explorer](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/patterns/content-explorer.md)
103
+ - [Box Server Integration](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/integration/box-server.md)
104
+ - [Agent UI guidelines](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/patterns/agent-ui-guidelines.md), [building blocks](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/patterns/agent-ui.md), and [motion](https://github.com/unofficialbox/box-open-elements/blob/v0.25.0/docs/foundations/motion.md)
103
105
 
104
106
  ## Contributing
105
107
 
@@ -5,6 +5,7 @@ export declare class Button extends BaseElement {
5
5
  static formAssociated: boolean;
6
6
  static get observedAttributes(): string[];
7
7
  private buttonEl;
8
+ focus(options?: FocusOptions): void;
8
9
  private spinnerEl;
9
10
  private iconEl;
10
11
  private labelEl;
@@ -64,7 +64,7 @@ const buttonStyles = `
64
64
  outline: none;
65
65
  background: var(--boe-token-surface-surface-brand-hover, #006ae9);
66
66
  border-color: var(--boe-token-surface-surface-brand, #0061d5);
67
- box-shadow: ${boeControl.primaryFocusShadow};
67
+ box-shadow: 0 0 0 2px var(--boe-token-surface-surface, #ffffff), 0 0 0 5px var(--boe-token-surface-surface-brand, #0061d5);
68
68
  }
69
69
 
70
70
  button[data-tone="neutral"] {
@@ -74,6 +74,17 @@ const buttonStyles = `
74
74
  box-shadow: none;
75
75
  }
76
76
 
77
+ button[data-tone="text"], button[data-tone="text"]:hover:not(:disabled),
78
+ button[data-tone="text"]:active:not(:disabled), button[data-tone="text"]:focus-visible {
79
+ background: transparent;
80
+ border-color: transparent;
81
+ color: var(--boe-token-surface-surface-brand, #0061d5);
82
+ padding-inline: 0;
83
+ white-space: normal;
84
+ text-align: start;
85
+ }
86
+ button[data-tone="text"]:hover:not(:disabled) { text-decoration: underline; }
87
+
77
88
  button[data-tone="neutral"]:hover:not(:disabled) {
78
89
  background: color-mix(in srgb, var(--boe-token-surface-surface, #ffffff) 97%, black 3%);
79
90
  border-color: ${boeControl.buttonBorder};
@@ -86,7 +97,7 @@ const buttonStyles = `
86
97
 
87
98
  button[data-tone="neutral"]:focus-visible {
88
99
  border-color: var(--boe-token-text-text, #222222);
89
- box-shadow: 0 1px 2px rgb(0 0 0 / 10%);
100
+ box-shadow: 0 0 0 2px var(--boe-token-surface-surface, #ffffff), 0 0 0 5px var(--boe-token-surface-surface-brand, #0061d5);
90
101
  }
91
102
 
92
103
  button[data-tone="danger"] {
@@ -106,7 +117,7 @@ const buttonStyles = `
106
117
  }
107
118
 
108
119
  button[data-tone="danger"]:focus-visible {
109
- box-shadow: inset 0 0 0 1px rgb(255 255 255 / 80%), 0 1px 2px rgb(0 0 0 / 10%);
120
+ box-shadow: 0 0 0 2px var(--boe-token-surface-surface, #ffffff), 0 0 0 5px var(--boe-token-surface-surface-brand, #0061d5);
110
121
  }
111
122
 
112
123
  button[data-size="small"] {
@@ -176,6 +187,8 @@ export class Button extends BaseElement {
176
187
  return ["disabled", "label", "size", "tone", "is-loading", "type"];
177
188
  }
178
189
  buttonEl;
190
+ focus(options) { if (!this.disabled)
191
+ this.buttonEl?.focus(options); }
179
192
  spinnerEl;
180
193
  iconEl;
181
194
  labelEl;
@@ -9,6 +9,7 @@ export declare class SegmentedControl extends BaseElement {
9
9
  static get observedAttributes(): string[];
10
10
  private valueInternal;
11
11
  private controlEl;
12
+ private renderedOptions;
12
13
  get disabled(): boolean;
13
14
  set disabled(value: boolean);
14
15
  get label(): string;
@@ -84,6 +84,7 @@ export class SegmentedControl extends BaseElement {
84
84
  }
85
85
  valueInternal = "";
86
86
  controlEl;
87
+ renderedOptions = "";
87
88
  get disabled() {
88
89
  return this.hasAttribute("disabled");
89
90
  }
@@ -121,17 +122,17 @@ export class SegmentedControl extends BaseElement {
121
122
  }
122
123
  }
123
124
  set options(value) {
124
- this.setAttribute("options", JSON.stringify(value));
125
+ const serialized = JSON.stringify(value);
126
+ if (serialized !== this.getAttribute("options"))
127
+ this.setAttribute("options", serialized);
125
128
  }
126
129
  get value() {
127
130
  return this.valueInternal;
128
131
  }
129
132
  set value(nextValue) {
130
- this.valueInternal = nextValue;
133
+ if (nextValue === this.valueInternal)
134
+ return;
131
135
  this.setAttribute("value", nextValue);
132
- if (this.isRendered) {
133
- this.update();
134
- }
135
136
  }
136
137
  attributeChangedCallback(name, oldValue, newValue) {
137
138
  if (name === "value") {
@@ -198,7 +199,20 @@ export class SegmentedControl extends BaseElement {
198
199
  this.controlEl.dataset.layout = this.layout;
199
200
  this.controlEl.setAttribute("aria-label", this.label);
200
201
  this.controlEl.setAttribute("aria-disabled", String(this.disabled));
201
- // Rebuild segments (count may change)
202
+ const serialized = JSON.stringify(options);
203
+ if (serialized === this.renderedOptions) {
204
+ this.controlEl.querySelectorAll('[part="segment"]').forEach((button, index) => {
205
+ const selected = options[index].value === selectedValue;
206
+ button.dataset.layout = this.layout;
207
+ button.dataset.selected = String(selected);
208
+ button.setAttribute("aria-checked", String(selected));
209
+ button.tabIndex = selected ? 0 : -1;
210
+ button.disabled = this.disabled || Boolean(options[index].disabled);
211
+ });
212
+ return;
213
+ }
214
+ this.renderedOptions = serialized;
215
+ // Rebuild only when the options themselves change.
202
216
  this.controlEl.innerHTML = options
203
217
  .map((option, index) => {
204
218
  const position = options.length === 1
@@ -131,7 +131,7 @@ const alertStyles = `
131
131
  border: 0;
132
132
  border-radius: ${boeRadius.med};
133
133
  background: transparent;
134
- color: var(--boe-token-text-text-secondary, #6f6f6f);
134
+ color: var(--boe-token-text-text, #222222);
135
135
  font: inherit;
136
136
  font-size: 13px;
137
137
  font-weight: 700;
@@ -30,8 +30,8 @@ const progressBarStyles = `
30
30
  [part="label"] {
31
31
  font-size: 0.8rem;
32
32
  font-weight: 700;
33
- letter-spacing: 0.08em;
34
- text-transform: uppercase;
33
+ letter-spacing: normal;
34
+ text-transform: none;
35
35
  color: var(--boe-token-text-text-secondary, #6f6f6f);
36
36
  }
37
37
 
@@ -7,6 +7,7 @@ export declare class Checkbox extends FormAssociatedElement {
7
7
  private indeterminateInternal;
8
8
  private valueInternal;
9
9
  private inputEl;
10
+ focus(options?: FocusOptions): void;
10
11
  private labelEl;
11
12
  private descriptionEl;
12
13
  private fieldEl;
@@ -1,4 +1,4 @@
1
- import { FormAssociatedElement, boeFormFieldErrorStyles, formErrorMessageMarkup, } from "../../core/index.js";
1
+ import { FormAssociatedElement, boeFormFieldErrorStyles, boeFormFieldSupportStyles, formErrorMessageMarkup, } from "../../core/index.js";
2
2
  import { boeFocusVisibleStyles } from "../../foundations/tokens/interaction.js";
3
3
  import { boeControl, boeRadius, boeSpace } from "../../foundations/geometry/index.js";
4
4
  import { boeMotionDuration, boeMotionEasing } from "../../foundations/motion/index.js";
@@ -86,12 +86,13 @@ const checkboxStyles = `
86
86
  }
87
87
 
88
88
  ${boeFormFieldErrorStyles}
89
+ ${boeFormFieldSupportStyles}
89
90
  `;
90
91
  export class Checkbox extends FormAssociatedElement {
91
92
  static tagName = DEFAULT_TAG_NAME;
92
93
  static get observedAttributes() {
93
94
  return [
94
- ...FormAssociatedElement.formObservedAttributes,
95
+ ...FormAssociatedElement.fieldObservedAttributes,
95
96
  "checked",
96
97
  "description",
97
98
  "disabled",
@@ -104,6 +105,8 @@ export class Checkbox extends FormAssociatedElement {
104
105
  indeterminateInternal = false;
105
106
  valueInternal = DEFAULT_VALUE;
106
107
  inputEl;
108
+ focus(options) { if (!this.disabled)
109
+ this.inputEl?.focus(options); }
107
110
  labelEl;
108
111
  descriptionEl;
109
112
  fieldEl;
@@ -288,6 +291,7 @@ export class Checkbox extends FormAssociatedElement {
288
291
  }
289
292
  this.inputEl.setAttribute("aria-label", this.label);
290
293
  this.labelEl.textContent = this.label;
294
+ this.applyFieldSupport(this.labelEl, this.inputEl, null);
291
295
  const description = this.description;
292
296
  if (description) {
293
297
  this.descriptionEl.hidden = false;
@@ -0,0 +1,86 @@
1
+ import { BaseElement } from "../../core/index.js";
2
+ import { type Completion, type CompletionSource } from "@codemirror/autocomplete";
3
+ export interface CodeProblem {
4
+ /** One-based line and column positions. */
5
+ line?: number;
6
+ /** UTF-16 offsets; when supplied, these take precedence over line/column. */
7
+ from?: number;
8
+ to?: number;
9
+ col?: number;
10
+ endCol?: number;
11
+ message: string;
12
+ tone: "error" | "warning" | "info";
13
+ }
14
+ export type CodeCompletion = Completion;
15
+ export type CodeCompletionSource = CompletionSource;
16
+ export interface CodeHighlight {
17
+ from: number;
18
+ to: number;
19
+ }
20
+ export interface CodeSelection {
21
+ anchor: number;
22
+ head: number;
23
+ }
24
+ /** Optional CodeMirror entrypoint. Import `code-editor`, not the root catalog. */
25
+ export declare class CodeEditor extends BaseElement {
26
+ static readonly tagName = "box-code-editor";
27
+ static get observedAttributes(): string[];
28
+ private valueInternal;
29
+ private problemsInternal;
30
+ private completionsInternal;
31
+ private view?;
32
+ private languageConfig;
33
+ private readonlyConfig;
34
+ private completionsConfig;
35
+ private wrapConfig;
36
+ private highlightsConfig;
37
+ private highlightsInternal;
38
+ private source?;
39
+ private timer?;
40
+ private pending;
41
+ private syncing;
42
+ private problemIndex;
43
+ private savedSelection;
44
+ private escapeUntil;
45
+ get value(): string;
46
+ set value(value: string);
47
+ /** Host replacements are silent and excluded from the typing undo stack. */
48
+ setValue(value: string, options?: {
49
+ addToHistory?: boolean;
50
+ }): void;
51
+ get wrap(): boolean;
52
+ set wrap(value: boolean);
53
+ get completionSource(): CodeCompletionSource | undefined;
54
+ set completionSource(value: CodeCompletionSource | undefined);
55
+ get highlights(): readonly CodeHighlight[];
56
+ set highlights(value: readonly CodeHighlight[]);
57
+ private highlightExtension;
58
+ get language(): string;
59
+ set language(value: string);
60
+ get readonly(): boolean;
61
+ set readonly(value: boolean);
62
+ get label(): string;
63
+ set label(value: string);
64
+ get problems(): readonly CodeProblem[];
65
+ set problems(value: readonly CodeProblem[]);
66
+ get completions(): readonly CodeCompletion[];
67
+ set completions(value: readonly CodeCompletion[]);
68
+ get selection(): CodeSelection;
69
+ set selection(value: CodeSelection);
70
+ revealLine(line: number, options?: {
71
+ center?: boolean;
72
+ }): void;
73
+ focus(): void;
74
+ attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
75
+ connectedCallback(): void;
76
+ disconnectedCallback(): void;
77
+ protected renderTemplate(): void;
78
+ protected setupListeners(): void;
79
+ private languageExtension;
80
+ private completionExtension;
81
+ protected update(): void;
82
+ private flushChange;
83
+ private diagnostics;
84
+ private syncProblems;
85
+ navigateProblem(direction: number): void;
86
+ }