@deepfuture/dui-components 0.0.10 → 0.0.12

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 (62) hide show
  1. package/_deprecated/center/register.d.ts +1 -0
  2. package/_deprecated/center/register.js +4 -0
  3. package/_deprecated/hstack/register.d.ts +1 -0
  4. package/_deprecated/hstack/register.js +4 -0
  5. package/_deprecated/page-inset/register.d.ts +1 -0
  6. package/_deprecated/page-inset/register.js +4 -0
  7. package/_deprecated/vstack/register.d.ts +1 -0
  8. package/_deprecated/vstack/register.js +4 -0
  9. package/alert-dialog/alert-dialog.d.ts +2 -0
  10. package/alert-dialog/alert-dialog.js +12 -6
  11. package/all.d.ts +16 -64
  12. package/all.js +132 -144
  13. package/checkbox/checkbox-group.d.ts +2 -0
  14. package/checkbox/checkbox-group.js +12 -6
  15. package/checkbox/checkbox.d.ts +2 -0
  16. package/checkbox/checkbox.js +17 -11
  17. package/dialog/dialog.d.ts +2 -0
  18. package/dialog/dialog.js +12 -6
  19. package/global.d.ts +0 -8
  20. package/input/input.d.ts +2 -0
  21. package/input/input.js +24 -18
  22. package/menubar/menubar.d.ts +2 -0
  23. package/menubar/menubar.js +11 -5
  24. package/number-field/number-field.d.ts +2 -0
  25. package/number-field/number-field.js +18 -12
  26. package/package.json +2 -18
  27. package/popover/popover.d.ts +2 -1
  28. package/popover/popover.js +14 -8
  29. package/preview-card/preview-card.d.ts +2 -1
  30. package/preview-card/preview-card.js +14 -8
  31. package/radio/radio-group.d.ts +2 -0
  32. package/radio/radio-group.js +12 -6
  33. package/radio/radio.d.ts +2 -0
  34. package/radio/radio.js +15 -9
  35. package/select/select.d.ts +2 -0
  36. package/select/select.js +19 -13
  37. package/sidebar/sidebar-provider.d.ts +2 -0
  38. package/sidebar/sidebar-provider.js +12 -6
  39. package/switch/switch.d.ts +2 -0
  40. package/switch/switch.js +15 -9
  41. package/toggle/toggle-group.d.ts +2 -0
  42. package/toggle/toggle-group.js +12 -6
  43. package/toggle/toggle.d.ts +2 -0
  44. package/toggle/toggle.js +15 -9
  45. package/tooltip/tooltip.d.ts +2 -1
  46. package/tooltip/tooltip.js +14 -8
  47. /package/{center → _deprecated/center}/center.d.ts +0 -0
  48. /package/{center → _deprecated/center}/center.js +0 -0
  49. /package/{center → _deprecated/center}/index.d.ts +0 -0
  50. /package/{center → _deprecated/center}/index.js +0 -0
  51. /package/{hstack → _deprecated/hstack}/hstack.d.ts +0 -0
  52. /package/{hstack → _deprecated/hstack}/hstack.js +0 -0
  53. /package/{hstack → _deprecated/hstack}/index.d.ts +0 -0
  54. /package/{hstack → _deprecated/hstack}/index.js +0 -0
  55. /package/{page-inset → _deprecated/page-inset}/index.d.ts +0 -0
  56. /package/{page-inset → _deprecated/page-inset}/index.js +0 -0
  57. /package/{page-inset → _deprecated/page-inset}/page-inset.d.ts +0 -0
  58. /package/{page-inset → _deprecated/page-inset}/page-inset.js +0 -0
  59. /package/{vstack → _deprecated/vstack}/index.d.ts +0 -0
  60. /package/{vstack → _deprecated/vstack}/index.js +0 -0
  61. /package/{vstack → _deprecated/vstack}/vstack.d.ts +0 -0
  62. /package/{vstack → _deprecated/vstack}/vstack.js +0 -0
@@ -6,10 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  import { css, html, LitElement, nothing } from "lit";
9
- import { property } from "lit/decorators.js";
9
+ import { property, state } from "lit/decorators.js";
10
10
  import { ContextConsumer } from "@lit/context";
11
+ import { consume } from "@lit/context";
11
12
  import { base } from "@deepfuture/dui-core/base";
12
13
  import { customEvent } from "@deepfuture/dui-core/event";
14
+ import { fieldContext } from "../field/field-context.js";
13
15
  import { checkboxGroupContext } from "./checkbox-group-context.js";
14
16
  export const checkedChangeEvent = customEvent("checked-change", { bubbles: true, composed: true });
