zmp-cli 3.2.0-0 → 3.2.3

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.
@@ -19,9 +19,19 @@ module.exports = (options) => {
19
19
  /* Custom color theme properties */
20
20
  :root {
21
21
  ${Object.keys(customProps)
22
+ .filter(
23
+ (prop) =>
24
+ prop !== '--zmp-tabbar-fill-link-active-color' &&
25
+ prop !== '--zmp-tabbar-fill-link-active-border-color'
26
+ )
22
27
  .map((prop) => `${prop}: ${customProps[prop]};`)
23
28
  .join('\n ')}
24
29
  }
30
+ :root.theme-dark,:root .theme-dark {
31
+ ${Object.keys(customProps)
32
+ .map((prop) => `${prop}: ${customProps[prop]};`)
33
+ .join('\n ')}
34
+ }
25
35
  `
26
36
  );
27
37
  }
@@ -30,51 +40,6 @@ module.exports = (options) => {
30
40
  0,
31
41
  `
32
42
  /* Invert navigation bars to fill style */
33
- :root,
34
- :root.theme-dark,
35
- :root .theme-dark {
36
- --zmp-bars-bg-color: var(--zmp-theme-color);
37
- --zmp-bars-bg-color-rgb: var(--zmp-theme-color-rgb);
38
- --zmp-bars-translucent-opacity: 0.9;
39
- --zmp-bars-text-color: #fff;
40
- --zmp-bars-link-color: #fff;
41
- --zmp-navbar-subtitle-text-color: rgba(255,255,255,0.85);
42
- --zmp-bars-border-color: transparent;
43
- --zmp-tabbar-link-active-color: #fff;
44
- --zmp-tabbar-link-inactive-color: rgba(255,255,255,0.54);
45
- --zmp-sheet-border-color: transparent;
46
- --zmp-tabbar-link-active-border-color: #fff;
47
- }
48
- .appbar,
49
- .navbar,
50
- .toolbar,
51
- .subnavbar,
52
- .calendar-header,
53
- .calendar-footer {
54
- --zmp-touch-ripple-color: var(--zmp-touch-ripple-white);
55
- --zmp-link-highlight-color: var(--zmp-link-highlight-white);
56
- --zmp-link-touch-ripple-color: var(--zmp-touch-ripple-white);
57
- --zmp-button-text-color: #fff;
58
- --zmp-button-pressed-bg-color: rgba(255,255,255,0.1);
59
- }
60
- .navbar-large-transparent,
61
- .navbar-large.navbar-transparent {
62
- --zmp-navbar-large-title-text-color: #000;
63
-
64
- --r: ${themeRgb[0]};
65
- --g: ${themeRgb[1]};
66
- --b: ${themeRgb[2]};
67
- --progress: var(--zmp-navbar-large-collapse-progress);
68
- --zmp-bars-link-color: rgb(
69
- calc(var(--r) + (255 - var(--r)) * var(--progress)),
70
- calc(var(--g) + (255 - var(--g)) * var(--progress)),
71
- calc(var(--b) + (255 - var(--b)) * var(--progress))
72
- );
73
- }
74
- .theme-dark .navbar-large-transparent,
75
- .theme-dark .navbar-large.navbar-transparent {
76
- --zmp-navbar-large-title-text-color: #fff;
77
- }
78
43
  `
79
44
  );
80
45
  }
@@ -1,7 +1,8 @@
1
1
  const indent = require('../../utils/indent');
2
2
 
3
3
  module.exports = (options) => {
4
- const { name, template } = options;
4
+ const { name, template, theming } = options;
5
+ const { fillBars } = theming;
5
6
 
6
7
  let description = '';
7
8
  if (template === 'single-view' || template === 'blank') {
@@ -60,7 +61,7 @@ module.exports = (options) => {
60
61
  return (
61
62
  <Page name="home" navbarLarge>
62
63
  {/* Top Navbar */}
63
- <Navbar transparent>
64
+ <Navbar ${fillBars ? 'fill' : ''}>
64
65
  <NavTitleLarge>${name}</NavTitleLarge>
65
66
  </Navbar>
66
67
  {/* Page content */}
@@ -1,15 +1,18 @@
1
1
  function colorHexToRgb(hex) {
2
- const h = hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (m, r, g, b) => r + r + g + g + b + b);
2
+ const h = hex.replace(
3
+ /^#?([a-f\d])([a-f\d])([a-f\d])$/i,
4
+ (m, r, g, b) => r + r + g + g + b + b
5
+ );
3
6
  const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(h);
4
- return result
5
- ? result.slice(1).map((n) => parseInt(n, 16))
6
- : null;
7
+ return result ? result.slice(1).map((n) => parseInt(n, 16)) : null;
7
8
  }
8
9
  function colorRgbToHex(r, g, b) {
9
- const result = [r, g, b].map((n) => {
10
- const hex = n.toString(16);
11
- return hex.length === 1 ? `0${hex}` : hex;
12
- }).join('');
10
+ const result = [r, g, b]
11
+ .map((n) => {
12
+ const hex = n.toString(16);
13
+ return hex.length === 1 ? `0${hex}` : hex;
14
+ })
15
+ .join('');
13
16
  return `#${result}`;
14
17
  }
