@greensight/gts 1.0.0-alpha.9 → 1.0.0-beta.2

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 (86) hide show
  1. package/README.md +55 -28
  2. package/classes/TokenManager/index.d.ts +19 -4
  3. package/classes/TokenManager/index.d.ts.map +1 -1
  4. package/classes/TokenManager/types/ds.d.ts +23 -12
  5. package/classes/TokenManager/types/ds.d.ts.map +1 -1
  6. package/classes/TokenManager/types/figma.d.ts +11 -3
  7. package/classes/TokenManager/types/figma.d.ts.map +1 -1
  8. package/commands/generate/index.d.ts.map +1 -1
  9. package/common/lodash.d.ts +8 -0
  10. package/common/lodash.d.ts.map +1 -0
  11. package/index.cjs +96 -5
  12. package/index.mjs +1039 -493
  13. package/modules/breakpoints/breakpointsFromTokenManager/index.d.ts +2 -0
  14. package/modules/breakpoints/breakpointsFromTokenManager/index.d.ts.map +1 -0
  15. package/modules/breakpoints/breakpointsFromTokenManager/module.d.ts +13 -0
  16. package/modules/breakpoints/breakpointsFromTokenManager/module.d.ts.map +1 -0
  17. package/modules/breakpoints/breakpointsFromTokenManager/utils.d.ts +8 -0
  18. package/modules/breakpoints/breakpointsFromTokenManager/utils.d.ts.map +1 -0
  19. package/modules/breakpoints/index.d.ts +3 -0
  20. package/modules/breakpoints/index.d.ts.map +1 -0
  21. package/modules/breakpoints/types.d.ts +6 -0
  22. package/modules/breakpoints/types.d.ts.map +1 -0
  23. package/modules/breakpoints/utils.d.ts +16 -0
  24. package/modules/breakpoints/utils.d.ts.map +1 -0
  25. package/modules/colors/colorsFromTokenManager/index.d.ts +2 -0
  26. package/modules/colors/colorsFromTokenManager/index.d.ts.map +1 -0
  27. package/modules/colors/{colorsFromTokenManager.d.ts → colorsFromTokenManager/module.d.ts} +4 -7
  28. package/modules/colors/colorsFromTokenManager/module.d.ts.map +1 -0
  29. package/modules/colors/colorsFromTokenManager/utils.d.ts +3 -0
  30. package/modules/colors/colorsFromTokenManager/utils.d.ts.map +1 -0
  31. package/modules/colors/index.d.ts +0 -2
  32. package/modules/colors/index.d.ts.map +1 -1
  33. package/modules/colors/utils.d.ts +8 -33
  34. package/modules/colors/utils.d.ts.map +1 -1
  35. package/modules/container/containerFromTokenManager/index.d.ts +2 -0
  36. package/modules/container/containerFromTokenManager/index.d.ts.map +1 -0
  37. package/modules/container/containerFromTokenManager/module.d.ts +13 -0
  38. package/modules/container/containerFromTokenManager/module.d.ts.map +1 -0
  39. package/modules/container/index.d.ts +3 -0
  40. package/modules/container/index.d.ts.map +1 -0
  41. package/modules/container/types.d.ts +5 -0
  42. package/modules/container/types.d.ts.map +1 -0
  43. package/modules/container/utils.d.ts +12 -0
  44. package/modules/container/utils.d.ts.map +1 -0
  45. package/modules/index.d.ts +5 -0
  46. package/modules/index.d.ts.map +1 -1
  47. package/modules/shadows/index.d.ts +3 -0
  48. package/modules/shadows/index.d.ts.map +1 -0
  49. package/modules/shadows/shadowsFromTokenManager.d.ts +13 -0
  50. package/modules/shadows/shadowsFromTokenManager.d.ts.map +1 -0
  51. package/modules/shadows/types.d.ts +6 -0
  52. package/modules/shadows/types.d.ts.map +1 -0
  53. package/modules/shadows/utils.d.ts +22 -0
  54. package/modules/shadows/utils.d.ts.map +1 -0
  55. package/modules/typography/index.d.ts +2 -0
  56. package/modules/typography/index.d.ts.map +1 -0
  57. package/modules/typography/types.d.ts +10 -0
  58. package/modules/typography/types.d.ts.map +1 -0
  59. package/modules/typography/typographyFromTokenManager/index.d.ts +2 -0
  60. package/modules/typography/typographyFromTokenManager/index.d.ts.map +1 -0
  61. package/modules/typography/typographyFromTokenManager/module.d.ts +19 -0
  62. package/modules/typography/typographyFromTokenManager/module.d.ts.map +1 -0
  63. package/modules/typography/utils.d.ts +56 -0
  64. package/modules/typography/utils.d.ts.map +1 -0
  65. package/modules/utilities/index.d.ts +4 -0
  66. package/modules/utilities/index.d.ts.map +1 -0
  67. package/modules/utilities/types.d.ts +48 -0
  68. package/modules/utilities/types.d.ts.map +1 -0
  69. package/modules/utilities/utilitiesFromTokenManager/index.d.ts +2 -0
  70. package/modules/utilities/utilitiesFromTokenManager/index.d.ts.map +1 -0
  71. package/modules/utilities/utilitiesFromTokenManager/module.d.ts +4 -0
  72. package/modules/utilities/utilitiesFromTokenManager/module.d.ts.map +1 -0
  73. package/modules/utilities/utils.d.ts +80 -0
  74. package/modules/utilities/utils.d.ts.map +1 -0
  75. package/package.json +1 -2
  76. package/temporarilyUnnecessary/colorsFromStyles.d.ts +1 -0
  77. package/temporarilyUnnecessary/colorsFromStyles.d.ts.map +1 -0
  78. package/temporarilyUnnecessary/colorsFromVariables.d.ts +1 -0
  79. package/temporarilyUnnecessary/colorsFromVariables.d.ts.map +1 -0
  80. package/temporarilyUnnecessary/utils.d.ts +1 -0
  81. package/temporarilyUnnecessary/utils.d.ts.map +1 -0
  82. package/modules/colors/colorsFromStyles.d.ts +0 -16
  83. package/modules/colors/colorsFromStyles.d.ts.map +0 -1
  84. package/modules/colors/colorsFromTokenManager.d.ts.map +0 -1
  85. package/modules/colors/colorsFromVariables.d.ts +0 -16
  86. package/modules/colors/colorsFromVariables.d.ts.map +0 -1
