oasis-editor 0.0.228 → 0.0.230

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.
@@ -9,6 +9,7 @@ export interface SplitButtonProps {
9
9
  ribbonSize?: "normal" | "large";
10
10
  /** Main (left) button. */
11
11
  mainContent: JSX.Element;
12
+ mainLabel?: string;
12
13
  mainTestId?: string;
13
14
  mainAriaLabel?: string;
14
15
  mainPressed?: boolean;
@@ -0,0 +1,7 @@
1
+ /** Logical ownership is preserved even when panels are portalled to body. */
2
+ export interface PopoverBranch {
3
+ open: () => boolean;
4
+ contains: (target: Node) => boolean;
5
+ children: Set<PopoverBranch>;
6
+ }
7
+ export declare const PopoverBranchContext: import('solid-js').Context<PopoverBranch | undefined>;
@@ -3,7 +3,9 @@ export interface DismissOptions {
3
3
  /** Elements that should NOT trigger a dismiss when clicked (anchor + panel). */
4
4
  refs: Accessor<Array<HTMLElement | undefined>>;
5
5
  open: Accessor<boolean>;
6
- onDismiss: () => void;
6
+ onDismiss: (reason: "outside" | "escape") => void;
7
+ isInside?: (target: Node) => boolean;
8
+ canDismissOnEscape?: () => boolean;
7
9
  /** Dismiss when Escape is pressed. Defaults to true. */
8
10
  closeOnEscape?: boolean;
9
11
  }
@@ -1,8 +1,9 @@
1
1
  import { JSX } from 'solid-js';
2
2
  import { ToolbarActionApi } from '../schema/items.js';
3
- import { ResolvedRibbonGroupModel } from './ribbonModel.js';
3
+ import { RibbonGroupWidth, ResolvedRibbonGroupModel } from './ribbonModel.js';
4
4
  export interface RibbonGroupProps {
5
5
  group: ResolvedRibbonGroupModel;
6
6
  api: ToolbarActionApi;
7
+ measurements?: RibbonGroupWidth;
7
8
  }
8
9
  export declare function RibbonGroup(props: RibbonGroupProps): JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { RibbonGroupModel, RibbonGroupWidth } from './ribbonModel.js';
2
+ /**
3
+ * Measure inert DOM copies of every state. No duplicate Solid controls, event
4
+ * handlers, focus effects or command dispatch are mounted for measurement.
5
+ * The copies share their owning toolbar's CSS/theme and are removed in the
6
+ * same synchronous task, before painting or any observer callback can run.
7
+ */
8
+ export declare function measureRibbonGroups(panel: HTMLElement, groups: RibbonGroupModel[]): Record<string, RibbonGroupWidth>;
@@ -1,4 +1,4 @@
1
- import { RibbonGroupResizePolicy, RibbonGroupResizeState, RibbonRow, RibbonTabId, ToolbarActionApi, ToolbarItem } from '../schema/items.js';
1
+ import { RibbonGroupResizePolicy, RibbonGroupLayout, RibbonGroupResizeState, RibbonRow, RibbonTabId, ToolbarActionApi, ToolbarItem } from '../schema/items.js';
2
2
  import { TranslateFn } from '../../../../i18n/index.js';
3
3
  export interface RibbonTabDefinition {
4
4
  id: RibbonTabId;
@@ -10,6 +10,7 @@ export interface RibbonGroupModel {
10
10
  id: string;
11
11
  label: string;
12
12
  largeItems: ToolbarItem[];
13
+ layout: RibbonGroupLayout;
13
14
  rows: Record<RibbonRow, ToolbarItem[]>;
14
15
  order: number;
15
16
  resizePolicy: Required<RibbonGroupResizePolicy>;
@@ -17,8 +18,12 @@ export interface RibbonGroupModel {
17
18
  export interface ResolvedRibbonGroupModel extends RibbonGroupModel {
18
19
  resizeState: RibbonGroupResizeState;
19
20
  allocatedWidth?: number;
21
+ measuredWidth?: number;
22
+ compactChrome?: number;
20
23
  }
21
24
  export interface RibbonGroupWidth {
25
+ /** Outer group width beyond a single compact style gallery. */
26
+ compactChrome?: number;
22
27
  full: number;
23
28
  compact: number;
24
29
  collapsed: number;
@@ -38,5 +43,13 @@ export declare function normalizeRibbonGroup(group: ToolbarItem["group"]): strin
38
43
  export declare function normalizeRibbonRow(row: ToolbarItem["row"]): RibbonRow;
39
44
  export declare function isLargeRibbonItem(item: ToolbarItem): boolean;
40
45
  export declare function ribbonGroupLabel(group: string, t: TranslateFn): string;
46
+ /** Filter reactive visibility before grouping, without hiding disabled actions. */
47
+ export declare function visibleRibbonItems(items: ToolbarItem[], api: ToolbarActionApi): ToolbarItem[];
41
48
  export declare function buildRibbonGroups(items: ToolbarItem[], tab: RibbonTabId, t: TranslateFn): RibbonGroupModel[];
49
+ /**
50
+ * Resolve from a fixed reduction ladder. There is no history-dependent repair
51
+ * pass: reducing the budget cannot restore a group by collapsing a neighbour.
52
+ * Compact states precede collapse; explicit priority then right-to-left order
53
+ * determines each step. Measured widths include the group's own chrome.
54
+ */
42
55
  export declare function resolveResponsiveRibbonGroups(groups: RibbonGroupModel[], availableWidth: number | null, measurements?: Partial<Record<string, Partial<RibbonGroupWidth>>>): ResolvedRibbonGroupModel[];
@@ -3,8 +3,8 @@ import { CommandBus } from '../../../../core/commands/CommandBus.js';
3
3
  import { CommandRef } from '../../../../core/commands/CommandRef.js';
4
4
  import { TranslationKey } from '../../../../i18n/index.js';
5
5
  import { ColorPalette } from './palette.js';
6
- import { RibbonGroupResizePolicy, RibbonTabId, RibbonRow, RibbonSize } from '../../../../core/pluginUiTypes.js';
7
- export { RIBBON_TABS, CONTEXTUAL_TABS, type RibbonTabId, type RibbonRow, type RibbonSize, type RibbonGroupResizePolicy, type RibbonGroupResizeState, } from '../../../../core/pluginUiTypes.js';
6
+ import { RibbonGroupResizePolicy, RibbonTabId, RibbonRow, RibbonGroupLayout, RibbonSize } from '../../../../core/pluginUiTypes.js';
7
+ export { RIBBON_TABS, CONTEXTUAL_TABS, type RibbonTabId, type RibbonRow, type RibbonGroupLayout, type RibbonSize, type RibbonGroupResizePolicy, type RibbonGroupResizeState, } from '../../../../core/pluginUiTypes.js';
8
8
  /** Reactive snapshot of a command's state, as consumed by toolbar items. */
9
9
  export interface ToolbarCommandState {
10
10
  isEnabled: boolean;
@@ -67,7 +67,8 @@ export interface ItemReactiveOverrides {
67
67
  */
68
68
  value?: (api: ToolbarActionApi) => unknown;
69
69
  /**
70
- * Contextual visibility — item stays mounted; the renderer toggles display.
70
+ * Contextual visibility. Compact controls toggle display; the Ribbon
71
+ * recomposes visible groups so hidden actions do not reserve space.
71
72
  * @param api - The toolbar action API.
72
73
  * @returns Whether the item should be visible.
73
74
  */
@@ -80,12 +81,15 @@ interface ToolbarItemBase extends ItemReactiveOverrides {
80
81
  tab?: RibbonTabId;
81
82
  /** Logical section id (used for grouping/ordering, not rendering layout). */
82
83
  group?: string;
83
- /** Two-row ribbon placement. Missing values default to row 1. */
84
+ /** Human-readable contribution label; unknown groups otherwise use General. */
85
+ groupLabel?: string;
86
+ /** Row placement. Row 3 opts the group into the three-row layout. */
84
87
  row?: RibbonRow;
85
88
  /** Ribbon-only visual scale. Large items span both toolbar rows. */
86
89
  ribbonSize?: RibbonSize;
87
90
  /** Group-level responsive behavior. First item wins per property. */
88
91
  ribbonGroupResize?: RibbonGroupResizePolicy;
92
+ ribbonGroupLayout?: RibbonGroupLayout;
89
93
  testId?: string;
90
94
  tooltipKey?: TranslationKey;
91
95
  tooltip?: string;
@@ -116,6 +120,8 @@ export type MenuContent = {
116
120
  };
117
121
  export interface SplitItem extends ToolbarItemBase {
118
122
  type: "split";
123
+ labelKey?: TranslationKey;
124
+ label?: string;
119
125
  /** Command the main button dispatches (the chevron opens `menu`). */
120
126
  command: CommandRef;
121
127
  /** Chevron-opened content. */
@@ -204,8 +210,11 @@ export interface SeparatorItem {
204
210
  order?: number;
205
211
  tab?: RibbonTabId;
206
212
  group?: string;
213
+ /** Human-readable contribution label; unknown groups otherwise use General. */
214
+ groupLabel?: string;
207
215
  row?: RibbonRow;
208
216
  ribbonGroupResize?: RibbonGroupResizePolicy;
217
+ ribbonGroupLayout?: RibbonGroupLayout;
209
218
  /**
210
219
  * @param api - The toolbar action API.
211
220
  * @returns Whether the separator should be visible.
@@ -1,2 +1,6 @@
1
+ /** Create a node that a reactive renderer can own without replacing its DOM. */
2
+ export declare function createLucideSvg(name: string, attributes?: Record<string, string>): SVGElement | undefined;
3
+ /** Resolve placeholders once. Existing SVGs retain their identity on DOM changes. */
1
4
  export declare function startIconObserver(root?: HTMLElement): void;
2
- export declare function stopIconObserver(): void;
5
+ /** Editors sharing an observer release their own subscription only. */
6
+ export declare function stopIconObserver(root?: HTMLElement): void;
@@ -40,10 +40,7 @@ export declare const CheckIcon: (props: {
40
40
  size?: number;
41
41
  }) => JSX.Element;
42
42
  export declare function getCustomIcon(name?: string): CustomIconRenderer | undefined;
43
- /**
44
- * Renders an icon by name: a registered custom inline SVG when available,
45
- * otherwise a lucide `<i data-lucide>` placeholder resolved by the icon observer.
46
- */
43
+ /** Custom vectors and Lucide nodes remain owned by Solid across name changes. */
47
44
  export declare function ToolIcon(props: {
48
45
  name: string;
49
46
  }): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis-editor",
3
- "version": "0.0.228",
3
+ "version": "0.0.230",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -69,7 +69,14 @@
69
69
  "check:native-ui": "node ./scripts/check-native-ui-elements.mjs",
70
70
  "typecheck": "tsc --noEmit",
71
71
  "lint": "eslint src --ext .ts,.tsx",
72
- "format": "prettier --write \"src/**/*.{ts,tsx}\""
72
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
73
+ "audit:ribbon:icons": "node scripts/audit-ribbon-icons.mjs",
74
+ "capture:ribbon": "node scripts/capture-ribbon-reference.mjs",
75
+ "test:ribbon:browser": "node scripts/verify-ribbon-reference.mjs",
76
+ "test:ribbon:resize": "node scripts/verify-ribbon-resize.mjs",
77
+ "test:ribbon:ci": "node scripts/verify-ribbon-ci.mjs",
78
+ "test:ribbon:contexts": "node scripts/verify-ribbon-contexts.mjs",
79
+ "test:ribbon:icons": "node scripts/verify-ribbon-icons.mjs"
73
80
  },
74
81
  "devDependencies": {
75
82
  "@eslint/js": "^10.0.1",