@yahoo/uds 3.0.0-beta.1 → 3.0.0

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.
Files changed (93) hide show
  1. package/cli/ButtonFile2.mock.tsx +11 -0
  2. package/cli/bin/uds-darwin-arm64-baseline +0 -0
  3. package/cli/bin/uds-linux-arm64 +0 -0
  4. package/cli/bin/uds-linux-x64-baseline +0 -0
  5. package/cli/codemods/addCommentAboveComponents.ts +8 -2
  6. package/cli/commands/expo/_setup.ts +1 -0
  7. package/cli/commands/sync.ts +3 -0
  8. package/cli/preload.ts +1 -0
  9. package/cli/utils/auth.ts +1 -0
  10. package/cli/utils/configWorker.ts +10 -2
  11. package/cli/utils/purgeCSS.ts +18 -6
  12. package/cli/utils/setupConfigWorker.ts +2 -2
  13. package/cli/utils/types.ts +3 -1
  14. package/dist/{Text-DC5H-ljU.d.cts → Text-yeQcITg9.d.cts} +1 -1
  15. package/dist/{Text-DC5H-ljU.d.ts → Text-yeQcITg9.d.ts} +1 -1
  16. package/dist/{VStack-dsjTgotn.d.ts → VStack-CJs5afN8.d.ts} +1 -1
  17. package/dist/{VStack-lZcVQtuR.d.cts → VStack-GpQHE4xQ.d.cts} +1 -1
  18. package/dist/analytics/server.js +1 -1
  19. package/dist/{chunk-ROCVTVD4.js → chunk-4G4TBHHL.js} +1 -1
  20. package/dist/chunk-6CVEYTLQ.js +2 -0
  21. package/dist/chunk-6XNKVFUM.cjs +2 -0
  22. package/dist/{chunk-GWUSJOIP.js → chunk-AFPPCX7S.js} +2 -2
  23. package/dist/{chunk-RCTE4OK2.cjs → chunk-BNLUH23E.cjs} +1 -1
  24. package/dist/{chunk-3R4CMTF2.js → chunk-EWJ3J526.js} +1 -1
  25. package/dist/{chunk-GXWRHF26.cjs → chunk-FOX6Q5GR.cjs} +1 -1
  26. package/dist/{chunk-UWAIMWW7.cjs → chunk-HTL6WRXY.cjs} +1 -1
  27. package/dist/{chunk-H35WDIEH.cjs → chunk-J7PUOUXC.cjs} +1 -1
  28. package/dist/{chunk-COT7GQ26.js → chunk-N3FKHXEJ.js} +2 -2
  29. package/dist/{chunk-PLVCO2Q2.cjs → chunk-NUEZVMWZ.cjs} +1 -1
  30. package/dist/chunk-O26JIFUR.cjs +3 -0
  31. package/dist/{chunk-TYCIDVTR.js → chunk-S5UKKXRV.js} +1 -1
  32. package/dist/chunk-WCB4EHGZ.js +3 -0
  33. package/dist/client/index.cjs +2 -2
  34. package/dist/client/index.d.cts +3 -3
  35. package/dist/client/index.d.ts +3 -3
  36. package/dist/client/index.js +3 -3
  37. package/dist/experimental/client/index.cjs +1 -1
  38. package/dist/experimental/client/index.d.cts +1 -1
  39. package/dist/experimental/client/index.d.ts +1 -1
  40. package/dist/experimental/client/index.js +1 -1
  41. package/dist/experimental/index.cjs +2 -2
  42. package/dist/experimental/index.d.cts +1 -1
  43. package/dist/experimental/index.d.ts +1 -1
  44. package/dist/experimental/index.js +1 -1
  45. package/dist/fixtures.cjs +2 -1
  46. package/dist/fixtures.js +2 -1
  47. package/dist/flags.cjs +1 -1
  48. package/dist/flags.js +1 -1
  49. package/dist/{index-B1ZHRmSN.d.ts → index-CU_UPAew.d.ts} +4 -4
  50. package/dist/{index-By9VJ9yq.d.cts → index-DUFUMc1S.d.cts} +4 -4
  51. package/dist/index.cjs +1 -1
  52. package/dist/index.d.cts +108 -108
  53. package/dist/index.d.ts +108 -108
  54. package/dist/index.js +1 -1
  55. package/dist/metafile-cjs.json +1 -1
  56. package/dist/metafile-esm.json +1 -1
  57. package/dist/tailwind/plugin.cjs +1 -1
  58. package/dist/tailwind/plugin.d.cts +9 -4
  59. package/dist/tailwind/plugin.d.ts +9 -4
  60. package/dist/tailwind/plugin.js +2 -2
  61. package/dist/tailwind/purger.cjs +2 -2
  62. package/dist/tailwind/purger.js +3 -3
  63. package/dist/tailwind/tsMorph.cjs +1 -1
  64. package/dist/tailwind/tsMorph.js +1 -1
  65. package/dist/tailwind/utils.cjs +1 -1
  66. package/dist/tailwind/utils.d.cts +4 -4
  67. package/dist/tailwind/utils.d.ts +4 -4
  68. package/dist/tailwind/utils.js +1 -1
  69. package/dist/tokens/automation/configs.cjs +1 -1
  70. package/dist/tokens/automation/configs.d.cts +2 -2
  71. package/dist/tokens/automation/configs.d.ts +2 -2
  72. package/dist/tokens/automation/configs.js +1 -1
  73. package/dist/tokens/automation/properties.cjs +1 -1
  74. package/dist/tokens/automation/properties.d.cts +2 -2
  75. package/dist/tokens/automation/properties.d.ts +2 -2
  76. package/dist/tokens/automation/properties.js +1 -1
  77. package/dist/tokens/index.cjs +1 -1
  78. package/dist/tokens/index.d.cts +3810 -3810
  79. package/dist/tokens/index.d.ts +3810 -3810
  80. package/dist/tokens/index.js +1 -1
  81. package/dist/tokens/parseTokens.cjs +1 -1
  82. package/dist/tokens/parseTokens.d.cts +1 -1
  83. package/dist/tokens/parseTokens.d.ts +1 -1
  84. package/dist/tokens/parseTokens.js +1 -1
  85. package/dist/{types-oxQ-ciqn.d.cts → types-d2CfR7zp.d.cts} +1962 -1954
  86. package/dist/{types-oxQ-ciqn.d.ts → types-d2CfR7zp.d.ts} +1962 -1954
  87. package/package.json +1 -1
  88. package/dist/chunk-DIZ6AEFQ.cjs +0 -3
  89. package/dist/chunk-IGRY2O2E.js +0 -2
  90. package/dist/chunk-IQXT3UML.cjs +0 -2
  91. package/dist/chunk-SWTZ62RF.js +0 -3
  92. /package/dist/{motionFeatures-II2BNXF5.cjs → motionFeatures-6LIGGXPL.cjs} +0 -0
  93. /package/dist/{motionFeatures-25DAPVNO.js → motionFeatures-SJISLQ4M.js} +0 -0