15
17
  /** Structural styles only — layout and behavioral CSS. */
@@ -149,9 +151,9 @@ export class DuiCheckbox extends LitElement {
149
151
  context: checkboxGroupContext,
150
152
  subscribe: true,
151
153
  });
152
- #fieldCtx_accessor_storage;
153
- get #fieldCtx() { return this.#fieldCtx_accessor_storage; }
154
- set #fieldCtx(value) { this.#fieldCtx_accessor_storage = value; }
154
+ #_fieldCtx_accessor_storage;
155
+ get _fieldCtx() { return this.#_fieldCtx_accessor_storage; }
156
+ set _fieldCtx(value) { this.#_fieldCtx_accessor_storage = value; }
155
157
  get #isChecked() {
156
158
  const ctx = this.#groupCtx.value;
157
159
  if (ctx && this.value !== undefined) {
@@ -174,10 +176,10 @@ export class DuiCheckbox extends LitElement {
174
176
  get #isDisabled() {
175
177
  return (this.disabled ||
176
178
  (this.#groupCtx.value?.disabled ?? false) ||
177
- (this.#fieldCtx?.disabled ?? false));
179
+ (this._fieldCtx?.disabled ?? false));
178
180
  }
179
181
  get #isInvalid() {
180
- return this.#fieldCtx?.invalid ?? false;
182
+ return this._fieldCtx?.invalid ?? false;
181
183
  }
182
184
  connectedCallback() {
183
185
  super.connectedCallback();
@@ -205,8 +207,8 @@ export class DuiCheckbox extends LitElement {
205
207
  else {
206
208
  ctx.toggle(this.value);
207
209
  }
208
- this.#fieldCtx?.markDirty();
209
- this.#fieldCtx?.markTouched();
210
+ this._fieldCtx?.markDirty();
211
+ this._fieldCtx?.markTouched();
210
212
  return;
211
213
  }
212
214
  // Standalone behavior
@@ -215,8 +217,8 @@ export class DuiCheckbox extends LitElement {
215
217
  this.#internalChecked = newChecked;
216
218
  this.indeterminate = false;
217
219
  }
218
- this.#fieldCtx?.markDirty();
219
- this.#fieldCtx?.markTouched();
220
+ this._fieldCtx?.markDirty();
221
+ this._fieldCtx?.markTouched();
220
222
  this.dispatchEvent(checkedChangeEvent({
221
223
  checked: newChecked,
222
224
  indeterminate: false,
@@ -234,7 +236,7 @@ export class DuiCheckbox extends LitElement {
234
236
  const isDisabled = this.#isDisabled;
235
237
  const isInvalid = this.#isInvalid;
236
238
  const showIndicator = isChecked || isIndeterminate;
237
- const controlId = this.#fieldCtx?.controlId ?? "";
239
+ const controlId = this._fieldCtx?.controlId ?? "";
238
240
  return html `
239
241
  <span
240
242
  part="root"
@@ -311,3 +313,7 @@ __decorate([
311
313
  __decorate([
312
314
  property({ type: Boolean })
313
315
  ], DuiCheckbox.prototype, "parent", null);
316
+ __decorate([
317
+ consume({ context: fieldContext, subscribe: true }),
318
+ state()
319
+ ], DuiCheckbox.prototype, "_fieldCtx", null);
@@ -1,5 +1,6 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/dialog */
2
2
  import { LitElement, type TemplateResult } from "lit";
3
+ import { type DialogContext } from "./dialog-context.js";
3
4
  export type DialogOpenChangeDetail = {
4
5
  open: boolean;
5
6
  };
@@ -24,6 +25,7 @@ export declare class DuiDialog extends LitElement {
24
25
  accessor open: boolean | undefined;
25
26
  /** Initial open state for uncontrolled mode. */
26
27
  accessor defaultOpen: boolean;
28
+ accessor _ctx: DialogContext;
27
29
  connectedCallback(): void;
28
30
  willUpdate(): void;
29
31
  render(): TemplateResult;
package/dialog/dialog.js CHANGED
@@ -6,9 +6,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  import { css, html, LitElement } from "lit";
9
- import { property } from "lit/decorators.js";
9
+ import { property, state } from "lit/decorators.js";
10
+ import { provide } from "@lit/context";
10
11
  import { base } from "@deepfuture/dui-core/base";
11
12
  import { customEvent } from "@deepfuture/dui-core/event";
13
+ import { dialogContext } from "./dialog-context.js";
12
14
  export const openChangeEvent = customEvent("open-change", { bubbles: true, composed: true });
13
15
  const hostStyles = css `
14
16
  :host {
@@ -61,9 +63,9 @@ export class DuiDialog extends LitElement {
61
63
  }
62
64
  this.dispatchEvent(openChangeEvent({ open: false }));
63
65
  };
64
- #ctx_accessor_storage = this.#buildContext();
65
- get #ctx() { return this.#ctx_accessor_storage; }
66
- set #ctx(value) { this.#ctx_accessor_storage = value; }
66
+ #_ctx_accessor_storage = this.#buildContext();
67
+ get _ctx() { return this.#_ctx_accessor_storage; }
68
+ set _ctx(value) { this.#_ctx_accessor_storage = value; }
67
69
  #buildContext() {
68
70
  return {
69
71
  open: this.#isOpen,
@@ -80,10 +82,10 @@ export class DuiDialog extends LitElement {
80
82
  if (this.open === undefined && this.defaultOpen) {
81
83
  this.#internalOpen = true;
82
84
  }
83
- this.#ctx = this.#buildContext();
85
+ this._ctx = this.#buildContext();
84
86
  }
85
87
  willUpdate() {
86
- this.#ctx = this.#buildContext();
88
+ this._ctx = this.#buildContext();
87
89
  }
88
90
  render() {
89
91
  return html `<slot></slot>`;
@@ -95,3 +97,7 @@ __decorate([
95
97
  __decorate([
96
98
  property({ type: Boolean, attribute: "default-open" })
97
99
  ], DuiDialog.prototype, "defaultOpen", null);
100
+ __decorate([
101
+ provide({ context: dialogContext }),
102
+ state()
103
+ ], DuiDialog.prototype, "_ctx", null);
package/global.d.ts CHANGED
@@ -22,7 +22,6 @@ import type { DuiBreadcrumbSeparator } from "./breadcrumb/breadcrumb-separator.j
22
22
  import type { DuiBreadcrumbEllipsis } from "./breadcrumb/breadcrumb-ellipsis.js";
23
23
  import type { DuiButton } from "./button/button.js";
24
24
  import type { DuiCalendar } from "./calendar/calendar.js";
25
- import type { DuiCenter } from "./center/center.js";
26
25
  import type { DuiCheckbox } from "./checkbox/checkbox.js";
27
26
  import type { DuiCheckboxGroup } from "./checkbox/checkbox-group.js";
28
27
  import type { DuiCollapsible } from "./collapsible/collapsible.js";
@@ -41,7 +40,6 @@ import type { DuiDialogTrigger } from "./dialog/dialog-trigger.js";
41
40
  import type { DuiDialogPopup } from "./dialog/dialog-popup.js";
42
41
  import type { DuiDialogClose } from "./dialog/dialog-close.js";
43
42
  import type { DuiDropzone } from "./dropzone/dropzone.js";
44
- import type { DuiHstack } from "./hstack/hstack.js";
45
43
  import type { DuiIcon } from "./icon/icon.js";
46
44
  import type { DuiInput } from "./input/input.js";
47
45
  import type { DuiLink } from "./link/link.js";
@@ -49,7 +47,6 @@ import type { DuiMenu } from "./menu/menu.js";
49
47
  import type { DuiMenuItem } from "./menu/menu-item.js";
50
48
  import type { DuiMenubar } from "./menubar/menubar.js";
51
49
  import type { DuiNumberField } from "./number-field/number-field.js";
52
- import type { DuiPageInset } from "./page-inset/page-inset.js";
53
50
  import type { DuiPopover } from "./popover/popover.js";
54
51
  import type { DuiPopoverTrigger } from "./popover/popover-trigger.js";
55
52
  import type { DuiPopoverPopup } from "./popover/popover-popup.js";
@@ -93,7 +90,6 @@ import type { DuiTooltip } from "./tooltip/tooltip.js";
93
90
  import type { DuiTooltipTrigger } from "./tooltip/tooltip-trigger.js";
94
91
  import type { DuiTooltipPopup } from "./tooltip/tooltip-popup.js";
95
92
  import type { DuiTrunc } from "./trunc/trunc.js";
96
- import type { DuiVstack } from "./vstack/vstack.js";
97
93
 
98
94
  declare global {
99
95
  interface HTMLElementTagNameMap {
@@ -113,7 +109,6 @@ declare global {
113
109
  "dui-breadcrumb-ellipsis": DuiBreadcrumbEllipsis;
114
110
  "dui-button": DuiButton;
115
111
  "dui-calendar": DuiCalendar;
116
- "dui-center": DuiCenter;
117
112
  "dui-checkbox": DuiCheckbox;
118
113
  "dui-checkbox-group": DuiCheckboxGroup;
119
114
  "dui-collapsible": DuiCollapsible;
@@ -132,7 +127,6 @@ declare global {
132
127
  "dui-dialog-popup": DuiDialogPopup;
133
128
  "dui-dialog-close": DuiDialogClose;
134
129
  "dui-dropzone": DuiDropzone;
135
- "dui-hstack": DuiHstack;
136
130
  "dui-icon": DuiIcon;
137
131
  "dui-input": DuiInput;
138
132
  "dui-link": DuiLink;
@@ -140,7 +134,6 @@ declare global {
140
134
  "dui-menu-item": DuiMenuItem;
141
135
  "dui-menubar": DuiMenubar;
142
136
  "dui-number-field": DuiNumberField;
143
- "dui-page-inset": DuiPageInset;
144
137
  "dui-popover": DuiPopover;
145
138
  "dui-popover-trigger": DuiPopoverTrigger;
146
139
  "dui-popover-popup": DuiPopoverPopup;
@@ -184,6 +177,5 @@ declare global {
184
177
  "dui-tooltip-trigger": DuiTooltipTrigger;
185
178
  "dui-tooltip-popup": DuiTooltipPopup;
186
179
  "dui-trunc": DuiTrunc;
187
- "dui-vstack": DuiVstack;
188
180
  }
189
181
  }
package/input/input.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/input */
2
2
  import { LitElement, type TemplateResult } from "lit";
3
+ import { type FieldContext } from "@deepfuture/dui-components/field";
3
4
  export declare const inputChangeEvent: (detail: {
4
5
  value: string;
5
6
  }) => CustomEvent<{
@@ -42,6 +43,7 @@ export declare class DuiInput extends LitElement {
42
43
  accessor autocomplete: string | undefined;
43
44
  /** Whether the input should receive focus on mount. */
44
45
  accessor autofocus: boolean;
46
+ accessor _fieldCtx: FieldContext;
45
47
  firstUpdated(): void;
46
48
  render(): TemplateResult;
47
49
  }
package/input/input.js CHANGED
@@ -6,10 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  import { css, html, LitElement } from "lit";
9
- import { property } from "lit/decorators.js";
9
+ import { property, state } from "lit/decorators.js";
10
+ import { consume } from "@lit/context";
10
11
  import { ifDefined } from "lit/directives/if-defined.js";
11
12
  import { live } from "lit/directives/live.js";
12
13
  import { base } from "@deepfuture/dui-core/base";
14
+ import { fieldContext } from "@deepfuture/dui-components/field";
13
15
  import { customEvent } from "@deepfuture/dui-core/event";
14
16
  export const inputChangeEvent = customEvent("input-change", {
15
17
  bubbles: true,
@@ -94,23 +96,23 @@ export class DuiInput extends LitElement {
94
96
  /** Whether the input should receive focus on mount. */
95
97
  get autofocus() { return this.#autofocus_accessor_storage; }
96
98
  set autofocus(value) { this.#autofocus_accessor_storage = value; }
97
- #ctx_accessor_storage;
98
- get #ctx() { return this.#ctx_accessor_storage; }
99
- set #ctx(value) { this.#ctx_accessor_storage = value; }
99
+ #_fieldCtx_accessor_storage;
100
+ get _fieldCtx() { return this.#_fieldCtx_accessor_storage; }
101
+ set _fieldCtx(value) { this.#_fieldCtx_accessor_storage = value; }
100
102
  get #controlId() {
101
- return this.#ctx?.controlId ?? "";
103
+ return this._fieldCtx?.controlId ?? "";
102
104
  }
103
105
  get #descriptionId() {
104
- return this.#ctx?.descriptionId;
106
+ return this._fieldCtx?.descriptionId;
105
107
  }
106
108
  get #errorId() {
107
- return this.#ctx?.errorId;
109
+ return this._fieldCtx?.errorId;
108
110
  }
109
111
  get #isDisabled() {
110
- return this.disabled || (this.#ctx?.disabled ?? false);
112
+ return this.disabled || (this._fieldCtx?.disabled ?? false);
111
113
  }
112
114
  get #isInvalid() {
113
- return this.#ctx?.invalid ?? false;
115
+ return this._fieldCtx?.invalid ?? false;
114
116
  }
115
117
  firstUpdated() {
116
118
  if (this.autofocus) {
@@ -120,16 +122,16 @@ export class DuiInput extends LitElement {
120
122
  #onInput = (event) => {
121
123
  const target = event.target;
122
124
  this.value = target.value;
123
- this.#ctx?.markDirty();
124
- this.#ctx?.setFilled(this.value.length > 0);
125
+ this._fieldCtx?.markDirty();
126
+ this._fieldCtx?.setFilled(this.value.length > 0);
125
127
  this.dispatchEvent(inputChangeEvent({ value: this.value }));
126
128
  };
127
129
  #onFocus = () => {
128
- this.#ctx?.setFocused(true);
130
+ this._fieldCtx?.setFocused(true);
129
131
  };
130
132
  #onBlur = () => {
131
- this.#ctx?.setFocused(false);
132
- this.#ctx?.markTouched();
133
+ this._fieldCtx?.setFocused(false);
134
+ this._fieldCtx?.markTouched();
133
135
  };
134
136
  render() {
135
137
  const describedBy = [this.#descriptionId, this.#isInvalid ? this.#errorId : undefined]
@@ -155,10 +157,10 @@ export class DuiInput extends LitElement {
155
157
  ?data-disabled="${this.#isDisabled}"
156
158
  ?data-invalid="${this.#isInvalid}"
157
159
  ?data-valid="${!this.#isInvalid}"
158
- ?data-dirty="${this.#ctx?.dirty}"
159
- ?data-touched="${this.#ctx?.touched}"
160
- ?data-filled="${this.#ctx?.filled}"
161
- ?data-focused="${this.#ctx?.focused}"
160
+ ?data-dirty="${this._fieldCtx?.dirty}"
161
+ ?data-touched="${this._fieldCtx?.touched}"
162
+ ?data-filled="${this._fieldCtx?.filled}"
163
+ ?data-focused="${this._fieldCtx?.focused}"
162
164
  @input="${this.#onInput}"
163
165
  @focus="${this.#onFocus}"
164
166
  @blur="${this.#onBlur}"
@@ -202,3 +204,7 @@ __decorate([
202
204
  __decorate([
203
205
  property({ type: Boolean })
204
206
  ], DuiInput.prototype, "autofocus", null);
207
+ __decorate([
208
+ consume({ context: fieldContext, subscribe: true }),
209
+ state()
210
+ ], DuiInput.prototype, "_fieldCtx", null);
@@ -1,4 +1,5 @@
1
1
  import { LitElement, type TemplateResult } from "lit";
2
+ import { type MenubarContext } from "./menubar-context.js";
2
3
  /**
3
4
  * `<dui-menubar>` — A horizontal bar of menus with coordinated open/close.
4
5
  *
@@ -14,6 +15,7 @@ export declare class DuiMenubar extends LitElement {
14
15
  static styles: import("lit").CSSResult[];
15
16
  accessor loop: boolean;
16
17
  accessor orientation: "horizontal" | "vertical";
18
+ accessor _ctx: MenubarContext;
17
19
  willUpdate(): void;
18
20
  render(): TemplateResult;
19
21
  }
@@ -5,8 +5,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { css, html, LitElement } from "lit";
8
- import { property } from "lit/decorators.js";
8
+ import { property, state } from "lit/decorators.js";
9
+ import { provide } from "@lit/context";
9
10
  import { base } from "@deepfuture/dui-core/base";
11
+ import { menubarContext, } from "./menubar-context.js";
10
12
  /** Structural styles only — layout CSS. */
11
13
  const styles = css `
12
14
  :host {
@@ -82,9 +84,9 @@ export class DuiMenubar extends LitElement {
82
84
  const trigger = nextMenu.querySelector('[slot="trigger"]');
83
85
  trigger?.focus();
84
86
  };
85
- #ctx_accessor_storage = this.#buildContext();
86
- get #ctx() { return this.#ctx_accessor_storage; }
87
- set #ctx(value) { this.#ctx_accessor_storage = value; }
87
+ #_ctx_accessor_storage = this.#buildContext();
88
+ get _ctx() { return this.#_ctx_accessor_storage; }
89
+ set _ctx(value) { this.#_ctx_accessor_storage = value; }
88
90
  #buildContext() {
89
91
  return {
90
92
  activeMenuId: this.#activeMenuId,
@@ -94,7 +96,7 @@ export class DuiMenubar extends LitElement {
94
96
  };
95
97
  }
96
98
  willUpdate() {
97
- this.#ctx = this.#buildContext();
99
+ this._ctx = this.#buildContext();
98
100
  }
99
101
  #onKeyDown = (e) => {
100
102
  const isHorizontal = this.orientation === "horizontal";
@@ -128,3 +130,7 @@ __decorate([
128
130
  __decorate([
129
131
  property({ reflect: true })
130
132
  ], DuiMenubar.prototype, "orientation", null);
133
+ __decorate([
134
+ provide({ context: menubarContext }),
135
+ state()
136
+ ], DuiMenubar.prototype, "_ctx", null);
@@ -1,4 +1,5 @@
1
1
  import { LitElement, type TemplateResult } from "lit";
2
+ import { type FieldContext } from "@deepfuture/dui-components/field";
2
3
  export declare const valueChangeEvent: (detail: {
3
4
  value: number;
4
5
  }) => CustomEvent<{
@@ -28,6 +29,7 @@ export declare class DuiNumberField extends LitElement {
28
29
  accessor readOnly: boolean;
29
30
  accessor required: boolean;
30
31
  accessor name: string | undefined;
32
+ accessor _fieldCtx: FieldContext;
31
33
  connectedCallback(): void;
32
34
  willUpdate(): void;
33
35
  render(): TemplateResult;
@@ -5,10 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { css, html, LitElement, nothing } from "lit";
8
- import { property } from "lit/decorators.js";
8
+ import { property, state } from "lit/decorators.js";
9
+ import { consume } from "@lit/context";
9
10
  import { live } from "lit/directives/live.js";
10
11
  import { base } from "@deepfuture/dui-core/base";
11
12
  import { customEvent } from "@deepfuture/dui-core/event";
13
+ import { fieldContext } from "@deepfuture/dui-components/field";
12
14
  export const valueChangeEvent = customEvent("value-change", { bubbles: true, composed: true });
13
15
  /** Structural styles only — layout CSS. */
14
16
  const styles = css `
@@ -117,17 +119,17 @@ export class DuiNumberField extends LitElement {
117
119
  #inputText_accessor_storage = "";
118
120
  get #inputText() { return this.#inputText_accessor_storage; }
119
121
  set #inputText(value) { this.#inputText_accessor_storage = value; }
120
- #fieldCtx_accessor_storage;
121
- get #fieldCtx() { return this.#fieldCtx_accessor_storage; }
122
- set #fieldCtx(value) { this.#fieldCtx_accessor_storage = value; }
122
+ #_fieldCtx_accessor_storage;
123
+ get _fieldCtx() { return this.#_fieldCtx_accessor_storage; }
124
+ set _fieldCtx(value) { this.#_fieldCtx_accessor_storage = value; }
123
125
  get #currentValue() {
124
126
  return this.value ?? this.#internalValue;
125
127
  }
126
128
  get #isDisabled() {
127
- return this.disabled || (this.#fieldCtx?.disabled ?? false);
129
+ return this.disabled || (this._fieldCtx?.disabled ?? false);
128
130
  }
129
131
  get #isInvalid() {
130
- return this.#fieldCtx?.invalid ?? false;
132
+ return this._fieldCtx?.invalid ?? false;
131
133
  }
132
134
  get #canDecrement() {
133
135
  const v = this.#currentValue;
@@ -167,8 +169,8 @@ export class DuiNumberField extends LitElement {
167
169
  if (this.value === undefined) {
168
170
  this.#internalValue = clamped;
169
171
  }
170
- this.#fieldCtx?.markDirty();
171
- this.#fieldCtx?.setFilled(true);
172
+ this._fieldCtx?.markDirty();
173
+ this._fieldCtx?.setFilled(true);
172
174
  this.dispatchEvent(valueChangeEvent({ value: clamped }));
173
175
  }
174
176
  #increment = (amount) => {
@@ -197,11 +199,11 @@ export class DuiNumberField extends LitElement {
197
199
  };
198
200
  #onBlur = () => {
199
201
  this.#commitInput();
200
- this.#fieldCtx?.setFocused(false);
201
- this.#fieldCtx?.markTouched();
202
+ this._fieldCtx?.setFocused(false);
203
+ this._fieldCtx?.markTouched();
202
204
  };
203
205
  #onFocus = () => {
204
- this.#fieldCtx?.setFocused(true);
206
+ this._fieldCtx?.setFocused(true);
205
207
  };
206
208
  #onKeyDown = (e) => {
207
209
  switch (e.key) {
@@ -239,7 +241,7 @@ export class DuiNumberField extends LitElement {
239
241
  render() {
240
242
  const isDisabled = this.#isDisabled;
241
243
  const isInvalid = this.#isInvalid;
242
- const controlId = this.#fieldCtx?.controlId ?? "";
244
+ const controlId = this._fieldCtx?.controlId ?? "";
243
245
  const currentValue = this.#currentValue;
244
246
  return html `
245
247
  <div
@@ -324,3 +326,7 @@ __decorate([
324
326
  __decorate([
325
327
  property()
326
328
  ], DuiNumberField.prototype, "name", null);
329
+ __decorate([
330
+ consume({ context: fieldContext, subscribe: true }),
331
+ state()
332
+ ], DuiNumberField.prototype, "_fieldCtx", null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepfuture/dui-components",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "DUI unstyled web components — structural CSS only, themed via applyTheme()",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -94,22 +94,6 @@
94
94
  "import": "./trunc/index.js",
95
95
  "types": "./trunc/index.d.ts"
96
96
  },
97
- "./center": {
98
- "import": "./center/index.js",
99
- "types": "./center/index.d.ts"
100
- },
101
- "./hstack": {
102
- "import": "./hstack/index.js",
103
- "types": "./hstack/index.d.ts"
104
- },
105
- "./vstack": {
106
- "import": "./vstack/index.js",
107
- "types": "./vstack/index.d.ts"
108
- },
109
- "./page-inset": {
110
- "import": "./page-inset/index.js",
111
- "types": "./page-inset/index.d.ts"
112
- },
113
97
  "./link": {
114
98
  "import": "./link/index.js",
115
99
  "types": "./link/index.d.ts"
@@ -194,7 +178,7 @@
194
178
  "README.md"
195
179
  ],
196
180
  "dependencies": {
197
- "@deepfuture/dui-core": "0.0.10",
181
+ "@deepfuture/dui-core": "0.0.12",
198
182
  "lit": "^3.3.2",
199
183
  "@lit/context": "^1.1.3"
200
184
  },
@@ -1,6 +1,6 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/popover */
2
2
  import { LitElement, type PropertyValues, type TemplateResult } from "lit";
3
- import { type PopoverSide } from "./popover-context.js";
3
+ import { type PopoverContext, type PopoverSide } from "./popover-context.js";
4
4
  export type PopoverOpenChangeDetail = {
5
5
  open: boolean;
6
6
  };
@@ -23,6 +23,7 @@ export declare class DuiPopover extends LitElement {
23
23
  accessor side: PopoverSide;
24
24
  /** Offset from the trigger in pixels. */
25
25
  accessor sideOffset: number;
26
+ accessor _ctx: PopoverContext;
26
27
  connectedCallback(): void;
27
28
  disconnectedCallback(): void;
28
29
  protected willUpdate(changed: PropertyValues): void;
@@ -6,9 +6,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  import { css, html, LitElement } from "lit";
9
- import { property } from "lit/decorators.js";
9
+ import { property, state } from "lit/decorators.js";
10
+ import { provide } from "@lit/context";
10
11
  import { base } from "@deepfuture/dui-core/base";
11
12
  import { customEvent } from "@deepfuture/dui-core/event";
13
+ import { popoverContext, } from "./popover-context.js";
12
14
  export const openChangeEvent = customEvent("open-change", { bubbles: true, composed: true });
13
15
  const hostStyles = css `
14
16
  :host {
@@ -51,7 +53,7 @@ export class DuiPopover extends LitElement {
51
53
  }
52
54
  #triggerId = `popover-trigger-${crypto.randomUUID().slice(0, 8)}`;
53
55
  #popupId = `popover-popup-${crypto.randomUUID().slice(0, 8)}`;
54
- #ctx_accessor_storage = {
56
+ #_ctx_accessor_storage = {
55
57
  open: false,
56
58
  triggerId: this.#triggerId,
57
59
  popupId: this.#popupId,
@@ -63,8 +65,8 @@ export class DuiPopover extends LitElement {
63
65
  togglePopover: () => this.#doToggle(),
64
66
  setTriggerEl: (el) => this.#setTriggerEl(el),
65
67
  };
66
- get #ctx() { return this.#ctx_accessor_storage; }
67
- set #ctx(value) { this.#ctx_accessor_storage = value; }
68
+ get _ctx() { return this.#_ctx_accessor_storage; }
69
+ set _ctx(value) { this.#_ctx_accessor_storage = value; }
68
70
  connectedCallback() {
69
71
  super.connectedCallback();
70
72
  if (this.defaultOpen) {
@@ -80,10 +82,10 @@ export class DuiPopover extends LitElement {
80
82
  if (changed.has("open") ||
81
83
  changed.has("side") ||
82
84
  changed.has("sideOffset") ||
83
- this.#ctx.open !== this.#isOpen ||
84
- this.#ctx.triggerEl !== this.#triggerEl) {
85
- this.#ctx = {
86
- ...this.#ctx,
85
+ this._ctx.open !== this.#isOpen ||
86
+ this._ctx.triggerEl !== this.#triggerEl) {
87
+ this._ctx = {
88
+ ...this._ctx,
87
89
  open: this.#isOpen,
88
90
  side: this.side,
89
91
  sideOffset: this.sideOffset,
@@ -138,3 +140,7 @@ __decorate([
138
140
  __decorate([
139
141
  property({ type: Number, attribute: "side-offset" })
140
142
  ], DuiPopover.prototype, "sideOffset", null);
143
+ __decorate([
144
+ provide({ context: popoverContext }),
145
+ state()
146
+ ], DuiPopover.prototype, "_ctx", null);
@@ -1,6 +1,6 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/preview-card */
2
2
  import { LitElement, type PropertyValues, type TemplateResult } from "lit";
3
- import { type PreviewCardSide } from "./preview-card-context.js";
3
+ import { type PreviewCardContext, type PreviewCardSide } from "./preview-card-context.js";
4
4
  export type PreviewCardOpenChangeDetail = {
5
5
  open: boolean;
6
6
  };
@@ -27,6 +27,7 @@ export declare class DuiPreviewCard extends LitElement {
27
27
  accessor delay: number;
28
28
  /** Delay before closing in milliseconds. */
29
29
  accessor closeDelay: number;
30
+ accessor _ctx: PreviewCardContext;
30
31
  connectedCallback(): void;
31
32
  disconnectedCallback(): void;
32
33
  protected willUpdate(changed: PropertyValues): void;
@@ -6,9 +6,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  import { css, html, LitElement } from "lit";
9
- import { property } from "lit/decorators.js";
9
+ import { property, state } from "lit/decorators.js";
10
+ import { provide } from "@lit/context";
10
11
  import { base } from "@deepfuture/dui-core/base";
11
12
  import { customEvent } from "@deepfuture/dui-core/event";
13
+ import { previewCardContext, } from "./preview-card-context.js";
12
14
  export const openChangeEvent = customEvent("open-change", { bubbles: true, composed: true });
13
15
  const hostStyles = css `
14
16
  :host {
@@ -58,7 +60,7 @@ export class DuiPreviewCard extends LitElement {
58
60
  #closeTimeout;
59
61
  #triggerId = `preview-card-trigger-${crypto.randomUUID().slice(0, 8)}`;
60
62
  #popupId = `preview-card-popup-${crypto.randomUUID().slice(0, 8)}`;
61
- #ctx_accessor_storage = {
63
+ #_ctx_accessor_storage = {
62
64
  open: false,
63
65
  triggerId: this.#triggerId,
64
66
  popupId: this.#popupId,
@@ -69,8 +71,8 @@ export class DuiPreviewCard extends LitElement {
69
71
  closePreviewCard: () => this.#scheduleClose(),
70
72
  setTriggerEl: (el) => this.#setTriggerEl(el),
71
73
  };
72
- get #ctx() { return this.#ctx_accessor_storage; }
73
- set #ctx(value) { this.#ctx_accessor_storage = value; }
74
+ get _ctx() { return this.#_ctx_accessor_storage; }
75
+ set _ctx(value) { this.#_ctx_accessor_storage = value; }
74
76
  connectedCallback() {
75
77
  super.connectedCallback();
76
78
  if (this.defaultOpen) {
@@ -86,10 +88,10 @@ export class DuiPreviewCard extends LitElement {
86
88
  if (changed.has("open") ||
87
89
  changed.has("side") ||
88
90
  changed.has("sideOffset") ||
89
- this.#ctx.open !== isOpen ||
90
- this.#ctx.triggerEl !== this.#triggerEl) {
91
- this.#ctx = {
92
- ...this.#ctx,
91
+ this._ctx.open !== isOpen ||
92
+ this._ctx.triggerEl !== this.#triggerEl) {
93
+ this._ctx = {
94
+ ...this._ctx,
93
95
  open: isOpen,
94
96
  side: this.side,
95
97
  sideOffset: this.sideOffset,
@@ -162,3 +164,7 @@ __decorate([
162
164
  __decorate([
163
165
  property({ type: Number, attribute: "close-delay" })
164
166
  ], DuiPreviewCard.prototype, "closeDelay", null);
167
+ __decorate([
168
+ provide({ context: previewCardContext }),
169
+ state()
170
+ ], DuiPreviewCard.prototype, "_ctx", null);
@@ -1,5 +1,6 @@
1
1
  /** Ported from original DUI: deep-future-app/app/client/components/dui/radio */
2
2
  import { LitElement, type TemplateResult } from "lit";
3
+ import { type RadioGroupContext } from "./radio-group-context.js";
3
4
  export declare const valueChangeEvent: (detail: {
4
5
  value: string;
5
6
  }) => CustomEvent<{
@@ -31,6 +32,7 @@ export declare class DuiRadioGroup extends LitElement {
31
32
  accessor readOnly: boolean;
32
33
  /** Whether a selection is required. */
33
34
  accessor required: boolean;
35
+ accessor _ctx: RadioGroupContext;
34
36
  connectedCallback(): void;
35
37
  willUpdate(): void;
36
38
  render(): TemplateResult;