@apple-pie/slice-native 0.1.2 → 0.1.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.
@@ -2,6 +2,7 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
2
  import { memo } from 'react';
3
3
  import { useColorScheme } from 'react-native';
4
4
  import Svg, { Polygon, Rect, Path, Line, Circle, G, Defs, ClipPath, Use, Polyline } from 'react-native-svg';
5
+ export { createTypography, darkTheme, lightTheme } from './theme.mjs';
5
6
 
6
7
  /**
7
8
  * Static icon registry created once at module load.
@@ -0,0 +1,585 @@
1
+ const coreColors$1 = {
2
+ 'brand-grey-50': '#f4f7fa',
3
+ 'brand-grey-100': '#e5ecf3',
4
+ 'brand-grey-200': '#d5e0ea',
5
+ 'brand-grey-300': '#98acbf',
6
+ 'brand-grey-400': '#7f96a9',
7
+ 'brand-grey-500': '#657d91',
8
+ 'brand-grey-600': '#4c6273',
9
+ 'brand-grey-700': '#405261',
10
+ 'brand-grey-800': '#37434e',
11
+ 'brand-grey-900': '#2d353d',
12
+ 'brand-grey-950': '#1f262d',
13
+ 'brand-sea-50': '#e8f1ff',
14
+ 'brand-sea-100': '#c7defe',
15
+ 'brand-sea-200': '#a5c9ff',
16
+ 'brand-sea-300': '#7ab3ff',
17
+ 'brand-sea-400': '#4084ff',
18
+ 'brand-sea-500': '#2f45ff',
19
+ 'brand-sea-600': '#2d2fff',
20
+ 'brand-sea-700': '#0000ff',
21
+ 'brand-sea-800': '#0609cd',
22
+ 'brand-sea-900': '#001699',
23
+ 'brand-sea-950': '#0a0b5c',
24
+ 'brand-sky-50': '#eafffe',
25
+ 'brand-sky-100': '#cdfffb',
26
+ 'brand-sky-200': '#a3f8ff',
27
+ 'brand-sky-300': '#6af5ff',
28
+ 'brand-sky-400': '#00edff',
29
+ 'brand-sky-500': '#00c8e0',
30
+ 'brand-sky-600': '#00a6c0',
31
+ 'brand-sky-700': '#03839b',
32
+ 'brand-sky-800': '#0d697d',
33
+ 'brand-sky-900': '#105669',
34
+ 'brand-sky-950': '#033949',
35
+ 'brand-land-50': '#f4ffe5',
36
+ 'brand-land-100': '#e0ffb7',
37
+ 'brand-land-200': '#caff95',
38
+ 'brand-land-300': '#b7fe59',
39
+ 'brand-land-400': '#9cf820',
40
+ 'brand-land-500': '#71e618',
41
+ 'brand-land-600': '#56c900',
42
+ 'brand-land-700': '#2d8c00',
43
+ 'brand-land-800': '#31690b',
44
+ 'brand-land-900': '#2a580f',
45
+ 'brand-land-950': '#123201',
46
+ 'brand-orange-50': '#fff8ec',
47
+ 'brand-orange-100': '#ffebd7',
48
+ 'brand-orange-200': '#ffe3c6',
49
+ 'brand-orange-300': '#ffc182',
50
+ 'brand-orange-400': '#ff972e',
51
+ 'brand-orange-500': '#ff800a',
52
+ 'brand-orange-600': '#ff6700',
53
+ 'brand-orange-700': '#ff3700',
54
+ 'brand-orange-800': '#a02b0b',
55
+ 'brand-orange-900': '#80250b',
56
+ 'brand-orange-950': '#461604',
57
+ 'brand-yellow-50': '#ffffea',
58
+ 'brand-yellow-100': '#fffdca',
59
+ 'brand-yellow-200': '#fff2a0',
60
+ 'brand-yellow-300': '#ffeb72',
61
+ 'brand-yellow-400': '#ffd333',
62
+ 'brand-yellow-500': '#ffc200',
63
+ 'brand-yellow-600': '#ffad00',
64
+ 'brand-yellow-700': '#c68601',
65
+ 'brand-yellow-800': '#8f6307',
66
+ 'brand-yellow-900': '#5f430a',
67
+ 'brand-yellow-950': '#442e00',
68
+ 'brand-purple-50': '#faf0ff',
69
+ 'brand-purple-100': '#f4ddff',
70
+ 'brand-purple-200': '#e5cdff',
71
+ 'brand-purple-300': '#ccafff',
72
+ 'brand-purple-400': '#b891ff',
73
+ 'brand-purple-500': '#7d48ff',
74
+ 'brand-purple-600': '#6a14ff',
75
+ 'brand-purple-700': '#5600f1',
76
+ 'brand-purple-800': '#4d01d6',
77
+ 'brand-purple-900': '#4003af',
78
+ 'brand-purple-950': '#1e007c',
79
+ 'brand-magenta-50': '#fef1fc',
80
+ 'brand-magenta-100': '#ffdcef',
81
+ 'brand-magenta-200': '#ffcae6',
82
+ 'brand-magenta-300': '#ff90cb',
83
+ 'brand-magenta-400': '#ff61ca',
84
+ 'brand-magenta-500': '#ff3ac2',
85
+ 'brand-magenta-600': '#f012aa',
86
+ 'brand-magenta-700': '#df059b',
87
+ 'brand-magenta-800': '#9b0069',
88
+ 'brand-magenta-900': '#790a55',
89
+ 'brand-magenta-950': '#58003a',
90
+ 'brand-white-0': '#ffffff',
91
+ 'product-red-400': '#ff474a',
92
+ 'product-red-500': '#df0529',
93
+ 'core-drop-shadow-light': '#0339491a',
94
+ 'core-drop-shadow-dark': '#0000007a',
95
+ 'core-surface-coverup-translucent-light': '#1f262d52',
96
+ 'core-surface-coverup-translucent-dark': '#0000007a',
97
+ 'core-surface-overlay-translucent-light': '#ffffffcc',
98
+ 'core-surface-overlay-translucent-dark': '#1f262dcc',
99
+ 'surface-primary-tint-light': '#fcfcfc',
100
+ 'surface-primary-tint-dark': '#191e24',
101
+ 'scroll-bar-light': '#e3e8ef',
102
+ 'scroll-bar-dark': 'rgba(255, 255, 255, 0.1)',
103
+ 'scroll-bar-hover-light': '#cdd5df',
104
+ 'scroll-bar-hover-dark': 'rgba(255, 255, 255, 0.15)',
105
+ 'surface-shadow-soft-light': '0px 4px 24px #0339491a',
106
+ 'surface-shadow-soft-dark': '0px 4px 24px #0000007a',
107
+ 'surface-shadow-strong-light': '0px 4px 64px #0339491a',
108
+ 'surface-shadow-strong-dark': '0px 4px 64px #0000007a',
109
+ };
110
+ const light = {
111
+ 'array-land': coreColors$1['brand-land-100'],
112
+ 'array-land-label': coreColors$1['brand-land-600'],
113
+ 'array-magenta': coreColors$1['brand-magenta-100'],
114
+ 'array-magenta-label': coreColors$1['brand-magenta-600'],
115
+ 'array-orange': coreColors$1['brand-orange-100'],
116
+ 'array-orange-label': coreColors$1['brand-orange-600'],
117
+ 'array-purple': coreColors$1['brand-purple-100'],
118
+ 'array-purple-label': coreColors$1['brand-purple-600'],
119
+ 'array-sea': coreColors$1['brand-sea-100'],
120
+ 'array-sea-label': coreColors$1['brand-sea-600'],
121
+ 'array-sky': coreColors$1['brand-sky-100'],
122
+ 'array-sky-label': coreColors$1['brand-sky-600'],
123
+ 'array-yellow': coreColors$1['brand-yellow-100'],
124
+ 'array-yellow-label': coreColors$1['brand-yellow-600'],
125
+ 'core-badge-primary': coreColors$1['brand-sea-500'],
126
+ 'core-badge-secondary': coreColors$1['brand-grey-100'],
127
+ 'core-button-disabled': coreColors$1['brand-grey-50'],
128
+ 'core-button-primary': coreColors$1['brand-sea-500'],
129
+ 'core-drop-shadow': coreColors$1['core-drop-shadow-light'],
130
+ 'core-gp-logo-primary': coreColors$1['brand-sea-700'],
131
+ 'core-gp-logo-secondary': coreColors$1['brand-grey-950'],
132
+ 'core-icon-dark': coreColors$1['brand-grey-950'],
133
+ 'core-icon-disabled': coreColors$1['brand-grey-300'],
134
+ 'core-icon-error': coreColors$1['product-red-500'],
135
+ 'core-icon-light': coreColors$1['brand-white-0'],
136
+ 'core-icon-primary': coreColors$1['brand-grey-950'],
137
+ 'core-icon-secondary': coreColors$1['brand-grey-700'],
138
+ 'core-icon-tertiary': coreColors$1['brand-sea-500'],
139
+ 'core-outline-secondary': coreColors$1['brand-grey-100'],
140
+ 'core-outline-primary': coreColors$1['brand-grey-100'],
141
+ 'core-outline-special': coreColors$1['brand-sea-100'],
142
+ 'core-outline-tertiary': coreColors$1['brand-sea-500'],
143
+ 'core-surface-coverup-translucent': coreColors$1['core-surface-coverup-translucent-light'],
144
+ 'core-surface-overlay-translucent': coreColors$1['core-surface-overlay-translucent-light'],
145
+ 'core-surface-primary': coreColors$1['brand-white-0'],
146
+ 'core-surface-primary-tint': coreColors$1['surface-primary-tint-light'],
147
+ 'core-surface-secondary': coreColors$1['brand-grey-50'],
148
+ 'core-surface-special': coreColors$1['brand-sea-50'],
149
+ 'core-text-dark': coreColors$1['brand-grey-950'],
150
+ 'core-text-disabled': coreColors$1['brand-grey-300'],
151
+ 'core-text-error': coreColors$1['product-red-500'],
152
+ 'core-text-light': coreColors$1['brand-white-0'],
153
+ 'core-text-primary': coreColors$1['brand-grey-950'],
154
+ 'core-text-secondary': coreColors$1['brand-grey-700'],
155
+ 'core-text-tertiary': coreColors$1['brand-grey-600'],
156
+ 'core-text-special': coreColors$1['brand-sea-500'],
157
+ 'core-text-accent': coreColors$1['brand-sky-500'],
158
+ 'core-link-primary': coreColors$1['brand-sea-500'],
159
+ 'eor-tag-employee': coreColors$1['brand-sky-700'],
160
+ 'eor-tag-overdue': coreColors$1['product-red-500'],
161
+ 'eor-tag-paid': coreColors$1['brand-land-700'],
162
+ 'eor-tag-pending': coreColors$1['brand-orange-500'],
163
+ 'eor-tag-professional': coreColors$1['brand-sea-500'],
164
+ 'feedback-attention': coreColors$1['brand-yellow-500'],
165
+ 'feedback-informative': coreColors$1['brand-sky-700'],
166
+ 'feedback-positive': coreColors$1['brand-land-700'],
167
+ 'feedback-urgency': coreColors$1['brand-orange-500'],
168
+ 'feedback-warning': coreColors$1['product-red-500'],
169
+ 'gia-tag-risk-high': coreColors$1['product-red-500'],
170
+ 'gia-tag-risk-low': coreColors$1['brand-sky-700'],
171
+ 'gia-tag-risk-moderate': coreColors$1['brand-orange-500'],
172
+ 'gia-text-excerpt-highlight': coreColors$1['brand-orange-100'],
173
+ 'gia-text-selection': coreColors$1['brand-sea-100'],
174
+ 'scroll-bar': coreColors$1['scroll-bar-light'],
175
+ 'scroll-bar-hover': coreColors$1['scroll-bar-hover-light'],
176
+ 'surface-shadow-soft': coreColors$1['surface-shadow-soft-light'],
177
+ 'surface-shadow-strong': coreColors$1['surface-shadow-strong-light'],
178
+ };
179
+ const dark = {
180
+ 'array-land': coreColors$1['brand-land-100'],
181
+ 'array-land-label': coreColors$1['brand-land-600'],
182
+ 'array-magenta': coreColors$1['brand-magenta-100'],
183
+ 'array-magenta-label': coreColors$1['brand-magenta-600'],
184
+ 'array-orange': coreColors$1['brand-orange-100'],
185
+ 'array-orange-label': coreColors$1['brand-orange-600'],
186
+ 'array-purple': coreColors$1['brand-purple-100'],
187
+ 'array-purple-label': coreColors$1['brand-purple-600'],
188
+ 'array-sea': coreColors$1['brand-sea-100'],
189
+ 'array-sea-label': coreColors$1['brand-sea-600'],
190
+ 'array-sky': coreColors$1['brand-sky-100'],
191
+ 'array-sky-label': coreColors$1['brand-sky-600'],
192
+ 'array-yellow': coreColors$1['brand-yellow-100'],
193
+ 'array-yellow-label': coreColors$1['brand-yellow-600'],
194
+ 'core-badge-primary': coreColors$1['brand-sea-500'],
195
+ 'core-badge-secondary': coreColors$1['brand-grey-700'],
196
+ 'core-button-disabled': coreColors$1['brand-grey-900'],
197
+ 'core-button-primary': coreColors$1['brand-sea-500'],
198
+ 'core-drop-shadow': coreColors$1['core-drop-shadow-dark'],
199
+ 'core-gp-logo-primary': coreColors$1['brand-sea-500'],
200
+ 'core-gp-logo-secondary': coreColors$1['brand-white-0'],
201
+ 'core-icon-dark': coreColors$1['brand-grey-950'],
202
+ 'core-icon-disabled': coreColors$1['brand-grey-500'],
203
+ 'core-icon-error': coreColors$1['product-red-400'],
204
+ 'core-icon-light': coreColors$1['brand-white-0'],
205
+ 'core-icon-primary': coreColors$1['brand-white-0'],
206
+ 'core-icon-secondary': coreColors$1['brand-grey-200'],
207
+ 'core-icon-tertiary': coreColors$1['brand-sky-300'],
208
+ 'core-outline-secondary': coreColors$1['brand-grey-900'],
209
+ 'core-outline-primary': coreColors$1['brand-grey-700'],
210
+ 'core-outline-special': coreColors$1['brand-sky-900'],
211
+ 'core-outline-tertiary': coreColors$1['brand-sky-300'],
212
+ 'core-surface-coverup-translucent': coreColors$1['core-surface-coverup-translucent-dark'],
213
+ 'core-surface-overlay-translucent': coreColors$1['core-surface-overlay-translucent-dark'],
214
+ 'core-surface-primary': coreColors$1['brand-grey-950'],
215
+ 'core-surface-primary-tint': coreColors$1['surface-primary-tint-dark'],
216
+ 'core-surface-secondary': coreColors$1['brand-grey-900'],
217
+ 'core-surface-special': coreColors$1['brand-sky-950'],
218
+ 'core-text-dark': coreColors$1['brand-grey-950'],
219
+ 'core-text-disabled': coreColors$1['brand-grey-500'],
220
+ 'core-text-error': coreColors$1['product-red-400'],
221
+ 'core-text-light': coreColors$1['brand-white-0'],
222
+ 'core-text-primary': coreColors$1['brand-white-0'],
223
+ 'core-text-secondary': coreColors$1['brand-grey-200'],
224
+ 'core-text-tertiary': coreColors$1['brand-grey-400'],
225
+ 'core-text-special': coreColors$1['brand-sky-300'],
226
+ 'core-text-accent': coreColors$1['brand-sky-300'],
227
+ 'core-link-primary': coreColors$1['brand-sky-300'],
228
+ 'eor-tag-employee': coreColors$1['brand-sky-700'],
229
+ 'eor-tag-overdue': coreColors$1['product-red-400'],
230
+ 'eor-tag-paid': coreColors$1['brand-land-700'],
231
+ 'eor-tag-pending': coreColors$1['brand-orange-500'],
232
+ 'eor-tag-professional': coreColors$1['brand-sea-500'],
233
+ 'feedback-attention': coreColors$1['brand-yellow-400'],
234
+ 'feedback-informative': coreColors$1['brand-sky-600'],
235
+ 'feedback-positive': coreColors$1['brand-land-700'],
236
+ 'feedback-urgency': coreColors$1['brand-orange-500'],
237
+ 'feedback-warning': coreColors$1['product-red-400'],
238
+ 'gia-tag-risk-high': coreColors$1['product-red-400'],
239
+ 'gia-tag-risk-low': coreColors$1['brand-sky-600'],
240
+ 'gia-tag-risk-moderate': coreColors$1['brand-orange-500'],
241
+ 'gia-text-excerpt-highlight': coreColors$1['brand-orange-100'],
242
+ 'gia-text-selection': coreColors$1['brand-sea-900'],
243
+ 'scroll-bar': coreColors$1['scroll-bar-dark'],
244
+ 'scroll-bar-hover': coreColors$1['scroll-bar-hover-dark'],
245
+ 'surface-shadow-soft': coreColors$1['surface-shadow-soft-dark'],
246
+ 'surface-shadow-strong': coreColors$1['surface-shadow-strong-dark'],
247
+ };
248
+
249
+ const corners = {
250
+ 'corner-none': 0,
251
+ 'corner-xs': 4,
252
+ 'corner-s': 6,
253
+ 'corner-m': 8,
254
+ 'corner-l': 12,
255
+ 'corner-xl': 16,
256
+ 'corner-xxl': 32,
257
+ 'corner-round': 1000,
258
+ };
259
+
260
+ /**
261
+ * Elevation levels for UI component types
262
+ */
263
+ const elevations = {
264
+ 'elevation-below-surface': -100, // items hidden from view
265
+ 'elevation-surface': 0, // default
266
+ 'elevation-float': 100, // toolbars, fab buttons, etc.
267
+ 'elevation-describe': 200, // tooltips, info, etc.
268
+ 'elevation-status': 300, // status bars, toasts, etc.
269
+ 'elevation-notify': 400, // alerts, and other critical status, etc.
270
+ 'elevation-overlay': 500, // overlay covers, etc.
271
+ 'elevation-confirm': 600, // conformation dialogs, etc. requiring action to dismiss
272
+ };
273
+
274
+ /**
275
+ * Motion for Slice UI
276
+ */
277
+ const motion$1 = {
278
+ 'motion-magnet': 'cubic-bezier(0.352, 0.003, 0.993, -0.052)',
279
+ 'motion-water': 'cubic-bezier(0.36, 0, 0.64, 1)',
280
+ 'motion-spring': 'linear(0, 0.001 0.3%, 0.008 0.7%, 0.034 1.5%, 0.076 2.3%, 0.138 3.2%, 0.275 4.8%, 0.713 9.4%, 0.836 10.9%, 0.933 12.3%, 1.011 13.7%, 1.074 15.2%, 1.096 15.9%, 1.116 16.7%, 1.132 17.5%, 1.142 18.3%, 1.148 19.1%, 1.15 20%, 1.148 21%, 1.142 22%, 1.133 22.9%, 1.12 24%, 1.048 29.1%, 1.015 31.8%, 1.002 33.3%, 0.991 34.9%, 0.983 36.5%, 0.979 38.1%, 0.977 39.9%, 0.979 42%, 0.997 51.7%, 1.003 57.7%, 1 77%, 1)',
281
+ 'motion-magnet-duration': '0.5s',
282
+ 'motion-water-duration': '0.25s',
283
+ 'motion-spring-duration': '1s',
284
+ };
285
+
286
+ const spacing = {
287
+ xxs: 2,
288
+ xs: 4,
289
+ s: 8,
290
+ m: 16,
291
+ l: 24,
292
+ xl: 32,
293
+ xxl: 64,
294
+ h: 128,
295
+ };
296
+
297
+ // base family
298
+ const fontFamily = `var(--slice-font-family, "Funnel Sans")`;
299
+ // base weights
300
+ const fontWeights = {
301
+ regular: 360,
302
+ medium: 420,
303
+ bold: 500,
304
+ extra: 560,
305
+ };
306
+ // base sizes
307
+ const fontSizes = {
308
+ xs: '0.75rem',
309
+ s: '0.875rem',
310
+ m: '0.9375rem',
311
+ l: '1rem',
312
+ xl: '1.0625rem',
313
+ h1: '4.25rem',
314
+ h2: '3.5rem',
315
+ h3: '2.75rem',
316
+ h4: '2rem',
317
+ h5: '1.5rem',
318
+ h6: '1.0625rem',
319
+ };
320
+ // base line heights
321
+ const lineHeights = {
322
+ xs: '116.67%',
323
+ m: '133.33%',
324
+ l: '140%',
325
+ xl: '142.86%',
326
+ xxl: '162.5%',
327
+ };
328
+ // base letter spacing
329
+ const letterSpacings = {
330
+ xs: '0.00625em',
331
+ s: '0.009375em',
332
+ m: '0.0125em',
333
+ l: '0.015625em',
334
+ };
335
+ // ** new styles aligned to lyra */
336
+ const type$1 = {
337
+ 'body-xs-regular': `
338
+ font-family: ${fontFamily};
339
+ font-weight: ${fontWeights.regular};
340
+ font-size: ${fontSizes.xs};
341
+ line-height: ${lineHeights.m};
342
+ text-decoration: none;
343
+ letter-spacing: ${letterSpacings.m}`,
344
+ 'body-xs-medium': `
345
+ font-family: ${fontFamily};
346
+ font-weight: ${fontWeights.medium};
347
+ font-size: ${fontSizes.xs};
348
+ line-height: ${lineHeights.m};
349
+ text-decoration: none;
350
+ letter-spacing: ${letterSpacings.m}`,
351
+ 'body-xs-bold': `
352
+ font-family: ${fontFamily};
353
+ font-weight: ${fontWeights.bold};
354
+ font-size: ${fontSizes.xs};
355
+ line-height: ${lineHeights.m};
356
+ text-decoration: none;
357
+ letter-spacing: ${letterSpacings.l}`,
358
+ 'body-s-regular': `
359
+ font-family: ${fontFamily};
360
+ font-weight: ${fontWeights.regular};
361
+ font-size: ${fontSizes.s};
362
+ line-height: ${lineHeights.xl};
363
+ text-decoration: none;
364
+ letter-spacing: ${letterSpacings.s}`,
365
+ 'body-s-medium': `
366
+ font-family: ${fontFamily};
367
+ font-weight: ${fontWeights.medium};
368
+ font-size: ${fontSizes.s};
369
+ line-height: ${lineHeights.xl};
370
+ text-decoration: none;
371
+ letter-spacing: ${letterSpacings.s}`,
372
+ 'body-s-bold': `
373
+ font-family: ${fontFamily};
374
+ font-weight: ${fontWeights.bold};
375
+ font-size: ${fontSizes.s};
376
+ line-height: ${lineHeights.xl};
377
+ text-decoration: none;
378
+ letter-spacing: ${letterSpacings.m}`,
379
+ 'body-m-regular': `
380
+ font-family: ${fontFamily};
381
+ font-weight: ${fontWeights.regular};
382
+ font-size: ${fontSizes.m};
383
+ line-height: ${lineHeights.l};
384
+ text-decoration: none;
385
+ letter-spacing: ${letterSpacings.s}`,
386
+ 'body-m-medium': `
387
+ font-family: ${fontFamily};
388
+ font-weight: ${fontWeights.medium};
389
+ font-size: ${fontSizes.m};
390
+ line-height: ${lineHeights.l};
391
+ text-decoration: none;
392
+ letter-spacing: ${letterSpacings.s}`,
393
+ 'body-m-bold': `
394
+ font-family: ${fontFamily};
395
+ font-weight: ${fontWeights.bold};
396
+ font-size: ${fontSizes.m};
397
+ line-height: ${lineHeights.l};
398
+ text-decoration: none;
399
+ letter-spacing: ${letterSpacings.m}`,
400
+ 'body-l-regular': `
401
+ font-family: ${fontFamily};
402
+ font-weight: ${fontWeights.regular};
403
+ font-size: ${fontSizes.l};
404
+ line-height: ${lineHeights.xxl};
405
+ text-decoration: none;
406
+ letter-spacing: ${letterSpacings.xs}`,
407
+ 'body-l-medium': `
408
+ font-family: ${fontFamily};
409
+ font-weight: ${fontWeights.medium};
410
+ font-size: ${fontSizes.l};
411
+ line-height: ${lineHeights.xxl};
412
+ text-decoration: none;
413
+ letter-spacing: ${letterSpacings.xs}`,
414
+ 'body-l-bold': `
415
+ font-family: ${fontFamily};
416
+ font-weight: ${fontWeights.bold};
417
+ font-size: ${fontSizes.l};
418
+ line-height: ${lineHeights.xxl};
419
+ text-decoration: none;
420
+ letter-spacing: ${letterSpacings.s}`,
421
+ 'body-xl-regular': `
422
+ font-family: ${fontFamily};
423
+ font-weight: ${fontWeights.regular};
424
+ font-size: ${fontSizes.xl};
425
+ line-height: ${lineHeights.xxl};
426
+ text-decoration: none;
427
+ letter-spacing: ${letterSpacings.xs}`,
428
+ 'body-xl-medium': `
429
+ font-family: ${fontFamily};
430
+ font-weight: ${fontWeights.medium};
431
+ font-size: ${fontSizes.xl};
432
+ line-height: ${lineHeights.xxl};
433
+ text-decoration: none;
434
+ letter-spacing: ${letterSpacings.xs}`,
435
+ 'body-xl-bold': `
436
+ font-family: ${fontFamily};
437
+ font-weight: ${fontWeights.bold};
438
+ font-size: ${fontSizes.xl};
439
+ line-height: ${lineHeights.xxl};
440
+ text-decoration: none;
441
+ letter-spacing: ${letterSpacings.s}`,
442
+ h1: `
443
+ font-family: ${fontFamily};
444
+ font-weight: ${fontWeights.extra};
445
+ font-size: ${fontSizes.h1};
446
+ line-height: ${lineHeights.xs};
447
+ letter-spacing: ${letterSpacings.m}`,
448
+ h2: `
449
+ font-family: ${fontFamily};
450
+ font-weight: ${fontWeights.extra};
451
+ font-size: ${fontSizes.h2};
452
+ line-height: ${lineHeights.xs};
453
+ letter-spacing: ${letterSpacings.m}`,
454
+ h3: `
455
+ font-family: ${fontFamily};
456
+ font-weight: ${fontWeights.extra};
457
+ font-size: ${fontSizes.h3};
458
+ line-height: ${lineHeights.xs};
459
+ letter-spacing: ${letterSpacings.m}`,
460
+ h4: `
461
+ font-family: ${fontFamily};
462
+ font-weight: ${fontWeights.extra};
463
+ font-size: ${fontSizes.h4};
464
+ line-height: ${lineHeights.xs};
465
+ letter-spacing: ${letterSpacings.m}`,
466
+ h5: `
467
+ font-family: ${fontFamily};
468
+ font-weight: ${fontWeights.extra};
469
+ font-size: ${fontSizes.h5};
470
+ line-height: ${lineHeights.xs};
471
+ letter-spacing: ${letterSpacings.m}`,
472
+ h6: `
473
+ font-family: ${fontFamily};
474
+ font-weight: ${fontWeights.extra};
475
+ font-size: ${fontSizes.h6};
476
+ line-height: ${lineHeights.xs};
477
+ letter-spacing: ${letterSpacings.m}`,
478
+ };
479
+
480
+ /** Convert Slice's explicit CSS curves without importing the React Native runtime. */
481
+ function easing(css) {
482
+ if (css.startsWith('cubic-bezier(')) {
483
+ const [x1, y1, x2, y2] = css.slice(13, -1).split(',').map(Number);
484
+ const sample = (t, a, b) => 3 * (1 - t) ** 2 * t * a + 3 * (1 - t) * t ** 2 * b + t ** 3;
485
+ return (progress) => {
486
+ if (progress <= 0)
487
+ return 0;
488
+ if (progress >= 1)
489
+ return 1;
490
+ let low = 0;
491
+ let high = 1;
492
+ for (let i = 0; i < 30; i++) {
493
+ const middle = (low + high) / 2;
494
+ if (sample(middle, x1, x2) < progress)
495
+ low = middle;
496
+ else
497
+ high = middle;
498
+ }
499
+ return sample((low + high) / 2, y1, y2);
500
+ };
501
+ }
502
+ if (!css.startsWith('linear('))
503
+ throw new Error(`Unsupported Slice easing: ${css}`);
504
+ const points = css
505
+ .slice(7, -1)
506
+ .split(',')
507
+ .map((entry, index, entries) => {
508
+ const [value, percent] = entry.trim().split(/\s+/).map(Number.parseFloat);
509
+ return { value, position: percent === undefined ? index / (entries.length - 1) : percent / 100 };
510
+ });
511
+ return (progress) => {
512
+ if (progress <= 0)
513
+ return points[0].value;
514
+ for (let i = 1; i < points.length; i++) {
515
+ const left = points[i - 1];
516
+ const right = points[i];
517
+ if (progress <= right.position)
518
+ return (left.value + ((right.value - left.value) * (progress - left.position)) / (right.position - left.position));
519
+ }
520
+ return points[points.length - 1].value;
521
+ };
522
+ }
523
+
524
+ const { 'surface-shadow-soft-light': _sl, 'surface-shadow-soft-dark': _sd, 'surface-shadow-strong-light': _hl, 'surface-shadow-strong-dark': _hd, ...palette } = coreColors$1;
525
+ const coreColors = palette;
526
+ /** Uses a 16dp base for the web rem scale. Load this font in the consuming app. */
527
+ function createTypography(fontFamily = 'Funnel Sans') {
528
+ return Object.fromEntries(Object.entries(type$1).map(([key, css]) => {
529
+ const read = (property) => {
530
+ const value = css.match(new RegExp(`(?:^|;)\\s*${property}:\\s*([^;]+)`))?.[1];
531
+ if (!value)
532
+ throw new Error(`Missing typography property: ${property}`);
533
+ return Number.parseFloat(value);
534
+ };
535
+ const fontSize = read('font-size') * 16;
536
+ return [
537
+ key,
538
+ {
539
+ fontFamily,
540
+ fontSize,
541
+ fontWeight: read('font-weight'),
542
+ lineHeight: (fontSize * read('line-height')) / 100,
543
+ letterSpacing: fontSize * read('letter-spacing'),
544
+ textDecorationLine: 'none',
545
+ },
546
+ ];
547
+ }));
548
+ }
549
+ const type = createTypography();
550
+ const motion = {
551
+ 'motion-magnet': easing(motion$1['motion-magnet']),
552
+ 'motion-water': easing(motion$1['motion-water']),
553
+ 'motion-spring': easing(motion$1['motion-spring']),
554
+ 'motion-magnet-duration': Number.parseFloat(motion$1['motion-magnet-duration']) * 1000,
555
+ 'motion-water-duration': Number.parseFloat(motion$1['motion-water-duration']) * 1000,
556
+ 'motion-spring-duration': Number.parseFloat(motion$1['motion-spring-duration']) * 1000,
557
+ };
558
+ function shadow(value) {
559
+ const match = value.match(/^([\d.]+)px ([\d.]+)px ([\d.]+)px (.+)$/);
560
+ if (!match)
561
+ throw new Error(`Unsupported Slice shadow: ${value}`);
562
+ return {
563
+ boxShadow: [
564
+ { offsetX: Number(match[1]), offsetY: Number(match[2]), blurRadius: Number(match[3]), color: match[4] },
565
+ ],
566
+ };
567
+ }
568
+ function createTheme(name, palette) {
569
+ const { 'surface-shadow-soft': soft, 'surface-shadow-strong': strong, ...colors } = palette;
570
+ return {
571
+ name,
572
+ coreColors,
573
+ colors,
574
+ corners,
575
+ spacing,
576
+ elevations,
577
+ type,
578
+ motion,
579
+ shadows: { 'surface-shadow-soft': shadow(soft), 'surface-shadow-strong': shadow(strong) },
580
+ };
581
+ }
582
+ const lightTheme = createTheme('lightMode', light);
583
+ const darkTheme = createTheme('darkMode', dark);
584
+
585
+ export { coreColors, corners, createTypography, darkTheme, elevations, lightTheme, motion, spacing, type };
@@ -0,0 +1,4 @@
1
+ export { Icon, NativeIcon, SliceIcons } from './components/Icon';
2
+ export type { IconProps } from './components/Icon';
3
+ export { lightTheme, darkTheme, createTypography } from './theme';
4
+ export type { SliceNativeTheme, SliceTheme } from './theme';