@punica/editor 1.10.0 → 1.10.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punica/editor",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "description": "Punica Editor",
5
5
  "private": false,
6
6
  "type": "module",
@@ -64,7 +64,7 @@ declare module 'punica' {
64
64
 
65
65
  /** A profile's app bar composition (see `ProfileShellSpec.appBar`). */
66
66
  interface AppBarSpec {
67
- /** Bar height in px. Defaults to 38. */
67
+ /** Bar height in px. Defaults to 30. */
68
68
  height?: number;
69
69
  /** What the centre region shows. Defaults to `'workspace'`. */
70
70
  title?: AppBarTitleMode;
@@ -36,6 +36,7 @@ declare module 'punica' {
36
36
  | 'punica-date-picker'
37
37
  | 'punica-drawer'
38
38
  | 'punica-paper'
39
+ | 'punica-split'
39
40
  | 'punica-split-button'
40
41
  | 'punica-card'
41
42
  | 'punica-card-header'
@@ -73,6 +74,8 @@ declare module 'punica' {
73
74
  | 'punica-toggle-button-group'
74
75
  | 'punica-context-menu'
75
76
  | 'punica-context-menu-item'
77
+ | 'punica-context-menu-separator'
78
+ /** @deprecated Misspelling of `punica-context-menu-separator`. */
76
79
  | 'punica-context-menu-sperator'
77
80
  | 'punica-toolbar'
78
81
  | 'punica-toast'
@@ -130,18 +130,48 @@ declare module 'punica' {
130
130
  variant?: 'text' | 'outlined' | 'filled';
131
131
  disabled?: boolean;
132
132
  attrs?: Record<string, string>;
133
+ style?: Record<string, string> | string;
134
+ className?: string;
135
+ /**
136
+ * Finished icon markup, for the cases the positional `iconClass`
137
+ * cannot express — a toolbar action declares its icon as ready
138
+ * `<i>`/`<svg>` markup rather than a class name, so wrapping it in
139
+ * another `<i class=…>` would nest it wrongly.
140
+ *
141
+ * Same contract as `IconOptions`: a non-empty `iconClass` wins, and
142
+ * this is used only when the caller passes an empty one.
143
+ */
144
+ innerHTML?: string;
133
145
  }
134
146
 
135
147
  interface TypographyOptions {
148
+ /**
149
+ * Every variant `punica-typography` ships a `:host([variant=…])`
150
+ * rule for, and nothing else.
151
+ *
152
+ * This list was previously `'h1'..'h6' | 'body' | 'caption'`, of
153
+ * which only `caption` was real. An unknown variant is not a
154
+ * harmless no-op: the component stamps `variant="body1"` on any
155
+ * element created *without* one, so passing a name it does not
156
+ * implement suppresses that default and leaves the text at the
157
+ * inherited size, `inline`, with no `role=heading` and no
158
+ * `aria-level`. `createTypography` therefore drops anything outside
159
+ * this list rather than writing it to the DOM.
160
+ */
136
161
  variant?:
137
- | 'h1'
138
- | 'h2'
139
- | 'h3'
140
- | 'h4'
141
- | 'h5'
142
- | 'h6'
143
- | 'body'
144
- | 'caption';
162
+ | 'headline1'
163
+ | 'headline2'
164
+ | 'headline3'
165
+ | 'headline4'
166
+ | 'headline5'
167
+ | 'headline6'
168
+ | 'subtitle1'
169
+ | 'subtitle2'
170
+ | 'body1'
171
+ | 'body2'
172
+ | 'button'
173
+ | 'caption'
174
+ | 'overline';
145
175
  color?: 'primary' | 'secondary' | 'error';
146
176
  fontWeight?: 'normal' | 'bold';
147
177
  style?: Record<string, string> | string;
@@ -298,12 +328,22 @@ declare module 'punica' {
298
328
  attrs?: Record<string, string>;
299
329
  children?: HTMLElement[];
300
330
  onChange?: (value: string) => void;
331
+ style?: Record<string, string> | string;
332
+ className?: string;
301
333
  }
302
334
 
303
335
  interface TabItemOptions {
304
336
  value: string;
305
337
  text?: string;
306
338
  attrs?: Record<string, string>;
339
+ /**
340
+ * A tab is rarely just text: the shell's own strips put an icon
341
+ * column, a truncating label and a close button inside one, so the
342
+ * item has to accept a subtree and carry its own sizing.
343
+ */
344
+ children?: HTMLElement[];
345
+ style?: Record<string, string> | string;
346
+ className?: string;
307
347
  }
308
348
 
309
349
  interface TabPanelOptions {
@@ -338,6 +378,37 @@ declare module 'punica' {
338
378
  style?: Record<string, string> | string;
339
379
  className?: string;
340
380
  children?: HTMLElement[];
381
+ /**
382
+ * Raw markup for the row's body, for the cases `text` cannot express
383
+ * — an icon, a label and a checkmark on one line. `punica-menu-item`
384
+ * slots into a `display: block` host and the menu clones itself into
385
+ * `document.body`, out of reach of any scoped stylesheet, so that
386
+ * row has to arrive as inline-styled markup. Written before
387
+ * `children`, and `text` still wins if both are given.
388
+ */
389
+ innerHTML?: string;
390
+ }
391
+
392
+ interface SplitOptions {
393
+ orientation?: 'horizontal' | 'vertical';
394
+ /** Pane sizes as percentages, in pane order. */
395
+ sizes?: number[];
396
+ attrs?: Record<string, string>;
397
+ children?: HTMLElement[];
398
+ style?: Record<string, string> | string;
399
+ className?: string;
400
+ }
401
+
402
+ interface ContextMenuOptions {
403
+ /**
404
+ * CSS selector for the element the menu attaches to, written to the
405
+ * component's `target` attribute.
406
+ */
407
+ target?: string;
408
+ /** Built once, unlike `attachContextMenu`'s per-right-click items. */
409
+ items: MenuItemSpec[];
410
+ onSelect: (value: string) => void;
411
+ attrs?: Record<string, string>;
341
412
  }
342
413
 
343
414
  interface LinkOptions {
@@ -370,15 +441,21 @@ declare module 'punica' {
370
441
  options?: CreateElementOptions
371
442
  ): HTMLElement;
372
443
 
444
+ /**
445
+ * `onClick` receives the click event. It was declared `() => void`,
446
+ * which no handler that needs the event (to stop propagation, or to
447
+ * position a flyout off the cursor) could satisfy.
448
+ */
373
449
  function createButton(
374
450
  label: string,
375
- onClick: () => void,
451
+ onClick: (event: MouseEvent) => void,
376
452
  options?: ButtonOptions
377
453
  ): HTMLElement;
378
454
 
455
+ /** `onClick` receives the click event — see `createButton`. */
379
456
  function createIconButton(
380
457
  iconClass: string,
381
- onClick: () => void,
458
+ onClick: (event: MouseEvent) => void,
382
459
  options?: IconButtonOptions
383
460
  ): HTMLElement;
384
461
 
@@ -427,6 +504,15 @@ declare module 'punica' {
427
504
 
428
505
  function createMenuItem(options?: MenuItemOptions): HTMLElement;
429
506
 
507
+ /** A resizable pane container. Children become the panes, in order. */
508
+ function createSplit(options?: SplitOptions): HTMLElement;
509
+
510
+ /**
511
+ * A right-click menu whose items are fixed. Use `attachContextMenu`
512
+ * instead when the items depend on the row under the cursor.
513
+ */
514
+ function createContextMenu(options: ContextMenuOptions): HTMLElement;
515
+
430
516
  function createLink(text: string, options: LinkOptions): HTMLElement;
431
517
 
432
518
  function createToolbar(options?: ToolbarOptions): HTMLElement;