@stacksjs/components 0.2.167 → 0.2.168
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.
|
@@ -134,6 +134,32 @@ function applyTint(position) {
|
|
|
134
134
|
style.setProperty('--stx-space-dark-accent', tint.dark.accent)
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Keep the active dot on screen.
|
|
139
|
+
*
|
|
140
|
+
* The dot row scrolls once there are more spaces than fit, and without this the
|
|
141
|
+
* active dot can sit outside the visible range — an indicator that indicates
|
|
142
|
+
* nothing. Measured on a sidebar with 22 spaces: the active one was the 20th,
|
|
143
|
+
* and none of the twelve you could see was lit.
|
|
144
|
+
*
|
|
145
|
+
* `block: 'nearest'` because this must never scroll the page vertically to
|
|
146
|
+
* bring a 6px dot into view.
|
|
147
|
+
*/
|
|
148
|
+
function revealCurrentDot(tab) {
|
|
149
|
+
const row = tab.closest('[data-space-switcher] .stx-space-dots')
|
|
150
|
+
if (!row || row.scrollWidth <= row.clientWidth) return
|
|
151
|
+
|
|
152
|
+
const rowBox = row.getBoundingClientRect()
|
|
153
|
+
const dotBox = tab.getBoundingClientRect()
|
|
154
|
+
if (dotBox.left >= rowBox.left && dotBox.right <= rowBox.right) return
|
|
155
|
+
|
|
156
|
+
tab.scrollIntoView({
|
|
157
|
+
inline: 'center',
|
|
158
|
+
block: 'nearest',
|
|
159
|
+
behavior: animates() ? 'smooth' : 'auto',
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
|
|
137
163
|
function markCurrent(position) {
|
|
138
164
|
const id = ids[position]
|
|
139
165
|
|
|
@@ -142,6 +168,7 @@ function markCurrent(position) {
|
|
|
142
168
|
tab.setAttribute('data-space-current', String(current))
|
|
143
169
|
tab.setAttribute('aria-selected', String(current))
|
|
144
170
|
tab.tabIndex = current ? 0 : -1
|
|
171
|
+
if (current) revealCurrentDot(tab)
|
|
145
172
|
})
|
|
146
173
|
|
|
147
174
|
root.querySelectorAll('[data-space]').forEach((panel) => {
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// ../../../../../../../tmp/stx-components-build-
|
|
2
|
+
// ../../../../../../../tmp/stx-components-build-tmXNAI/stubs/stub-0.js
|
|
3
3
|
var stub_0_default = { __stx: true, src: "./components/CodeBlock.stx" };
|
|
4
|
-
// ../../../../../../../tmp/stx-components-build-
|
|
4
|
+
// ../../../../../../../tmp/stx-components-build-tmXNAI/stubs/stub-1.js
|
|
5
5
|
var stub_1_default = { __stx: true, src: "./components/Footer.stx" };
|
|
6
|
-
// ../../../../../../../tmp/stx-components-build-
|
|
6
|
+
// ../../../../../../../tmp/stx-components-build-tmXNAI/stubs/stub-2.js
|
|
7
7
|
var stub_2_default = { __stx: true, src: "./components/Hero.stx" };
|
|
8
|
-
// ../../../../../../../tmp/stx-components-build-
|
|
8
|
+
// ../../../../../../../tmp/stx-components-build-tmXNAI/stubs/stub-3.js
|
|
9
9
|
var stub_3_default = { __stx: true, src: "./components/Installation.stx" };
|
|
10
10
|
// src/composables/useCopyCode.ts
|
|
11
11
|
function useCopyCode(options) {
|
|
@@ -1146,7 +1146,7 @@ var SidebarSection_default = "./SidebarSection-zd9z35ch.stx";
|
|
|
1146
1146
|
// src/ui/sidebar/SidebarSpace.stx
|
|
1147
1147
|
var SidebarSpace_default = "./SidebarSpace-r062weq2.stx";
|
|
1148
1148
|
// src/ui/sidebar/SidebarSpaces.stx
|
|
1149
|
-
var SidebarSpaces_default = "./SidebarSpaces-
|
|
1149
|
+
var SidebarSpaces_default = "./SidebarSpaces-f149wvf1.stx";
|
|
1150
1150
|
// src/ui/sidebar/SidebarSpaceSwitcher.stx
|
|
1151
1151
|
var SidebarSpaceSwitcher_default = "./SidebarSpaceSwitcher-az9wqm87.stx";
|
|
1152
1152
|
// src/ui/sidebar/themes.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/components",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.168",
|
|
5
5
|
"description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@iconify-json/f7": "^1.2.2",
|
|
66
66
|
"@cwcss/crosswind": "^0.2.14",
|
|
67
|
-
"@stacksjs/stx": "0.2.
|
|
68
|
-
"bun-plugin-stx": "0.2.
|
|
67
|
+
"@stacksjs/stx": "0.2.168",
|
|
68
|
+
"bun-plugin-stx": "0.2.168",
|
|
69
69
|
"ts-syntax-highlighter": "^0.2.1"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
@@ -134,6 +134,32 @@ function applyTint(position) {
|
|
|
134
134
|
style.setProperty('--stx-space-dark-accent', tint.dark.accent)
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Keep the active dot on screen.
|
|
139
|
+
*
|
|
140
|
+
* The dot row scrolls once there are more spaces than fit, and without this the
|
|
141
|
+
* active dot can sit outside the visible range — an indicator that indicates
|
|
142
|
+
* nothing. Measured on a sidebar with 22 spaces: the active one was the 20th,
|
|
143
|
+
* and none of the twelve you could see was lit.
|
|
144
|
+
*
|
|
145
|
+
* `block: 'nearest'` because this must never scroll the page vertically to
|
|
146
|
+
* bring a 6px dot into view.
|
|
147
|
+
*/
|
|
148
|
+
function revealCurrentDot(tab) {
|
|
149
|
+
const row = tab.closest('[data-space-switcher] .stx-space-dots')
|
|
150
|
+
if (!row || row.scrollWidth <= row.clientWidth) return
|
|
151
|
+
|
|
152
|
+
const rowBox = row.getBoundingClientRect()
|
|
153
|
+
const dotBox = tab.getBoundingClientRect()
|
|
154
|
+
if (dotBox.left >= rowBox.left && dotBox.right <= rowBox.right) return
|
|
155
|
+
|
|
156
|
+
tab.scrollIntoView({
|
|
157
|
+
inline: 'center',
|
|
158
|
+
block: 'nearest',
|
|
159
|
+
behavior: animates() ? 'smooth' : 'auto',
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
|
|
137
163
|
function markCurrent(position) {
|
|
138
164
|
const id = ids[position]
|
|
139
165
|
|
|
@@ -142,6 +168,7 @@ function markCurrent(position) {
|
|
|
142
168
|
tab.setAttribute('data-space-current', String(current))
|
|
143
169
|
tab.setAttribute('aria-selected', String(current))
|
|
144
170
|
tab.tabIndex = current ? 0 : -1
|
|
171
|
+
if (current) revealCurrentDot(tab)
|
|
145
172
|
})
|
|
146
173
|
|
|
147
174
|
root.querySelectorAll('[data-space]').forEach((panel) => {
|