@micromag/core 0.4.71 → 0.4.74
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/assets/css/styles.css +0 -1
- package/assets/css/vendor.css +2 -3
- package/es/components.d.ts +99 -56
- package/es/components.js +5098 -2330
- package/es/contexts.d.ts +139 -67
- package/es/contexts.js +2183 -1239
- package/es/hooks.d.ts +28 -72
- package/es/hooks.js +2515 -2145
- package/es/index.d.ts +51 -8
- package/es/index.js +1284 -1525
- package/es/styles.css +0 -1
- package/es/utils.d.ts +155 -15
- package/es/utils.js +739 -888
- package/package.json +36 -40
- package/lib/components.js +0 -3404
- package/lib/contexts.js +0 -1762
- package/lib/hooks.js +0 -2532
- package/lib/index.js +0 -1713
- package/lib/styles.css +0 -35
- package/lib/utils.js +0 -1300
package/es/styles.css
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
.micromag-core-buttons-button-container .micromag-core-buttons-button-icon{display:block;position:relative}.micromag-core-buttons-button-container .micromag-core-buttons-button-icon,.micromag-core-buttons-button-container .micromag-core-buttons-button-label{-webkit-transition:-webkit-transform .3s "ease-out";transition:-webkit-transform .3s "ease-out";transition:transform .3s "ease-out";transition:transform .3s "ease-out",-webkit-transform .3s "ease-out";-webkit-transition:-webkit-transform .3s var(--mm-ease-out-ramp,"ease-out");transition:-webkit-transform .3s var(--mm-ease-out-ramp,"ease-out");transition:transform .3s var(--mm-ease-out-ramp,"ease-out");transition:transform .3s var(--mm-ease-out-ramp,"ease-out"),-webkit-transform .3s var(--mm-ease-out-ramp,"ease-out")}.micromag-core-buttons-button-container.micromag-core-buttons-button-withoutStyle{color:inherit}.micromag-core-buttons-button-container.micromag-core-buttons-button-asLink,.micromag-core-buttons-button-container.micromag-core-buttons-button-withoutStyle{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:0;cursor:pointer;display:inline-block;font-family:inherit;padding:0;position:relative}.micromag-core-buttons-button-container.micromag-core-buttons-button-asLink{color:#a13dff;color:var(--mm-primary,#a13dff);font-weight:700}.micromag-core-buttons-button-container.micromag-core-buttons-button-withIcon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}.micromag-core-buttons-button-container.micromag-core-buttons-button-withIcon .micromag-core-buttons-button-label{margin-left:.5em;-webkit-transform-origin:0 50%;-ms-transform-origin:0 50%;transform-origin:0 50%}.micromag-core-buttons-button-container.micromag-core-buttons-button-withIcon .micromag-core-buttons-button-right{margin-left:.5em}.micromag-core-buttons-button-container.micromag-core-buttons-button-withIcon.micromag-core-buttons-button-withAnimations.micromag-core-buttons-button-icon-right .micromag-core-buttons-button-label{-webkit-transform-origin:100% 50%;-ms-transform-origin:100% 50%;transform-origin:100% 50%}.micromag-core-buttons-button-container.micromag-core-buttons-button-withIconColumns{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}.micromag-core-buttons-button-container.micromag-core-buttons-button-linkDisabled{opacity:.4;pointer-events:none;-webkit-text-decoration:none;text-decoration:none}.micromag-core-buttons-button-container:focus-visible{-webkit-box-shadow:0 0 2px 0 #fff;box-shadow:0 0 2px 0 #fff;-webkit-box-shadow:0 0 2px 0 var(--micromag-focus-color,#fff);box-shadow:0 0 2px 0 var(--micromag-focus-color,#fff);outline:2px solid #000}
|
|
2
|
-
|
|
3
2
|
.micromag-core-buttons-clear-container{display:inline-block;display:-ms-flexbox!important;display:flex!important;height:18px!important;position:relative;width:18px!important;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;background-color:#ddd!important;background-color:var(--mm-gray-700,#ddd)!important;border:0;border-radius:4px;color:inherit;cursor:pointer;font-family:inherit;justify-content:center;padding:0;padding:0 10px!important}.micromag-core-buttons-clear-container .micromag-core-buttons-clear-icon{display:block}
|
|
4
3
|
.micromag-core-forms-form-actions{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;margin-top:10px;margin-top:calc(var(--mm-spacer, 5px)*2)}.micromag-core-forms-form-actions.micromag-core-forms-form-left{-ms-flex-pack:start;justify-content:flex-start}.micromag-core-forms-form-actions.micromag-core-forms-form-right{-ms-flex-pack:end;justify-content:flex-end}
|
|
5
4
|
.micromag-core-partials-link-withoutStyle{color:inherit;-webkit-text-decoration:none;text-decoration:none}.micromag-core-partials-link-withoutStyle:hover{color:inherit;-webkit-text-decoration:none;text-decoration:none}
|
package/es/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { camelCase, pascalCase, snakeCase } from 'change-case';
|
|
2
|
-
import { ComponentType, ForwardedRef } from 'react';
|
|
2
|
+
import { ElementType, ComponentType, ForwardedRef } from 'react';
|
|
3
|
+
import { MessageDescriptor } from 'react-intl';
|
|
3
4
|
|
|
4
5
|
declare function addNonBreakingSpaces(text: any): any;
|
|
5
6
|
|
|
@@ -45,11 +46,120 @@ declare const easings: {
|
|
|
45
46
|
easeInOutElastic: (x: any) => number;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
type MediaElement = HTMLVideoElement | HTMLAudioElement | HTMLMediaElement;
|
|
50
|
+
/**
|
|
51
|
+
* Medias
|
|
52
|
+
*/
|
|
53
|
+
interface MediaMetadata {
|
|
54
|
+
filename?: string;
|
|
55
|
+
size?: number;
|
|
56
|
+
mime?: string;
|
|
57
|
+
}
|
|
58
|
+
interface MediaFile {
|
|
59
|
+
id?: string;
|
|
60
|
+
handle?: string;
|
|
61
|
+
type?: string;
|
|
62
|
+
mime?: string;
|
|
63
|
+
url: string;
|
|
64
|
+
}
|
|
65
|
+
interface Media {
|
|
66
|
+
id?: string;
|
|
67
|
+
type: string;
|
|
68
|
+
url: string;
|
|
69
|
+
thumbnail_url?: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
metadata?: MediaMetadata;
|
|
72
|
+
files?: Record<string, MediaFile>;
|
|
73
|
+
}
|
|
74
|
+
interface ImageMedia extends Omit<Media, 'type' | 'metadata'> {
|
|
75
|
+
type?: 'image' | 'video';
|
|
76
|
+
metadata?: MediaMetadata & {
|
|
77
|
+
width?: number;
|
|
78
|
+
height?: number;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
interface FontMedia extends Omit<Media, 'type'> {
|
|
82
|
+
type?: 'font';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type ComponentsMap = Record<string, ElementType>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Style
|
|
89
|
+
*/
|
|
90
|
+
interface CustomFont {
|
|
91
|
+
type?: 'system' | 'google' | 'custom';
|
|
92
|
+
name?: string;
|
|
93
|
+
media?: FontMedia;
|
|
94
|
+
variants?: string[] | {
|
|
95
|
+
fvd?: string;
|
|
96
|
+
weight?: number;
|
|
97
|
+
style?: string;
|
|
98
|
+
}[];
|
|
99
|
+
}
|
|
100
|
+
type Font = CustomFont | string;
|
|
101
|
+
type TextAlign = 'left' | 'right' | 'center';
|
|
102
|
+
interface ColorObject {
|
|
103
|
+
color?: string;
|
|
104
|
+
alpha?: number;
|
|
105
|
+
}
|
|
106
|
+
type Color = ColorObject | string;
|
|
107
|
+
interface FontStyle {
|
|
108
|
+
bold?: boolean;
|
|
109
|
+
italic?: boolean;
|
|
110
|
+
underline?: boolean;
|
|
111
|
+
upperCase?: boolean;
|
|
112
|
+
}
|
|
113
|
+
interface TextStyle {
|
|
114
|
+
fontFamily?: Font;
|
|
115
|
+
fontSize?: number;
|
|
116
|
+
fontStyle?: FontStyle;
|
|
117
|
+
align?: TextAlign;
|
|
118
|
+
color?: Color;
|
|
119
|
+
letterSpacing?: number;
|
|
120
|
+
lineHeight?: number;
|
|
121
|
+
}
|
|
122
|
+
type BorderType = 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | 'hidden';
|
|
123
|
+
interface ShadowType {
|
|
124
|
+
shadowDistance?: number;
|
|
125
|
+
shadowBlur?: number;
|
|
126
|
+
shadowColor?: Color;
|
|
127
|
+
}
|
|
128
|
+
interface BoxStyle {
|
|
129
|
+
backgroundColor?: Color;
|
|
130
|
+
borderRadius?: number;
|
|
131
|
+
borderWidth?: number;
|
|
132
|
+
borderColor?: Color;
|
|
133
|
+
borderStyle?: BorderType;
|
|
134
|
+
shadow?: ShadowType;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type CallToActionType = 'swipe-up' | 'button';
|
|
138
|
+
interface CallToAction {
|
|
139
|
+
active?: boolean;
|
|
140
|
+
type?: CallToActionType;
|
|
141
|
+
url?: string;
|
|
142
|
+
label?: TextElement;
|
|
143
|
+
buttonStyle?: BoxStyle;
|
|
144
|
+
}
|
|
145
|
+
interface TextElement {
|
|
146
|
+
body?: string;
|
|
147
|
+
textStyle?: TextStyle;
|
|
148
|
+
}
|
|
149
|
+
interface Badge {
|
|
150
|
+
label?: TextElement;
|
|
151
|
+
buttonStyle?: BoxStyle;
|
|
152
|
+
}
|
|
153
|
+
interface Header {
|
|
154
|
+
badge?: Badge;
|
|
155
|
+
}
|
|
156
|
+
interface Footer {
|
|
157
|
+
callToAction?: CallToAction;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare const getColorAsString: (value?: Color | null, overideAlpha?: any) => any;
|
|
161
|
+
|
|
162
|
+
declare const getComponentFromName: (name: string | null, components: ComponentsMap, defaultComponent?: ComponentType | null) => ElementType | null;
|
|
53
163
|
|
|
54
164
|
declare const getDeviceScreens: () => ({
|
|
55
165
|
name: string;
|
|
@@ -72,15 +182,26 @@ declare const getFileName: (url?: any) => any;
|
|
|
72
182
|
|
|
73
183
|
declare const getFontFamily: (value: any) => string;
|
|
74
184
|
|
|
75
|
-
declare
|
|
185
|
+
declare function getFooterProps(footer?: Footer | null, { isPreview, isView, current, openWebView, enableInteraction, disableInteraction, ...otherProps }?: {
|
|
76
186
|
isPreview?: boolean;
|
|
77
187
|
isView?: boolean;
|
|
78
188
|
current?: boolean;
|
|
79
189
|
openWebView?: boolean;
|
|
80
190
|
enableInteraction?: boolean;
|
|
81
191
|
disableInteraction?: boolean;
|
|
82
|
-
})
|
|
83
|
-
callToAction:
|
|
192
|
+
}): {
|
|
193
|
+
callToAction: {
|
|
194
|
+
animationDisabled: boolean;
|
|
195
|
+
focusable: boolean;
|
|
196
|
+
openWebView: boolean;
|
|
197
|
+
enableInteraction: boolean;
|
|
198
|
+
disableInteraction: boolean;
|
|
199
|
+
active?: boolean;
|
|
200
|
+
type?: CallToActionType;
|
|
201
|
+
url?: string;
|
|
202
|
+
label?: TextElement;
|
|
203
|
+
buttonStyle?: BoxStyle;
|
|
204
|
+
};
|
|
84
205
|
};
|
|
85
206
|
|
|
86
207
|
declare const getGridLayoutName: (layout: any) => any;
|
|
@@ -91,6 +212,14 @@ declare const getLayersFromBackground: (background?: any) => any;
|
|
|
91
212
|
|
|
92
213
|
declare const getMediaFilesAsArray: (files: any) => any;
|
|
93
214
|
|
|
215
|
+
declare function getMediaThumbnail(media: any, thumbnail?: MediaFile | ImageMedia | string): {
|
|
216
|
+
metadata?: {
|
|
217
|
+
width?: number;
|
|
218
|
+
height?: number;
|
|
219
|
+
};
|
|
220
|
+
url: string;
|
|
221
|
+
} | null;
|
|
222
|
+
|
|
94
223
|
declare const getOptimalImageUrl: (media?: any, containerWidth?: any, containerHeight?: any, { resolution, maxDiff, supportsWebp }?: {
|
|
95
224
|
resolution?: number;
|
|
96
225
|
maxDiff?: number;
|
|
@@ -138,7 +267,7 @@ declare const getStyleFromBox: (value: any) => {
|
|
|
138
267
|
borderRadius: any;
|
|
139
268
|
};
|
|
140
269
|
|
|
141
|
-
declare const getStyleFromColor: (value?:
|
|
270
|
+
declare const getStyleFromColor: (value?: Color | null, property?: string, overideAlpha?: any) => {
|
|
142
271
|
[x: string]: any;
|
|
143
272
|
};
|
|
144
273
|
|
|
@@ -197,11 +326,11 @@ declare const getLayoutParts: (layout?: any) => {
|
|
|
197
326
|
suffix: any;
|
|
198
327
|
};
|
|
199
328
|
|
|
200
|
-
declare const isHeaderFilled: (header?:
|
|
329
|
+
declare const isHeaderFilled: (header?: Header | null) => boolean;
|
|
201
330
|
|
|
202
|
-
declare const isFooterFilled: (footer?:
|
|
331
|
+
declare const isFooterFilled: (footer?: Footer | null) => boolean;
|
|
203
332
|
|
|
204
|
-
declare
|
|
333
|
+
declare function isMessage(message: MessageDescriptor | unknown): message is MessageDescriptor;
|
|
205
334
|
|
|
206
335
|
declare const isIos: () => boolean;
|
|
207
336
|
|
|
@@ -225,6 +354,17 @@ declare const unique: (arrArg: any) => any;
|
|
|
225
354
|
|
|
226
355
|
declare const validateFields: (fields: any, value: any) => any;
|
|
227
356
|
|
|
228
|
-
declare const getContrastingColor: (backgroundColor:
|
|
357
|
+
declare const getContrastingColor: (backgroundColor: Color | null) => any;
|
|
358
|
+
|
|
359
|
+
declare function getMediaCurrentTime(media: MediaElement | null, tsOffset?: number): number;
|
|
360
|
+
declare function getMediaDuration(media: MediaElement | null, tsOffset?: number): number;
|
|
361
|
+
declare function getMediaTimestampOffset(media: MediaElement | null, attributeName?: string): number;
|
|
362
|
+
declare function getMediaIsMuted(media: MediaElement | null): boolean;
|
|
363
|
+
declare function getMediaIsPlaying(media: MediaElement | null): boolean;
|
|
364
|
+
declare function getMediaIsBuffering(media: MediaElement | null): boolean;
|
|
365
|
+
declare function getMediaIsReady(media: MediaElement | null): boolean;
|
|
366
|
+
declare function getMediaSrc(media: MediaElement | null): string | null;
|
|
367
|
+
declare function getMediaHasAudio(media: MediaElement | null): boolean;
|
|
368
|
+
declare function getMediaFilename(src: string | null): string | null;
|
|
229
369
|
|
|
230
|
-
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, mergeRefs, schemaId, setValue as setFieldValue, slug, unique, validateFields };
|
|
370
|
+
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, getMediaCurrentTime, getMediaDuration, getMediaFilename, getMediaFilesAsArray, getMediaHasAudio, getMediaIsBuffering, getMediaIsMuted, getMediaIsPlaying, getMediaIsReady, getMediaSrc, getMediaThumbnail, getMediaTimestampOffset, 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, mergeRefs, schemaId, setValue as setFieldValue, slug, unique, validateFields };
|