@lls/vivi 24.37.0-dde481fe → 24.37.0-e4928d15

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.
Files changed (79) hide show
  1. package/lib/assets/vivi.css +222 -222
  2. package/lib/builttypes/vivi/src/components/Alert.d.ts +4 -0
  3. package/lib/builttypes/vivi/src/components/Audio.d.ts +5 -0
  4. package/lib/builttypes/vivi/src/components/HighlightedArea.d.ts +8 -0
  5. package/lib/builttypes/vivi/src/components/Rive.d.ts +11 -0
  6. package/lib/builttypes/vivi/src/components/Video.d.ts +5 -0
  7. package/lib/builttypes/vivi/src/components/ViewImage.d.ts +9 -0
  8. package/lib/builttypes/vivi/src/components/core/Document.d.ts +10 -0
  9. package/lib/builttypes/vivi/src/components/core/DocumentHtml.d.ts +11 -0
  10. package/lib/builttypes/vivi/src/components/core/DocumentToolbar.d.ts +10 -0
  11. package/lib/builttypes/vivi/src/components/core/ErrorBoundary.d.ts +24 -0
  12. package/lib/builttypes/vivi/src/components/core/editor/CodemirrorEditor.d.ts +3 -0
  13. package/lib/builttypes/vivi/src/components/core/editor/EditViewerMd.d.ts +20 -0
  14. package/lib/builttypes/vivi/src/components/core/editor/Editor.d.ts +14 -0
  15. package/lib/builttypes/vivi/src/components/core/editor/EditorHeaderModal.d.ts +4 -0
  16. package/lib/builttypes/vivi/src/components/core/editor/EditorListModal.d.ts +4 -0
  17. package/lib/builttypes/vivi/src/components/core/editor/EditorMathsModal.d.ts +4 -0
  18. package/lib/builttypes/vivi/src/components/core/editor/EditorOrderedListModal.d.ts +4 -0
  19. package/lib/builttypes/vivi/src/components/core/editor/EditorQuestionModal.d.ts +4 -0
  20. package/lib/builttypes/vivi/src/components/core/editor/EditorSsr.d.ts +2 -0
  21. package/lib/builttypes/vivi/src/components/core/editor/EditorStampModal.d.ts +4 -0
  22. package/lib/builttypes/vivi/src/components/core/editor/EditorTableModal.d.ts +4 -0
  23. package/lib/builttypes/vivi/src/components/core/editor/EditorTitleModal.d.ts +4 -0
  24. package/lib/builttypes/vivi/src/components/core/editor/EditorToolbar.d.ts +4 -0
  25. package/lib/builttypes/vivi/src/components/core/editor/EditorView.d.ts +19 -0
  26. package/lib/builttypes/vivi/src/components/core/editor/MetadataEditor.d.ts +13 -0
  27. package/lib/builttypes/vivi/src/components/core/viewer/ViewerMd.d.ts +37 -0
  28. package/lib/builttypes/vivi/src/components/lazy/CodemirrorEditor.browser.d.ts +12 -0
  29. package/lib/builttypes/vivi/src/components/lazy/index.editor.d.ts +16 -0
  30. package/lib/builttypes/vivi/src/components/primarygrid/AudioWord.d.ts +8 -0
  31. package/lib/builttypes/vivi/src/components/primarygrid/Correction.d.ts +9 -0
  32. package/lib/builttypes/vivi/src/components/primarygrid/DefinitionWord.d.ts +10 -0
  33. package/lib/builttypes/vivi/src/components/primarygrid/EditGrid.d.ts +6 -0
  34. package/lib/builttypes/vivi/src/components/primarygrid/EditZoneModal.d.ts +19 -0
  35. package/lib/builttypes/vivi/src/components/primarygrid/FullscreenDocument.d.ts +8 -0
  36. package/lib/builttypes/vivi/src/components/primarygrid/Grid.d.ts +6 -0
  37. package/lib/builttypes/vivi/src/components/primarygrid/PicWord.d.ts +10 -0
  38. package/lib/builttypes/vivi/src/components/primarygrid/SubZone.d.ts +10 -0
  39. package/lib/builttypes/vivi/src/components/primarygrid/ViewGrid.d.ts +6 -0
  40. package/lib/builttypes/vivi/src/components/primarygrid/ZoneCoordinates.d.ts +8 -0
  41. package/lib/builttypes/vivi/src/components/primarygrid/ZoneMaker.d.ts +16 -0
  42. package/lib/builttypes/vivi/src/components/primarygrid/ZoomedPicture.d.ts +12 -0
  43. package/lib/builttypes/vivi/src/components/primarygrid/sortable/SortableGrid.d.ts +10 -0
  44. package/lib/builttypes/vivi/src/components/primarygrid/sortable/SortableItem.d.ts +7 -0
  45. package/lib/builttypes/vivi/src/config/development.d.ts +6 -0
  46. package/lib/builttypes/vivi/src/config/index.d.ts +6 -0
  47. package/lib/builttypes/vivi/src/config/preproduction.d.ts +6 -0
  48. package/lib/builttypes/vivi/src/config/production.d.ts +6 -0
  49. package/lib/builttypes/vivi/src/config/test.d.ts +6 -0
  50. package/lib/builttypes/vivi/src/constants/config.d.ts +1 -0
  51. package/lib/builttypes/vivi/src/constants/grid.d.ts +3 -0
  52. package/lib/builttypes/vivi/src/constants/index.d.ts +5 -0
  53. package/lib/builttypes/vivi/src/constants/template.d.ts +4 -0
  54. package/lib/builttypes/vivi/src/constants/zoneElements.d.ts +8 -0
  55. package/lib/builttypes/vivi/src/constants/zoneMaker.d.ts +35 -0
  56. package/lib/builttypes/vivi/src/hooks/useClientMounted.d.ts +2 -0
  57. package/lib/builttypes/vivi/src/hooks/useDragAndResize.d.ts +21 -0
  58. package/lib/builttypes/vivi/src/hooks/useEditor.d.ts +13 -0
  59. package/lib/builttypes/vivi/src/hooks/usePictureSource.d.ts +13 -0
  60. package/lib/builttypes/vivi/src/hooks/useScroll.d.ts +7 -0
  61. package/lib/builttypes/vivi/src/index.d.ts +2 -0
  62. package/lib/builttypes/vivi/src/index.editor.d.ts +3 -0
  63. package/lib/builttypes/vivi/src/index.viewer.d.ts +4 -0
  64. package/lib/builttypes/vivi/src/store/documentPropsSlice.d.ts +16 -0
  65. package/lib/builttypes/vivi/src/store/index.d.ts +15 -0
  66. package/lib/builttypes/vivi/src/store/mdRendererPropsSlice.d.ts +48 -0
  67. package/lib/builttypes/vivi/src/utils/css-bare.d.mts +2 -0
  68. package/lib/builttypes/vivi/src/utils/dom.d.ts +6 -0
  69. package/lib/builttypes/vivi/src/utils/layoutTemplate.d.ts +2 -0
  70. package/lib/builttypes/vivi/src/utils/lazy.d.ts +9 -0
  71. package/lib/builttypes/vivi/src/utils/memo.d.ts +14 -0
  72. package/lib/builttypes/vivi/src/utils/mode.d.ts +3 -0
  73. package/lib/builttypes/vivi/src/utils/string.d.ts +5 -0
  74. package/lib/builttypes/vivi/src/utils/table.d.ts +4 -0
  75. package/lib/builttypes/vivi/src/utils/template.d.ts +61 -0
  76. package/lib/builttypes/vivi/src/utils/url.d.ts +1 -0
  77. package/lib/builttypes/vivi/src/utils/zoneMaker.d.ts +45 -0
  78. package/lib/index.js +237 -237
  79. package/package.json +6 -6
