material 3.14.0 → 3.14.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.
- package/dist/components/badge/index.d.ts +6 -6
- package/dist/components/bottom-sheet/index.d.ts +6 -6
- package/dist/components/button/features/progress.js +6 -9
- package/dist/components/button-group/index.d.ts +6 -6
- package/dist/components/card/index.d.ts +29 -29
- package/dist/components/checkbox/index.d.ts +6 -6
- package/dist/components/chips/index.d.ts +18 -18
- package/dist/components/datepicker/index.d.ts +6 -6
- package/dist/components/dialog/index.d.ts +6 -6
- package/dist/components/divider/index.d.ts +42 -42
- package/dist/components/fab/index.d.ts +6 -6
- package/dist/components/list/index.d.ts +16 -16
- package/dist/components/loading-indicator/index.d.ts +32 -32
- package/dist/components/navigation-bar/index.d.ts +3 -3
- package/dist/components/navigation-rail/index.d.ts +3 -3
- package/dist/components/progress/features/canvas.js +7 -13
- package/dist/components/radios/index.d.ts +6 -6
- package/dist/components/switch/index.d.ts +6 -6
- package/dist/components/tabs/index.d.ts +97 -97
- package/dist/components/text-field/index.d.ts +51 -51
- package/dist/components/tooltip/index.d.ts +6 -6
- package/dist/core/canvas/index.d.ts +77 -77
- package/dist/core/compose/index.d.ts +365 -365
- package/dist/core/dom/index.d.ts +117 -117
- package/dist/core/icons/index.d.ts +5 -5
- package/dist/core/shapes/index.d.ts +51 -51
- package/dist/core/state/index.d.ts +26 -26
- package/dist/core/utils/index.d.ts +8 -8
- package/dist/elements/index.d.ts +2109 -2109
- package/dist/elements/preupgrade/badge.css +1 -1
- package/dist/elements/preupgrade/bottom-app-bar.css +1 -1
- package/dist/elements/preupgrade/bottom-sheet.css +1 -1
- package/dist/elements/preupgrade/button-group.css +1 -1
- package/dist/elements/preupgrade/button.css +1 -1
- package/dist/elements/preupgrade/card.css +1 -1
- package/dist/elements/preupgrade/carousel.css +1 -1
- package/dist/elements/preupgrade/checkbox.css +1 -1
- package/dist/elements/preupgrade/chips.css +1 -1
- package/dist/elements/preupgrade/datepicker.css +1 -1
- package/dist/elements/preupgrade/dialog.css +1 -1
- package/dist/elements/preupgrade/divider.css +1 -1
- package/dist/elements/preupgrade/drawer.css +1 -1
- package/dist/elements/preupgrade/extended-fab.css +1 -1
- package/dist/elements/preupgrade/fab-menu.css +1 -1
- package/dist/elements/preupgrade/fab.css +1 -1
- package/dist/elements/preupgrade/icon-button.css +1 -1
- package/dist/elements/preupgrade/list.css +1 -1
- package/dist/elements/preupgrade/loading-indicator.css +1 -1
- package/dist/elements/preupgrade/menu.css +1 -1
- package/dist/elements/preupgrade/navigation-bar.css +1 -1
- package/dist/elements/preupgrade/navigation-rail.css +1 -1
- package/dist/elements/preupgrade/progress.css +1 -1
- package/dist/elements/preupgrade/radios.css +1 -1
- package/dist/elements/preupgrade/search.css +1 -1
- package/dist/elements/preupgrade/select.css +1 -1
- package/dist/elements/preupgrade/side-sheet.css +1 -1
- package/dist/elements/preupgrade/slider.css +1 -1
- package/dist/elements/preupgrade/snackbar.css +1 -1
- package/dist/elements/preupgrade/split-button.css +1 -1
- package/dist/elements/preupgrade/switch.css +1 -1
- package/dist/elements/preupgrade/tabs.css +1 -1
- package/dist/elements/preupgrade/text-field.css +1 -1
- package/dist/elements/preupgrade/timepicker.css +1 -1
- package/dist/elements/preupgrade/toolbar.css +1 -1
- package/dist/elements/preupgrade/tooltip.css +1 -1
- package/dist/elements/preupgrade/top-app-bar.css +1 -1
- package/dist/elements/preupgrade.css +1 -1
- package/dist/react/index.d.ts +47 -47
- package/dist/solid/index.d.ts +47 -47
- package/dist/styles/badge.css +1 -1
- package/dist/styles/base-elements.css +1 -1
- package/dist/styles/base-lite.css +1 -1
- package/dist/styles/base.css +1 -1
- package/dist/styles/bottom-app-bar-toolbar.css +1 -1
- package/dist/styles/bottom-app-bar.css +1 -1
- package/dist/styles/bottom-sheet.css +1 -1
- package/dist/styles/button-filled-small-round.css +1 -1
- package/dist/styles/button-group.css +1 -1
- package/dist/styles/button.css +1 -1
- package/dist/styles/card.css +1 -1
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/checkbox.css +1 -1
- package/dist/styles/chips.css +1 -1
- package/dist/styles/contrast.css +1 -1
- package/dist/styles/datepicker.css +1 -1
- package/dist/styles/dialog.css +1 -1
- package/dist/styles/divider.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/extended-fab.css +1 -1
- package/dist/styles/fab-menu.css +1 -1
- package/dist/styles/fab.css +1 -1
- package/dist/styles/icon-button.css +1 -1
- package/dist/styles/list.css +1 -1
- package/dist/styles/listbox.css +1 -1
- package/dist/styles/loading-indicator.css +1 -1
- package/dist/styles/menu.css +1 -1
- package/dist/styles/navigation-bar.css +1 -1
- package/dist/styles/navigation-rail.css +1 -1
- package/dist/styles/progress.css +1 -1
- package/dist/styles/radios.css +1 -1
- package/dist/styles/search.css +1 -1
- package/dist/styles/select.css +1 -1
- package/dist/styles/side-sheet.css +1 -1
- package/dist/styles/slider.css +1 -1
- package/dist/styles/snackbar.css +1 -1
- package/dist/styles/split-button.css +1 -1
- package/dist/styles/switch.css +1 -1
- package/dist/styles/tabs.css +1 -1
- package/dist/styles/text-field.css +1 -1
- package/dist/styles/timepicker.css +1 -1
- package/dist/styles/toolbar.css +1 -1
- package/dist/styles/tooltip.css +1 -1
- package/dist/styles/top-app-bar.css +1 -1
- package/dist/styles/typography.css +1 -1
- package/dist/styles/utilities.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/themes/autumn-contrast.css +1 -1
- package/dist/themes/autumn.css +1 -1
- package/dist/themes/baseline-contrast.css +1 -1
- package/dist/themes/baseline.css +1 -1
- package/dist/themes/brownbeige-contrast.css +1 -1
- package/dist/themes/brownbeige.css +1 -1
- package/dist/themes/content-contrast.css +1 -1
- package/dist/themes/content.css +1 -1
- package/dist/themes/desert-contrast.css +1 -1
- package/dist/themes/desert.css +1 -1
- package/dist/themes/expressive-contrast.css +1 -1
- package/dist/themes/expressive.css +1 -1
- package/dist/themes/fidelity-contrast.css +1 -1
- package/dist/themes/fidelity.css +1 -1
- package/dist/themes/forest-contrast.css +1 -1
- package/dist/themes/forest.css +1 -1
- package/dist/themes/fruit-salad-contrast.css +1 -1
- package/dist/themes/fruit-salad.css +1 -1
- package/dist/themes/highcontrast-contrast.css +1 -1
- package/dist/themes/highcontrast.css +1 -1
- package/dist/themes/monochrome-contrast.css +1 -1
- package/dist/themes/monochrome.css +1 -1
- package/dist/themes/neutral-contrast.css +1 -1
- package/dist/themes/neutral.css +1 -1
- package/dist/themes/ocean-contrast.css +1 -1
- package/dist/themes/ocean.css +1 -1
- package/dist/themes/rainbow-contrast.css +1 -1
- package/dist/themes/rainbow.css +1 -1
- package/dist/themes/sageivory-contrast.css +1 -1
- package/dist/themes/sageivory.css +1 -1
- package/dist/themes/spring-contrast.css +1 -1
- package/dist/themes/spring.css +1 -1
- package/dist/themes/summer-contrast.css +1 -1
- package/dist/themes/summer.css +1 -1
- package/dist/themes/sunset-contrast.css +1 -1
- package/dist/themes/sunset.css +1 -1
- package/dist/themes/tealcaramel-contrast.css +1 -1
- package/dist/themes/tealcaramel.css +1 -1
- package/dist/themes/vibrant-contrast.css +1 -1
- package/dist/themes/vibrant.css +1 -1
- package/dist/tokens/catalogue.json +3 -3
- package/dist/vue/index.d.ts +74 -74
- package/package.json +1 -1
package/dist/core/dom/index.d.ts
CHANGED
|
@@ -1,3 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set attributes on an element with performance optimizations
|
|
3
|
+
* @param element
|
|
4
|
+
* @param attributes
|
|
5
|
+
*/
|
|
6
|
+
declare const setAttributes: <E extends HTMLElement | SVGElement>(element: E, attributes?: object) => E;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Remove attributes from an element
|
|
10
|
+
* @param element
|
|
11
|
+
* @param attributes
|
|
12
|
+
*/
|
|
13
|
+
declare const removeAttributes: (element: HTMLElement, attributes?: string[]) => HTMLElement;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Batch attribute operations for better performance when setting many attributes
|
|
17
|
+
* @param element
|
|
18
|
+
*/
|
|
19
|
+
declare const batchAttributes: (element: HTMLElement, operations: Array<{
|
|
20
|
+
action: "set" | "remove";
|
|
21
|
+
key: string;
|
|
22
|
+
value?: unknown;
|
|
23
|
+
}>) => HTMLElement;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Check if element has attribute
|
|
27
|
+
* @param element
|
|
28
|
+
* @param attribute
|
|
29
|
+
*/
|
|
30
|
+
declare const hasAttribute: (element: HTMLElement, attribute: string) => boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Get attribute value with default
|
|
34
|
+
* @param element
|
|
35
|
+
* @param attribute
|
|
36
|
+
* @param defaultValue
|
|
37
|
+
*/
|
|
38
|
+
declare const getAttribute: (element: HTMLElement, attribute: string, defaultValue?: string) => string;
|
|
39
|
+
/** Event manager interface for handling DOM events */
|
|
40
|
+
interface EventManager {
|
|
41
|
+
/**
|
|
42
|
+
* Add an event listener with options
|
|
43
|
+
* @param event
|
|
44
|
+
* @param handler
|
|
45
|
+
* @param options
|
|
46
|
+
*/
|
|
47
|
+
on: <T extends Event>(event: string, handler: (e: T) => void, options?: AddEventListenerOptions) => EventManager;
|
|
48
|
+
/**
|
|
49
|
+
* Remove an event listener
|
|
50
|
+
* @param event
|
|
51
|
+
* @param handler
|
|
52
|
+
*/
|
|
53
|
+
off: <T extends Event>(event: string, handler: (e: T) => void) => EventManager;
|
|
54
|
+
/** Temporarily disable all event listeners */
|
|
55
|
+
pause: () => EventManager;
|
|
56
|
+
/** Re-enable all event listeners */
|
|
57
|
+
resume: () => EventManager;
|
|
58
|
+
/** Remove all event listeners and clean up */
|
|
59
|
+
destroy: () => void;
|
|
60
|
+
/** Get all active handlers */
|
|
61
|
+
getHandlers: () => Map<string, HandlerInfo>;
|
|
62
|
+
/**
|
|
63
|
+
* Check if a specific handler exists
|
|
64
|
+
* @param event
|
|
65
|
+
* @param handler
|
|
66
|
+
*/
|
|
67
|
+
hasHandler: <T extends Event>(event: string, handler: (e: T) => void) => boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Handler information */
|
|
71
|
+
interface HandlerInfo {
|
|
72
|
+
original: EventListener;
|
|
73
|
+
enhanced: EventListener;
|
|
74
|
+
event: string;
|
|
75
|
+
options: AddEventListenerOptions;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Creates an event manager to handle DOM events with enhanced functionality.
|
|
80
|
+
* @param element
|
|
81
|
+
*/
|
|
82
|
+
declare const createEventManager: (element: HTMLElement) => EventManager;
|
|
83
|
+
/** A value the browser's Trusted Types API accepts for innerHTML. */
|
|
84
|
+
interface TrustedHTMLLike {
|
|
85
|
+
toString(): string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Markup a component accepts: a string, or a TrustedHTML from a policy. */
|
|
89
|
+
type HTMLInput = string | TrustedHTMLLike;
|
|
90
|
+
|
|
91
|
+
interface HTMLPolicy {
|
|
92
|
+
/** Called with every markup string before it is written. */
|
|
93
|
+
sanitize: (html: string) => HTMLInput;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Sets the policy every component's markup goes through, or clears it with null. */
|
|
97
|
+
declare const configureHTML: (next: HTMLPolicy | null) => void;
|
|
98
|
+
|
|
99
|
+
/** The policy in force, if any. */
|
|
100
|
+
declare const getHTMLPolicy: () => HTMLPolicy | null;
|
|
101
|
+
|
|
102
|
+
/** Writes markup into an element, through the policy when one is set. */
|
|
103
|
+
declare const setHTML: (element: Element, html: HTMLInput | null | undefined) => void;
|
|
1
104
|
/** How an element is promoted to the browser's top layer: */
|
|
2
105
|
type TopLayerKind = "popover-auto" | "popover-manual" | "modal";
|
|
3
106
|
|
|
@@ -57,6 +160,20 @@ interface ModalEscape {
|
|
|
57
160
|
|
|
58
161
|
|
|
59
162
|
declare const onModalEscape: (element: HTMLElement, escape: () => void, d?: (() => unknown) | false) => ModalEscape;
|
|
163
|
+
/**
|
|
164
|
+
* The focused element as seen from a node's own root: the shadow root it lives in, or the document.
|
|
165
|
+
* @param node
|
|
166
|
+
*/
|
|
167
|
+
declare const activeElementOf: (node: Node) => Element | null;
|
|
168
|
+
|
|
169
|
+
/** The element that really has focus, looked for through open shadow roots: where focus goes back to after an overlay closes, when the overlay may sit in another root than whatever opened it. */
|
|
170
|
+
declare const deepActiveElement: () => Element | null;
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
declare const tabStops: (container: Element) => HTMLElement[];
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
declare const wrapTab: (container: HTMLElement, event: KeyboardEvent) => void;
|
|
60
177
|
/**
|
|
61
178
|
* Normalize classes to array of unique strings with optimization and caching
|
|
62
179
|
* @param classes
|
|
@@ -90,44 +207,6 @@ declare const toggleClass: (element: HTMLElement, ...classes: (string | string[]
|
|
|
90
207
|
* @param classes
|
|
91
208
|
*/
|
|
92
209
|
declare const hasClass: (element: HTMLElement, ...classes: (string | string[])[]) => boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Set attributes on an element with performance optimizations
|
|
95
|
-
* @param element
|
|
96
|
-
* @param attributes
|
|
97
|
-
*/
|
|
98
|
-
declare const setAttributes: <E extends HTMLElement | SVGElement>(element: E, attributes?: object) => E;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Remove attributes from an element
|
|
102
|
-
* @param element
|
|
103
|
-
* @param attributes
|
|
104
|
-
*/
|
|
105
|
-
declare const removeAttributes: (element: HTMLElement, attributes?: string[]) => HTMLElement;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Batch attribute operations for better performance when setting many attributes
|
|
109
|
-
* @param element
|
|
110
|
-
*/
|
|
111
|
-
declare const batchAttributes: (element: HTMLElement, operations: Array<{
|
|
112
|
-
action: "set" | "remove";
|
|
113
|
-
key: string;
|
|
114
|
-
value?: unknown;
|
|
115
|
-
}>) => HTMLElement;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Check if element has attribute
|
|
119
|
-
* @param element
|
|
120
|
-
* @param attribute
|
|
121
|
-
*/
|
|
122
|
-
declare const hasAttribute: (element: HTMLElement, attribute: string) => boolean;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Get attribute value with default
|
|
126
|
-
* @param element
|
|
127
|
-
* @param attribute
|
|
128
|
-
* @param defaultValue
|
|
129
|
-
*/
|
|
130
|
-
declare const getAttribute: (element: HTMLElement, attribute: string, defaultValue?: string) => string;
|
|
131
210
|
/** Whether the arrow keys, Home and End belong to an element: a text input, a textarea or editable content, where they move the caret. */
|
|
132
211
|
declare const isTextEditable: (element: EventTarget | null | undefined) => boolean;
|
|
133
212
|
|
|
@@ -149,85 +228,6 @@ interface Roving {
|
|
|
149
228
|
|
|
150
229
|
/** A roving tab index over a composite's focus targets (the WAI-ARIA toolbar pattern): one tab stop, kept on the target focused last; the arrow keys along the layout, Left and Right following the reading direction; Home and End to the ends. */
|
|
151
230
|
declare const createRoving: ({ container, targets, vertical }: RovingOptions) => Roving;
|
|
152
|
-
/** A value the browser's Trusted Types API accepts for innerHTML. */
|
|
153
|
-
interface TrustedHTMLLike {
|
|
154
|
-
toString(): string;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** Markup a component accepts: a string, or a TrustedHTML from a policy. */
|
|
158
|
-
type HTMLInput = string | TrustedHTMLLike;
|
|
159
|
-
|
|
160
|
-
interface HTMLPolicy {
|
|
161
|
-
/** Called with every markup string before it is written. */
|
|
162
|
-
sanitize: (html: string) => HTMLInput;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/** Sets the policy every component's markup goes through, or clears it with null. */
|
|
166
|
-
declare const configureHTML: (next: HTMLPolicy | null) => void;
|
|
167
|
-
|
|
168
|
-
/** The policy in force, if any. */
|
|
169
|
-
declare const getHTMLPolicy: () => HTMLPolicy | null;
|
|
170
|
-
|
|
171
|
-
/** Writes markup into an element, through the policy when one is set. */
|
|
172
|
-
declare const setHTML: (element: Element, html: HTMLInput | null | undefined) => void;
|
|
173
|
-
/** Event manager interface for handling DOM events */
|
|
174
|
-
interface EventManager {
|
|
175
|
-
/**
|
|
176
|
-
* Add an event listener with options
|
|
177
|
-
* @param event
|
|
178
|
-
* @param handler
|
|
179
|
-
* @param options
|
|
180
|
-
*/
|
|
181
|
-
on: <T extends Event>(event: string, handler: (e: T) => void, options?: AddEventListenerOptions) => EventManager;
|
|
182
|
-
/**
|
|
183
|
-
* Remove an event listener
|
|
184
|
-
* @param event
|
|
185
|
-
* @param handler
|
|
186
|
-
*/
|
|
187
|
-
off: <T extends Event>(event: string, handler: (e: T) => void) => EventManager;
|
|
188
|
-
/** Temporarily disable all event listeners */
|
|
189
|
-
pause: () => EventManager;
|
|
190
|
-
/** Re-enable all event listeners */
|
|
191
|
-
resume: () => EventManager;
|
|
192
|
-
/** Remove all event listeners and clean up */
|
|
193
|
-
destroy: () => void;
|
|
194
|
-
/** Get all active handlers */
|
|
195
|
-
getHandlers: () => Map<string, HandlerInfo>;
|
|
196
|
-
/**
|
|
197
|
-
* Check if a specific handler exists
|
|
198
|
-
* @param event
|
|
199
|
-
* @param handler
|
|
200
|
-
*/
|
|
201
|
-
hasHandler: <T extends Event>(event: string, handler: (e: T) => void) => boolean;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/** Handler information */
|
|
205
|
-
interface HandlerInfo {
|
|
206
|
-
original: EventListener;
|
|
207
|
-
enhanced: EventListener;
|
|
208
|
-
event: string;
|
|
209
|
-
options: AddEventListenerOptions;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Creates an event manager to handle DOM events with enhanced functionality.
|
|
214
|
-
* @param element
|
|
215
|
-
*/
|
|
216
|
-
declare const createEventManager: (element: HTMLElement) => EventManager;
|
|
217
|
-
/**
|
|
218
|
-
* The focused element as seen from a node's own root: the shadow root it lives in, or the document.
|
|
219
|
-
* @param node
|
|
220
|
-
*/
|
|
221
|
-
declare const activeElementOf: (node: Node) => Element | null;
|
|
222
|
-
|
|
223
|
-
/** The element that really has focus, looked for through open shadow roots: where focus goes back to after an overlay closes, when the overlay may sit in another root than whatever opened it. */
|
|
224
|
-
declare const deepActiveElement: () => Element | null;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
declare const tabStops: (container: Element) => HTMLElement[];
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
declare const wrapTab: (container: HTMLElement, event: KeyboardEvent) => void;
|
|
231
231
|
export type { EventManager, HTMLInput, HTMLPolicy, Roving, RovingOptions, TopLayerKind, TopLayerOptions, TrustedHTMLLike };
|
|
232
232
|
export { activeElementOf, addClass, batchAttributes, configureHTML, createEventManager, createRoving, deepActiveElement, getAttribute, getHTMLPolicy, hasAttribute, hasClass, hideFromTopLayer, inertOutside, isTextEditable, normalizeClasses, onTopLayerClose, removeAttributes, removeClass, setAttributes, setHTML, showInTopLayer, supportsTopLayer, toggleClass };
|
|
233
233
|
export type { CreateElementOptions, ForwardedEventPayload } from "./create.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/** The semantic names a component renders through the icon registry. */
|
|
2
|
-
type IconName = "menu" | "menu-open" | "close";
|
|
3
|
-
|
|
4
|
-
/** Overrides by semantic name; `null` or `""` restores the built-in. */
|
|
5
|
-
type IconOverrides = Partial<Record<IconName, string | null | undefined>>;
|
|
6
1
|
|
|
7
2
|
/** Override icons by semantic name. */
|
|
8
3
|
declare const setIcons: (icons: IconOverrides) => void;
|
|
9
4
|
|
|
10
5
|
/** The application's override for a name, or the component's own built-in. */
|
|
11
6
|
declare const getIcon: (name: IconName, fallback: string) => string;
|
|
7
|
+
/** The semantic names a component renders through the icon registry. */
|
|
8
|
+
type IconName = "menu" | "menu-open" | "close";
|
|
9
|
+
|
|
10
|
+
/** Overrides by semantic name; `null` or `""` restores the built-in. */
|
|
11
|
+
type IconOverrides = Partial<Record<IconName, string | null | undefined>>;
|
|
12
12
|
export type { IconName, IconOverrides };
|
|
13
13
|
export { getIcon, setIcons };
|
|
@@ -1,55 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
/** How a vertex is rounded: the radius, and how much the curve is smoothed into the sides (0–1) */
|
|
3
|
-
interface CornerRounding {
|
|
4
|
-
radius: number;
|
|
5
|
-
smoothing?: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare const UNROUNDED: CornerRounding;
|
|
9
|
-
|
|
10
|
-
/** A closed shape made of contiguous cubics */
|
|
11
|
-
interface RoundedPolygon {
|
|
12
|
-
cubics: Cubic[];
|
|
13
|
-
centerX: number;
|
|
14
|
-
centerY: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** Builds a rounded polygon from a flat list of vertex coordinates [x0, y0, x1, y1, ...], a rounding for every vertex or one per vertex, and an optional centre (the vertices' centroid by default). */
|
|
18
|
-
declare const roundedPolygon: (vertices: number[], rounding?: CornerRounding, perVertexRounding?: CornerRounding[], centerX?: number, centerY?: number) => RoundedPolygon;
|
|
19
|
-
|
|
20
|
-
/** A regular polygon, first vertex at angle 0 */
|
|
21
|
-
declare const regularPolygon: (numVertices: number, radius?: number, centerX?: number, centerY?: number, rounding?: CornerRounding, perVertexRounding?: CornerRounding[]) => RoundedPolygon;
|
|
22
|
-
|
|
23
|
-
/** A circle approximated by a fully rounded polygon */
|
|
24
|
-
declare const circle: (numVertices?: number, radius?: number, centerX?: number, centerY?: number) => RoundedPolygon;
|
|
25
|
-
|
|
26
|
-
/** A star with `numVerticesPerRadius` outer and inner vertices, outer first at angle 0 */
|
|
27
|
-
declare const star: (numVerticesPerRadius: number, radius?: number, innerRadius?: number, rounding?: CornerRounding, innerRounding?: CornerRounding, perVertexRounding?: CornerRounding[], centerX?: number, centerY?: number) => RoundedPolygon;
|
|
28
|
-
|
|
29
|
-
/** A rectangle centred on (centerX, centerY), its first vertex at the bottom right (graphics-shapes rectangle) */
|
|
30
|
-
declare const rectangle: (width?: number, height?: number, rounding?: CornerRounding, perVertexRounding?: CornerRounding[], centerX?: number, centerY?: number) => RoundedPolygon;
|
|
31
|
-
|
|
32
|
-
declare const transformPolygon: (polygon: RoundedPolygon, f: PointTransformer) => RoundedPolygon;
|
|
33
|
-
|
|
34
|
-
/** Rotation about the origin, in degrees, positive clockwise on a y-down canvas */
|
|
35
|
-
declare const rotatePolygon: (polygon: RoundedPolygon, degrees: number) => RoundedPolygon;
|
|
36
|
-
|
|
37
|
-
declare const scalePolygon: (polygon: RoundedPolygon, sx: number, sy?: number) => RoundedPolygon;
|
|
38
|
-
|
|
39
|
-
/** Bounding box [left, top, right, bottom] from the hull of anchors and controls */
|
|
40
|
-
declare const polygonBounds: (polygon: RoundedPolygon) => [
|
|
41
|
-
number,
|
|
42
|
-
number,
|
|
43
|
-
number,
|
|
44
|
-
number
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
/** The farthest any anchor or curve midpoint gets from the centre */
|
|
48
|
-
declare const polygonMaxRadius: (polygon: RoundedPolygon) => number;
|
|
49
|
-
|
|
50
|
-
/** Fits the shape into the unit square, centred, keeping its aspect ratio */
|
|
51
|
-
declare const normalizePolygon: (polygon: RoundedPolygon) => RoundedPolygon;
|
|
52
|
-
|
|
53
2
|
/** Circle */
|
|
54
3
|
declare const shapeCircle: () => RoundedPolygon;
|
|
55
4
|
|
|
@@ -282,5 +231,56 @@ declare const cubicBounds: (c: Cubic) => [
|
|
|
282
231
|
number,
|
|
283
232
|
number
|
|
284
233
|
];
|
|
234
|
+
|
|
235
|
+
/** How a vertex is rounded: the radius, and how much the curve is smoothed into the sides (0–1) */
|
|
236
|
+
interface CornerRounding {
|
|
237
|
+
radius: number;
|
|
238
|
+
smoothing?: number;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare const UNROUNDED: CornerRounding;
|
|
242
|
+
|
|
243
|
+
/** A closed shape made of contiguous cubics */
|
|
244
|
+
interface RoundedPolygon {
|
|
245
|
+
cubics: Cubic[];
|
|
246
|
+
centerX: number;
|
|
247
|
+
centerY: number;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** Builds a rounded polygon from a flat list of vertex coordinates [x0, y0, x1, y1, ...], a rounding for every vertex or one per vertex, and an optional centre (the vertices' centroid by default). */
|
|
251
|
+
declare const roundedPolygon: (vertices: number[], rounding?: CornerRounding, perVertexRounding?: CornerRounding[], centerX?: number, centerY?: number) => RoundedPolygon;
|
|
252
|
+
|
|
253
|
+
/** A regular polygon, first vertex at angle 0 */
|
|
254
|
+
declare const regularPolygon: (numVertices: number, radius?: number, centerX?: number, centerY?: number, rounding?: CornerRounding, perVertexRounding?: CornerRounding[]) => RoundedPolygon;
|
|
255
|
+
|
|
256
|
+
/** A circle approximated by a fully rounded polygon */
|
|
257
|
+
declare const circle: (numVertices?: number, radius?: number, centerX?: number, centerY?: number) => RoundedPolygon;
|
|
258
|
+
|
|
259
|
+
/** A star with `numVerticesPerRadius` outer and inner vertices, outer first at angle 0 */
|
|
260
|
+
declare const star: (numVerticesPerRadius: number, radius?: number, innerRadius?: number, rounding?: CornerRounding, innerRounding?: CornerRounding, perVertexRounding?: CornerRounding[], centerX?: number, centerY?: number) => RoundedPolygon;
|
|
261
|
+
|
|
262
|
+
/** A rectangle centred on (centerX, centerY), its first vertex at the bottom right (graphics-shapes rectangle) */
|
|
263
|
+
declare const rectangle: (width?: number, height?: number, rounding?: CornerRounding, perVertexRounding?: CornerRounding[], centerX?: number, centerY?: number) => RoundedPolygon;
|
|
264
|
+
|
|
265
|
+
declare const transformPolygon: (polygon: RoundedPolygon, f: PointTransformer) => RoundedPolygon;
|
|
266
|
+
|
|
267
|
+
/** Rotation about the origin, in degrees, positive clockwise on a y-down canvas */
|
|
268
|
+
declare const rotatePolygon: (polygon: RoundedPolygon, degrees: number) => RoundedPolygon;
|
|
269
|
+
|
|
270
|
+
declare const scalePolygon: (polygon: RoundedPolygon, sx: number, sy?: number) => RoundedPolygon;
|
|
271
|
+
|
|
272
|
+
/** Bounding box [left, top, right, bottom] from the hull of anchors and controls */
|
|
273
|
+
declare const polygonBounds: (polygon: RoundedPolygon) => [
|
|
274
|
+
number,
|
|
275
|
+
number,
|
|
276
|
+
number,
|
|
277
|
+
number
|
|
278
|
+
];
|
|
279
|
+
|
|
280
|
+
/** The farthest any anchor or curve midpoint gets from the centre */
|
|
281
|
+
declare const polygonMaxRadius: (polygon: RoundedPolygon) => number;
|
|
282
|
+
|
|
283
|
+
/** Fits the shape into the unit square, centred, keeping its aspect ratio */
|
|
284
|
+
declare const normalizePolygon: (polygon: RoundedPolygon) => RoundedPolygon;
|
|
285
285
|
export type { CornerRounding, Cubic, MaterialShapeName, Point, PointTransformer, RadialProfile, RoundedPolygon };
|
|
286
286
|
export { UNROUNDED, circle, circularArc, cubicBounds, materialShape, materialShapePath, normalizePolygon, pointOnCurve, polygonBounds, polygonMaxRadius, polygonPath, radialProfile, rectangle, regularPolygon, rotatePolygon, roundedPolygon, scalePolygon, shapeArch, shapeArrow, shapeBoom, shapeBun, shapeBurst, shapeCircle, shapeClamShell, shapeClover4Leaf, shapeClover8Leaf, shapeCookie12Sided, shapeCookie4Sided, shapeCookie6Sided, shapeCookie7Sided, shapeCookie9Sided, shapeDiamond, shapeFan, shapeFlower, shapeGem, shapeGhostish, shapeHeart, shapeOval, shapePentagon, shapePill, shapePixelCircle, shapePixelTriangle, shapePuffy, shapePuffyDiamond, shapeSemiCircle, shapeSlanted, shapeSoftBoom, shapeSoftBurst, shapeSquare, shapeSunny, shapeTriangle, shapeVerySunny, splitCubic, star, straightLine, transformPolygon };
|
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
import type { EventCallback } from "./emitter.js";
|
|
2
|
+
|
|
3
|
+
/** Event manager interface for handling component events */
|
|
4
|
+
interface EventManagerState {
|
|
5
|
+
/**
|
|
6
|
+
* Adds an event listener
|
|
7
|
+
* @param event
|
|
8
|
+
* @param handler
|
|
9
|
+
*/
|
|
10
|
+
on: (event: string, handler: EventCallback) => EventManagerState;
|
|
11
|
+
/**
|
|
12
|
+
* Removes an event listener
|
|
13
|
+
* @param event
|
|
14
|
+
* @param handler
|
|
15
|
+
*/
|
|
16
|
+
off: (event: string, handler: EventCallback) => EventManagerState;
|
|
17
|
+
/** Removes all event listeners and cleans up */
|
|
18
|
+
destroy: () => void;
|
|
19
|
+
/** Gets all active handlers */
|
|
20
|
+
getHandlers: () => Map<EventCallback, string>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Creates an event manager for a component
|
|
25
|
+
* @param element
|
|
26
|
+
*/
|
|
27
|
+
declare const createEventManager: (element: HTMLElement) => EventManagerState;
|
|
2
28
|
/** State store options */
|
|
3
29
|
interface StoreOptions<T> {
|
|
4
30
|
/** Middleware functions that process state changes */
|
|
@@ -67,32 +93,6 @@ declare const loggingMiddleware: <T extends object>(newState: T, oldState: T) =>
|
|
|
67
93
|
* @param predicate
|
|
68
94
|
*/
|
|
69
95
|
declare const deriveFiltered: <T>(predicate: (value: T, key: string) => boolean) => (state: Record<string, T>) => Record<string, T>;
|
|
70
|
-
|
|
71
|
-
/** Event manager interface for handling component events */
|
|
72
|
-
interface EventManagerState {
|
|
73
|
-
/**
|
|
74
|
-
* Adds an event listener
|
|
75
|
-
* @param event
|
|
76
|
-
* @param handler
|
|
77
|
-
*/
|
|
78
|
-
on: (event: string, handler: EventCallback) => EventManagerState;
|
|
79
|
-
/**
|
|
80
|
-
* Removes an event listener
|
|
81
|
-
* @param event
|
|
82
|
-
* @param handler
|
|
83
|
-
*/
|
|
84
|
-
off: (event: string, handler: EventCallback) => EventManagerState;
|
|
85
|
-
/** Removes all event listeners and cleans up */
|
|
86
|
-
destroy: () => void;
|
|
87
|
-
/** Gets all active handlers */
|
|
88
|
-
getHandlers: () => Map<EventCallback, string>;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Creates an event manager for a component
|
|
93
|
-
* @param element
|
|
94
|
-
*/
|
|
95
|
-
declare const createEventManager: (element: HTMLElement) => EventManagerState;
|
|
96
96
|
export type { Computation, DerivedState, EventManagerState, Selector, Store, StoreOptions, Updater };
|
|
97
97
|
export { createEventManager, createStore, deriveFiltered, loggingMiddleware };
|
|
98
98
|
export type { Emitter, EventCallback } from "./emitter.js";
|
|
@@ -11,6 +11,14 @@ declare const when: <T, C>(predicate: (obj: T, context: C) => boolean, transform
|
|
|
11
11
|
* @param classes
|
|
12
12
|
*/
|
|
13
13
|
declare const classNames: (...classes: (string | undefined | null | false)[]) => string;
|
|
14
|
+
/** Attributes whose value is a URL, and so must be checked before assignment. */
|
|
15
|
+
declare const URL_ATTRIBUTES: Set<string>;
|
|
16
|
+
|
|
17
|
+
/** Whether a URL is safe to assign to a navigable attribute. */
|
|
18
|
+
declare const isSafeUrl: (url: string) => boolean;
|
|
19
|
+
|
|
20
|
+
/** Returns the URL if its scheme is allowed, otherwise an empty string. */
|
|
21
|
+
declare const safeUrl: (url: string) => string;
|
|
14
22
|
/** Result interface for background color lookup */
|
|
15
23
|
interface BackgroundResult {
|
|
16
24
|
/** The computed background color value */
|
|
@@ -57,14 +65,6 @@ declare const byString: <T extends object, R = unknown>(obj: T, path: string) =>
|
|
|
57
65
|
* @param opacity
|
|
58
66
|
*/
|
|
59
67
|
declare const colorToRGBA: (color: string, opacity: number) => string;
|
|
60
|
-
/** Attributes whose value is a URL, and so must be checked before assignment. */
|
|
61
|
-
declare const URL_ATTRIBUTES: Set<string>;
|
|
62
|
-
|
|
63
|
-
/** Whether a URL is safe to assign to a navigable attribute. */
|
|
64
|
-
declare const isSafeUrl: (url: string) => boolean;
|
|
65
|
-
|
|
66
|
-
/** Returns the URL if its scheme is allowed, otherwise an empty string. */
|
|
67
|
-
declare const safeUrl: (url: string) => string;
|
|
68
68
|
type Cancellable<F> = F & {
|
|
69
69
|
cancel(): void;
|
|
70
70
|
};
|