@segnavia/react 0.22.0 → 0.24.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/dist/elements.d.ts +3 -1
- package/dist/elements.js +8 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.js +27 -3
- package/dist/props.d.ts +10 -0
- package/package.json +2 -2
package/dist/elements.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CaptionProps, CaptionsProps, CounterProps, DocumentProps, FullscreenProps, MuteProps, NotesProps, PageProps, PaperPickerProps, PaperProps, PlayProps, PlayerProps, RailProps, StageProps, StepProps, ThumbnailProps, TimeProps, TrackProps } from "./props.js";
|
|
1
|
+
import { CaptionProps, CaptionsProps, CounterProps, DocumentProps, FullscreenProps, ItemSettingsProps, MuteProps, NotesProps, PageProps, PaperPickerProps, PaperProps, PlayProps, PlayerProps, RailProps, StageProps, StepProps, ThumbnailProps, TimeProps, TrackProps } from "./props.js";
|
|
2
|
+
import { SegnaviaItemSettings } from "@segnavia/frame/item-settings";
|
|
2
3
|
import { SegnaviaPlayer } from "@segnavia/frame/player";
|
|
3
4
|
import { SegnaviaDocument, SegnaviaPage, SegnaviaPaper, SegnaviaStage, SegnaviaThumbnail } from "@segnavia/frame";
|
|
4
5
|
import { SegnaviaCaption, SegnaviaCaptions, SegnaviaCounter, SegnaviaFullscreen, SegnaviaMute, SegnaviaNotes, SegnaviaPaperPicker, SegnaviaPlay, SegnaviaRail, SegnaviaStep, SegnaviaTime, SegnaviaTrack } from "@segnavia/frame/controls";
|
|
@@ -20,6 +21,7 @@ export declare const ELEMENTS: {
|
|
|
20
21
|
readonly stage: ElementDescriptor<SegnaviaStage, StageProps, "segnavia-stage">;
|
|
21
22
|
readonly thumbnail: ElementDescriptor<SegnaviaThumbnail, ThumbnailProps, "segnavia-thumbnail">;
|
|
22
23
|
readonly paperPicker: ElementDescriptor<SegnaviaPaperPicker, PaperPickerProps, "segnavia-paper-picker">;
|
|
24
|
+
readonly itemSettings: ElementDescriptor<SegnaviaItemSettings, ItemSettingsProps, "segnavia-item-settings">;
|
|
23
25
|
readonly page: ElementDescriptor<SegnaviaPage, PageProps, "segnavia-page">;
|
|
24
26
|
readonly paper: ElementDescriptor<SegnaviaPaper, PaperProps, "segnavia-paper">;
|
|
25
27
|
readonly document: ElementDescriptor<SegnaviaDocument, DocumentProps, "segnavia-document">;
|
package/dist/elements.js
CHANGED
|
@@ -42,6 +42,14 @@ const ELEMENTS = {
|
|
|
42
42
|
"slots"
|
|
43
43
|
], { onSegnaviaThumbnailError: "segnavia-thumbnail-error" }),
|
|
44
44
|
paperPicker: element(STYLED_ELEMENTS.paperPicker, ["value", "labels"], { onChange: "change" }),
|
|
45
|
+
itemSettings: element("segnavia-item-settings", [
|
|
46
|
+
"declarations",
|
|
47
|
+
"fills",
|
|
48
|
+
"fill",
|
|
49
|
+
"source",
|
|
50
|
+
"report",
|
|
51
|
+
"labels"
|
|
52
|
+
], { onSegnaviaFillSelect: "segnavia-fill-select" }),
|
|
45
53
|
page: element(HEADLESS_ELEMENTS.page, [
|
|
46
54
|
"page",
|
|
47
55
|
"css",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { CaptionProps, CaptionsProps, CounterProps, DocumentProps, FullscreenProps, MuteProps, NotesProps, PageProps, PaperPickerProps, PaperProps, PlayProps, PlayerProps, RailProps, StageProps, StepProps, ThumbnailProps, TimeProps, TrackProps } from "./props.js";
|
|
1
|
+
import { CaptionProps, CaptionsProps, CounterProps, DocumentProps, FullscreenProps, ItemSettingsProps, MuteProps, NotesProps, PageProps, PaperPickerProps, PaperProps, PlayProps, PlayerProps, RailProps, StageProps, StepProps, ThumbnailProps, TimeProps, TrackProps } from "./props.js";
|
|
2
2
|
import { AnyElementDescriptor, ElementFor, PropsFor } from "./elements.js";
|
|
3
3
|
import { SegnaviaIntrinsicElements } from "./jsx.js";
|
|
4
4
|
import { AuthoringController, AuthoringController as AuthoringController$1, AuthoringErrorDetail, AuthoringHandlers, AuthoringHandlers as AuthoringHandlers$1, AuthoringOptions, AuthoringOptions as AuthoringOptions$1, DirtyChangeDetail, SaveNotesInput, SavePrintMomentInput } from "@segnavia/frame/authoring";
|
|
5
|
-
import { DocumentAuthoringController, DocumentAuthoringController as DocumentAuthoringController$1, DocumentAuthoringErrorDetail, DocumentAuthoringHandlers, DocumentAuthoringHandlers as DocumentAuthoringHandlers$1, MovePageHandler, MovePageInput } from "@segnavia/frame/document-authoring";
|
|
5
|
+
import { DocumentAuthoringController, DocumentAuthoringController as DocumentAuthoringController$1, DocumentAuthoringErrorDetail, DocumentAuthoringHandlers, DocumentAuthoringHandlers as DocumentAuthoringHandlers$1, DocumentAuthoringOptions, DocumentAuthoringOptions as DocumentAuthoringOptions$1, MovePageHandler, MovePageInput } from "@segnavia/frame/document-authoring";
|
|
6
|
+
import { ItemSettingsController, ItemSettingsController as ItemSettingsController$1, ItemSettingsErrorDetail, ItemSettingsHandlers, ItemSettingsHandlers as ItemSettingsHandlers$1, ItemSettingsLabels, ItemSettingsSection, ItemSettingsSectionContext, SegnaviaItemSettings } from "@segnavia/frame/item-settings";
|
|
6
7
|
import { SegnaviaPlayer } from "@segnavia/frame/player";
|
|
7
8
|
import { ReactNode } from "react";
|
|
8
9
|
import { DeckController, SegnaviaDocument } from "@segnavia/frame";
|
|
@@ -38,6 +39,19 @@ export declare const PaperPicker: import("react").ForwardRefExoticComponent<Omit
|
|
|
38
39
|
} & {
|
|
39
40
|
children?: ReactNode;
|
|
40
41
|
} & import("react").RefAttributes<import("@segnavia/frame/controls").SegnaviaPaperPicker>>;
|
|
42
|
+
export declare const ItemSettings: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<SegnaviaItemSettings>, "children"> & {
|
|
43
|
+
children?: ReactNode;
|
|
44
|
+
} & {
|
|
45
|
+
declarations?: SegnaviaItemSettings["declarations"];
|
|
46
|
+
fills?: SegnaviaItemSettings["fills"];
|
|
47
|
+
fill?: SegnaviaItemSettings["fill"];
|
|
48
|
+
source?: SegnaviaItemSettings["source"];
|
|
49
|
+
report?: SegnaviaItemSettings["report"];
|
|
50
|
+
labels?: Partial<import("@segnavia/frame/item-settings").ItemSettingsLabels>;
|
|
51
|
+
onSegnaviaFillSelect?: (event: CustomEvent<string>) => void;
|
|
52
|
+
} & {
|
|
53
|
+
children?: ReactNode;
|
|
54
|
+
} & import("react").RefAttributes<SegnaviaItemSettings>>;
|
|
41
55
|
export declare const Page: import("react").ForwardRefExoticComponent<PageProps & {
|
|
42
56
|
children?: ReactNode;
|
|
43
57
|
} & import("react").RefAttributes<import("@segnavia/frame").SegnaviaPage>>;
|
|
@@ -156,6 +170,7 @@ export declare const Rail: import("react").ForwardRefExoticComponent<Omit<import
|
|
|
156
170
|
} & import("react").RefAttributes<import("@segnavia/frame/controls").SegnaviaRail>>;
|
|
157
171
|
export declare function useDeckController(element: ElementWithController | null): DeckController | null;
|
|
158
172
|
export declare function useAuthoring(player: SegnaviaPlayer | null, handlers: AuthoringHandlers$1, options?: AuthoringOptions$1): AuthoringController$1 | null;
|
|
159
|
-
export declare function useDocumentAuthoring(document: SegnaviaDocument | null, handlers: DocumentAuthoringHandlers$1): DocumentAuthoringController$1 | null;
|
|
173
|
+
export declare function useDocumentAuthoring(document: SegnaviaDocument | null, handlers: DocumentAuthoringHandlers$1, options?: DocumentAuthoringOptions$1): DocumentAuthoringController$1 | null;
|
|
174
|
+
export declare function useItemSettings(element: SegnaviaItemSettings | null, handlers: ItemSettingsHandlers$1): ItemSettingsController$1 | null;
|
|
160
175
|
//#endregion
|
|
161
|
-
export type { AuthoringController, AuthoringErrorDetail, AuthoringHandlers, AuthoringOptions, CaptionProps, CaptionsProps, CounterProps, DirtyChangeDetail, DocumentAuthoringController, DocumentAuthoringErrorDetail, DocumentAuthoringHandlers, DocumentProps, FullscreenProps, MovePageHandler, MovePageInput, MuteProps, NotesProps, PageProps, PaperPickerProps, PaperProps, PlayProps, PlayerProps, RailProps, SaveNotesInput, SavePrintMomentInput, SegnaviaIntrinsicElements, StageProps, StepProps, ThumbnailProps, TimeProps, TrackProps };
|
|
176
|
+
export type { AuthoringController, AuthoringErrorDetail, AuthoringHandlers, AuthoringOptions, CaptionProps, CaptionsProps, CounterProps, DirtyChangeDetail, DocumentAuthoringController, DocumentAuthoringErrorDetail, DocumentAuthoringHandlers, DocumentAuthoringOptions, DocumentProps, FullscreenProps, ItemSettingsController, ItemSettingsErrorDetail, ItemSettingsHandlers, ItemSettingsLabels, ItemSettingsProps, ItemSettingsSection, ItemSettingsSectionContext, MovePageHandler, MovePageInput, MuteProps, NotesProps, PageProps, PaperPickerProps, PaperProps, PlayProps, PlayerProps, RailProps, SaveNotesInput, SavePrintMomentInput, SegnaviaIntrinsicElements, StageProps, StepProps, ThumbnailProps, TimeProps, TrackProps };
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ELEMENTS } from "./elements.js";
|
|
|
2
2
|
import { syncElementProps } from "./react-props.js";
|
|
3
3
|
import { attachAuthoring } from "@segnavia/frame/authoring";
|
|
4
4
|
import { attachDocumentAuthoring } from "@segnavia/frame/document-authoring";
|
|
5
|
+
import { attachItemSettings } from "@segnavia/frame/item-settings";
|
|
5
6
|
import "@segnavia/frame/player";
|
|
6
7
|
import { createElement, forwardRef, useCallback, useEffect, useRef, useState } from "react";
|
|
7
8
|
//#region src/index.ts
|
|
@@ -39,6 +40,7 @@ const Player = createComponent(ELEMENTS.player);
|
|
|
39
40
|
const Stage = createComponent(ELEMENTS.stage);
|
|
40
41
|
const Thumbnail = createComponent(ELEMENTS.thumbnail);
|
|
41
42
|
const PaperPicker = createComponent(ELEMENTS.paperPicker);
|
|
43
|
+
const ItemSettings = createComponent(ELEMENTS.itemSettings);
|
|
42
44
|
const Page = createComponent(ELEMENTS.page);
|
|
43
45
|
const Paper = createComponent(ELEMENTS.paper);
|
|
44
46
|
const Document = createComponent(ELEMENTS.document);
|
|
@@ -90,21 +92,43 @@ function useAuthoring(player, handlers, options) {
|
|
|
90
92
|
]);
|
|
91
93
|
return controller;
|
|
92
94
|
}
|
|
93
|
-
function useDocumentAuthoring(document, handlers) {
|
|
95
|
+
function useDocumentAuthoring(document, handlers, options) {
|
|
94
96
|
const [controller, setController] = useState(null);
|
|
95
97
|
const latestHandlers = useRef(handlers);
|
|
98
|
+
const latestOptions = useRef(options);
|
|
96
99
|
latestHandlers.current = handlers;
|
|
100
|
+
latestOptions.current = options;
|
|
97
101
|
useEffect(() => {
|
|
98
102
|
if (!document) return;
|
|
99
|
-
const attached = attachDocumentAuthoring(document, latestHandlers.current);
|
|
103
|
+
const attached = attachDocumentAuthoring(document, latestHandlers.current, latestOptions.current);
|
|
100
104
|
setController(attached);
|
|
101
105
|
return () => {
|
|
102
106
|
attached.detach();
|
|
103
107
|
setController(null);
|
|
104
108
|
};
|
|
105
109
|
}, [document]);
|
|
110
|
+
useEffect(() => controller?.update(handlers, options), [
|
|
111
|
+
controller,
|
|
112
|
+
handlers,
|
|
113
|
+
options
|
|
114
|
+
]);
|
|
115
|
+
return controller;
|
|
116
|
+
}
|
|
117
|
+
function useItemSettings(element, handlers) {
|
|
118
|
+
const [controller, setController] = useState(null);
|
|
119
|
+
const latestHandlers = useRef(handlers);
|
|
120
|
+
latestHandlers.current = handlers;
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (!element) return;
|
|
123
|
+
const attached = attachItemSettings(element, latestHandlers.current);
|
|
124
|
+
setController(attached);
|
|
125
|
+
return () => {
|
|
126
|
+
attached.detach();
|
|
127
|
+
setController(null);
|
|
128
|
+
};
|
|
129
|
+
}, [element]);
|
|
106
130
|
useEffect(() => controller?.update(handlers), [controller, handlers]);
|
|
107
131
|
return controller;
|
|
108
132
|
}
|
|
109
133
|
//#endregion
|
|
110
|
-
export { Caption, Captions, Counter, Document, Fullscreen, Mute, Notes, Page, Paper, PaperPicker, Play, Player, Rail, Stage, Step, Thumbnail, Time, Track, createComponent, useAuthoring, useDeckController, useDocumentAuthoring };
|
|
134
|
+
export { Caption, Captions, Counter, Document, Fullscreen, ItemSettings, Mute, Notes, Page, Paper, PaperPicker, Play, Player, Rail, Stage, Step, Thumbnail, Time, Track, createComponent, useAuthoring, useDeckController, useDocumentAuthoring, useItemSettings };
|
package/dist/props.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ItemSettingsLabels, SegnaviaItemSettings } from "@segnavia/frame/item-settings";
|
|
1
2
|
import { PlayerControls, PlayerFit, SegnaviaPlayer } from "@segnavia/frame/player";
|
|
2
3
|
import { HTMLAttributes, ReactNode } from "react";
|
|
3
4
|
import { ControllerOptions, DeckController, FittedSize, HostTransition, PageInput, PrintInput, SegnaviaDocument, SegnaviaPage, SegnaviaPaper, SegnaviaStage, SegnaviaThumbnail, StageReserve } from "@segnavia/frame";
|
|
@@ -68,6 +69,15 @@ export type PaperPickerProps = Omit<ElementProps<SegnaviaPaperPicker>, 'onChange
|
|
|
68
69
|
labels?: PaperPickerLabelOverrides;
|
|
69
70
|
onChange?: CustomEventProp<SegnaviaPaperPicker['value']>;
|
|
70
71
|
};
|
|
72
|
+
export type ItemSettingsProps = ElementProps<SegnaviaItemSettings> & {
|
|
73
|
+
declarations?: SegnaviaItemSettings['declarations'];
|
|
74
|
+
fills?: SegnaviaItemSettings['fills'];
|
|
75
|
+
fill?: SegnaviaItemSettings['fill'];
|
|
76
|
+
source?: SegnaviaItemSettings['source'];
|
|
77
|
+
report?: SegnaviaItemSettings['report'];
|
|
78
|
+
labels?: Partial<ItemSettingsLabels>;
|
|
79
|
+
onSegnaviaFillSelect?: CustomEventProp<string>;
|
|
80
|
+
};
|
|
71
81
|
export interface PageProps extends ElementProps<SegnaviaPage> {
|
|
72
82
|
page?: PageInput | null;
|
|
73
83
|
css?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segnavia/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@segnavia/frame": "0.
|
|
29
|
+
"@segnavia/frame": "0.24.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "^18.0.0 || ^19.0.0",
|