@yahoo/uds 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/cli/bin/uds-darwin-arm64-baseline +0 -0
  2. package/cli/bin/uds-linux-x64-baseline +0 -0
  3. package/cli/preload.ts +1 -0
  4. package/cli/utils/auth.test.ts +105 -10
  5. package/cli/utils/auth.ts +168 -48
  6. package/cli/utils/client_secrets.json +8 -0
  7. package/cli/utils/client_secrets.json.enc +0 -0
  8. package/cli/utils/secrets.ts +1 -1
  9. package/dist/{chunk-PCSDVJE6.js → chunk-33B23P5G.js} +1 -1
  10. package/dist/chunk-3LHMB72F.cjs +2 -0
  11. package/dist/{chunk-4IHRPERX.js → chunk-6GVKLLYU.js} +3 -3
  12. package/dist/{chunk-SLCISFAV.cjs → chunk-AWEUIM22.cjs} +3 -3
  13. package/dist/{chunk-4J7ZJHCN.js → chunk-BEYSF2MO.js} +1 -1
  14. package/dist/{chunk-SQU6CISU.js → chunk-FRZFCKD2.js} +2 -2
  15. package/dist/{chunk-CE5NDFHI.js → chunk-HJC2LPQ4.js} +1 -1
  16. package/dist/chunk-J6D4HCFT.cjs +2 -0
  17. package/dist/{chunk-TWTUXY76.cjs → chunk-LNFRMD6G.cjs} +2 -2
  18. package/dist/{chunk-2JIYRTEY.js → chunk-LPM6JKIW.js} +2 -2
  19. package/dist/{chunk-PONXZVX3.cjs → chunk-PECN66KD.cjs} +2 -2
  20. package/dist/chunk-PSTMMXTR.js +2 -0
  21. package/dist/{chunk-Y2TGGXMH.js → chunk-RGE634O5.js} +2 -2
  22. package/dist/{chunk-SISW7S7C.cjs → chunk-SSMBE7SI.cjs} +2 -2
  23. package/dist/chunk-VZAZKBYK.cjs +2 -0
  24. package/dist/{chunk-SWXXMG77.cjs → chunk-WASU57GH.cjs} +1 -1
  25. package/dist/chunk-WLOEKYUI.cjs +4 -0
  26. package/dist/{chunk-5TXG2NIQ.js → chunk-YRYDHL65.js} +4 -4
  27. package/dist/client/index.cjs +3 -3
  28. package/dist/client/index.js +5 -5
  29. package/dist/experimental/index.cjs +2 -2
  30. package/dist/experimental/index.js +2 -2
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.js +2 -2
  33. package/dist/metafile-cjs.json +1 -1
  34. package/dist/metafile-esm.json +1 -1
  35. package/dist/tailwind/plugin.cjs +2 -2
  36. package/dist/tailwind/plugin.js +3 -3
  37. package/dist/tailwind/purger.cjs +2 -2
  38. package/dist/tailwind/purger.js +2 -2
  39. package/dist/tailwind/tsMorph.cjs +2 -2
  40. package/dist/tailwind/tsMorph.js +2 -2
  41. package/dist/tailwind/utils.cjs +1 -1
  42. package/dist/tailwind/utils.js +1 -1
  43. package/dist/tokens/index.cjs +1 -1
  44. package/dist/tokens/index.js +1 -1
  45. package/dist/tokens/parseTokens.cjs +1 -1
  46. package/dist/tokens/parseTokens.js +1 -1
  47. package/package.json +5 -8
  48. package/dist/chunk-3VTRSTDI.cjs +0 -2
  49. package/dist/chunk-67ZAMQTH.js +0 -2
  50. package/dist/chunk-6K5IORZA.cjs +0 -2
  51. package/dist/chunk-E3Z3A4MR.cjs +0 -2
  52. package/dist/chunk-QSN7SKTX.cjs +0 -4
  53. /package/dist/{motionFeatures-QDISAARM.js → motionFeatures-B5UV2GY2.js} +0 -0
  54. /package/dist/{motionFeatures-M3DOZMRC.cjs → motionFeatures-THWWLQYC.cjs} +0 -0
