@lls/typings 24.1.30-e0c8c826

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,21 @@
1
+ import type { Filter } from '@typings/models'
2
+
3
+ type Collection = {
4
+ name?: string
5
+ year?: number
6
+ publisher?: string
7
+ }
8
+
9
+ export type Book = {
10
+ id?: number
11
+ valid?: boolean
12
+ subjects?: number[]
13
+ levels?: number[]
14
+ year?: number
15
+ textbooks?: number[]
16
+ displayTitle?: string
17
+ renderer?: string
18
+ filters?: Filter[]
19
+ chapters?: number[]
20
+ collection?: Collection
21
+ }
@@ -0,0 +1,10 @@
1
+ export type Chapter = {
2
+ id?: number
3
+ numShow?: string | number | null
4
+ releaseVersion?: number | null
5
+ oldChapter?: number | null
6
+ teaser?: boolean
7
+ valid?: boolean
8
+ book?: number | null
9
+ pages?: number[]
10
+ }
@@ -0,0 +1,6 @@
1
+ export type Department = {
2
+ id?: number
3
+ name?: string
4
+ zipcode?: string
5
+ academy?: number
6
+ }
@@ -0,0 +1,10 @@
1
+ export type Filter = {
2
+ type?: string
3
+ title?: string
4
+ match?: {
5
+ thematicName?: string[]
6
+ premium?: boolean
7
+ isOriginal?: boolean
8
+ }
9
+ displayConditions?: { isTeacher?: boolean; isPremium?: boolean }
10
+ }
@@ -0,0 +1,7 @@
1
+ export type Level = {
2
+ id?: number
3
+ name?: string
4
+ code?: string
5
+ slug?: string
6
+ order?: number
7
+ }
@@ -0,0 +1,4 @@
1
+ export type License = {
2
+ id?: number
3
+ books?: number[]
4
+ }
@@ -0,0 +1,132 @@
1
+ import type { TODO } from '@typings/utils'
2
+
3
+ export type ScreenMode = 'grid-xs' | 'grid-md'
4
+
5
+ export type SubzoneTypeCategory = 'picWord' | 'definition' | 'subZone'
6
+
7
+ export type ZoneType = {
8
+ id: string
9
+ x: number
10
+ y: number
11
+ w: number
12
+ h: number
13
+ }
14
+ export type ZoomZoneType = ZoneType & { type: Extract<SubzoneTypeCategory, 'subZone'> }
15
+ export type DefinitionsType = ZoneType & { type: Extract<SubzoneTypeCategory, 'definition'> }
16
+ export type PicWordType = ZoneType & { type: Extract<SubzoneTypeCategory, 'picWord'>; word?: string }
17
+
18
+ export type SubZoneType = ZoomZoneType | DefinitionsType | PicWordType
19
+
20
+ export type DocJson<T extends 'primary' | 'default' = 'default'> = {
21
+ id?: number
22
+ uuid?: string
23
+ contentMd?: string
24
+ } & (T extends 'primary'
25
+ ? {
26
+ src?: string
27
+ picWords?: PicWordType[]
28
+ definitions?: DefinitionsType[]
29
+ subZones?: ZoomZoneType[]
30
+ audios?: string[]
31
+ videos?: string[]
32
+ rives?: { src: string; stateMachines: string }[]
33
+ }
34
+ : {
35
+ metadata?: TODO | null
36
+ rightResponses?: TODO
37
+ isIndexable?: boolean | null
38
+ renewalAddedAt?: string
39
+ renewalUpdatedAt?: string
40
+ annotations?: TODO
41
+ premium?: boolean | null
42
+ responses?:
43
+ | {
44
+ id: string
45
+ content: string
46
+ token?: string
47
+ step?: number
48
+ start?: number
49
+ end?: number
50
+ verb?: string
51
+ files?: Record<string, unknown>
52
+ }[]
53
+ | null
54
+ })
55
+
56
+ export type PrimaryDoc = DocJson<'primary'>
57
+
58
+ export type LayoutItem =
59
+ | {
60
+ id: string
61
+ root?: true
62
+ type: 'vgrid' | 'hgrid' | 'tabs' | 'tab' | 'workplan' | 'wpcard' | 'wptask' // copied from ITEM_TYPES
63
+ content: (LayoutItem | LayoutCell)[]
64
+ w?: number
65
+ }
66
+ | LayoutCell
67
+
68
+ export type LayoutGrid = { content: LayoutItem[] }
69
+
70
+ export type LayoutCell = {
71
+ id: string
72
+ type: 'cell'
73
+ content?: undefined
74
+ w?: number
75
+ autoheight?: boolean
76
+ }
77
+
78
+ export type PrimaryLayoutItem = {
79
+ id: string
80
+ x: number
81
+ y: number
82
+ w: number
83
+ h: number
84
+ }
85
+
86
+ export type Page<T extends 'primary' | 'default' = 'default'> = {
87
+ id?: number
88
+ contentMd?: string
89
+ renewalAddedAt?: string
90
+ isWorkplan?: boolean
91
+ isOriginal?: boolean
92
+ book?: number | null
93
+ chapter?: number | null
94
+ thematicName?: string
95
+ numericOrder?: number | null
96
+ valid?: boolean
97
+ premium?: boolean | null
98
+ isPanorama?: boolean
99
+ isCreatedFromScratch?: boolean
100
+ isDraft?: boolean
101
+ page?: number | null
102
+ nbPages?: number
103
+ isExercise?: boolean
104
+ isPartOfSession?: boolean
105
+ title?: string
106
+ slug?: string
107
+ originalPage?: number | null
108
+ parent?: number | null
109
+ hasNewDesign?: boolean
110
+ oldLesson?: number | boolean | null
111
+ createdAt?: string
112
+ updatedAt?: string
113
+ sharedAt?: string
114
+ seenAt?: string
115
+ user?: number | null
116
+ shouldRender?: boolean
117
+ isCustomized?: boolean
118
+ type?: string
119
+ metadata?: TODO | null
120
+ } & (T extends 'primary'
121
+ ? {
122
+ children?: PrimaryDoc[]
123
+ layouts?: {
124
+ primary?: PrimaryLayoutItem[]
125
+ }
126
+ }
127
+ : {
128
+ children?: DocJson[]
129
+ layouts?: Partial<Record<ScreenMode, LayoutGrid>>
130
+ })
131
+
132
+ export type PrimaryPage = Page<'primary'>
@@ -0,0 +1,6 @@
1
+ export type School = {
2
+ id?: number
3
+ name?: string
4
+ city?: string
5
+ prefix?: string | null
6
+ }
@@ -0,0 +1,5 @@
1
+ export type SchoolType = {
2
+ id?: number
3
+ name?: string
4
+ order?: number
5
+ }
@@ -0,0 +1,6 @@
1
+ export type Subject = {
2
+ id?: number
3
+ name?: string | null
4
+ schoolTypes?: string[]
5
+ slug?: string
6
+ }
@@ -0,0 +1,4 @@
1
+ export type Summary = {
2
+ id?: number
3
+ elements?: Summary[]
4
+ }
@@ -0,0 +1,32 @@
1
+ export type User = {
2
+ id?: number
3
+ isAdmin?: boolean
4
+ isEditorLLS?: boolean
5
+ isPremium?: boolean
6
+ isTrial?: boolean
7
+ isStudent?: boolean
8
+ isTeacher?: boolean
9
+ isReviewer?: boolean
10
+ academicEnabled?: boolean
11
+ firstname?: string | null
12
+ lastname?: string | null
13
+ email?: string | null
14
+ username?: string | null
15
+ gender?: string | null
16
+ functions?: string[] | null
17
+ subjects?: number[] | null
18
+ schools?: number[] | null
19
+ isGarUser?: boolean
20
+ passwordUpdateRequired?: boolean
21
+ confirmed?: boolean
22
+ userPages?: number[] | null
23
+ schoolTypes?: string[]
24
+ }
25
+
26
+ export type AdminUser = User & { isAdmin: true }
27
+ export type EditorLLSUser = User & { isEditorLLS: true }
28
+ export type PremiumUser = User & { isPremium: true }
29
+ export type TrialUser = User & { isTrial: true }
30
+ export type StudentUser = User & { isStudent: true }
31
+ export type TeacherUser = User & { isTeacher: true }
32
+ export type AcademicEnabledUser = TeacherUser & { academicEnabled: true }
package/models.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export * from './internal/book'
2
+ export * from './internal/chapter'
3
+ export * from './internal/department'
4
+ export * from './internal/filter'
5
+ export * from './internal/level'
6
+ export * from './internal/license'
7
+ export * from './internal/page'
8
+ export * from './internal/school'
9
+ export * from './internal/schoolType'
10
+ export * from './internal/subject'
11
+ export * from './internal/summary'
12
+ export * from './internal/user'
@@ -0,0 +1,6 @@
1
+ import type CheerioModule from 'cheerio'
2
+
3
+ declare global {
4
+ // https://stackoverflow.com/questions/35074713/extending-typescript-global-object-in-node-js
5
+ var cheerio: typeof CheerioModule
6
+ }
@@ -0,0 +1,7 @@
1
+ declare module '*.module.css'
2
+
3
+ namespace React {
4
+ interface CSSProperties {
5
+ [key: `--${string}`]: string | number
6
+ }
7
+ }
@@ -0,0 +1,35 @@
1
+ declare module 'html-to-react' {
2
+ import type { Element as DomHandlerElement, Node as DomHandlerNode, DomElement as DomHandlerDomElement } from 'domhandler'
3
+ // TODO: Element is clearly inaccurate. It misses accessors like tagName, attributes
4
+
5
+ export type Node = DomHandlerNode
6
+ export type Element = DomHandlerElement
7
+ export type DomElement = DomHandlerDomElement
8
+ export interface ProcessingInstruction {
9
+ shouldProcessNode: (node: Node) => boolean | undefined
10
+ processNode: (node: Node, children: Element['children'], siblingKey: any) => unknown
11
+ }
12
+
13
+ class Parser {
14
+ constructor(options: { recognizeSelfClosing: boolean })
15
+
16
+ parse: (html: string) => any
17
+ parseWithInstructions: (
18
+ html: string,
19
+ isValidNode: any,
20
+ processingInstructions: ProcessingInstruction[],
21
+ preprocessingInstructions?: ProcessingInstruction[]
22
+ ) => unknown
23
+ }
24
+
25
+ class ProcessNodeDefinitions {
26
+ constructor(param: unknown)
27
+
28
+ processDefaultNode: (node: Node, children: Element['children'], index: number) => any
29
+ }
30
+
31
+ export default {
32
+ Parser,
33
+ ProcessNodeDefinitions
34
+ }
35
+ }
@@ -0,0 +1,43 @@
1
+ import type lo from 'lodash'
2
+ import type _ from 'lodash/fp'
3
+ import type { ValueOf } from '../utils.d.ts'
4
+
5
+ declare module 'lodash/fp.js' {
6
+ interface LodashMap {
7
+ convert: (a: { cap: false }) => <Iterable, TResult>(
8
+ iteratee: (value: Iterable extends Array<infer T> ? T : ValueOf<Iterable>, idx: Iterable extends any[] ? number : keyof Iterable) => TResult,
9
+ collection: Iterable
10
+ ) => TResult[]
11
+ }
12
+
13
+ interface LodashForEach {
14
+ convert: (a: { cap: false }) => <Iterable, TResult>(
15
+ iteratee: (value: Iterable extends Array<infer T> ? T : ValueOf<Iterable>, idx: Iterable extends any[] ? number : keyof Iterable) => TResult,
16
+ collection: Iterable
17
+ ) => void
18
+ }
19
+
20
+ interface LodashSome {
21
+ convert: (a: { cap: false }) => LodashSome
22
+ }
23
+
24
+ interface LodashReplace {
25
+ // biome-ignore lint/style/useShorthandFunctionType:
26
+ (pattern: RegExp | string, replacement: lo.ReplaceFunction | string, string: string | number | undefined): string
27
+ }
28
+
29
+ interface LodashStartsWith extends _.LodashStartsWith {
30
+ (target?: unknown): _.LodashStartsWith1x1
31
+ (target?: unknown, string?: unknown): boolean
32
+ }
33
+
34
+ interface LodashParseInt {
35
+ (radix: number, string: string | number | undefined): number
36
+ (radix: number): (string: string | number | undefined) => number
37
+ }
38
+
39
+ interface LodashReject {
40
+ // biome-ignore lint/style/useShorthandFunctionType:
41
+ <T>(predicate: unknown, collection: T): T
42
+ }
43
+ }
@@ -0,0 +1,37 @@
1
+ type TPianoOpts = {
2
+ user_id?: string | undefined
3
+ user_category?: string | undefined
4
+ } & Record<string, unknown>
5
+
6
+ interface Window {
7
+ opera: any | undefined
8
+ MSStream: any | undefined
9
+ coreOpenWindow?: typeof window.open
10
+ coreHref?: string
11
+ pa?: {
12
+ user?: {
13
+ setUser?: (user_id: TPianoOpts['user_id'], user_category: TPianoOpts['user_category']) => void
14
+ }
15
+ sendEvent?: (name: string, opts: TPianoOpts) => void
16
+ }
17
+ playwrightInplaceNavigate: (value: string) => void
18
+ playwrightStoryId: string
19
+ }
20
+
21
+ type requestFullscreenType = (typeof Element.prototype)['requestFullscreen']
22
+
23
+ interface Element {
24
+ mozRequestFullScreen: requestFullscreenType
25
+ webkitRequestFullscreen: requestFullscreenType
26
+ msRequestFullscreen: requestFullscreenType
27
+ }
28
+
29
+ type exitFullscreenType = (typeof Document.prototype)['exitFullscreen']
30
+ interface Document {
31
+ webkitFullscreenElement: Element | null
32
+ mozFullScreenElement: Element | null
33
+ webkitExitFullscreen: exitFullscreenType
34
+ mozExitFullscreen: exitFullscreenType
35
+ msExitFullscreen: exitFullscreenType
36
+ outerHTML: unknown
37
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@lls/typings",
3
+ "version": "24.1.30-e0c8c826",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "keywords": [],
7
+ "author": "",
8
+ "license": "ISC",
9
+ "devDependencies": {
10
+ "@types/domhandler": "2.4.5",
11
+ "@types/lodash": "4.14.202",
12
+ "@types/react": "18.2.45",
13
+ "typescript": "5.4.5"
14
+ },
15
+ "peerDependencies": {
16
+ "@biomejs/biome": "*"
17
+ },
18
+ "scripts": {
19
+ "dts": "pnpm tsc --project tsconfig.production.json",
20
+ "lint": "pnpm biome check --apply *.d.ts internal overrides",
21
+ "test": "echo \"Error: no test specified\" && exit 0"
22
+ }
23
+ }
@@ -0,0 +1,38 @@
1
+ import type { ReactSetState } from '@typings/react'
2
+
3
+ type ZoomPropsType = {
4
+ zoomStep?: number
5
+ zoom: number
6
+ resetZoom?: (resetStep: number) => void
7
+ increaseZoom?: () => void
8
+ decreaseZoom?: () => void
9
+ }
10
+ export type PresentationViewType = {
11
+ view?: 'page' | 'slide' | 'split' | undefined
12
+ uuids?: (string | undefined)[]
13
+ uuid?: string
14
+ lastOpenUuid?: string
15
+ }
16
+ export type PresentationPropsType = {
17
+ isPresentationMode?: boolean
18
+ isPaginationEnabled?: boolean
19
+ presentationView?: PresentationViewType
20
+ preSlideDocUuid?: string
21
+ viewerZoomProps?: ZoomPropsType
22
+ leftDocZoomProps?: ZoomPropsType
23
+ rightDocZoomProps?: ZoomPropsType
24
+ isLaserCursor?: boolean
25
+ setIsLaserCursor?: ReactSetState<boolean>
26
+ openProjectorView?: () => void
27
+ extendSplitView?: (view: -1 | 0 | 1) => void
28
+ closeFullscreenCard?: (docUuid: string) => void
29
+ closeProjectorView?: () => void
30
+ closeSplitView?: () => void
31
+ openFullscreenCard?: (docUuid: string, forceSplit: boolean) => void
32
+ slideToPreviousDocument?: (currentDocUuid: string, tabId: string) => void
33
+ getChildPosition?: (docUuid?: string, tabId?: string) => number
34
+ slideToNextDocument?: (currentDocUuid: string, tabId: string) => void
35
+ initZoomModal?: (docUuid?: string) => void
36
+ deleteZoomModal?: (docUuid?: string) => void
37
+ getNbDocs?: (tabId: string) => number
38
+ }
package/project.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "@typings",
3
+ "targets": {
4
+ "build": {
5
+ "dependsOn": [],
6
+ "executor": "nx:noop"
7
+ }
8
+ }
9
+ }
package/react.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ export type ReactChildren = React.ReactNode | undefined
2
+
3
+ export type AnyComponent = (...args: any[]) => JSX.Element
4
+
5
+ export type ReactSetState<T> = React.Dispatch<React.SetStateAction<T>>
6
+
7
+ export type DataAttributesType = {
8
+ [key in `data-${string}`]: unknown
9
+ }
10
+
11
+ type ArialAttributesType = {
12
+ [key in `aria-${string}`]: unknown
13
+ }
14
+
15
+ export type CommonPropsType = {
16
+ children?: ReactChildren
17
+ dangerouslySetInnerHTML?:
18
+ | {
19
+ __html: string
20
+ }
21
+ | undefined
22
+ className?: string | undefined
23
+ contentEditable?: boolean | 'inherit' | undefined
24
+ id?: string | undefined
25
+ placeholder?: string | undefined
26
+ style?: React.CSSProperties | undefined
27
+ tabIndex?: number | undefined
28
+ title?: string | undefined
29
+ role?: React.AriaRole | undefined
30
+ }
31
+
32
+ export type AllowedPropsType = DataAttributesType & ArialAttributesType & CommonPropsType
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.production.json",
3
+ "compilerOptions": {
4
+ "declaration": false,
5
+ "noEmit": true,
6
+ "emitDeclarationOnly": false
7
+ }
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": [],
5
+ "outDir": "builttypes"
6
+ }
7
+ }
package/utils.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export type TODO = any
2
+
3
+ export type AnyFunction = (...args: any[]) => void
4
+
5
+ export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> &
6
+ {
7
+ [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>
8
+ }[Keys]
9
+
10
+ export type ValueOf<T> = T[keyof T]
11
+
12
+ export type ArrayElement<T> = T extends readonly (infer I)[] ? I : never