@getnarro/atlas 0.1.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/LICENSE +21 -0
- package/README.md +143 -0
- package/dist/check/index.d.ts +82 -0
- package/dist/check/index.js +150 -0
- package/dist/check/index.js.map +1 -0
- package/dist/chunk-5SRKWTOU.js +33 -0
- package/dist/chunk-5SRKWTOU.js.map +1 -0
- package/dist/chunk-BDF2X5LC.js +28 -0
- package/dist/chunk-BDF2X5LC.js.map +1 -0
- package/dist/chunk-RHTCDWZD.js +142 -0
- package/dist/chunk-RHTCDWZD.js.map +1 -0
- package/dist/chunk-RWYOYDBD.js +75 -0
- package/dist/chunk-RWYOYDBD.js.map +1 -0
- package/dist/chunk-SD4Y4EBG.js +69 -0
- package/dist/chunk-SD4Y4EBG.js.map +1 -0
- package/dist/chunk-UTCNNNPT.js +89 -0
- package/dist/chunk-UTCNNNPT.js.map +1 -0
- package/dist/embed/narro-atlas.js +12 -0
- package/dist/image/index.d.ts +132 -0
- package/dist/image/index.js +117 -0
- package/dist/image/index.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/lod-DBuZ0MG3.d.ts +86 -0
- package/dist/map/index.d.ts +222 -0
- package/dist/map/index.js +184 -0
- package/dist/map/index.js.map +1 -0
- package/dist/path-BIxJH8g2.d.ts +101 -0
- package/dist/provider-CjL3i-0A.d.ts +54 -0
- package/dist/react/index.d.ts +183 -0
- package/dist/react/index.js +291 -0
- package/dist/react/index.js.map +1 -0
- package/dist/replay/index.d.ts +162 -0
- package/dist/replay/index.js +138 -0
- package/dist/replay/index.js.map +1 -0
- package/dist/tag-BP51cBza.d.ts +24 -0
- package/dist/timeline-B_dNydQA.d.ts +194 -0
- package/dist/video/index.d.ts +101 -0
- package/dist/video/index.js +91 -0
- package/dist/video/index.js.map +1 -0
- package/dist/view-BzztOpV6.d.ts +83 -0
- package/dist/web/embed.d.ts +59 -0
- package/dist/web/embed.js +192 -0
- package/dist/web/embed.js.map +1 -0
- package/dist/web/index.d.ts +89 -0
- package/dist/web/index.js +4 -0
- package/dist/web/index.js.map +1 -0
- package/package.json +119 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { R as Rect } from '../view-BzztOpV6.js';
|
|
2
|
+
import { S as SceneProvider } from '../provider-CjL3i-0A.js';
|
|
3
|
+
import { T as Timeline } from '../timeline-B_dNydQA.js';
|
|
4
|
+
export { A as AtlasMode, T as TAG } from '../tag-BP51cBza.js';
|
|
5
|
+
import '../path-BIxJH8g2.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A scene that is just the page's own markup.
|
|
9
|
+
*
|
|
10
|
+
* The web embed's default, and the reason it needs no build step: whatever a page puts
|
|
11
|
+
* inside `<narro-atlas>` *is* the scene. A waypoint that says `at: "#pricing"` resolves
|
|
12
|
+
* against the element with that id, exactly as a reader would expect from a fragment
|
|
13
|
+
* link, and the same markup is what shows with JavaScript off.
|
|
14
|
+
*
|
|
15
|
+
* Measured with `offsetLeft`/`offsetTop` rather than `getBoundingClientRect`, because the
|
|
16
|
+
* camera's own transform is on an ancestor: a rect would include it and every waypoint
|
|
17
|
+
* would resolve to a different place depending on where the camera happened to be.
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
interface DomProviderOptions {
|
|
23
|
+
/** The element whose coordinate system the world is. */
|
|
24
|
+
root: HTMLElement | null;
|
|
25
|
+
/** Padding when framing a matched element, as a fraction. @defaultValue 0.15 */
|
|
26
|
+
padding?: number;
|
|
27
|
+
/** The world grid, used when the root has not been laid out yet. */
|
|
28
|
+
fallback?: Rect;
|
|
29
|
+
}
|
|
30
|
+
/** An element's box in the root's coordinates, following the offset chain. */
|
|
31
|
+
declare function offsetRectWithin(element: HTMLElement, root: HTMLElement): Rect;
|
|
32
|
+
declare function domProvider(options: DomProviderOptions): SceneProvider;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Scroll as a clock.
|
|
36
|
+
*
|
|
37
|
+
* The third clock, after a presenter's keypress and a renderer's frame counter, and the
|
|
38
|
+
* one a web page wants. It costs almost nothing to add because the camera is a pure
|
|
39
|
+
* function of a moment: a deck asks for the moment a flight has reached, a video asks for
|
|
40
|
+
* `frame / fps`, and a page asks how far it has been scrolled. Same camera, same path,
|
|
41
|
+
* same checker.
|
|
42
|
+
*
|
|
43
|
+
* Pure arithmetic here, so the part that is fiddly — what "how far through" means for an
|
|
44
|
+
* element that is taller than the window and sticky inside it — is pinned by tests rather
|
|
45
|
+
* than discovered on a phone.
|
|
46
|
+
*
|
|
47
|
+
* @packageDocumentation
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/** What the page can tell us, without this module touching the DOM. */
|
|
51
|
+
interface ScrollGeometry {
|
|
52
|
+
/** The scroller's top edge relative to the viewport — `getBoundingClientRect().top`. */
|
|
53
|
+
top: number;
|
|
54
|
+
/** Its full height, which is what gives the camera room to travel. */
|
|
55
|
+
height: number;
|
|
56
|
+
/** The window's height. */
|
|
57
|
+
viewportHeight: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* How far through the camera path a scroll position is, in `[0, 1]`.
|
|
61
|
+
*
|
|
62
|
+
* The scroller is taller than the window and holds a window-height panel stuck to the top
|
|
63
|
+
* of it; the camera travels while that panel is stuck. So the travel distance is
|
|
64
|
+
* `height - viewportHeight`, and progress is how much of it has gone by. A scroller no
|
|
65
|
+
* taller than the window has nowhere to travel and sits at the start, which is the
|
|
66
|
+
* honest answer rather than a division by zero.
|
|
67
|
+
*/
|
|
68
|
+
declare function scrollProgress(geometry: ScrollGeometry): number;
|
|
69
|
+
/** The height a scroller needs to give every waypoint `perWaypoint` screens of travel. */
|
|
70
|
+
declare function scrollerHeight(waypointCount: number, viewportHeight: number, perWaypoint?: number): number;
|
|
71
|
+
/**
|
|
72
|
+
* The moment on the timeline a scroll progress corresponds to.
|
|
73
|
+
*
|
|
74
|
+
* Holds are dropped from the mapping deliberately: a hold is time spent not moving, and a
|
|
75
|
+
* reader who keeps scrolling through one has the distinct experience of a broken page.
|
|
76
|
+
* Scroll drives the *flights*; the rests belong to autoplay and video.
|
|
77
|
+
*/
|
|
78
|
+
declare function progressToSeconds(timeline: Timeline, progress: number): number;
|
|
79
|
+
/**
|
|
80
|
+
* The nearest waypoint's arrival time — what a reduced-motion reader gets.
|
|
81
|
+
*
|
|
82
|
+
* Scrolling is the reader's own doing, so the motion is theirs to control; what they have
|
|
83
|
+
* asked not to have is the camera sliding under them while they do it. Snapping to the
|
|
84
|
+
* waypoint they are nearest keeps every framing reachable by scrolling and removes the
|
|
85
|
+
* travel between, which is the same trade the deck host makes by cutting.
|
|
86
|
+
*/
|
|
87
|
+
declare function snapToWaypoint(timeline: Timeline, seconds: number): number;
|
|
88
|
+
|
|
89
|
+
export { type DomProviderOptions, type ScrollGeometry, domProvider, offsetRectWithin, progressToSeconds, scrollProgress, scrollerHeight, snapToWaypoint };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getnarro/atlas",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "A spatial canvas for Narro — a camera path as text, one pure camera function over it, and scene providers a deck, a video and a web page all render the same way",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/getnarro/narro.git",
|
|
10
|
+
"directory": "packages/atlas"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/getnarro/narro/tree/main/packages/atlas",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/getnarro/narro/issues"
|
|
15
|
+
},
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./react": {
|
|
24
|
+
"types": "./dist/react/index.d.ts",
|
|
25
|
+
"import": "./dist/react/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./video": {
|
|
28
|
+
"types": "./dist/video/index.d.ts",
|
|
29
|
+
"import": "./dist/video/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./replay": {
|
|
32
|
+
"types": "./dist/replay/index.d.ts",
|
|
33
|
+
"import": "./dist/replay/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./check": {
|
|
36
|
+
"types": "./dist/check/index.d.ts",
|
|
37
|
+
"import": "./dist/check/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./package.json": "./package.json",
|
|
40
|
+
"./map": {
|
|
41
|
+
"types": "./dist/map/index.d.ts",
|
|
42
|
+
"import": "./dist/map/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./image": {
|
|
45
|
+
"types": "./dist/image/index.d.ts",
|
|
46
|
+
"import": "./dist/image/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./web": {
|
|
49
|
+
"types": "./dist/web/index.d.ts",
|
|
50
|
+
"import": "./dist/web/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./embed": {
|
|
53
|
+
"types": "./dist/web/embed.d.ts",
|
|
54
|
+
"import": "./dist/web/embed.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist",
|
|
59
|
+
"CHANGELOG.md"
|
|
60
|
+
],
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"keywords": [
|
|
65
|
+
"presentation",
|
|
66
|
+
"zooming",
|
|
67
|
+
"infinite-canvas",
|
|
68
|
+
"camera",
|
|
69
|
+
"prezi",
|
|
70
|
+
"react",
|
|
71
|
+
"developer-tools"
|
|
72
|
+
],
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"@getnarro/replay": ">=0.1.0",
|
|
75
|
+
"@getnarro/video": ">=0.7.0",
|
|
76
|
+
"react": "^19.0.0",
|
|
77
|
+
"react-dom": "^19.0.0"
|
|
78
|
+
},
|
|
79
|
+
"peerDependenciesMeta": {
|
|
80
|
+
"react": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"react-dom": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@getnarro/replay": {
|
|
87
|
+
"optional": true
|
|
88
|
+
},
|
|
89
|
+
"@getnarro/video": {
|
|
90
|
+
"optional": true
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"devDependencies": {
|
|
94
|
+
"@biomejs/biome": "2.3.7",
|
|
95
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
96
|
+
"@testing-library/react": "16.3.0",
|
|
97
|
+
"@types/node": "22.16.0",
|
|
98
|
+
"@types/react": "19.2.7",
|
|
99
|
+
"@types/react-dom": "19.2.3",
|
|
100
|
+
"esbuild": "0.27.0",
|
|
101
|
+
"jsdom": "27.2.0",
|
|
102
|
+
"react": "19.2.0",
|
|
103
|
+
"react-dom": "19.2.0",
|
|
104
|
+
"tsup": "8.5.1",
|
|
105
|
+
"typescript": "5.9.3",
|
|
106
|
+
"vitest": "4.0.14",
|
|
107
|
+
"@getnarro/replay": "0.1.0",
|
|
108
|
+
"@getnarro/video": "0.7.0"
|
|
109
|
+
},
|
|
110
|
+
"scripts": {
|
|
111
|
+
"dev": "tsup --watch",
|
|
112
|
+
"build": "tsup && node scripts/bundle-embed.mjs",
|
|
113
|
+
"lint": "biome lint .",
|
|
114
|
+
"format": "biome format --write .",
|
|
115
|
+
"check": "biome check --write . && tsc --noEmit",
|
|
116
|
+
"test": "vitest run",
|
|
117
|
+
"test:watch": "vitest"
|
|
118
|
+
}
|
|
119
|
+
}
|