@@ -0,0 +1,13 @@
1
+ import type { PrimaryPage } from '@lls/store';
2
+ declare const useEditor: ({ id }: {
3
+ id: PrimaryPage["id"] | undefined;
4
+ }) => {
5
+ positions: {
6
+ x: number;
7
+ y: number;
8
+ };
9
+ path: string | undefined;
10
+ open: (editPath: string, e?: React.MouseEvent | React.TouchEvent) => void;
11
+ close: () => void;
12
+ };
13
+ export default useEditor;
@@ -0,0 +1,13 @@
1
+ import type { PrimaryPage } from '@lls/store';
2
+ import type { ReactSetState } from '@lls/typings/react';
3
+ import type { Mode } from '#vivi/types/common';
4
+ type usePictureSourceProps = {
5
+ template: PrimaryPage | undefined;
6
+ mode?: Mode;
7
+ };
8
+ declare const usePictureSource: ({ template }: usePictureSourceProps) => {
9
+ pictureSource: string | undefined;
10
+ pictureRatio: number;
11
+ setPictureRatio: ReactSetState<number>;
12
+ };
13
+ export default usePictureSource;
@@ -0,0 +1,7 @@
1
+ type UseScrollType = {
2
+ scrollOffset?: number;
3
+ };
4
+ declare const useScroll: ({ scrollOffset }?: UseScrollType) => {
5
+ scrollTo: (nameOrUuid: string) => void;
6
+ };
7
+ export default useScroll;
@@ -0,0 +1,2 @@
1
+ export { default as Editor } from './index.editor';
2
+ export { default as Viewer } from './index.viewer';
@@ -0,0 +1,3 @@
1
+ import type { EditorNextProps } from '#vivi/components/lazy/index.editor';
2
+ declare const ViewerEditor: (props: EditorNextProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default ViewerEditor;
@@ -0,0 +1,4 @@
1
+ import ViewerMd from '#vivi/components/core/viewer/ViewerMd';
2
+ type ViewerProps = Omit<Parameters<typeof ViewerMd>[0], 'pictureSource' | 'pictureRatio' | 'setPictureRatio' | 'showZonesCoordinates' | 'onChange' | 'addDocument' | 'updateLayouts' | 'updateChildren' | 'deleteDocument' | 'openEditor' | 'openMetadataEditor'>;
3
+ declare const Viewer: (props: ViewerProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default Viewer;
@@ -0,0 +1,16 @@
1
+ import type { PrimaryDoc, PrimaryPage } from '@lls/store';
2
+ import type { TODO } from '@lls/typings/utils';
3
+ import { type SpecificPropsType } from '#vivi/utils/memo';
4
+ export type DocumentPropsSliceType = {
5
+ data: {
6
+ [x: string]: SpecificPropsType;
7
+ };
8
+ read: <T extends keyof SpecificPropsType>(iState: DocumentPropsSliceType, docJson: PrimaryDoc, pickProps: Array<T>) => Pick<SpecificPropsType, T>;
9
+ reduce: (state: DocumentPropsSliceType, input?: {
10
+ template?: PrimaryPage;
11
+ mdRendererProps?: TODO;
12
+ toBecomeSpecificProps?: TODO;
13
+ }) => DocumentPropsSliceType;
14
+ };
15
+ declare const documentPropsSlice: DocumentPropsSliceType;
16
+ export default documentPropsSlice;
@@ -0,0 +1,15 @@
1
+ import type { PrimaryDoc } from '@lls/store';
2
+ import { type DocumentPropsSliceType } from './documentPropsSlice';
3
+ import { type MdRendererPropsSliceType } from './mdRendererPropsSlice';
4
+ interface Store {
5
+ mdRendererProps: MdRendererPropsSliceType;
6
+ documentProps: DocumentPropsSliceType;
7
+ update: ({ mdRendererProps, documentProps }: {
8
+ mdRendererProps: Parameters<MdRendererPropsSliceType['reduce']>[1];
9
+ documentProps: Parameters<DocumentPropsSliceType['reduce']>[1];
10
+ }) => void;
11
+ }
12
+ export declare const useWriteStore: ({ mdRendererProps, documentProps }: Parameters<Store["update"]>[0]) => void;
13
+ export declare const useReadDocumentProps: (docJson: PrimaryDoc, props: Parameters<DocumentPropsSliceType["read"]>[2]) => Pick<import("#vivi/utils/memo").SpecificPropsType, keyof import("#vivi/utils/memo").SpecificPropsType>;
14
+ export declare const useReadMdRendererProps: (pickProps: Parameters<MdRendererPropsSliceType["read"]>[1]) => Pick<import("./mdRendererPropsSlice").MdRendererDataType, keyof import("./mdRendererPropsSlice").MdRendererDataType>;
15
+ export {};
@@ -0,0 +1,48 @@
1
+ import type { Book, PrimaryDoc, PrimaryPage, Word } from '@lls/store';
2
+ import type { ReactSetState } from '@lls/typings/react';
3
+ import type { Mode, UiState } from '#vivi/types/common';
4
+ export type MdRendererDataType = {
5
+ isOffline?: boolean;
6
+ isTouchable?: boolean;
7
+ zoneVisibilityCounter?: number;
8
+ uiState?: UiState;
9
+ wasSsrRendered?: boolean;
10
+ showZonesCoordinates?: boolean;
11
+ words?: Word[];
12
+ onDocChange: (nextDocJson: PrimaryDoc) => void;
13
+ layouts?: PrimaryPage['layouts'];
14
+ template?: PrimaryPage;
15
+ mode: Mode;
16
+ pageId?: PrimaryPage['id'];
17
+ numPage: PrimaryPage['page'];
18
+ nbPages: PrimaryPage['nbPages'];
19
+ bookDisplayTitle: Book['displayTitle'];
20
+ fullscreenDocUuid: string | null;
21
+ addDocument: (coord: {
22
+ x: number;
23
+ y: number;
24
+ w: number;
25
+ h: number;
26
+ }) => void;
27
+ addClipboardDocuments: () => void;
28
+ updateLayouts: (layouts: PrimaryPage['layouts']) => void;
29
+ updateChildren: (children: PrimaryPage['children']) => void;
30
+ onChange: ReactSetState<PrimaryPage>;
31
+ deleteDocument: (uuid: string) => void;
32
+ setFullscreenDocUuid: (uuid: string | null) => void;
33
+ setUiState: ReactSetState<UiState>;
34
+ setPictureRatio: ReactSetState<number>;
35
+ pictureSource: string | undefined;
36
+ pictureRatio: number;
37
+ };
38
+ export type MdRendererPropsSliceType = {
39
+ data: MdRendererDataType;
40
+ read: <T extends keyof MdRendererDataType>(iState: MdRendererPropsSliceType, pickProps: Array<T>) => Pick<MdRendererDataType, T>;
41
+ reduce: (state: MdRendererPropsSliceType, input: MdRendererDataType) => MdRendererPropsSliceType;
42
+ };
43
+ declare const _default: {
44
+ data: MdRendererDataType;
45
+ reduce: (state: MdRendererPropsSliceType, input: MdRendererDataType) => MdRendererPropsSliceType;
46
+ read: <T extends keyof MdRendererDataType>(iState: MdRendererPropsSliceType, pickProps: Array<T>) => Pick<MdRendererDataType, T>;
47
+ };
48
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export const themeIsDarkMode: "div:where(.vivi-dark)&, div:where(.vivi-dark) &";
2
+ export const themeIsNotDarkMode: "div:where(.vivi-light)&, div:where(.vivi-light) &";
@@ -0,0 +1,6 @@
1
+ export declare const decodeHtmlEntities: (html: string) => string;
2
+ export declare const isValidTagName: (name: string) => boolean;
3
+ export declare const isValidNode: ({ type, name }: {
4
+ type: string;
5
+ name: string;
6
+ }) => boolean;
@@ -0,0 +1,2 @@
1
+ import type { PrimaryDoc, PrimaryPage } from '@lls/store';
2
+ export declare const evalTemplate: (template: PrimaryPage, fn: <T extends PrimaryDoc | PrimaryPage>(value: T) => Partial<PrimaryPage & PrimaryDoc>) => PrimaryPage;
@@ -0,0 +1,9 @@
1
+ type DefaultType<T> = T extends {
2
+ default: infer U;
3
+ } ? U : never;
4
+ export declare const lazyInterop: <T extends {
5
+ default: any;
6
+ }>(m: T) => {
7
+ default: DefaultType<T>;
8
+ };
9
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { PrimaryDoc, PrimaryPage } from '@lls/store';
2
+ import type { TODO } from '@lls/typings/utils';
3
+ export declare const shallowExcept: <SliceDataType extends {}>(deepEqualProperties: [keyof SliceDataType]) => (old: SliceDataType, next: SliceDataType) => boolean;
4
+ export type SpecificPropsType = {
5
+ docTitle: string | undefined;
6
+ path: [] | Array<string>;
7
+ };
8
+ export declare const makeGetSpecificProps: ({ docJson: rootDocJson, toBecomeSpecificProps: { keepMountedUuids } }: {
9
+ [x: string]: any;
10
+ docJson: PrimaryPage;
11
+ }) => (docJson: PrimaryDoc) => SpecificPropsType;
12
+ export declare const shouldReturnCurrent: (old: TODO, next: TODO) => boolean;
13
+ export declare const areDocumentHtmlPropsEqual: (old?: {}, next?: {}) => boolean;
14
+ export declare const areToolbarPropsEqual: (old?: {}, next?: {}) => boolean;
@@ -0,0 +1,3 @@
1
+ import type { Mode } from '#vivi/types/common';
2
+ export declare const isViewMode: (mode?: Mode) => mode is "view";
3
+ export declare const isEditMode: (mode?: Mode) => mode is "edit";
@@ -0,0 +1,5 @@
1
+ import _ from 'lodash/fp';
2
+ export declare const escapeRegexChars: (pattern: string) => string;
3
+ export declare const removeTrailingNewLines: _.LodashReplace1x3;
4
+ export declare const escapeTags: (content: string) => string;
5
+ export declare const escapeTagContent: (tagName: string, str: string) => string;
@@ -0,0 +1,4 @@
1
+ export declare const generateTable: ({ column, line }: {
2
+ column: number;
3
+ line: number;
4
+ }) => string;
@@ -0,0 +1,61 @@
1
+ import type { PrimaryDoc, PrimaryLayoutItem, PrimaryPage, PrimaryZoneElement, PrimaryZoneElementTypeCategory, Rect } from '@lls/store';
2
+ export declare const getDocumentByUuid: (uuid: PrimaryDoc["uuid"], template: PrimaryPage) => PrimaryPage;
3
+ export declare const getDepth: (path: string[]) => number;
4
+ export declare const parseErrorsInContentMd: (contentMd: string | undefined, sanitizeErrorFn?: (e: HTMLCollectionOf<Element>) => string | undefined) => string | undefined;
5
+ export declare const getDocumentUniqueId: (doc?: PrimaryPage | PrimaryDoc) => string | number;
6
+ export declare const getMissingUuid: (template?: PrimaryPage) => PrimaryDoc | undefined;
7
+ export declare const getMissingId: (template?: PrimaryPage) => PrimaryDoc | undefined;
8
+ export declare const updateTemplate: (template: PrimaryPage, doc?: PrimaryDoc) => PrimaryPage;
9
+ export declare const addDocumentToTemplate: (template: PrimaryPage, partialDoc: Omit<PrimaryLayoutItem, "id">) => PrimaryPage;
10
+ export declare const deleteDocumentFromTemplate: (template: PrimaryPage, docUuid: string) => PrimaryPage;
11
+ export declare const updateLayoutItemFromTemplate: ({ template, newLayoutItem }: {
12
+ template: PrimaryPage;
13
+ newLayoutItem: PrimaryLayoutItem;
14
+ }) => PrimaryPage;
15
+ export declare const addZoneElementToTemplate: ({ template, uuid, type, newZoneElement }: {
16
+ template: PrimaryPage;
17
+ uuid: string;
18
+ type: PrimaryZoneElementTypeCategory;
19
+ newZoneElement: PrimaryZoneElement;
20
+ }) => PrimaryPage;
21
+ export declare const updateZoneElementFromTemplate: ({ template, uuid, type, newZoneElement }: {
22
+ template: PrimaryPage;
23
+ uuid: string;
24
+ type: PrimaryZoneElementTypeCategory;
25
+ newZoneElement: PrimaryZoneElement;
26
+ }) => PrimaryPage;
27
+ export declare const rotateDocFromTemplate: ({ template, uuid, rotation }: {
28
+ template: PrimaryPage;
29
+ uuid: string;
30
+ rotation: number;
31
+ }) => PrimaryPage;
32
+ export declare const deleteZoneElementFromTemplate: ({ template, uuid, type, zoneElementId }: {
33
+ template: PrimaryPage;
34
+ uuid: string;
35
+ type: PrimaryZoneElementTypeCategory;
36
+ zoneElementId: string;
37
+ }) => PrimaryPage;
38
+ export declare const addPictureToTemplate: (template: PrimaryPage, picture: string) => PrimaryPage;
39
+ export type GridItemElement<T extends PrimaryZoneElement = PrimaryZoneElement> = {
40
+ zoneElement: T;
41
+ pictureSize: string;
42
+ pictureRatio: number;
43
+ pictureAbsolutePosition: Rect;
44
+ rotation: number;
45
+ elementRect: Rect;
46
+ };
47
+ export type GridItem = {
48
+ pictureSize: string;
49
+ pictureRatio: number;
50
+ pictureAbsolutePosition: Rect;
51
+ rotation: number;
52
+ elements: GridItemElement[];
53
+ };
54
+ export declare const getGridItem: (template: PrimaryPage | undefined, originalPictureRratio: number) => Map<string, GridItem>;
55
+ export declare const validatePrimaryLayoutItemFormat: (doc: Omit<PrimaryLayoutItem, "id">) => boolean;
56
+ export declare const getGridElementStyle: (gridItemElement: GridItemElement, gridItem: GridItem) => {
57
+ '--v-grid-zone-element-picture-ratio': number;
58
+ '--v-grid-zone-element-picture-size': string;
59
+ '--v-grid-zone-element-picture-left': string;
60
+ '--v-grid-zone-element-picture-top': string;
61
+ };
@@ -0,0 +1 @@
1
+ export declare const replaceByPlaceholder: (url: string) => string;
@@ -0,0 +1,45 @@
1
+ import type { PrimaryLayoutItem, PrimaryZone, PrimaryZoneElement, Word } from '@lls/store';
2
+ import { type HandleID } from '#vivi/constants/zoneMaker';
3
+ type MagnetsType = {
4
+ x: number[];
5
+ y: number[];
6
+ };
7
+ type Point = {
8
+ x: number;
9
+ y: number;
10
+ };
11
+ export declare const roundAndBound: (val: number, min?: number, max?: number) => number;
12
+ export declare const getMagnets: ({ containerRect, zones, currentZoneId, rotation }: {
13
+ containerRect: DOMRect;
14
+ zones: PrimaryZone[];
15
+ currentZoneId: string;
16
+ rotation?: number;
17
+ }) => MagnetsType;
18
+ export declare const dragZone: <T extends PrimaryZone>({ zone, magnets, startPosition, cursorPosition: iCursorPosition, containerRect: iContainerRect, rotation }: {
19
+ zone: T;
20
+ magnets: MagnetsType;
21
+ startPosition: Point;
22
+ cursorPosition: Point;
23
+ containerRect: Pick<DOMRect, "width" | "height" | "x" | "y">;
24
+ rotation?: number;
25
+ }) => T;
26
+ export declare const resizeZone: <T extends PrimaryZone>({ zone, handleId: iHandleId, magnets, rotation, cursorPosition: iCursorPosition, containerRect: iContainerRect }: {
27
+ zone: T;
28
+ handleId?: HandleID;
29
+ magnets: MagnetsType;
30
+ cursorPosition: Point;
31
+ containerRect: Pick<DOMRect, "width" | "height" | "x" | "y">;
32
+ rotation?: number;
33
+ }) => T;
34
+ export declare const getZoneElementColor: (zone: PrimaryZoneElement) => "black" | "lightgray" | "var(--primary-40-color)" | "var(--secondary-40-color)" | "var(--turquoise-40-color)" | "var(--purple-40-color)" | "var(--pk-pink-30-color)";
35
+ export declare const addPixelToPercent: ({ itemSize, zonePosition, pixelToAdd }: {
36
+ itemSize: number;
37
+ zonePosition: number;
38
+ pixelToAdd: number;
39
+ }) => number;
40
+ export declare const duplicateZone: (zone: PrimaryZoneElement, layoutItem: PrimaryLayoutItem) => PrimaryZoneElement;
41
+ export declare const setWordsList: (words?: Word[]) => {
42
+ value: number;
43
+ label: string;
44
+ }[];
45
+ export {};