@capytale/iframe-react 1.1.5 → 1.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capytale/iframe-react",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
package/dist/index.d.ts DELETED
@@ -1,335 +0,0 @@
1
- import { CapytaleContracts } from '@capytale/contracts';
2
- import { JSX as JSX_2 } from 'react/jsx-runtime';
3
- import { PropsWithChildren } from 'react';
4
- import { StoreApi } from 'zustand';
5
-
6
- export declare type Action = {
7
- type: "action";
8
- title: string;
9
- icon: string;
10
- action: () => any;
11
- } | {
12
- type: "file-upload";
13
- accept?: string;
14
- title: string;
15
- icon: string;
16
- action: (file: File) => any;
17
- };
18
-
19
- export declare type ActivitySettings = ActivitySettingsSection[];
20
-
21
- declare type ActivitySettingsFormSection = {
22
- type: "form";
23
- fields: FormField[];
24
- };
25
-
26
- declare type ActivitySettingsInput = {
27
- type: "input";
28
- inputType: "color" | "date" | "datetime-local" | "email" | "month" | "password" | "search" | "tel" | "text" | "time" | "url" | "week";
29
- defaultValue: string;
30
- };
31
-
32
- declare type ActivitySettingsMultipleOptionsSection = {
33
- name: string;
34
- type: "checkboxes" | "switches";
35
- options: {
36
- label: string;
37
- value: string;
38
- }[];
39
- defaultValues: string[];
40
- };
41
-
42
- declare type ActivitySettingsNumberInput = {
43
- type: "input";
44
- inputType: "number";
45
- defaultValue: number;
46
- };
47
-
48
- declare type ActivitySettingsOption = {
49
- type: "checkbox" | "switch";
50
- defaultValue: boolean;
51
- };
52
-
53
- declare type ActivitySettingsRadioOptionsSection = {
54
- name: string;
55
- type: "radio";
56
- options: {
57
- label: string;
58
- value: string;
59
- }[];
60
- defaultValue: string | null;
61
- };
62
-
63
- declare type ActivitySettingsRange = {
64
- type: "range";
65
- min: number;
66
- max: number;
67
- step?: number;
68
- defaultValue: number;
69
- };
70
-
71
- declare type ActivitySettingsSection = (ActivitySettingsMultipleOptionsSection | ActivitySettingsRadioOptionsSection | ActivitySettingsFormSection) & {
72
- title: string;
73
- };
74
-
75
- declare type ActivitySettingsSelect = {
76
- type: "select";
77
- options: {
78
- label: string;
79
- value: string;
80
- }[];
81
- defaultValue: string;
82
- };
83
-
84
- declare type ActivitySettingsTextArea = {
85
- type: "textarea";
86
- defaultValue: string;
87
- };
88
-
89
- declare type AddId<C, I extends {
90
- name: string;
91
- variant?: string;
92
- }> = I extends {
93
- variant: string;
94
- } ? C & {
95
- name: `${I['name']}(${I['variant']})`;
96
- } : C & {
97
- name: I['name'];
98
- };
99
-
100
- /**
101
- * Un type utilitaire pour ajouter les propriétés d'identifications à un contrat
102
- * ou à un tuple de contrats.
103
- *
104
- * @param C Le type de contrat ou de tuple de contrats.
105
- * @param I Le nom et éventuellement la variante à ajouter.
106
- */
107
- declare type AddIdData<C, I extends {
108
- name: string;
109
- variant?: string;
110
- }> = C extends {}[] ? {
111
- [Index in keyof C]: AddId<C[Index], I>;
112
- } : AddId<C, I>;
113
-
114
- declare type AllContractNames = keyof AllContracts;
115
-
116
- declare type AllContracts = CapytaleContracts & CustomContracts;
117
-
118
- export declare function Capytale<T extends ActivitySettings>({ children, contracts, loadOnlyWhenReady, activitySettingsStore, }: PropsWithChildren<CapytaleProps<T>>): JSX_2.Element;
119
-
120
- declare type CapytaleProps<T extends ActivitySettings> = {
121
- contracts: ContractNamesExceptForced[];
122
- loadOnlyWhenReady?: boolean;
123
- activitySettingsStore?: ReturnType<typeof createActivitySettingsStore<T>>;
124
- };
125
-
126
- /**
127
- * Un type utilitaire pour indexer un ensemble de contrats par leur identifiant complet.
128
- *
129
- * @param T Un tuple de contrats.
130
- */
131
- declare type CollectionOf<T extends {
132
- name: string;
133
- version: number;
134
- }[]> = Indexed<IdContractTuple<T>>;
135
-
136
- declare type ContractNamesExceptForced = Exclude<AllContractNames, ForcedContactNames>;
137
-
138
- export declare function createActivitySettingsStore<T extends ActivitySettings>(as: T): {
139
- (): InferValue<T>;
140
- <U>(selector: (state: InferValue<T>) => U): U;
141
- } & StoreApi<InferValue<T>> & {
142
- activitySettings: T;
143
- };
144
-
145
- declare type CustomContracts = CollectionOf<[
146
- AddIdData<MetaPlayerAntiCheatV1, {
147
- name: "meta-player-anti-cheat";
148
- }>
149
- ]>;
150
-
151
- declare type ForcedContactNames = "meta-player-events:1" | "mode:1" | "workflow:1";
152
-
153
- declare type FormField = (ActivitySettingsRange | ActivitySettingsInput | ActivitySettingsNumberInput | ActivitySettingsTextArea | ActivitySettingsOption | ActivitySettingsSelect) & {
154
- label: string;
155
- name: string;
156
- };
157
-
158
- declare type IdContractTuple<T extends {
159
- name: string;
160
- version: number;
161
- }[]> = {
162
- [Index in keyof T]: [IdOf<T[Index]>, T[Index]];
163
- }[number];
164
-
165
- /**
166
- * Un type qui représente un identifiant de contrat.
167
- * Il est composé du nom du contrat et de sa version.
168
- * Exemple: `content:1`
169
- *
170
- * @param C Le type de contrat.
171
- */
172
- declare type IdOf<C extends {
173
- name: string;
174
- version: number;
175
- }> = `${C['name']}:${C['version']}`;
176
-
177
- declare type Indexed<L extends [string, unknown]> = {
178
- [I in L[0]]: Extract<L, [I, any]>[1];
179
- };
180
-
181
- declare type InferFieldType<T> = T extends {
182
- type: "checkboxes" | "switches";
183
- options: readonly {
184
- value: infer V;
185
- }[];
186
- } ? V[] : T extends {
187
- type: "radio";
188
- options: readonly {
189
- value: infer V;
190
- }[];
191
- } ? V | null : T extends {
192
- type: "select";
193
- options: readonly {
194
- value: infer V;
195
- }[];
196
- } ? V : T extends {
197
- type: "input";
198
- inputType: "number";
199
- } ? number : T extends {
200
- type: "input" | "textarea";
201
- } ? string : T extends {
202
- type: "range";
203
- } ? number : T extends {
204
- type: "checkbox" | "switch";
205
- } ? boolean : never;
206
-
207
- export declare type InferValue<T> = T extends readonly (infer Section)[] ? UnionToIntersection<Section extends {
208
- type: "form";
209
- fields: infer F extends readonly any[];
210
- } ? UnionToIntersection<{
211
- [K in keyof F]: F[K] extends {
212
- name: infer N extends string;
213
- } ? {
214
- [P in N]: InferFieldType<F[K]>;
215
- } : never;
216
- }[number]> : Section extends {
217
- name: infer N extends string;
218
- } ? {
219
- [P in N]: InferFieldType<Section>;
220
- } : never> : never;
221
-
222
- declare type MetaPlayerAntiCheatV1 = {
223
- version: 1;
224
- /**
225
- * L'interface qui expose le *MetaPlayer* à l'*Application*.
226
- */
227
- metaplayer: {
228
- reportGainedFocus(): void;
229
- reportLostFocus(): void;
230
- };
231
- /**
232
- * L'interface qui expose l'*Application* au *MetaPlayer*.
233
- */
234
- application: {
235
- lock(): void;
236
- unlock(): void;
237
- };
238
- };
239
-
240
- declare type MPToastMessage = {
241
- /**
242
- * Severity of the message.
243
- */
244
- severity?: "error" | "success" | "info" | "warn" | "secondary" | "contrast";
245
- /**
246
- * Summary content of the message.
247
- */
248
- summary?: string;
249
- /**
250
- * Detail content of the message.
251
- */
252
- detail?: string;
253
- /**
254
- * Whether the message can be closed manually using the close icon.
255
- */
256
- closable?: boolean;
257
- /**
258
- * When enabled, message is not removed automatically.
259
- */
260
- sticky?: boolean;
261
- /**
262
- * Delay in milliseconds to close the message automatically.
263
- */
264
- life?: number;
265
- };
266
-
267
- declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
268
-
269
- export declare const useAfterSaveAction: (fn: () => any) => void;
270
-
271
- export declare const useGetLoadedJsonActivityContent: () => () => any;
272
-
273
- export declare const useGetLoadedJsonActivitySplitContent: () => () => {
274
- content: any;
275
- binaryData: any;
276
- };
277
-
278
- export declare const useGetLoadedJsonAssignmentContent: () => () => any;
279
-
280
- export declare const useGetLoadedJsonAssignmentSplitContent: () => () => {
281
- content: any;
282
- binaryData: any;
283
- };
284
-
285
- export declare const useGetLoadedJsonContent: () => () => any;
286
-
287
- export declare const useGetLoadedTextContent: () => () => string | null;
288
-
289
- export declare const useJsonActivityContentSaveFunction: (fn: () => any) => void;
290
-
291
- export declare const useJsonActivitySplitContentSaveFunction: (fn: () => any) => void;
292
-
293
- export declare const useJsonAssignmentContentSaveFunction: (fn: () => any) => void;
294
-
295
- export declare const useJsonAssignmentSplitContentSaveFunction: (fn: () => any) => void;
296
-
297
- export declare const useJsonContentSaveFunction: (fn: () => any) => void;
298
-
299
- export declare const useLoadedJsonActivityBinaryData: () => any;
300
-
301
- export declare const useLoadedJsonActivityContent: () => any;
302
-
303
- export declare const useLoadedJsonAssignmentBinaryData: () => any;
304
-
305
- export declare const useLoadedJsonAssignmentContent: () => any;
306
-
307
- export declare const useLoadedJsonContent: () => any;
308
-
309
- export declare const useLoadedTextContent: () => string | null;
310
-
311
- export declare const useMode: () => "assignment" | "create" | "review" | "view";
312
-
313
- export declare const useNotifyIsDirty: () => () => void;
314
-
315
- export declare const usePreviewImageFile: () => (title: string, url: string) => void;
316
-
317
- export declare const usePreviewTextFile: () => (title: string, content: string) => void;
318
-
319
- export declare const useQuickActions: (actionsFn: () => Action[], deps: readonly unknown[]) => void;
320
-
321
- export declare const useRequestSave: () => () => void;
322
-
323
- export declare const useSettings: <T extends ActivitySettings>(settingsUiFn: () => T | null, callback: (changes: Partial<InferValue<T>>) => void, deps: readonly unknown[]) => void;
324
-
325
- export declare const useShowToast: () => (message: MPToastMessage) => void;
326
-
327
- export declare const useSidebarActions: (actionsFn: () => Action[], deps: readonly unknown[]) => void;
328
-
329
- export declare const useTextContentSaveFunction: (fn: () => string | null | Promise<string | null>) => void;
330
-
331
- export declare const useTheme: () => "light" | "dark";
332
-
333
- export declare const useWorkflow: () => "current" | "finished" | "corrected";
334
-
335
- export { }