@punica/editor 1.10.1 → 1.10.3
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/package.json
CHANGED
|
@@ -112,6 +112,14 @@ declare module 'punica' {
|
|
|
112
112
|
children?: HTMLElement[];
|
|
113
113
|
style?: Record<string, string> | string;
|
|
114
114
|
className?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Listeners bound as the element is built, keyed by event name:
|
|
117
|
+
* `{ click: fn, mousedown: fn }`. The component factories already
|
|
118
|
+
* take an `onClick`; this is the same thing for the plain tags a
|
|
119
|
+
* view builds by hand, so a tree stays one expression instead of
|
|
120
|
+
* breaking into a variable plus an `addEventListener` line.
|
|
121
|
+
*/
|
|
122
|
+
on?: Record<string, EventListener>;
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
interface ButtonOptions {
|
|
@@ -130,6 +138,18 @@ declare module 'punica' {
|
|
|
130
138
|
variant?: 'text' | 'outlined' | 'filled';
|
|
131
139
|
disabled?: boolean;
|
|
132
140
|
attrs?: Record<string, string>;
|
|
141
|
+
style?: Record<string, string> | string;
|
|
142
|
+
className?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Finished icon markup, for the cases the positional `iconClass`
|
|
145
|
+
* cannot express — a toolbar action declares its icon as ready
|
|
146
|
+
* `<i>`/`<svg>` markup rather than a class name, so wrapping it in
|
|
147
|
+
* another `<i class=…>` would nest it wrongly.
|
|
148
|
+
*
|
|
149
|
+
* Same contract as `IconOptions`: a non-empty `iconClass` wins, and
|
|
150
|
+
* this is used only when the caller passes an empty one.
|
|
151
|
+
*/
|
|
152
|
+
innerHTML?: string;
|
|
133
153
|
}
|
|
134
154
|
|
|
135
155
|
interface TypographyOptions {
|
|
@@ -171,6 +191,31 @@ declare module 'punica' {
|
|
|
171
191
|
variant?: 'filled' | 'outlined';
|
|
172
192
|
color?: 'primary' | 'secondary' | 'error' | 'success' | 'warning';
|
|
173
193
|
size?: 'small' | 'medium';
|
|
194
|
+
/**
|
|
195
|
+
* Icon class placed before the label, wrapped in an `<i>`. Same
|
|
196
|
+
* contract as `createIcon`'s `iconClass`.
|
|
197
|
+
*/
|
|
198
|
+
icon?: string;
|
|
199
|
+
/**
|
|
200
|
+
* Extra content after the label — a chevron on a chip that opens a
|
|
201
|
+
* menu, a count, a thumbnail. `punica-chip` slots its children, so
|
|
202
|
+
* these land next to the label rather than replacing it.
|
|
203
|
+
*/
|
|
204
|
+
children?: HTMLElement[];
|
|
205
|
+
/**
|
|
206
|
+
* A dismiss control in the component's `delete` slot. Without this
|
|
207
|
+
* no slot content is written, so a plain chip is unchanged.
|
|
208
|
+
*/
|
|
209
|
+
onDelete?: (e: Event) => void;
|
|
210
|
+
/**
|
|
211
|
+
* Makes the chip act as a button: `role="button"`, `tabindex="0"`
|
|
212
|
+
* and Enter/Space alongside the click. The component styles itself
|
|
213
|
+
* `cursor: unset`, so a chip is inert until this is given.
|
|
214
|
+
*/
|
|
215
|
+
onClick?: (e: Event) => void;
|
|
216
|
+
attrs?: Record<string, string>;
|
|
217
|
+
style?: Record<string, string> | string;
|
|
218
|
+
className?: string;
|
|
174
219
|
}
|
|
175
220
|
|
|
176
221
|
interface BoxOptions {
|
|
@@ -359,6 +404,24 @@ declare module 'punica' {
|
|
|
359
404
|
className?: string;
|
|
360
405
|
}
|
|
361
406
|
|
|
407
|
+
/**
|
|
408
|
+
* Where an anchored menu opens. An element is measured with
|
|
409
|
+
* `getBoundingClientRect`; a bare rect is for the cursor-driven case
|
|
410
|
+
* (a context menu opens at the pointer, which has no element).
|
|
411
|
+
*/
|
|
412
|
+
interface MenuAnchorOptions {
|
|
413
|
+
anchor:
|
|
414
|
+
| HTMLElement
|
|
415
|
+
| {
|
|
416
|
+
top: number;
|
|
417
|
+
left: number;
|
|
418
|
+
bottom?: number;
|
|
419
|
+
width?: number;
|
|
420
|
+
height?: number;
|
|
421
|
+
};
|
|
422
|
+
placement?: 'top' | 'bottom' | 'left' | 'right';
|
|
423
|
+
}
|
|
424
|
+
|
|
362
425
|
interface MenuItemOptions {
|
|
363
426
|
text?: string;
|
|
364
427
|
attrs?: Record<string, string>;
|
|
@@ -492,6 +555,21 @@ declare module 'punica' {
|
|
|
492
555
|
|
|
493
556
|
function createMenuItem(options?: MenuItemOptions): HTMLElement;
|
|
494
557
|
|
|
558
|
+
/**
|
|
559
|
+
* Opens a `punica-menu` beside something. The component does the rest
|
|
560
|
+
* — backdrop, Escape, and flipping when the menu does not fit — but it
|
|
561
|
+
* reads the position off `top`/`left`/`width`/`height`/`bottom`/
|
|
562
|
+
* `placement` attributes, which every caller was measuring and writing
|
|
563
|
+
* by hand.
|
|
564
|
+
*/
|
|
565
|
+
function openMenuAt(
|
|
566
|
+
menu: HTMLElement,
|
|
567
|
+
options: MenuAnchorOptions
|
|
568
|
+
): void;
|
|
569
|
+
|
|
570
|
+
/** Closes an open menu. The component fires `close` as it hides. */
|
|
571
|
+
function closeMenu(menu: HTMLElement): void;
|
|
572
|
+
|
|
495
573
|
/** A resizable pane container. Children become the panes, in order. */
|
|
496
574
|
function createSplit(options?: SplitOptions): HTMLElement;
|
|
497
575
|
|