ooxml-ui 0.20.0 → 0.21.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.
Files changed (114) hide show
  1. package/README.md +47 -2
  2. package/dist/base.d.ts +118 -0
  3. package/dist/{account.d.ts → chrome/account-profile.d.ts} +0 -6
  4. package/dist/chrome/account.d.ts +17 -0
  5. package/dist/chrome/backstage.d.ts +78 -0
  6. package/dist/chrome/find-bar.d.ts +111 -0
  7. package/dist/chrome/print-preview.d.ts +39 -0
  8. package/dist/chrome/ruler.d.ts +43 -0
  9. package/dist/chrome/status-bar.d.ts +80 -0
  10. package/dist/chrome/status-item.d.ts +40 -0
  11. package/dist/chrome/tab-strip.d.ts +88 -0
  12. package/dist/chrome/title-bar-types.d.ts +75 -0
  13. package/dist/chrome/title-bar.d.ts +81 -0
  14. package/dist/{chunk-7XBKSYGM.js → chunk-2X6QYQ3Q.js} +10 -1
  15. package/dist/{chunk-4JQLQROF.js → chunk-3MDKXKKQ.js} +53 -65
  16. package/dist/chunk-5A4REH6T.js +259 -0
  17. package/dist/chunk-E47762NY.js +90 -0
  18. package/dist/chunk-HNGJI5EZ.js +834 -0
  19. package/dist/{chunk-G3LAGZEW.js → chunk-HSJH6SUW.js} +33 -1
  20. package/dist/{chunk-W5PYFBEZ.js → chunk-HZ422LTR.js} +1 -49
  21. package/dist/chunk-UTLCJKYC.js +4527 -0
  22. package/dist/controls.d.ts +56 -46
  23. package/dist/controls.js +5 -5
  24. package/dist/dialog/dialog-footer.d.ts +40 -0
  25. package/dist/dialog/dialog.d.ts +52 -0
  26. package/dist/{options.d.ts → dialog/options-dialog.d.ts} +46 -1
  27. package/dist/form/checkable.d.ts +49 -0
  28. package/dist/form/checkbox.d.ts +8 -0
  29. package/dist/form/radio.d.ts +68 -0
  30. package/dist/form/search-field.d.ts +54 -0
  31. package/dist/{select-menu.d.ts → form/select-menu.d.ts} +3 -13
  32. package/dist/form/select.d.ts +115 -0
  33. package/dist/form/switch.d.ts +11 -0
  34. package/dist/form/zoom-slider.d.ts +61 -0
  35. package/dist/glyph.d.ts +2 -0
  36. package/dist/icon.d.ts +19 -0
  37. package/dist/icons.d.ts +0 -3
  38. package/dist/icons.js +1 -3
  39. package/dist/index.d.ts +4 -1
  40. package/dist/index.js +16 -12
  41. package/dist/menu/command-search.d.ts +74 -0
  42. package/dist/menu/context-menu.d.ts +89 -0
  43. package/dist/menu/menu-button.d.ts +77 -0
  44. package/dist/menu/menu-item.d.ts +52 -0
  45. package/dist/menu/menu-separator.d.ts +7 -0
  46. package/dist/notices/paste-options.d.ts +41 -0
  47. package/dist/notices/read-only-banner.d.ts +53 -0
  48. package/dist/notices/toasts.d.ts +40 -0
  49. package/dist/presence/presence.d.ts +53 -0
  50. package/dist/presence.d.ts +1 -31
  51. package/dist/presence.js +3 -3
  52. package/dist/ribbon/button.d.ts +60 -0
  53. package/dist/ribbon/gallery-styles.d.ts +2 -0
  54. package/dist/ribbon/gallery.d.ts +97 -0
  55. package/dist/ribbon/ribbon-group.d.ts +35 -0
  56. package/dist/{ribbon-section.d.ts → ribbon/ribbon-section.d.ts} +14 -1
  57. package/dist/ribbon/ribbon-stack.d.ts +10 -0
  58. package/dist/ribbon/ribbon-tabs.d.ts +82 -0
  59. package/dist/ribbon/ribbon-toggle.d.ts +49 -0
  60. package/dist/ribbon/ribbon-toolbar.d.ts +15 -0
  61. package/dist/smartart/smartart.d.ts +43 -0
  62. package/dist/smartart.d.ts +1 -14
  63. package/dist/smartart.js +3 -3
  64. package/dist/styles.d.ts +1 -4
  65. package/dist/teams/app-rail.d.ts +29 -0
  66. package/dist/teams/avatar.d.ts +39 -0
  67. package/dist/teams/base.d.ts +17 -0
  68. package/dist/teams/call-controls.d.ts +61 -0
  69. package/dist/teams/call-grid.d.ts +33 -0
  70. package/dist/teams/channel-list.d.ts +40 -0
  71. package/dist/teams/chat-composer.d.ts +60 -0
  72. package/dist/teams/chat-list.d.ts +51 -0
  73. package/dist/teams/icons.d.ts +3 -0
  74. package/dist/teams/index.d.ts +14 -0
  75. package/dist/teams/prejoin.d.ts +40 -0
  76. package/dist/teams.js +5 -0
  77. package/dist/theme.js +2 -2
  78. package/dist/tokens.d.ts +245 -214
  79. package/package.json +12 -6
  80. package/dist/backstage.d.ts +0 -28
  81. package/dist/button.d.ts +0 -14
  82. package/dist/checkable.d.ts +0 -4
  83. package/dist/chrome-controls.d.ts +0 -52
  84. package/dist/chunk-24MMSCKW.js +0 -119
  85. package/dist/chunk-UEJ4F33J.js +0 -78
  86. package/dist/chunk-W7YI5DSJ.js +0 -5970
  87. package/dist/command-search.d.ts +0 -18
  88. package/dist/context-menu.d.ts +0 -20
  89. package/dist/dialog.d.ts +0 -13
  90. package/dist/document-notices.d.ts +0 -55
  91. package/dist/find-bar.d.ts +0 -15
  92. package/dist/gallery-styles.d.ts +0 -7
  93. package/dist/gallery-view.d.ts +0 -53
  94. package/dist/gallery.d.ts +0 -20
  95. package/dist/menu.d.ts +0 -15
  96. package/dist/print-preview.d.ts +0 -11
  97. package/dist/radio.d.ts +0 -1
  98. package/dist/ribbon-tabs.d.ts +0 -14
  99. package/dist/ribbon-toggle.d.ts +0 -1
  100. package/dist/ribbon.d.ts +0 -24
  101. package/dist/ruler.d.ts +0 -10
  102. package/dist/search-field.d.ts +0 -1
  103. package/dist/select-styles.d.ts +0 -6
  104. package/dist/select.d.ts +0 -19
  105. package/dist/status-bar-view.d.ts +0 -50
  106. package/dist/status-bar.d.ts +0 -19
  107. package/dist/tab-strip.d.ts +0 -20
  108. package/dist/title-bar-search.d.ts +0 -43
  109. package/dist/title-bar-strip.d.ts +0 -20
  110. package/dist/title-bar.d.ts +0 -49
  111. package/dist/zoom-slider.d.ts +0 -9
  112. /package/dist/{menu-model.d.ts → menu/menu-model.d.ts} +0 -0
  113. /package/dist/{safe-svg.d.ts → ribbon/safe-svg.d.ts} +0 -0
  114. /package/dist/{smartart-svg.d.ts → smartart/smartart-svg.d.ts} +0 -0
