@punica/editor 1.9.1 → 1.10.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punica/editor",
3
- "version": "1.9.1",
3
+ "version": "1.10.1",
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'
@@ -133,15 +133,33 @@ declare module 'punica' {
133
133
  }
134
134
 
135
135
  interface TypographyOptions {
136
+ /**
137
+ * Every variant `punica-typography` ships a `:host([variant=…])`
138
+ * rule for, and nothing else.
139
+ *
140
+ * This list was previously `'h1'..'h6' | 'body' | 'caption'`, of
141
+ * which only `caption` was real. An unknown variant is not a
142
+ * harmless no-op: the component stamps `variant="body1"` on any
143
+ * element created *without* one, so passing a name it does not
144
+ * implement suppresses that default and leaves the text at the
145
+ * inherited size, `inline`, with no `role=heading` and no
146
+ * `aria-level`. `createTypography` therefore drops anything outside
147
+ * this list rather than writing it to the DOM.
148
+ */
136
149
  variant?:
137
- | 'h1'
138
- | 'h2'
139
- | 'h3'
140
- | 'h4'
141
- | 'h5'
142
- | 'h6'
143
- | 'body'
144
- | 'caption';
150
+ | 'headline1'
151
+ | 'headline2'
152
+ | 'headline3'
153
+ | 'headline4'
154
+ | 'headline5'
155
+ | 'headline6'
156
+ | 'subtitle1'
157
+ | 'subtitle2'
158
+ | 'body1'
159
+ | 'body2'
160
+ | 'button'
161
+ | 'caption'
162
+ | 'overline';
145
163
  color?: 'primary' | 'secondary' | 'error';
146
164
  fontWeight?: 'normal' | 'bold';
147
165
  style?: Record<string, string> | string;
@@ -298,12 +316,22 @@ declare module 'punica' {
298
316
  attrs?: Record<string, string>;
299
317
  children?: HTMLElement[];
300
318
  onChange?: (value: string) => void;
319
+ style?: Record<string, string> | string;
320
+ className?: string;
301
321
  }
302
322
 
303
323
  interface TabItemOptions {
304
324
  value: string;
305
325
  text?: string;
306
326
  attrs?: Record<string, string>;
327
+ /**
328
+ * A tab is rarely just text: the shell's own strips put an icon
329
+ * column, a truncating label and a close button inside one, so the
330
+ * item has to accept a subtree and carry its own sizing.
331
+ */
332
+ children?: HTMLElement[];
333
+ style?: Record<string, string> | string;
334
+ className?: string;
307
335
  }
308
336
 
309
337
  interface TabPanelOptions {
@@ -338,6 +366,37 @@ declare module 'punica' {
338
366
  style?: Record<string, string> | string;
339
367
  className?: string;
340
368
  children?: HTMLElement[];
369
+ /**
370
+ * Raw markup for the row's body, for the cases `text` cannot express
371
+ * — an icon, a label and a checkmark on one line. `punica-menu-item`
372
+ * slots into a `display: block` host and the menu clones itself into
373
+ * `document.body`, out of reach of any scoped stylesheet, so that
374
+ * row has to arrive as inline-styled markup. Written before
375
+ * `children`, and `text` still wins if both are given.
376
+ */
377
+ innerHTML?: string;
378
+ }
379
+
380
+ interface SplitOptions {
381
+ orientation?: 'horizontal' | 'vertical';
382
+ /** Pane sizes as percentages, in pane order. */
383
+ sizes?: number[];
384
+ attrs?: Record<string, string>;
385
+ children?: HTMLElement[];
386
+ style?: Record<string, string> | string;
387
+ className?: string;
388
+ }
389
+
390
+ interface ContextMenuOptions {
391
+ /**
392
+ * CSS selector for the element the menu attaches to, written to the
393
+ * component's `target` attribute.
394
+ */
395
+ target?: string;
396
+ /** Built once, unlike `attachContextMenu`'s per-right-click items. */
397
+ items: MenuItemSpec[];
398
+ onSelect: (value: string) => void;
399
+ attrs?: Record<string, string>;
341
400
  }
342
401
 
343
402
  interface LinkOptions {
@@ -370,15 +429,21 @@ declare module 'punica' {
370
429
  options?: CreateElementOptions
371
430
  ): HTMLElement;
372
431
 
432
+ /**
433
+ * `onClick` receives the click event. It was declared `() => void`,
434
+ * which no handler that needs the event (to stop propagation, or to
435
+ * position a flyout off the cursor) could satisfy.
436
+ */
373
437
  function createButton(
374
438
  label: string,
375
- onClick: () => void,
439
+ onClick: (event: MouseEvent) => void,
376
440
  options?: ButtonOptions
377
441
  ): HTMLElement;
378
442
 
443
+ /** `onClick` receives the click event — see `createButton`. */
379
444
  function createIconButton(
380
445
  iconClass: string,
381
- onClick: () => void,
446
+ onClick: (event: MouseEvent) => void,
382
447
  options?: IconButtonOptions
383
448
  ): HTMLElement;
384
449
 
@@ -427,6 +492,15 @@ declare module 'punica' {
427
492
 
428
493
  function createMenuItem(options?: MenuItemOptions): HTMLElement;
429
494
 
495
+ /** A resizable pane container. Children become the panes, in order. */
496
+ function createSplit(options?: SplitOptions): HTMLElement;
497
+
498
+ /**
499
+ * A right-click menu whose items are fixed. Use `attachContextMenu`
500
+ * instead when the items depend on the row under the cursor.
501
+ */
502
+ function createContextMenu(options: ContextMenuOptions): HTMLElement;
503
+
430
504
  function createLink(text: string, options: LinkOptions): HTMLElement;
431
505
 
432
506
  function createToolbar(options?: ToolbarOptions): HTMLElement;