@makefully/fancifully 0.1.0 → 0.2.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/CHANGELOG.md +31 -12
- package/LICENSE +21 -21
- package/README.md +250 -147
- package/dist/Storybook.d.ts +68 -0
- package/dist/Storybook.d.ts.map +1 -1
- package/dist/editor/EditorChrome.d.ts +33 -0
- package/dist/editor/EditorChrome.d.ts.map +1 -0
- package/dist/editor/PageCanvas.d.ts +50 -0
- package/dist/editor/PageCanvas.d.ts.map +1 -0
- package/dist/editor/dropImport.d.ts +16 -0
- package/dist/editor/dropImport.d.ts.map +1 -0
- package/dist/editor/index.d.ts +7 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/layoutUnits.d.ts +39 -0
- package/dist/editor/layoutUnits.d.ts.map +1 -0
- package/dist/editor/packFanci.d.ts +16 -0
- package/dist/editor/packFanci.d.ts.map +1 -0
- package/dist/editor/storyFabricMap.d.ts +29 -0
- package/dist/editor/storyFabricMap.d.ts.map +1 -0
- package/dist/fancifully.css +1 -1
- package/dist/fancifully.iife.js +4 -8
- package/dist/fancifully.js +3432 -2065
- package/dist/flip/DefaultFlipStyle.d.ts +11 -0
- package/dist/flip/DefaultFlipStyle.d.ts.map +1 -0
- package/dist/flip/FlipStyle.d.ts +47 -0
- package/dist/flip/FlipStyle.d.ts.map +1 -0
- package/dist/flip/index.d.ts +4 -0
- package/dist/flip/index.d.ts.map +1 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/nav/Pager.d.ts +18 -3
- package/dist/nav/Pager.d.ts.map +1 -1
- package/dist/nav/hardback.d.ts +21 -0
- package/dist/nav/hardback.d.ts.map +1 -0
- package/dist/nav/layoutMode.d.ts +43 -3
- package/dist/nav/layoutMode.d.ts.map +1 -1
- package/dist/render/SpreadView.d.ts +48 -2
- package/dist/render/SpreadView.d.ts.map +1 -1
- package/dist/schema/story.d.ts +30 -6
- package/dist/schema/story.d.ts.map +1 -1
- package/package.json +75 -74
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FlipStyle, type FlipContext } from './FlipStyle.js';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in CSS 3D page turn (perspective rotateY on the turning leaf).
|
|
4
|
+
* Registered as `"default"`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DefaultFlipStyle extends FlipStyle {
|
|
7
|
+
static readonly id = "default";
|
|
8
|
+
play(ctx: FlipContext): Promise<void>;
|
|
9
|
+
cancel(ctx: Pick<FlipContext, 'bookEl'>): void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=DefaultFlipStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultFlipStyle.d.ts","sourceRoot":"","sources":["../../src/flip/DefaultFlipStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,WAAW,EAEjB,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,gBAAyB,EAAE,aAAa;IAE/B,IAAI,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BrC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,GAAG,IAAI;CAGxD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export type FlipDirection = 'next' | 'prev';
|
|
2
|
+
/** Context passed to a flip style while animating a turn. */
|
|
3
|
+
export type FlipContext = {
|
|
4
|
+
bookEl: HTMLElement;
|
|
5
|
+
viewportEl: HTMLElement;
|
|
6
|
+
leftLeaf: HTMLElement;
|
|
7
|
+
rightLeaf: HTMLElement;
|
|
8
|
+
direction: FlipDirection;
|
|
9
|
+
/** Duration in milliseconds */
|
|
10
|
+
durationMs: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Base class for page-flip animations.
|
|
14
|
+
*
|
|
15
|
+
* Built-in styles (e.g. {@link DefaultFlipStyle}) extend this class.
|
|
16
|
+
* Hosts can subclass it and pass the constructor or an instance via
|
|
17
|
+
* `StorybookOptions.flipStyle`, or {@link registerFlipStyle} a named id
|
|
18
|
+
* for string lookup (`flipStyle: "my-style"`).
|
|
19
|
+
*/
|
|
20
|
+
export declare abstract class FlipStyle {
|
|
21
|
+
/** Registry id when registered via {@link registerFlipStyle}. */
|
|
22
|
+
static readonly id: string;
|
|
23
|
+
/**
|
|
24
|
+
* Play the flip. Resolve when the outgoing leaf animation is done and
|
|
25
|
+
* the engine may mount the next spread.
|
|
26
|
+
*/
|
|
27
|
+
abstract play(ctx: FlipContext): Promise<void>;
|
|
28
|
+
/** Clear classes/styles if a flip is interrupted. */
|
|
29
|
+
cancel(ctx: Pick<FlipContext, 'bookEl' | 'viewportEl' | 'leftLeaf' | 'rightLeaf'>): void;
|
|
30
|
+
}
|
|
31
|
+
export type FlipStyleConstructor = (new () => FlipStyle) & {
|
|
32
|
+
readonly id?: string;
|
|
33
|
+
};
|
|
34
|
+
export type FlipStyleInput = string | FlipStyle | FlipStyleConstructor;
|
|
35
|
+
/** Register a named flip style for string lookup (`flipStyle: "id"`). */
|
|
36
|
+
export declare function registerFlipStyle(id: string, ctor: FlipStyleConstructor): void;
|
|
37
|
+
export declare function getRegisteredFlipStyle(id: string): FlipStyleConstructor | undefined;
|
|
38
|
+
export declare function listRegisteredFlipStyles(): string[];
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a string id, constructor, or instance into a {@link FlipStyle}.
|
|
41
|
+
* Unknown string ids throw. Omitting input yields {@link DefaultFlipStyle}.
|
|
42
|
+
*/
|
|
43
|
+
export declare function createFlipStyle(input?: FlipStyleInput | null): FlipStyle;
|
|
44
|
+
/** Default flip duration in ms (matches legacy 0.4s CSS). */
|
|
45
|
+
export declare const DEFAULT_FLIP_SPEED_MS = 400;
|
|
46
|
+
export declare function resolveFlipSpeedMs(speed?: number | null): number;
|
|
47
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;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,CA2BxE;AAED,6DAA6D;AAC7D,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAKhE"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { FlipStyle, createFlipStyle, registerFlipStyle, getRegisteredFlipStyle, listRegisteredFlipStyles, resolveFlipSpeedMs, DEFAULT_FLIP_SPEED_MS, type FlipContext, type FlipDirection, type FlipStyleConstructor, type FlipStyleInput, } from './FlipStyle.js';
|
|
2
|
+
export { DefaultFlipStyle } from './DefaultFlipStyle.js';
|
|
3
|
+
import './DefaultFlipStyle.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,uBAAuB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import './styles/fancifully.css';
|
|
2
|
-
export { Storybook, type StorybookOptions } from './Storybook.js';
|
|
3
|
-
export { parseStory, storySchema, type Story, type StoryPage, type Cue, type LayoutMode } from './schema/story.js';
|
|
2
|
+
export { Storybook, type StorybookOptions, type StorybookChromeOptions, } from './Storybook.js';
|
|
3
|
+
export { parseStory, storySchema, type Story, type StoryPage, type StoryBlock, type Cue, type LayoutMode, } from './schema/story.js';
|
|
4
|
+
export { packFanci, downloadBlob, type PackFanciOptions } from './editor/packFanci.js';
|
|
5
|
+
export { storyToFabric, fabricToStory } from './editor/storyFabricMap.js';
|
|
6
|
+
export { boxToPixels, htmlToPlainText, plainTextToHtml, serializeLayoutBox, toPx, } from './editor/layoutUnits.js';
|
|
7
|
+
export { FlipStyle, DefaultFlipStyle, createFlipStyle, registerFlipStyle, getRegisteredFlipStyle, listRegisteredFlipStyles, resolveFlipSpeedMs, DEFAULT_FLIP_SPEED_MS, type FlipContext, type FlipDirection, type FlipStyleConstructor, type FlipStyleInput, } from './flip/index.js';
|
|
4
8
|
export { loadStory, revokeLoadedStory, FANCI_EXTENSION, type LoadedStory, type LoadStoryOptions, } from './load/loadStory.js';
|
|
5
9
|
export type { StorySource, PackageKind } from './load/packageTypes.js';
|
|
6
10
|
export { loadFanciFromBytes, loadFanciFromZip, findStoryJsonPath } from './load/loadFanci.js';
|
|
7
11
|
export { loadEpubFromBytes, loadEpubFromZip } from './load/loadEpub.js';
|
|
8
12
|
export { parseVtt } from './sync/parseVtt.js';
|
|
9
13
|
export { CueTimeline } from './sync/CueTimeline.js';
|
|
10
|
-
export { buildSpreads, resolveLayoutMode, contentPageIds } from './nav/layoutMode.js';
|
|
14
|
+
export { buildSpreads, buildSingleSpreads, buildTwoPageSpreads, buildFrontCoverSpread, buildBackCoverSpread, resolveLayoutMode, contentPageIds, primaryPageId, findSpreadIndexForPage, type CoverOptions, type BookState, } from './nav/layoutMode.js';
|
|
15
|
+
export { HARDBACK_EDGE_RATIO, hardbackEnabled, hardbackOverhang, type HardbackOverhang, } from './nav/hardback.js';
|
|
11
16
|
export { bindApplication, createSpringrollApplication, waitForSpringrollReady, } from './springroll/bindApplication.js';
|
|
12
17
|
export { reportSpringrollProgress, reportSpringrollLoaded, type LoadProgress, type LoadStage, } from './springroll/loading.js';
|
|
13
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EACL,SAAS,EACT,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EACV,WAAW,EACX,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,GAAG,EACR,KAAK,UAAU,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,IAAI,GACL,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,KAAK,gBAAgB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,SAAS,GACf,MAAM,yBAAyB,CAAC"}
|
package/dist/nav/Pager.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Spread } from './layoutMode.js';
|
|
1
|
+
import { type BookState, type Spread } from './layoutMode.js';
|
|
2
2
|
import type { LayoutMode, ResolvedLayoutMode, Story } from '../schema/story.js';
|
|
3
3
|
import type { SpreadView } from '../render/SpreadView.js';
|
|
4
4
|
export type PagerEvents = {
|
|
@@ -6,6 +6,7 @@ export type PagerEvents = {
|
|
|
6
6
|
pageIds: string[];
|
|
7
7
|
index: number;
|
|
8
8
|
layoutMode: ResolvedLayoutMode;
|
|
9
|
+
bookState: BookState;
|
|
9
10
|
};
|
|
10
11
|
layoutchange: {
|
|
11
12
|
layoutMode: ResolvedLayoutMode;
|
|
@@ -22,17 +23,31 @@ export declare class Pager {
|
|
|
22
23
|
private breakpoint;
|
|
23
24
|
private listeners;
|
|
24
25
|
private busy;
|
|
26
|
+
private hasResolvedLayout;
|
|
27
|
+
private bookState;
|
|
28
|
+
private covers;
|
|
29
|
+
private frontCoverSpread;
|
|
30
|
+
private backCoverSpread;
|
|
25
31
|
constructor(story: Story, spreadView: SpreadView);
|
|
26
32
|
get layoutMode(): ResolvedLayoutMode;
|
|
33
|
+
get currentBookState(): BookState;
|
|
27
34
|
get currentSpread(): Spread;
|
|
28
35
|
get currentPageIds(): string[];
|
|
36
|
+
get canPrev(): boolean;
|
|
37
|
+
get canNext(): boolean;
|
|
29
38
|
on<K extends keyof PagerEvents>(event: K, fn: Listener<K>): () => void;
|
|
30
|
-
setLayoutMode(mode: LayoutMode, containerWidth: number): void;
|
|
31
|
-
updateLayout(containerWidth: number, emitIfChanged?: boolean): void;
|
|
39
|
+
setLayoutMode(mode: LayoutMode, containerWidth: number, containerHeight: number): void;
|
|
40
|
+
updateLayout(containerWidth: number, containerHeight: number, emitIfChanged?: boolean): void;
|
|
32
41
|
showInitial(): Promise<void>;
|
|
33
42
|
next(): Promise<void>;
|
|
34
43
|
prev(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Rebuild spreads/covers from the current story object after page CRUD or
|
|
46
|
+
* cover-flag changes. Remounts the current spread without animation.
|
|
47
|
+
*/
|
|
48
|
+
rebuildFromStory(preferPageId?: string | null): void;
|
|
35
49
|
goTo(pageId: string): Promise<void>;
|
|
50
|
+
private rebuildCoverSpreads;
|
|
36
51
|
private emitPageChange;
|
|
37
52
|
private emit;
|
|
38
53
|
}
|
package/dist/nav/Pager.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pager.d.ts","sourceRoot":"","sources":["../../src/nav/Pager.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Pager.d.ts","sourceRoot":"","sources":["../../src/nav/Pager.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EAEd,KAAK,MAAM,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,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,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI;IAQtE,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI;IAKtF,YAAY,CACV,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,aAAa,UAAO,GACnB,IAAI;IAuED,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA4CrB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA2C3B;;;OAGG;IACH,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAyD9C,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2CzC,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,IAAI;CAOb"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hardback covers are larger than interior leaves so open pages sit on top
|
|
3
|
+
* with a visible cover rim on each edge.
|
|
4
|
+
*/
|
|
5
|
+
/** Extra size on each edge as a fraction of the matching page dimension. */
|
|
6
|
+
export declare const HARDBACK_EDGE_RATIO = 0.035;
|
|
7
|
+
export type HardbackOverhang = {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function hardbackOverhang(pageSize: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}): HardbackOverhang;
|
|
15
|
+
/** Whether hardback presentation applies (flag on + at least one cover). */
|
|
16
|
+
export declare function hardbackEnabled(story: {
|
|
17
|
+
hardback?: boolean;
|
|
18
|
+
frontCover?: boolean;
|
|
19
|
+
backCover?: boolean;
|
|
20
|
+
}): boolean;
|
|
21
|
+
//# sourceMappingURL=hardback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hardback.d.ts","sourceRoot":"","sources":["../../src/nav/hardback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAEzC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,gBAAgB,CAKnB;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,OAAO,CAEV"}
|
package/dist/nav/layoutMode.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import type { LayoutMode, ResolvedLayoutMode } from '../schema/story.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Resolve authoring layout mode to a concrete single / two-page presentation.
|
|
4
|
+
*
|
|
5
|
+
* - `single` / `two-page`: fixed
|
|
6
|
+
* - `responsive`: landscape (width ≥ height) → two-page; portrait → single
|
|
7
|
+
* - `auto`: width ≥ singleBreakpoint → two-page (legacy width breakpoint)
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveLayoutMode(mode: LayoutMode, containerWidth: number, containerHeight: number, singleBreakpoint: number): ResolvedLayoutMode;
|
|
10
|
+
export type CoverOptions = {
|
|
11
|
+
frontCover?: boolean;
|
|
12
|
+
backCover?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** Closed cover presentation vs open spreads. */
|
|
15
|
+
export type BookState = 'closed-front' | 'open' | 'closed-back';
|
|
4
16
|
export type SpreadLeaf = {
|
|
5
17
|
kind: 'blank';
|
|
6
18
|
} | {
|
|
@@ -13,9 +25,37 @@ export type Spread = {
|
|
|
13
25
|
left: SpreadLeaf;
|
|
14
26
|
right: SpreadLeaf;
|
|
15
27
|
};
|
|
28
|
+
/** Closed front cover: cover on the right (recto), blank left — flips away on open. */
|
|
29
|
+
export declare function buildFrontCoverSpread(pages: {
|
|
30
|
+
id: string;
|
|
31
|
+
}[]): Spread;
|
|
32
|
+
/** Closed back cover: back on the right, blank left. */
|
|
33
|
+
export declare function buildBackCoverSpread(pages: {
|
|
34
|
+
id: string;
|
|
35
|
+
}[]): Spread;
|
|
36
|
+
/**
|
|
37
|
+
* Two-page open spreads.
|
|
38
|
+
*
|
|
39
|
+
* Default (no covers): `[blank, p0]`, then pairs, orphan `[last, blank]`.
|
|
40
|
+
* `frontCover`: page 0 is only shown closed; open spreads start at page 1 with
|
|
41
|
+
* content on the left (no leading blank).
|
|
42
|
+
* `backCover`: last page is only shown closed; open spreads omit it (no trailing blank).
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildTwoPageSpreads(pages: {
|
|
45
|
+
id: string;
|
|
46
|
+
}[], covers?: CoverOptions): Spread[];
|
|
47
|
+
/**
|
|
48
|
+
* One-page spreads: every story page (including covers) is its own spread.
|
|
49
|
+
* Front cover on the left; back cover on the right; others alternate.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildSingleSpreads(pages: {
|
|
52
|
+
id: string;
|
|
53
|
+
}[], covers?: CoverOptions): Spread[];
|
|
16
54
|
export declare function buildSpreads(pages: {
|
|
17
55
|
id: string;
|
|
18
|
-
}[]): Spread[];
|
|
56
|
+
}[], mode?: ResolvedLayoutMode, covers?: CoverOptions): Spread[];
|
|
19
57
|
export declare function contentPageIds(spread: Spread): string[];
|
|
58
|
+
/** Prefer left content page, else right — stable anchor when remapping layouts. */
|
|
59
|
+
export declare function primaryPageId(spread: Spread | undefined): string | null;
|
|
20
60
|
export declare function findSpreadIndexForPage(spreads: Spread[], pageId: string): number;
|
|
21
61
|
//# sourceMappingURL=layoutMode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layoutMode.d.ts","sourceRoot":"","sources":["../../src/nav/layoutMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEzE,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,GACvB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"layoutMode.d.ts","sourceRoot":"","sources":["../../src/nav/layoutMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEzE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,UAAU,EAChB,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,MAAM,GACvB,kBAAkB,CAQpB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG,MAAM,GAAG,aAAa,CAAC;AAEhE,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,MAAM,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AAQF,uFAAuF;AACvF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,CAMrE;AAED,wDAAwD;AACxD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,CAOpE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,EACvB,MAAM,GAAE,YAAiB,GACxB,MAAM,EAAE,CAyCV;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,EACvB,MAAM,GAAE,YAAiB,GACxB,MAAM,EAAE,CAoBV;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,EACvB,IAAI,GAAE,kBAA+B,EACrC,MAAM,GAAE,YAAiB,GACxB,MAAM,EAAE,CAIV;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAKvD;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAKvE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOhF"}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
+
import { type FlipStyleInput } from '../flip/index.js';
|
|
1
2
|
import type { LoadedAssets } from '../load/loadStory.js';
|
|
2
|
-
import type { Spread } from '../nav/layoutMode.js';
|
|
3
|
+
import type { BookState, Spread } from '../nav/layoutMode.js';
|
|
3
4
|
import type { ResolvedLayoutMode, Story, TapAction } from '../schema/story.js';
|
|
5
|
+
export type SpreadViewFlipOptions = {
|
|
6
|
+
flipStyle?: FlipStyleInput;
|
|
7
|
+
flipSpeed?: number;
|
|
8
|
+
};
|
|
4
9
|
export declare class SpreadView {
|
|
5
10
|
readonly element: HTMLElement;
|
|
6
11
|
readonly bookEl: HTMLElement;
|
|
12
|
+
private hardbackEl;
|
|
13
|
+
private hardbackLeft;
|
|
14
|
+
private hardbackRight;
|
|
15
|
+
private hardbackLeftPage;
|
|
16
|
+
private hardbackRightPage;
|
|
7
17
|
private leftSlot;
|
|
8
18
|
private rightSlot;
|
|
9
19
|
private leftPage;
|
|
@@ -12,10 +22,41 @@ export declare class SpreadView {
|
|
|
12
22
|
private assets;
|
|
13
23
|
private onTapActions;
|
|
14
24
|
private turning;
|
|
15
|
-
|
|
25
|
+
private bookState;
|
|
26
|
+
private layoutMode;
|
|
27
|
+
private lastSize;
|
|
28
|
+
private currentSpread;
|
|
29
|
+
private flipStyle;
|
|
30
|
+
private flipSpeedMs;
|
|
31
|
+
constructor(story: Story, assets: LoadedAssets, onTapActions: (actions: TapAction[], pageEl: HTMLElement) => void, flipOptions?: SpreadViewFlipOptions);
|
|
32
|
+
get currentBookState(): BookState;
|
|
33
|
+
setFlipStyle(style: FlipStyleInput): void;
|
|
34
|
+
setFlipSpeed(speedMs: number): void;
|
|
16
35
|
setLayoutMode(mode: ResolvedLayoutMode): void;
|
|
36
|
+
/** Update closed/open presentation geometry (use page flips to change content). */
|
|
37
|
+
setBookState(state: BookState): void;
|
|
17
38
|
showSpread(spread: Spread, animate?: 'none' | 'next' | 'prev'): Promise<void>;
|
|
18
39
|
getPageElement(pageId: string): HTMLElement | null;
|
|
40
|
+
/** Leaf slot elements (left / right) for editor overlays. */
|
|
41
|
+
getLeafSlots(): {
|
|
42
|
+
left: HTMLElement;
|
|
43
|
+
right: HTMLElement;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Visible content leaves for the current spread (skips blank / dimmed cover mate).
|
|
47
|
+
* Used by the editor to mount Fabric canvases.
|
|
48
|
+
*/
|
|
49
|
+
getEditableLeaves(mode: ResolvedLayoutMode, spread: Spread): Array<{
|
|
50
|
+
side: 'left' | 'right';
|
|
51
|
+
pageIndex: number;
|
|
52
|
+
slot: HTMLElement;
|
|
53
|
+
}>;
|
|
54
|
+
/** Hide or show PageView DOM inside leaf slots (editor overlays sit on top). */
|
|
55
|
+
setPageViewsHidden(hidden: boolean): void;
|
|
56
|
+
/** Remount the current spread from story data (after in-place story mutations). */
|
|
57
|
+
remountCurrent(): void;
|
|
58
|
+
/** Keep SpreadView's story reference in sync when the host mutates covers/pages. */
|
|
59
|
+
setStory(story: Story): void;
|
|
19
60
|
getVisiblePageElements(mode: ResolvedLayoutMode, spread: Spread): HTMLElement[];
|
|
20
61
|
updateStageSize(containerWidth: number, containerHeight: number, mode: ResolvedLayoutMode, spread?: {
|
|
21
62
|
left: {
|
|
@@ -26,6 +67,11 @@ export declare class SpreadView {
|
|
|
26
67
|
};
|
|
27
68
|
}): void;
|
|
28
69
|
destroy(): void;
|
|
70
|
+
private applyStageTransform;
|
|
71
|
+
private sizeHardbackBoards;
|
|
72
|
+
private syncHardbackBoards;
|
|
73
|
+
private mountHardbackBoard;
|
|
74
|
+
private clearHardbackBoards;
|
|
29
75
|
private mountSpread;
|
|
30
76
|
private createLeaf;
|
|
31
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpreadView.d.ts","sourceRoot":"","sources":["../../src/render/SpreadView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"SpreadView.d.ts","sourceRoot":"","sources":["../../src/render/SpreadView.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAc,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE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IAoBnB,OAAO,CAAC,UAAU;CAOnB"}
|
package/dist/schema/story.d.ts
CHANGED
|
@@ -812,14 +812,32 @@ export declare const storySchema: z.ZodObject<{
|
|
|
812
812
|
width: number;
|
|
813
813
|
height: number;
|
|
814
814
|
}>;
|
|
815
|
+
/**
|
|
816
|
+
* First page is a front cover: starts closed (centered); page-flips open to
|
|
817
|
+
* interior content (cover omitted from open spreads).
|
|
818
|
+
*/
|
|
819
|
+
frontCover: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
820
|
+
/**
|
|
821
|
+
* Last page is a back cover: omitted from open spreads; page-flips closed
|
|
822
|
+
* to a centered back cover after the final interior spread.
|
|
823
|
+
*/
|
|
824
|
+
backCover: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
825
|
+
/**
|
|
826
|
+
* Front/back cover boards are larger than interior pages. When open, the
|
|
827
|
+
* cover stays behind the spread so a rim of cover remains visible.
|
|
828
|
+
* Only applies when `frontCover` and/or `backCover` is set.
|
|
829
|
+
*/
|
|
830
|
+
hardback: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
815
831
|
layout: z.ZodDefault<z.ZodObject<{
|
|
816
|
-
|
|
832
|
+
/** `single` = one-page; `two-page`; `responsive` = orientation; `auto` = width breakpoint */
|
|
833
|
+
mode: z.ZodDefault<z.ZodEnum<["single", "two-page", "responsive", "auto"]>>;
|
|
834
|
+
/** Used when `mode` is `auto` (width ≥ breakpoint → two-page). */
|
|
817
835
|
singleBreakpoint: z.ZodDefault<z.ZodNumber>;
|
|
818
836
|
}, "strip", z.ZodTypeAny, {
|
|
819
|
-
mode: "single" | "two-page" | "auto";
|
|
837
|
+
mode: "single" | "two-page" | "responsive" | "auto";
|
|
820
838
|
singleBreakpoint: number;
|
|
821
839
|
}, {
|
|
822
|
-
mode?: "single" | "two-page" | "auto" | undefined;
|
|
840
|
+
mode?: "single" | "two-page" | "responsive" | "auto" | undefined;
|
|
823
841
|
singleBreakpoint?: number | undefined;
|
|
824
842
|
}>>;
|
|
825
843
|
fonts: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1322,13 +1340,16 @@ export declare const storySchema: z.ZodObject<{
|
|
|
1322
1340
|
}, "strip", z.ZodTypeAny, {
|
|
1323
1341
|
id: string;
|
|
1324
1342
|
layout: {
|
|
1325
|
-
mode: "single" | "two-page" | "auto";
|
|
1343
|
+
mode: "single" | "two-page" | "responsive" | "auto";
|
|
1326
1344
|
singleBreakpoint: number;
|
|
1327
1345
|
};
|
|
1328
1346
|
pageSize: {
|
|
1329
1347
|
width: number;
|
|
1330
1348
|
height: number;
|
|
1331
1349
|
};
|
|
1350
|
+
frontCover: boolean;
|
|
1351
|
+
backCover: boolean;
|
|
1352
|
+
hardback: boolean;
|
|
1332
1353
|
fonts: {
|
|
1333
1354
|
src: string;
|
|
1334
1355
|
family: string;
|
|
@@ -1503,10 +1524,13 @@ export declare const storySchema: z.ZodObject<{
|
|
|
1503
1524
|
})[] | undefined;
|
|
1504
1525
|
}[];
|
|
1505
1526
|
layout?: {
|
|
1506
|
-
mode?: "single" | "two-page" | "auto" | undefined;
|
|
1527
|
+
mode?: "single" | "two-page" | "responsive" | "auto" | undefined;
|
|
1507
1528
|
singleBreakpoint?: number | undefined;
|
|
1508
1529
|
} | undefined;
|
|
1509
1530
|
title?: string | undefined;
|
|
1531
|
+
frontCover?: boolean | undefined;
|
|
1532
|
+
backCover?: boolean | undefined;
|
|
1533
|
+
hardback?: boolean | undefined;
|
|
1510
1534
|
fonts?: {
|
|
1511
1535
|
src: string;
|
|
1512
1536
|
family: string;
|
|
@@ -1534,7 +1558,7 @@ export type StoryBlock = z.infer<typeof blockSchema>;
|
|
|
1534
1558
|
export type StoryAsset = z.infer<typeof assetSchema>;
|
|
1535
1559
|
export type Cue = z.infer<typeof cueSchema>;
|
|
1536
1560
|
export type LayoutBox = z.infer<typeof layoutBoxSchema>;
|
|
1537
|
-
export type LayoutMode = 'single' | 'two-page' | 'auto';
|
|
1561
|
+
export type LayoutMode = 'single' | 'two-page' | 'responsive' | 'auto';
|
|
1538
1562
|
export type ResolvedLayoutMode = 'single' | 'two-page';
|
|
1539
1563
|
export type TapAction = z.infer<typeof tapActionSchema>;
|
|
1540
1564
|
export type AudioChannel = 'vo' | 'sfx' | 'music';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../src/schema/story.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB,wCAAoC,CAAC;AAEnE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;EAQ1B,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;EAKpB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkBtB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQ1B,CAAC;AAmCH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAItB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBtE,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAChD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACnD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACrD,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAC5C,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,UAAU,CAAC;AACvD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC;AAElD,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,KAAK,CAE/C"}
|
package/package.json
CHANGED
|
@@ -1,74 +1,75 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@makefully/fancifully",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "DOM-based interactive storybook engine with SpringRoll audio and VO↔text sync.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/fancifully.js",
|
|
7
|
-
"module": "./dist/fancifully.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/fancifully.js",
|
|
13
|
-
"default": "./dist/fancifully.js"
|
|
14
|
-
},
|
|
15
|
-
"./fancifully.css": "./dist/fancifully.css",
|
|
16
|
-
"./iife": "./dist/fancifully.iife.js",
|
|
17
|
-
"./package.json": "./package.json"
|
|
18
|
-
},
|
|
19
|
-
"files": [
|
|
20
|
-
"dist",
|
|
21
|
-
"README.md",
|
|
22
|
-
"CHANGELOG.md",
|
|
23
|
-
"LICENSE"
|
|
24
|
-
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"dev": "vite --config vite.demo.config.ts",
|
|
27
|
-
"build": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
28
|
-
"test": "tsx --test tests/*.test.ts",
|
|
29
|
-
"pack:fanci": "node scripts/pack-fanci.mjs
|
|
30
|
-
"pack:check": "npm pack --dry-run",
|
|
31
|
-
"prepack": "npm run build",
|
|
32
|
-
"prepublishOnly": "npm test && npm run build"
|
|
33
|
-
},
|
|
34
|
-
"publishConfig": {
|
|
35
|
-
"access": "public"
|
|
36
|
-
},
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/Makefully-Studios/fancifully.git"
|
|
40
|
-
},
|
|
41
|
-
"bugs": {
|
|
42
|
-
"url": "https://github.com/Makefully-Studios/fancifully/issues"
|
|
43
|
-
},
|
|
44
|
-
"homepage": "https://github.com/Makefully-Studios/fancifully#readme",
|
|
45
|
-
"keywords": [
|
|
46
|
-
"fancifully",
|
|
47
|
-
"storybook",
|
|
48
|
-
"interactive",
|
|
49
|
-
"read-aloud",
|
|
50
|
-
"epub",
|
|
51
|
-
"springroll",
|
|
52
|
-
"makefully"
|
|
53
|
-
],
|
|
54
|
-
"author": "Makefully Studios",
|
|
55
|
-
"license": "MIT",
|
|
56
|
-
"dependencies": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@makefully/fancifully",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "DOM-based interactive storybook engine with SpringRoll audio and VO↔text sync.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/fancifully.js",
|
|
7
|
+
"module": "./dist/fancifully.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/fancifully.js",
|
|
13
|
+
"default": "./dist/fancifully.js"
|
|
14
|
+
},
|
|
15
|
+
"./fancifully.css": "./dist/fancifully.css",
|
|
16
|
+
"./iife": "./dist/fancifully.iife.js",
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md",
|
|
22
|
+
"CHANGELOG.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"dev": "vite --config vite.demo.config.ts",
|
|
27
|
+
"build": "vite build --config vite.lib.config.ts && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
28
|
+
"test": "tsx --test tests/*.test.ts",
|
|
29
|
+
"pack:fanci": "node scripts/pack-fanci.mjs",
|
|
30
|
+
"pack:check": "npm pack --dry-run",
|
|
31
|
+
"prepack": "npm run build",
|
|
32
|
+
"prepublishOnly": "npm test && npm run build"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/Makefully-Studios/fancifully.git"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/Makefully-Studios/fancifully/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/Makefully-Studios/fancifully#readme",
|
|
45
|
+
"keywords": [
|
|
46
|
+
"fancifully",
|
|
47
|
+
"storybook",
|
|
48
|
+
"interactive",
|
|
49
|
+
"read-aloud",
|
|
50
|
+
"epub",
|
|
51
|
+
"springroll",
|
|
52
|
+
"makefully"
|
|
53
|
+
],
|
|
54
|
+
"author": "Makefully Studios",
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"fabric": "^6.6.5",
|
|
58
|
+
"fflate": "^0.8.3",
|
|
59
|
+
"zod": "^3.24.2"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"springroll": "^2.6.0"
|
|
63
|
+
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"springroll": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"springroll": "^2.6.0",
|
|
71
|
+
"tsx": "^4.19.3",
|
|
72
|
+
"typescript": "^5.8.2",
|
|
73
|
+
"vite": "^6.0.7"
|
|
74
|
+
}
|
|
75
|
+
}
|