@fusion.dev/helix-core 0.0.0-dev
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.
- package/LICENSE +21 -0
- package/custom-elements.json +8005 -0
- package/dist/controllers/aria-forward-controller/aria-forward-controller.d.ts +67 -0
- package/dist/controllers/aria-forward-controller/aria-forward-controller.js +146 -0
- package/dist/controllers/chart-pointer-controller/chart-pointer-controller.d.ts +79 -0
- package/dist/controllers/chart-pointer-controller/chart-pointer-controller.js +140 -0
- package/dist/controllers/command-controller/command-controller.d.ts +83 -0
- package/dist/controllers/command-controller/command-controller.js +93 -0
- package/dist/controllers/copy-controller/copy-controller.d.ts +58 -0
- package/dist/controllers/copy-controller/copy-controller.js +128 -0
- package/dist/controllers/disabled-cascade-controller/disabled-cascade-controller.d.ts +76 -0
- package/dist/controllers/disabled-cascade-controller/disabled-cascade-controller.js +67 -0
- package/dist/controllers/dismiss-controller/dismiss-controller.d.ts +58 -0
- package/dist/controllers/dismiss-controller/dismiss-controller.js +165 -0
- package/dist/controllers/drilldown-controller/drilldown-controller.d.ts +127 -0
- package/dist/controllers/drilldown-controller/drilldown-controller.js +171 -0
- package/dist/controllers/floating-controller/floating-controller.d.ts +123 -0
- package/dist/controllers/floating-controller/floating-controller.js +227 -0
- package/dist/controllers/focus-trap-controller/focus-trap-controller.d.ts +26 -0
- package/dist/controllers/focus-trap-controller/focus-trap-controller.js +93 -0
- package/dist/controllers/indicator-controller/indicator-controller.d.ts +97 -0
- package/dist/controllers/indicator-controller/indicator-controller.js +164 -0
- package/dist/controllers/keyboard-navigation-controller/keyboard-navigation-controller.d.ts +113 -0
- package/dist/controllers/keyboard-navigation-controller/keyboard-navigation-controller.js +117 -0
- package/dist/controllers/popover-controller/popover-controller.d.ts +132 -0
- package/dist/controllers/popover-controller/popover-controller.js +150 -0
- package/dist/controllers/source-controller/source-controller.d.ts +55 -0
- package/dist/controllers/source-controller/source-controller.js +94 -0
- package/dist/controllers/token-color-controller/token-color-controller.d.ts +63 -0
- package/dist/controllers/token-color-controller/token-color-controller.js +105 -0
- package/dist/controllers/virtualize-controller/virtualize-controller.d.ts +127 -0
- package/dist/controllers/virtualize-controller/virtualize-controller.js +216 -0
- package/dist/events/element-events.d.ts +4 -0
- package/dist/events/element-events.js +34 -0
- package/dist/events/events.d.ts +743 -0
- package/dist/events/events.js +799 -0
- package/dist/helix-element/helix-element.d.ts +201 -0
- package/dist/helix-element/helix-element.js +695 -0
- package/dist/helix-form-element/helix-form-element.d.ts +152 -0
- package/dist/helix-form-element/helix-form-element.js +194 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +54 -0
- package/dist/mixins/mixin-chart-source/mixin-chart-source.d.ts +137 -0
- package/dist/mixins/mixin-chart-source/mixin-chart-source.js +140 -0
- package/dist/mixins/mixin-collection/index.d.ts +1 -0
- package/dist/mixins/mixin-collection/index.js +1 -0
- package/dist/mixins/mixin-collection/mixin-collection.d.ts +58 -0
- package/dist/mixins/mixin-collection/mixin-collection.js +154 -0
- package/dist/mixins/mixin-controller-active/mixin-controller-active.d.ts +53 -0
- package/dist/mixins/mixin-controller-active/mixin-controller-active.js +155 -0
- package/dist/mixins/mixin-controller-checked/mixin-controller-checked.d.ts +54 -0
- package/dist/mixins/mixin-controller-checked/mixin-controller-checked.js +157 -0
- package/dist/mixins/mixin-controller-open/mixin-controller-open.d.ts +49 -0
- package/dist/mixins/mixin-controller-open/mixin-controller-open.js +176 -0
- package/dist/mixins/mixin-controller-value/mixin-controller-value.d.ts +73 -0
- package/dist/mixins/mixin-controller-value/mixin-controller-value.js +173 -0
- package/dist/mixins/mixin-dismissible/mixin-dismissible.d.ts +41 -0
- package/dist/mixins/mixin-dismissible/mixin-dismissible.js +79 -0
- package/dist/mixins/mixin-field/mixin-field.d.ts +145 -0
- package/dist/mixins/mixin-field/mixin-field.js +423 -0
- package/dist/utils/anchor-element/anchor-element.d.ts +23 -0
- package/dist/utils/anchor-element/anchor-element.js +39 -0
- package/dist/utils/capture-pointer/capture-pointer.d.ts +22 -0
- package/dist/utils/capture-pointer/capture-pointer.js +30 -0
- package/dist/utils/closest-instance/closest-instance.d.ts +25 -0
- package/dist/utils/closest-instance/closest-instance.js +34 -0
- package/dist/utils/create-sheet/create-sheet.d.ts +16 -0
- package/dist/utils/create-sheet/create-sheet.js +16 -0
- package/dist/utils/custom-element/custom-element.d.ts +26 -0
- package/dist/utils/custom-element/custom-element.js +114 -0
- package/dist/utils/draw-icon/draw-icon.d.ts +38 -0
- package/dist/utils/draw-icon/draw-icon.js +39 -0
- package/dist/utils/draw-tooltip/draw-tooltip.d.ts +56 -0
- package/dist/utils/draw-tooltip/draw-tooltip.js +89 -0
- package/dist/utils/elapsed-time/elapsed-time.d.ts +10 -0
- package/dist/utils/elapsed-time/elapsed-time.js +117 -0
- package/dist/utils/focusable-elements/focusable-elements.d.ts +40 -0
- package/dist/utils/focusable-elements/focusable-elements.js +88 -0
- package/dist/utils/format-numbers/format-numbers.d.ts +1 -0
- package/dist/utils/format-numbers/format-numbers.js +29 -0
- package/dist/utils/host-aria/host-aria.d.ts +38 -0
- package/dist/utils/host-aria/host-aria.js +41 -0
- package/dist/utils/inherit-disabled/inherit-disabled.d.ts +33 -0
- package/dist/utils/inherit-disabled/inherit-disabled.js +55 -0
- package/dist/utils/line-path/line-path.d.ts +23 -0
- package/dist/utils/line-path/line-path.js +107 -0
- package/dist/utils/on-unless-false/on-unless-false.d.ts +28 -0
- package/dist/utils/on-unless-false/on-unless-false.js +32 -0
- package/dist/utils/read-series/read-series.d.ts +78 -0
- package/dist/utils/read-series/read-series.js +187 -0
- package/dist/utils/relative-time/relative-time.d.ts +24 -0
- package/dist/utils/relative-time/relative-time.js +84 -0
- package/dist/utils/request-change/request-change.d.ts +48 -0
- package/dist/utils/request-change/request-change.js +7 -0
- package/dist/utils/resolve-active-item/resolve-active-item.d.ts +28 -0
- package/dist/utils/resolve-active-item/resolve-active-item.js +21 -0
- package/dist/utils/restore-value/restore-value.d.ts +32 -0
- package/dist/utils/restore-value/restore-value.js +84 -0
- package/dist/utils/scale/scale.d.ts +23 -0
- package/dist/utils/scale/scale.js +32 -0
- package/dist/utils/scale/ticks.d.ts +27 -0
- package/dist/utils/scale/ticks.js +52 -0
- package/dist/utils/scroll-item-into-view/scroll-item-into-view.d.ts +10 -0
- package/dist/utils/scroll-item-into-view/scroll-item-into-view.js +98 -0
- package/dist/utils/slot-filled/slot-filled.d.ts +26 -0
- package/dist/utils/slot-filled/slot-filled.js +26 -0
- package/dist/utils/tell-disclosure/tell-disclosure.d.ts +51 -0
- package/dist/utils/tell-disclosure/tell-disclosure.js +76 -0
- package/dist/utils/ticker/ticker.d.ts +8 -0
- package/dist/utils/ticker/ticker.js +55 -0
- package/dist/utils/tone-marks/tone-marks.d.ts +52 -0
- package/dist/utils/tone-marks/tone-marks.js +36 -0
- package/dist/utils/value-as/value-as.d.ts +64 -0
- package/dist/utils/value-as/value-as.js +105 -0
- package/package.json +58 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { type CSSResultOrNative, LitElement, type PropertyValues } from 'lit';
|
|
2
|
+
import { type StaticValue } from 'lit/static-html.js';
|
|
3
|
+
/**
|
|
4
|
+
* @summary Base class every Helix element extends.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Owns only what is universal: normalizing `box-sizing` inside the shadow root,
|
|
8
|
+
* so component CSS can rely on border-box on both sides of the boundary.
|
|
9
|
+
*
|
|
10
|
+
* There is deliberately no `emit(name, detail)` helper. A dispatch through a
|
|
11
|
+
* generic helper cannot be named by the manifest analyzer, which recorded the
|
|
12
|
+
* parameter identifier and produced a phantom event on every element that
|
|
13
|
+
* inherited it. Components dispatch concrete event classes from `events.ts`,
|
|
14
|
+
* which the analyzer and TypeScript can both see.
|
|
15
|
+
*
|
|
16
|
+
* @since 0.1.0
|
|
17
|
+
* @status experimental
|
|
18
|
+
* @documentation https://helix.fusion.dev/core/helix-element
|
|
19
|
+
*/
|
|
20
|
+
export declare class HelixElement extends LitElement {
|
|
21
|
+
/**
|
|
22
|
+
* The prefix this tier registers its elements under.
|
|
23
|
+
*
|
|
24
|
+
* **A component that renders another renders its own tier's version of it**,
|
|
25
|
+
* so `helix-headless-pagination-size` composes `helix-headless-select` and
|
|
26
|
+
* `helix-pagination-size` composes `helix-select`. One template says
|
|
27
|
+
* `${this.tag('select')}` and each tier answers with its own name.
|
|
28
|
+
*
|
|
29
|
+
* It was the public tag in both tiers, on the argument that each imports its
|
|
30
|
+
* own element under that name. That works and costs three things: the name
|
|
31
|
+
* means two different things depending on what a consumer imported, the
|
|
32
|
+
* headless tier composes an element it does not ship, and the composition
|
|
33
|
+
* cannot be tested there at all, because there is no `helix-select` on that
|
|
34
|
+
* tier to test it against. Thirty-nine specs had to be moved back to
|
|
35
|
+
* `helix/styled` for exactly that reason.
|
|
36
|
+
*
|
|
37
|
+
* **A prefix rather than an override per composition**, which was the first
|
|
38
|
+
* plan and does not compile. An override re-renders the fragment from the
|
|
39
|
+
* subclass, and the fragment reads members the base keeps private:
|
|
40
|
+
* `PaginationSize` alone would have had to widen `options`, `current` and
|
|
41
|
+
* `handleChange` to `protected` so a subclass could say the same thing again.
|
|
42
|
+
* Sixteen families of that is a lot of encapsulation spent on saying one
|
|
43
|
+
* word differently.
|
|
44
|
+
*/
|
|
45
|
+
static tier: string;
|
|
46
|
+
/**
|
|
47
|
+
* One composed tag, as a static value a template can interpolate.
|
|
48
|
+
*
|
|
49
|
+
* `unsafeStatic` is safe by construction: the name is a literal in our own
|
|
50
|
+
* source and the prefix is one of two strings this class defines. Called per
|
|
51
|
+
* render and not cached, which costs nothing, because `static-html` keys its
|
|
52
|
+
* template cache on the joined string rather than on the object.
|
|
53
|
+
*/
|
|
54
|
+
protected tag(name: string): StaticValue;
|
|
55
|
+
/**
|
|
56
|
+
* The element's semantics, set without touching the DOM.
|
|
57
|
+
*
|
|
58
|
+
* `ElementInternals` sets the implicit role, which an author's own `role`
|
|
59
|
+
* attribute still overrides, and it writes no attribute. Setting `role` on the
|
|
60
|
+
* host directly would: that is an attribute the element gives itself after it
|
|
61
|
+
* upgrades, which a React consumer's server markup never had, and hydration
|
|
62
|
+
* reports it as a mismatch.
|
|
63
|
+
*
|
|
64
|
+
* Available during server rendering. Lit's shim implements `attachInternals`,
|
|
65
|
+
* so nothing here needs a guard.
|
|
66
|
+
*/
|
|
67
|
+
protected readonly internals: ElementInternals;
|
|
68
|
+
/**
|
|
69
|
+
* Records a boolean fact about this element as a custom state.
|
|
70
|
+
*
|
|
71
|
+
* **The host belongs to whoever rendered it, and a component's own
|
|
72
|
+
* bookkeeping may not be kept there.** An attribute written on the first
|
|
73
|
+
* update is markup a consumer's server never sent, so a React consumer
|
|
74
|
+
* hydrates a DOM that has gained attributes since and reports a mismatch it
|
|
75
|
+
* will not patch up. A custom state is not in the DOM at all: it carries the
|
|
76
|
+
* fact to a stylesheet through `:state()` and leaves the markup alone, so the
|
|
77
|
+
* server's output and the client's agree by construction.
|
|
78
|
+
*
|
|
79
|
+
* `SETTLED` carries the long version of that argument and was the first to
|
|
80
|
+
* move. `checked`, `open`, `invalid` and `has-label` followed it on 27 Aug
|
|
81
|
+
* 2026, after the same fault was reported once more from the landing page's
|
|
82
|
+
* showcase: a `default-checked` switch, a `default-checked` checkbox and a
|
|
83
|
+
* `default-open` accordion item, each writing its own resolved state onto
|
|
84
|
+
* itself before React reached the node.
|
|
85
|
+
*
|
|
86
|
+
* **The deferral that had been holding it is not a fix and could not be.**
|
|
87
|
+
* The site imports the definitions from an effect so the upgrades fall the
|
|
88
|
+
* other side of hydration, which works only while hydration is one pass:
|
|
89
|
+
* anything that splits it, a streamed segment or a suspended boundary, puts
|
|
90
|
+
* an upgrade back inside the window. Timing cannot be the guarantee when the
|
|
91
|
+
* fact is kept somewhere React reconciles.
|
|
92
|
+
*
|
|
93
|
+
* Feature-tested rather than assumed, the way `hostAria` tests element
|
|
94
|
+
* references. An engine without `CustomStateSet` records nothing and keeps
|
|
95
|
+
* whatever the resting rule draws, which is the safe direction to fail, and
|
|
96
|
+
* Lit's server shim is one of them: a custom state is a fact about a running
|
|
97
|
+
* element, and a server has nothing to say about it.
|
|
98
|
+
*/
|
|
99
|
+
protected toggleState(name: string, on: boolean): void;
|
|
100
|
+
/**
|
|
101
|
+
* Resolves a frame after the first update, when transitions are switched on.
|
|
102
|
+
*
|
|
103
|
+
* **Named `whenSettled` because `settled` was taken four times over.** Image
|
|
104
|
+
* and Splitter each have a private `settle`, and both color controls carry a
|
|
105
|
+
* `settled` of their own, all of them older than this and none of them about
|
|
106
|
+
* transitions. A base class takes the name every subclass then cannot use, so
|
|
107
|
+
* it takes the one nobody wanted.
|
|
108
|
+
*
|
|
109
|
+
* **The state it reports cannot be watched, which is why this exists.** A
|
|
110
|
+
* `MutationObserver` could see `[data-settled]` arrive and there is no
|
|
111
|
+
* equivalent for `ElementInternals.states`: a custom state is deliberately not
|
|
112
|
+
* in the DOM, which is the whole reason it replaced the attribute. Anything
|
|
113
|
+
* that used to wait on the attribute waits on this instead, and gets a better
|
|
114
|
+
* signal for it, an awaited promise being what the callers wanted rather than
|
|
115
|
+
* a mutation they had to interpret.
|
|
116
|
+
*
|
|
117
|
+
* Separate from `updateComplete`, which resolves in the microtask checkpoint
|
|
118
|
+
* the suppression is still active in. That is the distinction `readyToMove`
|
|
119
|
+
* in `@fusion.dev/helix-testing` was written around and the reason two checkbox specs
|
|
120
|
+
* were misread as a token fault for days.
|
|
121
|
+
*
|
|
122
|
+
* It never resolves where `requestAnimationFrame` never fires, which is a
|
|
123
|
+
* server, a hidden tab, and happy-dom. Callers that must not hang race it
|
|
124
|
+
* against a timeout; `readyToMove` does exactly that.
|
|
125
|
+
*/
|
|
126
|
+
readonly whenSettled: Promise<void>;
|
|
127
|
+
/** Resolves `whenSettled`, once, from the frame that records the state. */
|
|
128
|
+
private resolveSettled;
|
|
129
|
+
constructor();
|
|
130
|
+
/**
|
|
131
|
+
* Announces an event, having first bound whatever React is holding for it.
|
|
132
|
+
*
|
|
133
|
+
* Every event this library sends passes through here, the concrete classes in
|
|
134
|
+
* `events.ts` and the relayed native ones alike, and `requestChange`
|
|
135
|
+
* dispatches through the host as well. One override therefore covers all
|
|
136
|
+
* ninety-seven of them, which is the reason it is here rather than at each
|
|
137
|
+
* dispatch. See `bindReactHandler`.
|
|
138
|
+
*
|
|
139
|
+
* @internal
|
|
140
|
+
*/
|
|
141
|
+
dispatchEvent(event: Event): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Stops an inner control's own announcement at this element's boundary.
|
|
144
|
+
*
|
|
145
|
+
* **A composed control is one control to a consumer, and the natives had no
|
|
146
|
+
* equivalent of the stop the prefixed events already get.** `<helix-select>`
|
|
147
|
+
* renders a `<helix-listbox>`, and both announce: the listbox dispatches
|
|
148
|
+
* `input` and `change` from its own host, `input` is composed by
|
|
149
|
+
* specification, and a consumer listening on the select therefore heard one
|
|
150
|
+
* choice twice. Measured before this existed, on the styled tier, one choice
|
|
151
|
+
* on the inner listbox: select `input` twice and `change` three times,
|
|
152
|
+
* combobox, date input, time input and color input twice each. `Command` was
|
|
153
|
+
* the only one that was right, because it happened to reach for
|
|
154
|
+
* `stopImmediatePropagation` for a different reason.
|
|
155
|
+
*
|
|
156
|
+
* Bound on the child in the parent's template, so it runs while the event is
|
|
157
|
+
* still at the child and before it can cross. The guard is for the case where
|
|
158
|
+
* a component binds this on itself: an element must never stop its own
|
|
159
|
+
* announcement, which is the one it exists to make.
|
|
160
|
+
*
|
|
161
|
+
* This is the same job the `helix-before-*` handlers do with their own
|
|
162
|
+
* `stopPropagation`, and it is separate rather than folded into them because
|
|
163
|
+
* a consumer may legitimately refuse a request without the notification ever
|
|
164
|
+
* happening: the two travel at different times and one can be absent.
|
|
165
|
+
*/
|
|
166
|
+
protected readonly stopInner: (event: Event) => void;
|
|
167
|
+
/**
|
|
168
|
+
* Re-emits a native event from the host, under its own name.
|
|
169
|
+
*
|
|
170
|
+
* A native event fired by an inner `<input>` or `<textarea>` is not composed,
|
|
171
|
+
* so it stops at the shadow boundary and a consumer listening on
|
|
172
|
+
* `<helix-input>` hears nothing. Re-dispatching it from the host is what
|
|
173
|
+
* makes the component behave like the control it wraps.
|
|
174
|
+
*
|
|
175
|
+
* The relayed event keeps the native name deliberately. `change` is `change`,
|
|
176
|
+
* which is what a consumer already knows to listen for, and it is what
|
|
177
|
+
* reaches React: its synthetic system claims `onChange` and wires it to that
|
|
178
|
+
* name, so a prefixed one would never arrive.
|
|
179
|
+
*
|
|
180
|
+
* `composed` is not forced. It defaults to the original event's own value, so
|
|
181
|
+
* a relayed `change` stops at the next shadow boundary exactly as a native
|
|
182
|
+
* one would. Pass it explicitly only where escaping is the intent, and say so
|
|
183
|
+
* where you do.
|
|
184
|
+
*/
|
|
185
|
+
protected relayNativeEvent(event: Event, init?: EventInit): void;
|
|
186
|
+
/**
|
|
187
|
+
* Prepends the shadow-root reset to every subclass's styles, so no component
|
|
188
|
+
* has to remember to include it.
|
|
189
|
+
*/
|
|
190
|
+
protected static finalizeStyles(styles?: CSSResultOrNative | CSSResultOrNative[]): CSSResultOrNative[];
|
|
191
|
+
/**
|
|
192
|
+
* Marks the component's first style resolution as done, so `SETTLED` stops
|
|
193
|
+
* suppressing transitions.
|
|
194
|
+
*
|
|
195
|
+
* A frame later, not now: see `SETTLED` for why `firstUpdated` itself is too
|
|
196
|
+
* early. SSR never calls this, which is correct, because the attribute
|
|
197
|
+
* describes something that happened in a browser and the server has no frame
|
|
198
|
+
* to wait for.
|
|
199
|
+
*/
|
|
200
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
201
|
+
}
|