@curiouslearning/gdl-player-core 1.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/README.md +80 -0
- package/dist/Image-BUpmrK8U.cjs +1 -0
- package/dist/Image-Bwx-qXJQ.js +10 -0
- package/dist/components/Animate.d.ts +11 -0
- package/dist/components/Background.d.ts +6 -0
- package/dist/components/Image.d.ts +4 -0
- package/dist/components/LazySvg.d.ts +9 -0
- package/dist/components/MediaItemWrapper.d.ts +13 -0
- package/dist/components/Page.d.ts +7 -0
- package/dist/components/PageTextSegments.d.ts +19 -0
- package/dist/components/Player.d.ts +8 -0
- package/dist/components/SwipeNav.d.ts +7 -0
- package/dist/components/dolottie.d.ts +13 -0
- package/dist/components/effectlib/bounce.d.ts +3 -0
- package/dist/components/effectlib/highlight.d.ts +3 -0
- package/dist/components/effectlib/jump.d.ts +3 -0
- package/dist/components/effectlib/move.d.ts +18 -0
- package/dist/components/effectlib/noeffect.d.ts +3 -0
- package/dist/components/effectlib/shake.d.ts +3 -0
- package/dist/context/BookProvider.d.ts +12 -0
- package/dist/dolottie-D6pmgIXi.js +71330 -0
- package/dist/dolottie-_lFr9NOP.cjs +5 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6174 -0
- package/dist/lib/fonts.d.ts +17 -0
- package/dist/lib/utils.d.ts +9 -0
- package/dist/types/analytics.d.ts +10 -0
- package/dist/types/animation.d.ts +23 -0
- package/dist/types/audio.d.ts +20 -0
- package/dist/types/book.d.ts +82 -0
- package/dist/types/context.d.ts +8 -0
- package/dist/types/font.d.ts +8 -0
- package/dist/types/media.d.ts +42 -0
- package/dist/utils-DTI6gl3r.cjs +18 -0
- package/dist/utils-Dm7P4Nnv.js +1116 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @curiouslearning/gdl-player-core
|
|
2
|
+
|
|
3
|
+
Shared core player package for GDL interactive books.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This package contains shared player code used by:
|
|
8
|
+
|
|
9
|
+
- interactive-book-builder
|
|
10
|
+
- GDLbook
|
|
11
|
+
|
|
12
|
+
Both apps should import from this package instead of duplicating local player components.
|
|
13
|
+
|
|
14
|
+
## Tooling
|
|
15
|
+
|
|
16
|
+
- Package manager: npm
|
|
17
|
+
- Build: Vite library mode
|
|
18
|
+
- Type declarations: TypeScript `tsc` during the build step
|
|
19
|
+
- Registry: npmjs
|
|
20
|
+
- Versioning: semantic-release on `main` using Conventional Commits
|
|
21
|
+
|
|
22
|
+
## Development
|
|
23
|
+
|
|
24
|
+
Install dependencies:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Build package output:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm run build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Build artifacts are emitted to `dist/`:
|
|
37
|
+
|
|
38
|
+
- `dist/index.js` (ESM)
|
|
39
|
+
- `dist/index.cjs` (CommonJS)
|
|
40
|
+
- `dist/index.d.ts` (types)
|
|
41
|
+
|
|
42
|
+
## Publishing (npmjs)
|
|
43
|
+
|
|
44
|
+
Publishing is automated in CircleCI when changes land on `main` and validation jobs pass.
|
|
45
|
+
|
|
46
|
+
Requirements:
|
|
47
|
+
|
|
48
|
+
1. `NPM_TOKEN` available in CI with publish permissions for `@curiouslearning`.
|
|
49
|
+
2. Conventional Commit messages so semantic-release can calculate versions.
|
|
50
|
+
|
|
51
|
+
Common commit examples:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git commit -m "fix: handle undefined page media"
|
|
55
|
+
git commit -m "feat: add swipe threshold option"
|
|
56
|
+
git commit -m "feat!: remove deprecated player prop"
|
|
57
|
+
git commit -m "feat: replace page media schema" -m "BREAKING CHANGE: page.media now requires mimeType"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Release impact:
|
|
61
|
+
|
|
62
|
+
- `fix` -> patch release
|
|
63
|
+
- `feat` -> minor release
|
|
64
|
+
- `feat!` or `BREAKING CHANGE:` footer -> major release
|
|
65
|
+
|
|
66
|
+
For local validation before merge:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm run ci:verify
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Consuming in other repos
|
|
73
|
+
|
|
74
|
+
Install:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm install @curiouslearning/gdl-player-core
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Then replace local component imports with package imports.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./utils-DTI6gl3r.cjs");var t=e.o(),n=({mediaItem:n})=>(0,t.jsx)(`img`,{src:e.n(e.a(),n),alt:``,loading:`lazy`,className:`max-w-full max-h-full w-full h-full -z-10`});exports.Image=n,exports.default=n;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { a as e, n as t, o as n } from "./utils-Dm7P4Nnv.js";
|
|
2
|
+
//#region src/components/Image.tsx
|
|
3
|
+
var r = n(), i = ({ mediaItem: n }) => /* @__PURE__ */ (0, r.jsx)("img", {
|
|
4
|
+
src: t(e(), n),
|
|
5
|
+
alt: "",
|
|
6
|
+
loading: "lazy",
|
|
7
|
+
className: "max-w-full max-h-full w-full h-full -z-10"
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { i as Image, i as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnimationProps } from '../types/animation';
|
|
3
|
+
export declare const Animation: {
|
|
4
|
+
({ item, screenScale, onMediaClick, ref, }: AnimationProps): React.JSX.Element | null;
|
|
5
|
+
displayName: string;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: React.MemoExoticComponent<{
|
|
8
|
+
({ item, screenScale, onMediaClick, ref, }: AnimationProps): React.JSX.Element | null;
|
|
9
|
+
displayName: string;
|
|
10
|
+
}>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface LazySvgProps extends ComponentProps<'svg'> {
|
|
4
|
+
path: string;
|
|
5
|
+
mediaType?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const LazySvg: React.MemoExoticComponent<({ path, mediaType, ...props }: LazySvgProps) => React.JSX.Element | null>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<React.MemoExoticComponent<({ path, mediaType, ...props }: LazySvgProps) => React.JSX.Element | null>>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { MediaType } from '../types/media';
|
|
4
|
+
export declare const MediaItemWrapper: {
|
|
5
|
+
({ item, screenScale, children, onActivate, }: {
|
|
6
|
+
item: MediaType;
|
|
7
|
+
screenScale: number;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
onActivate?: () => void;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export default MediaItemWrapper;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { WordItemType } from '../types/book';
|
|
3
|
+
import { AudioSegment, AudioSegments, PageAudio } from '../types/audio';
|
|
4
|
+
type ChildProps = {
|
|
5
|
+
segments: AudioSegments | WordItemType[];
|
|
6
|
+
pageAudio?: PageAudio | null;
|
|
7
|
+
onWordSelect?: (wordItem: AudioSegment | WordItemType) => void;
|
|
8
|
+
highlightIds?: Array<number>;
|
|
9
|
+
setIsPlaying: React.Dispatch<React.SetStateAction<boolean | null>>;
|
|
10
|
+
ref: React.Ref<PlayerRef>;
|
|
11
|
+
textDirection?: 'LTR' | 'RTL';
|
|
12
|
+
};
|
|
13
|
+
export type PlayerRef = {
|
|
14
|
+
onPlay: () => void;
|
|
15
|
+
onAbortAudio: () => void;
|
|
16
|
+
isPlaying?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const TextSegments: React.MemoExoticComponent<({ segments, pageAudio, setIsPlaying, onWordSelect, highlightIds, ref, textDirection, }: ChildProps) => React.JSX.Element>;
|
|
19
|
+
export default TextSegments;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PlayerAnalytics } from '../types/analytics';
|
|
2
|
+
import type { FontDefinition } from '../types/font';
|
|
3
|
+
export type PlayerProps = {
|
|
4
|
+
id?: string;
|
|
5
|
+
analytics?: PlayerAnalytics;
|
|
6
|
+
fonts?: FontDefinition[];
|
|
7
|
+
};
|
|
8
|
+
export declare const Player: ({ id, analytics, fonts }: PlayerProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MediaType } from '../types/media';
|
|
3
|
+
export declare const LottieFile: React.MemoExoticComponent<({ item, play, setDotLottie, }: {
|
|
4
|
+
item: MediaType;
|
|
5
|
+
play?: boolean;
|
|
6
|
+
setDotLottie: any;
|
|
7
|
+
}) => React.JSX.Element>;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<React.MemoExoticComponent<({ item, play, setDotLottie, }: {
|
|
9
|
+
item: MediaType;
|
|
10
|
+
play?: boolean;
|
|
11
|
+
setDotLottie: any;
|
|
12
|
+
}) => React.JSX.Element>>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChildRef } from '../../types/animation';
|
|
3
|
+
interface ChildProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
screenScale: number;
|
|
6
|
+
position: {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
};
|
|
10
|
+
settings: {
|
|
11
|
+
duration?: number;
|
|
12
|
+
};
|
|
13
|
+
onEffectEnd?: () => void;
|
|
14
|
+
onEffectStart?: () => void;
|
|
15
|
+
ref: React.Ref<ChildRef>;
|
|
16
|
+
}
|
|
17
|
+
export declare const Movement: ({ children, position, screenScale, settings, onEffectEnd, onEffectStart, ref, }: ChildProps) => React.JSX.Element;
|
|
18
|
+
export default Movement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BookContextType } from '../types/context';
|
|
3
|
+
import { AssetConfig } from '../lib/utils';
|
|
4
|
+
import type { PlayerAnalytics } from '../types/analytics';
|
|
5
|
+
export declare const BookProvider: ({ bookId, slug, assetConfig, analytics, children, }: {
|
|
6
|
+
bookId: string;
|
|
7
|
+
slug: string;
|
|
8
|
+
assetConfig: AssetConfig;
|
|
9
|
+
analytics?: PlayerAnalytics;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}) => React.JSX.Element;
|
|
12
|
+
export declare const useBookContext: () => BookContextType;
|