ooxml-ui 0.24.0 → 0.26.0

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.
@@ -6,6 +6,7 @@ export type OfficeRibbonSelectEvent = CustomEvent<{
6
6
  interface RibbonTab {
7
7
  id: string;
8
8
  label: string;
9
+ contextual: boolean;
9
10
  keytip?: string;
10
11
  keytipPanel?: string;
11
12
  }
@@ -15,8 +16,16 @@ interface RibbonTab {
15
16
  * optionally `data-tab-keytip`; the element builds the tabs from them, keeps exactly one panel
16
17
  * visible and moves between tabs with the arrow keys, Home and End. Slots: `quick-access`,
17
18
  * `search`, `end`. Attributes: `selected`, `label` (tab list name), `file-label` (default "File"),
18
- * `no-file`, `file-expanded`, `file-keytip`. Events: `office-ribbon-select` `{ tab }`
19
+ * `no-file`, `file-expanded`, `file-keytip`. A panel with `data-tab-hidden` keeps its content but has
20
+ * no tab (a contextual tab, or one a customisation removed); if it was selected, the first
21
+ * remaining tab takes over. `data-contextual` on a panel tints its tab (`--office-ribbon-contextual`),
22
+ * for tools that apply to the selection, such as a table's. Events: `office-ribbon-select` `{ tab }`
19
23
  * (cancelable) and `office-ribbon-file` when File is activated.
24
+ *
25
+ * `collapsible` adds Office's collapse button: `collapsed` hides the panels, a click on a tab then
26
+ * shows its panel over the content (`peek`) until Escape, a command or a click elsewhere. Ctrl+F1 and
27
+ * a double click on a tab toggle it. `collapse-label` names the button. Event:
28
+ * `office-ribbon-collapse` `{ collapsed }`.
20
29
  */
21
30
  export declare class OfficeUiRibbon extends OfficeElement {
22
31
  static styles: import("lit").CSSResult[];
@@ -49,6 +58,34 @@ export declare class OfficeUiRibbon extends OfficeElement {
49
58
  attribute: string;
50
59
  type: StringConstructor;
51
60
  };
61
+ collapsible: {
62
+ type: BooleanConstructor;
63
+ reflect: true;
64
+ converter: {
65
+ fromAttribute: (value: string | null) => boolean;
66
+ toAttribute: (value: unknown) => string | null;
67
+ };
68
+ };
69
+ collapsed: {
70
+ type: BooleanConstructor;
71
+ reflect: true;
72
+ converter: {
73
+ fromAttribute: (value: string | null) => boolean;
74
+ toAttribute: (value: unknown) => string | null;
75
+ };
76
+ };
77
+ peek: {
78
+ type: BooleanConstructor;
79
+ reflect: true;
80
+ converter: {
81
+ fromAttribute: (value: string | null) => boolean;
82
+ toAttribute: (value: unknown) => string | null;
83
+ };
84
+ };
85
+ collapseLabel: {
86
+ attribute: string;
87
+ type: StringConstructor;
88
+ };
52
89
  tabs: {
53
90
  state: boolean;
54
91
  };
@@ -58,6 +95,10 @@ export declare class OfficeUiRibbon extends OfficeElement {
58
95
  noFile: boolean;
59
96
  fileExpanded: string | null;
60
97
  fileKeytip: string | null;
98
+ collapsible: boolean;
99
+ collapsed: boolean;
100
+ peek: boolean;
101
+ collapseLabel: string | null;
61
102
  tabs: RibbonTab[];
62
103
  private chosen;
63
104
  constructor();
@@ -67,13 +108,35 @@ export declare class OfficeUiRibbon extends OfficeElement {
67
108
  focusFile(): void;
68
109
  /** Focus the selected tab. */
69
110
  focusTab(): void;
111
+ /** The rendered tab button of `tab`, or null before the first render. */
112
+ tabButton(tab: string): HTMLButtonElement | null;
113
+ /** The rendered File button, or null before the first render. */
114
+ fileButton(): HTMLButtonElement | null;
115
+ /**
116
+ * Hide or show the tab of panel `tab` for one reason (`contextual`, `custom`, ...). The tab shows
117
+ * only while no reason hides it, so a table's tools and a customisation do not undo each other.
118
+ */
119
+ setTabHidden(tab: string, reason: string, hidden: boolean): void;
70
120
  private panels;
121
+ /** The panels that have a tab: those not marked `data-tab-hidden`. */
122
+ private shown;
71
123
  /** Read the tabs off the panels (on connection and whenever the slotted panels change). */
72
124
  private build;
125
+ private setCollapsed;
126
+ private onOutside;
127
+ private onTabDoubleClick;
128
+ /** A command run from an overlaid panel closes it; a menu opener keeps it open. */
129
+ private onPanelClick;
130
+ protected willUpdate(changed: Map<PropertyKey, unknown>): void;
73
131
  private choose;
74
132
  private onTabClick;
133
+ /** Ctrl+F1 and Escape work from anywhere in the ribbon, panels included. */
134
+ private onHostKey;
75
135
  private onKey;
136
+ /** Rebuild the tab row when a panel's label or visibility flag changes. */
137
+ private watcher;
76
138
  connectedCallback(): void;
139
+ disconnectedCallback(): void;
77
140
  /** Exactly one panel shows. */
78
141
  protected updated(): void;
79
142
  protected render(): import("lit").TemplateResult<1>;
package/dist/smartart.js CHANGED
@@ -1,3 +1,3 @@
1
- export { OfficeUiSmartArt, defineSmartArt, renderDiagramDrawing } from './chunk-RVZAYXTI.js';
2
- import './chunk-PCZJV6HQ.js';
3
- import './chunk-HSJH6SUW.js';
1
+ export { OfficeUiSmartArt, defineSmartArt, renderDiagramDrawing } from './chunk-4VQ6S7QJ.js';
2
+ import './chunk-ZWBP2WTC.js';
3
+ import './chunk-7Q7ZS2CC.js';
package/dist/teams.js CHANGED
@@ -1,5 +1,5 @@
1
- export { EMOJI, OfficeUiAppRail, OfficeUiAvatar, OfficeUiCallControls, OfficeUiCallGrid, OfficeUiChannelList, OfficeUiChatComposer, OfficeUiChatList, OfficeUiPrejoin, QUICK_REACTIONS, TEAMS_TAGS, TeamsElement, colorFor, dayLabel, defineAppRail, defineAvatar, defineCallControls, defineCallGrid, defineChannelList, defineChatComposer, defineChatList, definePrejoin, formatElapsed, formatSize, formatTime, icon, registerTeams, withStyles } from './chunk-TCBUC6BI.js';
1
+ export { EMOJI, OfficeUiAppRail, OfficeUiAvatar, OfficeUiCallControls, OfficeUiCallGrid, OfficeUiChannelList, OfficeUiChatComposer, OfficeUiChatList, OfficeUiPrejoin, QUICK_REACTIONS, TEAMS_TAGS, TeamsElement, colorFor, dayLabel, defineAppRail, defineAvatar, defineCallControls, defineCallGrid, defineChannelList, defineChatComposer, defineChatList, definePrejoin, formatElapsed, formatSize, formatTime, icon, registerTeams, withStyles } from './chunk-LE4FTRWB.js';
2
2
  import './chunk-HZ422LTR.js';
3
- import './chunk-XQWRKHC2.js';
4
- import './chunk-PCZJV6HQ.js';
5
- import './chunk-HSJH6SUW.js';
3
+ import './chunk-V6W5DKJ6.js';
4
+ import './chunk-ZWBP2WTC.js';
5
+ import './chunk-7Q7ZS2CC.js';
@@ -0,0 +1,25 @@
1
+ import type { OfficeToken } from './tokens.js';
2
+ /**
3
+ * Feeds the `--office-*` tokens from a product's own theme, so the shared elements follow it.
4
+ * Products (docx, xlsx, pptx, visio) already name their theme after shadcn/ui
5
+ * (`--<prefix>foreground`, `--<prefix>muted-foreground`, ...); `shadcnBridge('--dve-')` is the
6
+ * whole bridge for such a product. `themeBridge` takes any mapping for the rest.
7
+ *
8
+ * The CSS is declared on the selector you give (usually `:host` inside a shadow root, or the
9
+ * product's root element), not on `:root`: a product's colours often resolve where they are read,
10
+ * so a nested theme, a dark scheme or a host override keeps working. Pure strings, no DOM.
11
+ */
12
+ export type ThemeBridgeMap = Partial<Record<OfficeToken, string>>;
13
+ /** `selector { --office-x: value; ... }` for a mapping; entries without a value are skipped. */
14
+ export declare function themeBridge(selector: string, map: ThemeBridgeMap): string;
15
+ export interface ShadcnBridgeOptions {
16
+ /** Extra or overriding `--office-*` values, for example `{ '--office-font': '...' }`. */
17
+ extra?: ThemeBridgeMap;
18
+ /** A literal each theme variable falls back to when the product does not define it. */
19
+ fallbacks?: Partial<Record<string, string>>;
20
+ }
21
+ /**
22
+ * The bridge for a product whose theme variables are `<prefix><shadcn-name>`
23
+ * (`prefix` includes the dashes, for example `'--dve-'` or `'--pptx-'`).
24
+ */
25
+ export declare function shadcnBridge(selector: string, prefix: string, options?: ShadcnBridgeOptions): string;
package/dist/theme.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { shadcnBridge, themeBridge, type ShadcnBridgeOptions, type ThemeBridgeMap, } from './theme-bridge.js';
1
2
  export { COMPACT, FOCUS_RING, OFFICE_TOKENS, tok, TOUCH, type OfficeToken } from './tokens.js';
2
3
  /**
3
4
  * Theme-token foundation. Custom properties cross shadow boundaries, so one `<style>` in the
package/dist/theme.js CHANGED
@@ -1,2 +1,2 @@
1
- export { THEME_CSS, THEME_STYLE_ID, installOfficeUiTheme } from './chunk-2X6QYQ3Q.js';
2
- export { COMPACT, FOCUS_RING, OFFICE_TOKENS, TOUCH, tok } from './chunk-HSJH6SUW.js';
1
+ export { THEME_CSS, THEME_STYLE_ID, installOfficeUiTheme, shadcnBridge, themeBridge } from './chunk-7QLJS57B.js';
2
+ export { COMPACT, FOCUS_RING, OFFICE_TOKENS, TOUCH, tok } from './chunk-7Q7ZS2CC.js';
package/dist/tokens.d.ts CHANGED
@@ -122,6 +122,7 @@ export declare const OFFICE_TOKENS: {
122
122
  readonly '--office-switch-thumb': 'var(--office-foreground, #1f2937)';
123
123
  readonly '--office-switch-thumb-on': 'var(--office-accent-foreground, #ffffff)';
124
124
  readonly '--office-ribbon-tab-height': '35px';
125
+ readonly '--office-ribbon-contextual': 'var(--office-accent, #2563eb)';
125
126
  readonly '--office-ribbon-group-gap': '2px';
126
127
  readonly '--office-ribbon-group-height': '78px';
127
128
  readonly '--office-ribbon-group-padding': '4px 8px 2px';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml-ui",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "Shared, format-neutral web components and styles for the Office viewers (Word, PowerPoint, Excel)",
5
5
  "keywords": [
6
6
  "custom-elements",
@@ -23,6 +23,7 @@
23
23
  },
24
24
  "files": [
25
25
  "dist",
26
+ "custom-elements.json",
26
27
  "LICENSE",
27
28
  "NOTICE",
28
29
  "README.md"
@@ -68,7 +69,8 @@
68
69
  "import": "./dist/teams.js",
69
70
  "default": "./dist/teams.js"
70
71
  },
71
- "./package.json": "./package.json"
72
+ "./package.json": "./package.json",
73
+ "./custom-elements.json": "./custom-elements.json"
72
74
  },
73
75
  "publishConfig": {
74
76
  "access": "public"
@@ -78,11 +80,12 @@
78
80
  "prepack": "node scripts/ensure-built.mjs",
79
81
  "typecheck": "tsc -p tsconfig.json --noEmit",
80
82
  "test": "vitest run",
81
- "test:package": "node scripts/package-smoke.mjs"
83
+ "test:package": "node scripts/package-smoke.mjs",
84
+ "gen:manifest": "node scripts/gen-manifest.mjs"
82
85
  },
83
86
  "dependencies": {
84
87
  "lit": "^3.3.3",
85
- "ooxml-core": "^0.16.0"
88
+ "ooxml-core": "^0.17.0"
86
89
  },
87
90
  "devDependencies": {
88
91
  "@types/jsdom": "^30.0.0",
@@ -93,5 +96,6 @@
93
96
  },
94
97
  "engines": {
95
98
  "node": ">=22"
96
- }
99
+ },
100
+ "customElements": "custom-elements.json"
97
101
  }