@unseenco/theatre-core 0.4.2 → 0.5.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.
@@ -0,0 +1,17 @@
1
+ import type { ScrollDriver } from './sheets/attachSheetScrollDriver';
2
+ /**
3
+ * Minimal Lenis surface for {@link createLenisScrollDriver}.
4
+ * Matches [Lenis](https://github.com/darkroomengineering/lenis) without importing the package.
5
+ */
6
+ export type LenisScrollDriverSource = {
7
+ readonly scroll: number;
8
+ readonly limit: number;
9
+ scrollTo(target: number, options?: {
10
+ immediate?: boolean;
11
+ }): void;
12
+ on(event: 'scroll', handler: () => void): void;
13
+ off(event: 'scroll', handler: () => void): void;
14
+ };
15
+ /** Maps Lenis scroll position to a Theatre {@link ScrollDriver} (0–1 progress). */
16
+ export declare function createLenisScrollDriver(lenis: LenisScrollDriverSource): ScrollDriver;
17
+ //# sourceMappingURL=lenis.d.ts.map
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // core/src/lenis.ts
21
+ var lenis_exports = {};
22
+ __export(lenis_exports, {
23
+ createLenisScrollDriver: () => createLenisScrollDriver
24
+ });
25
+ module.exports = __toCommonJS(lenis_exports);
26
+ function createLenisScrollDriver(lenis) {
27
+ const readProgress = () => {
28
+ const limit = lenis.limit;
29
+ if (limit <= 0) return 0;
30
+ const progress = lenis.scroll / limit;
31
+ return Math.max(0, Math.min(1, progress));
32
+ };
33
+ return {
34
+ getProgress: readProgress,
35
+ setProgress(progress) {
36
+ const limit = lenis.limit;
37
+ const clamped = Math.max(0, Math.min(1, progress));
38
+ lenis.scrollTo(clamped * limit, { immediate: true });
39
+ },
40
+ subscribe(onChange) {
41
+ const handler = () => {
42
+ onChange(readProgress());
43
+ };
44
+ lenis.on("scroll", handler);
45
+ return () => {
46
+ lenis.off("scroll", handler);
47
+ };
48
+ }
49
+ };
50
+ }
51
+ //# sourceMappingURL=lenis-entry.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lenis.ts"],
4
+ "sourcesContent": ["import type {ScrollDriver} from './sheets/attachSheetScrollDriver'\r\n\r\n/**\r\n * Minimal Lenis surface for {@link createLenisScrollDriver}.\r\n * Matches [Lenis](https://github.com/darkroomengineering/lenis) without importing the package.\r\n */\r\nexport type LenisScrollDriverSource = {\r\n readonly scroll: number\r\n readonly limit: number\r\n scrollTo(target: number, options?: {immediate?: boolean}): void\r\n on(event: 'scroll', handler: () => void): void\r\n off(event: 'scroll', handler: () => void): void\r\n}\r\n\r\n/** Maps Lenis scroll position to a Theatre {@link ScrollDriver} (0\u20131 progress). */\r\nexport function createLenisScrollDriver(\r\n lenis: LenisScrollDriverSource,\r\n): ScrollDriver {\r\n const readProgress = (): number => {\r\n const limit = lenis.limit\r\n if (limit <= 0) return 0\r\n const progress = lenis.scroll / limit\r\n return Math.max(0, Math.min(1, progress))\r\n }\r\n\r\n return {\r\n getProgress: readProgress,\r\n setProgress(progress: number) {\r\n const limit = lenis.limit\r\n const clamped = Math.max(0, Math.min(1, progress))\r\n lenis.scrollTo(clamped * limit, {immediate: true})\r\n },\r\n subscribe(onChange) {\r\n const handler = () => {\r\n onChange(readProgress())\r\n }\r\n lenis.on('scroll', handler)\r\n return () => {\r\n lenis.off('scroll', handler)\r\n }\r\n },\r\n }\r\n}\r\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeO,SAAS,wBACd,OACc;AACd,QAAM,eAAe,MAAc;AACjC,UAAM,QAAQ,MAAM;AACpB,QAAI,SAAS,EAAG,QAAO;AACvB,UAAM,WAAW,MAAM,SAAS;AAChC,WAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,QAAQ,CAAC;AAAA,EAC1C;AAEA,SAAO;AAAA,IACL,aAAa;AAAA,IACb,YAAY,UAAkB;AAC5B,YAAM,QAAQ,MAAM;AACpB,YAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,QAAQ,CAAC;AACjD,YAAM,SAAS,UAAU,OAAO,EAAC,WAAW,KAAI,CAAC;AAAA,IACnD;AAAA,IACA,UAAU,UAAU;AAClB,YAAM,UAAU,MAAM;AACpB,iBAAS,aAAa,CAAC;AAAA,MACzB;AACA,YAAM,GAAG,UAAU,OAAO;AAC1B,aAAO,MAAM;AACX,cAAM,IAAI,UAAU,OAAO;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,30 @@
1
+ // core/src/lenis.ts
2
+ function createLenisScrollDriver(lenis) {
3
+ const readProgress = () => {
4
+ const limit = lenis.limit;
5
+ if (limit <= 0) return 0;
6
+ const progress = lenis.scroll / limit;
7
+ return Math.max(0, Math.min(1, progress));
8
+ };
9
+ return {
10
+ getProgress: readProgress,
11
+ setProgress(progress) {
12
+ const limit = lenis.limit;
13
+ const clamped = Math.max(0, Math.min(1, progress));
14
+ lenis.scrollTo(clamped * limit, { immediate: true });
15
+ },
16
+ subscribe(onChange) {
17
+ const handler = () => {
18
+ onChange(readProgress());
19
+ };
20
+ lenis.on("scroll", handler);
21
+ return () => {
22
+ lenis.off("scroll", handler);
23
+ };
24
+ }
25
+ };
26
+ }
27
+ export {
28
+ createLenisScrollDriver
29
+ };
30
+ //# sourceMappingURL=lenis-entry.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lenis.ts"],
4
+ "sourcesContent": ["import type {ScrollDriver} from './sheets/attachSheetScrollDriver'\r\n\r\n/**\r\n * Minimal Lenis surface for {@link createLenisScrollDriver}.\r\n * Matches [Lenis](https://github.com/darkroomengineering/lenis) without importing the package.\r\n */\r\nexport type LenisScrollDriverSource = {\r\n readonly scroll: number\r\n readonly limit: number\r\n scrollTo(target: number, options?: {immediate?: boolean}): void\r\n on(event: 'scroll', handler: () => void): void\r\n off(event: 'scroll', handler: () => void): void\r\n}\r\n\r\n/** Maps Lenis scroll position to a Theatre {@link ScrollDriver} (0\u20131 progress). */\r\nexport function createLenisScrollDriver(\r\n lenis: LenisScrollDriverSource,\r\n): ScrollDriver {\r\n const readProgress = (): number => {\r\n const limit = lenis.limit\r\n if (limit <= 0) return 0\r\n const progress = lenis.scroll / limit\r\n return Math.max(0, Math.min(1, progress))\r\n }\r\n\r\n return {\r\n getProgress: readProgress,\r\n setProgress(progress: number) {\r\n const limit = lenis.limit\r\n const clamped = Math.max(0, Math.min(1, progress))\r\n lenis.scrollTo(clamped * limit, {immediate: true})\r\n },\r\n subscribe(onChange) {\r\n const handler = () => {\r\n onChange(readProgress())\r\n }\r\n lenis.on('scroll', handler)\r\n return () => {\r\n lenis.off('scroll', handler)\r\n }\r\n },\r\n }\r\n}\r\n"],
5
+ "mappings": ";AAeO,SAAS,wBACd,OACc;AACd,QAAM,eAAe,MAAc;AACjC,UAAM,QAAQ,MAAM;AACpB,QAAI,SAAS,EAAG,QAAO;AACvB,UAAM,WAAW,MAAM,SAAS;AAChC,WAAO,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,QAAQ,CAAC;AAAA,EAC1C;AAEA,SAAO;AAAA,IACL,aAAa;AAAA,IACb,YAAY,UAAkB;AAC5B,YAAM,QAAQ,MAAM;AACpB,YAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,QAAQ,CAAC;AACjD,YAAM,SAAS,UAAU,OAAO,EAAC,WAAW,KAAI,CAAC;AAAA,IACnD;AAAA,IACA,UAAU,UAAU;AAClB,YAAM,UAAU,MAAM;AACpB,iBAAS,aAAa,CAAC;AAAA,MACzB;AACA,YAAM,GAAG,UAAU,OAAO;AAC1B,aAAO,MAAM;AACX,cAAM,IAAI,UAAU,OAAO;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export { createLenisScrollDriver } from './lenis-entry';
2
+ export type { LenisScrollDriverSource } from './lenis-entry';
package/dist/lenis.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+ const lenisEntry = require('./lenis-entry.js');
3
+ exports.createLenisScrollDriver = lenisEntry.createLenisScrollDriver;
package/dist/lenis.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export { createLenisScrollDriver } from './lenis-entry.mjs';
2
+ export type { LenisScrollDriverSource } from './lenis-entry.mjs';
@@ -1 +1 @@
1
- export { privateAPI, setPrivateAPI } from './index';
1
+ export { privateAPI, setPrivateAPI, getTheatreCoreRafDriver } from './index';
@@ -2,3 +2,4 @@
2
2
  const index = require('./index.js');
3
3
  exports.privateAPI = index.privateAPI;
4
4
  exports.setPrivateAPI = index.setPrivateAPI;
5
+ exports.getTheatreCoreRafDriver = index.getTheatreCoreRafDriver;
@@ -1 +1 @@
1
- export { privateAPI, setPrivateAPI } from './index.mjs';
1
+ export { privateAPI, setPrivateAPI, getTheatreCoreRafDriver } from './index.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unseenco/theatre-core",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Motion design editor for the web",
6
6
  "repository": {
@@ -11,7 +11,7 @@
11
11
  "author": {
12
12
  "name": "TheaterJS Oy",
13
13
  "email": "hello@theatrejs.com",
14
- "url": "https://www.theatrejs.com"
14
+ "url": "https://unseen-theatre.netlify.app"
15
15
  },
16
16
  "main": "dist/index.js",
17
17
  "module": "dist/index.mjs",
@@ -27,6 +27,11 @@
27
27
  "types": "./dist/privateAPIs.d.ts",
28
28
  "import": "./dist/privateAPIs.mjs",
29
29
  "require": "./dist/privateAPIs.js"
30
+ },
31
+ "./lenis": {
32
+ "types": "./dist/lenis.d.ts",
33
+ "import": "./dist/lenis.mjs",
34
+ "require": "./dist/lenis.js"
30
35
  }
31
36
  },
32
37
  "files": [
@@ -37,7 +42,15 @@
37
42
  },
38
43
  "sideEffects": true,
39
44
  "dependencies": {
40
- "@unseenco/theatre-dataverse": "0.4.2"
45
+ "@unseenco/theatre-dataverse": "0.5.0"
46
+ },
47
+ "peerDependencies": {
48
+ "lenis": ">=1.0.0"
49
+ },
50
+ "peerDependenciesMeta": {
51
+ "lenis": {
52
+ "optional": true
53
+ }
41
54
  },
42
55
  "//": "Add packages here to make them externals of core. Add them to theatre/package.json if you want to bundle them with studio."
43
56
  }