@iconify/tools 4.0.0-beta.9 → 4.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.
- package/lib/colors/attribs.d.cts +27 -0
- package/lib/colors/attribs.d.mts +27 -0
- package/lib/colors/attribs.d.ts +1 -1
- package/lib/colors/detect.d.cts +16 -0
- package/lib/colors/detect.d.mts +16 -0
- package/lib/colors/parse.d.cts +60 -0
- package/lib/colors/parse.d.mts +60 -0
- package/lib/colors/parse.d.ts +1 -1
- package/lib/colors/validate.d.cts +20 -0
- package/lib/colors/validate.d.mts +20 -0
- package/lib/css/parse.d.cts +6 -0
- package/lib/css/parse.d.mts +6 -0
- package/lib/css/parser/error.d.cts +13 -0
- package/lib/css/parser/error.d.mts +13 -0
- package/lib/css/parser/error.d.ts +1 -1
- package/lib/css/parser/export.d.cts +8 -0
- package/lib/css/parser/export.d.mts +8 -0
- package/lib/css/parser/strings.d.cts +16 -0
- package/lib/css/parser/strings.d.mts +16 -0
- package/lib/css/parser/text.d.cts +20 -0
- package/lib/css/parser/text.d.mts +20 -0
- package/lib/css/parser/tokens.d.cts +9 -0
- package/lib/css/parser/tokens.d.mts +9 -0
- package/lib/css/parser/tree.d.cts +8 -0
- package/lib/css/parser/tree.d.mts +8 -0
- package/lib/css/parser/types.d.cts +52 -0
- package/lib/css/parser/types.d.mts +52 -0
- package/lib/css/parser/types.d.ts +1 -1
- package/lib/download/api/cache.d.cts +20 -0
- package/lib/download/api/cache.d.mts +20 -0
- package/lib/download/api/config.d.cts +18 -0
- package/lib/download/api/config.d.mts +18 -0
- package/lib/download/api/download.d.cts +8 -0
- package/lib/download/api/download.d.mts +8 -0
- package/lib/download/api/index.d.cts +8 -0
- package/lib/download/api/index.d.mts +8 -0
- package/lib/download/api/queue.d.cts +32 -0
- package/lib/download/api/queue.d.mts +32 -0
- package/lib/download/api/queue.d.ts +1 -1
- package/lib/download/api/types.d.cts +17 -0
- package/lib/download/api/types.d.mts +17 -0
- package/lib/download/api/types.d.ts +1 -1
- package/lib/download/git/branch.d.cts +8 -0
- package/lib/download/git/branch.d.mts +8 -0
- package/lib/download/git/hash.d.cts +8 -0
- package/lib/download/git/hash.d.mts +8 -0
- package/lib/download/git/index.d.cts +29 -0
- package/lib/download/git/index.d.mts +29 -0
- package/lib/download/git/index.d.ts +1 -1
- package/lib/download/git/reset.d.cts +6 -0
- package/lib/download/git/reset.d.mts +6 -0
- package/lib/download/github/hash.d.cts +8 -0
- package/lib/download/github/hash.d.mts +8 -0
- package/lib/download/github/index.d.cts +31 -0
- package/lib/download/github/index.d.mts +31 -0
- package/lib/download/github/index.d.ts +1 -1
- package/lib/download/github/types.d.cts +11 -0
- package/lib/download/github/types.d.mts +11 -0
- package/lib/download/github/types.d.ts +1 -1
- package/lib/download/gitlab/hash.d.cts +8 -0
- package/lib/download/gitlab/hash.d.mts +8 -0
- package/lib/download/gitlab/index.d.cts +31 -0
- package/lib/download/gitlab/index.d.mts +31 -0
- package/lib/download/gitlab/index.d.ts +1 -1
- package/lib/download/gitlab/types.d.cts +15 -0
- package/lib/download/gitlab/types.d.mts +15 -0
- package/lib/download/gitlab/types.d.ts +1 -1
- package/lib/download/helpers/untar.d.cts +6 -0
- package/lib/download/helpers/untar.d.mts +6 -0
- package/lib/download/helpers/unzip.d.cts +6 -0
- package/lib/download/helpers/unzip.d.mts +6 -0
- package/lib/download/index.d.cts +48 -0
- package/lib/download/index.d.mts +48 -0
- package/lib/download/index.d.ts +1 -1
- package/lib/download/npm/index.d.cts +30 -0
- package/lib/download/npm/index.d.mts +30 -0
- package/lib/download/npm/index.d.ts +1 -1
- package/lib/download/npm/types.d.cts +9 -0
- package/lib/download/npm/types.d.mts +9 -0
- package/lib/download/npm/types.d.ts +1 -1
- package/lib/download/npm/version.d.cts +16 -0
- package/lib/download/npm/version.d.mts +16 -0
- package/lib/download/npm/version.d.ts +1 -1
- package/lib/download/types/modified.d.cts +6 -0
- package/lib/download/types/modified.d.mts +6 -0
- package/lib/download/types/modified.d.ts +1 -1
- package/lib/download/types/sources.d.cts +12 -0
- package/lib/download/types/sources.d.mts +12 -0
- package/lib/download/types/sources.d.ts +1 -1
- package/lib/export/directory.d.cts +26 -0
- package/lib/export/directory.d.mts +26 -0
- package/lib/export/directory.d.ts +1 -1
- package/lib/export/helpers/custom-files.d.cts +12 -0
- package/lib/export/helpers/custom-files.d.mts +12 -0
- package/lib/export/helpers/custom-files.d.ts +1 -1
- package/lib/export/helpers/prepare.d.cts +19 -0
- package/lib/export/helpers/prepare.d.mts +19 -0
- package/lib/export/helpers/prepare.d.ts +1 -1
- package/lib/export/helpers/types-version.d.cts +6 -0
- package/lib/export/helpers/types-version.d.mts +6 -0
- package/lib/export/icon-package.d.cts +26 -0
- package/lib/export/icon-package.d.mts +26 -0
- package/lib/export/icon-package.d.ts +1 -3
- package/lib/export/json-package.d.cts +25 -0
- package/lib/export/json-package.d.mts +25 -0
- package/lib/export/json-package.d.ts +1 -1
- package/lib/icon-set/index.cjs +22 -0
- package/lib/icon-set/index.d.cts +162 -0
- package/lib/icon-set/index.d.mts +162 -0
- package/lib/icon-set/index.mjs +22 -0
- package/lib/icon-set/match.d.cts +15 -0
- package/lib/icon-set/match.d.mts +15 -0
- package/lib/icon-set/merge.d.cts +14 -0
- package/lib/icon-set/merge.d.mts +14 -0
- package/lib/icon-set/modified.d.cts +16 -0
- package/lib/icon-set/modified.d.mts +16 -0
- package/lib/icon-set/props.d.cts +13 -0
- package/lib/icon-set/props.d.mts +13 -0
- package/lib/icon-set/tags.d.cts +23 -0
- package/lib/icon-set/tags.d.mts +23 -0
- package/lib/icon-set/types.d.cts +75 -0
- package/lib/icon-set/types.d.mts +75 -0
- package/lib/icon-set/types.d.ts +1 -1
- package/lib/import/directory.d.cts +52 -0
- package/lib/import/directory.d.mts +52 -0
- package/lib/import/directory.d.ts +1 -1
- package/lib/import/figma/index.d.cts +20 -0
- package/lib/import/figma/index.d.mts +20 -0
- package/lib/import/figma/nodes.d.cts +18 -0
- package/lib/import/figma/nodes.d.mts +18 -0
- package/lib/import/figma/query.d.cts +42 -0
- package/lib/import/figma/query.d.mts +42 -0
- package/lib/import/figma/query.d.ts +1 -1
- package/lib/import/figma/types/api.d.cts +53 -0
- package/lib/import/figma/types/api.d.mts +53 -0
- package/lib/import/figma/types/api.d.ts +1 -1
- package/lib/import/figma/types/nodes.d.cts +44 -0
- package/lib/import/figma/types/nodes.d.mts +44 -0
- package/lib/import/figma/types/nodes.d.ts +1 -1
- package/lib/import/figma/types/options.d.cts +59 -0
- package/lib/import/figma/types/options.d.mts +59 -0
- package/lib/import/figma/types/options.d.ts +1 -1
- package/lib/import/figma/types/result.d.cts +44 -0
- package/lib/import/figma/types/result.d.mts +44 -0
- package/lib/import/figma/types/result.d.ts +1 -1
- package/lib/index.cjs +7 -5
- package/lib/index.d.cts +78 -0
- package/lib/index.d.mts +78 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.mjs +6 -5
- package/lib/misc/bump-version.d.cts +6 -0
- package/lib/misc/bump-version.d.mts +6 -0
- package/lib/misc/cheerio.d.cts +9 -0
- package/lib/misc/cheerio.d.mts +9 -0
- package/lib/misc/cheerio.d.ts +1 -1
- package/lib/misc/compare-dirs.d.cts +11 -0
- package/lib/misc/compare-dirs.d.mts +11 -0
- package/lib/misc/compare-dirs.d.ts +1 -1
- package/lib/misc/exec.d.cts +12 -0
- package/lib/misc/exec.d.mts +12 -0
- package/lib/misc/exec.d.ts +1 -1
- package/lib/misc/keyword.d.cts +6 -0
- package/lib/misc/keyword.d.mts +6 -0
- package/lib/misc/scan.d.cts +33 -0
- package/lib/misc/scan.d.mts +33 -0
- package/lib/misc/scan.d.ts +1 -1
- package/lib/misc/write-json.d.cts +6 -0
- package/lib/misc/write-json.d.mts +6 -0
- package/lib/optimise/figma.d.cts +11 -0
- package/lib/optimise/figma.d.mts +11 -0
- package/lib/optimise/flags.d.cts +11 -0
- package/lib/optimise/flags.d.mts +11 -0
- package/lib/optimise/global-style.d.cts +11 -0
- package/lib/optimise/global-style.d.mts +11 -0
- package/lib/optimise/mask.d.cts +24 -0
- package/lib/optimise/mask.d.mts +24 -0
- package/lib/optimise/origin.d.cts +11 -0
- package/lib/optimise/origin.d.mts +11 -0
- package/lib/optimise/scale.d.cts +11 -0
- package/lib/optimise/scale.d.mts +11 -0
- package/lib/optimise/svgo.d.cts +37 -0
- package/lib/optimise/svgo.d.mts +37 -0
- package/lib/svg/analyse/error.d.cts +10 -0
- package/lib/svg/analyse/error.d.mts +10 -0
- package/lib/svg/analyse/types.d.cts +92 -0
- package/lib/svg/analyse/types.d.mts +92 -0
- package/lib/svg/analyse/types.d.ts +1 -1
- package/lib/svg/analyse.d.cts +15 -0
- package/lib/svg/analyse.d.mts +15 -0
- package/lib/svg/cleanup/attribs.d.cts +11 -0
- package/lib/svg/cleanup/attribs.d.mts +11 -0
- package/lib/svg/cleanup/bad-tags.d.cts +17 -0
- package/lib/svg/cleanup/bad-tags.d.mts +17 -0
- package/lib/svg/cleanup/bad-tags.d.ts +1 -1
- package/lib/svg/cleanup/inline-style.d.cts +11 -0
- package/lib/svg/cleanup/inline-style.d.mts +11 -0
- package/lib/svg/cleanup/root-style.d.cts +17 -0
- package/lib/svg/cleanup/root-style.d.mts +17 -0
- package/lib/svg/cleanup/root-svg.d.cts +11 -0
- package/lib/svg/cleanup/root-svg.d.mts +11 -0
- package/lib/svg/cleanup/svgo-style.d.cts +11 -0
- package/lib/svg/cleanup/svgo-style.d.mts +11 -0
- package/lib/svg/cleanup.d.cts +16 -0
- package/lib/svg/cleanup.d.mts +16 -0
- package/lib/svg/cleanup.d.ts +1 -1
- package/lib/svg/data/attributes.d.cts +77 -0
- package/lib/svg/data/attributes.d.mts +77 -0
- package/lib/svg/data/tags.d.cts +95 -0
- package/lib/svg/data/tags.d.mts +95 -0
- package/lib/svg/index.cjs +17 -0
- package/lib/svg/index.d.cts +52 -0
- package/lib/svg/index.d.mts +52 -0
- package/lib/svg/index.d.ts +5 -1
- package/lib/svg/index.mjs +18 -1
- package/lib/svg/parse-style.d.cts +58 -0
- package/lib/svg/parse-style.d.mts +58 -0
- package/lib/svg/parse-style.d.ts +1 -1
- package/lib/svg/parse.d.cts +30 -0
- package/lib/svg/parse.d.mts +30 -0
- package/lib/svg/parse.d.ts +1 -1
- package/package.json +14 -17
package/lib/icon-set/types.d.ts
CHANGED
|
@@ -72,4 +72,4 @@ type IconSetForEachCallbackResult = void | false;
|
|
|
72
72
|
type IconSetAsyncForEachCallback = (name: string, type: IconSetIconEntry['type']) => Promise<IconSetForEachCallbackResult> | IconSetForEachCallbackResult;
|
|
73
73
|
type IconSetSyncForEachCallback = (name: string, type: IconSetIconEntry['type']) => IconSetForEachCallbackResult;
|
|
74
74
|
|
|
75
|
-
export { CheckThemeResult, CommonIconProps, ExtraIconProps, IconCategory, IconParentData, IconSetAsyncForEachCallback, IconSetIcon, IconSetIconAlias, IconSetIconEntry, IconSetIconType, IconSetIconVariation, IconSetSyncForEachCallback, IconWithCategories, IconWithChars, IconWithPropsData, ResolvedIconifyIcon };
|
|
75
|
+
export type { CheckThemeResult, CommonIconProps, ExtraIconProps, IconCategory, IconParentData, IconSetAsyncForEachCallback, IconSetIcon, IconSetIconAlias, IconSetIconEntry, IconSetIconType, IconSetIconVariation, IconSetSyncForEachCallback, IconWithCategories, IconWithChars, IconWithPropsData, ResolvedIconifyIcon };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IconSet } from '../icon-set/index.cjs';
|
|
2
|
+
import { CleanupSVGOptions } from '../svg/cleanup.cjs';
|
|
3
|
+
import '@iconify/types';
|
|
4
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
5
|
+
import '../icon-set/types.cjs';
|
|
6
|
+
import '../svg/index.cjs';
|
|
7
|
+
import 'cheerio';
|
|
8
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
9
|
+
import '../svg/cleanup/bad-tags.cjs';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Entry for file
|
|
13
|
+
*/
|
|
14
|
+
interface ImportDirectoryFileEntry {
|
|
15
|
+
path: string;
|
|
16
|
+
subdir: string;
|
|
17
|
+
file: string;
|
|
18
|
+
ext: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Callback to get keyword for icon based on file name
|
|
22
|
+
*
|
|
23
|
+
* Returns:
|
|
24
|
+
* - string for new keyword
|
|
25
|
+
* - undefined to skip icon
|
|
26
|
+
*
|
|
27
|
+
* Callback can be asynchronous
|
|
28
|
+
*/
|
|
29
|
+
type ImportDirectoryKeywordCallbackResult = string | undefined;
|
|
30
|
+
type Callback<T> = (file: ImportDirectoryFileEntry, defaultKeyword: string, iconSet: IconSet) => T;
|
|
31
|
+
type AsyncCallback<T> = Callback<T | Promise<T>>;
|
|
32
|
+
type ImportDirectoryKeywordCallback = AsyncCallback<ImportDirectoryKeywordCallbackResult>;
|
|
33
|
+
type ImportDirectoryKeywordSyncCallback = Callback<ImportDirectoryKeywordCallbackResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Options
|
|
36
|
+
*/
|
|
37
|
+
interface ImportDirectoryOptions<K> extends CleanupSVGOptions {
|
|
38
|
+
prefix?: string;
|
|
39
|
+
includeSubDirs?: boolean;
|
|
40
|
+
keyword?: K;
|
|
41
|
+
ignoreImportErrors?: boolean | 'warn';
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Import all icons from directory
|
|
45
|
+
*/
|
|
46
|
+
declare function importDirectory(path: string, options?: ImportDirectoryOptions<ImportDirectoryKeywordCallback>): Promise<IconSet>;
|
|
47
|
+
/**
|
|
48
|
+
* Import all icons from directory synchronously
|
|
49
|
+
*/
|
|
50
|
+
declare function importDirectorySync(path: string, options?: ImportDirectoryOptions<ImportDirectoryKeywordSyncCallback>): IconSet;
|
|
51
|
+
|
|
52
|
+
export { type ImportDirectoryFileEntry, type ImportDirectoryKeywordCallback, type ImportDirectoryKeywordSyncCallback, importDirectory, importDirectorySync };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { IconSet } from '../icon-set/index.mjs';
|
|
2
|
+
import { CleanupSVGOptions } from '../svg/cleanup.mjs';
|
|
3
|
+
import '@iconify/types';
|
|
4
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
5
|
+
import '../icon-set/types.mjs';
|
|
6
|
+
import '../svg/index.mjs';
|
|
7
|
+
import 'cheerio';
|
|
8
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
9
|
+
import '../svg/cleanup/bad-tags.mjs';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Entry for file
|
|
13
|
+
*/
|
|
14
|
+
interface ImportDirectoryFileEntry {
|
|
15
|
+
path: string;
|
|
16
|
+
subdir: string;
|
|
17
|
+
file: string;
|
|
18
|
+
ext: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Callback to get keyword for icon based on file name
|
|
22
|
+
*
|
|
23
|
+
* Returns:
|
|
24
|
+
* - string for new keyword
|
|
25
|
+
* - undefined to skip icon
|
|
26
|
+
*
|
|
27
|
+
* Callback can be asynchronous
|
|
28
|
+
*/
|
|
29
|
+
type ImportDirectoryKeywordCallbackResult = string | undefined;
|
|
30
|
+
type Callback<T> = (file: ImportDirectoryFileEntry, defaultKeyword: string, iconSet: IconSet) => T;
|
|
31
|
+
type AsyncCallback<T> = Callback<T | Promise<T>>;
|
|
32
|
+
type ImportDirectoryKeywordCallback = AsyncCallback<ImportDirectoryKeywordCallbackResult>;
|
|
33
|
+
type ImportDirectoryKeywordSyncCallback = Callback<ImportDirectoryKeywordCallbackResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Options
|
|
36
|
+
*/
|
|
37
|
+
interface ImportDirectoryOptions<K> extends CleanupSVGOptions {
|
|
38
|
+
prefix?: string;
|
|
39
|
+
includeSubDirs?: boolean;
|
|
40
|
+
keyword?: K;
|
|
41
|
+
ignoreImportErrors?: boolean | 'warn';
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Import all icons from directory
|
|
45
|
+
*/
|
|
46
|
+
declare function importDirectory(path: string, options?: ImportDirectoryOptions<ImportDirectoryKeywordCallback>): Promise<IconSet>;
|
|
47
|
+
/**
|
|
48
|
+
* Import all icons from directory synchronously
|
|
49
|
+
*/
|
|
50
|
+
declare function importDirectorySync(path: string, options?: ImportDirectoryOptions<ImportDirectoryKeywordSyncCallback>): IconSet;
|
|
51
|
+
|
|
52
|
+
export { type ImportDirectoryFileEntry, type ImportDirectoryKeywordCallback, type ImportDirectoryKeywordSyncCallback, importDirectory, importDirectorySync };
|
|
@@ -49,4 +49,4 @@ declare function importDirectory(path: string, options?: ImportDirectoryOptions<
|
|
|
49
49
|
*/
|
|
50
50
|
declare function importDirectorySync(path: string, options?: ImportDirectoryOptions<ImportDirectoryKeywordSyncCallback>): IconSet;
|
|
51
51
|
|
|
52
|
-
export { ImportDirectoryFileEntry, ImportDirectoryKeywordCallback, ImportDirectoryKeywordSyncCallback, importDirectory, importDirectorySync };
|
|
52
|
+
export { type ImportDirectoryFileEntry, type ImportDirectoryKeywordCallback, type ImportDirectoryKeywordSyncCallback, importDirectory, importDirectorySync };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DocumentNotModified } from '../../download/types/modified.cjs';
|
|
2
|
+
import { FigmaIfModifiedSinceOption, FigmaImportOptions } from './types/options.cjs';
|
|
3
|
+
import { FigmaImportResult } from './types/result.cjs';
|
|
4
|
+
import '../../icon-set/index.cjs';
|
|
5
|
+
import '@iconify/types';
|
|
6
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
7
|
+
import '../../icon-set/types.cjs';
|
|
8
|
+
import '../../svg/index.cjs';
|
|
9
|
+
import 'cheerio';
|
|
10
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
11
|
+
import './types/nodes.cjs';
|
|
12
|
+
import './types/api.cjs';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Import icon set from Figma
|
|
16
|
+
*/
|
|
17
|
+
declare function importFromFigma<T extends FigmaIfModifiedSinceOption & FigmaImportOptions>(options: T): Promise<FigmaImportResult | DocumentNotModified>;
|
|
18
|
+
declare function importFromFigma(options: FigmaImportOptions): Promise<FigmaImportResult>;
|
|
19
|
+
|
|
20
|
+
export { importFromFigma };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DocumentNotModified } from '../../download/types/modified.mjs';
|
|
2
|
+
import { FigmaIfModifiedSinceOption, FigmaImportOptions } from './types/options.mjs';
|
|
3
|
+
import { FigmaImportResult } from './types/result.mjs';
|
|
4
|
+
import '../../icon-set/index.mjs';
|
|
5
|
+
import '@iconify/types';
|
|
6
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
7
|
+
import '../../icon-set/types.mjs';
|
|
8
|
+
import '../../svg/index.mjs';
|
|
9
|
+
import 'cheerio';
|
|
10
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
11
|
+
import './types/nodes.mjs';
|
|
12
|
+
import './types/api.mjs';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Import icon set from Figma
|
|
16
|
+
*/
|
|
17
|
+
declare function importFromFigma<T extends FigmaIfModifiedSinceOption & FigmaImportOptions>(options: T): Promise<FigmaImportResult | DocumentNotModified>;
|
|
18
|
+
declare function importFromFigma(options: FigmaImportOptions): Promise<FigmaImportResult>;
|
|
19
|
+
|
|
20
|
+
export { importFromFigma };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FigmaDocument } from './types/api.cjs';
|
|
2
|
+
import { FigmaGetIconNodesOptions } from './types/options.cjs';
|
|
3
|
+
import { FigmaNodesImportResult } from './types/result.cjs';
|
|
4
|
+
import '../../icon-set/index.cjs';
|
|
5
|
+
import '@iconify/types';
|
|
6
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
7
|
+
import '../../icon-set/types.cjs';
|
|
8
|
+
import '../../svg/index.cjs';
|
|
9
|
+
import 'cheerio';
|
|
10
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
11
|
+
import './types/nodes.cjs';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get node ids for icons
|
|
15
|
+
*/
|
|
16
|
+
declare function getFigmaIconNodes(document: FigmaDocument, options: FigmaGetIconNodesOptions): FigmaNodesImportResult;
|
|
17
|
+
|
|
18
|
+
export { getFigmaIconNodes };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FigmaDocument } from './types/api.mjs';
|
|
2
|
+
import { FigmaGetIconNodesOptions } from './types/options.mjs';
|
|
3
|
+
import { FigmaNodesImportResult } from './types/result.mjs';
|
|
4
|
+
import '../../icon-set/index.mjs';
|
|
5
|
+
import '@iconify/types';
|
|
6
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
7
|
+
import '../../icon-set/types.mjs';
|
|
8
|
+
import '../../svg/index.mjs';
|
|
9
|
+
import 'cheerio';
|
|
10
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
11
|
+
import './types/nodes.mjs';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get node ids for icons
|
|
15
|
+
*/
|
|
16
|
+
declare function getFigmaIconNodes(document: FigmaDocument, options: FigmaGetIconNodesOptions): FigmaNodesImportResult;
|
|
17
|
+
|
|
18
|
+
export { getFigmaIconNodes };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { APICacheOptions } from '../../download/api/types.cjs';
|
|
2
|
+
import { DocumentNotModified } from '../../download/types/modified.cjs';
|
|
3
|
+
import { FigmaDocument } from './types/api.cjs';
|
|
4
|
+
import { FigmaIfModifiedSinceOption, FigmaFilesQueryOptions, FigmaImagesQueryOptions } from './types/options.cjs';
|
|
5
|
+
import { FigmaNodesImportResult, FigmaIconNode } from './types/result.cjs';
|
|
6
|
+
import '../../icon-set/index.cjs';
|
|
7
|
+
import '@iconify/types';
|
|
8
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
9
|
+
import '../../icon-set/types.cjs';
|
|
10
|
+
import '../../svg/index.cjs';
|
|
11
|
+
import 'cheerio';
|
|
12
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
13
|
+
import './types/nodes.cjs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Extra parameters added to runConcurrentQueries()
|
|
17
|
+
*
|
|
18
|
+
* Can be used to identify failed items in onfail callback
|
|
19
|
+
*/
|
|
20
|
+
interface FigmaIconNodeWithURL extends FigmaIconNode {
|
|
21
|
+
url: string;
|
|
22
|
+
}
|
|
23
|
+
type FigmaConcurrentQueriesParamsFunction = 'figmaImagesQuery' | 'figmaDownloadImages';
|
|
24
|
+
interface FigmaConcurrentQueriesParams<T extends FigmaConcurrentQueriesParamsFunction> {
|
|
25
|
+
function: T;
|
|
26
|
+
payload: T extends 'figmaImagesQuery' ? string[][] : FigmaIconNodeWithURL[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get Figma files
|
|
30
|
+
*/
|
|
31
|
+
declare function figmaFilesQuery<T extends FigmaIfModifiedSinceOption & FigmaFilesQueryOptions>(options: T, cache?: APICacheOptions): Promise<FigmaDocument | DocumentNotModified>;
|
|
32
|
+
declare function figmaFilesQuery(options: FigmaFilesQueryOptions, cache?: APICacheOptions): Promise<FigmaDocument>;
|
|
33
|
+
/**
|
|
34
|
+
* Generate all images
|
|
35
|
+
*/
|
|
36
|
+
declare function figmaImagesQuery(options: FigmaImagesQueryOptions, nodes: FigmaNodesImportResult, cache?: APICacheOptions): Promise<FigmaNodesImportResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Download all images
|
|
39
|
+
*/
|
|
40
|
+
declare function figmaDownloadImages(nodes: FigmaNodesImportResult, cache?: APICacheOptions): Promise<FigmaNodesImportResult>;
|
|
41
|
+
|
|
42
|
+
export { type FigmaConcurrentQueriesParams, type FigmaConcurrentQueriesParamsFunction, figmaDownloadImages, figmaFilesQuery, figmaImagesQuery };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { APICacheOptions } from '../../download/api/types.mjs';
|
|
2
|
+
import { DocumentNotModified } from '../../download/types/modified.mjs';
|
|
3
|
+
import { FigmaDocument } from './types/api.mjs';
|
|
4
|
+
import { FigmaIfModifiedSinceOption, FigmaFilesQueryOptions, FigmaImagesQueryOptions } from './types/options.mjs';
|
|
5
|
+
import { FigmaNodesImportResult, FigmaIconNode } from './types/result.mjs';
|
|
6
|
+
import '../../icon-set/index.mjs';
|
|
7
|
+
import '@iconify/types';
|
|
8
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
9
|
+
import '../../icon-set/types.mjs';
|
|
10
|
+
import '../../svg/index.mjs';
|
|
11
|
+
import 'cheerio';
|
|
12
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
13
|
+
import './types/nodes.mjs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Extra parameters added to runConcurrentQueries()
|
|
17
|
+
*
|
|
18
|
+
* Can be used to identify failed items in onfail callback
|
|
19
|
+
*/
|
|
20
|
+
interface FigmaIconNodeWithURL extends FigmaIconNode {
|
|
21
|
+
url: string;
|
|
22
|
+
}
|
|
23
|
+
type FigmaConcurrentQueriesParamsFunction = 'figmaImagesQuery' | 'figmaDownloadImages';
|
|
24
|
+
interface FigmaConcurrentQueriesParams<T extends FigmaConcurrentQueriesParamsFunction> {
|
|
25
|
+
function: T;
|
|
26
|
+
payload: T extends 'figmaImagesQuery' ? string[][] : FigmaIconNodeWithURL[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get Figma files
|
|
30
|
+
*/
|
|
31
|
+
declare function figmaFilesQuery<T extends FigmaIfModifiedSinceOption & FigmaFilesQueryOptions>(options: T, cache?: APICacheOptions): Promise<FigmaDocument | DocumentNotModified>;
|
|
32
|
+
declare function figmaFilesQuery(options: FigmaFilesQueryOptions, cache?: APICacheOptions): Promise<FigmaDocument>;
|
|
33
|
+
/**
|
|
34
|
+
* Generate all images
|
|
35
|
+
*/
|
|
36
|
+
declare function figmaImagesQuery(options: FigmaImagesQueryOptions, nodes: FigmaNodesImportResult, cache?: APICacheOptions): Promise<FigmaNodesImportResult>;
|
|
37
|
+
/**
|
|
38
|
+
* Download all images
|
|
39
|
+
*/
|
|
40
|
+
declare function figmaDownloadImages(nodes: FigmaNodesImportResult, cache?: APICacheOptions): Promise<FigmaNodesImportResult>;
|
|
41
|
+
|
|
42
|
+
export { type FigmaConcurrentQueriesParams, type FigmaConcurrentQueriesParamsFunction, figmaDownloadImages, figmaFilesQuery, figmaImagesQuery };
|
|
@@ -39,4 +39,4 @@ declare function figmaImagesQuery(options: FigmaImagesQueryOptions, nodes: Figma
|
|
|
39
39
|
*/
|
|
40
40
|
declare function figmaDownloadImages(nodes: FigmaNodesImportResult, cache?: APICacheOptions): Promise<FigmaNodesImportResult>;
|
|
41
41
|
|
|
42
|
-
export { FigmaConcurrentQueriesParams, FigmaConcurrentQueriesParamsFunction, figmaDownloadImages, figmaFilesQuery, figmaImagesQuery };
|
|
42
|
+
export { type FigmaConcurrentQueriesParams, type FigmaConcurrentQueriesParamsFunction, figmaDownloadImages, figmaFilesQuery, figmaImagesQuery };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic document structure
|
|
3
|
+
*/
|
|
4
|
+
interface FigmaBoundingBox {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
interface BaseFigmaNode {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
interface GenericFigmaNode extends BaseFigmaNode {
|
|
15
|
+
type: string;
|
|
16
|
+
children?: FigmaNode[];
|
|
17
|
+
}
|
|
18
|
+
interface IconFigmaNode extends BaseFigmaNode {
|
|
19
|
+
type: 'FRAME' | 'COMPONENT' | 'INSTANCE';
|
|
20
|
+
clipsContent?: boolean;
|
|
21
|
+
absoluteBoundingBox?: FigmaBoundingBox;
|
|
22
|
+
children: FigmaNode[];
|
|
23
|
+
}
|
|
24
|
+
interface FigmaDocumentNode extends BaseFigmaNode {
|
|
25
|
+
type: 'DOCUMENT';
|
|
26
|
+
children: FigmaNode[];
|
|
27
|
+
}
|
|
28
|
+
type FigmaNode = GenericFigmaNode | IconFigmaNode;
|
|
29
|
+
/**
|
|
30
|
+
* Document response from API
|
|
31
|
+
*/
|
|
32
|
+
interface FigmaDocument {
|
|
33
|
+
document: FigmaDocumentNode;
|
|
34
|
+
name: string;
|
|
35
|
+
version: string;
|
|
36
|
+
lastModified: string;
|
|
37
|
+
thumbnailUrl: string;
|
|
38
|
+
role: string;
|
|
39
|
+
editorType: 'figma' | 'figjam';
|
|
40
|
+
}
|
|
41
|
+
interface FigmaAPIError {
|
|
42
|
+
status: number;
|
|
43
|
+
err: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Result for retrieved icons
|
|
47
|
+
*/
|
|
48
|
+
interface FigmaAPIImagesResponse {
|
|
49
|
+
err?: string | null;
|
|
50
|
+
images: Record<string, string | null>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type { FigmaAPIError, FigmaAPIImagesResponse, FigmaDocument, FigmaDocumentNode, FigmaNode, IconFigmaNode };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic document structure
|
|
3
|
+
*/
|
|
4
|
+
interface FigmaBoundingBox {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
interface BaseFigmaNode {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
interface GenericFigmaNode extends BaseFigmaNode {
|
|
15
|
+
type: string;
|
|
16
|
+
children?: FigmaNode[];
|
|
17
|
+
}
|
|
18
|
+
interface IconFigmaNode extends BaseFigmaNode {
|
|
19
|
+
type: 'FRAME' | 'COMPONENT' | 'INSTANCE';
|
|
20
|
+
clipsContent?: boolean;
|
|
21
|
+
absoluteBoundingBox?: FigmaBoundingBox;
|
|
22
|
+
children: FigmaNode[];
|
|
23
|
+
}
|
|
24
|
+
interface FigmaDocumentNode extends BaseFigmaNode {
|
|
25
|
+
type: 'DOCUMENT';
|
|
26
|
+
children: FigmaNode[];
|
|
27
|
+
}
|
|
28
|
+
type FigmaNode = GenericFigmaNode | IconFigmaNode;
|
|
29
|
+
/**
|
|
30
|
+
* Document response from API
|
|
31
|
+
*/
|
|
32
|
+
interface FigmaDocument {
|
|
33
|
+
document: FigmaDocumentNode;
|
|
34
|
+
name: string;
|
|
35
|
+
version: string;
|
|
36
|
+
lastModified: string;
|
|
37
|
+
thumbnailUrl: string;
|
|
38
|
+
role: string;
|
|
39
|
+
editorType: 'figma' | 'figjam';
|
|
40
|
+
}
|
|
41
|
+
interface FigmaAPIError {
|
|
42
|
+
status: number;
|
|
43
|
+
err: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Result for retrieved icons
|
|
47
|
+
*/
|
|
48
|
+
interface FigmaAPIImagesResponse {
|
|
49
|
+
err?: string | null;
|
|
50
|
+
images: Record<string, string | null>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type { FigmaAPIError, FigmaAPIImagesResponse, FigmaDocument, FigmaDocumentNode, FigmaNode, IconFigmaNode };
|
|
@@ -50,4 +50,4 @@ interface FigmaAPIImagesResponse {
|
|
|
50
50
|
images: Record<string, string | null>;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export { FigmaAPIError, FigmaAPIImagesResponse, FigmaDocument, FigmaDocumentNode, FigmaNode, IconFigmaNode };
|
|
53
|
+
export type { FigmaAPIError, FigmaAPIImagesResponse, FigmaDocument, FigmaDocumentNode, FigmaNode, IconFigmaNode };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IconFigmaNode, FigmaDocument } from './api.cjs';
|
|
2
|
+
import { FigmaNodesImportResult, FigmaIconNode } from './result.cjs';
|
|
3
|
+
import '../../../icon-set/index.cjs';
|
|
4
|
+
import '@iconify/types';
|
|
5
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
6
|
+
import '../../../icon-set/types.cjs';
|
|
7
|
+
import '../../../svg/index.cjs';
|
|
8
|
+
import 'cheerio';
|
|
9
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
10
|
+
|
|
11
|
+
type FigmaImportParentNodeType = 'CANVAS' | 'FRAME' | 'GROUP' | 'SECTION';
|
|
12
|
+
type FigmaImportIconNodeType = IconFigmaNode['type'];
|
|
13
|
+
/**
|
|
14
|
+
* Node information passed to callback
|
|
15
|
+
*/
|
|
16
|
+
interface FigmaParentNodeData {
|
|
17
|
+
id: string;
|
|
18
|
+
type: FigmaImportParentNodeType;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
interface FigmaImportNodeData {
|
|
22
|
+
id: string;
|
|
23
|
+
type: FigmaImportIconNodeType;
|
|
24
|
+
name: string;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
parents: FigmaParentNodeData[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Callback to check if node needs to be checked for icons
|
|
31
|
+
*
|
|
32
|
+
* Used to speed up processing by eleminating pages, frames and groups that do not need processing
|
|
33
|
+
*/
|
|
34
|
+
type FigmaImportParentNodeFilter = (node: FigmaParentNodeData[], document: FigmaDocument) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Check if node is an icon.
|
|
37
|
+
*
|
|
38
|
+
* Returns icon name on success, null or undefined if not should be ignored.
|
|
39
|
+
* Function can also return FigmaIconNode object, where it can put extra properties that can be used later
|
|
40
|
+
*/
|
|
41
|
+
type FigmaIconNodeWithKeyword = Partial<FigmaIconNode> & Pick<FigmaIconNode, 'keyword'>;
|
|
42
|
+
type FigmaImportNodeFilter = (node: FigmaImportNodeData, nodes: FigmaNodesImportResult, document: FigmaDocument) => string | FigmaIconNodeWithKeyword | null | undefined;
|
|
43
|
+
|
|
44
|
+
export type { FigmaImportIconNodeType, FigmaImportNodeData, FigmaImportNodeFilter, FigmaImportParentNodeFilter, FigmaImportParentNodeType, FigmaParentNodeData };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { IconFigmaNode, FigmaDocument } from './api.mjs';
|
|
2
|
+
import { FigmaNodesImportResult, FigmaIconNode } from './result.mjs';
|
|
3
|
+
import '../../../icon-set/index.mjs';
|
|
4
|
+
import '@iconify/types';
|
|
5
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
6
|
+
import '../../../icon-set/types.mjs';
|
|
7
|
+
import '../../../svg/index.mjs';
|
|
8
|
+
import 'cheerio';
|
|
9
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
10
|
+
|
|
11
|
+
type FigmaImportParentNodeType = 'CANVAS' | 'FRAME' | 'GROUP' | 'SECTION';
|
|
12
|
+
type FigmaImportIconNodeType = IconFigmaNode['type'];
|
|
13
|
+
/**
|
|
14
|
+
* Node information passed to callback
|
|
15
|
+
*/
|
|
16
|
+
interface FigmaParentNodeData {
|
|
17
|
+
id: string;
|
|
18
|
+
type: FigmaImportParentNodeType;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
interface FigmaImportNodeData {
|
|
22
|
+
id: string;
|
|
23
|
+
type: FigmaImportIconNodeType;
|
|
24
|
+
name: string;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
parents: FigmaParentNodeData[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Callback to check if node needs to be checked for icons
|
|
31
|
+
*
|
|
32
|
+
* Used to speed up processing by eleminating pages, frames and groups that do not need processing
|
|
33
|
+
*/
|
|
34
|
+
type FigmaImportParentNodeFilter = (node: FigmaParentNodeData[], document: FigmaDocument) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Check if node is an icon.
|
|
37
|
+
*
|
|
38
|
+
* Returns icon name on success, null or undefined if not should be ignored.
|
|
39
|
+
* Function can also return FigmaIconNode object, where it can put extra properties that can be used later
|
|
40
|
+
*/
|
|
41
|
+
type FigmaIconNodeWithKeyword = Partial<FigmaIconNode> & Pick<FigmaIconNode, 'keyword'>;
|
|
42
|
+
type FigmaImportNodeFilter = (node: FigmaImportNodeData, nodes: FigmaNodesImportResult, document: FigmaDocument) => string | FigmaIconNodeWithKeyword | null | undefined;
|
|
43
|
+
|
|
44
|
+
export type { FigmaImportIconNodeType, FigmaImportNodeData, FigmaImportNodeFilter, FigmaImportParentNodeFilter, FigmaImportParentNodeType, FigmaParentNodeData };
|
|
@@ -41,4 +41,4 @@ type FigmaImportParentNodeFilter = (node: FigmaParentNodeData[], document: Figma
|
|
|
41
41
|
type FigmaIconNodeWithKeyword = Partial<FigmaIconNode> & Pick<FigmaIconNode, 'keyword'>;
|
|
42
42
|
type FigmaImportNodeFilter = (node: FigmaImportNodeData, nodes: FigmaNodesImportResult, document: FigmaDocument) => string | FigmaIconNodeWithKeyword | null | undefined;
|
|
43
43
|
|
|
44
|
-
export { FigmaImportIconNodeType, FigmaImportNodeData, FigmaImportNodeFilter, FigmaImportParentNodeFilter, FigmaImportParentNodeType, FigmaParentNodeData };
|
|
44
|
+
export type { FigmaImportIconNodeType, FigmaImportNodeData, FigmaImportNodeFilter, FigmaImportParentNodeFilter, FigmaImportParentNodeType, FigmaParentNodeData };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { IconSet } from '../../../icon-set/index.cjs';
|
|
2
|
+
import { FigmaImportParentNodeFilter, FigmaImportNodeFilter } from './nodes.cjs';
|
|
3
|
+
import { FigmaIconNode } from './result.cjs';
|
|
4
|
+
import '@iconify/types';
|
|
5
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
6
|
+
import '../../../icon-set/types.cjs';
|
|
7
|
+
import '../../../svg/index.cjs';
|
|
8
|
+
import 'cheerio';
|
|
9
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
10
|
+
import './api.cjs';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Options for importing SVG
|
|
14
|
+
*/
|
|
15
|
+
interface FigmaImportSVGOptions {
|
|
16
|
+
includeID?: boolean;
|
|
17
|
+
simplifyStroke?: boolean;
|
|
18
|
+
useAbsoluteBounds?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Options
|
|
22
|
+
*/
|
|
23
|
+
interface FigmaImportCommonOptions {
|
|
24
|
+
token: string;
|
|
25
|
+
file: string;
|
|
26
|
+
version?: string;
|
|
27
|
+
}
|
|
28
|
+
interface FigmaIfModifiedSinceOption {
|
|
29
|
+
ifModifiedSince: string | Date | true;
|
|
30
|
+
}
|
|
31
|
+
interface FigmaFilesQueryOptions extends FigmaImportCommonOptions, Partial<FigmaIfModifiedSinceOption> {
|
|
32
|
+
ids?: string[];
|
|
33
|
+
depth?: number;
|
|
34
|
+
}
|
|
35
|
+
interface FigmaImagesQueryOptions extends FigmaImportCommonOptions {
|
|
36
|
+
svgOptions?: FigmaImportSVGOptions;
|
|
37
|
+
}
|
|
38
|
+
interface FigmaGetIconNodesOptions {
|
|
39
|
+
pages?: string[];
|
|
40
|
+
filterParentNode?: FigmaImportParentNodeFilter;
|
|
41
|
+
iconNameForNode: FigmaImportNodeFilter;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Callback to call before or after importing icon
|
|
45
|
+
*/
|
|
46
|
+
type FigmaImportedIconCallback = (node: FigmaIconNode, iconSet: IconSet) => void | Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Options for main import function
|
|
49
|
+
*/
|
|
50
|
+
interface FigmaImportOptions extends FigmaFilesQueryOptions, FigmaImagesQueryOptions, FigmaGetIconNodesOptions {
|
|
51
|
+
prefix: string;
|
|
52
|
+
cacheDir?: string;
|
|
53
|
+
cacheAPITTL?: number;
|
|
54
|
+
cacheSVGTTL?: number;
|
|
55
|
+
beforeImportingIcon?: FigmaImportedIconCallback;
|
|
56
|
+
afterImportingIcon?: FigmaImportedIconCallback;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type { FigmaFilesQueryOptions, FigmaGetIconNodesOptions, FigmaIfModifiedSinceOption, FigmaImagesQueryOptions, FigmaImportOptions, FigmaImportSVGOptions };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { IconSet } from '../../../icon-set/index.mjs';
|
|
2
|
+
import { FigmaImportParentNodeFilter, FigmaImportNodeFilter } from './nodes.mjs';
|
|
3
|
+
import { FigmaIconNode } from './result.mjs';
|
|
4
|
+
import '@iconify/types';
|
|
5
|
+
import '@iconify/utils/lib/customisations/defaults';
|
|
6
|
+
import '../../../icon-set/types.mjs';
|
|
7
|
+
import '../../../svg/index.mjs';
|
|
8
|
+
import 'cheerio';
|
|
9
|
+
import '@iconify/utils/lib/icon-set/tree';
|
|
10
|
+
import './api.mjs';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Options for importing SVG
|
|
14
|
+
*/
|
|
15
|
+
interface FigmaImportSVGOptions {
|
|
16
|
+
includeID?: boolean;
|
|
17
|
+
simplifyStroke?: boolean;
|
|
18
|
+
useAbsoluteBounds?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Options
|
|
22
|
+
*/
|
|
23
|
+
interface FigmaImportCommonOptions {
|
|
24
|
+
token: string;
|
|
25
|
+
file: string;
|
|
26
|
+
version?: string;
|
|
27
|
+
}
|
|
28
|
+
interface FigmaIfModifiedSinceOption {
|
|
29
|
+
ifModifiedSince: string | Date | true;
|
|
30
|
+
}
|
|
31
|
+
interface FigmaFilesQueryOptions extends FigmaImportCommonOptions, Partial<FigmaIfModifiedSinceOption> {
|
|
32
|
+
ids?: string[];
|
|
33
|
+
depth?: number;
|
|
34
|
+
}
|
|
35
|
+
interface FigmaImagesQueryOptions extends FigmaImportCommonOptions {
|
|
36
|
+
svgOptions?: FigmaImportSVGOptions;
|
|
37
|
+
}
|
|
38
|
+
interface FigmaGetIconNodesOptions {
|
|
39
|
+
pages?: string[];
|
|
40
|
+
filterParentNode?: FigmaImportParentNodeFilter;
|
|
41
|
+
iconNameForNode: FigmaImportNodeFilter;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Callback to call before or after importing icon
|
|
45
|
+
*/
|
|
46
|
+
type FigmaImportedIconCallback = (node: FigmaIconNode, iconSet: IconSet) => void | Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Options for main import function
|
|
49
|
+
*/
|
|
50
|
+
interface FigmaImportOptions extends FigmaFilesQueryOptions, FigmaImagesQueryOptions, FigmaGetIconNodesOptions {
|
|
51
|
+
prefix: string;
|
|
52
|
+
cacheDir?: string;
|
|
53
|
+
cacheAPITTL?: number;
|
|
54
|
+
cacheSVGTTL?: number;
|
|
55
|
+
beforeImportingIcon?: FigmaImportedIconCallback;
|
|
56
|
+
afterImportingIcon?: FigmaImportedIconCallback;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type { FigmaFilesQueryOptions, FigmaGetIconNodesOptions, FigmaIfModifiedSinceOption, FigmaImagesQueryOptions, FigmaImportOptions, FigmaImportSVGOptions };
|
|
@@ -56,4 +56,4 @@ interface FigmaImportOptions extends FigmaFilesQueryOptions, FigmaImagesQueryOpt
|
|
|
56
56
|
afterImportingIcon?: FigmaImportedIconCallback;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export { FigmaFilesQueryOptions, FigmaGetIconNodesOptions, FigmaIfModifiedSinceOption, FigmaImagesQueryOptions, FigmaImportOptions, FigmaImportSVGOptions };
|
|
59
|
+
export type { FigmaFilesQueryOptions, FigmaGetIconNodesOptions, FigmaIfModifiedSinceOption, FigmaImagesQueryOptions, FigmaImportOptions, FigmaImportSVGOptions };
|