Binary file
Binary file
package/cli/preload.ts CHANGED
@@ -51,6 +51,7 @@ mock.module('googleapis', () => ({
51
51
  OAuth2: mock(() => {}).mockImplementation(() => ({
52
52
  getToken: () => Promise.resolve({ tokens: 'test' }),
53
53
  setCredentials: mock(() => {}),
54
+ generateAuthUrl: mock(() => 'https://accounts.google.com/o/oauth2/v2/auth'),
54
55
  })),
55
56
  },
56
57
  oauth2: () => ({
@@ -6,11 +6,15 @@ import http from 'http';
6
6
  import httpMocks from 'node-mocks-http';
7
7
 
8
8
  import {
9
+ configuratorUrlOrigin,
9
10
  getAuthenticatedUser,
11
+ getAuthorizeUrl,
10
12
  isYahooEmployee,
11
13
  login,
14
+ type LoginProvider,
12
15
  logout,
13
- onRequestHandler,
16
+ onGETHandler,
17
+ onPostHandler,
14
18
  type User,
15
19
  } from './auth';
16
20
 
@@ -29,6 +33,22 @@ describe('auth', () => {
29
33
  });
30
34
  });
31
35
 
36
+ describe('getAuthorizeUrl', () => {
37
+ it('uses configurator by default', () => {
38
+ expect(getAuthorizeUrl()).toEqual(
39
+ `${configuratorUrlOrigin}/login?continue=http://localhost:3000/oauth2callback`,
40
+ );
41
+ });
42
+
43
+ it('generates the google auth url for other providers', () => {
44
+ (['google', 'firebase'] as LoginProvider[]).forEach((provider) => {
45
+ expect(getAuthorizeUrl(provider)).toStartWith(
46
+ `https://accounts.google.com/o/oauth2/v2/auth`,
47
+ );
48
+ });
49
+ });
50
+ });
51
+
32
52
  describe('getAuthenticatedUser', () => {
33
53
  it('does not return a user on first use', async () => {
34
54
  expect(await getAuthenticatedUser(__dirname)).toBeUndefined();
@@ -50,29 +70,104 @@ describe('auth', () => {
50
70
  });
51
71
  });
52
72
 
53
- describe('getAuthenticatedClient', () => {
54
- // mock.module('open', () => ({}));
73
+ describe('authenticateUser', () => {
55
74
  const mockServer = Object.assign(Object.create(http.Server.prototype), {
56
75
  listen: mock(),
57
76
  on: mock(),
58
77
  close: mock(),
59
78
  });
60
- const resolve = mock();
61
- const reject = mock();
79
+
80
+ const mockUser = { email: 'foo@yahooinc.com' };
81
+
82
+ mock.module('firebase/auth', () => ({
83
+ GoogleAuthProvider: {
84
+ credential: mock(),
85
+ },
86
+ signInWithCredential: mock(() => Promise.resolve({ user: mockUser })),
87
+ }));
62
88
 
63
89
  it('returns error when no code is on callback url', async () => {
90
+ const resolve = mock();
91
+ const reject = mock();
92
+
64
93
  const request = httpMocks.createRequest({ method: 'GET', url: '/oauth2callback' });
65
94
  const response = httpMocks.createResponse();
66
- await onRequestHandler.bind(mockServer)(request, response, resolve, reject);
95
+ await onGETHandler.bind(mockServer)(request, response, resolve, reject);
67
96
  expect(response._getData()).toInclude('no code parameter');
68
97
  });
69
98
 
70
99
  it('can successfully login in user', async () => {
100
+ const resolve = mock();
101
+ const reject = mock();
102
+
71
103
  const request = httpMocks.createRequest({ method: 'GET', url: '/oauth2callback?code=123' });
72
104
  const response = httpMocks.createResponse();
73
- await onRequestHandler.bind(mockServer)(request, response, resolve, reject);
74
- expect(response._getData()).toInclude('Authentication successful!');
75
- expect(resolve).toHaveBeenCalled();
105
+ await onGETHandler.bind(mockServer)(request, response, resolve, reject);
106
+ expect(response._getData()).toInclude('Authentication successful! Please close this window.');
107
+ expect(resolve).toHaveBeenCalledWith(mockUser);
108
+ expect(reject).not.toHaveBeenCalled();
109
+ });
110
+ });
111
+
112
+ describe('onPostHandler', () => {
113
+ const mockServer = Object.assign(Object.create(http.Server.prototype), {
114
+ listen: mock(),
115
+ on: mock(),
116
+ close: mock(),
117
+ });
118
+
119
+ it('ignores non-POST requests', () => {
120
+ const req = httpMocks.createRequest({ method: 'GET' });
121
+ const resp = httpMocks.createResponse();
122
+ onPostHandler.bind(mockServer)(req, resp, mock(), mock());
123
+ expect(resp._getStatusCode()).toBe(405);
124
+ expect(resp._getData()).toInclude('Method Not Allowed');
125
+ });
126
+
127
+ it('rejects requests from 3rd party origins', () => {
128
+ const req = httpMocks.createRequest({
129
+ method: 'POST',
130
+ headers: { origin: 'https://bad.com' },
131
+ });
132
+ const resp = httpMocks.createResponse();
133
+ const reject = mock();
134
+ onPostHandler.bind(mockServer)(req, resp, mock(), reject);
135
+ expect(reject).toHaveBeenCalledWith('Request origin not allowed.');
136
+ });
137
+
138
+ it('sets CORS headers', () => {
139
+ const req = httpMocks.createRequest({
140
+ method: 'POST',
141
+ headers: { origin: configuratorUrlOrigin },
142
+ // body: JSON.stringify({ email: ''}),
143
+ });
144
+ const resp = httpMocks.createResponse();
145
+ const resolve = mock();
146
+ const reject = mock();
147
+ onPostHandler.bind(mockServer)(req, resp, resolve, reject);
148
+ expect(resp.getHeaders()).toEqual({
149
+ 'access-control-allow-origin': configuratorUrlOrigin,
150
+ 'access-control-allow-methods': 'OPTIONS, GET, POST',
151
+ });
152
+ });
153
+
154
+ it('sends a user obj', async () => {
155
+ const mockUser = { email: 'foo@yahooinc.com', displayName: 'Foo' };
156
+
157
+ const req = httpMocks.createRequest({
158
+ method: 'POST',
159
+ headers: { origin: configuratorUrlOrigin },
160
+ });
161
+ const resp = httpMocks.createResponse({
162
+ eventEmitter: (await import('events')).EventEmitter,
163
+ });
164
+ const resolve = mock();
165
+ const reject = mock();
166
+ onPostHandler.bind(mockServer)(req, resp, resolve, reject);
167
+ req.send(mockUser);
168
+ expect(resp._getData()).toInclude('Authentication successful! Please close this window.');
169
+ expect(reject).not.toHaveBeenCalled();
170
+ expect(resolve).toHaveBeenCalledWith(mockUser);
76
171
  });
77
172
  });
78
173
 
@@ -93,7 +188,7 @@ describe('auth', () => {
93
188
  const mockFunc = mock(() => Promise.resolve({ email: 'foo@yahooinc.com' }));
94
189
 
95
190
  mock.module('./auth', () => ({
96
- getAuthenticatedClient: mockFunc,
191
+ authenticateUser: mockFunc,
97
192
  }));
98
193
 
99
194
  it('uses cache when user previously logged in', async () => {
package/cli/utils/auth.ts CHANGED
@@ -3,87 +3,204 @@ import path from 'node:path';
3
3
 
4
4
  import { print, red } from 'bluebun';
5
5
  import Bun from 'bun';
6
- import { Auth, google, oauth2_v2 } from 'googleapis';
6
+ import { getApps, initializeApp } from 'firebase/app';
7
+ import {
8
+ connectAuthEmulator,
9
+ getAuth,
10
+ GoogleAuthProvider,
11
+ signInWithCredential,
12
+ User as FirebaseUser,
13
+ } from 'firebase/auth';
14
+ import { google, oauth2_v2 } from 'googleapis';
7
15
  import http from 'http';
8
16
  import open from 'open';
9
17
 
10
18
  import clientSecrets from './client_secrets.json';
11
19
 
12
- const { redirect_uris, client_id, client_secret } = clientSecrets.web;
13
- const REDIRECT_URL = redirect_uris[0];
14
- const { port: PORT, origin: BASE_URL } = new URL(REDIRECT_URL);
20
+ type User = oauth2_v2.Schema$Userinfo | FirebaseUser;
21
+ type LoginProvider = 'google' | 'firebase' | 'configurator';
15
22
 
16
- const cacheFilePath = '.uds/user.json';
23
+ const LOGIN_PROVIDER: LoginProvider =
24
+ (process.env.LOGIN_PROVIDER as LoginProvider) ?? 'configurator';
25
+
26
+ const REDIRECT_URL = clientSecrets.web.redirect_uris[0];
27
+ const { port: PORT, origin: SERVER_ORIGIN } = new URL(REDIRECT_URL);
28
+
29
+ const configuratorUrlOrigin =
30
+ process.env.NODE_ENV === 'production' ? 'https://config.uds.build' : 'http://localhost:4001';
31
+
32
+ const CACHE_FILEPATH = '.uds/user.json';
17
33
  const DEFAULT_CLI_PATH = path.resolve(import.meta.dir, '..');
18
- const CACHED_USER_FILE = path.resolve(DEFAULT_CLI_PATH, cacheFilePath);
34
+ const CACHED_USER_FILE = path.resolve(DEFAULT_CLI_PATH, CACHE_FILEPATH);
19
35
 
20
- // Credentials can be found in https://console.cloud.google.com/apis/credentials/oauthclient/700524957090-6uju02gp6i0rlm3p17nt1v6vbrretfka.apps.googleusercontent.com?project=uds-poc.
21
- const oauth2Client = new google.auth.OAuth2(client_id, client_secret, REDIRECT_URL);
36
+ const isEmulator = process.env.EMULATOR || process.env.NEXT_PUBLIC_EMULATOR;
22
37
 
23
- type User = oauth2_v2.Schema$Userinfo;
38
+ // TODO: consolidate with the firebase config and setup in database/firebase.ts
39
+ const firebaseConfig = !isEmulator
40
+ ? clientSecrets.firebaseConfig
41
+ : {
42
+ projectId: 'uds-poc',
43
+ apiKey: 'DUMMY_API_KEY',
44
+ authDomain: 'uds-poc.firebaseapp.com',
45
+ };
46
+
47
+ const firebaseApp = getApps().length === 0 ? initializeApp(firebaseConfig) : getApps()[0];
48
+ const auth = getAuth(firebaseApp);
49
+
50
+ if (isEmulator) {
51
+ connectAuthEmulator(auth, 'http://127.0.0.1:9099');
52
+ }
53
+
54
+ // Credentials can be found in https://console.cloud.google.com/apis/credentials/oauthclient/700524957090-6uju02gp6i0rlm3p17nt1v6vbrretfka.apps.googleusercontent.com?project=uds-poc.
55
+ const oauth2Client = new google.auth.OAuth2(
56
+ clientSecrets.web.client_id,
57
+ clientSecrets.web.client_secret,
58
+ REDIRECT_URL,
59
+ );
24
60
 
25
61
  function isYahooEmployee(user?: User) {
26
62
  return user?.email?.endsWith('@yahooinc.com');
27
63
  }
28
64
 
29
- async function onRequestHandler(
65
+ function getAuthorizeUrl(loginProvider = LOGIN_PROVIDER) {
66
+ if (loginProvider === 'configurator') {
67
+ return `${configuratorUrlOrigin}/login?continue=${REDIRECT_URL}`;
68
+ }
69
+
70
+ return oauth2Client.generateAuthUrl({
71
+ access_type: 'offline',
72
+ scope: [
73
+ 'https://www.googleapis.com/auth/userinfo.profile',
74
+ 'https://www.googleapis.com/auth/userinfo.email',
75
+ ].join(' '),
76
+ hd: 'yahooinc.com',
77
+ include_granted_scopes: true,
78
+ });
79
+ }
80
+
81
+ function onPostHandler(
30
82
  this: http.Server,
31
83
  req: http.IncomingMessage,
32
84
  res: http.ServerResponse,
33
- resolve: (value: typeof oauth2Client) => void,
85
+ resolve: (user: User) => void,
86
+ reject: (reason?: unknown) => void,
87
+ ) {
88
+ if (req.method !== 'POST') {
89
+ res.writeHead(405, { Allow: 'POST' }); // Set the 405 status and Allow header
90
+ res.end('Method Not Allowed');
91
+ reject('Method Not Allowed');
92
+ return;
93
+ }
94
+
95
+ if (req.headers.origin !== configuratorUrlOrigin) {
96
+ reject(`Request origin not allowed.`);
97
+ return;
98
+ }
99
+
100
+ res.setHeader('Access-Control-Allow-Origin', configuratorUrlOrigin);
101
+ res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET, POST');
102
+
103
+ let data = '';
104
+
105
+ req.on('data', (chunk) => {
106
+ data += chunk.toString();
107
+ });
108
+
109
+ req.on('error', (err: NodeJS.ErrnoException) => {
110
+ reject(err);
111
+ });
112
+
113
+ req.on('end', () => {
114
+ try {
115
+ const user: FirebaseUser = JSON.parse(data);
116
+ res.end('Authentication successful! Please close this window.');
117
+ resolve(user);
118
+ } catch (err) {
119
+ reject(err);
120
+ } finally {
121
+ this.close();
122
+ }
123
+ });
124
+ }
125
+
126
+ async function onGETHandler(
127
+ this: http.Server,
128
+ req: http.IncomingMessage,
129
+ res: http.ServerResponse,
130
+ resolve: (user: User) => void,
34
131
  reject: (reason?: unknown) => void,
35
132
  ) {
36
133
  try {
37
- const code = new URL(req.url || '', BASE_URL).searchParams.get('code');
134
+ const code = new URL(req.url || '', SERVER_ORIGIN).searchParams.get('code');
38
135
  if (!code) {
39
136
  res.end('There was no code parameter on the url.');
40
137
  this.close();
41
138
  return;
42
139
  }
43
140
 
44
- res.end('Authentication successful! You can close this window.');
45
-
141
+ res.end('Authentication successful! Please close this window.');
46
142
  this.close();
47
143
 
48
144
  const { tokens } = await oauth2Client.getToken(code);
49
145
  oauth2Client.setCredentials(tokens);
50
146
 
51
- resolve(oauth2Client);
52
- } catch (e) {
53
- reject(e);
147
+ let user: User;
148
+
149
+ if (LOGIN_PROVIDER === 'firebase') {
150
+ // Build Firebase credential using the Google ID token.
151
+ const credential = GoogleAuthProvider.credential(tokens.id_token);
152
+ user = (await signInWithCredential(auth, credential)).user;
153
+ } else {
154
+ const oauth2 = google.oauth2({ version: 'v2', auth: oauth2Client });
155
+ user = (await oauth2.userinfo.get()).data;
156
+ }
157
+
158
+ resolve(user);
159
+ } catch (err) {
160
+ reject(err);
54
161
  }
55
162
  }
56
163
 
57
- async function getAuthenticatedClient(): Promise<Auth.OAuth2Client> {
164
+ /**
165
+ * Opens a browser window to authenticate the user using Google OAuth2 flow.
166
+ * The id token is exchanged for Firebase user credentials.
167
+ * @returns
168
+ */
169
+ async function authenticateUser(): Promise<User> {
58
170
  return new Promise((resolve, reject) => {
59
- const authorizeUrl = oauth2Client.generateAuthUrl({
60
- access_type: 'offline',
61
- scope: [
62
- 'https://www.googleapis.com/auth/userinfo.profile',
63
- 'https://www.googleapis.com/auth/userinfo.email',
64
- ].join(' '),
65
- hd: 'yahooinc.com',
66
- include_granted_scopes: true,
67
- });
68
-
69
171
  // TODO: If port (3000) is already in use, this will fail.
70
172
  // Setup https://www.npmjs.com/package/find-free-ports, but that won't
71
173
  // play well with the pre-configured redirect_uris in the Google Cloud Console.
72
- const server = http
73
- .createServer()
74
- .listen(PORT, async () => {
75
- const childProcess = await open(authorizeUrl, { wait: false });
76
- childProcess.unref();
77
- })
78
- .on('request', (req, res) => onRequestHandler.call(server, req, res, resolve, reject))
79
- .on('error', (err: NodeJS.ErrnoException) => {
80
- if (err.code && err.code.includes('EADDRINUSE')) {
81
- print(
82
- red(`🚨 Port ${PORT} already in use. Cannot start local server to handle OAuth flow.`),
83
- );
84
- server.close();
85
- }
174
+ const server = http.createServer();
175
+
176
+ server.listen(PORT, async () => {
177
+ const authorizeUrl = getAuthorizeUrl();
178
+
179
+ print(`Please visit the following URL if it didn't open automatically:\n${authorizeUrl}`);
180
+
181
+ const childProcess = await open(authorizeUrl, { wait: false });
182
+ childProcess.unref();
183
+
184
+ process.on('SIGINT', () => {
185
+ server.close();
186
+ reject('Received SIGINT.');
86
187
  });
188
+ });
189
+
190
+ server.on('error', (err: NodeJS.ErrnoException) => {
191
+ if (err.code && err.code.includes('EADDRINUSE')) {
192
+ print(
193
+ red(`🚨 Port ${PORT} already in use. Cannot start local server to handle OAuth flow.`),
194
+ );
195
+ server.close();
196
+ }
197
+ });
198
+
199
+ if (LOGIN_PROVIDER === 'configurator') {
200
+ server.on('request', (req, res) => onPostHandler.call(server, req, res, resolve, reject));
201
+ } else {
202
+ server.on('request', (req, res) => onGETHandler.call(server, req, res, resolve, reject));
203
+ }
87
204
  });
88
205
  }
89
206
 
@@ -107,12 +224,11 @@ async function login() {
107
224
  // Authenticate if there's no user cached.
108
225
  if (!user) {
109
226
  try {
110
- const auth = await getAuthenticatedClient();
111
- const oauth2 = google.oauth2({ version: 'v2', auth });
112
- user = (await oauth2.userinfo.get()).data;
227
+ user = await authenticateUser();
113
228
  await Bun.write(CACHED_USER_FILE, JSON.stringify(user, null, 2));
114
229
  } catch (err) {
115
230
  console.error('Error:', err);
231
+ throw err;
116
232
  }
117
233
  }
118
234
 
@@ -129,7 +245,7 @@ async function login() {
129
245
  */
130
246
  async function getAuthenticatedUser(cliPath = DEFAULT_CLI_PATH): Promise<User | undefined> {
131
247
  try {
132
- const cachePath = path.resolve(cliPath, cacheFilePath);
248
+ const cachePath = path.resolve(cliPath, CACHE_FILEPATH);
133
249
  const file = Bun.file(cachePath);
134
250
  const user = await file.json();
135
251
 
@@ -148,11 +264,15 @@ async function getAuthenticatedUser(cliPath = DEFAULT_CLI_PATH): Promise<User |
148
264
  }
149
265
 
150
266
  export {
151
- getAuthenticatedClient,
267
+ authenticateUser,
268
+ configuratorUrlOrigin,
152
269
  getAuthenticatedUser,
270
+ getAuthorizeUrl,
153
271
  isYahooEmployee,
154
272
  login,
273
+ type LoginProvider,
155
274
  logout,
156
- onRequestHandler,
275
+ onGETHandler,
276
+ onPostHandler,
157
277
  type User,
158
278
  };
@@ -11,5 +11,13 @@
11
11
  "https://uds.build/oauth2callback",
12
12
  "https://config.uds.build/oauth2callback"
13
13
  ]
14
+ },
15
+ "firebaseConfig": {
16
+ "apiKey": "AIzaSyDZEsm1GQ1lkK7T8NxJ9D_Pqmcz5u5D2hc",
17
+ "authDomain": "uds-poc.firebaseapp.com",
18
+ "projectId": "uds-poc",
19
+ "storageBucket": "uds-poc.appspot.com",
20
+ "messagingSenderId": "700524957090",
21
+ "appId": "1:700524957090:web:b4b5cdba42f694bb5cf6fb"
14
22
  }
15
23
  }
Binary file
@@ -22,7 +22,7 @@ async function decrypt() {
22
22
 
23
23
  async function main() {
24
24
  if (!process.env.UDS_CLI_SECRETS_PW) {
25
- console.error('Please set UDS_CLI_SECRETS_PW env variable. The password is in LastPass.');
25
+ console.error('Please set the UDS_CLI_SECRETS_PW env variable. The password is in LastPass.');
26
26
  process.exitCode = 1;
27
27
  return;
28
28
  }
@@ -1,2 +1,2 @@
1
- /*! © 2024 Yahoo, Inc. UDS v1.2.0 */
1
+ /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
2
2
  var o="uds",e=`${o}-avatar-size`,t=`${o}-border-radius`,r=`${o}-border-width`,n=`${o}-font`,d=`${o}-font-size`,i=`${o}-font-weight`,s=`${o}-icon-size`,a=`${o}-line-height`,l=`${o}-motion`,$=`${o}-spectrum-color`,c=`${o}-text-transform`,b=`${o}-color-mode-dark`,u=`${o}-color-mode-light`,f=`${o}-scale-mode-xsmall`,m=`${o}-scale-mode-small`,g=`${o}-scale-mode-medium`,h=`${o}-scale-mode-large`,p=`${o}-scale-mode-xlarge`,x=`${o}-scale-mode-xxlarge`,z=`${o}-scale-mode-xxxlarge`,v=u,w=h,k={borderRadius:`--${o}-button-border-radius`,borderWidth:`--${o}-button-border-width`,color:`--${o}-button-color`,backgroundColor:`--${o}-button-background-color`,borderColor:`--${o}-button-border-color`,padding:`--${o}-button-padding`,columnGap:`--${o}-button-gap`,fontFamily:`--${o}-button-font`,fontWeight:`--${o}-button-font-weight`,fontSize:`--${o}-button-font-size`,lineHeight:`--${o}-button-line-height`,textTransform:`--${o}-button-text-transform`,iconSize:`--${o}-button-icon-size`,effects:{scale:{rest:`--${o}-button-effects-scale--rest`,hover:`--${o}-button-effects-scale--hover`,pressed:`--${o}-button-effects-scale--pressed`}}},S={padding:`--${o}-icon-button-padding`,iconSize:`--${o}-icon-button-icon-size`},C={hover:":hover:not([disabled])",pressed:":active:not([disabled])",disabled:":disabled",focused:":focus-visible",notDisabled:":not(:disabled)"};export{e as AVATAR_SIZE_PREFIX,t as BORDER_RADIUS_PREFIX,r as BORDER_WIDTH_PREFIX,k as BUTTON_CSS_VAR_MAP,b as DARK_COLOR_MODE_CLASSNAME,v as DEFAULT_COLOR_MODE_CLASSNAME,w as DEFAULT_SCALE_MODE_CLASSNAME,n as FONT_FAMILY_PREFIX,d as FONT_SIZE_PREFIX,i as FONT_WEIGHT_PREFIX,S as ICON_BUTTON_CSS_VAR_MAP,s as ICON_SIZE_PREFIX,h as LARGE_SCALE_MODE_CLASSNAME,u as LIGHT_COLOR_MODE_CLASSNAME,a as LINE_HEIGHT_PREFIX,g as MEDIUM_SCALE_MODE_CLASSNAME,l as MOTION_PREFIX,C as PSEUDO_STYLE_SELECTOR_MAP,m as SMALL_SCALE_MODE_CLASSNAME,$ as SPECTRUM_COLOR_PREFIX,c as TEXT_TRANSFORM_PREFIX,o as UDS_PREFIX,p as XLARGE_SCALE_MODE_CLASSNAME,f as XSMALL_SCALE_MODE_CLASSNAME,x as XXLARGE_SCALE_MODE_CLASSNAME,z as XXXLARGE_SCALE_MODE_CLASSNAME};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */var l={fontSize:{display1:46,display2:37,display3:33,title1:29,title2:25,title3:21,title4:17,headline1:13,body1:13,label1:12,label2:12,caption1:11,caption2:11,legal1:10},lineHeight:{display1:44,display2:44,display3:44,title1:36,title2:32,title3:28,title4:24,headline1:16,body1:16,label1:16,label2:16,caption1:16,caption2:16,legal1:12}},e={fontSize:{display1:46,display2:38,display3:34,title1:30,title2:26,title3:22,title4:18,headline1:14,body1:14,label1:13,label2:13,caption1:12,caption2:12,legal1:11},lineHeight:{...l.lineHeight,title1:40,headline1:20,body1:20,legal1:16}},t={fontSize:{display1:47,display2:39,display3:35,title1:31,title2:27,title3:23,title4:19,headline1:15,body1:15,label1:13,label2:13,caption1:12,caption2:12,legal1:11},lineHeight:{...e.lineHeight,title2:36,title3:32}},i={fontSize:{...t.fontSize,display1:48,display2:40,display3:36,title1:32,title2:28,title3:24,title4:20,headline1:16,body1:16,label1:14,label2:14},lineHeight:{...t.lineHeight,title2:36,title3:32,headline1:20,body1:20,label1:20,label2:20}},a={fontSize:{display1:50,display2:42,display3:38,title1:34,title2:30,title3:26,title4:22,headline1:18,body1:16,label1:16,label2:16,caption1:14,caption2:14,legal1:13},lineHeight:{...i.lineHeight,title1:44,headline1:24,body1:24,caption1:20,caption2:20}},n={fontSize:{display1:52,display2:44,display3:40,title1:36,title2:32,title3:28,title4:26,headline1:20,body1:20,label1:18,label2:18,caption1:16,caption2:16,legal1:15},lineHeight:{...a.lineHeight,title2:40,title3:36,headline1:28,body1:28,label1:24,label2:24,legal1:20}},o={fontSize:{display1:54,display2:46,display3:42,title1:38,title2:34,title3:30,title4:28,headline1:22,body1:22,label1:20,label2:20,caption1:18,caption2:18,legal1:17},lineHeight:{...n.lineHeight,title1:48,title2:44,title4:32,label1:28,label2:28,caption1:24,caption2:24}};exports.entries=function(l){return Object.entries(l)},exports.fontFamily={display1:"sans",display2:"sans",display3:"sans",title1:"sans",title2:"sans",title3:"sans",title4:"sans",headline1:"sans",body1:"sans",label1:"sans",label2:"sans",caption1:"sans",caption2:"sans",legal1:"sans"},exports.fontWeight={display1:"black",display2:"extrabold",display3:"extrabold",title1:"bold",title2:"bold",title3:"bold",title4:"bold",headline1:"semibold",body1:"regular",label1:"semibold",label2:"regular",caption1:"semibold",caption2:"regular",legal1:"semibold"},exports.fontWeightMap={thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},exports.large=i,exports.mapValues=function(l,e){return Object.keys(l).reduce(((t,i,a)=>(t[i]=e(l[i],i,a),t)),{})},exports.medium=t,exports.small=e,exports.textTransform={display1:"uppercase",display2:"none",display3:"none",title1:"none",title2:"none",title3:"none",title4:"none",headline1:"none",body1:"none",label1:"none",label2:"none",caption1:"none",caption2:"none",legal1:"none"},exports.xLarge=a,exports.xSmall=l,exports.xxLarge=n,exports.xxxLarge=o;
@@ -1,3 +1,3 @@
1
- import{normalIconSizes as e}from"./chunk-5TXG2NIQ.js";import{variants as r}from"./chunk-Y2TGGXMH.js";import{lineColors as t,borderWidths as n,borderRadii as o,foregroundColors as s,spectrumColors as c,backgroundColors as i,textVariants as a}from"@yahoo/uds/fixtures";import l from"clsx";import u from"imurmurhash";import{extendTailwindMerge as f}from"tailwind-merge";import{forwardRef as m,Children as d,isValidElement as p,cloneElement as h}from"react";import{jsx as y}from"react/jsx-runtime";
2
- /*! © 2024 Yahoo, Inc. UDS v1.2.0 */
3
- var v="undefined"!=typeof process,b={useGetStylesCache:!!v&&"true"===process.env.NEXT_PUBLIC_UDS_FEATURE_USE_STYLE_CACHE,useCLIAuth:!!v&&"true"===process.env.UDS_FEATURE_ENABLE_CLI_AUTH},g=e=>b={...b,...e},N=()=>b;function E(e){return"boolean"==typeof e?`${e}`:0===e?"0":e}function C(e){const r=Object.create(null),t=Object.keys(e);for(let n=0,o=t.length;n<o;n++){const o=t[n];void 0!==e[o]&&(r[o]=e[o])}return r}var _=f({extend:{theme:{borderColor:t,borderWidth:n,borderRadius:o}},override:{classGroups:{"text-color":[{text:[...s,...c]}],"bg-color":[{bg:i}],"font-family":[{font:["icons",...a]}],leading:[{leading:a}]},conflictingClassGroups:{}}}),j=(...e)=>{const r=l(e);return _(r)},w=e=>r=>{if(!e?.variants)return j(e?.base,r?.className);const{variants:t,defaultVariants:n}=e,o=Object.keys(t).map((e=>{const o=r?.[e],s=n?.[e],c=E(o)||E(s);return t[e][c]})),s={...n,...r&&C(r)},c=e?.compoundVariants?.reduce(((e,{className:r,...t})=>Object.entries(t).every((([e,r])=>s[e]===r))?j(e,r):e),"");return j(e?.base,o,c,r?.className)},x=w({variants:r}),S=new Map,A=e=>{const{useGetStylesCache:r}=N();if(r){const r=function(e){const r=Object.create(null),t=Object.keys(e).sort();for(let n=0,o=t.length;n<o;n++){const o=t[n];r[o]=e[o]}return r}(C(e)),t=(new u).hash(JSON.stringify(r)).result();if(S.has(t))return S.get(t);const n=x(r);return S.set(t,n),n}return x(e)},G=m((function({name:r,size:t="md",variant:n="outline",color:o="primary",className:s,...c},i){const a=A({color:o,className:s}),l=e[t];return y("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:`0 0 ${l} ${l}`,"aria-hidden":"true",focusable:"false",className:a,...c,children:y(r,{size:t,variant:n})})}));function O(...e){return r=>e.forEach((e=>function(e,r){"function"==typeof e?e(r):null!=e&&(e.current=r)}(e,r)))}function T(){const e=m(((e,t)=>{const{children:o,...s}=e,c=d.toArray(o),i=c.find(n);if(i){const e=i.props.children,n=c.map((r=>r===i?d.count(e)>1?d.only(null):p(e)?e.props.children:null:r));return y(r,{...s,ref:t,children:p(e)?h(e,void 0,n):null})}return y(r,{...s,ref:t,children:o})}));e.displayName="Slot";const r=m(((e,r)=>{const{children:t,...n}=e;return p(t)?h(t,{...o(n,t.props),ref:r?O(r,t.ref):t.ref}):d.count(t)>1?d.only(null):null}));r.displayName="SlotClone";const t=({children:e})=>e;function n(e){return p(e)&&e.type===t}function o(e,r){const t={...r};for(const n in r){const o=e[n],s=r[n];/^on[A-Z]/.test(n)?o&&s?t[n]=(...e)=>{s(...e),o(...e)}:o&&(t[n]=o):"style"===n&&(t[n]={...o,...s})}return{...e,...t}}return e}export{G as Icon,T as createSlot,w as cva,j as cx,N as getFeatureFlags,A as getStyles,g as updateFeatureFlags};
1
+ import{normalIconSizes as e}from"./chunk-YRYDHL65.js";import{variants as r}from"./chunk-RGE634O5.js";import{lineColors as t,borderWidths as n,borderRadii as o,foregroundColors as s,spectrumColors as c,backgroundColors as i,textVariants as a}from"@yahoo/uds/fixtures";import l from"clsx";import u from"imurmurhash";import{extendTailwindMerge as f}from"tailwind-merge";import{forwardRef as m,Children as d,isValidElement as p,cloneElement as h}from"react";import{jsx as y}from"react/jsx-runtime";
2
+ /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
3
+ var v="undefined"!=typeof process,b={useGetStylesCache:!!v&&"true"===process.env.NEXT_PUBLIC_UDS_FEATURE_USE_STYLE_CACHE,useCLIAuth:!!v&&"true"===process.env.UDS_FEATURE_ENABLE_CLI_AUTH},g=e=>b={...b,...e},E=()=>b;function N(e){return"boolean"==typeof e?`${e}`:0===e?"0":e}function C(e){const r=Object.create(null),t=Object.keys(e);for(let n=0,o=t.length;n<o;n++){const o=t[n];void 0!==e[o]&&(r[o]=e[o])}return r}var _=f({extend:{theme:{borderColor:t,borderWidth:n,borderRadius:o}},override:{classGroups:{"text-color":[{text:[...s,...c]}],"bg-color":[{bg:i}],"font-family":[{font:["icons",...a]}],leading:[{leading:a}]},conflictingClassGroups:{}}}),j=(...e)=>{const r=l(e);return _(r)},w=e=>r=>{if(!e?.variants)return j(e?.base,r?.className);const{variants:t,defaultVariants:n}=e,o=Object.keys(t).map((e=>{const o=r?.[e],s=n?.[e],c=N(o)||N(s);return t[e][c]})),s={...n,...r&&C(r)},c=e?.compoundVariants?.reduce(((e,{className:r,...t})=>Object.entries(t).every((([e,r])=>s[e]===r))?j(e,r):e),"");return j(e?.base,o,c,r?.className)},x=w({variants:r}),S=new Map,A=e=>{const{useGetStylesCache:r}=E();if(r){const r=function(e){const r=Object.create(null),t=Object.keys(e).sort();for(let n=0,o=t.length;n<o;n++){const o=t[n];r[o]=e[o]}return r}(C(e)),t=(new u).hash(JSON.stringify(r)).result();if(S.has(t))return S.get(t);const n=x(r);return S.set(t,n),n}return x(e)},O=m((function({name:r,size:t="md",variant:n="outline",color:o="primary",className:s,...c},i){const a=A({color:o,className:s}),l=e[t];return y("svg",{ref:i,xmlns:"http://www.w3.org/2000/svg",width:l,height:l,viewBox:`0 0 ${l} ${l}`,"aria-hidden":"true",focusable:"false",className:a,...c,children:y(r,{size:t,variant:n})})}));function U(...e){return r=>e.forEach((e=>function(e,r){"function"==typeof e?e(r):null!=e&&(e.current=r)}(e,r)))}function L(){const e=m(((e,t)=>{const{children:o,...s}=e,c=d.toArray(o),i=c.find(n);if(i){const e=i.props.children,n=c.map((r=>r===i?d.count(e)>1?d.only(null):p(e)?e.props.children:null:r));return y(r,{...s,ref:t,children:p(e)?h(e,void 0,n):null})}return y(r,{...s,ref:t,children:o})}));e.displayName="Slot";const r=m(((e,r)=>{const{children:t,...n}=e;return p(t)?h(t,{...o(n,t.props),ref:r?U(r,t.ref):t.ref}):d.count(t)>1?d.only(null):null}));r.displayName="SlotClone";const t=({children:e})=>e;function n(e){return p(e)&&e.type===t}function o(e,r){const t={...r};for(const n in r){const o=e[n],s=r[n];/^on[A-Z]/.test(n)?o&&s?t[n]=(...e)=>{s(...e),o(...e)}:o&&(t[n]=o):"style"===n&&(t[n]={...o,...s})}return{...e,...t}}return e}export{O as Icon,L as createSlot,w as cva,j as cx,E as getFeatureFlags,A as getStyles,g as updateFeatureFlags};
@@ -1,3 +1,3 @@
1
- "use strict";var t=require("./chunk-E3Z3A4MR.cjs"),r=require("./chunk-3VTRSTDI.cjs");
2
- /*! © 2024 Yahoo, Inc. UDS v1.2.0 */
3
- function e(e){const{palette:o,spectrum:n}=e,i={},a={spectrum:{},palette:{}};for(const[e,o]of t.entries(n))for(const[n,s]of t.entries(o)){const t=`${e}-${n}`,o=`--${r.SPECTRUM_COLOR_PREFIX}-${t}`;a.spectrum[e]||(a.spectrum[e]={}),a.spectrum[e][n]=`rgb(var(${o}))`,i[o]=s}return t.entries(o).forEach((([t,e])=>{for(const[o,{hue:n,step:s,opacity:c}]of Object.entries(e)){t in a.palette||(a.palette[t]={});const e=`--${r.UDS_PREFIX}-${t}-color-${o}`;i[e]=`var(--${r.SPECTRUM_COLOR_PREFIX}-${n}-${s})`,a.palette[t][o]=c?`rgb(var(${e}) / ${c})`:`rgb(var(${e}))`}})),{_vars:i,_raw:e,tailwindConfig:a}}function o(e){const o={},n={};for(const[i,a="regular"]of t.entries(e)){const e=`--${r.FONT_WEIGHT_PREFIX}-${i}`,s="number"==typeof a?`${a}`:t.fontWeightMap[a];o[e]=s,n[i]=`var(${e})`}return{_vars:o,_raw:e,tailwindConfig:{...t.fontWeightMap,...n}}}function n(r,e,o){const n={},i={};for(const[a,s]of t.entries(e)){const t=`--${r}-${a}`,e=o?o(s):s;n[t]=e,i[a]=`var(${t})`}return{_vars:n,_raw:e,tailwindConfig:i}}function i(r,e){if(!e)return{_vars:{},_raw:{},tailwindConfig:{}};const o={},n={};for(const[i,a]of t.entries(e)){const t=`--${r}-${i}`,e=`${a}px`;o[t]=e,n[i]=`var(${t})`}return{_vars:o,_raw:e,tailwindConfig:n}}exports.parseTokens=function(a){const{colorMode:s,scaleMode:c}=a;return{...a,colorMode:{light:e(s.light),dark:e(s.dark)},scaleMode:t.mapValues(c,(({borderRadius:t,borderWidth:e,fontSize:a,lineHeight:s,fontFamily:c,fontWeight:f,textTransform:_,avatarSizes:R,iconSizes:u})=>({fontFamily:n(r.FONT_FAMILY_PREFIX,c,(t=>`var(--${r.FONT_FAMILY_PREFIX}-${t})`)),fontSize:i(r.FONT_SIZE_PREFIX,a),fontWeight:o(f),lineHeight:i(r.LINE_HEIGHT_PREFIX,s),textTransform:n(r.TEXT_TRANSFORM_PREFIX,_),borderRadius:i(r.BORDER_RADIUS_PREFIX,t),borderWidth:i(r.BORDER_WIDTH_PREFIX,e),avatarSizes:i(r.AVATAR_SIZE_PREFIX,R),iconSizes:i(r.ICON_SIZE_PREFIX,u)})))}};
1
+ "use strict";var t=require("./chunk-3LHMB72F.cjs"),r=require("./chunk-J6D4HCFT.cjs");
2
+ /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
3
+ function e(e){const{palette:o,spectrum:n}=e,i={},a={spectrum:{},palette:{}};for(const[e,o]of t.entries(n))for(const[n,s]of t.entries(o)){const t=`${e}-${n}`,o=`--${r.SPECTRUM_COLOR_PREFIX}-${t}`;a.spectrum[e]||(a.spectrum[e]={}),a.spectrum[e][n]=`rgb(var(${o}))`,i[o]=s}return t.entries(o).forEach((([t,e])=>{for(const[o,{hue:n,step:s,opacity:c}]of Object.entries(e)){t in a.palette||(a.palette[t]={});const e=`--${r.UDS_PREFIX}-${t}-color-${o}`;i[e]=`var(--${r.SPECTRUM_COLOR_PREFIX}-${n}-${s})`,a.palette[t][o]=c?`rgb(var(${e}) / ${c})`:`rgb(var(${e}))`}})),{_vars:i,_raw:e,tailwindConfig:a}}function o(e){const o={},n={};for(const[i,a="regular"]of t.entries(e)){const e=`--${r.FONT_WEIGHT_PREFIX}-${i}`,s="number"==typeof a?`${a}`:t.fontWeightMap[a];o[e]=s,n[i]=`var(${e})`}return{_vars:o,_raw:e,tailwindConfig:{...t.fontWeightMap,...n}}}function n(r,e,o){const n={},i={};for(const[a,s]of t.entries(e)){const t=`--${r}-${a}`,e=o?o(s):s;n[t]=e,i[a]=`var(${t})`}return{_vars:n,_raw:e,tailwindConfig:i}}function i(r,e){if(!e)return{_vars:{},_raw:{},tailwindConfig:{}};const o={},n={};for(const[i,a]of t.entries(e)){const t=`--${r}-${i}`,e=`${a}px`;o[t]=e,n[i]=`var(${t})`}return{_vars:o,_raw:e,tailwindConfig:n}}exports.parseTokens=function(a){const{colorMode:s,scaleMode:c}=a;return{...a,colorMode:{light:e(s.light),dark:e(s.dark)},scaleMode:t.mapValues(c,(({borderRadius:t,borderWidth:e,fontSize:a,lineHeight:s,fontFamily:c,fontWeight:f,textTransform:_,avatarSizes:u,iconSizes:R})=>({fontFamily:n(r.FONT_FAMILY_PREFIX,c,(t=>`var(--${r.FONT_FAMILY_PREFIX}-${t})`)),fontSize:i(r.FONT_SIZE_PREFIX,a),fontWeight:o(f),lineHeight:i(r.LINE_HEIGHT_PREFIX,s),textTransform:n(r.TEXT_TRANSFORM_PREFIX,_),borderRadius:i(r.BORDER_RADIUS_PREFIX,t),borderWidth:i(r.BORDER_WIDTH_PREFIX,e),avatarSizes:i(r.AVATAR_SIZE_PREFIX,u),iconSizes:i(r.ICON_SIZE_PREFIX,R)})))}};
@@ -1,2 +1,2 @@
1
- /*! © 2024 Yahoo, Inc. UDS v1.2.0 */
1
+ /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
2
2
  var l={display1:"sans",display2:"sans",display3:"sans",title1:"sans",title2:"sans",title3:"sans",title4:"sans",headline1:"sans",body1:"sans",label1:"sans",label2:"sans",caption1:"sans",caption2:"sans",legal1:"sans"},e={thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},i={display1:"black",display2:"extrabold",display3:"extrabold",title1:"bold",title2:"bold",title3:"bold",title4:"bold",headline1:"semibold",body1:"regular",label1:"semibold",label2:"regular",caption1:"semibold",caption2:"regular",legal1:"semibold"},t={display1:"uppercase",display2:"none",display3:"none",title1:"none",title2:"none",title3:"none",title4:"none",headline1:"none",body1:"none",label1:"none",label2:"none",caption1:"none",caption2:"none",legal1:"none"},a={fontSize:{display1:46,display2:37,display3:33,title1:29,title2:25,title3:21,title4:17,headline1:13,body1:13,label1:12,label2:12,caption1:11,caption2:11,legal1:10},lineHeight:{display1:44,display2:44,display3:44,title1:36,title2:32,title3:28,title4:24,headline1:16,body1:16,label1:16,label2:16,caption1:16,caption2:16,legal1:12}},n={fontSize:{display1:46,display2:38,display3:34,title1:30,title2:26,title3:22,title4:18,headline1:14,body1:14,label1:13,label2:13,caption1:12,caption2:12,legal1:11},lineHeight:{...a.lineHeight,title1:40,headline1:20,body1:20,legal1:16}},d={fontSize:{display1:47,display2:39,display3:35,title1:31,title2:27,title3:23,title4:19,headline1:15,body1:15,label1:13,label2:13,caption1:12,caption2:12,legal1:11},lineHeight:{...n.lineHeight,title2:36,title3:32}},o={fontSize:{...d.fontSize,display1:48,display2:40,display3:36,title1:32,title2:28,title3:24,title4:20,headline1:16,body1:16,label1:14,label2:14},lineHeight:{...d.lineHeight,title2:36,title3:32,headline1:20,body1:20,label1:20,label2:20}},s={fontSize:{display1:50,display2:42,display3:38,title1:34,title2:30,title3:26,title4:22,headline1:18,body1:16,label1:16,label2:16,caption1:14,caption2:14,legal1:13},lineHeight:{...o.lineHeight,title1:44,headline1:24,body1:24,caption1:20,caption2:20}},b={fontSize:{display1:52,display2:44,display3:40,title1:36,title2:32,title3:28,title4:26,headline1:20,body1:20,label1:18,label2:18,caption1:16,caption2:16,legal1:15},lineHeight:{...s.lineHeight,title2:40,title3:36,headline1:28,body1:28,label1:24,label2:24,legal1:20}},p={fontSize:{display1:54,display2:46,display3:42,title1:38,title2:34,title3:30,title4:28,headline1:22,body1:22,label1:20,label2:20,caption1:18,caption2:18,legal1:17},lineHeight:{...b.lineHeight,title1:48,title2:44,title4:32,label1:28,label2:28,caption1:24,caption2:24}};function y(l){return Object.entries(l)}function c(l,e){return Object.keys(l).reduce(((i,t,a)=>(i[t]=e(l[t],t,a),i)),{})}export{y as entries,l as fontFamily,i as fontWeight,e as fontWeightMap,o as large,c as mapValues,d as medium,n as small,t as textTransform,s as xLarge,a as xSmall,b as xxLarge,p as xxxLarge};
@@ -1,3 +1,3 @@
1
- import{fromEntries as r,FONT_DECLARATIONS_MAP as o}from"./chunk-5TXG2NIQ.js";import{entries as a}from"./chunk-4J7ZJHCN.js";import{FONT_FAMILY_PREFIX as e}from"./chunk-PCSDVJE6.js";import n from"tailwindcss/plugin";
2
- /*! © 2024 Yahoo, Inc. UDS v1.2.0 */
1
+ import{fromEntries as r,FONT_DECLARATIONS_MAP as o}from"./chunk-YRYDHL65.js";import{entries as a}from"./chunk-BEYSF2MO.js";import{FONT_FAMILY_PREFIX as e}from"./chunk-33B23P5G.js";import n from"tailwindcss/plugin";
2
+ /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
3
3
  function t(r,a){for(const e of r){const{declarations:r}=o[e];for(const o of r)a({"@font-face":o})}}var s=n.withOptions((function({fontIds:r}){return function({addBase:o}){t(r,o)}}));function i(r){return{light:{colorScheme:"light",...r.colorMode.light._vars},dark:{colorScheme:"dark",...r.colorMode.dark._vars}}}function c(r){return r.flatMap((r=>{const{declarations:a}=o[r];return a.map((r=>r))}))}function l(r){return`"${r}"`}function f(n){return r(a(n).map((([r,a])=>{const n=`--${e}-${r}`,t=o[a];return[n,[t.declarations[0].fontFamily,...t.fallback].map(l).join(", ")]})))}function d(r){return{...r.borderRadius._vars,...r.borderWidth._vars,...r.avatarSizes._vars,...r.iconSizes._vars,...r.fontFamily._vars,...r.fontSize._vars,...r.fontWeight._vars,...r.lineHeight._vars,...r.textTransform._vars}}function u(r){return{xSmall:d(r.scaleMode.xSmall),small:d(r.scaleMode.small),medium:d(r.scaleMode.medium),large:d(r.scaleMode.large),xLarge:d(r.scaleMode.xLarge),xxLarge:d(r.scaleMode.xxLarge),xxxLarge:d(r.scaleMode.xxxLarge)}}export{t as addFontFaceDeclarations,s as addFontsPlugin,i as getColorModeStyles,c as getFontFaceDeclarations,f as getFontStyles,u as getScaleModeStyles};
@@ -1,2 +1,2 @@
1
- /*! © 2024 Yahoo, Inc. UDS v1.2.0 */
1
+ /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */
2
2
  var e=(e=>"undefined"!=typeof require?require:"undefined"!=typeof Proxy?new Proxy(e,{get:(e,r)=>("undefined"!=typeof require?require:e)[r]}):e)((function(e){if("undefined"!=typeof require)return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}));export{e as __require};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ /*! © 2024 Yahoo, Inc. UDS v0.0.0-development */var o="uds",e=`${o}-avatar-size`,t=`${o}-border-radius`,r=`${o}-border-width`,s=`${o}-font`,_=`${o}-font-size`,E=`${o}-font-weight`,n=`${o}-icon-size`,d=`${o}-line-height`,A=`${o}-motion`,i=`${o}-spectrum-color`,S=`${o}-text-transform`,a=`${o}-color-mode-dark`,l=`${o}-color-mode-light`,L=`${o}-scale-mode-xsmall`,$=`${o}-scale-mode-small`,c=`${o}-scale-mode-medium`,p=`${o}-scale-mode-large`,x=`${o}-scale-mode-xlarge`,b=`${o}-scale-mode-xxlarge`,R=`${o}-scale-mode-xxxlarge`,M=l,O=p,C={borderRadius:`--${o}-button-border-radius`,borderWidth:`--${o}-button-border-width`,color:`--${o}-button-color`,backgroundColor:`--${o}-button-background-color`,borderColor:`--${o}-button-border-color`,padding:`--${o}-button-padding`,columnGap:`--${o}-button-gap`,fontFamily:`--${o}-button-font`,fontWeight:`--${o}-button-font-weight`,fontSize:`--${o}-button-font-size`,lineHeight:`--${o}-button-line-height`,textTransform:`--${o}-button-text-transform`,iconSize:`--${o}-button-icon-size`,effects:{scale:{rest:`--${o}-button-effects-scale--rest`,hover:`--${o}-button-effects-scale--hover`,pressed:`--${o}-button-effects-scale--pressed`}}},u={padding:`--${o}-icon-button-padding`,iconSize:`--${o}-icon-button-icon-size`};exports.AVATAR_SIZE_PREFIX=e,exports.BORDER_RADIUS_PREFIX=t,exports.BORDER_WIDTH_PREFIX=r,exports.BUTTON_CSS_VAR_MAP=C,exports.DARK_COLOR_MODE_CLASSNAME=a,exports.DEFAULT_COLOR_MODE_CLASSNAME=M,exports.DEFAULT_SCALE_MODE_CLASSNAME=O,exports.FONT_FAMILY_PREFIX=s,exports.FONT_SIZE_PREFIX=_,exports.FONT_WEIGHT_PREFIX=E,exports.ICON_BUTTON_CSS_VAR_MAP=u,exports.ICON_SIZE_PREFIX=n,exports.LARGE_SCALE_MODE_CLASSNAME=p,exports.LIGHT_COLOR_MODE_CLASSNAME=l,exports.LINE_HEIGHT_PREFIX=d,exports.MEDIUM_SCALE_MODE_CLASSNAME=c,exports.MOTION_PREFIX=A,exports.PSEUDO_STYLE_SELECTOR_MAP={hover:":hover:not([disabled])",pressed:":active:not([disabled])",disabled:":disabled",focused:":focus-visible",notDisabled:":not(:disabled)"},exports.SMALL_SCALE_MODE_CLASSNAME=$,exports.SPECTRUM_COLOR_PREFIX=i,exports.TEXT_TRANSFORM_PREFIX=S,exports.UDS_PREFIX=o,exports.XLARGE_SCALE_MODE_CLASSNAME=x,exports.XSMALL_SCALE_MODE_CLASSNAME=L,exports.XXLARGE_SCALE_MODE_CLASSNAME=b,exports.XXXLARGE_SCALE_MODE_CLASSNAME=R;