package/README.md CHANGED
@@ -9,8 +9,9 @@
9
9
  [Try the apps](https://christophervr.github.io/ooxml/) | [npm](https://www.npmjs.com/package/ooxml-ui) | [Full docs](https://christophervr.github.io/ooxml/) | [Source](https://github.com/ChristopherVR/ooxml)
10
10
 
11
11
  Shared, format-neutral web components and styles for the Office viewers (Word, PowerPoint and
12
- Excel). Vanilla custom elements with shadow-root controls, typed events, no framework and no
13
- runtime dependency except `ooxml-core` (types and a few pure helpers).
12
+ Excel). Custom elements with shadow-root controls and typed events, no framework. The runtime
13
+ dependencies are `ooxml-core` (types and a few pure helpers) and `lit`, which every element is built on
14
+ (see "How the elements are built").
14
15
 
15
16
  > **You do not install this package.** It is a regular `dependency` of every published editor
16
17
  > package (`docx-*-viewer`, `pptx-*-viewer` and `xlsx-*-viewer`), so installing the editor of your framework pulls it
@@ -19,6 +20,50 @@ runtime dependency except `ooxml-core` (types and a few pure helpers).
19
20
  > package, which registers them for you. Importing `ooxml-ui` directly is for
20
21
  > the viewer packages themselves and for people building their own Office-style UI.
21
22
 
