@vaadin/vaadin-lumo-styles 23.2.0-alpha3 → 23.2.0-alpha4

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/font-icons.js CHANGED
@@ -5,9 +5,9 @@
5
5
  */
6
6
  import './version.js';
7
7
 
8
- const $_documentContainer = document.createElement('template');
8
+ const template = document.createElement('template');
9
9
 
10
- $_documentContainer.innerHTML = `
10
+ template.innerHTML = `
11
11
  <style>
12
12
  @font-face {
13
13
  font-family: 'lumo-icons';
@@ -63,4 +63,4 @@ $_documentContainer.innerHTML = `
63
63
  </style>
64
64
  `;
65
65
 
66
- document.head.appendChild($_documentContainer.content);
66
+ document.head.appendChild(template.content);
package/iconset.js CHANGED
@@ -10,9 +10,9 @@ console.warn(
10
10
  `WARNING: Since Vaadin 23.1, using <iron-icon> is deprecated. Please use <vaadin-icon> and '@vaadin/vaadin-lumo-styles/vaadin-iconset.js' instead.`,
11
11
  );
12
12
 
13
- const $_documentContainer = document.createElement('template');
13
+ const template = document.createElement('template');
14
14
 
15
- $_documentContainer.innerHTML = `<iron-iconset-svg size="1000" name="lumo">
15
+ template.innerHTML = `<iron-iconset-svg size="1000" name="lumo">
16
16
  <svg xmlns="http://www.w3.org/2000/svg">
17
17
  <defs>
18
18
  <g id="align-center"><path d="M167 217c0-18 17-33 38-34H795c21 0 38 15 38 34 0 18-17 33-38 33H205C184 250 167 235 167 217z m83 191c0-18 13-33 29-33H721c16 0 29 15 29 33 0 18-13 33-29 34H279C263 442 250 427 250 408zM250 792c0-18 13-33 29-34H721c16 0 29 15 29 34s-13 33-29 33H279C263 825 250 810 250 792z m-83-192c0-18 17-33 38-33H795c21 0 38 15 38 33s-17 33-38 33H205C184 633 167 618 167 600z" fill-rule="evenodd" clip-rule="evenodd"></path></g>
@@ -61,4 +61,4 @@ $_documentContainer.innerHTML = `<iron-iconset-svg size="1000" name="lumo">
61
61
  </svg>
62
62
  </iron-iconset-svg>`;
63
63
 
64
- document.head.appendChild($_documentContainer.content);
64
+ document.head.appendChild(template.content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/vaadin-lumo-styles",
3
- "version": "23.2.0-alpha3",
3
+ "version": "23.2.0-alpha4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -20,7 +20,7 @@
20
20
  "module": "all-imports.js",
21
21
  "type": "module",
22
22
  "scripts": {
23
- "icons": "gulp icons"
23
+ "icons": "gulp icons --gulpfile gulpfile.cjs"
24
24
  },
25
25
  "files": [
26
26
  "*.d.ts",
@@ -42,8 +42,8 @@
42
42
  "@polymer/iron-icon": "^3.0.0",
43
43
  "@polymer/iron-iconset-svg": "^3.0.0",
44
44
  "@polymer/polymer": "^3.0.0",
45
- "@vaadin/icon": "23.2.0-alpha3",
46
- "@vaadin/vaadin-themable-mixin": "23.2.0-alpha3"
45
+ "@vaadin/icon": "23.2.0-alpha4",
46
+ "@vaadin/vaadin-themable-mixin": "23.2.0-alpha4"
47
47
  },
48
48
  "devDependencies": {
49
49
  "gulp": "^4.0.2",
@@ -52,5 +52,5 @@
52
52
  "gulp-sort": "^2.0.0",
53
53
  "gulp-svgmin": "^4.1.0"
54
54
  },
55
- "gitHead": "06e5875be93ca50da2846dafc65a8531010c0576"
55
+ "gitHead": "cbf5f1d0f38ac9b81c65cf9ef5660182e176e598"
56
56
  }
@@ -5,9 +5,9 @@
5
5
  */
6
6
  import '../sizing.js';
7
7
  import '../spacing.js';
8
- const $_documentContainer = document.createElement('template');
8
+ const template = document.createElement('template');
9
9
 
10
- $_documentContainer.innerHTML = `
10
+ template.innerHTML = `
11
11
  <style>
12
12
  /* Use a stronger selector so that imports added later do not override the property values */
13
13
  html:not(div) {
@@ -37,4 +37,4 @@ $_documentContainer.innerHTML = `
37
37
  </style>
38
38
  `;
39
39
 
40
- document.head.appendChild($_documentContainer.content);
40
+ document.head.appendChild(template.content);
package/vaadin-iconset.js CHANGED
@@ -6,9 +6,9 @@
6
6
  import '@vaadin/icon/vaadin-iconset.js';
7
7
  import './version.js';
8
8
 
9
- const $_documentContainer = document.createElement('template');
9
+ const template = document.createElement('template');
10
10
 
11
- $_documentContainer.innerHTML = `<vaadin-iconset name="lumo" size="1000">
11
+ template.innerHTML = `<vaadin-iconset name="lumo" size="1000">
12
12
  <svg xmlns="http://www.w3.org/2000/svg">
13
13
  <defs>
14
14
  <g id="lumo:align-center"><path d="M167 217c0-18 17-33 38-34H795c21 0 38 15 38 34 0 18-17 33-38 33H205C184 250 167 235 167 217z m83 191c0-18 13-33 29-33H721c16 0 29 15 29 33 0 18-13 33-29 34H279C263 442 250 427 250 408zM250 792c0-18 13-33 29-34H721c16 0 29 15 29 34s-13 33-29 33H279C263 825 250 810 250 792z m-83-192c0-18 17-33 38-33H795c21 0 38 15 38 33s-17 33-38 33H205C184 633 167 618 167 600z" fill-rule="evenodd" clip-rule="evenodd"></path></g>
@@ -57,4 +57,4 @@ $_documentContainer.innerHTML = `<vaadin-iconset name="lumo" size="1000">
57
57
  </svg>
58
58
  </vaadin-iconset>`;
59
59
 
60
- document.head.appendChild($_documentContainer.content);
60
+ document.head.appendChild(template.content);
package/version.js CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  class Lumo extends HTMLElement {
7
7
  static get version() {
8
- return '23.2.0-alpha3';
8
+ return '23.2.0-alpha4';
9
9
  }
10
10
  }
11
11
 
package/gulpfile.js DELETED
@@ -1,216 +0,0 @@
1
- /* eslint-env node */
2
- 'use strict';
3
-
4
- const gulp = require('gulp');
5
- const sort = require('gulp-sort');
6
- const iconfont = require('gulp-iconfont');
7
- const fs = require('fs');
8
- const svgpath = require('svgpath');
9
- const svgmin = require('gulp-svgmin');
10
-
11
- /**
12
- * Normalize file sort order across platforms (OS X vs Linux, maybe others).
13
- *
14
- * Before: `[..., 'eye-disabled', 'eye', ...]`
15
- * After: `[..., 'eye', 'eye-disabled', ...]`
16
- *
17
- * Order of appearance impacts assigned Unicode codepoints, and sometimes build diffs.
18
- *
19
- * @see https://github.com/nfroidure/svgicons2svgfont/pull/82
20
- * @see https://github.com/nfroidure/svgicons2svgfont/blob/master/src/filesorter.js
21
- * @see http://support.ecisolutions.com/doc-ddms/help/reportsmenu/ascii_sort_order_chart.htm
22
- */
23
- function sortIconFilesNormalized(file1, file2) {
24
- return file1.replace(/-/g, '~').localeCompare(file2.replace(/-/g, '~'), 'en-US');
25
- }
26
-
27
- function createCopyright() {
28
- return `/**
29
- * @license
30
- * Copyright (c) 2017 - 2022 Vaadin Ltd.
31
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
32
- */`;
33
- }
34
-
35
- function createIconset(folder, filenames, idPrefix = '') {
36
- let output = `<svg xmlns="http://www.w3.org/2000/svg">\n<defs>\n`;
37
- filenames.forEach((filename) => {
38
- // Skip non-svg files
39
- if (filename.indexOf('.svg') === -1) {
40
- return;
41
- }
42
-
43
- const content = fs.readFileSync(folder + filename, 'utf-8');
44
- const path = content.match(/<path( fill-rule="evenodd" clip-rule="evenodd")* d="([^"]*)"/);
45
- if (path) {
46
- const newPath = new svgpath(path[2])
47
- .scale(1000 / 24, 1000 / 24)
48
- .round(0)
49
- .toString();
50
- const name = filename.replace('.svg', '').replace(/\s/g, '-').toLowerCase();
51
- const attrs = path[1] !== undefined ? path[1] : '';
52
- output += `<g id="${idPrefix}${name}"><path d="${newPath}"${attrs}></path></g>\n`;
53
- } else {
54
- throw new Error(`Unexpected SVG content: ${filename}`);
55
- }
56
- });
57
-
58
- output += `</defs>\n</svg>`;
59
- return output;
60
- }
61
-
62
- gulp.task('icons', async () => {
63
- const folder = 'icons/svg/';
64
- let glyphs;
65
-
66
- // Optimize the source files
67
- gulp
68
- .src(`${folder}*.svg`)
69
- .pipe(
70
- svgmin({
71
- plugins: [
72
- {
73
- removeTitle: true,
74
- },
75
- {
76
- removeViewBox: false,
77
- },
78
- {
79
- cleanupNumericValues: {
80
- floatPrecision: 6,
81
- },
82
- },
83
- {
84
- convertPathData: {
85
- floatPrecision: 6,
86
- },
87
- },
88
- ],
89
- }),
90
- )
91
- .pipe(gulp.dest(folder))
92
- .on('finish', () => {
93
- // Iron-iconset-svg
94
- fs.readdir(folder, (err, filenames) => {
95
- if (err) {
96
- console.error(err);
97
- return;
98
- }
99
-
100
- filenames.sort(sortIconFilesNormalized);
101
-
102
- const ironIcons = `${createCopyright()}
103
- import '@polymer/iron-iconset-svg/iron-iconset-svg.js';
104
- import './version.js';
105
-
106
- const $_documentContainer = document.createElement('template');
107
-
108
- $_documentContainer.innerHTML = \`<iron-iconset-svg size="1000" name="lumo">
109
- ${createIconset(folder, filenames)}
110
- </iron-iconset-svg>\`;\n\ndocument.head.appendChild($_documentContainer.content);\n`;
111
-
112
- fs.writeFile('iconset.js', ironIcons, (err) => {
113
- if (err) {
114
- return console.error(err);
115
- }
116
- });
117
-
118
- const vaadinIcons = `${createCopyright()}
119
- import '@vaadin/icon/vaadin-iconset.js';
120
- import './version.js';
121
-
122
- const $_documentContainer = document.createElement('template');
123
-
124
- $_documentContainer.innerHTML = \`<vaadin-iconset name="lumo" size="1000">
125
- ${createIconset(folder, filenames, 'lumo:')}
126
- </vaadin-iconset>\`;\n\ndocument.head.appendChild($_documentContainer.content);\n`;
127
-
128
- fs.writeFile('vaadin-iconset.js', vaadinIcons, (err) => {
129
- if (err) {
130
- return console.error(err);
131
- }
132
- });
133
- });
134
-
135
- // Icon font
136
- gulp
137
- .src(`${folder}*.svg`)
138
- .pipe(
139
- sort({
140
- comparator(file1, file2) {
141
- return sortIconFilesNormalized(file1.relative, file2.relative);
142
- },
143
- }),
144
- )
145
- .pipe(
146
- iconfont({
147
- fontName: 'lumo-icons',
148
- formats: ['woff'],
149
- fontHeight: 1000,
150
- ascent: 850,
151
- descent: 150,
152
- fixedWidth: true,
153
- normalize: true,
154
- timestamp: 1, // Truthy!
155
- }),
156
- )
157
- .on('glyphs', (glyphData) => {
158
- // Store for later use
159
- glyphs = glyphData;
160
- })
161
- .pipe(gulp.dest('.'))
162
- .on('finish', () => {
163
- // Generate base64 version of the font
164
- const lumoIconsWoff = fs.readFileSync('lumo-icons.woff');
165
-
166
- // Write the output to font-icons.js
167
- let output = createCopyright();
168
- output += `
169
- import './version.js';
170
-
171
- const $_documentContainer = document.createElement('template');
172
-
173
- $_documentContainer.innerHTML = \`
174
- <style>
175
- @font-face {
176
- font-family: 'lumo-icons';
177
- src: url(data:application/font-woff;charset=utf-8;base64,${lumoIconsWoff.toString('base64')}) format('woff');
178
- font-weight: normal;
179
- font-style: normal;
180
- }
181
-
182
- html {
183
- `;
184
- glyphs.forEach((g) => {
185
- const name = g.name.replace(/\s/g, '-').toLowerCase();
186
- const unicode = `\\\\${g.unicode[0].charCodeAt(0).toString(16)}`;
187
- output += ` --lumo-icons-${name}: "${unicode}";\n`;
188
- });
189
- output += ` }
190
- </style>
191
- \`;
192
-
193
- document.head.appendChild($_documentContainer.content);
194
- `;
195
- fs.writeFile('font-icons.js', output, (err) => {
196
- if (err) {
197
- return console.error(err);
198
- }
199
- });
200
-
201
- const list = glyphs.map((g) => g.name);
202
- fs.writeFile('test/glyphs.json', JSON.stringify(list, null, 2), (err) => {
203
- if (err) {
204
- return console.error(err);
205
- }
206
- });
207
-
208
- // Cleanup
209
- fs.unlink('lumo-icons.woff', (err) => {
210
- if (err) {
211
- return console.error(err);
212
- }
213
- });
214
- });
215
- });
216
- });