@salt-ds/styles 0.0.0-snapshot-20251117223641 → 0.0.0-snapshot-20251118094021

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @salt-ds/styles
2
2
 
3
- ## 0.0.0-snapshot-20251117223641
3
+ ## 0.0.0-snapshot-20251118094021
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -16,7 +16,10 @@ function useInjectedClassName(component, props) {
16
16
  const { className: classNameProp, ...restProps } = props;
17
17
  const registry = React.useContext(InjectionContext);
18
18
  if (!registry) {
19
- return { className: classNameProp || "", props: restProps };
19
+ return {
20
+ className: classNameProp || "",
21
+ props: restProps
22
+ };
20
23
  }
21
24
  const entries = registry[component] ?? [];
22
25
  const injected = entries.map((e) => e.fn(restProps)).filter(Boolean);
@@ -1 +1 @@
1
- {"version":3,"file":"useClassNameInjection.js","sources":["../src/useClassNameInjection.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { createContext, useContext, useMemo } from \"react\";\n\nexport type ClassNameInjector<Props, Keys extends keyof Props> = (\n props: Pick<Props, Keys>,\n) => string | undefined;\n\ninterface ClassNameInjectorEntry<Props> {\n fn: (props: Props) => string | undefined;\n keys: (keyof Props)[];\n}\n\nexport type ClassNameInjectionRegistry = Record<\n string,\n // biome-ignore lint/suspicious/noExplicitAny: refer to ClassNameInjector which derives it's entry type based on the Props\n ClassNameInjectorEntry<any>[]\n>;\n\nconst InjectionContext = createContext<ClassNameInjectionRegistry | null>(null);\n\nexport type ClassNameInjectionProviderProps = {\n children: React.ReactNode;\n value?: ClassNameInjectionRegistry;\n};\n\nexport function ClassNameInjectionProvider({\n children,\n value,\n}: ClassNameInjectionProviderProps) {\n const registry = useMemo(() => value ?? {}, [value]);\n return (\n <InjectionContext.Provider value={registry}>\n {children}\n </InjectionContext.Provider>\n );\n}\n\ntype PropsWithClassName = { className?: string } & Record<string, any>;\n\nexport function useInjectedClassName<Props extends PropsWithClassName>(\n component: string,\n props: Props\n): { className: string; props: Omit<Props, \"className\"> } {\n const { className: classNameProp, ...restProps } = props;\n const registry = useContext(InjectionContext);\n\n if (!registry) {\n return { className: classNameProp || \"\", props: restProps as Omit<Props, \"className\"> };\n }\n\n const entries = registry[component] ?? [];\n const injected = entries.map((e) => e.fn(restProps)).filter(Boolean);\n const className = clsx(classNameProp, injected);\n\n const cleanProps = { ...restProps } as Omit<Props, \"className\">;\n for (const entry of entries) {\n for (const key of entry.keys) {\n delete (cleanProps as any)[key];\n }\n }\n\n return { className, props: cleanProps };\n}\n\nexport function registerClassInjector<Props, Keys extends keyof Props>(\n registry: ClassNameInjectionRegistry,\n component: string,\n keys: Keys[],\n injector: ClassNameInjector<Props, Keys>,\n) {\n registry[component] ??= [];\n const wrapped = (props: Props) => injector(props as Props);\n registry[component] = [...registry[component], { fn: wrapped, keys }];\n}\n"],"names":["createContext","useMemo","useContext","clsx"],"mappings":";;;;;;AAkBA,MAAM,gBAAA,GAAmBA,oBAAiD,IAAI,CAAA;AAOvE,SAAS,0BAAA,CAA2B;AAAA,EACzC,QAAA;AAAA,EACA;AACF,CAAA,EAAoC;AAClC,EAAA,MAAM,QAAA,GAAWC,cAAQ,MAAM,KAAA,IAAS,EAAC,EAAG,CAAC,KAAK,CAAC,CAAA;AACnD,EAAA,sCACG,gBAAA,CAAiB,QAAA,EAAjB,EAA0B,KAAA,EAAO,UAC/B,QAAA,EACH,CAAA;AAEJ;AAIO,SAAS,oBAAA,CACd,WACA,KAAA,EACwD;AACxD,EAAA,MAAM,EAAE,SAAA,EAAW,aAAA,EAAe,GAAG,WAAU,GAAI,KAAA;AACnD,EAAA,MAAM,QAAA,GAAWC,iBAAW,gBAAgB,CAAA;AAE5C,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,EAAE,SAAA,EAAW,aAAA,IAAiB,EAAA,EAAI,OAAO,SAAA,EAAsC;AAAA,EACxF;AAEA,EAAA,MAAM,OAAA,GAAU,QAAA,CAAS,SAAS,CAAA,IAAK,EAAC;AACxC,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,EAAA,CAAG,SAAS,CAAC,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA;AACnE,EAAA,MAAM,SAAA,GAAYC,SAAA,CAAK,aAAA,EAAe,QAAQ,CAAA;AAE9C,EAAA,MAAM,UAAA,GAAa,EAAE,GAAG,SAAA,EAAU;AAClC,EAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,IAAA,KAAA,MAAW,GAAA,IAAO,MAAM,IAAA,EAAM;AAC5B,MAAA,OAAQ,WAAmB,GAAG,CAAA;AAAA,IAChC;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,UAAA,EAAW;AACxC;AAEO,SAAS,qBAAA,CACd,QAAA,EACA,SAAA,EACA,IAAA,EACA,QAAA,EACA;AACA,EAAA,QAAA,CAAS,SAAS,MAAM,EAAC;AACzB,EAAA,MAAM,OAAA,GAAU,CAAC,KAAA,KAAiB,QAAA,CAAS,KAAc,CAAA;AACzD,EAAA,QAAA,CAAS,SAAS,CAAA,GAAI,CAAC,GAAG,QAAA,CAAS,SAAS,CAAA,EAAG,EAAE,EAAA,EAAI,OAAA,EAAS,IAAA,EAAM,CAAA;AACtE;;;;;;"}
1
+ {"version":3,"file":"useClassNameInjection.js","sources":["../src/useClassNameInjection.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { createContext, useContext, useMemo } from \"react\";\n\nexport type ClassNameInjector<Props, Keys extends keyof Props> = (\n props: Pick<Props, Keys>,\n) => string | undefined;\n\ninterface ClassNameInjectorEntry<Props> {\n fn: (props: Props) => string | undefined;\n keys: (keyof Props)[];\n}\n\nexport type ClassNameInjectionRegistry = Record<\n string,\n // biome-ignore lint/suspicious/noExplicitAny: refer to ClassNameInjector which derives it's entry type based on the Props\n ClassNameInjectorEntry<any>[]\n>;\n\nconst InjectionContext = createContext<ClassNameInjectionRegistry | null>(null);\n\nexport type ClassNameInjectionProviderProps = {\n children: React.ReactNode;\n value?: ClassNameInjectionRegistry;\n};\n\nexport function ClassNameInjectionProvider({\n children,\n value,\n}: ClassNameInjectionProviderProps) {\n const registry = useMemo(() => value ?? {}, [value]);\n return (\n <InjectionContext.Provider value={registry}>\n {children}\n </InjectionContext.Provider>\n );\n}\n\ntype PropsWithClassName = { className?: string } & Record<string, any>;\n\nexport function useInjectedClassName<Props extends PropsWithClassName>(\n component: string,\n props: Props,\n): { className: string; props: Omit<Props, \"className\"> } {\n const { className: classNameProp, ...restProps } = props;\n const registry = useContext(InjectionContext);\n\n if (!registry) {\n return {\n className: classNameProp || \"\",\n props: restProps as Omit<Props, \"className\">,\n };\n }\n\n const entries = registry[component] ?? [];\n const injected = entries.map((e) => e.fn(restProps)).filter(Boolean);\n const className = clsx(classNameProp, injected);\n\n const cleanProps = { ...restProps } as Omit<Props, \"className\">;\n for (const entry of entries) {\n for (const key of entry.keys) {\n delete (cleanProps as any)[key];\n }\n }\n\n return { className, props: cleanProps };\n}\n\nexport function registerClassInjector<Props, Keys extends keyof Props>(\n registry: ClassNameInjectionRegistry,\n component: string,\n keys: Keys[],\n injector: ClassNameInjector<Props, Keys>,\n) {\n registry[component] ??= [];\n const wrapped = (props: Props) => injector(props as Props);\n registry[component] = [...registry[component], { fn: wrapped, keys }];\n}\n"],"names":["createContext","useMemo","useContext","clsx"],"mappings":";;;;;;AAkBA,MAAM,gBAAA,GAAmBA,oBAAiD,IAAI,CAAA;AAOvE,SAAS,0BAAA,CAA2B;AAAA,EACzC,QAAA;AAAA,EACA;AACF,CAAA,EAAoC;AAClC,EAAA,MAAM,QAAA,GAAWC,cAAQ,MAAM,KAAA,IAAS,EAAC,EAAG,CAAC,KAAK,CAAC,CAAA;AACnD,EAAA,sCACG,gBAAA,CAAiB,QAAA,EAAjB,EAA0B,KAAA,EAAO,U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7 +14,10 @@ function useInjectedClassName(component, props) {
14
14
  const { className: classNameProp, ...restProps } = props;
15
15
  const registry = useContext(InjectionContext);
16
16
  if (!registry) {
17
- return { className: classNameProp || "", props: restProps };
17
+ return {
18
+ className: classNameProp || "",
19
+ props: restProps
20
+ };
18
21
  }
19
22
  const entries = registry[component] ?? [];
20
23
  const injected = entries.map((e) => e.fn(restProps)).filter(Boolean);
@@ -1 +1 @@
1
- {"version":3,"file":"useClassNameInjection.js","sources":["../src/useClassNameInjection.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { createContext, useContext, useMemo } from \"react\";\n\nexport type ClassNameInjector<Props, Keys extends keyof Props> = (\n props: Pick<Props, Keys>,\n) => string | undefined;\n\ninterface ClassNameInjectorEntry<Props> {\n fn: (props: Props) => string | undefined;\n keys: (keyof Props)[];\n}\n\nexport type ClassNameInjectionRegistry = Record<\n string,\n // biome-ignore lint/suspicious/noExplicitAny: refer to ClassNameInjector which derives it's entry type based on the Props\n ClassNameInjectorEntry<any>[]\n>;\n\nconst InjectionContext = createContext<ClassNameInjectionRegistry | null>(null);\n\nexport type ClassNameInjectionProviderProps = {\n children: React.ReactNode;\n value?: ClassNameInjectionRegistry;\n};\n\nexport function ClassNameInjectionProvider({\n children,\n value,\n}: ClassNameInjectionProviderProps) {\n const registry = useMemo(() => value ?? {}, [value]);\n return (\n <InjectionContext.Provider value={registry}>\n {children}\n </InjectionContext.Provider>\n );\n}\n\ntype PropsWithClassName = { className?: string } & Record<string, any>;\n\nexport function useInjectedClassName<Props extends PropsWithClassName>(\n component: string,\n props: Props\n): { className: string; props: Omit<Props, \"className\"> } {\n const { className: classNameProp, ...restProps } = props;\n const registry = useContext(InjectionContext);\n\n if (!registry) {\n return { className: classNameProp || \"\", props: restProps as Omit<Props, \"className\"> };\n }\n\n const entries = registry[component] ?? [];\n const injected = entries.map((e) => e.fn(restProps)).filter(Boolean);\n const className = clsx(classNameProp, injected);\n\n const cleanProps = { ...restProps } as Omit<Props, \"className\">;\n for (const entry of entries) {\n for (const key of entry.keys) {\n delete (cleanProps as any)[key];\n }\n }\n\n return { className, props: cleanProps };\n}\n\nexport function registerClassInjector<Props, Keys extends keyof Props>(\n registry: ClassNameInjectionRegistry,\n component: string,\n keys: Keys[],\n injector: ClassNameInjector<Props, Keys>,\n) {\n registry[component] ??= [];\n const wrapped = (props: Props) => injector(props as Props);\n registry[component] = [...registry[component], { fn: wrapped, keys }];\n}\n"],"names":[],"mappings":";;;;AAkBA,MAAM,gBAAA,GAAmB,cAAiD,IAAI,CAAA;AAOvE,SAAS,0BAAA,CAA2B;AAAA,EACzC,QAAA;AAAA,EACA;AACF,CAAA,EAAoC;AAClC,EAAA,MAAM,QAAA,GAAW,QAAQ,MAAM,KAAA,IAAS,EAAC,EAAG,CAAC,KAAK,CAAC,CAAA;AACnD,EAAA,2BACG,gBAAA,CAAiB,QAAA,EAAjB,EAA0B,KAAA,EAAO,UAC/B,QAAA,EACH,CAAA;AAEJ;AAIO,SAAS,oBAAA,CACd,WACA,KAAA,EACwD;AACxD,EAAA,MAAM,EAAE,SAAA,EAAW,aAAA,EAAe,GAAG,WAAU,GAAI,KAAA;AACnD,EAAA,MAAM,QAAA,GAAW,WAAW,gBAAgB,CAAA;AAE5C,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,EAAE,SAAA,EAAW,aAAA,IAAiB,EAAA,EAAI,OAAO,SAAA,EAAsC;AAAA,EACxF;AAEA,EAAA,MAAM,OAAA,GAAU,QAAA,CAAS,SAAS,CAAA,IAAK,EAAC;AACxC,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,EAAA,CAAG,SAAS,CAAC,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA;AACnE,EAAA,MAAM,SAAA,GAAY,IAAA,CAAK,aAAA,EAAe,QAAQ,CAAA;AAE9C,EAAA,MAAM,UAAA,GAAa,EAAE,GAAG,SAAA,EAAU;AAClC,EAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,IAAA,KAAA,MAAW,GAAA,IAAO,MAAM,IAAA,EAAM;AAC5B,MAAA,OAAQ,WAAmB,GAAG,CAAA;AAAA,IAChC;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,UAAA,EAAW;AACxC;AAEO,SAAS,qBAAA,CACd,QAAA,EACA,SAAA,EACA,IAAA,EACA,QAAA,EACA;AACA,EAAA,QAAA,CAAS,SAAS,MAAM,EAAC;AACzB,EAAA,MAAM,OAAA,GAAU,CAAC,KAAA,KAAiB,QAAA,CAAS,KAAc,CAAA;AACzD,EAAA,QAAA,CAAS,SAAS,CAAA,GAAI,CAAC,GAAG,QAAA,CAAS,SAAS,CAAA,EAAG,EAAE,EAAA,EAAI,OAAA,EAAS,IAAA,EAAM,CAAA;AACtE;;;;"}
1
+ {"version":3,"file":"useClassNameInjection.js","sources":["../src/useClassNameInjection.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { createContext, useContext, useMemo } from \"react\";\n\nexport type ClassNameInjector<Props, Keys extends keyof Props> = (\n props: Pick<Props, Keys>,\n) => string | undefined;\n\ninterface ClassNameInjectorEntry<Props> {\n fn: (props: Props) => string | undefined;\n keys: (keyof Props)[];\n}\n\nexport type ClassNameInjectionRegistry = Record<\n string,\n // biome-ignore lint/suspicious/noExplicitAny: refer to ClassNameInjector which derives it's entry type based on the Props\n ClassNameInjectorEntry<any>[]\n>;\n\nconst InjectionContext = createContext<ClassNameInjectionRegistry | null>(null);\n\nexport type ClassNameInjectionProviderProps = {\n children: React.ReactNode;\n value?: ClassNameInjectionRegistry;\n};\n\nexport function ClassNameInjectionProvider({\n children,\n value,\n}: ClassNameInjectionProviderProps) {\n const registry = useMemo(() => value ?? {}, [value]);\n return (\n <InjectionContext.Provider value={registry}>\n {children}\n </InjectionContext.Provider>\n );\n}\n\ntype PropsWithClassName = { className?: string } & Record<string, any>;\n\nexport function useInjectedClassName<Props extends PropsWithClassName>(\n component: string,\n props: Props,\n): { className: string; props: Omit<Props, \"className\"> } {\n const { className: classNameProp, ...restProps } = props;\n const registry = useContext(InjectionContext);\n\n if (!registry) {\n return {\n className: classNameProp || \"\",\n props: restProps as Omit<Props, \"className\">,\n };\n }\n\n const entries = registry[component] ?? [];\n const injected = entries.map((e) => e.fn(restProps)).filter(Boolean);\n const className = clsx(classNameProp, injected);\n\n const cleanProps = { ...restProps } as Omit<Props, \"className\">;\n for (const entry of entries) {\n for (const key of entry.keys) {\n delete (cleanProps as any)[key];\n }\n }\n\n return { className, props: cleanProps };\n}\n\nexport function registerClassInjector<Props, Keys extends keyof Props>(\n registry: ClassNameInjectionRegistry,\n component: string,\n keys: Keys[],\n injector: ClassNameInjector<Props, Keys>,\n) {\n registry[component] ??= [];\n const wrapped = (props: Props) => injector(props as Props);\n registry[component] = [...registry[component], { fn: wrapped, keys }];\n}\n"],"names":[],"mappings":";;;;AAkBA,MAAM,gBAAA,GAAmB,cAAiD,IAAI,CAAA;AAOvE,SAAS,0BAAA,CAA2B;AAAA,EACzC,QAAA;AAAA,EACA;AACF,CAAA,EAAoC;AAClC,EAAA,MAAM,QAAA,GAAW,QAAQ,MAAM,KAAA,IAAS,EAAC,EAAG,CAAC,KAAK,CAAC,CAAA;AACnD,EAAA,2BACG,gBAAA,CAAiB,QAAA,EAAjB,EAA0B,KAAA,EAAO,UAC/B,QAAA,EACH,CAAA;AAEJ;AAIO,SAAS,oBAAA,CACd,WACA,KAAA,EACwD;AACxD,EAAA,MAAM,EAAE,SAAA,EAAW,aAAA,EAAe,GAAG,WAAU,GAAI,KAAA;AACnD,EAAA,MAAM,QAAA,GAAW,WAAW,gBAAgB,CAAA;AAE5C,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO;AAAA,MACL,WAAW,aAAA,IAAiB,EAAA;AAAA,MAC5B,KAAA,EAAO;AAAA,KACT;AAAA,EACF;AAEA,EAAA,MAAM,OAAA,GAAU,QAAA,CAAS,SAAS,CAAA,IAAK,EAAC;AACxC,EAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,EAAA,CAAG,SAAS,CAAC,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA;AACnE,EAAA,MAAM,SAAA,GAAY,IAAA,CAAK,aAAA,EAAe,QAAQ,CAAA;AAE9C,EAAA,MAAM,UAAA,GAAa,EAAE,GAAG,SAAA,EAAU;AAClC,EAAA,KAAA,MAAW,SAAS,OAAA,EAAS;AAC3B,IAAA,KAAA,MAAW,GAAA,IAAO,MAAM,IAAA,EAAM;AAC5B,MAAA,OAAQ,WAAmB,GAAG,CAAA;AAAA,IAChC;AAAA,EACF;AAEA,EAAA,OAAO,EAAE,SAAA,EAAW,KAAA,EAAO,UAAA,EAAW;AACxC;AAEO,SAAS,qBAAA,CACd,QAAA,EACA,SAAA,EACA,IAAA,EACA,QAAA,EACA;AACA,EAAA,QAAA,CAAS,SAAS,MAAM,EAAC;AACzB,EAAA,MAAM,OAAA,GAAU,CAAC,KAAA,KAAiB,QAAA,CAAS,KAAc,CAAA;AACzD,EAAA,QAAA,CAAS,SAAS,CAAA,GAAI,CAAC,GAAG,QAAA,CAAS,SAAS,CAAA,EAAG,EAAE,EAAA,EAAI,OAAA,EAAS,IAAA,EAAM,CAAA;AACtE;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salt-ds/styles",
3
- "version": "0.0.0-snapshot-20251117223641",
3
+ "version": "0.0.0-snapshot-20251118094021",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",