@openpageflip/core 0.0.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 +22 -0
- package/README.md +17 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.iife.js +37 -0
- package/dist/index.iife.js.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +22 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ben Honda and OpenPageFlip contributors
|
|
4
|
+
Copyright (c) 2020 Oleg Litovski (StPageFlip and react-pageflip, from which the page-fold geometry is derived)
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @openpageflip/core
|
|
2
|
+
|
|
3
|
+
Framework-agnostic page-turn engine. Successor to [`page-flip`](https://www.npmjs.com/package/page-flip) (StPageFlip).
|
|
4
|
+
|
|
5
|
+
Pre-1.0 and under construction. The plan, decisions and status live in the
|
|
6
|
+
[repository's SPEC.md](https://github.com/benhonda/openpageflip/blob/main/SPEC.md).
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
bun add @openpageflip/core
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import "@openpageflip/core/styles.css";
|
|
14
|
+
import { Layout } from "@openpageflip/core";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
A CDN build is published as `dist/index.iife.js` and exposes `window.OpenPageFlip`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/options.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Public option vocabularies. Plain `as const` objects instead of enums so they survive
|
|
4
|
+
* `isolatedModules`, `erasableSyntaxOnly`, and consumers who only speak string literals.
|
|
5
|
+
*/
|
|
6
|
+
/** How many pages are visible at once. `auto` picks by container width. */
|
|
7
|
+
declare const Layout: {
|
|
8
|
+
readonly auto: "auto";
|
|
9
|
+
readonly single: "single";
|
|
10
|
+
readonly spread: "spread";
|
|
11
|
+
};
|
|
12
|
+
type Layout = (typeof Layout)[keyof typeof Layout];
|
|
13
|
+
/** Reading direction. `rtl` flips the spine to the right for manga and Hebrew/Arabic books. */
|
|
14
|
+
declare const Direction: {
|
|
15
|
+
readonly ltr: "ltr";
|
|
16
|
+
readonly rtl: "rtl";
|
|
17
|
+
};
|
|
18
|
+
type Direction = (typeof Direction)[keyof typeof Direction];
|
|
19
|
+
/** Which corner a programmatic flip lifts. */
|
|
20
|
+
declare const FlipCorner: {
|
|
21
|
+
readonly top: "top";
|
|
22
|
+
readonly bottom: "bottom";
|
|
23
|
+
};
|
|
24
|
+
type FlipCorner = (typeof FlipCorner)[keyof typeof FlipCorner];
|
|
25
|
+
/** `hard` pages rotate as a rigid sheet (covers); `soft` pages bend along the fold. */
|
|
26
|
+
declare const PageDensity: {
|
|
27
|
+
readonly soft: "soft";
|
|
28
|
+
readonly hard: "hard";
|
|
29
|
+
};
|
|
30
|
+
type PageDensity = (typeof PageDensity)[keyof typeof PageDensity];
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Direction, FlipCorner, Layout, PageDensity };
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var OpenPageFlip = (function(exports) {
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
//#region src/options.ts
|
|
4
|
+
/**
|
|
5
|
+
* Public option vocabularies. Plain `as const` objects instead of enums so they survive
|
|
6
|
+
* `isolatedModules`, `erasableSyntaxOnly`, and consumers who only speak string literals.
|
|
7
|
+
*/
|
|
8
|
+
/** How many pages are visible at once. `auto` picks by container width. */
|
|
9
|
+
const Layout = {
|
|
10
|
+
auto: "auto",
|
|
11
|
+
single: "single",
|
|
12
|
+
spread: "spread"
|
|
13
|
+
};
|
|
14
|
+
/** Reading direction. `rtl` flips the spine to the right for manga and Hebrew/Arabic books. */
|
|
15
|
+
const Direction = {
|
|
16
|
+
ltr: "ltr",
|
|
17
|
+
rtl: "rtl"
|
|
18
|
+
};
|
|
19
|
+
/** Which corner a programmatic flip lifts. */
|
|
20
|
+
const FlipCorner = {
|
|
21
|
+
top: "top",
|
|
22
|
+
bottom: "bottom"
|
|
23
|
+
};
|
|
24
|
+
/** `hard` pages rotate as a rigid sheet (covers); `soft` pages bend along the fold. */
|
|
25
|
+
const PageDensity = {
|
|
26
|
+
soft: "soft",
|
|
27
|
+
hard: "hard"
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.Direction = Direction;
|
|
31
|
+
exports.FlipCorner = FlipCorner;
|
|
32
|
+
exports.Layout = Layout;
|
|
33
|
+
exports.PageDensity = PageDensity;
|
|
34
|
+
return exports;
|
|
35
|
+
})({});
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=index.iife.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.iife.js","names":[],"sources":["../src/options.ts"],"sourcesContent":["/**\n * Public option vocabularies. Plain `as const` objects instead of enums so they survive\n * `isolatedModules`, `erasableSyntaxOnly`, and consumers who only speak string literals.\n */\n\n/** How many pages are visible at once. `auto` picks by container width. */\nexport const Layout = { auto: \"auto\", single: \"single\", spread: \"spread\" } as const;\nexport type Layout = (typeof Layout)[keyof typeof Layout];\n\n/** Reading direction. `rtl` flips the spine to the right for manga and Hebrew/Arabic books. */\nexport const Direction = { ltr: \"ltr\", rtl: \"rtl\" } as const;\nexport type Direction = (typeof Direction)[keyof typeof Direction];\n\n/** Which corner a programmatic flip lifts. */\nexport const FlipCorner = { top: \"top\", bottom: \"bottom\" } as const;\nexport type FlipCorner = (typeof FlipCorner)[keyof typeof FlipCorner];\n\n/** `hard` pages rotate as a rigid sheet (covers); `soft` pages bend along the fold. */\nexport const PageDensity = { soft: \"soft\", hard: \"hard\" } as const;\nexport type PageDensity = (typeof PageDensity)[keyof typeof PageDensity];\n"],"mappings":";;;;;;;;CAMA,MAAa,SAAS;EAAE,MAAM;EAAQ,QAAQ;EAAU,QAAQ;CAAS;;CAIzE,MAAa,YAAY;EAAE,KAAK;EAAO,KAAK;CAAM;;CAIlD,MAAa,aAAa;EAAE,KAAK;EAAO,QAAQ;CAAS;;CAIzD,MAAa,cAAc;EAAE,MAAM;EAAQ,MAAM;CAAO"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/options.ts
|
|
2
|
+
/**
|
|
3
|
+
* Public option vocabularies. Plain `as const` objects instead of enums so they survive
|
|
4
|
+
* `isolatedModules`, `erasableSyntaxOnly`, and consumers who only speak string literals.
|
|
5
|
+
*/
|
|
6
|
+
/** How many pages are visible at once. `auto` picks by container width. */
|
|
7
|
+
const Layout = {
|
|
8
|
+
auto: "auto",
|
|
9
|
+
single: "single",
|
|
10
|
+
spread: "spread"
|
|
11
|
+
};
|
|
12
|
+
/** Reading direction. `rtl` flips the spine to the right for manga and Hebrew/Arabic books. */
|
|
13
|
+
const Direction = {
|
|
14
|
+
ltr: "ltr",
|
|
15
|
+
rtl: "rtl"
|
|
16
|
+
};
|
|
17
|
+
/** Which corner a programmatic flip lifts. */
|
|
18
|
+
const FlipCorner = {
|
|
19
|
+
top: "top",
|
|
20
|
+
bottom: "bottom"
|
|
21
|
+
};
|
|
22
|
+
/** `hard` pages rotate as a rigid sheet (covers); `soft` pages bend along the fold. */
|
|
23
|
+
const PageDensity = {
|
|
24
|
+
soft: "soft",
|
|
25
|
+
hard: "hard"
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Direction, FlipCorner, Layout, PageDensity };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/options.ts"],"sourcesContent":["/**\n * Public option vocabularies. Plain `as const` objects instead of enums so they survive\n * `isolatedModules`, `erasableSyntaxOnly`, and consumers who only speak string literals.\n */\n\n/** How many pages are visible at once. `auto` picks by container width. */\nexport const Layout = { auto: \"auto\", single: \"single\", spread: \"spread\" } as const;\nexport type Layout = (typeof Layout)[keyof typeof Layout];\n\n/** Reading direction. `rtl` flips the spine to the right for manga and Hebrew/Arabic books. */\nexport const Direction = { ltr: \"ltr\", rtl: \"rtl\" } as const;\nexport type Direction = (typeof Direction)[keyof typeof Direction];\n\n/** Which corner a programmatic flip lifts. */\nexport const FlipCorner = { top: \"top\", bottom: \"bottom\" } as const;\nexport type FlipCorner = (typeof FlipCorner)[keyof typeof FlipCorner];\n\n/** `hard` pages rotate as a rigid sheet (covers); `soft` pages bend along the fold. */\nexport const PageDensity = { soft: \"soft\", hard: \"hard\" } as const;\nexport type PageDensity = (typeof PageDensity)[keyof typeof PageDensity];\n"],"mappings":";;;;;;AAMA,MAAa,SAAS;CAAE,MAAM;CAAQ,QAAQ;CAAU,QAAQ;AAAS;;AAIzE,MAAa,YAAY;CAAE,KAAK;CAAO,KAAK;AAAM;;AAIlD,MAAa,aAAa;CAAE,KAAK;CAAO,QAAQ;AAAS;;AAIzD,MAAa,cAAc;CAAE,MAAM;CAAQ,MAAM;AAAO"}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @openpageflip/core stylesheet. Import it once: `import "@openpageflip/core/styles.css"`.
|
|
3
|
+
* Theming is through the custom properties below; set them on the host element.
|
|
4
|
+
*/
|
|
5
|
+
.opf-book {
|
|
6
|
+
--opf-flip-duration: 800ms;
|
|
7
|
+
--opf-shadow-opacity: 1;
|
|
8
|
+
|
|
9
|
+
position: relative;
|
|
10
|
+
display: block;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
/* Vertical page scroll stays native; horizontal drags belong to the book. */
|
|
13
|
+
touch-action: pan-y;
|
|
14
|
+
user-select: none;
|
|
15
|
+
-webkit-user-select: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@media (prefers-reduced-motion: reduce) {
|
|
19
|
+
.opf-book {
|
|
20
|
+
--opf-flip-duration: 0ms;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openpageflip/core",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Realistic page-flip effect for HTML content. Framework-agnostic successor to StPageFlip.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"**/*.css"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/benhonda/openpageflip.git",
|
|
13
|
+
"directory": "packages/core"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/benhonda/openpageflip#readme",
|
|
16
|
+
"bugs": "https://github.com/benhonda/openpageflip/issues",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"page-flip",
|
|
19
|
+
"flipbook",
|
|
20
|
+
"book",
|
|
21
|
+
"page turn",
|
|
22
|
+
"stpageflip",
|
|
23
|
+
"typescript"
|
|
24
|
+
],
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./styles.css": "./dist/styles.css",
|
|
37
|
+
"./package.json": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"unpkg": "./dist/index.iife.js",
|
|
40
|
+
"jsdelivr": "./dist/index.iife.js"
|
|
41
|
+
}
|