@micromag/core 0.4.71 → 0.4.77

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/es/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { ReactNode, ComponentType } from 'react';
1
+ import * as react from 'react';
2
+ import { ReactNode, ElementType, ComponentType } from 'react';
2
3
  import EventEmitter from 'wolfy87-eventemitter';
3
4
  import { MessageDescriptor } from 'react-intl';
4
5
  import { Tracking as Tracking$1 } from '@folklore/tracking';
@@ -20,6 +21,7 @@ type Text = MessageDescriptor | ReactNode;
20
21
  type Label = MessageDescriptor | ReactNode;
21
22
  type Target = '_blank' | '_self' | '_parent';
22
23
 
24
+ type MediaElement = HTMLVideoElement | HTMLAudioElement | HTMLMediaElement;
23
25
  /**
24
26
  * Medias
25
27
  */
@@ -33,12 +35,12 @@ interface MediaFile {
33
35
  handle?: string;
34
36
  type?: string;
35
37
  mime?: string;
36
- url?: string;
38
+ url: string;
37
39
  }
38
40
  interface Media {
39
41
  id?: string;
40
42
  type: string;
41
- url?: string;
43
+ url: string;
42
44
  thumbnail_url?: string;
43
45
  name?: string;
44
46
  metadata?: MediaMetadata;
@@ -75,8 +77,8 @@ interface ClosedCaptionsMedia extends Omit<Media, 'type'> {
75
77
 
76
78
  type Errors = string | string[];
77
79
  type FormErrors = Record<string, Errors>;
78
- type Component = string | ComponentType;
79
- type ComponentsMap = Record<string, ComponentType>;
80
+ type Component = ElementType;
81
+ type ComponentsMap = Record<string, ElementType>;
80
82
  type SelectOption = string | {
81
83
  value: unknown;
82
84
  label?: Label;
@@ -129,7 +131,21 @@ interface Panel {
129
131
  id: string;
130
132
  }
131
133
  interface Button {
134
+ id?: string | number;
132
135
  label?: Label;
136
+ name?: string;
137
+ theme?: ButtonTheme | null;
138
+ size?: ButtonSize | null;
139
+ href?: string | null;
140
+ external?: boolean;
141
+ direct?: boolean;
142
+ target?: string;
143
+ focusable?: boolean;
144
+ active?: boolean;
145
+ icon?: React.ReactNode | null;
146
+ iconPosition?: 'left' | 'right' | 'inline';
147
+ disabled?: boolean;
148
+ className?: string | null;
133
149
  onClick?: (...args: unknown[]) => void;
134
150
  }
135
151
  type BootstrapTheme = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
@@ -170,8 +186,13 @@ interface CustomFont {
170
186
  type?: 'system' | 'google' | 'custom';
171
187
  name?: string;
172
188
  media?: FontMedia;
189
+ variants?: string[] | {
190
+ fvd?: string;
191
+ weight?: number;
192
+ style?: string;
193
+ }[];
173
194
  }
174
- type Font = Record<string, unknown> | string;
195
+ type Font = CustomFont | string;
175
196
  type TextAlign = 'left' | 'right' | 'center';
176
197
  interface ColorObject {
177
198
  color?: string;
@@ -377,6 +398,7 @@ interface ClosedCaptions {
377
398
  }
378
399
 
379
400
  interface StoryComponent {
401
+ id: string;
380
402
  type: string;
381
403
  [key: string]: unknown;
382
404
  }
@@ -386,6 +408,7 @@ interface StoryMetadata {
386
408
  shareUrl?: string;
387
409
  shareImage?: ImageMedia;
388
410
  favIcon?: ImageMedia;
411
+ language?: string;
389
412
  }
390
413
  interface StoryTheme {
391
414
  id?: string;
@@ -394,11 +417,31 @@ interface StoryTheme {
394
417
  colors?: Record<string, Color>;
395
418
  components?: ScreenComponent[];
396
419
  }
420
+ interface Organisation {
421
+ slug?: string;
422
+ name?: string;
423
+ tracking?: TrackingSettings;
424
+ }
425
+ interface TrackingCode {
426
+ id: string;
427
+ type: string;
428
+ }
429
+ interface TrackingSettings {
430
+ codes?: TrackingCode[];
431
+ }
432
+ interface StorySettings {
433
+ tracking?: TrackingSettings;
434
+ }
397
435
  interface Story {
398
436
  id?: string;
437
+ title?: string;
438
+ slug?: string;
439
+ document_id?: string;
399
440
  theme?: StoryTheme;
400
441
  components?: ScreenComponent[];
401
442
  metadata?: StoryMetadata;
443
+ settings?: StorySettings;
444
+ organisation?: Organisation;
402
445
  }
403
446
 
404
447
  interface DeviceScreen {
@@ -442,7 +485,7 @@ declare class ComponentsManager extends EventEmitter {
442
485
  addComponents(components: ComponentsMap, namespace?: string | null): this;
443
486
  merge(manager: ComponentsManager, namespace?: any): this;
444
487
  addNamespace(namespace: string | null): this;
445
- getComponent(name: string, namespace?: string | null): ComponentType;
488
+ getComponent(name: string, namespace?: string | null): react.ElementType;
446
489
  getComponents(namespace?: string | null): ComponentsMap;
447
490
  hasComponent(name: string, namespace?: string | null): boolean;
448
491
  }
@@ -568,4 +611,4 @@ declare class Tracking extends Tracking$1 {
568
611
  }
569
612
 
570
613
  export { ColorsParser, ComponentsManager, DefinitionsManager, EventsManager, FieldsManager, FontsParser, MediasParser, ScreensManager, StoryParser, ThemeParser, Tracking };
571
- export type { ActiveForm, AdFormat, AdFormats, Alternatives, Answer, AudioElement, AudioMedia, AuthorElement, BackgroundElement, Badge, BootstrapTheme, BorderStyle, BorderType, BoxStyle, Breadcrumb, Button, ButtonLayout, ButtonSize, ButtonTheme, CallToAction, CallToActionType, ClosedCaptions, ClosedCaptionsElement, ClosedCaptionsMedia, Color, ColorObject, Component, ComponentsMap, Conversation, ConversationMessage, CustomAnswer, CustomFont, Definition, Device, DeviceScreen, DropdownAlign, Errors, Field, FieldDefinition, Font, FontMedia, FontStyle, Footer, FormControlSize, FormErrors, FormField, GeoPosition, GridElement, GridLayout, GridLayoutItem, Header, HeadingElement, ImageElement, ImageElementWithCaption, ImageMedia, InputElement, Interaction, Label, Margin, Marker, MarkerWithImage, Media, MediaFile, MediaMetadata, MediaType, MenuItem, Modal, ObjectFit, ObjectFitSize, Panel, QuizAnswer, RenderContext, ScreenComponent, ScreenDefinition, ScreenSize, SearchFilter, SelectOption, ShadowType, ShareIncentive, Speaker, StackAlign, StackDirection, StackElement, StackSpacing, Story, StoryComponent, StoryMetadata, StoryTheme, Target, Text, TextAlign, TextElement, TextStyle, TimingOverrides, TrackingVariables, Transition, TransitionConfig, TransitionEasing, TransitionName, Transitions, User, VideoElement, VideoMedia, ViewerTheme, Visitor, VisualElement };
614
+ export type { ActiveForm, AdFormat, AdFormats, Alternatives, Answer, AudioElement, AudioMedia, AuthorElement, BackgroundElement, Badge, BootstrapTheme, BorderStyle, BorderType, BoxStyle, Breadcrumb, Button, ButtonLayout, ButtonSize, ButtonTheme, CallToAction, CallToActionType, ClosedCaptions, ClosedCaptionsElement, ClosedCaptionsMedia, Color, ColorObject, Component, ComponentsMap, Conversation, ConversationMessage, CustomAnswer, CustomFont, Definition, Device, DeviceScreen, DropdownAlign, Errors, Field, FieldDefinition, Font, FontMedia, FontStyle, Footer, FormControlSize, FormErrors, FormField, GeoPosition, GridElement, GridLayout, GridLayoutItem, Header, HeadingElement, ImageElement, ImageElementWithCaption, ImageMedia, InputElement, Interaction, Label, Margin, Marker, MarkerWithImage, Media, MediaElement, MediaFile, MediaMetadata, MediaType, MenuItem, Modal, ObjectFit, ObjectFitSize, Organisation, Panel, QuizAnswer, RenderContext, ScreenComponent, ScreenDefinition, ScreenSize, SearchFilter, SelectOption, ShadowType, ShareIncentive, Speaker, StackAlign, StackDirection, StackElement, StackSpacing, Story, StoryComponent, StoryMetadata, StorySettings, StoryTheme, Target, Text, TextAlign, TextElement, TextStyle, TimingOverrides, TrackingCode, TrackingSettings, TrackingVariables, Transition, TransitionConfig, TransitionEasing, TransitionName, Transitions, User, VideoElement, VideoMedia, ViewerTheme, Visitor, VisualElement };