23
+ ## How the elements are built
24
+
25
+ Every element is a Lit class that reads like a component, in a folder named for what it is:
26
+ `<name>.ts` holds the reactive properties and a `render()` template, `<name>.css` the styles (a real
27
+ stylesheet imported as `?raw`, tokens only). The folders are `form/` (checkbox, switch, radio, select,
28
+ search, zoom), `ribbon/` (button, group, stack, toolbar, tabs, section, toggle), `menu/` (menu button
29
+ and item, separator, context menu, command search), `dialog/` (dialog, options dialog, dialog footer),
30
+ `notices/` (toasts, read-only banner, paste options), `chrome/` (title bar, status bar and item, tab
31
+ strip, backstage, account, find bar, print preview, ruler), `presence/`, `smartart/` and `teams/`.
32
+
33
+ - **`OfficeElement`** (`base.ts`) is the base class, exported for products that build their own
34
+ elements. Bare `var(--office-x)` in a `.css` file gets the token's default when the sheet loads
35
+ (`withTokens`), so an element renders correctly with or without the installed theme.
36
+ - **Updates are synchronous.** Setting a property or attribute redraws the shadow DOM before the call
37
+ returns (the contract the earlier hand-built elements had and every test relies on). The team
38
+ elements keep Lit's batched updates (`static syncUpdates = false`).
39
+ - **Products subclass these elements** (pptx-viewer registers `pptx-ui-*` aliases that keep their own
40
+ event names and ids), so the base class keeps what those subclasses lean on: the shadow root exists
41
+ when the constructor returns, a connected element renders on first `shadowRoot` read or in a
42
+ microtask even if a subclass skips `super.connectedCallback()`, and a property that a product hook
43
+ reads as an attribute (`icon`, `command`, `launcher`, `placement`) writes the attribute through.
44
+ A constructor must not assign a property a subclass may override with its own accessor (it would
45
+ run the subclass's setter before its fields exist); such state (`state`, `groups`, ...) lives in a
46
+ private field behind a hand-written accessor.
47
+ - **Text is exact.** Text-bearing elements are written without whitespace between nodes, because
48
+ consumers compare `textContent`. `oxfmt` is set to `htmlWhitespaceSensitivity: "strict"` for
49
+ `packages/ui/src` (not `teams/`) so it never adds whitespace to a template; `glyph.ts` opts out of
50
+ the formatter with `// prettier-ignore` because it reflows `<svg>` regardless.
51
+ - **`ribbon-section` and `keytips`** keep imperative DOM on purpose: the section patches light-DOM
52
+ children keyed by id (so focus and a product's tags survive), and keytips attaches a badge layer to
53
+ a scope it does not own.
54
+
55
+ ## Team workspace elements (`ooxml-ui/teams`)
56
+
57
+ The chat and meeting pieces of the open-source Teams-style workspace (logic in `ooxml-core/teams`,
58
+ app in the `teams-viewer` repository): `office-ui-avatar`, `-app-rail`, `-channel-list`, `-chat-list`,
59
+ `-chat-composer`, `-prejoin`, `-call-grid` and `-call-controls`. Properties in, bubbling `office-*`
60
+ events out, no data fetching; message text is always rendered as text.
61
+
62
+ ```ts
63
+ import { registerOfficeUi } from 'ooxml-ui';
64
+ registerOfficeUi(); // defines every element, idempotent
65
+ ```
66
+
22
67
  ## Install
23
68
 
24
69
  Applications using a viewer receive this package as a dependency. For a custom
package/dist/base.d.ts ADDED
@@ -0,0 +1,118 @@
1
+ import { LitElement, type CSSResult, type PropertyDeclaration, type PropertyDeclarations } from 'lit';
2
+ /**
3
+ * Give every bare `var(--office-x)` in a stylesheet the token's default, so a control renders
4
+ * correctly with or without the installed theme (the same fallback `tok()` writes). Sheets stay
5
+ * plain CSS; unknown names and private `--_x` helpers are left alone.
6
+ */
7
+ export declare function withTokens(css: string): string;
8
+ /** An element's style list: the shared control basics plus its own `.css` files. */
9
+ export declare const controlStyles: (...sheets: string[]) => CSSResult[];
10
+ /**
11
+ * A boolean attribute that reflects. A property value of `''` counts as present (`checked=""`),
12
+ * so frameworks that pass attribute idioms through properties keep working.
13
+ */
14
+ export declare const flag: {
15
+ type: BooleanConstructor;
16
+ reflect: true;
17
+ converter: {
18
+ fromAttribute: (value: string | null) => boolean;
19
+ toAttribute: (value: unknown) => string | null;
20
+ };
21
+ };
22
+ /** A boolean attribute that is read but never written back (`icon-only`, `caret`). */
23
+ export declare const readFlag: {
24
+ type: BooleanConstructor;
25
+ converter: {
26
+ fromAttribute: (value: string | null) => boolean;
27
+ };
28
+ };
29
+ /** `pressed="true|false"` as a tri-state: absent is `undefined`, `""` and anything but `false` is true. */
30
+ export declare const triState: {
31
+ reflect: true;
32
+ converter: {
33
+ fromAttribute: (value: string | null) => boolean | undefined;
34
+ toAttribute: (value: unknown) => string | null;
35
+ };
36
+ };
37
+ /** A `value` that reads `'on'` while its attribute is absent, like a native checkbox or radio. */
38
+ export declare const valueOn: {
39
+ type: StringConstructor;
40
+ converter: {
41
+ fromAttribute: (value: string | null) => string;
42
+ };
43
+ };
44
+ export type OfficeProperties = PropertyDeclarations;
45
+ /**
46
+ * Base class of the ooxml-ui elements. Products subclass these elements (they register an alias
47
+ * tag that keeps their own names), and the earlier hand-built elements always had their shadow DOM
48
+ * the moment the constructor returned. So, unlike a plain Lit element:
49
+ *
50
+ * - The shadow root exists as soon as the constructor returns, so a subclass can attach its own
51
+ * styles there.
52
+ * - Reading `shadowRoot` of an element that has not rendered yet renders it first (host writes
53
+ * are held back until it connects and the element re-renders), so a subclass or a host that inspects the shadow DOM right
54
+ * after construction, or before connecting, finds it. A
55
+ * microtask renders a connected element that nothing else rendered, for a subclass that
56
+ * overrides `connectedCallback` without calling `super`.
57
+ * - Updates are synchronous: setting a property or attribute has redrawn the shadow DOM before
58
+ * the call returns, whether or not the element is connected, the contract every consumer and
59
+ * test already relies on. An element that prefers Lit's batched updates sets
60
+ * `static syncUpdates = false`.
61
+ *
62
+ * A constructor must not assign a property a subclass may override with its own accessor (that
63
+ * would run the subclass's setter before its fields exist); elements keep such state in a private
64
+ * field behind a hand-written accessor instead.
65
+ */
66
+ export declare class OfficeElement extends LitElement {
67
+ static syncUpdates: boolean;
68
+ private _rendering?;
69
+ private _ready?;
70
+ constructor();
71
+ /**
72
+ * Render now if the element has never rendered; a no-op afterwards or while rendering. A
73
+ * disconnected element may be rendered here from inside a constructor (a subclass reading
74
+ * `shadowRoot`), and a constructor may not add host attributes, so while it renders its host
75
+ * writes are queued and applied before the next write or update, or on connection.
76
+ */
77
+ ensureRendered(): void;
78
+ private _detachedRender?;
79
+ /** True while a detached first render runs (inside a constructor, maybe): no children may be added. */
80
+ protected get detachedFirstRender(): boolean;
81
+ private _queue;
82
+ private _deferring?;
83
+ /** Write to the host element: queued (and dropped) during a detached first render, else applied at once. */
84
+ protected hostWrite(write: () => void): void;
85
+ /**
86
+ * Forget the host writes a detached first render queued. They are stale by the time anything
87
+ * else happens (replaying one would fire an attribute change that overwrites a newer property),
88
+ * and the render that follows connecting recomputes every host write from the current state.
89
+ */
90
+ protected flushHost(): void;
91
+ setAttribute(name: string, value: string): void;
92
+ removeAttribute(name: string): void;
93
+ toggleAttribute(name: string, force?: boolean): boolean;
94
+ /**
95
+ * Reflecting properties write their attribute as soon as they are set, even before the element
96
+ * connects (Lit alone reflects during an update). A `flag` property also stores a real
97
+ * boolean whatever it is given, so a framework writing `''` (the attribute idiom for
98
+ * "present") reads back `true`.
99
+ */
100
+ static createProperty(name: PropertyKey, options?: PropertyDeclaration): void;
101
+ /**
102
+ * Attributes the element reads straight from the DOM, without a property of the same name: a
103
+ * product subclass reads them too, and a framework that assigns properties it finds (React 19)
104
+ * must write the attribute instead. Changing one redraws the element.
105
+ */
106
+ static watched: readonly string[];
107
+ static get observedAttributes(): string[];
108
+ private fromAttribute;
109
+ attributeChangedCallback(name: string, old: string | null, value: string | null): void;
110
+ /** Write a property's value to its attribute now, unless the attribute is where it came from. */
111
+ protected reflectAttribute(attribute: string, value: unknown, options: PropertyDeclaration): void;
112
+ /** Dispatch a bubbling, composed event with `detail`. */
113
+ protected fire<T>(type: string, detail: T, cancelable?: boolean): boolean;
114
+ private get immediate();
115
+ connectedCallback(): void;
116
+ protected performUpdate(): void | Promise<unknown>;
117
+ requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void;
118
+ }
@@ -30,10 +30,4 @@ export declare function readOfficeProfile(storage?: StorageLike | undefined, key
30
30
  export declare function writeOfficeProfile(profile: OfficeProfile, storage?: StorageLike | undefined, key?: string): void;
31
31
  /** Forget the stored profile. */
32
32
  export declare function clearOfficeProfile(storage?: StorageLike | undefined, key?: string): void;
33
- /**
34
- * `<office-ui-account>`: User Information with avatar, display name and avatar colour. Set or read
35
- * `profile`; edits emit `office-profile-change`. `slot="sign-in"` hosts a product sign-in flow;
36
- * the default slot holds product sections (theme, product information).
37
- */
38
- export declare const defineAccount: import("./registry.js").Definer;
39
33
  export {};
@@ -0,0 +1,17 @@
1
+ import { OfficeElement } from '../base.js';
2
+ import { type OfficeProfile } from './account-profile.js';
3
+ /**
4
+ * `<office-ui-account>`: User Information with avatar, display name and avatar colour. Set or read
5
+ * `profile`; edits emit `office-profile-change`. `slot="sign-in"` hosts a product sign-in flow;
6
+ * the default slot holds product sections (theme, product information).
7
+ */
8
+ export declare class OfficeUiAccount extends OfficeElement {
9
+ static styles: import("lit").CSSResult[];
10
+ private current;
11
+ get profile(): OfficeProfile;
12
+ set profile(value: OfficeProfile);
13
+ private change;
14
+ private onSwatchKey;
15
+ protected render(): import("lit").TemplateResult<1>;
16
+ }
17
+ export declare const defineAccount: import("../registry.js").Definer;
@@ -0,0 +1,78 @@
1
+ import { OfficeElement } from '../base.js';
2
+ /**
3
+ * Office's File view (backstage): a navigation column and one page per item. Generalised from
4
+ * pptx-viewer's `BACKSTAGE_NAV` model (render/backstage.ts) and the Visio viewer's backstage.
5
+ */
6
+ export interface OfficeBackstageItem {
7
+ id: string;
8
+ label: string;
9
+ /** Items in the footer group sit at the bottom of the column (Account, Options). */
10
+ group?: 'footer';
11
+ disabled?: boolean;
12
+ /** Tooltip, for example why an item is disabled. */
13
+ title?: string;
14
+ }
15
+ /** An item was chosen; cancelable (`preventDefault()` keeps the current page). */
16
+ export type OfficeBackstageSelectEvent = CustomEvent<{
17
+ id: string;
18
+ }>;
19
+ export type OfficeBackstageCloseEvent = CustomEvent<{
20
+ reason: 'back' | 'escape' | 'api';
21
+ }>;
22
+ /**
23
+ * `<office-ui-backstage>`: set `items`, put one light-DOM child per page with
24
+ * `data-backstage-page="<id>"`, then `show(id)`. Choosing an item emits `office-backstage-select`
25
+ * and, unless prevented, shows its page; items without a page (Save, Close) only emit. Back and
26
+ * Escape emit a cancelable `office-backstage-close` and close. Attributes: `open`, `selected`,
27
+ * `label` (default "File"), `back-label`. Nav buttons carry `data-backstage-item`.
28
+ */
29
+ export declare class OfficeUiBackstage extends OfficeElement {
30
+ static styles: import("lit").CSSResult[];
31
+ static properties: {
32
+ open: {
33
+ type: BooleanConstructor;
34
+ reflect: true;
35
+ converter: {
36
+ fromAttribute: (value: string | null) => boolean;
37
+ toAttribute: (value: unknown) => string | null;
38
+ };
39
+ };
40
+ items: {
41
+ attribute: boolean;
42
+ };
43
+ label: {
44
+ type: StringConstructor;
45
+ };
46
+ backLabel: {
47
+ attribute: string;
48
+ type: StringConstructor;
49
+ };
50
+ selected: {
51
+ type: StringConstructor;
52
+ noAccessor: boolean;
53
+ };
54
+ };
55
+ open: boolean;
56
+ items: readonly OfficeBackstageItem[];
57
+ label: string | null;
58
+ backLabel: string | null;
59
+ private picked;
60
+ constructor();
61
+ get selected(): string;
62
+ set selected(id: string | null);
63
+ /** Open on a page (default: the selected one) and focus its item. */
64
+ show(page?: string): void;
65
+ /** Close without asking (emits `office-backstage-close` with reason `api`). */
66
+ close(): void;
67
+ private page;
68
+ private button;
69
+ private choose;
70
+ private requestClose;
71
+ private onNavClick;
72
+ /** Exactly the selected page of the light DOM shows. */
73
+ private syncPages;
74
+ protected updated(): void;
75
+ private item;
76
+ protected render(): import("lit").TemplateResult<1>;
77
+ }
78
+ export declare const defineBackstage: import("../registry.js").Definer;
@@ -0,0 +1,111 @@
1
+ import { OfficeElement } from '../base.js';
2
+ export type OfficeFindInputEvent = CustomEvent<{
3
+ query: string;
4
+ }>;
5
+ export type OfficeFindStepEvent = CustomEvent<{
6
+ direction: 'next' | 'previous';
7
+ }>;
8
+ /**
9
+ * `<office-ui-find-bar>`: Office's on-demand Find bar under the ribbon. Shown while `open`;
10
+ * `show()` opens it and selects the query. Enter steps to the next result, Shift+Enter to the
11
+ * previous; Escape clears a query, or closes the bar when it is already empty. Attributes:
12
+ * `open`, `label`, `input-label`, `placeholder`, `maxlength`, `disabled`, `navigation-disabled`,
13
+ * `previous-label`, `next-label`, `close-label`. Properties: `value`, `status`, `statusTitle`.
14
+ * Events: `office-find-input` `{ query }`, `office-find-step` `{ direction }`, `office-find-close`.
15
+ */
16
+ export declare class OfficeUiFindBar extends OfficeElement {
17
+ static shadowRootOptions: {
18
+ clonable?: boolean;
19
+ customElementRegistry?: CustomElementRegistry | null;
20
+ mode: ShadowRootMode;
21
+ serializable?: boolean;
22
+ slotAssignment?: SlotAssignmentMode;
23
+ delegatesFocus: boolean;
24
+ };
25
+ static styles: import("lit").CSSResult[];
26
+ static properties: {
27
+ open: {
28
+ type: BooleanConstructor;
29
+ reflect: true;
30
+ converter: {
31
+ fromAttribute: (value: string | null) => boolean;
32
+ toAttribute: (value: unknown) => string | null;
33
+ };
34
+ };
35
+ disabled: {
36
+ type: BooleanConstructor;
37
+ reflect: true;
38
+ converter: {
39
+ fromAttribute: (value: string | null) => boolean;
40
+ toAttribute: (value: unknown) => string | null;
41
+ };
42
+ };
43
+ navigationDisabled: {
44
+ type: BooleanConstructor;
45
+ reflect: true;
46
+ converter: {
47
+ fromAttribute: (value: string | null) => boolean;
48
+ toAttribute: (value: unknown) => string | null;
49
+ };
50
+ attribute: string;
51
+ };
52
+ label: {
53
+ type: StringConstructor;
54
+ };
55
+ inputLabel: {
56
+ attribute: string;
57
+ type: StringConstructor;
58
+ };
59
+ placeholder: {
60
+ type: StringConstructor;
61
+ };
62
+ maxlength: {
63
+ type: StringConstructor;
64
+ };
65
+ previousLabel: {
66
+ attribute: string;
67
+ type: StringConstructor;
68
+ };
69
+ nextLabel: {
70
+ attribute: string;
71
+ type: StringConstructor;
72
+ };
73
+ closeLabel: {
74
+ attribute: string;
75
+ type: StringConstructor;
76
+ };
77
+ value: {
78
+ attribute: boolean;
79
+ };
80
+ status: {
81
+ attribute: boolean;
82
+ };
83
+ statusTitle: {
84
+ attribute: boolean;
85
+ };
86
+ };
87
+ open: boolean;
88
+ disabled: boolean;
89
+ navigationDisabled: boolean;
90
+ label: string | null;
91
+ inputLabel: string | null;
92
+ placeholder: string | null;
93
+ maxlength: string | null;
94
+ previousLabel: string | null;
95
+ nextLabel: string | null;
96
+ closeLabel: string | null;
97
+ value: string;
98
+ status: string;
99
+ statusTitle: string;
100
+ constructor();
101
+ private get input();
102
+ /** Open, focus the field and select its query. */
103
+ show(): void;
104
+ /** Close and emit `office-find-close`. */
105
+ close(): void;
106
+ private step;
107
+ private onInput;
108
+ private onKey;
109
+ protected render(): import("lit").TemplateResult<1>;
110
+ }
111
+ export declare const defineFindBar: import("../registry.js").Definer;
@@ -0,0 +1,39 @@
1
+ import { type PropertyValues } from 'lit';
2
+ import { OfficeElement } from '../base.js';
3
+ export type OfficePrintPreviewPageEvent = CustomEvent<{
4
+ index: number;
5
+ }>;
6
+ /**
7
+ * `<office-ui-print-preview>`: the Print page's paper preview with page navigation. Set `pages`
8
+ * to rendered nodes (for example the SVG of each page); the element shows a deep clone of the
9
+ * current one with `tabindex` and inline `style` removed, so the preview is inert and never
10
+ * parses markup. `index` selects the page; the arrows emit `office-print-preview-page`.
11
+ * Attributes: `label` (default "Print preview"), `empty-label`.
12
+ */
13
+ export declare class OfficeUiPrintPreview extends OfficeElement {
14
+ static styles: import("lit").CSSResult[];
15
+ static properties: {
16
+ label: {
17
+ type: StringConstructor;
18
+ };
19
+ emptyLabel: {
20
+ attribute: string;
21
+ type: StringConstructor;
22
+ };
23
+ };
24
+ label: string | null;
25
+ emptyLabel: string | null;
26
+ private list;
27
+ private current;
28
+ private clone;
29
+ constructor();
30
+ get pages(): readonly Node[];
31
+ set pages(value: readonly Node[]);
32
+ get index(): number;
33
+ set index(value: number);
34
+ private go;
35
+ /** The shown page is an inert copy: no tabindex, no inline style. */
36
+ protected willUpdate(changed: PropertyValues<this>): void;
37
+ protected render(): import("lit").TemplateResult<1>;
38
+ }
39
+ export declare const definePrintPreview: import("../registry.js").Definer;
@@ -0,0 +1,43 @@
1
+ import { OfficeElement } from '../base.js';
2
+ /** Tick subdivisions per unit for a given unit length in CSS pixels, finer as it grows. */
3
+ export declare function rulerDivisions(unitPixels: number): number;
4
+ /**
5
+ * `<office-ui-ruler>`: a decorative Office ruler (inches by default). The product positions it
6
+ * and says where zero is: `origin` is the CSS-pixel offset of zero from the ruler's start edge,
7
+ * `scale` the CSS pixels per unit (96 at 100% for inches). `orientation="vertical"` draws a
8
+ * side ruler; `direction="reverse"` makes values grow toward the start edge, as Visio's
9
+ * vertical ruler grows upward from the page bottom. Hidden from assistive technology.
10
+ */
11
+ export declare class OfficeUiRuler extends OfficeElement {
12
+ static styles: import("lit").CSSResult[];
13
+ static properties: {
14
+ orientation: {
15
+ type: StringConstructor;
16
+ reflect: boolean;
17
+ };
18
+ origin: {
19
+ type: NumberConstructor;
20
+ };
21
+ scale: {
22
+ type: NumberConstructor;
23
+ };
24
+ direction: {
25
+ type: StringConstructor;
26
+ };
27
+ };
28
+ orientation: string;
29
+ origin: number;
30
+ scale: number;
31
+ direction: string;
32
+ private frame;
33
+ private observer;
34
+ constructor();
35
+ connectedCallback(): void;
36
+ disconnectedCallback(): void;
37
+ private schedule;
38
+ protected willUpdate(): void;
39
+ protected updated(): void;
40
+ private draw;
41
+ protected render(): import("lit").TemplateResult<1>;
42
+ }
43
+ export declare const defineRuler: import("../registry.js").Definer;
@@ -0,0 +1,80 @@
1
+ import { type TemplateResult } from 'lit';
2
+ import { OfficeElement } from '../base.js';
3
+ export type OfficeStatusActivateEvent = CustomEvent<{
4
+ id: string;
5
+ }>;
6
+ /** A text segment at the start of the bar (page count, words, language, save state). */
7
+ export interface OfficeStatusText {
8
+ id: string;
9
+ text: string;
10
+ title?: string | undefined;
11
+ tone?: 'idle' | 'saving' | 'error' | undefined;
12
+ /** Announce changes politely (a page counter). */
13
+ live?: boolean | undefined;
14
+ /** Hide on phone widths. */
15
+ narrowHide?: boolean | undefined;
16
+ }
17
+ /** A status-bar button (Notes, Comments, a view switch). `label` is its name and ScreenTip. */
18
+ export interface OfficeStatusButton {
19
+ id: string;
20
+ icon: string;
21
+ label: string;
22
+ /** Visible text after the glyph; hidden on phone widths. */
23
+ text?: string | undefined;
24
+ pressed?: boolean | undefined;
25
+ hidden?: boolean | undefined;
26
+ }
27
+ /** Everything the controlled bar shows, already translated. Absent parts are not rendered. */
28
+ export interface OfficeStatusBarState {
29
+ items?: readonly OfficeStatusText[] | undefined;
30
+ toggles?: readonly OfficeStatusButton[] | undefined;
31
+ /** The view switches (Normal, Sorter, Reading); hidden while empty, all hidden or `false`. */
32
+ views?: readonly OfficeStatusButton[] | false | undefined;
33
+ /** Zoom out, percentage (zoom to fit) and zoom in; emits `zoomOut`, `zoomFit`, `zoomIn`. */
34
+ zoom?: {
35
+ percent: number;
36
+ outLabel: string;
37
+ fitLabel: string;
38
+ inLabel: string;
39
+ /** Keeps the named buttons but hides the cluster. */
40
+ hidden?: boolean | undefined;
41
+ /** Glyphs; default `minus` and `plus`. */
42
+ outIcon?: string | undefined;
43
+ inIcon?: string | undefined;
44
+ } | undefined;
45
+ }
46
+ /**
47
+ * Status bar: `role="group"` named by its `label` attribute (default "Status"). Two ways to fill
48
+ * it. Composed: children, with `slot="end"` pushed to the trailing edge (zoom, view switches).
49
+ * Controlled: set `state` (`OfficeStatusBarState`: start texts, toggles, view switches and a zoom
50
+ * cluster, all translated); every button emits `office-status-activate` `{ id }` (static
51
+ * `activateEvent` lets a product subclass keep its published name). Slots stay available in
52
+ * controlled mode: the default after the texts, `collaboration` and `end` before the zoom. Keyed
53
+ * children are patched in place, so a focused button survives updates.
54
+ */
55
+ export declare class OfficeUiStatusBar extends OfficeElement {
56
+ static activateEvent: string;
57
+ static styles: import("lit").CSSResult[];
58
+ static properties: {
59
+ label: {
60
+ type: StringConstructor;
61
+ };
62
+ hasCollaboration: {
63
+ state: boolean;
64
+ };
65
+ };
66
+ label: string | null;
67
+ hasCollaboration: boolean;
68
+ private model;
69
+ constructor();
70
+ get state(): OfficeStatusBarState | undefined;
71
+ set state(value: OfficeStatusBarState | null | undefined);
72
+ private activate;
73
+ /** Keep native activation out of the host document's navigation shortcuts. */
74
+ private onKeydown;
75
+ protected willUpdate(): void;
76
+ private button;
77
+ private zoomStep;
78
+ protected render(): TemplateResult<1>;
79
+ }
80
+ export declare const defineStatusBar: import("../registry.js").Definer;
@@ -0,0 +1,40 @@
1
+ import { OfficeElement } from '../base.js';
2
+ /**
3
+ * One status entry: `label` and `value` attributes (textual, so assistive tech reads both).
4
+ * With the `interactive` attribute it renders a button and emits `office-status-activate`
5
+ * `{ id }` (`id` attribute) on click, Enter or Space; zoom or language pickers are examples.
6
+ */
7
+ export declare class OfficeUiStatusItem extends OfficeElement {
8
+ static shadowRootOptions: {
9
+ clonable?: boolean;
10
+ customElementRegistry?: CustomElementRegistry | null;
11
+ mode: ShadowRootMode;
12
+ serializable?: boolean;
13
+ slotAssignment?: SlotAssignmentMode;
14
+ delegatesFocus: boolean;
15
+ };
16
+ static styles: import("lit").CSSResult[];
17
+ static properties: {
18
+ label: {
19
+ type: StringConstructor;
20
+ };
21
+ value: {
22
+ type: StringConstructor;
23
+ reflect: boolean;
24
+ };
25
+ interactive: {
26
+ type: BooleanConstructor;
27
+ reflect: true;
28
+ converter: {
29
+ fromAttribute: (value: string | null) => boolean;
30
+ toAttribute: (value: unknown) => string | null;
31
+ };
32
+ };
33
+ };
34
+ label: string;
35
+ value: string;
36
+ interactive: boolean;
37
+ constructor();
38
+ protected render(): import("lit").TemplateResult<1>;
39
+ }
40
+ export declare const defineStatusItem: import("../registry.js").Definer;