@getcortexlabs/mavis-web 0.1.0-alpha.1 → 0.1.0-alpha.3
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/README.md +3 -3
- package/dist/appearance.d.ts +4 -0
- package/dist/appearance.d.ts.map +1 -0
- package/dist/appearance.js +23 -0
- package/dist/appearance.js.map +1 -0
- package/dist/components/MButton.d.ts +25 -7
- package/dist/components/MButton.d.ts.map +1 -1
- package/dist/components/MButton.js +30 -3
- package/dist/components/MButton.js.map +1 -1
- package/dist/components/MIcon.d.ts +55 -0
- package/dist/components/MIcon.d.ts.map +1 -0
- package/dist/components/MIcon.js +31 -0
- package/dist/components/MIcon.js.map +1 -0
- package/dist/components/MInput.d.ts +31 -13
- package/dist/components/MInput.d.ts.map +1 -1
- package/dist/components/MInput.js +87 -65
- package/dist/components/MInput.js.map +1 -1
- package/dist/components/MScreen.d.ts +9 -0
- package/dist/components/MScreen.d.ts.map +1 -1
- package/dist/components/MScreen.js +17 -0
- package/dist/components/MScreen.js.map +1 -1
- package/dist/components/MSheet.d.ts +96 -0
- package/dist/components/MSheet.d.ts.map +1 -0
- package/dist/components/MSheet.js +238 -0
- package/dist/components/MSheet.js.map +1 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/style.d.ts.map +1 -1
- package/dist/style.js +24 -9
- package/dist/style.js.map +1 -1
- package/package.json +2 -2
- package/src/appearance.ts +23 -0
- package/src/components/MButton.ts +41 -3
- package/src/components/MIcon.ts +39 -0
- package/src/components/MInput.ts +88 -64
- package/src/components/MScreen.ts +14 -0
- package/src/components/MSheet.ts +268 -0
- package/src/fonts/LICENSE +45 -0
- package/src/fonts/lucide.woff2 +0 -0
- package/src/index.ts +37 -6
- package/src/style.css +87 -0
- package/src/style.ts +20 -9
package/src/style.css
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: 'lucide';
|
|
3
|
+
src: url('./fonts/lucide.woff2') format('woff2');
|
|
4
|
+
font-weight: normal;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
font-display: block;
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
.m-screen {
|
|
2
10
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
3
11
|
-webkit-font-smoothing: antialiased;
|
|
@@ -137,3 +145,82 @@
|
|
|
137
145
|
-webkit-text-fill-color: currentColor;
|
|
138
146
|
opacity: 1;
|
|
139
147
|
}
|
|
148
|
+
|
|
149
|
+
.m-icon {
|
|
150
|
+
font-style: normal;
|
|
151
|
+
font-weight: normal;
|
|
152
|
+
font-variant: normal;
|
|
153
|
+
text-transform: none;
|
|
154
|
+
user-select: none;
|
|
155
|
+
-webkit-font-smoothing: antialiased;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.m-sheet {
|
|
159
|
+
position: fixed;
|
|
160
|
+
inset: auto 0 0 0;
|
|
161
|
+
width: 100%;
|
|
162
|
+
max-width: 560px;
|
|
163
|
+
max-height: calc(100dvh - 24px);
|
|
164
|
+
margin: 0 auto;
|
|
165
|
+
padding: 0;
|
|
166
|
+
border: 0;
|
|
167
|
+
border-radius: var(--m-sheet-radius) var(--m-sheet-radius) 0 0;
|
|
168
|
+
background: var(--m-sheet-surface);
|
|
169
|
+
overflow: hidden;
|
|
170
|
+
translate: 0 100%;
|
|
171
|
+
transition: translate 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.m-sheet[open] {
|
|
175
|
+
display: flex;
|
|
176
|
+
flex-direction: column;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.m-sheet:focus {
|
|
180
|
+
outline: none;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.m-sheet.m-sheet-open {
|
|
184
|
+
translate: 0 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.m-sheet::backdrop {
|
|
188
|
+
background: rgba(0, 0, 0, 0);
|
|
189
|
+
transition: background-color 240ms ease-out;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.m-sheet.m-sheet-open::backdrop {
|
|
193
|
+
background: rgba(0, 0, 0, 0.45);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.m-sheet-full {
|
|
197
|
+
max-width: none;
|
|
198
|
+
max-height: none;
|
|
199
|
+
height: 100dvh;
|
|
200
|
+
border-radius: 0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.m-sheet-panel {
|
|
204
|
+
display: flex;
|
|
205
|
+
flex: 1;
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
min-height: 0;
|
|
208
|
+
box-sizing: border-box;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.m-sheet-body {
|
|
212
|
+
min-height: 0;
|
|
213
|
+
overflow: auto;
|
|
214
|
+
overscroll-behavior: contain;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
html:has(.m-sheet[open]) {
|
|
218
|
+
overflow: hidden;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@media (prefers-reduced-motion: reduce) {
|
|
222
|
+
.m-sheet,
|
|
223
|
+
.m-sheet::backdrop {
|
|
224
|
+
transition: none;
|
|
225
|
+
}
|
|
226
|
+
}
|
package/src/style.ts
CHANGED
|
@@ -12,21 +12,32 @@ export function length(value: number | string | undefined) {
|
|
|
12
12
|
return typeof value === 'number' ? `${value}px` : value
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
// A prop that was not given leaves its style untouched, so the host's CSS keeps applying.
|
|
15
16
|
export function boxStyle(theme: MavisTheme, props: BoxProps, defaultShrink = 0): CSSProperties {
|
|
16
|
-
const
|
|
17
|
-
const x = props.paddingX === undefined ? padding : resolveSpace(theme, props.paddingX)
|
|
18
|
-
const y = props.paddingY === undefined ? padding : resolveSpace(theme, props.paddingY)
|
|
19
|
-
return {
|
|
17
|
+
const style: CSSProperties = {
|
|
20
18
|
boxSizing: 'border-box',
|
|
21
|
-
padding: `${y}px ${x}px`,
|
|
22
|
-
borderRadius: length(resolveRadius(theme, props.radius)),
|
|
23
19
|
flexGrow: nonNegative(props.grow, 'grow'),
|
|
24
20
|
flexShrink: nonNegative(props.shrink ?? defaultShrink, 'shrink'),
|
|
25
21
|
minWidth: 0,
|
|
26
|
-
width: length(resolveDimension(props.width)),
|
|
27
|
-
height: length(resolveDimension(props.height)),
|
|
28
|
-
backgroundColor: props.backgroundColor,
|
|
29
22
|
}
|
|
23
|
+
const padding = props.padding === undefined ? undefined : resolveSpace(theme, props.padding)
|
|
24
|
+
const x = props.paddingX === undefined ? padding : resolveSpace(theme, props.paddingX)
|
|
25
|
+
const y = props.paddingY === undefined ? padding : resolveSpace(theme, props.paddingY)
|
|
26
|
+
if (x !== undefined) {
|
|
27
|
+
style.paddingLeft = `${x}px`
|
|
28
|
+
style.paddingRight = `${x}px`
|
|
29
|
+
}
|
|
30
|
+
if (y !== undefined) {
|
|
31
|
+
style.paddingTop = `${y}px`
|
|
32
|
+
style.paddingBottom = `${y}px`
|
|
33
|
+
}
|
|
34
|
+
if (props.radius !== undefined) style.borderRadius = length(resolveRadius(theme, props.radius))
|
|
35
|
+
const width = length(resolveDimension(props.width))
|
|
36
|
+
if (width !== undefined) style.width = width
|
|
37
|
+
const height = length(resolveDimension(props.height))
|
|
38
|
+
if (height !== undefined) style.height = height
|
|
39
|
+
if (props.backgroundColor !== undefined) style.backgroundColor = props.backgroundColor
|
|
40
|
+
return style
|
|
30
41
|
}
|
|
31
42
|
|
|
32
43
|
/** Native accessibility labels have the same meaning on the DOM renderer. */
|