15
18
  function colorRgbToHsl(r, g, b) {
@@ -41,7 +44,7 @@ function colorHslToRgb(h, s, l) {
41
44
  else if (hp <= 4) rgb1 = [0, x, c];
42
45
  else if (hp <= 5) rgb1 = [x, 0, c];
43
46
  else if (hp <= 6) rgb1 = [c, 0, x];
44
- const m = l - (c / 2);
47
+ const m = l - c / 2;
45
48
  return rgb1.map((n) => Math.max(0, Math.min(255, Math.round(255 * (n + m)))));
46
49
  }
47
50
  function colorThemeCSSProperties(...args) {
@@ -56,15 +59,29 @@ function colorThemeCSSProperties(...args) {
56
59
  }
57
60
  if (!rgb) return {};
58
61
  const hsl = colorRgbToHsl(...rgb);
59
- const hslShade = [hsl[0], hsl[1], Math.max(0, (hsl[2] - 0.08))];
60
- const hslTint = [hsl[0], hsl[1], Math.max(0, (hsl[2] + 0.08))];
62
+ const hslShade = [hsl[0], hsl[1], Math.max(0, hsl[2] - 0.08)];
63
+ const hslTint = [hsl[0], hsl[1], Math.max(0, hsl[2] + 0.08)];
61
64
  const shade = colorRgbToHex(...colorHslToRgb(...hslShade));
62
65
  const tint = colorRgbToHex(...colorHslToRgb(...hslTint));
66
+ const hslSecondaryColor = [hsl[0], hsl[1], Math.max(0, hsl[2] + 0.6)];
67
+ const secondaryColor = colorRgbToHex(...colorHslToRgb(...hslSecondaryColor));
63
68
  return {
64
69
  '--zmp-theme-color': hex,
65
70
  '--zmp-theme-color-rgb': rgb.join(', '),
66
71
  '--zmp-theme-color-shade': shade,
67
72
  '--zmp-theme-color-tint': tint,
73
+ '--zmp-checkbox-active-color-disabled': 'var(--zmp-theme-color-shade)',
74
+ '--zmp-radio-active-color-disabled': 'var(--zmp-theme-color-shade)',
75
+ '--zmp-toggle-active-color-disabled': 'var(--zmp-theme-color-shade)',
76
+ '--zmp-picker-action-button-hover-bg-color': 'var(--zmp-theme-color-shade)',
77
+ '--zmp-button-pressed-bg-color-primary': 'var(--zmp-theme-color-shade)',
78
+ ' --zmp-button-bg-color-secondary': secondaryColor,
79
+ '--zmp-button-pressed-bg-color-secondary': secondaryColor,
80
+ '--zmp-button-pressed-color-secondary': 'var(--zmp-theme-color)',
81
+ '--zmp-button-border-color-secondary': 'var(--zmp-theme-color)',
82
+ '--zmp-tabbar-fill-link-active-color': 'var(--zmp-theme-color)',
83
+ '--zmp-tabbar-fill-link-active-border-color': 'var(--zmp-theme-color)',
84
+ '--zmp-fab-pressed-bg-color': 'var(--zmp-theme-color-shade)',
68
85
  };
69
86
  }
70
87
 
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ var templateIf = require('./template-if');
4
+
5
+ module.exports = function (options) {
6
+ return "\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Dependency directories\nnode_modules/\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional REPL history\n.node_repl_history\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n\n# Misc\n.DS_Store\nThumbs.db\n\n# Production build\nwww/\n";
7
+ };
@@ -1,8 +1,6 @@
1
1
  const templateIf = require('./template-if');
2
2
 
3
3
  module.exports = (options) => {
4
- const { bundler } = options;
5
-
6
4
  return `
7
5
  # Logs
8
6
  logs
@@ -39,12 +37,7 @@ node_modules/
39
37
  .DS_Store
40
38
  Thumbs.db
41
39
 
42
- ${templateIf(
43
- bundler,
44
- () => `
45
40
  # Production build
46
41
  www/
47
- `
48
- )}
49
42
  `;
50
43
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmp-cli",
3
- "version": "3.2.0-0",
3
+ "version": "3.2.3",
4
4
  "description": "ZMP command line utility (CLI)",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -28,6 +28,9 @@ var qrcode = require('qrcode-terminal');
28
28
 
29
29
  var logSymbols = require('log-symbols');
30
30
 
31
+ var _require2 = require('path'),
32
+ resolve = _require2.resolve;
33
+
31
34
  var spinner = ora('Starting mini app...');
32
35
 
33
36
  module.exports = function _callee() {
@@ -49,6 +52,7 @@ module.exports = function _callee() {
49
52
  publicServer,
50
53
  server,
51
54
  app,
55
+ serverFrame,
52
56
  _args = arguments;
53
57
 
54
58
  return regeneratorRuntime.async(function _callee$(_context) {
@@ -117,7 +121,8 @@ module.exports = function _callee() {
117
121
  'process.env.NODE_ENV': JSON.stringify(previewOnZalo ? 'production' : 'development')
118
122
  },
119
123
  server: _objectSpread({
120
- port: port
124
+ port: port,
125
+ strictPort: true
121
126
  }, previewOnZalo ? publicServer : localServer)
122
127
  }));
123
128
 
@@ -128,8 +133,29 @@ module.exports = function _callee() {
128
133
 
129
134
  case 21:
130
135
  app = _context.sent;
131
- spinner.stop();
136
+
137
+ if (previewOnZalo) {
138
+ _context.next = 27;
139
+ break;
140
+ }
141
+
132
142
  _context.next = 25;
143
+ return regeneratorRuntime.awrap(createServer({
144
+ // any valid user config options, plus `mode` and `configFile`
145
+ configFile: false,
146
+ root: __dirname + '/frame',
147
+ server: {
148
+ port: port + 1
149
+ }
150
+ }));
151
+
152
+ case 25:
153
+ serverFrame = _context.sent;
154
+ serverFrame.listen();
155
+
156
+ case 27:
157
+ spinner.stop();
158
+ _context.next = 30;
133
159
  return regeneratorRuntime.awrap(new Promise(function () {
134
160
  var previewOnZaloURL = "https://zalo.me/app/link/zapps/".concat(appId, "/?env=TESTING_LOCAL&clientIp=https://").concat(host, ":").concat(app.config.server.port);
135
161
 
@@ -147,11 +173,11 @@ module.exports = function _callee() {
147
173
  }
148
174
  }));
149
175
 
150
- case 25:
176
+ case 30:
151
177
  return _context.abrupt("return", _context.sent);
152
178
 
153
- case 28:
154
- _context.prev = 28;
179
+ case 33:
180
+ _context.prev = 33;
155
181
  _context.t0 = _context["catch"](12);
156
182
  logger.statusError('Error starting project'); // if (err) logger.error(err.stderr || err);
157
183
 
@@ -159,10 +185,10 @@ module.exports = function _callee() {
159
185
  errorExit(_context.t0);
160
186
  return _context.abrupt("return");
161
187
 
162
- case 34:
188
+ case 39:
163
189
  case "end":
164
190
  return _context.stop();
165
191
  }
166
192
  }
167
- }, null, null, [[12, 28]]);
193
+ }, null, null, [[12, 33]]);
168
194
  };
@@ -22,6 +22,7 @@
22
22
  .then(data => {
23
23
  if (data.app.title) {
24
24
  document.getElementById('title').innerHTML = data.app.title;
25
+ document.title = data.app.title;
25
26
  }
26
27
  if (data.app.headerColor) {
27
28
  document.getElementById('header').style.backgroundColor = data.app.headerColor;
@@ -36,7 +37,7 @@
36
37
  });
37
38
  </script>
38
39
 
39
- <title>Water Reminder</title>
40
+ <title>Water Reminder1</title>
40
41
  <style>
41
42
  body {
42
43
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;