@@ -0,0 +1,80 @@
1
+ import { TokenManager } from '../../classes/TokenManager';
2
+ import { IDSTokenFile } from '../../classes/TokenManager/types';
3
+ import { IBreakpoints, IResolvedUtilityToken, IUtilitiesInput, IUtilitiesOutput, IUtilityNamingFromVariablePath } from './types';
4
+ /**
5
+ * Поддерево variables по пути — строка с сегментами через `.` (как в lodash.get).
6
+ */
7
+ export declare const getVariablesSubtree: (variables: IDSTokenFile["variables"], variablePath: string) => unknown;
8
+ /**
9
+ * Обход дерева variables, только листья с type === 'dimension'; резолв ссылок по каждому режиму.
10
+ */
11
+ export declare const resolveUtilitiesSubtree: (subtree: unknown, tokenManager: TokenManager) => IResolvedUtilityToken[];
12
+ /**
13
+ * Проверка `flatName` против одного элемента белого списка.
14
+ */
15
+ export declare const utilityFlatNameMatchesIncludePattern: (flatName: string, pattern: string | RegExp) => boolean;
16
+ /**
17
+ * Оставляет только токены, чей `flatName` совпадает хотя бы с одним шаблоном из `include`.
18
+ */
19
+ export declare const filterResolvedUtilitiesByInclude: (tokens: IResolvedUtilityToken[], include: (string | RegExp)[] | undefined) => IResolvedUtilityToken[];
20
+ export interface ISortedBreakpointMode {
21
+ mode: string;
22
+ widthPx: number;
23
+ }
24
+ /**
25
+ * Режимы из breakpoints, отсортированные по ширине по убыванию (широкий первый — база).
26
+ */
27
+ export declare const getSortedBreakpointModes: (breakpoints: IBreakpoints) => ISortedBreakpointMode[];
28
+ /**
29
+ * Последний сегмент variablePath задаёт дефолтные префиксы имён переменных и класс обёртки.
30
+ */
31
+ export declare const deriveUtilityNamingFromVariablePath: (variablePath: string) => IUtilityNamingFromVariablePath;
32
+ /**
33
+ * Учитывает опциональные поля `input`: префикс переменных и класс обёртки.
34
+ */
35
+ export declare const resolveUtilityNaming: (input: IUtilitiesInput) => IUtilityNamingFromVariablePath;
36
+ /**
37
+ * Имя CSS custom property для токена (как в сгенерированном `styles.css`).
38
+ */
39
+ export declare const getUtilityCssVariableName: (variableNamePrefix: string, flatName: string) => string;
40
+ /**
41
+ * Делит значения токена на базу и переопределения для @media (max-width).
42
+ */
43
+ export declare const splitUtilityTokenForMedia: (token: IResolvedUtilityToken, breakpoints: IBreakpoints, variableNamePrefix: string) => {
44
+ base: Record<string, string>;
45
+ byBreakpoint: Record<number, Record<string, string>>;
46
+ };
47
+ /**
48
+ * Глобальный styles.css: класс-обёртка с CSS variables и вложенные @media (max-width), без медиа при ≤1 режиме или пустых breakpoints.
49
+ */
50
+ export declare const buildUtilitiesGlobalStylesCSS: (tokens: IResolvedUtilityToken[], input: IUtilitiesInput) => string;
51
+ export interface IUtilitySerializableEntry {
52
+ breakpoints: Record<string, string>;
53
+ }
54
+ /**
55
+ * Данные для utilities.ts: все значения по режимам токена в `breakpoints` (без схлопывания совпадающих соседей).
56
+ * Порядок ключей: режимы из `getSortedBreakpointModes` (широкий → узкий), присутствующие в токене;
57
+ * затем остальные режимы в порядке `Object.keys(resolvedByMode)`.
58
+ * Если конфиг `breakpoints` пуст или нет валидных ширин — порядок ключей как в `Object.keys(resolvedByMode)`.
59
+ */
60
+ export declare const utilityTokenToSerializableData: (token: IResolvedUtilityToken, breakpoints: IBreakpoints) => IUtilitySerializableEntry;
61
+ /**
62
+ * Содержимое файла utilities.ts (объект + as const).
63
+ */
64
+ export declare const buildUtilitiesDataTSContent: (tokens: IResolvedUtilityToken[], input: IUtilitiesInput) => string;
65
+ /**
66
+ * Содержимое index.ts: данные токенов и хелперы имён переменных (как в `styles.css`).
67
+ */
68
+ export declare const buildUtilitiesIndexTSContent: (input: IUtilitiesInput) => string;
69
+ export declare const writeUtilitiesFiles: ({ dir, globalCss, utilitiesTs, indexTs, }: {
70
+ dir: string;
71
+ globalCss: string;
72
+ utilitiesTs: string;
73
+ indexTs: string;
74
+ }) => Promise<void>;
75
+ export declare const generateUtilitiesFiles: ({ tokens, input, output, }: {
76
+ tokens: IResolvedUtilityToken[];
77
+ input: IUtilitiesInput;
78
+ output: IUtilitiesOutput;
79
+ }) => Promise<void>;
80
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/modules/utilities/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,kCAAkC,CAAC;AAGvF,OAAO,KAAK,EACR,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,8BAA8B,EACjC,MAAM,SAAS,CAAC;AAejB;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,WAAW,YAAY,CAAC,WAAW,CAAC,EAAE,cAAc,MAAM,KAAG,OAWhG,CAAC;AA+BF;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,SAAS,OAAO,EAAE,c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B,GACvC,OAAO,qBAAqB,EAC5B,aAAa,YAAY,KAC1B,yBAqCF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,QAAQ,qBAAqB,EAAE,EAAE,OAAO,eAAe,KAAG,MAsBrG,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GAAI,OAAO,eAAe,KAAG,MA2BrE,CAAC;AAMF,eAAO,MAAM,mBAAmB,GAAU,2CAKvC;IACC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,KAAG,OAAO,CAAC,IAAI,CAQf,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAU,4BAI1C;IACC,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;CAC5B,KAAG,OAAO,CAAC,IAAI,CAOf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greensight/gts",
3
- "version": "1.0.0-alpha.9",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "Generate design tokens from Figma",
5
5
  "keywords": [
6
6
  "figma",
@@ -23,7 +23,6 @@
23
23
  "homepage": "https://github.com/greensight/gts",
24
24
  "license": "MIT",
25
25
  "peerDependencies": {
26
- "lodash-es": "^4.17.23",
27
26
  "rimraf": "^6.0.1",
28
27
  "ts-import": "2.0.40"
29
28
  },
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=colorsFromStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorsFromStyles.d.ts","sourceRoot":"","sources":["../../src/temporarilyUnnecessary/colorsFromStyles.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=colorsFromVariables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorsFromVariables.d.ts","sourceRoot":"","sources":["../../src/temporarilyUnnecessary/colorsFromVariables.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/temporarilyUnnecessary/utils.ts"],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
1
- import { IModule } from '../types';
2
- export interface IColorsFromStylesInput {
3
- variablePaths?: string[];
4
- }
5
- export interface IColorsFromStylesOutput {
6
- jsonDir: string;
7
- stylesDir: string;
8
- jsonFileName?: string;
9
- cssFileName?: string;
10
- }
11
- export interface IColorsFromStylesParams {
12
- input?: IColorsFromStylesInput;
13
- output: IColorsFromStylesOutput;
14
- }
15
- export declare const colorsFromStyles: ({ input, output: { jsonDir, stylesDir, jsonFileName, cssFileName }, }: IColorsFromStylesParams) => IModule;
16
- //# sourceMappingURL=colorsFromStyles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"colorsFromStyles.d.ts","sourceRoot":"","sources":["../../../src/modules/colors/colorsFromStyles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAKxC,MAAM,WAAW,sBAAsB;IACnC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACpC,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B,MAAM,EAAE,uBAAuB,CAAC;CACnC;AAED,eAAO,MAAM,gBAAgB,GAAI,uEAG9B,uBAAuB,KAAG,OA4H3B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"colorsFromTokenManager.d.ts","sourceRoot":"","sources":["../../../src/modules/colors/colorsFromTokenManager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,WAAW,4BAA4B;IACzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,6BAA6B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,6BAA6B;IAC1C,KAAK,CAAC,EAAE,4BAA4B,CAAC;IACrC,MAAM,EAAE,6BAA6B,CAAC;CACzC;AAiFD,eAAO,MAAM,sBAAsB,GAAI,uEAGpC,6BAA6B,KAAG,OAuEjC,CAAC"}
@@ -1,16 +0,0 @@
1
- import { IModule } from '../types';
2
- export interface IColorsFromVariablesInput {
3
- variablePaths: string[];
4
- }
5
- export interface IColorsFromVariablesOutput {
6
- jsonDir: string;
7
- stylesDir: string;
8
- jsonFileName?: string;
9
- cssFileName?: string;
10
- }
11
- export interface IColorsFromVariablesParams {
12
- input: IColorsFromVariablesInput;
13
- output: IColorsFromVariablesOutput;
14
- }
15
- export declare const colorsFromVariables: ({ input: { variablePaths }, output: { jsonDir, stylesDir, jsonFileName, cssFileName }, }: IColorsFromVariablesParams) => IModule;
16
- //# sourceMappingURL=colorsFromVariables.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"colorsFromVariables.d.ts","sourceRoot":"","sources":["../../../src/modules/colors/colorsFromVariables.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAIxC,MAAM,WAAW,yBAAyB;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,0BAA0B;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACvC,KAAK,EAAE,yBAAyB,CAAC;IACjC,MAAM,EAAE,0BAA0B,CAAC;CACtC;AAED,eAAO,MAAM,mBAAmB,GAAI,0FAGjC,0BAA0B,KAAG,OA2G9B,CAAC"}