@alveole/theme 1.8.2 → 1.8.4

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.
@@ -1,13 +1,13 @@
1
1
  import { TextStyle } from 'react-native';
2
2
  export declare const FontsMap: {
3
- readonly 'Barlow-Light': any;
4
- readonly 'Barlow-Regular': any;
5
- readonly 'Barlow-Medium': any;
6
- readonly 'Barlow-Bold': any;
7
- readonly 'Inter-Light': any;
8
- readonly 'Inter-Regular': any;
9
- readonly 'Inter-Medium': any;
10
- readonly 'Inter-Bold': any;
3
+ readonly 'Barlow-Light': number;
4
+ readonly 'Barlow-Regular': number;
5
+ readonly 'Barlow-Medium': number;
6
+ readonly 'Barlow-Bold': number;
7
+ readonly 'Inter-Light': number;
8
+ readonly 'Inter-Regular': number;
9
+ readonly 'Inter-Medium': number;
10
+ readonly 'Inter-Bold': number;
11
11
  };
12
12
  export type Font = keyof typeof FontsMap;
13
13
  export declare const Fonts: Record<Font, Font>;
@@ -1 +1 @@
1
- {"version":3,"file":"Font.d.ts","sourceRoot":"","sources":["../../src/constants/Font.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,QAAQ;;;;;;;;;CAWX,CAAC;AAGX,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,QAAQ,CAAC;AACzC,eAAO,MAAM,KAAK,EAA0E,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAI/G,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,IAAI,EACJ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAA;CAAE,CAU7F,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAA;CAIhG,CAAC"}
1
+ {"version":3,"file":"Font.d.ts","sourceRoot":"","sources":["../../src/constants/Font.ts"],"names":[],"mappings":"AAQA,OAAO,EAAY,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,QAAQ;;;;;;;;;CAWX,CAAC;AAGX,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,QAAQ,CAAC;AACzC,eAAO,MAAM,KAAK,EAA0E,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAI/G,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,IAAI,EACJ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,kBAAkB,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAA;CAAE,CAU7F,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAA;CAIhG,CAAC"}
@@ -1,15 +1,23 @@
1
+ import { Barlow_300Light } from '@expo-google-fonts/barlow/300Light';
2
+ import { Barlow_400Regular } from '@expo-google-fonts/barlow/400Regular';
3
+ import { Barlow_500Medium } from '@expo-google-fonts/barlow/500Medium';
4
+ import { Barlow_600SemiBold } from '@expo-google-fonts/barlow/600SemiBold';
5
+ import { Inter_300Light } from '@expo-google-fonts/inter/300Light';
6
+ import { Inter_400Regular } from '@expo-google-fonts/inter/400Regular';
7
+ import { Inter_500Medium } from '@expo-google-fonts/inter/500Medium';
8
+ import { Inter_600SemiBold } from '@expo-google-fonts/inter/600SemiBold';
1
9
  import { Platform } from 'react-native';
2
10
  export const FontsMap = {
3
11
  // Barlow
4
- 'Barlow-Light': require('../../assets/fonts/Barlow/Barlow-Light.ttf'),
5
- 'Barlow-Regular': require('../../assets/fonts/Barlow/Barlow-Regular.ttf'),
6
- 'Barlow-Medium': require('../../assets/fonts/Barlow/Barlow-Medium.ttf'),
7
- 'Barlow-Bold': require('../../assets/fonts/Barlow/Barlow-SemiBold.ttf'),
12
+ 'Barlow-Light': Barlow_300Light,
13
+ 'Barlow-Regular': Barlow_400Regular,
14
+ 'Barlow-Medium': Barlow_500Medium,
15
+ 'Barlow-Bold': Barlow_600SemiBold,
8
16
  // Inter
9
- 'Inter-Light': require('../../assets/fonts/Inter/Inter-Light.ttf'),
10
- 'Inter-Regular': require('../../assets/fonts/Inter/Inter-Regular.ttf'),
11
- 'Inter-Medium': require('../../assets/fonts/Inter/Inter-Medium.ttf'),
12
- 'Inter-Bold': require('../../assets/fonts/Inter/Inter-SemiBold.ttf'),
17
+ 'Inter-Light': Inter_300Light,
18
+ 'Inter-Regular': Inter_400Regular,
19
+ 'Inter-Medium': Inter_500Medium,
20
+ 'Inter-Bold': Inter_600SemiBold,
13
21
  };
14
22
  export const Fonts = Object.fromEntries(Object.keys(FontsMap).map(font => [font, font]));
15
23
  const SANS_SERIF_FALLBACK = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif";
@@ -1,5 +1,6 @@
1
1
  export declare const CustomPalette: {
2
2
  readonly light: {
3
+ /** @deprecated Ancienne variable issue du DSFR */
3
4
  readonly artwork: {
4
5
  readonly 'major-primary': "#033B72";
5
6
  readonly 'decorative-primary': "#E5F1FE";
@@ -1 +1 @@
1
- {"version":3,"file":"Palette.d.ts","sourceRoot":"","sources":["../../src/constants/Palette.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuFxB,0DAA0D;;;YAGtD,0DAA0D;;;;YAI1D,0DAA0D;;YAE1D,0DAA0D;;;;IAK9D,kHAAkH;;IAElH,iGAAiG;;IAEjG,gGAAgG;;IAEhG,uFA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8CAA8C;;;CAGxC,CAAC;AAEX,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE/F,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAC1C,MAAM,GACN,CAAC,SAAS,MAAM,GACd,MAAM,GAAG,MAAM,GACf;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE7C,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC;AACxD,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { Colors } from './Color';
2
2
  export const CustomPalette = {
3
3
  light: {
4
+ /** @deprecated Ancienne variable issue du DSFR */
4
5
  artwork: {
5
6
  'major-primary': Colors['BleuCaptive']['200'],
6
7
  'decorative-primary': Colors['BleuCaptive']['950'],
package/dist/default.css CHANGED
@@ -1,51 +1,4 @@
1
- @font-face {
2
- font-family: 'Barlow';
3
- src: url('../assets/fonts/Barlow/Barlow-Light.ttf') format('truetype');
4
- font-weight: 300;
5
- font-style: normal;
6
- }
7
- @font-face {
8
- font-family: 'Barlow';
9
- src: url('../assets/fonts/Barlow/Barlow-Regular.ttf') format('truetype');
10
- font-weight: 400;
11
- font-style: normal;
12
- }
13
- @font-face {
14
- font-family: 'Barlow';
15
- src: url('../assets/fonts/Barlow/Barlow-Medium.ttf') format('truetype');
16
- font-weight: 500;
17
- font-style: normal;
18
- }
19
- @font-face {
20
- font-family: 'Barlow';
21
- src: url('../assets/fonts/Barlow/Barlow-SemiBold.ttf') format('truetype');
22
- font-weight: 600;
23
- font-style: normal;
24
- }
25
- @font-face {
26
- font-family: 'Inter';
27
- src: url('../assets/fonts/Inter/Inter-Light.ttf') format('truetype');
28
- font-weight: 300;
29
- font-style: normal;
30
- }
31
- @font-face {
32
- font-family: 'Inter';
33
- src: url('../assets/fonts/Inter/Inter-Regular.ttf') format('truetype');
34
- font-weight: 400;
35
- font-style: normal;
36
- }
37
- @font-face {
38
- font-family: 'Inter';
39
- src: url('../assets/fonts/Inter/Inter-Medium.ttf') format('truetype');
40
- font-weight: 500;
41
- font-style: normal;
42
- }
43
- @font-face {
44
- font-family: 'Inter';
45
- src: url('../assets/fonts/Inter/Inter-SemiBold.ttf') format('truetype');
46
- font-weight: 600;
47
- font-style: normal;
48
- }
1
+ @import url('https://fonts.googleapis.com/css2?family=Barlow:wght@300;400;500;600&family=Inter:wght@300;400;500;600&display=swap');
49
2
 
50
3
  body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
51
4
 
@@ -1,7 +1,5 @@
1
1
  import { Theme } from '../type';
2
2
  export declare const generateCSSVariables: (theme: Theme) => string;
3
- export declare const injectFontFaceCSS: () => void;
4
- export declare const injectFontSmoothingCSS: () => void;
5
3
  export declare const injectVariableCSS: (theme: Theme) => void;
6
4
  export declare const generateFontFaceCSS: () => string;
7
5
  export declare const generateFontSmoothingCSS: () => string;
@@ -1 +1 @@
1
- {"version":3,"file":"injectVariableCSS.d.ts","sourceRoot":"","sources":["../../src/helpers/injectVariableCSS.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA6BhC,eAAO,MAAM,oBAAoB,GAAI,OAAO,KAAK,KAAG,MA+CnD,CAAC;AA8CF,eAAO,MAAM,iBAAiB,YAiB7B,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAYlC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,SAY7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,MAMxB,CAAC;AAEhB,eAAO,MAAM,wBAAwB,QAAO,MAC6E,CAAC;AAE1H,eAAO,MAAM,uBAAuB,QAAO,MAM9B,CAAC"}
1
+ {"version":3,"file":"injectVariableCSS.d.ts","sourceRoot":"","sources":["../../src/helpers/injectVariableCSS.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA6BhC,eAAO,MAAM,oBAAoB,GAAI,OAAO,KAAK,KAAG,MA+CnD,CAAC;AA8CF,eAAO,MAAM,iBAAiB,GAAI,OAAO,KAAK,SAY7C,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,MAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAO,MAC6E,CAAC;AAE1H,eAAO,MAAM,uBAAuB,QAAO,MAM9B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { Colors, CustomPalette, Spacings } from '../constants';
2
2
  import { Elevations } from '../constants/Elevation';
3
- import { FontWeightMap, FontsMap } from '../constants/Font';
3
+ import { FontWeightMap } from '../constants/Font';
4
4
  import { RadiusList } from '../constants/Radius';
5
5
  import { CustomTypography } from '../constants/Typography';
6
6
  import { sanitizeCSSKey } from './sanitizeCSSKey';
@@ -101,35 +101,6 @@ const collectTypographyLines = (path, node, fontReverseMap, lines) => {
101
101
  collectTypographyLines([...path, key], value, fontReverseMap, lines);
102
102
  });
103
103
  };
104
- export const injectFontFaceCSS = () => {
105
- if (typeof document === 'undefined')
106
- return;
107
- const styleId = 'theme-font-faces';
108
- if (document.getElementById(styleId))
109
- return;
110
- const rules = Object.entries(FontsMap)
111
- .map(([key, src]) => {
112
- const { family, weight } = FontWeightMap[key];
113
- return `@font-face {\n font-family: '${family}';\n src: url('${src}') format('truetype');\n font-weight: ${weight};\n font-style: normal;\n}`;
114
- })
115
- .join('\n');
116
- const styleTag = document.createElement('style');
117
- styleTag.id = styleId;
118
- styleTag.innerHTML = rules;
119
- document.head.appendChild(styleTag);
120
- };
121
- export const injectFontSmoothingCSS = () => {
122
- if (typeof document === 'undefined')
123
- return;
124
- const styleId = 'theme-font-smoothing';
125
- if (document.getElementById(styleId))
126
- return;
127
- const styleTag = document.createElement('style');
128
- styleTag.id = styleId;
129
- styleTag.innerHTML =
130
- 'body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }';
131
- document.head.appendChild(styleTag);
132
- };
133
104
  export const injectVariableCSS = (theme) => {
134
105
  if (typeof document === 'undefined')
135
106
  return;
@@ -142,12 +113,18 @@ export const injectVariableCSS = (theme) => {
142
113
  styleTag.innerHTML = generateCSSVariables(theme);
143
114
  document.head.appendChild(styleTag);
144
115
  };
145
- export const generateFontFaceCSS = () => Object.entries(FontsMap)
146
- .map(([key, src]) => {
147
- const { family, weight } = FontWeightMap[key];
148
- return `@font-face {\n font-family: '${family}';\n src: url('${src}') format('truetype');\n font-weight: ${weight};\n font-style: normal;\n}`;
149
- })
150
- .join('\n');
116
+ export const generateFontFaceCSS = () => {
117
+ const weightsByFamily = new Map();
118
+ Object.values(FontWeightMap).forEach(({ family, weight }) => {
119
+ if (!weightsByFamily.has(family))
120
+ weightsByFamily.set(family, new Set());
121
+ weightsByFamily.get(family)?.add(String(weight));
122
+ });
123
+ const families = Array.from(weightsByFamily.entries())
124
+ .map(([family, weights]) => `family=${family.replace(/ /g, '+')}:wght@${Array.from(weights).sort().join(';')}`)
125
+ .join('&');
126
+ return `@import url('https://fonts.googleapis.com/css2?${families}&display=swap');`;
127
+ };
151
128
  export const generateFontSmoothingCSS = () => 'body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }';
152
129
  export const generateDefaultThemeCSS = () => generateCSSVariables({
153
130
  color: {
@@ -1 +1 @@
1
- {"version":3,"file":"useThemeBuilder.d.ts","sourceRoot":"","sources":["../../src/helpers/useThemeBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKrC,OAAO,EAKL,WAAW,EAKX,OAAO,EAGR,MAAM,cAAc,CAAC;AAOtB,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC9B,CAAC;AAgDF,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,KAAK,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAwEnF"}
1
+ {"version":3,"file":"useThemeBuilder.d.ts","sourceRoot":"","sources":["../../src/helpers/useThemeBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKrC,OAAO,EAKL,WAAW,EAKX,OAAO,EAGR,MAAM,cAAc,CAAC;AAOtB,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CAC9B,CAAC;AAgDF,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,KAAK,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CA0EnF"}
@@ -51,7 +51,9 @@ const toCSSVarTypography = (node, path = []) => {
51
51
  };
52
52
  export function useThemeBuilder(params) {
53
53
  const { width } = useWindowDimensions();
54
- const [loadedFonts] = useFonts(FontsMap);
54
+ // Sur web, les fonts sont chargées via @font-face (generateFontFaceCSS), pas via expo-font,
55
+ // pour éviter une double source (fichiers locaux vs Google Fonts) et un chargement redondant.
56
+ const [loadedFonts] = useFonts(Platform.OS === 'web' ? {} : FontsMap);
55
57
  const variant = useMemo(() => breakpointToVariant(width), [width]);
56
58
  const rawMergedPalette = useMemo(() => deepMerge(CustomPalette, params.color), [params.color]);
57
59
  const mergedPalette = useMemo(() => toCSSVarPalette(rawMergedPalette), [rawMergedPalette]);
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "@alveole/theme",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "description": "Shared theme tokens and utilities.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
8
8
  "dist",
9
- "assets",
10
9
  "README.md"
11
10
  ],
12
11
  "sideEffects": false,
13
12
  "scripts": {
14
- "build": "tsc -p tsconfig.build.json && rm -rf assets && cp -R src/assets assets && node scripts/build-css.mjs",
13
+ "build": "tsc -p tsconfig.build.json && node scripts/build-css.mjs",
15
14
  "lint": "eslint .",
16
15
  "typecheck": "tsc -p tsconfig.build.json --noEmit"
17
16
  },
@@ -32,6 +31,8 @@
32
31
  "access": "public"
33
32
  },
34
33
  "dependencies": {
34
+ "@expo-google-fonts/barlow": "0.4.1",
35
+ "@expo-google-fonts/inter": "0.4.2",
35
36
  "@uiw/react-signature": "1.3.5",
36
37
  "react-native-signature-canvas": "5.1.1"
37
38
  }
Binary file
Binary file
Binary file
Binary file