@fastkit/icon-font-gen 0.6.15 → 0.6.16

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.
@@ -59,6 +59,9 @@ async function resolveRawIconFontEntry(rootDir, rawEntry) {
59
59
  if (entry.name == null) {
60
60
  entry.name = 'mdi';
61
61
  }
62
+ if (entry.startUnicode == null) {
63
+ entry.startUnicode = 0xea0;
64
+ }
62
65
  }
63
66
  const name = entry.name || path__default.basename(entry.src);
64
67
  const fontName = entry.fontName || `${name}-icon`;
@@ -143,6 +146,8 @@ async function generateEntry(entry) {
143
146
  }
144
147
  await fs__default.ensureDir(options.dest);
145
148
  const webfont = await (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('webfont')); })).default;
149
+ const { startUnicode = 0xea01 } = options;
150
+ let i = startUnicode;
146
151
  const result = await webfont({
147
152
  files: options.src,
148
153
  fontName: options.fontName,
@@ -154,6 +159,12 @@ async function generateEntry(entry) {
154
159
  round: options.round,
155
160
  descent: options.descent,
156
161
  addHashInFontUrl: options.addHashInFontUrl,
162
+ glyphTransformFn: (obj) => {
163
+ const char = String.fromCodePoint(i);
164
+ obj.unicode = [char];
165
+ i++;
166
+ return obj;
167
+ },
157
168
  });
158
169
  const buildedFormats = [];
159
170
  ICON_FONT_FORMATS.forEach((format) => {
@@ -171,8 +182,9 @@ async function generateEntry(entry) {
171
182
  if (!metadata)
172
183
  return;
173
184
  const { name, unicode } = metadata;
174
- if (!unicode)
185
+ if (!unicode) {
175
186
  return;
187
+ }
176
188
  const code = unicode[0].charCodeAt(0).toString(16);
177
189
  glyphs.push({ name, code });
178
190
  });
@@ -183,25 +195,25 @@ async function generateEntry(entry) {
183
195
  return `url("${urlPath}/${options.name}.${format}${hashSuffix}") format("${ICON_FONT_FORMAT_MAP[format]}")`;
184
196
  })
185
197
  .join(',');
186
- const cssCode = `
198
+ const cssCode = `/* stylelint-disable */
187
199
  @font-face {
188
- font-family: "${options.fontName}";
189
- font-display: block;
190
- font-style: normal;
191
- font-weight: 400;
192
- src: ${src};
200
+ font-family: "${options.fontName}";
201
+ font-display: block;
202
+ font-style: normal;
203
+ font-weight: 400;
204
+ src: ${src};
193
205
  }
194
206
 
195
207
  i[class^="${cssPrefix}"]:before, i[class*=" ${cssPrefix}"]:before {
196
- font-family: ${options.fontName} !important;
197
- font-style: normal;
198
- font-weight: normal !important;
199
- font-variant: normal;
200
- text-transform: none;
201
- text-rendering: auto;
202
- line-height: 1;
203
- -webkit-font-smoothing: antialiased;
204
- -moz-osx-font-smoothing: grayscale;
208
+ font-family: ${options.fontName} !important;
209
+ font-style: normal;
210
+ font-weight: normal !important;
211
+ font-variant: normal;
212
+ text-transform: none;
213
+ text-rendering: auto;
214
+ line-height: 1;
215
+ -webkit-font-smoothing: antialiased;
216
+ -moz-osx-font-smoothing: grayscale;
205
217
  }
206
218
  ${glyphs
207
219
  .map(({ name, code }) => {
@@ -59,6 +59,9 @@ async function resolveRawIconFontEntry(rootDir, rawEntry) {
59
59
  if (entry.name == null) {
60
60
  entry.name = 'mdi';
61
61
  }
62
+ if (entry.startUnicode == null) {
63
+ entry.startUnicode = 0xea0;
64
+ }
62
65
  }
63
66
  const name = entry.name || path__default.basename(entry.src);
64
67
  const fontName = entry.fontName || `${name}-icon`;
@@ -143,6 +146,8 @@ async function generateEntry(entry) {
143
146
  }
144
147
  await fs__default.ensureDir(options.dest);
145
148
  const webfont = await (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('webfont')); })).default;
149
+ const { startUnicode = 0xea01 } = options;
150
+ let i = startUnicode;
146
151
  const result = await webfont({
147
152
  files: options.src,
148
153
  fontName: options.fontName,
@@ -154,6 +159,12 @@ async function generateEntry(entry) {
154
159
  round: options.round,
155
160
  descent: options.descent,
156
161
  addHashInFontUrl: options.addHashInFontUrl,
162
+ glyphTransformFn: (obj) => {
163
+ const char = String.fromCodePoint(i);
164
+ obj.unicode = [char];
165
+ i++;
166
+ return obj;
167
+ },
157
168
  });
158
169
  const buildedFormats = [];
159
170
  ICON_FONT_FORMATS.forEach((format) => {
@@ -171,8 +182,9 @@ async function generateEntry(entry) {
171
182
  if (!metadata)
172
183
  return;
173
184
  const { name, unicode } = metadata;
174
- if (!unicode)
185
+ if (!unicode) {
175
186
  return;
187
+ }
176
188
  const code = unicode[0].charCodeAt(0).toString(16);
177
189
  glyphs.push({ name, code });
178
190
  });
@@ -183,25 +195,25 @@ async function generateEntry(entry) {
183
195
  return `url("${urlPath}/${options.name}.${format}${hashSuffix}") format("${ICON_FONT_FORMAT_MAP[format]}")`;
184
196
  })
185
197
  .join(',');
186
- const cssCode = `
198
+ const cssCode = `/* stylelint-disable */
187
199
  @font-face {
188
- font-family: "${options.fontName}";
189
- font-display: block;
190
- font-style: normal;
191
- font-weight: 400;
192
- src: ${src};
200
+ font-family: "${options.fontName}";
201
+ font-display: block;
202
+ font-style: normal;
203
+ font-weight: 400;
204
+ src: ${src};
193
205
  }
194
206
 
195
207
  i[class^="${cssPrefix}"]:before, i[class*=" ${cssPrefix}"]:before {
196
- font-family: ${options.fontName} !important;
197
- font-style: normal;
198
- font-weight: normal !important;
199
- font-variant: normal;
200
- text-transform: none;
201
- text-rendering: auto;
202
- line-height: 1;
203
- -webkit-font-smoothing: antialiased;
204
- -moz-osx-font-smoothing: grayscale;
208
+ font-family: ${options.fontName} !important;
209
+ font-style: normal;
210
+ font-weight: normal !important;
211
+ font-variant: normal;
212
+ text-transform: none;
213
+ text-rendering: auto;
214
+ line-height: 1;
215
+ -webkit-font-smoothing: antialiased;
216
+ -moz-osx-font-smoothing: grayscale;
205
217
  }
206
218
  ${glyphs
207
219
  .map(({ name, code }) => {
@@ -31,6 +31,7 @@ export declare interface IconFontEntry extends IconFontSettings {
31
31
  name: string;
32
32
  fontName: string;
33
33
  formats?: IconFontFormat[];
34
+ startUnicode?: number;
34
35
  prefix: string;
35
36
  src: string;
36
37
  dest: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastkit/icon-font-gen",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "description": "@fastkit/icon-font-gen",
5
5
  "buildOptions": {
6
6
  "name": "IconFont",
@@ -33,10 +33,10 @@
33
33
  },
34
34
  "homepage": "https://github.com/dadajam4/fastkit/tree/main/packages/icon-font-gen#readme",
35
35
  "dependencies": {
36
- "@fastkit/ev": "0.6.15",
37
- "@fastkit/icon-font": "0.6.15",
38
- "@fastkit/node-util": "0.6.15",
39
- "@fastkit/tiny-logger": "0.6.15",
36
+ "@fastkit/ev": "0.6.16",
37
+ "@fastkit/icon-font": "0.6.16",
38
+ "@fastkit/node-util": "0.6.16",
39
+ "@fastkit/tiny-logger": "0.6.16",
40
40
  "cac": "^6.7.11",
41
41
  "chokidar": "^3.5.0",
42
42
  "fs-extra": "^9.1.0",