ooxml-ui 0.16.1 → 0.16.3

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.
@@ -1,4 +1,4 @@
1
- import { definer, attachStyles, controlCss, emit } from './chunk-NDEB6EBU.js';
1
+ import { definer, attachStyles, controlCss, emit } from './chunk-XPYONXNE.js';
2
2
  import { tok } from './chunk-4MT4OIAJ.js';
3
3
  import { normalizeHexColor } from 'ooxml-core/color';
4
4
 
@@ -1,6 +1,6 @@
1
- import { createIconSvg, paintIcon, defineIcon } from './chunk-VUXNXH4Q.js';
2
- import { initialsOf } from './chunk-VYF7LGXZ.js';
3
- import { definer, attachStyles, controlCss, emit } from './chunk-NDEB6EBU.js';
1
+ import { createIconSvg, paintIcon, defineIcon } from './chunk-YFT6FYOP.js';
2
+ import { initialsOf } from './chunk-YM2DT6QD.js';
3
+ import { definer, attachStyles, controlCss, present, emit } from './chunk-XPYONXNE.js';
4
4
  import { tok, FOCUS_RING, OFFICE_TOKENS } from './chunk-4MT4OIAJ.js';
5
5
 
6
6
  // src/chrome-controls.ts
@@ -613,13 +613,13 @@ var defineRadio = definer("office-ui-radio", () => {
613
613
  return this.hasAttribute("checked");
614
614
  }
615
615
  set checked(next) {
616
- this.toggleAttribute("checked", Boolean(next));
616
+ this.toggleAttribute("checked", present(next));
617
617
  }
618
618
  get disabled() {
619
619
  return this.hasAttribute("disabled");
620
620
  }
621
621
  set disabled(next) {
622
- this.toggleAttribute("disabled", Boolean(next));
622
+ this.toggleAttribute("disabled", present(next));
623
623
  }
624
624
  get value() {
625
625
  return this.getAttribute("value") ?? "on";
@@ -752,7 +752,7 @@ var defineRibbonToggle = definer("office-ui-ribbon-toggle", () => {
752
752
  return this.hasAttribute("checked");
753
753
  }
754
754
  set checked(value) {
755
- this.toggleAttribute("checked", Boolean(value));
755
+ this.toggleAttribute("checked", present(value));
756
756
  }
757
757
  sync() {
758
758
  const label = this.getAttribute("label") ?? "";
@@ -777,7 +777,10 @@ var CSS3 = `
777
777
  :host(:focus-within) { border-color: ${tok("--office-field-border-focus")}; }
778
778
  :host([variant="titlebar"]) { height: ${tok("--office-field-height")}; gap: ${tok("--office-space-1-5")}; padding-inline: ${tok("--office-space-3-5")};
779
779
  border-color: ${tok("--office-border")}; border-radius: ${tok("--office-radius-md")}; background: ${tok("--office-background")}; }
780
- :host([variant="titlebar"]:focus-within) { color: ${tok("--office-foreground")}; }
780
+ :host([variant="titlebar"]:focus-within) {
781
+ border-color: ${tok("--office-field-border-focus")};
782
+ color: ${tok("--office-foreground")};
783
+ }
781
784
  :host([disabled]) { opacity: .5; cursor: not-allowed; }
782
785
  svg { width: ${tok("--office-icon-size-md")}; height: ${tok("--office-icon-size-md")}; flex: none; }
783
786
  :host([variant="titlebar"]) svg { width: ${tok("--office-icon-size")}; height: ${tok("--office-icon-size")}; }
@@ -856,7 +859,7 @@ var defineSearchField = definer("office-ui-search", () => {
856
859
  return this.hasAttribute("disabled");
857
860
  }
858
861
  set disabled(next) {
859
- this.toggleAttribute("disabled", Boolean(next));
862
+ this.toggleAttribute("disabled", present(next));
860
863
  }
861
864
  focus(options) {
862
865
  this.input.focus(options);
@@ -971,7 +974,7 @@ var defineBackstage = definer("office-ui-backstage", () => {
971
974
  return this.hasAttribute("open");
972
975
  }
973
976
  set open(value) {
974
- this.toggleAttribute("open", Boolean(value));
977
+ this.toggleAttribute("open", present(value));
975
978
  }
976
979
  get selected() {
977
980
  return this.getAttribute("selected") ?? "";
@@ -1139,7 +1142,7 @@ var defineFindBar = definer("office-ui-find-bar", () => {
1139
1142
  return this.hasAttribute("open");
1140
1143
  }
1141
1144
  set open(value) {
1142
- this.toggleAttribute("open", Boolean(value));
1145
+ this.toggleAttribute("open", present(value));
1143
1146
  }
1144
1147
  get value() {
1145
1148
  return this.#input.value;
@@ -1894,7 +1897,7 @@ var defineButton = definer("office-ui-button", () => {
1894
1897
  return this.hasAttribute("disabled");
1895
1898
  }
1896
1899
  set disabled(value) {
1897
- this.toggleAttribute("disabled", Boolean(value));
1900
+ this.toggleAttribute("disabled", present(value));
1898
1901
  }
1899
1902
  get pressed() {
1900
1903
  const value = this.getAttribute("pressed");
@@ -1975,12 +1978,12 @@ var SWITCH_CSS = `
1975
1978
  flex: none; border: var(--_b) solid ${tok("--office-switch-border")}; border-radius: ${tok("--office-radius-full")};
1976
1979
  background: ${tok("--office-switch-track")}; cursor: pointer; vertical-align: middle;
1977
1980
  touch-action: manipulation; transition: background-color ${tok("--office-duration")}; }
1978
- :host::after { content: ""; position: absolute; top: calc((var(--_h) - 2 * var(--_b) - var(--_k)) / 2); left: var(--_o);
1981
+ .knob { display: block; position: absolute; top: calc((var(--_h) - 2 * var(--_b) - var(--_k)) / 2); left: var(--_o);
1979
1982
  width: var(--_k); height: var(--_k); border-radius: 50%; background: ${tok("--office-switch-thumb")};
1980
1983
  box-shadow: ${tok("--office-shadow-sm")}; transition: transform ${tok("--office-duration")}; }
1981
1984
  :host([checked]) { border-color: ${tok("--office-switch-track-on")};
1982
1985
  background: ${tok("--office-switch-track-on")}; }
1983
- :host([checked])::after { transform: translateX(var(--office-switch-knob-travel, calc(var(--_w) - var(--_k) - 2 * var(--_o) - 2 * var(--_b))));
1986
+ :host([checked]) .knob { transform: translateX(var(--office-switch-knob-travel, calc(var(--_w) - var(--_k) - 2 * var(--_o) - 2 * var(--_b))));
1984
1987
  background: ${tok("--office-switch-thumb-on")}; }
1985
1988
  :host(:focus-visible) { outline: ${tok("--office-focus-width")} solid ${tok("--office-ring")}; outline-offset: ${tok("--office-focus-offset")}; }
1986
1989
  :host([disabled]) { opacity: .5; cursor: not-allowed; }
@@ -1988,9 +1991,9 @@ svg { display: none; }
1988
1991
  @media (pointer: coarse), (max-width: 767px) { :host { --_w: ${tok("--office-switch-width-touch")}; --_h: ${tok("--office-switch-height-touch")}; --_k: ${tok("--office-switch-knob-size-touch")}; } }
1989
1992
  @media (forced-colors: active) {
1990
1993
  :host { border-color: CanvasText; background: Canvas; forced-color-adjust: none; }
1991
- :host::after { background: CanvasText; }
1994
+ .knob { background: CanvasText; }
1992
1995
  :host([checked]) { border-color: Highlight; background: Highlight; }
1993
- :host([checked])::after { background: HighlightText; }
1996
+ :host([checked]) .knob { background: HighlightText; }
1994
1997
  }
1995
1998
  `;
1996
1999
  function makeCheckable(role, css) {
@@ -2011,6 +2014,12 @@ function makeCheckable(role, css) {
2011
2014
  const template = this.ownerDocument.createElement("template");
2012
2015
  template.innerHTML = CHECK_SVG;
2013
2016
  root.append(template.content.cloneNode(true));
2017
+ if (role === "switch") {
2018
+ const knob = this.ownerDocument.createElement("span");
2019
+ knob.className = "knob";
2020
+ knob.setAttribute("part", "knob");
2021
+ root.append(knob);
2022
+ }
2014
2023
  this.addEventListener("click", (event) => {
2015
2024
  if (this.disabled) event.preventDefault();
2016
2025
  else this.toggle();
@@ -2033,13 +2042,13 @@ function makeCheckable(role, css) {
2033
2042
  return this.hasAttribute("checked");
2034
2043
  }
2035
2044
  set checked(value) {
2036
- this.toggleAttribute("checked", Boolean(value));
2045
+ this.toggleAttribute("checked", present(value));
2037
2046
  }
2038
2047
  get disabled() {
2039
2048
  return this.hasAttribute("disabled");
2040
2049
  }
2041
2050
  set disabled(value) {
2042
- this.toggleAttribute("disabled", Boolean(value));
2051
+ this.toggleAttribute("disabled", present(value));
2043
2052
  }
2044
2053
  get value() {
2045
2054
  return this.getAttribute("value") ?? "on";
@@ -2155,7 +2164,7 @@ var defineDialog = definer("office-ui-dialog", () => {
2155
2164
  return this.hasAttribute("open");
2156
2165
  }
2157
2166
  set open(value) {
2158
- this.toggleAttribute("open", Boolean(value));
2167
+ this.toggleAttribute("open", present(value));
2159
2168
  }
2160
2169
  show() {
2161
2170
  this.open = true;
@@ -2940,7 +2949,7 @@ var defineMenuItem = definer("office-ui-menu-item", () => {
2940
2949
  return this.hasAttribute("disabled");
2941
2950
  }
2942
2951
  set disabled(value) {
2943
- this.toggleAttribute("disabled", Boolean(value));
2952
+ this.toggleAttribute("disabled", present(value));
2944
2953
  }
2945
2954
  /** Focus the menuitem itself, so arrow navigation never depends on delegatesFocus. */
2946
2955
  focus(options) {
@@ -3048,7 +3057,7 @@ var defineMenuButton = definer("office-ui-menu-button", () => {
3048
3057
  return this.hasAttribute("disabled");
3049
3058
  }
3050
3059
  set disabled(value) {
3051
- this.toggleAttribute("disabled", Boolean(value));
3060
+ this.toggleAttribute("disabled", present(value));
3052
3061
  }
3053
3062
  get open() {
3054
3063
  return this.caret.getAttribute("aria-expanded") === "true";
@@ -3280,7 +3289,7 @@ var defineOptionsDialog = definer("office-ui-options-dialog", () => {
3280
3289
  return this.hasAttribute("open");
3281
3290
  }
3282
3291
  set open(value) {
3283
- this.toggleAttribute("open", Boolean(value));
3292
+ this.toggleAttribute("open", present(value));
3284
3293
  }
3285
3294
  show() {
3286
3295
  this.open = true;
@@ -4005,7 +4014,7 @@ var defineSelect = definer("office-ui-select", () => {
4005
4014
  return this.hasAttribute("disabled");
4006
4015
  }
4007
4016
  set disabled(next) {
4008
- this.toggleAttribute("disabled", Boolean(next));
4017
+ this.toggleAttribute("disabled", present(next));
4009
4018
  }
4010
4019
  focus(options) {
4011
4020
  this.trigger.focus(options);
@@ -4546,7 +4555,7 @@ var defineZoomSlider = definer("office-ui-zoom-slider", () => {
4546
4555
  return this.hasAttribute("disabled");
4547
4556
  }
4548
4557
  set disabled(value) {
4549
- this.toggleAttribute("disabled", Boolean(value));
4558
+ this.toggleAttribute("disabled", present(value));
4550
4559
  }
4551
4560
  /** Office buttons snap to the next multiple of `step`, so 67% steps to 70%, not 77%. */
4552
4561
  stepBy(direction) {
@@ -32,6 +32,9 @@ function emit(host, type, detail, cancelable = false) {
32
32
  new CustomEvent(type, { detail, bubbles: true, composed: true, cancelable })
33
33
  );
34
34
  }
35
+ function present(value) {
36
+ return value === "" || Boolean(value);
37
+ }
35
38
 
36
39
  // src/styles.ts
37
40
  var sheetsByDocument = /* @__PURE__ */ new WeakMap();
@@ -72,4 +75,4 @@ var COMMON_CONTROL_CSS = `
72
75
  var controlCss = (css) => `${COMMON_CONTROL_CSS}
73
76
  ${css}`;
74
77
 
75
- export { CONTRACT_REVISION, attachStyles, controlCss, definer, emit };
78
+ export { CONTRACT_REVISION, attachStyles, controlCss, definer, emit, present };
@@ -1,4 +1,4 @@
1
- import { definer, attachStyles, controlCss } from './chunk-NDEB6EBU.js';
1
+ import { definer, attachStyles, controlCss } from './chunk-XPYONXNE.js';
2
2
 
3
3
  // src/icons.ts
4
4
  var registry = /* @__PURE__ */ new Map();
@@ -1,4 +1,4 @@
1
- import { definer, attachStyles, controlCss, emit } from './chunk-NDEB6EBU.js';
1
+ import { definer, attachStyles, controlCss, emit } from './chunk-XPYONXNE.js';
2
2
  import { tok } from './chunk-4MT4OIAJ.js';
3
3
 
4
4
  // src/presence.ts
package/dist/controls.js CHANGED
@@ -1,5 +1,5 @@
1
- export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TOAST_VISIBLE_LIMIT, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, defineAccount, defineBackstage, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonGroup, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToasts, defineToolbar, defineZoomSlider, nextEnabledIndex, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-2XJDHLPW.js';
2
- export { defineIcon } from './chunk-VUXNXH4Q.js';
3
- import './chunk-VYF7LGXZ.js';
4
- import './chunk-NDEB6EBU.js';
1
+ export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TOAST_VISIBLE_LIMIT, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, defineAccount, defineBackstage, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonGroup, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToasts, defineToolbar, defineZoomSlider, nextEnabledIndex, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-IKE3XWDZ.js';
2
+ export { defineIcon } from './chunk-YFT6FYOP.js';
3
+ import './chunk-YM2DT6QD.js';
4
+ import './chunk-XPYONXNE.js';
5
5
  import './chunk-4MT4OIAJ.js';
package/dist/icons.js CHANGED
@@ -1,3 +1,3 @@
1
- export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-VUXNXH4Q.js';
2
- import './chunk-NDEB6EBU.js';
1
+ export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-YFT6FYOP.js';
2
+ import './chunk-XPYONXNE.js';
3
3
  import './chunk-4MT4OIAJ.js';
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { installOfficeUiTheme } from './chunk-F4TM7U4P.js';
2
2
  export { THEME_CSS, THEME_STYLE_ID, installOfficeUiTheme } from './chunk-F4TM7U4P.js';
3
- import { registerControls } from './chunk-2XJDHLPW.js';
4
- export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TOAST_VISIBLE_LIMIT, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, defineAccount, defineBackstage, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonGroup, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToasts, defineToolbar, defineZoomSlider, nextEnabledIndex, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-2XJDHLPW.js';
5
- export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-VUXNXH4Q.js';
6
- import { definePresence } from './chunk-VYF7LGXZ.js';
7
- export { definePresence, initialsOf, participantsFromAwareness } from './chunk-VYF7LGXZ.js';
8
- import { defineSmartArt } from './chunk-A46H2JBV.js';
9
- export { defineSmartArt, renderDiagramDrawing } from './chunk-A46H2JBV.js';
10
- export { CONTRACT_REVISION } from './chunk-NDEB6EBU.js';
3
+ import { registerControls } from './chunk-IKE3XWDZ.js';
4
+ export { CONTROL_DEFINERS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_TOAST_VISIBLE_LIMIT, attachKeyTips, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, defineAccount, defineBackstage, defineButton, defineCheckbox, defineCommandSearch, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonGroup, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineTabStrip, defineToasts, defineToolbar, defineZoomSlider, nextEnabledIndex, profileInitials, readOfficeProfile, registerControls, rulerDivisions, sanitizeOfficeProfile, typeAheadIndex, writeOfficeProfile } from './chunk-IKE3XWDZ.js';
5
+ export { ICON_CSS, createIconSvg, defineIcon, getIcon, listIcons, paintIcon, registerIcon } from './chunk-YFT6FYOP.js';
6
+ import { definePresence } from './chunk-YM2DT6QD.js';
7
+ export { definePresence, initialsOf, participantsFromAwareness } from './chunk-YM2DT6QD.js';
8
+ import { defineSmartArt } from './chunk-HSM56NH6.js';
9
+ export { defineSmartArt, renderDiagramDrawing } from './chunk-HSM56NH6.js';
10
+ export { CONTRACT_REVISION } from './chunk-XPYONXNE.js';
11
11
  export { COMPACT, FOCUS_RING, OFFICE_TOKENS, TOUCH, tok } from './chunk-4MT4OIAJ.js';
12
12
 
13
13
  // src/index.ts
package/dist/presence.js CHANGED
@@ -1,3 +1,3 @@
1
- export { definePresence, initialsOf, participantsFromAwareness } from './chunk-VYF7LGXZ.js';
2
- import './chunk-NDEB6EBU.js';
1
+ export { definePresence, initialsOf, participantsFromAwareness } from './chunk-YM2DT6QD.js';
2
+ import './chunk-XPYONXNE.js';
3
3
  import './chunk-4MT4OIAJ.js';
@@ -16,3 +16,9 @@ export declare function browserRegistry(): CustomElementRegistry | undefined;
16
16
  export declare function definer(tag: string, make: () => CustomElementConstructor): Definer;
17
17
  /** Bubbling, composed event: crosses shadow boundaries like the native ones do. */
18
18
  export declare function emit<T>(host: HTMLElement, type: string, detail: T, cancelable?: boolean): boolean;
19
+ /**
20
+ * A boolean property value as its attribute would read it: `''` means present, as in
21
+ * `checked=""`. Frameworks that pass attribute idioms through properties (Svelte's
22
+ * `checked={on ? '' : undefined}`) therefore keep working.
23
+ */
24
+ export declare function present(value: unknown): boolean;
package/dist/smartart.js CHANGED
@@ -1,3 +1,3 @@
1
- export { defineSmartArt, renderDiagramDrawing } from './chunk-A46H2JBV.js';
2
- import './chunk-NDEB6EBU.js';
1
+ export { defineSmartArt, renderDiagramDrawing } from './chunk-HSM56NH6.js';
2
+ import './chunk-XPYONXNE.js';
3
3
  import './chunk-4MT4OIAJ.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml-ui",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "Shared, format-neutral web components and styles for the Office viewers (Word, PowerPoint, Excel)",
5
5
  "keywords": [
6
6
  "custom-elements",