@nordwerk/scroll-carousel 0.1.0 → 0.1.1
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/AGENTS.md +4 -2
- package/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/dist/markup.d.ts +6 -1
- package/dist/markup.js +1 -1
- package/dist/preact.js +2 -2
- package/dist/react.js +2 -2
- package/dist/shared/{chunk-5Q4YPVNK.js → chunk-I3QEUR7L.js} +1 -1
- package/dist/shared/{chunk-I4ZMRKZV.js → chunk-QHWWA243.js} +3 -2
- package/package.json +3 -2
- package/src/astro/Carousel.astro +5 -2
package/AGENTS.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Two parts: how to build a carousel with this package in a project, and how to work on the package
|
|
4
4
|
itself. Human documentation is in README.md; live examples with code are at
|
|
5
|
-
https://
|
|
5
|
+
https://www.nordwerk.studio/oss/scroll-carousel.
|
|
6
6
|
|
|
7
7
|
## Part 1: using the package
|
|
8
8
|
|
|
@@ -79,7 +79,9 @@ JavaScript, never move slides with transforms, never clone slides.
|
|
|
79
79
|
- `src/astro/Carousel.astro`: shipped as source.
|
|
80
80
|
- `src/carousel.css`: all layout and the default controls.
|
|
81
81
|
- `site/`: the documentation site (`generate.mjs` writes `_site/`), including the wireframe
|
|
82
|
-
patterns in `wireframes.mjs`. Content there is fictional.
|
|
82
|
+
patterns in `wireframes.mjs`. Content there is fictional. CI publishes it to GitHub Pages;
|
|
83
|
+
www.nordwerk.studio/oss/scroll-carousel serves the same files through a proxy that rewrites
|
|
84
|
+
`<base href>`, so every link in the site must stay relative to `<base>`.
|
|
83
85
|
- `test/unit/`: node's test runner on the TypeScript sources.
|
|
84
86
|
- `test/e2e/`: Playwright against `_site/` and the adapter fixtures from `scripts/fixtures.mjs`.
|
|
85
87
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1 (2026-09-21)
|
|
4
|
+
|
|
5
|
+
- Astro and `templateLabels`: `statusSingle` template for when only one slide is visible, so a
|
|
6
|
+
status like "Items {first} to {last}" does not read "Items 2 to 2".
|
|
7
|
+
- Documentation moved to https://www.nordwerk.studio/oss/scroll-carousel; the GitHub Pages
|
|
8
|
+
address forwards there.
|
|
9
|
+
|
|
3
10
|
## 0.1.0 (2026-09-21)
|
|
4
11
|
|
|
5
12
|
First version.
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ so the markup your server sends is already the final layout: no layout shift, no
|
|
|
5
5
|
no device detection on the server. A small script adds arrows, dots, paging by group, an API and
|
|
6
6
|
change events. Drag and autoplay are opt-in plugins. No runtime dependencies.
|
|
7
7
|
|
|
8
|
-
**Live examples:** https://
|
|
8
|
+
**Live examples:** https://www.nordwerk.studio/oss/scroll-carousel (every configuration, with
|
|
9
9
|
its code, plus common storefront patterns as wireframes next to the library options they replace).
|
|
10
10
|
|
|
11
11
|
| Part | gzip, minified |
|
package/dist/markup.d.ts
CHANGED
|
@@ -36,10 +36,15 @@ export declare function responsiveCss(id: string, props: LayoutProps): string;
|
|
|
36
36
|
* Start alignment only. It expects the root as its previous sibling.
|
|
37
37
|
*/
|
|
38
38
|
export declare const PRE_POSITION: string;
|
|
39
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Label templates such as 'Slide {n} of {count}' turned into label functions. `statusSingle`
|
|
41
|
+
* is used when only one slide is visible, e.g. 'Item {first} of {count}' next to a `status` of
|
|
42
|
+
* 'Items {first} to {last} of {count}'.
|
|
43
|
+
*/
|
|
40
44
|
export declare function templateLabels(templates?: {
|
|
41
45
|
page?: string;
|
|
42
46
|
status?: string;
|
|
47
|
+
statusSingle?: string;
|
|
43
48
|
}): {
|
|
44
49
|
page?: ((n: number, count: number) => string) | undefined;
|
|
45
50
|
status?: ((first: number, last: number, count: number) => string) | undefined;
|
package/dist/markup.js
CHANGED
package/dist/preact.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAdapter
|
|
3
|
-
} from "./shared/chunk-
|
|
3
|
+
} from "./shared/chunk-I3QEUR7L.js";
|
|
4
4
|
import "./shared/chunk-HPGJKTV5.js";
|
|
5
5
|
import "./shared/chunk-3THCBXDW.js";
|
|
6
|
-
import "./shared/chunk-
|
|
6
|
+
import "./shared/chunk-QHWWA243.js";
|
|
7
7
|
|
|
8
8
|
// src/preact.ts
|
|
9
9
|
import { Fragment, createElement, toChildArray } from "preact";
|
package/dist/react.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAdapter
|
|
3
|
-
} from "./shared/chunk-
|
|
3
|
+
} from "./shared/chunk-I3QEUR7L.js";
|
|
4
4
|
import "./shared/chunk-HPGJKTV5.js";
|
|
5
5
|
import "./shared/chunk-3THCBXDW.js";
|
|
6
|
-
import "./shared/chunk-
|
|
6
|
+
import "./shared/chunk-QHWWA243.js";
|
|
7
7
|
|
|
8
8
|
// src/react.ts
|
|
9
9
|
import { Children, Fragment, createElement, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
PRE_POSITION,
|
|
6
6
|
baseVars,
|
|
7
7
|
responsiveCss
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QHWWA243.js";
|
|
9
9
|
|
|
10
10
|
// src/adapter.ts
|
|
11
11
|
var chevron = (h, path) => h("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false" }, h("path", { d: path }));
|
|
@@ -43,10 +43,11 @@ function responsiveCss(id, props) {
|
|
|
43
43
|
var PRE_POSITION = "(function(r){var t=r.querySelector('[data-sc-track]'),s=t&&t.querySelector('[data-sc-initial]'),f=t&&t.firstElementChild;if(!s||s==f)return;var a=s.getBoundingClientRect(),b=f.getBoundingClientRect();t.scrollLeft=getComputedStyle(t).direction=='rtl'?a.right-b.right:a.left-b.left})(document.currentScript.previousElementSibling)";
|
|
44
44
|
function templateLabels(templates = {}) {
|
|
45
45
|
const fill = (template, values) => template.replace(/\{(\w+)\}/g, (match, name) => name in values ? String(values[name]) : match);
|
|
46
|
+
const status = templates.status || templates.statusSingle;
|
|
46
47
|
return {
|
|
47
48
|
...templates.page && { page: (n, count) => fill(templates.page, { n, count }) },
|
|
48
|
-
...
|
|
49
|
-
status: (first, last, count) => fill(templates.status, { first, last, count })
|
|
49
|
+
...status && {
|
|
50
|
+
status: (first, last, count) => fill(first == last && templates.statusSingle ? templates.statusSingle : status, { first, last, count })
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordwerk/scroll-carousel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A dependency-free carousel on native scrolling: CSS scroll snap first, arrows, dots, paging and an API as progressive enhancement.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/studio-nordwerk/scroll-carousel.git"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://
|
|
11
|
+
"homepage": "https://www.nordwerk.studio/oss/scroll-carousel",
|
|
12
12
|
"keywords": [
|
|
13
13
|
"carousel",
|
|
14
14
|
"slider",
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@axe-core/playwright": "4.13.0",
|
|
90
|
+
"@fontsource-variable/geist": "^5.3.0",
|
|
90
91
|
"@playwright/test": "1.61.1",
|
|
91
92
|
"@types/node": "^24.0.0",
|
|
92
93
|
"@types/react": "^19.3.0",
|
package/src/astro/Carousel.astro
CHANGED
|
@@ -21,8 +21,11 @@ interface Props extends LayoutProps {
|
|
|
21
21
|
drag?: boolean;
|
|
22
22
|
/** Milliseconds per page; renders the play button. */
|
|
23
23
|
autoplay?: number;
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Label templates: page 'Slide {n} of {count}', status 'Items {first} to {last} of {count}',
|
|
26
|
+
* statusSingle 'Item {first} of {count}' for one visible slide, prev, next, play, pause.
|
|
27
|
+
*/
|
|
28
|
+
labels?: { page?: string; status?: string; statusSingle?: string; prev?: string; next?: string; play?: string; pause?: string };
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
const props = Astro.props;
|