umberto 10.6.1 → 10.7.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,22 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## [10.7.0](https://github.com/cksource/umberto/compare/v10.6.1...v10.7.0) (July 2, 2026)
5
+
6
+ ### Features
7
+
8
+ * Enabled MCP install menu in the Kapa widget.
9
+
10
+ ### Bug fixes
11
+
12
+ * Fixed scrolling to a section in the Gloria theme when navigating to an anchor without a full page reload — for example, changing the anchor in the address bar, using the browser's back/forward buttons, or opening a link to a section on the current page. The target heading is now offset below the sticky header instead of being hidden beneath it.
13
+ * Moved `chokidar` from `devDependencies` to `dependencies`. It is imported at runtime by the file watcher (`src/tasks/watcher.js`), which ships with the package, so it must be installed for consumers. Previously it resolved only by chance through a hoisted copy in the consumer's tree, which fails when the consumer enables pnpm's `enableGlobalVirtualStore` and the package is linked from the global store, outside the consumer's `node_modules`.
14
+
15
+ ### Other changes
16
+
17
+ * The tabbed content component now sets a `data-tab-label` attribute on each tab panel, carrying the label of its tab. This exposes the label to tools that process the rendered HTML, where it otherwise lives only inside the tab button.
18
+
19
+
4
20
  ## [10.6.1](https://github.com/cksource/umberto/compare/v10.6.0...v10.6.1) (June 18, 2026)
5
21
 
6
22
  ### Other changes
@@ -37,13 +53,6 @@ Changelog
37
53
 
38
54
  * Added the Call for feedback component for documentation pages.
39
55
 
40
-
41
- ## [10.4.1](https://github.com/cksource/umberto/compare/v10.4.0...v10.4.1) (April 13, 2026)
42
-
43
- ### Bug fixes
44
-
45
- * Fixed URL in the dropdown for LTS item to have absolute URL to pass documentation validation.
46
-
47
56
  ---
48
57
 