@@ -0,0 +1,11 @@
1
+ import { Button, IconButton } from 'another-package';
2
+ import { Link } from '@yahoo/uds-icons';
3
+
4
+ export const PageB = () => {
5
+ return (
6
+ <Button>Click me</Button>
7
+ <Button type="button">Click me</Button>
8
+ <Button type="submit">Click me</Button>
9
+ <IconButton icon={Link} />
10
+ );
11
+ }
Binary file
Binary file
Binary file
@@ -1,7 +1,13 @@
1
1
  import { IndentationText, Project } from 'ts-morph';
2
2
 
3
- import { getGlobPattern, getImportsFromPackage, getProject } from './utils';
4
- import { getJSXElements, hasJSXProperty, matchesJSXTagName } from './utils';
3
+ import {
4
+ getGlobPattern,
5
+ getImportsFromPackage,
6
+ getJSXElements,
7
+ getProject,
8
+ hasJSXProperty,
9
+ matchesJSXTagName,
10
+ } from './utils';
5
11
 
6
12
  interface LineInfo {
7
13
  linePos: number;
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import os from 'node:os';
3
3
 
4
4
  // @ts-expect-error this is a transitive dep of expo, which is required in consumers to even run this setup
5
+ // eslint-disable-next-line import/no-unresolved
5
6
  import { EasJsonAccessor, EasJsonUtils, Platform } from '@expo/eas-json';
6
7
  import { print, type Props } from 'bluebun';
7
8
  import { $, semver, which } from 'bun';
@@ -1,5 +1,6 @@
1
1
  import { magenta, print, Props } from 'bluebun';
2
2
 
3
+ import packageJson from '../../package.json';
3
4
  import { trackEvent } from '../utils/analytics';
4
5
  import { setupConfigWorker } from '../utils/setupConfigWorker';
5
6
  import { SyncOptions } from '../utils/types';
@@ -22,10 +23,12 @@ export default {
22
23
  print(`${magenta('Usage:')} ${name} ${commandPath} --id <config-id>\n`);
23
24
  return;
24
25
  }
26
+
25
27
  try {
26
28
  await setupConfigWorker({
27
29
  id,
28
30
  outFile: outFile ?? './uds.config.ts',
31
+ version: packageJson.version,
29
32
  onUpdate: ({ worker }) => {
30
33
  if (!options.watch) {
31
34
  worker.terminate();
package/cli/preload.ts CHANGED
@@ -1,3 +1,4 @@
1
+ // eslint-disable-next-line import/no-unresolved
1
2
  import { mock, spyOn } from 'bun:test';
2
3
 
3
4
  spyOn(global.Bun.Glob.prototype, 'scan').mockImplementation(() => {
package/cli/utils/auth.ts CHANGED
@@ -5,6 +5,7 @@ import util from 'node:util';
5
5
 
6
6
  import { ask, print, red } from 'bluebun';
7
7
  import Bun from 'bun';
8
+ // eslint-disable-next-line import/no-unresolved
8
9
  import { type FirebaseUser } from 'root/database/firebase';
9
10
  import { v5 as uuidv5 } from 'uuid';
10
11
 
@@ -31,8 +31,8 @@ if (process.env.DATABASE === 'local') {
31
31
  }
32
32
 
33
33
  self.onmessage = async ({ data }: ConfigWorkerThreadMessageEvent) => {
34
- const { id } = data.resp;
35
- const FETCH_URL = `${CONFIG_ENDPOINT}?id=${id}`;
34
+ const { id, version } = data.resp;
35
+ const FETCH_URL = `${CONFIG_ENDPOINT}?id=${id}&version=${version}`;
36
36
  if (data.type === 'init') {
37
37
  try {
38
38
  console.log('Fetching from configurator...');
@@ -50,6 +50,14 @@ self.onmessage = async ({ data }: ConfigWorkerThreadMessageEvent) => {
50
50
  `);
51
51
  }
52
52
 
53
+ // Needs upgrade
54
+ if (resp.status === 402) {
55
+ throw new Error(`
56
+ ${resp.status} error: ${resp.statusText}\n
57
+ This usually means you need to upgrade the npm package @yahoo/uds to the latest version.
58
+ `);
59
+ }
60
+
53
61
  throw new Error(`Error fetching config id '${id}'. Does it exist in the Configurator?`);
54
62
  }
55
63
 
@@ -182,15 +182,27 @@ export const getTailwindSafelist = (project: Project, componentList: string[]):
182
182
  });
183
183
 
184
184
  for (const [propName, usedValues] of usedProps) {
185
- usedValues.forEach((option) => {
186
- safeList.push((variants[propName as never][option] as string)?.replaceAll('\\', ''));
187
- });
185
+ const variantGroup = variants[propName as keyof typeof variants];
186
+ if (variantGroup) {
187
+ usedValues.forEach((option) => {
188
+ const variantClass = (variantGroup as Record<string, string>)[option];
189
+ if (variantClass) {
190
+ safeList.push(variantClass.replaceAll('\\', ''));
191
+ }
192
+ });
193
+ }
188
194
  }
189
195
 
190
196
  for (const [variant, variantOptions] of scanGetStylesReferences(project)) {
191
- variantOptions.forEach((option) => {
192
- safeList.push((variants[variant as never][option] as string)?.replaceAll('\\', ''));
193
- });
197
+ const variantGroup = variants[variant as keyof typeof variants];
198
+ if (variantGroup) {
199
+ variantOptions.forEach((option) => {
200
+ const variantClass = (variantGroup as Record<string, string>)[option];
201
+ if (variantClass) {
202
+ safeList.push(variantClass.replaceAll('\\', ''));
203
+ }
204
+ });
205
+ }
194
206
  }
195
207
 
196
208
  // Return a deduped list and strip out any empty strings
@@ -7,7 +7,7 @@ interface ConfigWorkerOptions extends SyncOptions {
7
7
  onUpdate?: (params: { worker: Worker }) => void;
8
8
  }
9
9
 
10
- export async function setupConfigWorker({ id, outFile, onUpdate }: ConfigWorkerOptions) {
10
+ export async function setupConfigWorker({ id, outFile, version, onUpdate }: ConfigWorkerOptions) {
11
11
  const workerPath = path.resolve(import.meta.dir, './configWorker');
12
12
  const workerURL = Bun.pathToFileURL(workerPath).href;
13
13
  const outFilePath = `${Bun.env.PWD}/${outFile}`;
@@ -22,7 +22,7 @@ export async function setupConfigWorker({ id, outFile, onUpdate }: ConfigWorkerO
22
22
  const worker = new Worker(workerURL);
23
23
 
24
24
  worker.addEventListener('open', () => {
25
- worker.postMessage({ type: 'init', resp: { id } });
25
+ worker.postMessage({ type: 'init', resp: { id, version } });
26
26
  });
27
27
 
28
28
  worker.addEventListener('message', async ({ data }: ConfigWorkerMainThreadMessageEvent) => {
@@ -2,7 +2,7 @@ import { type UniversalTokensConfig } from '@yahoo/uds/tokens';
2
2
 
3
3
  export type ConfigWorkerThreadMessageEvent = Bun.MessageEvent<{
4
4
  type: 'init';
5
- resp: { id: string };
5
+ resp: { id: string; version: string };
6
6
  }>;
7
7
  export type ConfigWorkerMainThreadMessageEvent = Bun.MessageEvent<{
8
8
  type: 'update';
@@ -16,4 +16,6 @@ export type SyncOptions = {
16
16
  outFile: string;
17
17
  /** Enable watch mode? */
18
18
  watch?: boolean;
19
+ /** The version of the CLI */
20
+ version: string;
19
21
  };
@@ -216,7 +216,7 @@ type DivProps = React.HTMLAttributes<HTMLDivElement>;
216
216
  interface BoxProps extends UniversalBoxProps, DivProps {
217
217
  }
218
218
 
219
- type TextElementTagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'span' | 'label' | 'li';
219
+ type TextElementTagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'span' | 'label' | 'li' | 'sup';
220
220
  type ColorWithInherit = Exclude<UniversalTextProps['color'], undefined> | 'inherit';
221
221
  type VariantWithInherit = Exclude<UniversalTextProps['variant'], undefined> | 'inherit';
222
222
  type TextProps<TagName extends TextElementTagName = TextElementTagName> = {
@@ -216,7 +216,7 @@ type DivProps = React.HTMLAttributes<HTMLDivElement>;
216
216
  interface BoxProps extends UniversalBoxProps, DivProps {
217
217
  }
218
218
 
219
- type TextElementTagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'span' | 'label' | 'li';
219
+ type TextElementTagName = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'p' | 'strong' | 'span' | 'label' | 'li' | 'sup';
220
220
  type ColorWithInherit = Exclude<UniversalTextProps['color'], undefined> | 'inherit';
221
221
  type VariantWithInherit = Exclude<UniversalTextProps['variant'], undefined> | 'inherit';
222
222
  type TextProps<TagName extends TextElementTagName = TextElementTagName> = {
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { e as UniversalBoxProps, f as UniversalStackProps, g as UniversalDividerProps, h as UniversalInputProps } from './types-oxQ-ciqn.js';
2
+ import { e as UniversalBoxProps, f as UniversalStackProps, g as UniversalDividerProps, h as UniversalInputProps } from './types-d2CfR7zp.js';
3
3
  import { HTMLMotionProps } from 'motion/react';
4
4
 
5
5
  type DivProps = React.HTMLAttributes<HTMLDivElement>;
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { e as UniversalBoxProps, f as UniversalStackProps, g as UniversalDividerProps, h as UniversalInputProps } from './types-oxQ-ciqn.cjs';
2
+ import { e as UniversalBoxProps, f as UniversalStackProps, g as UniversalDividerProps, h as UniversalInputProps } from './types-d2CfR7zp.cjs';
3
3
  import { HTMLMotionProps } from 'motion/react';
4
4
 
5
5
  type DivProps = React.HTMLAttributes<HTMLDivElement>;
@@ -1 +1 @@
1
- import e from"node:os";import t from"node:child_process";import i from"os";import{v5 as n}from"uuid";/*! © 2025 Yahoo, Inc. UDS v3.0.0-development */var r=/^(\w+)\:\s+flags=/,s=/^(\w+)\s{2,}link encap:\w+/i,o=/(?:ether|HWaddr)\s+((?:[a-z0-9]{2}\:){5}[a-z0-9]{2})/i,a=/inet\s(?:addr\:)?(\d+\.\d+\.\d+\.\d+)/;function c(){let t="eth";const i=e.platform();return"darwin"===i?t="en":"win32"===i&&(t=void 0),t}function l(e,t){return"IPv4"===t?"IPv4"===e||4===e:"IPv6"===t?"IPv6"===e||6===e:e===t}function d(e,t,i=!1){let n;for(const r of e)if(l(r.family,t)){if(i&&r.address.startsWith("127."))continue;if("IPv6"!==t)return r;if(0===r.scopeid)return r;n||(n=r)}return n}function u(i,n){let l;l=i,l=l||c();const u=function(t,i){const n=e.networkInterfaces(),r=!i;if(t=t||"IPv4",i=i||c())for(let e=-1;e<8;e++){const r=n[i+(e>=0?e:"")];if(r){const e=d(r,t);if(e)return e}}if(r)for(const e in n){const i=n[e];if(i){const e=d(i,t,!0);if(e)return e}}}("IPv4",l);return u?(process.env.CI||"ff:00:00:00:00:00"!==u.mac&&"00:00:00:00:00:00"!==u.mac||(u.mac=""),u.mac?n(null,u.mac):void t.exec("win32"===e.platform()?"ipconfig/all":"/sbin/ifconfig",{timeout:5e3},((e,t)=>{if(e||!t)return n(e);if(!l)return n();const i=function(e,t,i){const n=e.split("\n");for(let e=0;e<n.length;e++){let c=n[e].trimEnd();const l=r.exec(c)||s.exec(c);if(!l)continue;if(0!==l[1].indexOf(t))continue;let d=null,u=null,m=o.exec(c);for(m&&(u=m[1]),e++;;){if(c=n[e],!c||r.exec(c)||s.exec(c)){e--;break}u||(m=o.exec(c),m&&(u=m[1])),d||(m=a.exec(c),m&&(d=m[1])),e++}if(d===i)return u}return null}(t||"",l,u.address);n(null,i)}))):n()}async function m(){const e=await new Promise(((e,t)=>{u("",((i,n)=>{if(i)return t(i);e(n||null)}))}))??i.hostname();return n(e,"6ba7b810-9dad-11d1-80b4-00c04fd430c8")}var f={all:"G-0C2FBF3K5Y",docs:"G-6HSWE4WFFV",cli:"G-4N1G785K8W","figma-plugin":"G-Q1PFL2R17E","figma-dev-mode":"G-ZD8YHG3NWV",metrics:"G-1JW6B5D3JH",configurator:"G-JEHT4QPKB0"},h={all:"GwoNoIVUQwy-AP5hKnoskw",cli:"lrds1CjyTGimkKEA9hvmmQ","figma-plugin":"CgJ4b2ISS8KArcJHihE9og","figma-dev-mode":"Ns1whhmxTE-QIpDdbZr45Q"},p=["development","test"].includes(process.env.NODE_ENV??""),w=new class{#e;#t;#i;#n=!1;appName;user;debugMode;async init({appName:e,measurementId:t,apiSecret:i,debugMode:n,user:r}){if(!this.#n)return this.#e=t,this.#t=i,this.user=r,this.appName=e,this.debugMode=n??p,m().then((e=>{this.#i=e,this.#n=!0,this.#r()}));console.info("UDS analytics: already initialized.")}getClientId(){return this.#i}#r(){if(!this.#n)throw new Error("UDS analytics: not been initialized. Have you called init()?");if(!this.#e)throw new Error("UDS analytics: measurement property ID has not been set.");if(!this.#i)throw new Error("UDS analytics - client ID has not been set.");if(!this.user)throw new Error("UDS analytics: user has not been set.");if(!this.user.analyticsContext)throw new Error("UDS analytics: user is missing analyticsContext.")}pageview(e={}){return this.event("page_view",e)}event(e,t={}){return this.#s(e,t)}error(e={}){return this.#s("error",e)}async#s(e,t={}){this.#r();const{role:i,team:n}=this.user.analyticsContext??{},r=i&&n?{role:{value:i},team:{value:n}}:void 0,s={client_id:this.#i,user_id:this.user.id,user_properties:r,events:[{name:e,params:{app_name:this.appName,engagement_time_msec:"0",...this.debugMode&&{debug_mode:!0},...t}}]},o=[{id:this.#e,apiSecret:this.#t},{id:f.all,apiSecret:h.all}].map((async({id:t,apiSecret:i})=>{try{const n=new URL("https://www.google-analytics.com/mp/collect");n.searchParams.set("measurement_id",t),n.searchParams.set("api_secret",i);const r=await fetch(n.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok)throw new Error(`HTTP error status: ${r.status}`);p&&console.log(`UDS analytics: event "${e}" sent successfully to ${t}.`)}catch(e){console.error(`UDS analytics: error sending event to ${t}:`,e)}}));return Promise.allSettled(o)}};export{f as GA_MEASUREMENT_IDS,h as GA_MEASUREMENT_SECRETS,w as track};
1
+ import e from"node:os";import t from"node:child_process";import i from"os";import{v5 as n}from"uuid";/*! © 2025 Yahoo, Inc. UDS v0.0.0-development */var r=/^(\w+)\:\s+flags=/,s=/^(\w+)\s{2,}link encap:\w+/i,o=/(?:ether|HWaddr)\s+((?:[a-z0-9]{2}\:){5}[a-z0-9]{2})/i,a=/inet\s(?:addr\:)?(\d+\.\d+\.\d+\.\d+)/;function c(){let t="eth";const i=e.platform();return"darwin"===i?t="en":"win32"===i&&(t=void 0),t}function l(e,t){return"IPv4"===t?"IPv4"===e||4===e:"IPv6"===t?"IPv6"===e||6===e:e===t}function d(e,t,i=!1){let n;for(const r of e)if(l(r.family,t)){if(i&&r.address.startsWith("127."))continue;if("IPv6"!==t)return r;if(0===r.scopeid)return r;n||(n=r)}return n}function u(i,n){let l;l=i,l=l||c();const u=function(t,i){const n=e.networkInterfaces(),r=!i;if(t=t||"IPv4",i=i||c())for(let e=-1;e<8;e++){const r=n[i+(e>=0?e:"")];if(r){const e=d(r,t);if(e)return e}}if(r)for(const e in n){const i=n[e];if(i){const e=d(i,t,!0);if(e)return e}}}("IPv4",l);return u?(process.env.CI||"ff:00:00:00:00:00"!==u.mac&&"00:00:00:00:00:00"!==u.mac||(u.mac=""),u.mac?n(null,u.mac):void t.exec("win32"===e.platform()?"ipconfig/all":"/sbin/ifconfig",{timeout:5e3},((e,t)=>{if(e||!t)return n(e);if(!l)return n();const i=function(e,t,i){const n=e.split("\n");for(let e=0;e<n.length;e++){let c=n[e].trimEnd();const l=r.exec(c)||s.exec(c);if(!l)continue;if(0!==l[1].indexOf(t))continue;let d=null,u=null,m=o.exec(c);for(m&&(u=m[1]),e++;;){if(c=n[e],!c||r.exec(c)||s.exec(c)){e--;break}u||(m=o.exec(c),m&&(u=m[1])),d||(m=a.exec(c),m&&(d=m[1])),e++}if(d===i)return u}return null}(t||"",l,u.address);n(null,i)}))):n()}async function m(){const e=await new Promise(((e,t)=>{u("",((i,n)=>{if(i)return t(i);e(n||null)}))}))??i.hostname();return n(e,"6ba7b810-9dad-11d1-80b4-00c04fd430c8")}var f={all:"G-0C2FBF3K5Y",docs:"G-6HSWE4WFFV",cli:"G-4N1G785K8W","figma-plugin":"G-Q1PFL2R17E","figma-dev-mode":"G-ZD8YHG3NWV",metrics:"G-1JW6B5D3JH",configurator:"G-JEHT4QPKB0"},h={all:"GwoNoIVUQwy-AP5hKnoskw",cli:"lrds1CjyTGimkKEA9hvmmQ","figma-plugin":"CgJ4b2ISS8KArcJHihE9og","figma-dev-mode":"Ns1whhmxTE-QIpDdbZr45Q"},p=["development","test"].includes(process.env.NODE_ENV??""),w=new class{#e;#t;#i;#n=!1;appName;user;debugMode;async init({appName:e,measurementId:t,apiSecret:i,debugMode:n,user:r}){if(!this.#n)return this.#e=t,this.#t=i,this.user=r,this.appName=e,this.debugMode=n??p,m().then((e=>{this.#i=e,this.#n=!0,this.#r()}));console.info("UDS analytics: already initialized.")}getClientId(){return this.#i}#r(){if(!this.#n)throw new Error("UDS analytics: not been initialized. Have you called init()?");if(!this.#e)throw new Error("UDS analytics: measurement property ID has not been set.");if(!this.#i)throw new Error("UDS analytics - client ID has not been set.");if(!this.user)throw new Error("UDS analytics: user has not been set.");if(!this.user.analyticsContext)throw new Error("UDS analytics: user is missing analyticsContext.")}pageview(e={}){return this.event("page_view",e)}event(e,t={}){return this.#s(e,t)}error(e={}){return this.#s("error",e)}async#s(e,t={}){this.#r();const{role:i,team:n}=this.user.analyticsContext??{},r=i&&n?{role:{value:i},team:{value:n}}:void 0,s={client_id:this.#i,user_id:this.user.id,user_properties:r,events:[{name:e,params:{app_name:this.appName,engagement_time_msec:"0",...this.debugMode&&{debug_mode:!0},...t}}]},o=[{id:this.#e,apiSecret:this.#t},{id:f.all,apiSecret:h.all}].map((async({id:t,apiSecret:i})=>{try{const n=new URL("https://www.google-analytics.com/mp/collect");n.searchParams.set("measurement_id",t),n.searchParams.set("api_secret",i);const r=await fetch(n.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok)throw new Error(`HTTP error status: ${r.status}`);p&&console.log(`UDS analytics: event "${e}" sent successfully to ${t}.`)}catch(e){console.error(`UDS analytics: error sending event to ${t}:`,e)}}));return Promise.allSettled(o)}};export{f as GA_MEASUREMENT_IDS,h as GA_MEASUREMENT_SECRETS,w as track};
@@ -1,2 +1,2 @@
1
- /*! © 2025 Yahoo, Inc. UDS v3.0.0-development */
1
+ /*! © 2025 Yahoo, Inc. UDS v0.0.0-development */
2
2
  var o="uds",t=`${o}-avatar-size`,e=`${o}-border-radius`,n=`${o}-border-width`,d=`${o}-font`,s=`${o}-font-size`,i=`${o}-font-weight`,r=`${o}-font-slant`,a=`${o}-font-width`,l=`${o}-icon-size`,$=`${o}-line-height`,b=`${o}-motion`,c=`${o}-spectrum-color`,u=`${o}-text-transform`,f=`${o}-color-mode-dark`,h=`${o}-color-mode-light`,m=`${o}-scale-mode-xsmall`,g=`${o}-scale-mode-small`,p=`${o}-scale-mode-medium`,x=`${o}-scale-mode-large`,w=`${o}-scale-mode-xlarge`,v=`${o}-scale-mode-xxlarge`,z=`${o}-scale-mode-xxxlarge`,S=h,W=x,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`,fontWidth:`--${o}-button-font-width`,fontSlant:`--${o}-button-font-slant`,fontSize:`--${o}-button-font-size`,lineHeight:`--${o}-button-line-height`,textTransform:`--${o}-button-text-transform`,iconSize:`--${o}-button-icon-size`,dropShadow:`--${o}-button-shadow`,insetShadow:`--${o}-button-inset-shadow`,effects:{scale:{rest:`--${o}-button-effects-scale--rest`,hover:`--${o}-button-effects-scale--hover`,pressed:`--${o}-button-effects-scale--pressed`}}},C={padding:`--${o}-icon-button-padding`,iconSize:`--${o}-icon-button-icon-size`},y={hover:":hover:not([disabled])",pressed:":active:not([disabled])",disabled:":disabled",focused:":focus-visible",focusedWithin:":has(:focus-visible)",notDisabled:":not(:disabled)"};export{t as AVATAR_SIZE_PREFIX,e as BORDER_RADIUS_PREFIX,n as BORDER_WIDTH_PREFIX,k as BUTTON_CSS_VAR_MAP,f as DARK_COLOR_MODE_CLASSNAME,S as DEFAULT_COLOR_MODE_CLASSNAME,W as DEFAULT_SCALE_MODE_CLASSNAME,d as FONT_FAMILY_PREFIX,s as FONT_SIZE_PREFIX,r as FONT_SLANT_PREFIX,i as FONT_WEIGHT_PREFIX,a as FONT_WIDTH_PREFIX,C as ICON_BUTTON_CSS_VAR_MAP,l as ICON_SIZE_PREFIX,x as LARGE_SCALE_MODE_CLASSNAME,h as LIGHT_COLOR_MODE_CLASSNAME,$ as LINE_HEIGHT_PREFIX,p as MEDIUM_SCALE_MODE_CLASSNAME,b as MOTION_PREFIX,y as PSEUDO_STYLE_SELECTOR_MAP,g as SMALL_SCALE_MODE_CLASSNAME,c as SPECTRUM_COLOR_PREFIX,u as TEXT_TRANSFORM_PREFIX,o as UDS_PREFIX,w as XLARGE_SCALE_MODE_CLASSNAME,m as XSMALL_SCALE_MODE_CLASSNAME,v as XXLARGE_SCALE_MODE_CLASSNAME,z as XXXLARGE_SCALE_MODE_CLASSNAME};