@oscarpalmer/oui 0.26.0 → 0.26.1

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,6 +7,10 @@ declare class OuiDialog {
7
7
  * Is the dialog open?
8
8
  */
9
9
  get open(): boolean;
10
+ /**
11
+ * Open or close the dialog
12
+ */
13
+ set open(value: boolean);
10
14
  constructor(state: OuiDialogState);
11
15
  /**
12
16
  * Closes the dialog by request
@@ -10,6 +10,13 @@ var OuiDialog = class {
10
10
  get open() {
11
11
  return this.#state.element.open;
12
12
  }
13
+ /**
14
+ * Open or close the dialog
15
+ */
16
+ set open(value) {
17
+ if (value === true) this.show();
18
+ else if (value === false) this.hide();
19
+ }
13
20
  constructor(state) {
14
21
  this.#state = state;
15
22
  }
@@ -3,39 +3,39 @@ import { RemovableEventListener } from "@oscarpalmer/toretto/models";
3
3
  //#region src/js/floatable/embedded.d.ts
4
4
  type CreateOuiFloatableOptions = {
5
5
  /**
6
- * Open the _OuiFloatable_ when created? _(defaults to `true`)_
6
+ * Open the floatable when created? _(defaults to `true`)_
7
7
  */
8
8
  open?: boolean;
9
9
  /**
10
- * Position of the _OuiFloatable_ _(defaults to `below`)_
10
+ * Position of the floatable _(defaults to `below`)_
11
11
  */
12
12
  position?: OuiFloatablePosition;
13
13
  };
14
14
  declare class OuiFloatable {
15
15
  #private;
16
16
  /**
17
- * Is the _OuiFloatable_ open?
17
+ * Is the floatable open?
18
18
  */
19
19
  get open(): boolean;
20
20
  /**
21
- * Open or close the _OuiFloatable_
21
+ * Open or close the floatable
22
22
  */
23
23
  set open(value: boolean);
24
24
  constructor(state: OuiFloatableState, standalone: boolean);
25
25
  /**
26
- * Destroy the _OuiFloatable_, removing it from the DOM and cleaning up references
26
+ * Destroy the floatable, removing it from the DOM and cleaning up references
27
27
  */
28
28
  destroy(): void;
29
29
  /**
30
- * Closes the _OuiFloatable_
30
+ * Closes the floatable
31
31
  */
32
32
  hide(): void;
33
33
  /**
34
- * Opens the _OuiFloatable_
34
+ * Opens the floatable
35
35
  */
36
36
  show(): void;
37
37
  /**
38
- * Update the position of the _OuiFloatable_, with an optional new position
38
+ * Update the position of the floatable, with an optional new position
39
39
  *
40
40
  * @param position Optional new position
41
41
  */
@@ -1,2 +1,2 @@
1
- import { a as createEmbeddedFloatable, c as removeFloatable, i as OuiFloatablePosition, n as OuiFloatable, o as createFloatable, r as OuiFloatableOptions, s as getOnBeforeToggleListener, t as ATTRIBUTE_FLOATABLE } from "../embedded-ai6cqURc.mjs";
1
+ import { a as createEmbeddedFloatable, c as removeFloatable, i as OuiFloatablePosition, n as OuiFloatable, o as createFloatable, r as OuiFloatableOptions, s as getOnBeforeToggleListener, t as ATTRIBUTE_FLOATABLE } from "../embedded-CSOh5njI.mjs";
2
2
  export { ATTRIBUTE_FLOATABLE, OuiFloatable, OuiFloatableOptions, OuiFloatablePosition, createEmbeddedFloatable, createFloatable, getOnBeforeToggleListener, removeFloatable };
@@ -6,13 +6,13 @@ var OuiFloatable = class {
6
6
  #destroyed = false;
7
7
  #state;
8
8
  /**
9
- * Is the _OuiFloatable_ open?
9
+ * Is the floatable open?
10
10
  */
11
11
  get open() {
12
12
  return this.#state.content.checkVisibility();
13
13
  }
14
14
  /**
15
- * Open or close the _OuiFloatable_
15
+ * Open or close the floatable
16
16
  */
17
17
  set open(value) {
18
18
  if (value === true) this.show();
@@ -30,7 +30,7 @@ var OuiFloatable = class {
30
30
  content.style.positionAnchor = anchorName;
31
31
  }
32
32
  /**
33
- * Destroy the _OuiFloatable_, removing it from the DOM and cleaning up references
33
+ * Destroy the floatable, removing it from the DOM and cleaning up references
34
34
  */
35
35
  destroy() {
36
36
  if (this.#destroyed) return;
@@ -40,19 +40,19 @@ var OuiFloatable = class {
40
40
  this.#state.content = null;
41
41
  }
42
42
  /**
43
- * Closes the _OuiFloatable_
43
+ * Closes the floatable
44
44
  */
45
45
  hide() {
46
46
  if (!this.#destroyed && this.open) this.#state.content.hidePopover();
47
47
  }
48
48
  /**
49
- * Opens the _OuiFloatable_
49
+ * Opens the floatable
50
50
  */
51
51
  show() {
52
52
  if (!this.#destroyed && !this.open) this.#state.content.showPopover();
53
53
  }
54
54
  /**
55
- * Update the position of the _OuiFloatable_, with an optional new position
55
+ * Update the position of the floatable, with an optional new position
56
56
  *
57
57
  * @param position Optional new position
58
58
  */
@@ -1,2 +1,2 @@
1
- import { i as OuiFloatablePosition, n as OuiFloatable, o as createFloatable } from "../embedded-ai6cqURc.mjs";
1
+ import { i as OuiFloatablePosition, n as OuiFloatable, o as createFloatable } from "../embedded-CSOh5njI.mjs";
2
2
  export { type OuiFloatable, type OuiFloatablePosition, createFloatable };
@@ -1,5 +1,5 @@
1
1
  import { OuiDialog, getDialog } from "./dialog.mjs";
2
- import { i as OuiFloatablePosition, n as OuiFloatable, o as createFloatable } from "./embedded-ai6cqURc.mjs";
2
+ import { i as OuiFloatablePosition, n as OuiFloatable, o as createFloatable } from "./embedded-CSOh5njI.mjs";
3
3
  import { a as createFocusTrap, i as OuiFocusTrap } from "./embedded-CHK82Uh5.mjs";
4
4
  import { OuiPopover, getPopover } from "./popover.mjs";
5
5
  import { OuiSplitterElement } from "./splitter.mjs";
@@ -1,4 +1,4 @@
1
- import { n as OuiFloatable } from "./embedded-ai6cqURc.mjs";
1
+ import { n as OuiFloatable } from "./embedded-CSOh5njI.mjs";
2
2
  import { i as OuiFocusTrap } from "./embedded-CHK82Uh5.mjs";
3
3
  import { RemovableEventListener } from "@oscarpalmer/toretto/models";
4
4
 
@@ -9,6 +9,7 @@ declare class OuiPopover {
9
9
  * Is the popover open?
10
10
  */
11
11
  get open(): boolean;
12
+ set open(value: boolean);
12
13
  constructor(state: OuiPopoverState);
13
14
  /**
14
15
  * Closes the popover
@@ -12,6 +12,10 @@ var OuiPopover = class {
12
12
  get open() {
13
13
  return this.#state.content.checkVisibility();
14
14
  }
15
+ set open(value) {
16
+ if (value === true) this.show();
17
+ else if (value === false) this.hide();
18
+ }
15
19
  constructor(state) {
16
20
  this.#state = state;
17
21
  this.#state.floatable.update();
@@ -7,13 +7,37 @@ declare global {
7
7
  declare class OuiSplitterElement extends HTMLElement {
8
8
  #private;
9
9
  static readonly observedAttributes: string[];
10
+ /**
11
+ * Maximum size for the first panel
12
+ */
10
13
  get max(): number;
14
+ /**
15
+ * Maximum size for the first panel
16
+ */
11
17
  set max(value: number);
18
+ /**
19
+ * Minimum size for the first panel
20
+ */
12
21
  get min(): number;
22
+ /**
23
+ * Minimum size for the first panel
24
+ */
13
25
  set min(value: number);
26
+ /**
27
+ * Current size for the first panel
28
+ */
14
29
  get size(): number;
30
+ /**
31
+ * Current size for the first panel
32
+ */
15
33
  set size(value: number);
34
+ /**
35
+ * Orientation of the splitter
36
+ */
16
37
  get type(): string;
38
+ /**
39
+ * Orientation of the splitter
40
+ */
17
41
  set type(value: string);
18
42
  constructor();
19
43
  connectedCallback(): void;
@@ -62,29 +62,53 @@ var OuiSplitterElement = class extends HTMLElement {
62
62
  ATTRIBUTE_TYPE
63
63
  ];
64
64
  #splitter;
65
+ /**
66
+ * Maximum size for the first panel
67
+ */
65
68
  get max() {
66
69
  return this.#splitter.values.max;
67
70
  }
71
+ /**
72
+ * Maximum size for the first panel
73
+ */
68
74
  set max(value) {
69
75
  this.setAttribute(ATTRIBUTE_MAX, String(value));
70
76
  }
77
+ /**
78
+ * Minimum size for the first panel
79
+ */
71
80
  get min() {
72
81
  return this.#splitter.values.min;
73
82
  }
83
+ /**
84
+ * Minimum size for the first panel
85
+ */
74
86
  set min(value) {
75
- this.setAttribute("min", String(value));
87
+ this.setAttribute(ATTRIBUTE_MIN, String(value));
76
88
  }
89
+ /**
90
+ * Current size for the first panel
91
+ */
77
92
  get size() {
78
93
  return this.#splitter.values.now.current;
79
94
  }
95
+ /**
96
+ * Current size for the first panel
97
+ */
80
98
  set size(value) {
81
- this.setAttribute("size", String(value));
99
+ this.setAttribute(ATTRIBUTE_SIZE, String(value));
82
100
  }
101
+ /**
102
+ * Orientation of the splitter
103
+ */
83
104
  get type() {
84
- return this.getAttribute("type") ?? "vertical";
105
+ return this.getAttribute(ATTRIBUTE_TYPE) ?? "vertical";
85
106
  }
107
+ /**
108
+ * Orientation of the splitter
109
+ */
86
110
  set type(value) {
87
- this.setAttribute("type", value);
111
+ this.setAttribute(ATTRIBUTE_TYPE, value);
88
112
  }
89
113
  constructor() {
90
114
  super();
@@ -1,4 +1,4 @@
1
- import { n as OuiFloatable } from "./embedded-ai6cqURc.mjs";
1
+ import { n as OuiFloatable } from "./embedded-CSOh5njI.mjs";
2
2
 
3
3
  //#region src/js/tooltip.d.ts
4
4
  declare class OuiTooltip {
@@ -7,6 +7,10 @@ declare class OuiTooltip {
7
7
  * Is the tooltip open?
8
8
  */
9
9
  get open(): boolean;
10
+ /**
11
+ * Open or close the tooltip
12
+ */
13
+ set open(value: boolean);
10
14
  constructor(state: OuiTooltipState);
11
15
  /**
12
16
  * Closes the tooltip
@@ -24,6 +28,12 @@ type OuiTooltipState = {
24
28
  timer?: number;
25
29
  tooltip: OuiTooltip;
26
30
  };
31
+ /**
32
+ * Get the _OuiTooltip_ for an element
33
+ *
34
+ * @param element Element to get _OuiTooltip_ for
35
+ * @returns _OuiTooltip_ instance
36
+ */
27
37
  declare function getTooltip(element: HTMLElement): OuiTooltip | undefined;
28
38
  /**
29
39
  * Set the delay before showing the tooltip, in milliseconds
@@ -14,6 +14,13 @@ var OuiTooltip = class {
14
14
  get open() {
15
15
  return this.#state.content.checkVisibility();
16
16
  }
17
+ /**
18
+ * Open or close the tooltip
19
+ */
20
+ set open(value) {
21
+ if (value === true) this.show();
22
+ else if (value === false) this.hide();
23
+ }
17
24
  constructor(state) {
18
25
  this.#state = state;
19
26
  state.floatable.update();
@@ -129,6 +136,12 @@ function getState(anchor, content) {
129
136
  state.tooltip = new OuiTooltip(state);
130
137
  return state;
131
138
  }
139
+ /**
140
+ * Get the _OuiTooltip_ for an element
141
+ *
142
+ * @param element Element to get _OuiTooltip_ for
143
+ * @returns _OuiTooltip_ instance
144
+ */
132
145
  function getTooltip(element) {
133
146
  return states.get(element)?.tooltip;
134
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oscarpalmer/oui",
3
- "version": "0.26.0",
3
+ "version": "0.26.1",
4
4
  "description": "Styles, components, and utilities for building websites and applications.",
5
5
  "keywords": [
6
6
  "css",
package/src/js/dialog.ts CHANGED
@@ -15,6 +15,17 @@ class OuiDialog {
15
15
  return this.#state.element.open;
16
16
  }
17
17
 
18
+ /**
19
+ * Open or close the dialog
20
+ */
21
+ set open(value: boolean) {
22
+ if (value === true) {
23
+ this.show();
24
+ } else if (value === false) {
25
+ this.hide();
26
+ }
27
+ }
28
+
18
29
  constructor(state: OuiDialogState) {
19
30
  this.#state = state;
20
31
  }
@@ -7,11 +7,11 @@ import type {RemovableEventListener} from '@oscarpalmer/toretto/models';
7
7
 
8
8
  type CreateOuiFloatableOptions = {
9
9
  /**
10
- * Open the _OuiFloatable_ when created? _(defaults to `true`)_
10
+ * Open the floatable when created? _(defaults to `true`)_
11
11
  */
12
12
  open?: boolean;
13
13
  /**
14
- * Position of the _OuiFloatable_ _(defaults to `below`)_
14
+ * Position of the floatable _(defaults to `below`)_
15
15
  */
16
16
  position?: OuiFloatablePosition;
17
17
  };
@@ -22,14 +22,14 @@ export class OuiFloatable {
22
22
  readonly #state: OuiFloatableState;
23
23
 
24
24
  /**
25
- * Is the _OuiFloatable_ open?
25
+ * Is the floatable open?
26
26
  */
27
27
  get open(): boolean {
28
28
  return this.#state.content.checkVisibility();
29
29
  }
30
30
 
31
31
  /**
32
- * Open or close the _OuiFloatable_
32
+ * Open or close the floatable
33
33
  */
34
34
  set open(value: boolean) {
35
35
  if (value === true) {
@@ -57,7 +57,7 @@ export class OuiFloatable {
57
57
  }
58
58
 
59
59
  /**
60
- * Destroy the _OuiFloatable_, removing it from the DOM and cleaning up references
60
+ * Destroy the floatable, removing it from the DOM and cleaning up references
61
61
  */
62
62
  destroy(): void {
63
63
  if (this.#destroyed) {
@@ -73,7 +73,7 @@ export class OuiFloatable {
73
73
  }
74
74
 
75
75
  /**
76
- * Closes the _OuiFloatable_
76
+ * Closes the floatable
77
77
  */
78
78
  hide(): void {
79
79
  if (!this.#destroyed && this.open) {
@@ -82,7 +82,7 @@ export class OuiFloatable {
82
82
  }
83
83
 
84
84
  /**
85
- * Opens the _OuiFloatable_
85
+ * Opens the floatable
86
86
  */
87
87
  show(): void {
88
88
  if (!this.#destroyed && !this.open) {
@@ -91,7 +91,7 @@ export class OuiFloatable {
91
91
  }
92
92
 
93
93
  /**
94
- * Update the position of the _OuiFloatable_, with an optional new position
94
+ * Update the position of the floatable, with an optional new position
95
95
  *
96
96
  * @param position Optional new position
97
97
  */
package/src/js/popover.ts CHANGED
@@ -23,6 +23,14 @@ class OuiPopover {
23
23
  return this.#state.content.checkVisibility();
24
24
  }
25
25
 
26
+ set open(value: boolean) {
27
+ if (value === true) {
28
+ this.show();
29
+ } else if (value === false) {
30
+ this.hide();
31
+ }
32
+ }
33
+
26
34
  constructor(state: OuiPopoverState) {
27
35
  this.#state = state;
28
36
 
@@ -109,36 +109,60 @@ export class OuiSplitterElement extends HTMLElement {
109
109
 
110
110
  // Getters and setters
111
111
 
112
+ /**
113
+ * Maximum size for the first panel
114
+ */
112
115
  get max(): number {
113
116
  return this.#splitter.values.max;
114
117
  }
115
118
 
119
+ /**
120
+ * Maximum size for the first panel
121
+ */
116
122
  set max(value: number) {
117
123
  this.setAttribute(ATTRIBUTE_MAX, String(value));
118
124
  }
119
125
 
126
+ /**
127
+ * Minimum size for the first panel
128
+ */
120
129
  get min(): number {
121
130
  return this.#splitter.values.min;
122
131
  }
123
132
 
133
+ /**
134
+ * Minimum size for the first panel
135
+ */
124
136
  set min(value: number) {
125
- this.setAttribute('min', String(value));
137
+ this.setAttribute(ATTRIBUTE_MIN, String(value));
126
138
  }
127
139
 
140
+ /**
141
+ * Current size for the first panel
142
+ */
128
143
  get size(): number {
129
144
  return this.#splitter.values.now.current;
130
145
  }
131
146
 
147
+ /**
148
+ * Current size for the first panel
149
+ */
132
150
  set size(value: number) {
133
- this.setAttribute('size', String(value));
151
+ this.setAttribute(ATTRIBUTE_SIZE, String(value));
134
152
  }
135
153
 
154
+ /**
155
+ * Orientation of the splitter
156
+ */
136
157
  get type(): string {
137
- return this.getAttribute('type') ?? 'vertical';
158
+ return this.getAttribute(ATTRIBUTE_TYPE) ?? 'vertical';
138
159
  }
139
160
 
161
+ /**
162
+ * Orientation of the splitter
163
+ */
140
164
  set type(value: string) {
141
- this.setAttribute('type', value);
165
+ this.setAttribute(ATTRIBUTE_TYPE, value);
142
166
  }
143
167
 
144
168
  // Constructor
package/src/js/tooltip.ts CHANGED
@@ -22,6 +22,17 @@ class OuiTooltip {
22
22
  return this.#state.content.checkVisibility();
23
23
  }
24
24
 
25
+ /**
26
+ * Open or close the tooltip
27
+ */
28
+ set open(value: boolean) {
29
+ if (value === true) {
30
+ this.show();
31
+ } else if (value === false) {
32
+ this.hide();
33
+ }
34
+ }
35
+
25
36
  constructor(state: OuiTooltipState) {
26
37
  this.#state = state;
27
38
 
@@ -230,6 +241,12 @@ function getState(anchor: HTMLElement, content: HTMLElement): OuiTooltipState {
230
241
  return state;
231
242
  }
232
243
 
244
+ /**
245
+ * Get the _OuiTooltip_ for an element
246
+ *
247
+ * @param element Element to get _OuiTooltip_ for
248
+ * @returns _OuiTooltip_ instance
249
+ */
233
250
  function getTooltip(element: HTMLElement): OuiTooltip | undefined {
234
251
  return states.get(element)?.tooltip;
235
252
  }