49
58
  To see all releases, visit the [release page](https://github.com/cksource/umberto/releases).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umberto",
3
- "version": "10.6.1",
3
+ "version": "10.7.0",
4
4
  "description": "CKSource Documentation builder",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -20,6 +20,7 @@
20
20
  "@minify-html/node": "^0.17.1",
21
21
  "@vscode/markdown-it-katex": "^1.1.2",
22
22
  "babel-loader": "^10.0.0",
23
+ "chokidar": "^4.0.3",
23
24
  "css-select": "^6.0.0",
24
25
  "dom-serializer": "^2.0.0",
25
26
  "domhandler": "^5.0.3",
@@ -70,6 +70,7 @@ mixin tabs({ id: tabsId, ariaLabel = 'Tabbed content', className, align = 'left'
70
70
  aria-labelledby=`${idPrefix}-${ id }-tab`
71
71
  aria-hidden=tab.active ? 'false' : 'true'
72
72
  data-tab-id=id
73
+ data-tab-label=tab.label
73
74
  class={
74
75
  [className]: !!className,
75
76
  'is-spaced': tab.spaced,
@@ -139,11 +139,32 @@ mixin load-kapa-script( kapa )
139
139
  return projectConfig.sourceGroupIds.join( ',' );
140
140
  }
141
141
 
142
+ function getMcpServerUrl() {
143
+ const defaultMcpServerUrl = kapa.default.mcpServerUrl || null;
144
+
145
+ if ( !projectConfig ) {
146
+ return defaultMcpServerUrl;
147
+ }
148
+
149
+ if ( !projectConfig.mcpServerUrl ) {
150
+ return defaultMcpServerUrl;
151
+ }
152
+
153
+ return projectConfig.mcpServerUrl;
154
+ }
155
+
142
156
  attributes[ 'data-modal-title' ] = getModalTitle( projectConfig );
143
157
  attributes[ 'data-modal-ask-ai-input-placeholder' ] = getQuestionPlaceholder();
144
158
  attributes[ 'data-modal-example-questions' ] = getExampleQuestions();
145
159
  attributes[ 'data-source-group-ids-include' ] = getSourceGroupIds();
146
160
 
161
+ const mcpServerUrl = getMcpServerUrl();
162
+
163
+ if ( mcpServerUrl ) {
164
+ attributes[ 'data-mcp-enabled' ] = 'true';
165
+ attributes[ 'data-mcp-server-url' ] = mcpServerUrl;
166
+ }
167
+
147
168
  script&attributes(attributes)
148
169
 
149
170
  style#custom_kapa_styles
@@ -5,6 +5,10 @@
5
5
  height: 100%;
6
6
  overscroll-behavior-y: none; /* Prevent vertical bounce, allow horizontal trackpad gestures. */
7
7
  overflow-x: hidden;
8
+
9
+ /* Offset native fragment navigation (anchor jumps, pasting a hash URL) below the
10
+ sticky header. `--header-height` is kept up to date by the header module. */
11
+ scroll-padding-top: calc(var(--header-height, 0px) + 32px);
8
12
  }
9
13
 
10
14
  body {
@@ -18,6 +18,10 @@ export class HashLink extends BaseComponent {
18
18
  // Handle initial hash link navigation if present in the URL
19
19
  this._handleInitialHash();
20
20
 
21
+ // Handle hash changes on an already-loaded page (e.g. editing the hash in the
22
+ // address bar or browser back/forward navigation).
23
+ this._handleHashChange();
24
+
21
25
  // Add click event listener to handle hash link clicks
22
26
  document.addEventListener( 'click', event => {
23
27
  const target = event.target.closest( 'a[href^="#"]' );
@@ -57,4 +61,30 @@ export class HashLink extends BaseComponent {
57
61
  } );
58
62
  }, { once: true } );
59
63
  }
64
+
65
+ /**
66
+ * Handles hash changes that happen without a full page reload, e.g. editing the
67
+ * hash in the address bar or navigating with the browser's back/forward buttons.
68
+ *
69
+ * In these cases the browser performs native fragment navigation, which scrolls
70
+ * the target to the very top of the viewport without accounting for the sticky
71
+ * header. Re-running the scroll with the proper offset keeps the heading visible.
72
+ *
73
+ * Clicking an `a[href^="#"]` link does not trigger this handler, because the click
74
+ * handler updates the URL via `history.pushState()`, which does not emit a
75
+ * `hashchange` event.
76
+ *
77
+ * @private
78
+ */
79
+ static _handleHashChange() {
80
+ window.addEventListener( 'hashchange', () => {
81
+ if ( !window.location.hash ) {
82
+ return;
83
+ }
84
+
85
+ scrollToHash( window.location.hash.substring( 1 ), {
86
+ pushState: false
87
+ } );
88
+ } );
89
+ }
60
90
  }
@@ -83,6 +83,11 @@ export class Header extends BaseComponent {
83
83
  this.element.classList.toggle( 'is-on-top-overlay', state.isOnOverlay );
84
84
  this.dispatchHeaderResizeEvent();
85
85
  } else if ( prevState?.height !== state.height && state.height !== null ) {
86
+ // Expose the header height on the document root so that native fragment navigation
87
+ // (e.g. pasting a URL with a hash, which fires no `hashchange` or `load` event) can
88
+ // offset the target below the sticky header via `scroll-padding-top`. See `_base.scss`.
89
+ document.documentElement.style.setProperty( '--header-height', `${ state.height }px` );
90
+
86
91
  this.dispatchHeaderResizeEvent();
87
92
  }
88
93
  }
@@ -128,7 +133,7 @@ export class Header extends BaseComponent {
128
133
  }
129
134
 
130
135
  /**
131
- * Sets the header height variable on the body element.
136
+ * Tracks the header height and updates the component state.
132
137
  */
133
138
  _trackHeight() {
134
139
  this.setState( {