@micromag/core 0.4.46 → 0.4.48

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,97 +1,25 @@
1
- import { ReactNode, Ref as Ref$1 } from 'react';
1
+ import { ReactNode, ComponentType } from 'react';
2
2
  import EventEmitter from 'wolfy87-eventemitter';
3
+ import { MessageDescriptor } from 'react-intl';
3
4
  import { Tracking as Tracking$1 } from '@folklore/tracking';
4
5
 
5
- /**
6
- * Core
7
- */
8
- interface History {
9
- listen: (...args: unknown[]) => void;
10
- push: (path: string, state?: unknown) => void;
11
- }
12
- interface Location {
13
- pathname?: string;
14
- search?: string;
15
- }
16
- interface Intl {
17
- locale: string;
18
- formatMessage: (...args: unknown[]) => string;
19
- }
20
- interface DefaultMessageContent {
21
- type?: number;
22
- value?: string;
23
- }
24
- type DefaultMessage = string | DefaultMessageContent[];
25
- interface Message {
26
- id?: string;
27
- defaultMessage: DefaultMessage;
28
- description?: string;
6
+ declare class ColorsParser {
7
+ constructor({ fieldsManager, screensManager }: {
8
+ fieldsManager: any;
9
+ screensManager: any;
10
+ });
11
+ parse(story: any): any;
12
+ getColorFieldPatterns(fields: any, namePrefix?: any): any;
13
+ static fieldIsColor({ id }: {
14
+ id?: any;
15
+ }): boolean;
16
+ static getColorsFromPath(data: any, patterns: any, colors?: any, keyPrefix?: any): any;
29
17
  }
30
- type Text = Message | string;
31
- type Label = Message | ReactNode;
32
- type StatusCode = 401 | 403 | 404 | 500;
33
- type Ref<T = unknown> = Ref$1<T>;
18
+
19
+ type Text = MessageDescriptor | ReactNode;
20
+ type Label = MessageDescriptor | ReactNode;
34
21
  type Target = '_blank' | '_self' | '_parent';
35
- type Interaction = 'tap' | 'swipe';
36
- type TrackingVariables = Record<string, string | number | unknown[]>;
37
- interface Progress {
38
- currentTime?: number;
39
- duration?: number;
40
- }
41
- /**
42
- * Site
43
- */
44
- interface User {
45
- id?: number;
46
- firstname?: string;
47
- lastname?: string;
48
- email?: string;
49
- gender?: string;
50
- birthdate?: string;
51
- }
52
- interface MenuItem {
53
- id?: number | string;
54
- label?: Label;
55
- url?: string;
56
- external?: boolean;
57
- active?: boolean;
58
- }
59
- interface Breadcrumb {
60
- label?: Label;
61
- url?: string;
62
- }
63
- interface Device {
64
- id: string;
65
- }
66
- interface Modal {
67
- id: string;
68
- }
69
- interface Panel {
70
- id: string;
71
- }
72
- interface Button {
73
- label?: Label;
74
- onClick?: (...args: unknown[]) => void;
75
- }
76
- type BootstrapTheme = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
77
- type ButtonTheme = BootstrapTheme | 'outline-primary' | 'outline-secondary' | 'outline-success' | 'outline-danger' | 'outline-warning' | 'outline-info' | 'outline-light' | 'outline-dark' | 'outline-link' | null;
78
- type ButtonSize = 'lg' | 'sm' | null;
79
- type FormControlSize = 'lg' | 'sm' | null;
80
- type DropdownAlign = 'start' | 'end';
81
- type Component = Record<string, unknown> | ((...args: unknown[]) => unknown);
82
- /**
83
- * Forms
84
- */
85
- type Errors = string | string[];
86
- type FormErrors = Record<string, Errors>;
87
- type SelectOption = string | {
88
- value: unknown;
89
- label?: Label;
90
- };
91
- interface FormField {
92
- name?: string;
93
- component?: Component;
94
- }
22
+
95
23
  /**
96
24
  * Medias
97
25
  */
@@ -144,6 +72,97 @@ interface AudioMedia extends Omit<Media, 'type' | 'metadata'> {
144
72
  interface ClosedCaptionsMedia extends Omit<Media, 'type'> {
145
73
  type?: 'closed-captions';
146
74
  }
75
+
76
+ type Errors = string | string[];
77
+ type FormErrors = Record<string, Errors>;
78
+ type Component = string | ComponentType;
79
+ type ComponentsMap = Record<string, ComponentType>;
80
+ type SelectOption = string | {
81
+ value: unknown;
82
+ label?: Label;
83
+ };
84
+ interface FormField {
85
+ name?: string;
86
+ component?: Component;
87
+ }
88
+ interface Definition {
89
+ id: string;
90
+ component?: Component;
91
+ }
92
+ interface Field {
93
+ name?: string;
94
+ type: string;
95
+ label?: Text;
96
+ isSection?: boolean;
97
+ fields?: Field[];
98
+ }
99
+ interface ScreenDefinition extends Definition {
100
+ type: 'screen';
101
+ title: Text;
102
+ layouts?: string[];
103
+ fields?: Field[];
104
+ }
105
+ interface FieldDefinition extends Definition {
106
+ id: string;
107
+ fields?: Field[];
108
+ settings?: Field[];
109
+ [key: string]: unknown;
110
+ }
111
+ interface MenuItem {
112
+ id?: number | string;
113
+ label?: Label;
114
+ url?: string;
115
+ external?: boolean;
116
+ active?: boolean;
117
+ }
118
+ interface Breadcrumb {
119
+ label?: Label;
120
+ url?: string;
121
+ }
122
+ interface Device {
123
+ id: string;
124
+ }
125
+ interface Modal {
126
+ id: string;
127
+ }
128
+ interface Panel {
129
+ id: string;
130
+ }
131
+ interface Button {
132
+ label?: Label;
133
+ onClick?: (...args: unknown[]) => void;
134
+ }
135
+ type BootstrapTheme = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
136
+ type ButtonTheme = BootstrapTheme | 'outline-primary' | 'outline-secondary' | 'outline-success' | 'outline-danger' | 'outline-warning' | 'outline-info' | 'outline-light' | 'outline-dark' | 'outline-link' | null;
137
+ type ButtonSize = 'lg' | 'sm' | null;
138
+ type FormControlSize = 'lg' | 'sm' | null;
139
+ type DropdownAlign = 'start' | 'end';
140
+ type ButtonLayout = 'label-bottom' | 'label-top' | 'no-label' | 'label-over' | 'label-left' | 'label-right';
141
+ interface User {
142
+ id?: number;
143
+ firstname?: string;
144
+ lastname?: string;
145
+ email?: string;
146
+ gender?: string;
147
+ birthdate?: string;
148
+ }
149
+ interface SearchFilter {
150
+ type?: string;
151
+ value?: string | number;
152
+ }
153
+ interface AdFormats {
154
+ width?: number;
155
+ height?: number;
156
+ }
157
+ interface AdFormat {
158
+ width?: number;
159
+ height?: number;
160
+ url?: string;
161
+ target?: Target;
162
+ iframe?: string;
163
+ image?: ImageMedia;
164
+ }
165
+
147
166
  /**
148
167
  * Style
149
168
  */
@@ -209,51 +228,7 @@ interface ObjectFit {
209
228
  horizontalPosition?: 'left' | 'center' | 'right';
210
229
  verticalPosition?: 'top' | 'center' | 'bottom';
211
230
  }
212
- /**
213
- * Elements
214
- */
215
- interface TextElement {
216
- body?: string;
217
- textStyle?: TextStyle;
218
- }
219
- type HeadingElement = TextElement;
220
- interface InputElement {
221
- label?: string;
222
- textStyle?: TextStyle;
223
- }
224
- interface ImageElement {
225
- media?: ImageMedia;
226
- }
227
- interface VideoElement {
228
- media?: VideoMedia;
229
- autoPlay?: boolean;
230
- loop?: boolean;
231
- closedCaptions?: ClosedCaptionsMedia;
232
- withSeekBar?: boolean;
233
- withControls?: boolean;
234
- }
235
- interface VisualElement {
236
- media?: ImageMedia;
237
- }
238
- interface AudioElement {
239
- media?: AudioMedia;
240
- autoPlay?: boolean;
241
- loop?: boolean;
242
- closedCaptions?: ClosedCaptionsMedia;
243
- withPlayPause?: boolean;
244
- }
245
- interface ClosedCaptionsElement {
246
- media?: ClosedCaptionsMedia;
247
- }
248
- interface BackgroundElement {
249
- color?: Color;
250
- image?: ImageMedia;
251
- video?: VideoMedia;
252
- }
253
- interface ImageElementWithCaption {
254
- image?: ImageMedia;
255
- caption?: TextElement;
256
- }
231
+
257
232
  type StackDirection = 'horizontal' | 'vertical';
258
233
  type StackAlign = 'start' | 'center' | 'end';
259
234
  type StackSpacing = number | 'between' | 'evenly' | 'around';
@@ -333,75 +308,99 @@ interface Conversation {
333
308
  interface Alternatives {
334
309
  audio?: AudioElement;
335
310
  }
336
- /**
337
- * Definitions
338
- */
339
- interface Field {
340
- name?: string;
341
- type: string;
342
- label?: Text;
343
- isSection?: boolean;
344
- fields?: Field[];
311
+ interface TextElement {
312
+ body?: string;
313
+ textStyle?: TextStyle;
345
314
  }
346
- interface ScreenDefinition {
347
- id: string;
348
- type: 'screen';
349
- title: Text;
350
- layouts?: string[];
351
- fields?: Field[];
315
+ type HeadingElement = TextElement;
316
+ interface InputElement {
317
+ label?: string;
318
+ textStyle?: TextStyle;
352
319
  }
353
- interface FieldDefinition {
354
- id: string;
355
- type: 'field';
356
- title: Text;
357
- fields?: Field[];
320
+ interface ImageElement {
321
+ media?: ImageMedia;
358
322
  }
359
- /**
360
- * Components
361
- */
323
+ interface VideoElement {
324
+ media?: VideoMedia;
325
+ autoPlay?: boolean;
326
+ loop?: boolean;
327
+ closedCaptions?: ClosedCaptionsMedia;
328
+ withSeekBar?: boolean;
329
+ withControls?: boolean;
330
+ }
331
+ interface VisualElement {
332
+ media?: ImageMedia;
333
+ }
334
+ interface AudioElement {
335
+ media?: AudioMedia;
336
+ autoPlay?: boolean;
337
+ loop?: boolean;
338
+ closedCaptions?: ClosedCaptionsMedia;
339
+ withPlayPause?: boolean;
340
+ }
341
+ interface ClosedCaptionsElement {
342
+ media?: ClosedCaptionsMedia;
343
+ }
344
+ interface BackgroundElement {
345
+ color?: Color;
346
+ image?: ImageMedia;
347
+ video?: VideoMedia;
348
+ }
349
+ interface ImageElementWithCaption {
350
+ image?: ImageMedia;
351
+ caption?: TextElement;
352
+ }
353
+ interface AuthorElement {
354
+ name?: TextElement;
355
+ avatar?: ImageMedia;
356
+ }
357
+ interface Badge {
358
+ label?: TextElement;
359
+ buttonStyle?: BoxStyle;
360
+ }
361
+ interface CustomAnswer {
362
+ active?: boolean;
363
+ placeholder?: TextElement;
364
+ textStyle?: TextStyle;
365
+ boxStyle?: BoxStyle;
366
+ }
367
+ interface Header {
368
+ badge?: Badge;
369
+ }
370
+ interface Footer {
371
+ callToAction?: CallToAction;
372
+ }
373
+ interface ClosedCaptions {
374
+ file?: ClosedCaptionsMedia;
375
+ textStyle?: TextStyle;
376
+ boxStyle?: BoxStyle;
377
+ }
378
+
362
379
  interface StoryComponent {
363
380
  type: string;
364
381
  [key: string]: unknown;
365
382
  }
366
383
  type ScreenComponent = StoryComponent;
367
- /**
368
- * Theme
369
- */
370
- interface Theme {
371
- id?: string;
372
- textStyles?: Record<string, TextStyle>;
373
- background?: BackgroundElement;
374
- colors?: Record<string, Color>;
375
- components?: ScreenComponent[];
376
- }
377
- interface ViewerTheme extends Theme {
378
- logo?: ImageMedia;
379
- }
380
- /**
381
- * Metadata
382
- */
383
- interface Metadata {
384
+ interface StoryMetadata {
384
385
  description?: string;
385
386
  shareUrl?: string;
386
387
  shareImage?: ImageMedia;
387
388
  favIcon?: ImageMedia;
388
389
  }
389
- interface Tag {
390
- label?: string;
391
- value?: number | string;
390
+ interface StoryTheme {
391
+ id?: string;
392
+ textStyles?: Record<string, TextStyle>;
393
+ background?: BackgroundElement;
394
+ colors?: Record<string, Color>;
395
+ components?: ScreenComponent[];
392
396
  }
393
- /**
394
- * Story
395
- */
396
397
  interface Story {
397
398
  id?: string;
398
- theme?: Theme;
399
+ theme?: StoryTheme;
399
400
  components?: ScreenComponent[];
400
- metadata?: Metadata;
401
+ metadata?: StoryMetadata;
401
402
  }
402
- /**
403
- * Render
404
- */
403
+
405
404
  interface DeviceScreen {
406
405
  name: string;
407
406
  mediaQuery?: string;
@@ -414,37 +413,9 @@ interface ScreenSize {
414
413
  landscape?: boolean;
415
414
  }
416
415
  type RenderContext = 'view' | 'placeholder' | 'edit' | 'preview' | 'static' | 'capture';
417
- /**
418
- * Screens
419
- */
420
- interface AdFormats {
421
- width?: number;
422
- height?: number;
423
- }
424
- interface AdFormat {
425
- width?: number;
426
- height?: number;
427
- url?: string;
428
- target?: Target;
429
- iframe?: string;
430
- image?: ImageMedia;
431
- }
432
- interface AudioComponent {
433
- src?: string;
434
- track?: string;
435
- trackLng?: number;
436
- controls?: boolean;
437
- }
438
- interface Slide {
439
- image?: ImageMedia;
440
- text?: string;
441
- }
442
- type ContainerStyle = Record<string, unknown>;
443
- /**
444
- * Transitions
445
- */
446
416
  type TransitionName = 'fade' | 'scale' | 'slide';
447
417
  type TransitionEasing = 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear';
418
+ type Interaction = 'tap' | 'swipe';
448
419
  interface TransitionConfig {
449
420
  name: TransitionName;
450
421
  duration?: number;
@@ -455,109 +426,39 @@ interface Transitions {
455
426
  in?: Transition;
456
427
  out?: Transition;
457
428
  }
458
- /**
459
- * Search
460
- */
461
- interface SearchFilter {
462
- type?: string;
463
- value?: string | number;
464
- }
465
- /**
466
- * Payments
467
- */
468
- interface PaymentItem {
469
- id?: string | number;
470
- date?: string;
471
- type?: string;
472
- invoice_link?: string;
473
- amount?: string | number;
474
- }
475
- /**
476
- * Page Metadata
477
- */
478
- interface PageMetadata {
479
- canonical?: string;
480
- description?: string;
481
- keywords?: string | string[];
482
- image?: {
483
- url?: string;
484
- };
485
- favicon?: {
486
- url?: string;
487
- };
488
- rssUrl?: string;
489
- atomUrl?: string;
490
- microformats?: Record<string, unknown>[];
491
- }
492
- interface AuthorElement {
493
- name?: TextElement;
494
- avatar?: {
495
- url?: string;
496
- };
429
+ interface ViewerTheme extends StoryTheme {
430
+ logo?: ImageMedia;
497
431
  }
498
432
  interface Visitor {
499
433
  id?: string | number;
500
434
  name?: string;
501
435
  }
502
- interface Badge {
503
- label?: TextElement;
504
- buttonStyle?: BoxStyle;
505
- }
506
- interface CustomAnswer {
507
- active?: boolean;
508
- placeholder?: TextElement;
509
- textStyle?: TextStyle;
510
- boxStyle?: BoxStyle;
511
- }
512
- interface Header {
513
- badge?: Badge;
514
- }
515
- interface Footer {
516
- callToAction?: CallToAction;
517
- }
518
- type Reload = Record<string, unknown>;
519
- interface ClosedCaptions {
520
- file?: ClosedCaptionsMedia;
521
- textStyle?: TextStyle;
522
- boxStyle?: BoxStyle;
523
- }
524
- type ButtonLayout = 'label-bottom' | 'label-top' | 'no-label' | 'label-over' | 'label-left' | 'label-right';
525
-
526
- declare class ColorsParser {
527
- constructor({ fieldsManager, screensManager }: {
528
- fieldsManager: any;
529
- screensManager: any;
530
- });
531
- parse(story: any): any;
532
- getColorFieldPatterns(fields: any, namePrefix?: any): any;
533
- static fieldIsColor({ id }: {
534
- id?: any;
535
- }): boolean;
536
- static getColorsFromPath(data: any, patterns: any, colors?: any, keyPrefix?: any): any;
537
- }
436
+ type TrackingVariables = Record<string, string | number | unknown[]>;
538
437
 
539
438
  declare class ComponentsManager extends EventEmitter {
439
+ components: ComponentsMap;
540
440
  constructor(components?: {});
541
- addComponent(name: any, component: any, namespace?: any): this;
542
- addComponents(components: any, namespace?: any): this;
543
- merge(manager: any, namespace?: any): this;
544
- addNamespace(namespace: any): this;
545
- getComponent(name: any, namespace?: any): any;
546
- getComponents(namespace?: any): any;
547
- hasComponent(name: any, namespace?: any): boolean;
441
+ addComponent(name: string, component: ComponentType, namespace?: string | null): this;
442
+ addComponents(components: ComponentsMap, namespace?: string | null): this;
443
+ merge(manager: ComponentsManager, namespace?: any): this;
444
+ addNamespace(namespace: string | null): this;
445
+ getComponent(name: string, namespace?: string | null): ComponentType;
446
+ getComponents(namespace?: string | null): ComponentsMap;
447
+ hasComponent(name: string, namespace?: string | null): boolean;
548
448
  }
549
449
 
550
- declare class DefinitionsManager extends EventEmitter {
551
- constructor(definitions?: any[]);
552
- addDefinition(definition: any): this;
553
- addDefinitions(definitions: any): this;
554
- merge(manager: any): this;
555
- filter(filter: any): DefinitionsManager;
556
- getDefinition(id: any): any;
557
- getDefinitions(): any;
558
- hasDefinition(id: any): boolean;
559
- getComponent(id: any): any;
560
- getComponents(): any;
450
+ declare class DefinitionsManager<T extends Definition = Definition> extends EventEmitter {
451
+ definitions: T[];
452
+ constructor(definitions?: T[]);
453
+ addDefinition(definition: T | T[]): this;
454
+ addDefinitions(definitions: T[]): this;
455
+ merge(manager: DefinitionsManager<T>): this;
456
+ filter(filter: (definition: T) => boolean): DefinitionsManager<T>;
457
+ getDefinition(id: string): T;
458
+ getDefinitions(): T[];
459
+ hasDefinition(id: string): boolean;
460
+ getComponent(id: string): Component;
461
+ getComponents(): Record<string, Component>;
561
462
  }
562
463
 
563
464
  declare class EventsManager extends EventEmitter {
@@ -568,8 +469,8 @@ declare class EventsManager extends EventEmitter {
568
469
  removeEventListener(event: any): void;
569
470
  }
570
471
 
571
- declare class FieldsManager extends DefinitionsManager {
572
- filter(filter: any): FieldsManager;
472
+ declare class FieldsManager extends DefinitionsManager<FieldDefinition> {
473
+ filter(filter: (definition: FieldDefinition) => boolean): FieldsManager;
573
474
  }
574
475
 
575
476
  declare class MediasParser {
@@ -599,14 +500,19 @@ declare class MediasParser {
599
500
  static keys(obj: any): any[];
600
501
  }
601
502
 
602
- declare class ScreensManager extends DefinitionsManager {
503
+ type ScreensFieldsPattern = {
504
+ fonts?: Record<string, RegExp[]>;
505
+ medias?: Record<string, RegExp[]>;
506
+ };
507
+ declare class ScreensManager extends DefinitionsManager<ScreenDefinition> {
508
+ fieldsPattern: ScreensFieldsPattern | null;
603
509
  constructor(definitions?: any[]);
604
- getFields(id: any): any;
605
- getLayouts(id: any): any;
606
- getFieldsPattern(): any;
607
- setFieldsPattern(fieldsPattern: any): void;
608
- filter(filter: any): ScreensManager;
609
- merge(manager: any): this;
510
+ getFields(id: string): Field[];
511
+ getLayouts(id: string): string[];
512
+ getFieldsPattern(): ScreensFieldsPattern;
513
+ setFieldsPattern(fieldsPattern: ScreensFieldsPattern): void;
514
+ filter(filter: (definition: ScreenDefinition) => boolean): ScreensManager;
515
+ merge(manager: ScreensManager): this;
610
516
  }
611
517
 
612
518
  declare class StoryParser {
@@ -662,4 +568,4 @@ declare class Tracking extends Tracking$1 {
662
568
  }
663
569
 
664
570
  export { ColorsParser, ComponentsManager, DefinitionsManager, EventsManager, FieldsManager, FontsParser, MediasParser, ScreensManager, StoryParser, ThemeParser, Tracking };
665
- export type { ActiveForm, AdFormat, AdFormats, Alternatives, Answer, AudioComponent, AudioElement, AudioMedia, AuthorElement, BackgroundElement, Badge, BootstrapTheme, BorderStyle, BorderType, BoxStyle, Breadcrumb, Button, ButtonLayout, ButtonSize, ButtonTheme, CallToAction, CallToActionType, ClosedCaptions, ClosedCaptionsElement, ClosedCaptionsMedia, Color, ColorObject, Component, ContainerStyle, Conversation, ConversationMessage, CustomAnswer, CustomFont, DefaultMessage, DefaultMessageContent, Device, DeviceScreen, DropdownAlign, Errors, Field, FieldDefinition, Font, FontMedia, FontStyle, Footer, FormControlSize, FormErrors, FormField, GeoPosition, GridElement, GridLayout, GridLayoutItem, Header, HeadingElement, History, ImageElement, ImageElementWithCaption, ImageMedia, InputElement, Interaction, Intl, Label, Location, Margin, Marker, MarkerWithImage, Media, MediaFile, MediaMetadata, MediaType, MenuItem, Message, Metadata, Modal, ObjectFit, ObjectFitSize, PageMetadata, Panel, PaymentItem, Progress, QuizAnswer, Ref, Reload, RenderContext, ScreenComponent, ScreenDefinition, ScreenSize, SearchFilter, SelectOption, ShadowType, ShareIncentive, Slide, Speaker, StackAlign, StackDirection, StackElement, StackSpacing, StatusCode, Story, StoryComponent, Tag, Target, Text, TextAlign, TextElement, TextStyle, Theme, TimingOverrides, TrackingVariables, Transition, TransitionConfig, TransitionEasing, TransitionName, Transitions, User, VideoElement, VideoMedia, ViewerTheme, Visitor, VisualElement };
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 };
package/es/index.js CHANGED
@@ -277,7 +277,7 @@ var ComponentsManager = /*#__PURE__*/function (_EventEmitter) {
277
277
  var pattern = new RegExp("^".concat(namespace, "\\.(.*)$"));
278
278
  var matches = pattern.exec(name);
279
279
  return matches !== null ? _objectSpread(_objectSpread({}, componentsMap), {}, _defineProperty({}, matches[1], _this3.components[name])) : componentsMap;
280
- }, null) : this.components;
280
+ }, {}) : this.components;
281
281
  }
282
282
  }, {
283
283
  key: "hasComponent",
@@ -436,8 +436,6 @@ var FieldsManager = /*#__PURE__*/function (_DefinitionsManager) {
436
436
  key: "filter",
437
437
  value: function filter(_filter) {
438
438
  return new FieldsManager(this.definitions.filter(_filter));
439
- // this.definitions = this.definitions.filter(filter);
440
- // return this;
441
439
  }
442
440
  }]);
443
441
  }(DefinitionsManager);
package/es/utils.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { camelCase, pascalCase, snakeCase } from 'change-case';
2
+ import { ComponentType } from 'react';
2
3
 
3
4
  declare function addNonBreakingSpaces(text: any): any;
4
5
 
@@ -11,6 +12,8 @@ declare const createNullableOnChange: (onChange?: any) => (newValue: any) => voi
11
12
 
12
13
  declare const createUseEvent: (eventsManager: any) => (event: any, callback: any, enabled?: boolean) => void;
13
14
 
15
+ declare function cssEscape(value: string): string;
16
+
14
17
  declare const easings: {
15
18
  linear: (x: any) => any;
16
19
  easeInQuad: (x: any) => number;
@@ -44,7 +47,9 @@ declare const easings: {
44
47
 
45
48
  declare const getColorAsString: (value?: any, overideAlpha?: any) => any;
46
49
 
47
- declare const getComponentFromName: (name: any, components: any, defaultComponent?: any) => any;
50
+ type ComponentsMap = Record<string, ComponentType>;
51
+
52
+ declare const getComponentFromName: (name: string | null, components: ComponentsMap, defaultComponent?: ComponentType | null) => ComponentType | null;
48
53
 
49
54
  declare const getDeviceScreens: () => ({
50
55
  name: string;
@@ -211,4 +216,4 @@ declare const validateFields: (fields: any, value: any) => any;
211
216
 
212
217
  declare const getContrastingColor: (backgroundColor: any) => any;
213
218
 
214
- export { addNonBreakingSpaces, convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, easings, getColorAsString, getComponentFromName, getContrastingColor, getDeviceScreens, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getFontFamily as getFontFamilyFromFont, getFooterProps, getGridLayoutName, largestRemainderRound as getLargestRemainderRound, getLayersFromBackground, getLayoutParts, getMediaFilesAsArray, getOptimalImageUrl, getScreenExtraField, getScreenFieldsWithStates, getSecondsFromTime, getShadowCoords, getStyleFromAlignment, getStyleFromBorder, getStyleFromBox, getStyleFromColor, getStyleFromContainer, getStyleFromHighlight, getStyleFromImage, getStyleFromLink, getStyleFromMargin, getStyleFromText, getVideoSupportedMimes, isFooterFilled, isHeaderFilled, isImageFilled, isIos, isTextFilled$1 as isLabelFilled, isMessage, isTextFilled, isValidUrl, schemaId, setValue as setFieldValue, slug, unique, validateFields };
219
+ export { addNonBreakingSpaces, convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, cssEscape, easings, getColorAsString, getComponentFromName, getContrastingColor, getDeviceScreens, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getFontFamily as getFontFamilyFromFont, getFooterProps, getGridLayoutName, largestRemainderRound as getLargestRemainderRound, getLayersFromBackground, getLayoutParts, getMediaFilesAsArray, getOptimalImageUrl, getScreenExtraField, getScreenFieldsWithStates, getSecondsFromTime, getShadowCoords, getStyleFromAlignment, getStyleFromBorder, getStyleFromBox, getStyleFromColor, getStyleFromContainer, getStyleFromHighlight, getStyleFromImage, getStyleFromLink, getStyleFromMargin, getStyleFromText, getVideoSupportedMimes, isFooterFilled, isHeaderFilled, isImageFilled, isIos, isTextFilled$1 as isLabelFilled, isMessage, isTextFilled, isValidUrl, schemaId, setValue as setFieldValue, slug, unique, validateFields };