handoff-app 0.7.2 → 0.7.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.
Files changed (49) hide show
  1. package/Changelog.md +14 -2
  2. package/dist/cli/eject.d.ts +5 -0
  3. package/dist/cli/eject.js +35 -1
  4. package/dist/cli.js +21 -19
  5. package/dist/exporters/utils.d.ts +4 -4
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +15 -0
  8. package/dist/utils/convertColor.d.ts +1 -0
  9. package/package.json +1 -1
  10. package/src/app/next.config.js +14 -4
  11. package/src/app/sass/main.scss +0 -2
  12. package/src/cli/eject.ts +29 -0
  13. package/src/cli.ts +3 -0
  14. package/src/index.ts +8 -2
  15. package/src/app/sass/custom.scss +0 -4
  16. package/templates/alert/default.html +0 -7
  17. package/templates/alert/horizontal.html +0 -12
  18. package/templates/alert/vertical.html +0 -12
  19. package/templates/button/default.html +0 -5
  20. package/templates/button/large.html +0 -5
  21. package/templates/button/medium.html +0 -5
  22. package/templates/button/primary/disabled.html +0 -5
  23. package/templates/button/small.html +0 -5
  24. package/templates/checkbox/default/off.html +0 -10
  25. package/templates/checkbox/default/on.html +0 -10
  26. package/templates/checkbox/default.html +0 -22
  27. package/templates/checkbox/disabled.html +0 -16
  28. package/templates/input/complete.html +0 -14
  29. package/templates/input/default.html +0 -14
  30. package/templates/input/disabled.html +0 -14
  31. package/templates/input/error.html +0 -14
  32. package/templates/main.js +0 -16
  33. package/templates/main.scss +0 -32
  34. package/templates/modal/default.html +0 -20
  35. package/templates/pagination/default.html +0 -31
  36. package/templates/pagination/lg.html +0 -31
  37. package/templates/pagination/sm.html +0 -31
  38. package/templates/radio/default/off.html +0 -10
  39. package/templates/radio/default/on.html +0 -10
  40. package/templates/radio/default.html +0 -10
  41. package/templates/radio/disabled.html +0 -16
  42. package/templates/select/default.html +0 -10
  43. package/templates/select/disabled.html +0 -10
  44. package/templates/select/error.html +0 -10
  45. package/templates/switch/default/off.html +0 -10
  46. package/templates/switch/default/on.html +0 -10
  47. package/templates/switch/default.html +0 -8
  48. package/templates/switch/disabled.html +0 -16
  49. package/templates/tooltip/default.html +0 -16
package/Changelog.md CHANGED
@@ -6,6 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to
7
7
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [0.7.3] - 2023-07-28
10
+
11
+ This release allows custom theme files in the working directory to override the main theme
12
+
13
+ ### Changes
14
+
15
+ - Added `eject:theme` which will eject the currently set theme into `theme/main.scss`
16
+ - A new config `theme` has been added to allow toggling between themes. At present only a single default theme is provided
17
+ - Improvements to cli help text
18
+
19
+ ### Cleanup
20
+
21
+ - Removes unneeded template files from the root dir
22
+
9
23
  ## [0.7.2] - 2023-07-28
10
24
 
11
25
  This release improves existing functionalities and issue detected within the design system app.
@@ -13,10 +27,8 @@ This release improves existing functionalities and issue detected within the des
13
27
  ### Changes
14
28
 
15
29
  - Component style maps placed in `integration/scss` are now read in at build time allowing developers to provide custom scss mappings for components.
16
- - A new config `theme` has been added to allow toggling between themes. At present only a single default theme is provided
17
30
  - If a folder `theme/main.scss` is found in the working root of the project, that file will be included at build time to allow styling the app.
18
31
  - Globbing is now supported in scss integrations allowing more flexible ingest of component variables
19
- - Added `eject:theme` which will eject the currently set theme into `theme/main.scss`
20
32
  - Added `make:page` command to CLI for creating custom pages or editing existing pages
21
33
  - Adds a flattening algorithm when color blending on properties that do not support blending like `color` and `border-color`
22
34
  - Purge the app build cache when restarting the app to prevent cache from holding old copies of customized files.
@@ -19,4 +19,9 @@ export declare const ejectExportables: (handoff: Handoff) => Promise<Handoff>;
19
19
  * @param handoff
20
20
  */
21
21
  export declare const ejectPages: (handoff: Handoff) => Promise<Handoff>;
22
+ /**
23
+ * Eject the integration to the working directory
24
+ * @param handoff
25
+ */
26
+ export declare const ejectTheme: (handoff: Handoff) => Promise<Handoff>;
22
27
  export default ejectConfig;
package/dist/cli/eject.js CHANGED
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.ejectPages = exports.ejectExportables = exports.ejectIntegration = exports.ejectConfig = void 0;
42
+ exports.ejectTheme = exports.ejectPages = exports.ejectExportables = exports.ejectIntegration = exports.ejectConfig = void 0;
43
43
  var path_1 = __importDefault(require("path"));
44
44
  var fs_extra_1 = __importDefault(require("fs-extra"));
45
45
  var chalk_1 = __importDefault(require("chalk"));
@@ -148,4 +148,38 @@ var ejectPages = function (handoff) { return __awaiter(void 0, void 0, void 0, f
148
148
  });
149
149
  }); };
150
150
  exports.ejectPages = ejectPages;
151
+ /**
152
+ * Eject the integration to the working directory
153
+ * @param handoff
154
+ */
155
+ var ejectTheme = function (handoff) { return __awaiter(void 0, void 0, void 0, function () {
156
+ var config, workingPath, currentTheme, docsPath;
157
+ var _a;
158
+ return __generator(this, function (_b) {
159
+ switch (_b.label) {
160
+ case 0: return [4 /*yield*/, handoff.config];
161
+ case 1:
162
+ config = _b.sent();
163
+ workingPath = path_1.default.resolve(path_1.default.join(handoff.workingPath, 'theme', 'main.scss'));
164
+ if (fs_extra_1.default.existsSync(workingPath)) {
165
+ if (!handoff.force) {
166
+ console.log(chalk_1.default.yellow("It appears you already have custom theme. Use the --force flag to replace you haven't customized."));
167
+ return [2 /*return*/];
168
+ }
169
+ }
170
+ currentTheme = (_a = handoff.config.theme) !== null && _a !== void 0 ? _a : 'default';
171
+ docsPath = path_1.default.resolve(path_1.default.join(handoff.modulePath, "src/app/sass/themes/_".concat(currentTheme, ".scss")));
172
+ if (fs_extra_1.default.existsSync(docsPath)) {
173
+ fs_extra_1.default.copySync(docsPath, workingPath, { overwrite: false });
174
+ console.log(chalk_1.default.green("Customizable theme ejected to ".concat(workingPath)));
175
+ }
176
+ else {
177
+ fs_extra_1.default.copySync(path_1.default.resolve(path_1.default.join(handoff.modulePath, "src/app/sass/themes/_default.scss")), workingPath, { overwrite: false });
178
+ console.log(chalk_1.default.green("Customizable theme ejected to ".concat(workingPath)));
179
+ }
180
+ return [2 /*return*/, handoff];
181
+ }
182
+ });
183
+ }); };
184
+ exports.ejectTheme = ejectTheme;
151
185
  exports.default = exports.ejectConfig;
package/dist/cli.js CHANGED
@@ -69,7 +69,7 @@ var HandoffCliError = /** @class */ (function (_super) {
69
69
  }
70
70
  return HandoffCliError;
71
71
  }(Error));
72
- var usage = "Usage: handoff-app <cmd> <opts>\n\nCommands:\n fetch [opts] - Fetches the design tokens from the design system\n\n build - Using the current tokens, build various outputs\n build:app [opts] - Builds the design system static application\n build:integration [opts] - Builds current selected integration, styles and previews\n\n start [opts] - Starts the design system in development mode\n\n make\n make:exportable <type> <name> [opts] - Creates a new schema\n make:template <component> <state> [opts] - Creates a new template\n make:page <name> <parent> [opts] - Creates a new custom page\n\n eject - Ejects the default entire configuration to the current directory\n eject:config [opts] - Ejects the default configuration to the current directory\n eject:integration [opts] - Ejects the default integration to the current directory\n eject:exportables [opts] - Ejects the default exportables to the current directory\n eject:pages [opts] - Ejects the default pages to the current directory\n\nOptions:\n -c, --config [file] Define the path to the config file\n -d, --debug Show debug logs\n -h, --help Show this help message\n -v, --version Show the version number\n";
72
+ var usage = "Usage: handoff-app <cmd> <opts>\n\nCommands:\n fetch [opts] - Fetches the design tokens from the design system\n\n build - Using the current tokens, build various outputs\n build:app [opts] - Builds the design system static application\n build:integration [opts] - Builds current selected integration, styles and previews\n\n start [opts] - Starts the design system in development mode\n\n make\n make:exportable <type> <name> [opts] - Creates a new schema\n make:template <component> <state> [opts] - Creates a new template\n make:page <name> <parent> [opts] - Creates a new custom page\n\n eject - Ejects the default entire configuration to the current directory\n eject:config [opts] - Ejects the default configuration to the current directory\n eject:integration [opts] - Ejects the default integration to the current directory\n eject:exportables [opts] - Ejects the default exportables to the current directory\n eject:pages [opts] - Ejects the default pages to the current directory\n eject:theme [opts] - Ejects the currently selected theme to theme/main.scss\n\nOptions:\n -c, --config [file] Define the path to the config file\n -d, --debug Show debug logs\n -h, --help Show this help message\n -v, --version Show the version number\n";
73
73
  /**
74
74
  * Show the help message
75
75
  */
@@ -100,7 +100,7 @@ var run = function (argv, stdout, stderr) { return __awaiter(void 0, void 0, voi
100
100
  return __generator(this, function (_b) {
101
101
  switch (_b.label) {
102
102
  case 0:
103
- _b.trys.push([0, 18, , 19]);
103
+ _b.trys.push([0, 19, , 20]);
104
104
  args = (0, arg_1.default)({
105
105
  '--help': Boolean,
106
106
  '-h': '--help',
@@ -140,13 +140,14 @@ var run = function (argv, stdout, stderr) { return __awaiter(void 0, void 0, voi
140
140
  case 'eject:config': return [3 /*break*/, 8];
141
141
  case 'eject:integration': return [3 /*break*/, 9];
142
142
  case 'eject:exportables': return [3 /*break*/, 10];
143
- case 'eject:pages': return [3 /*break*/, 11];
144
- case 'make': return [3 /*break*/, 12];
145
- case 'make:exportable': return [3 /*break*/, 13];
146
- case 'make:template': return [3 /*break*/, 14];
147
- case 'make:page': return [3 /*break*/, 15];
143
+ case 'eject:theme': return [3 /*break*/, 11];
144
+ case 'eject:pages': return [3 /*break*/, 12];
145
+ case 'make': return [3 /*break*/, 13];
146
+ case 'make:exportable': return [3 /*break*/, 14];
147
+ case 'make:template': return [3 /*break*/, 15];
148
+ case 'make:page': return [3 /*break*/, 16];
148
149
  }
149
- return [3 /*break*/, 16];
150
+ return [3 /*break*/, 17];
150
151
  case 1: return [2 /*return*/, handoff_1.fetch()];
151
152
  case 2: return [4 /*yield*/, handoff_1.build()];
152
153
  case 3:
@@ -161,15 +162,16 @@ var run = function (argv, stdout, stderr) { return __awaiter(void 0, void 0, voi
161
162
  case 6: return [2 /*return*/, handoff_1.integration()];
162
163
  case 7:
163
164
  cliError("Eject commands will eject the default configuration into the working directory so you can customize it.\n\nEject must have a subcommand. Did you mean:\n - eject:config\n - eject:exportables\n - eject:integration\n - eject:docs\n - eject:theme.", 2);
164
- return [3 /*break*/, 17];
165
+ return [3 /*break*/, 18];
165
166
  case 8: return [2 /*return*/, handoff_1.ejectConfig()];
166
167
  case 9: return [2 /*return*/, handoff_1.ejectIntegration()];
167
168
  case 10: return [2 /*return*/, handoff_1.ejectExportables()];
168
- case 11: return [2 /*return*/, handoff_1.ejectPages()];
169
- case 12:
170
- cliError("Make commands create configuration files in your working root and scaffold up the appropriate folder structure if needed.\n \n Make must have a subcommand. Did you mean:\n - make:template\n - make:exportable\n - make:page", 2);
171
- return [3 /*break*/, 17];
169
+ case 11: return [2 /*return*/, handoff_1.ejectTheme()];
170
+ case 12: return [2 /*return*/, handoff_1.ejectPages()];
172
171
  case 13:
172
+ cliError("Make commands create configuration files in your working root and scaffold up the appropriate folder structure if needed.\n \n Make must have a subcommand. Did you mean:\n - make:template\n - make:exportable\n - make:page", 2);
173
+ return [3 /*break*/, 18];
174
+ case 14:
173
175
  type = args._[1];
174
176
  if (!type) {
175
177
  cliError("You must specify a type of 'component' or 'foundation'", 2);
@@ -182,7 +184,7 @@ var run = function (argv, stdout, stderr) { return __awaiter(void 0, void 0, voi
182
184
  cliError("Exportable name must be alphanumeric and may contain dashes or underscores", 2);
183
185
  }
184
186
  return [2 /*return*/, handoff_1.makeExportable(type, name_1)];
185
- case 14:
187
+ case 15:
186
188
  templateComponent = args._[1];
187
189
  if (!templateComponent) {
188
190
  cliError("You must supply a component name", 2);
@@ -195,7 +197,7 @@ var run = function (argv, stdout, stderr) { return __awaiter(void 0, void 0, voi
195
197
  cliError("Template state must be alphanumeric and may contain dashes or underscores", 2);
196
198
  }
197
199
  return [2 /*return*/, handoff_1.makeTemplate(templateComponent, templateState)];
198
- case 15:
200
+ case 16:
199
201
  pageName = args._[1];
200
202
  if (!pageName) {
201
203
  cliError("You must supply a page name", 2);
@@ -208,14 +210,14 @@ var run = function (argv, stdout, stderr) { return __awaiter(void 0, void 0, voi
208
210
  cliError("Page parent must be alphanumeric and may contain dashes or underscores", 2);
209
211
  }
210
212
  return [2 /*return*/, handoff_1.makePage(pageName, pageParent)];
211
- case 16: return [2 /*return*/, showHelp()];
212
- case 17: return [3 /*break*/, 19];
213
- case 18:
213
+ case 17: return [2 /*return*/, showHelp()];
214
+ case 18: return [3 /*break*/, 20];
215
+ case 19:
214
216
  e_1 = _b.sent();
215
217
  if (e_1.message.indexOf('Unknown or unexpected option') === -1)
216
218
  throw e_1;
217
219
  return [2 /*return*/, cliError(e_1.message + "\n".concat(usage), 2)];
218
- case 19: return [2 /*return*/];
220
+ case 20: return [2 /*return*/];
219
221
  }
220
222
  });
221
223
  }); };
@@ -1,9 +1,7 @@
1
1
  /// <reference types="plugin-typings" />
2
2
  import * as FigmaTypes from '../figma/types';
3
3
  import { Exportable, VariantProperty } from '../types';
4
- export declare function filterByNodeType<Type extends FigmaTypes.Node['type']>(type: Type): (obj?: FigmaTypes.Node | null) => obj is Extract<FigmaTypes.Component, {
5
- type: Type;
6
- }> | Extract<FigmaTypes.Document, {
4
+ export declare function filterByNodeType<Type extends FigmaTypes.Node['type']>(type: Type): (obj?: FigmaTypes.Node | null) => obj is Extract<FigmaTypes.Document, {
7
5
  type: Type;
8
6
  }> | Extract<FigmaTypes.Canvas, {
9
7
  type: Type;
@@ -29,6 +27,8 @@ export declare function filterByNodeType<Type extends FigmaTypes.Node['type']>(t
29
27
  type: Type;
30
28
  }> | Extract<FigmaTypes.Slice, {
31
29
  type: Type;
30
+ }> | Extract<FigmaTypes.Component, {
31
+ type: Type;
32
32
  }> | Extract<FigmaTypes.ComponentSet, {
33
33
  type: Type;
34
34
  }> | Extract<FigmaTypes.Instance, {
@@ -46,7 +46,7 @@ export declare function findChildNodeWithTypeAndName<Type extends FigmaTypes.Nod
46
46
  export declare function getComponentNamePart(componentName: string, partKey: string): string;
47
47
  export declare const isValidVariantProperty: (variantProperty: string) => variantProperty is VariantProperty;
48
48
  export declare const isExportable: (exportable: string) => exportable is Exportable;
49
- export declare const isValidNodeType: (type: string) => type is "INSTANCE" | "COMPONENT" | "DOCUMENT" | "CANVAS" | "FRAME" | "GROUP" | "VECTOR" | "BOOLEAN_OPERATION" | "STAR" | "LINE" | "ELLIPSE" | "REGULAR_POLYGON" | "RECTANGLE" | "TEXT" | "SLICE" | "COMPONENT_SET";
49
+ export declare const isValidNodeType: (type: string) => type is "DOCUMENT" | "CANVAS" | "FRAME" | "GROUP" | "VECTOR" | "BOOLEAN_OPERATION" | "STAR" | "LINE" | "ELLIPSE" | "REGULAR_POLYGON" | "RECTANGLE" | "TEXT" | "SLICE" | "COMPONENT" | "COMPONENT_SET" | "INSTANCE";
50
50
  export declare const isValidEffectType: (effect: FigmaTypes.Effect['type']) => boolean;
51
51
  export declare const isShadowEffectType: (effect: FigmaTypes.Effect['type']) => boolean;
52
52
  export declare const isValidGradientType: (gradientType: FigmaTypes.PaintType) => boolean;
package/dist/index.d.ts CHANGED
@@ -39,6 +39,7 @@ declare class Handoff {
39
39
  ejectIntegration(): Promise<Handoff>;
40
40
  ejectExportables(): Promise<Handoff>;
41
41
  ejectPages(): Promise<Handoff>;
42
+ ejectTheme(): Promise<Handoff>;
42
43
  makeExportable(type: string, name: string): Promise<Handoff>;
43
44
  makeTemplate(component: string, state: string): Promise<Handoff>;
44
45
  makePage(name: string, parent: string): Promise<Handoff>;
package/dist/index.js CHANGED
@@ -221,6 +221,21 @@ var Handoff = /** @class */ (function () {
221
221
  });
222
222
  });
223
223
  };
224
+ Handoff.prototype.ejectTheme = function () {
225
+ return __awaiter(this, void 0, void 0, function () {
226
+ return __generator(this, function (_a) {
227
+ switch (_a.label) {
228
+ case 0:
229
+ if (!this.config) return [3 /*break*/, 2];
230
+ return [4 /*yield*/, (0, eject_1.ejectTheme)(this)];
231
+ case 1:
232
+ _a.sent();
233
+ _a.label = 2;
234
+ case 2: return [2 /*return*/, this];
235
+ }
236
+ });
237
+ });
238
+ };
224
239
  Handoff.prototype.makeExportable = function (type, name) {
225
240
  return __awaiter(this, void 0, void 0, function () {
226
241
  return __generator(this, function (_a) {
@@ -1,3 +1,4 @@
1
+ /// <reference types="plugin-typings" />
1
2
  import * as FigmaTypes from '../figma/types';
2
3
  import { GradientObject } from '../types';
3
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handoff-app",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Automated documentation toolchain for building client side documentation from figma",
5
5
  "author ": {
6
6
  "name": "Convertiv",
@@ -23,6 +23,7 @@ const nextConfig = {
23
23
  },
24
24
  sassOptions: {
25
25
  additionalData: (content, loaderContext) => {
26
+ let foundTheme = false;
26
27
  // Check if client configuration exists
27
28
  if (fs.existsSync('handoff.config.json')) {
28
29
  // Load client configuration
@@ -33,12 +34,21 @@ const nextConfig = {
33
34
  // If the theme is specified, check if the theme exists in the 'themes' folder
34
35
  if (clientConfig.hasOwnProperty('theme') && fs.existsSync(path.resolve('themes', `${clientConfig['theme']}.scss`))) {
35
36
  // Use custom theme
36
- return content + `@import 'themes/${clientConfig['theme']}';`;
37
+ foundTheme = true;
38
+ content = content + `\n@import 'themes/${clientConfig['theme']}';`;
37
39
  }
38
40
  }
39
41
  }
40
- // Use default theme
41
- return content + `@import 'themes/default';`
42
+ if (!foundTheme) {
43
+ // Use default theme
44
+ content = content + `\n@import 'themes/default';`;
45
+ }
46
+
47
+ // Check if custom CSS exists
48
+ if (fs.existsSync('theme/main.scss')) {
49
+ content = content + `\n@import "theme/main.scss";`;
50
+ }
51
+ return content;
42
52
  },
43
53
  },
44
54
  webpack: (config) => {
@@ -47,7 +57,7 @@ const nextConfig = {
47
57
  config.resolve.modules.push(path.resolve('node_modules'));
48
58
  config.resolveLoader.modules.push(path.resolve('node_modules'));
49
59
  config.module.rules.push({
50
- test: /\.svg$/i,
60
+ test: /\.svg$/i,
51
61
  type: 'asset',
52
62
  });
53
63
  config.module.rules.push({
@@ -37,5 +37,3 @@ $enable-shadows: true;
37
37
  @import 'objects/all';
38
38
  @import 'components/all';
39
39
  @import 'utilities/all';
40
- //@import 'vendor/prism.scss';
41
- @import 'custom';
package/src/cli/eject.ts CHANGED
@@ -87,4 +87,33 @@ export const ejectPages = async (handoff: Handoff) => {
87
87
  return handoff;
88
88
  };
89
89
 
90
+ /**
91
+ * Eject the integration to the working directory
92
+ * @param handoff
93
+ */
94
+ export const ejectTheme = async (handoff: Handoff) => {
95
+ const config = await handoff.config;
96
+ // does an local page exist?
97
+ const workingPath = path.resolve(path.join(handoff.workingPath, 'theme', 'main.scss'));
98
+ if (fs.existsSync(workingPath)) {
99
+ if (!handoff.force) {
100
+ console.log(
101
+ chalk.yellow(`It appears you already have custom theme. Use the --force flag to replace you haven't customized.`)
102
+ );
103
+ return;
104
+ }
105
+ }
106
+ const currentTheme = handoff.config.theme ?? 'default';
107
+ const docsPath = path.resolve(path.join(handoff.modulePath, `src/app/sass/themes/_${currentTheme}.scss`));
108
+ if(fs.existsSync(docsPath)){
109
+ fs.copySync(docsPath, workingPath, { overwrite: false });
110
+ console.log(chalk.green(`Customizable theme ejected to ${workingPath}`));
111
+ }else {
112
+ fs.copySync(path.resolve(path.join(handoff.modulePath, `src/app/sass/themes/_default.scss`)), workingPath, { overwrite: false });
113
+ console.log(chalk.green(`Customizable theme ejected to ${workingPath}`));
114
+ }
115
+
116
+ return handoff;
117
+ };
118
+
90
119
  export default ejectConfig;
package/src/cli.ts CHANGED
@@ -35,6 +35,7 @@ Commands:
35
35
  eject:integration [opts] - Ejects the default integration to the current directory
36
36
  eject:exportables [opts] - Ejects the default exportables to the current directory
37
37
  eject:pages [opts] - Ejects the default pages to the current directory
38
+ eject:theme [opts] - Ejects the currently selected theme to theme/main.scss
38
39
 
39
40
  Options:
40
41
  -c, --config [file] Define the path to the config file
@@ -143,6 +144,8 @@ Eject must have a subcommand. Did you mean:
143
144
  return handoff.ejectIntegration();
144
145
  case 'eject:exportables':
145
146
  return handoff.ejectExportables();
147
+ case 'eject:theme':
148
+ return handoff.ejectTheme();
146
149
  case 'eject:pages':
147
150
  return handoff.ejectPages();
148
151
  case 'make':
package/src/index.ts CHANGED
@@ -8,7 +8,7 @@ import { TransformedPreviewComponents } from './transformers/preview/types';
8
8
  import { HookReturn } from './types';
9
9
  import buildApp, { devApp, watchApp } from './app';
10
10
  import pipeline, { buildIntegrationOnly } from './pipeline';
11
- import { ejectConfig, ejectExportables, ejectIntegration, ejectPages } from './cli/eject';
11
+ import { ejectConfig, ejectExportables, ejectIntegration, ejectPages, ejectTheme } from './cli/eject';
12
12
  import { makeExportable, makePage, makeTemplate } from './cli/make';
13
13
  import { HandoffIntegration, instantiateIntegration } from './transformers/integration';
14
14
  import { TransformerOutput } from './transformers/types';
@@ -66,7 +66,7 @@ class Handoff {
66
66
  return this;
67
67
  }
68
68
  preRunner(): Handoff {
69
- if(!this.config) {
69
+ if (!this.config) {
70
70
  throw Error('Handoff not initialized');
71
71
  }
72
72
  this.config.figma.definitions = this.hooks.configureExportables(this.config.figma?.definitions || []);
@@ -119,6 +119,12 @@ class Handoff {
119
119
  }
120
120
  return this;
121
121
  }
122
+ async ejectTheme(): Promise<Handoff> {
123
+ if (this.config) {
124
+ await ejectTheme(this);
125
+ }
126
+ return this;
127
+ }
122
128
  async makeExportable(type: string, name: string): Promise<Handoff> {
123
129
  if (this.config) {
124
130
  await makeExportable(this, type, name);
@@ -1,4 +0,0 @@
1
- /*
2
- This is a placeholder scss file that will get replaced by client specific
3
- styles when the project is built
4
- */
@@ -1,7 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="preview-body">
4
- <div class="alert alert-{{ type }} w-100 mb-0" role="alert">
5
- {{ parts.text.characters }}
6
- </div>
7
- </body>
@@ -1,12 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="preview-body">
4
- <div class="alert alert-horizontal alert-dismissible w-100" role="alert">
5
- <h4 class="alert-heading">{{ parts.title.characters }}</h4>
6
- <p>{{ parts.text.characters }}</p>
7
- <p>
8
- <a href="#">{{ parts.actions.characters }}</a>
9
- </p>
10
- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
11
- </div>
12
- </body>
@@ -1,12 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="preview-body">
4
- <div class="alert alert-vertical alert-dismissible" role="alert">
5
- <h4 class="alert-heading">{{ parts.title.characters }}</h4>
6
- <p>{{ parts.text.characters }}</p>
7
- <p>
8
- <a href="#">{{ parts.actions.characters }}</a>
9
- </p>
10
- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
11
- </div>
12
- </body>
@@ -1,5 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} preview-body">
4
- <button class="btn btn-{{ type }}">{{ parts.$.characters }}</button>
5
- </body>
@@ -1,5 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="preview-body">
4
- <button class="btn btn-primary btn-lg">{{ parts.$.characters }}</button>
5
- </body>
@@ -1,5 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="preview-body">
4
- <button class="btn btn-primary btn-md">{{ parts.$.characters }}</button>
5
- </body>
@@ -1,5 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} preview-body">
4
- <button class="btn btn-{{ type }}" disabled>{{ parts.$.characters }}</button>
5
- </body>
@@ -1,5 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="preview-body">
4
- <button class="btn btn-primary btn-sm">{{ parts.$.characters }}</button>
5
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check m-1">
5
- <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
6
- <label class="form-check-label" for="flexCheckDefault">
7
- {{ parts.label.characters }}
8
- </label>
9
- </div>
10
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check m-1">
5
- <input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" checked>
6
- <label class="form-check-label" for="flexCheckChecked">
7
- {{ parts.label.characters }}
8
- </label>
9
- </div>
10
- </body>
@@ -1,22 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox preview-body">
4
- <!-- <div class="form-check form-check-{{ state }}">
5
- <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
6
- <label class="form-check-label" for="flexCheckDefault">
7
- {{ parts.label.characters }}
8
- </label>
9
- </div> -->
10
- <div class="form-check me-5">
11
- <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
12
- <label class="form-check-label" for="flexCheckDefault">
13
- {{ parts.label.characters }}
14
- </label>
15
- </div>
16
- <div class="form-check">
17
- <input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" checked>
18
- <label class="form-check-label" for="flexCheckChecked">
19
- {{ parts.label.characters }}
20
- </label>
21
- </div>
22
- </body>
@@ -1,16 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check form-check-{{ state }} m-1">
5
- <input class="form-check-input" type="checkbox" value="" id="flexCheckDisabled" disabled>
6
- <label class="form-check-label" for="flexCheckDisabled">
7
- {{ parts.label.characters }}
8
- </label>
9
- </div>
10
- <div class="form-check form-check-{{ state }} m-1">
11
- <input class="form-check-input" type="checkbox" value="" id="flexCheckCheckedDisabled" checked disabled>
12
- <label class="form-check-label" for="flexCheckCheckedDisabled">
13
- {{ parts.label.characters }}
14
- </label>
15
- </div>
16
- </body>
@@ -1,14 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} input flex-column preview-body">
4
- <div class="mb-3">
5
- <label class="form-label" htmlFor="formTextComplete">{{parts.label.characters}}</label>
6
- <input type="text" class="form-control" id="formTextComplete" value="{{parts.text.characters}}" />
7
- <div class="form-text">{{parts.additionalInfo.characters}}</div>
8
- </div>
9
- <div class="mb-3">
10
- <label class="form-label" for="formTextareaComplete">{{parts.label.characters}}</label>
11
- <textarea class="form-control" id="formTextareaComplete" rows="3">{{parts.text.characters}}</textarea>
12
- <div class="form-text">{{parts.additionalInfo.characters}}</div>
13
- </div>
14
- </body>
@@ -1,14 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} input flex-column preview-body">
4
- <div class="mb-3">
5
- <label class="form-label" for="formText">{{parts.label.characters}}</label>
6
- <input type="text" class="form-control" id="formText" placeholder="{{parts.text.characters}}" />
7
- <div class="form-text">{{parts.additionalInfo.characters}}</div>
8
- </div>
9
- <div class="mb-3">
10
- <label class="form-label" for="formTextarea">{{parts.label.characters}}</label>
11
- <textarea class="form-control" id="formTextarea" rows="3" placeholder="{{parts.text.characters}}"></textarea>
12
- <div class="form-text">{{parts.additionalInfo.characters}}</div>
13
- </div>
14
- </body>
@@ -1,14 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} input flex-column preview-body">
4
- <div class="mb-3">
5
- <label class="form-label" htmlFor="formTextDisabled">{{parts.label.characters}}</label>
6
- <input type="text" class="form-control" id="formTextDisabled" placeholder="{{parts.text.characters}}" disabled />
7
- <div class="form-text">{{parts.additionalInfo.characters}}</div>
8
- </div>
9
- <div class="mb-3">
10
- <label class="form-label" for="formTextareaDisabled">{{parts.label.characters}}</label>
11
- <textarea class="form-control" id="formTextareaDisabled" rows="3" placeholder="{{parts.text.characters}}" disabled></textarea>
12
- <div class="form-text">{{parts.additionalInfo.characters}}</div>
13
- </div>
14
- </body>
@@ -1,14 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} input flex-column preview-body">
4
- <div class="mb-3">
5
- <label class="form-label" for="formTextInvalid">{{parts.label.characters}}</label>
6
- <input type="text" class="form-control is-invalid" id="formTextInvalid" placeholder="{{parts.text.characters}}" />
7
- <div class="invalid-feedback">{{parts.additionalInfo.characters}}</div>
8
- </div>
9
- <div class="mb-3">
10
- <label class="form-label" for="formTextareaInvalid">{{parts.label.characters}}</label>
11
- <textarea class="form-control is-invalid" id="formTextareaInvalid" rows="3" placeholder="{{parts.text.characters}}"></textarea>
12
- <div class="invalid-feedback">{{parts.additionalInfo.characters}}</div>
13
- </div>
14
- </body>
package/templates/main.js DELETED
@@ -1,16 +0,0 @@
1
- // bootstrap
2
- import { Tooltip, Modal } from 'bootstrap';
3
- import 'iframe-resizer/js/iframeResizer.contentWindow';
4
- // bootstrap css
5
- import './main.scss';
6
-
7
- // enable tooltips
8
- document.addEventListener('DOMContentLoaded', function (event) {
9
- const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]');
10
- const tooltipList = [...tooltipTriggerList].map(
11
- (tooltipTriggerEl) =>
12
- new Tooltip(tooltipTriggerEl, {
13
- boundary: document.body,
14
- })
15
- );
16
- });
@@ -1,32 +0,0 @@
1
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500&display=swap');
2
-
3
- @import "./exported/bootstrap-tokens/main.scss";
4
-
5
- body {
6
- background-color: #f7f7f7;
7
- display: flex;
8
- justify-content: center;
9
- }
10
-
11
- p {
12
- color: rgba( 0, 0, 0, .8 );
13
- font-family: 'Inter', sans-serif;
14
- font-size: 16px;
15
- font-weight: 300;
16
- letter-spacing: -.3px;
17
- line-height: 1.6;
18
- }
19
-
20
- .modal-footer small {
21
- color: #777;
22
- font-family: 'Inter', sans-serif;
23
- font-size: 12px;
24
- font-weight: 300;
25
- letter-spacing: -.3px;
26
- line-height: 1.6;
27
- }
28
-
29
- .preview-body {
30
- padding: 30px 40px;
31
- }
32
-
@@ -1,20 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="preview-body">
4
- <div class="modal" tabindex="-1" id="myModal" style="position: static; display: block;">
5
- <div class="modal-dialog">
6
- <div class="modal-content">
7
- <div class="modal-header">
8
- <h5 class="modal-title">Modal Visual</h5>
9
- <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
10
- </div>
11
- <div class="modal-body">
12
- <p>Show modal content here, supports any tipe of previously styled component.</p>
13
- </div>
14
- <div class="modal-footer">
15
- <small>Modal footer copy example.</small>
16
- </div>
17
- </div>
18
- </div>
19
- </div>
20
- </body>
@@ -1,31 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="flex-column align-items-center">
4
- <nav aria-label="Page navigation example">
5
- <ul class="pagination">
6
- <li class="page-item disabled"><a class="page-link">Previous</a></li>
7
- <li class="page-item"><a class="page-link" href="#">1</a></li>
8
- <li class="page-item active" aria-current="page"><a class="page-link" href="#">2</a></li>
9
- <li class="page-item"><a class="page-link" href="#">3</a></li>
10
- <li class="page-item"><a class="page-link" href="#">Next</a></li>
11
- </ul>
12
- </nav>
13
-
14
- <nav aria-label="Page navigation example">
15
- <ul class="pagination">
16
- <li class="page-item disabled">
17
- <a class="page-link" aria-label="Previous">
18
- <span aria-hidden="true">&laquo;</span>
19
- </a>
20
- </li>
21
- <li class="page-item"><a class="page-link" href="#">1</a></li>
22
- <li class="page-item active" aria-current="page"><a class="page-link" href="#">2</a></li>
23
- <li class="page-item"><a class="page-link" href="#">3</a></li>
24
- <li class="page-item">
25
- <a class="page-link" href="#" aria-label="Next">
26
- <span aria-hidden="true">&raquo;</span>
27
- </a>
28
- </li>
29
- </ul>
30
- </nav>
31
- </body>
@@ -1,31 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="flex-column align-items-center">
4
- <nav aria-label="Page navigation example">
5
- <ul class="pagination pagination-lg">
6
- <li class="page-item disabled"><a class="page-link">Previous</a></li>
7
- <li class="page-item"><a class="page-link" href="#">1</a></li>
8
- <li class="page-item active" aria-current="page"><a class="page-link" href="#">2</a></li>
9
- <li class="page-item"><a class="page-link" href="#">3</a></li>
10
- <li class="page-item"><a class="page-link" href="#">Next</a></li>
11
- </ul>
12
- </nav>
13
-
14
- <nav aria-label="Page navigation example">
15
- <ul class="pagination pagination-lg">
16
- <li class="page-item disabled">
17
- <a class="page-link" aria-label="Previous">
18
- <span aria-hidden="true">&laquo;</span>
19
- </a>
20
- </li>
21
- <li class="page-item"><a class="page-link" href="#">1</a></li>
22
- <li class="page-item active" aria-current="page"><a class="page-link" href="#">2</a></li>
23
- <li class="page-item"><a class="page-link" href="#">3</a></li>
24
- <li class="page-item">
25
- <a class="page-link" href="#" aria-label="Next">
26
- <span aria-hidden="true">&raquo;</span>
27
- </a>
28
- </li>
29
- </ul>
30
- </nav>
31
- </body>
@@ -1,31 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="flex-column align-items-center">
4
- <nav aria-label="Page navigation example">
5
- <ul class="pagination pagination-sm">
6
- <li class="page-item disabled"><a class="page-link">Previous</a></li>
7
- <li class="page-item"><a class="page-link" href="#">1</a></li>
8
- <li class="page-item active" aria-current="page"><a class="page-link" href="#">2</a></li>
9
- <li class="page-item"><a class="page-link" href="#">3</a></li>
10
- <li class="page-item"><a class="page-link" href="#">Next</a></li>
11
- </ul>
12
- </nav>
13
-
14
- <nav aria-label="Page navigation example">
15
- <ul class="pagination pagination-sm">
16
- <li class="page-item disabled">
17
- <a class="page-link" aria-label="Previous">
18
- <span aria-hidden="true">&laquo;</span>
19
- </a>
20
- </li>
21
- <li class="page-item"><a class="page-link" href="#">1</a></li>
22
- <li class="page-item active" aria-current="page"><a class="page-link" href="#">2</a></li>
23
- <li class="page-item"><a class="page-link" href="#">3</a></li>
24
- <li class="page-item">
25
- <a class="page-link" href="#" aria-label="Next">
26
- <span aria-hidden="true">&raquo;</span>
27
- </a>
28
- </li>
29
- </ul>
30
- </nav>
31
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check form-radio m-1">
5
- <input class="form-check-input" type="radio" name="flexRadioDefault" id="flexRadioDefault1">
6
- <label class="form-check-label" for="flexRadioDefault1">
7
- {{ parts.label.characters }}
8
- </label>
9
- </div>
10
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check form-radio m-1">
5
- <input class="form-check-input" type="radio" name="flexRadioDefault" id="flexRadioDefault2" checked>
6
- <label class="form-check-label" for="flexRadioDefault2">
7
- {{ parts.label.characters }}
8
- </label>
9
- </div>
10
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} preview-body">
4
- <div class="form-check form-radio-{{ state }}">
5
- <input class="form-check-input" type="radio" name="flexRadioDefault" id="flexRadioDefault1">
6
- <label class="form-check-label" for="flexRadioDefault1">
7
- {{ parts.label.characters }}
8
- </label>
9
- </div>
10
- </body>
@@ -1,16 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check form-check-{{ state }} form-radio m-1">
5
- <input class="form-check-input" type="radio" name="flexRadioDisabled" id="flexRadioDisabled1" disabled>
6
- <label class="form-check-label" for="flexRadioDisabled1">
7
- {{ parts.label.characters }}
8
- </label>
9
- </div>
10
- <div class="form-check form-check-{{ state }} form-radio m-1">
11
- <input class="form-check-input" type="radio" name="flexRadioDisabled" id="flexRadioDisabled2" checked disabled>
12
- <label class="form-check-label" for="flexRadioDisabled2">
13
- {{ parts.label.characters }}
14
- </label>
15
- </div>
16
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} select flex-column preview-body">
4
- <select class="form-select" aria-label="Default select example">
5
- <option selected>Open this select menu</option>
6
- <option value="1">One</option>
7
- <option value="2">Two</option>
8
- <option value="3">Three</option>
9
- </select>
10
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} select flex-column preview-body">
4
- <select class="form-select" aria-label="Default select example" disabled>
5
- <option selected>Open this select menu</option>
6
- <option value="1">One</option>
7
- <option value="2">Two</option>
8
- <option value="3">Three</option>
9
- </select>
10
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} select flex-column preview-body">
4
- <select class="form-select is-invalid" aria-label="Default select example">
5
- <option selected>Open this select menu</option>
6
- <option value="1">One</option>
7
- <option value="2">Two</option>
8
- <option value="3">Three</option>
9
- </select>
10
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check form-switch m-1">
5
- <input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault">
6
- <label class="form-check-label" for="flexSwitchCheckDefault">
7
- Switch Label
8
- </label>
9
- </div>
10
- </body>
@@ -1,10 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check form-switch m-1">
5
- <input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckChecked" checked>
6
- <label class="form-check-label" for="flexSwitchCheckChecked">
7
- Switch Label
8
- </label>
9
- </div>
10
- </body>
@@ -1,8 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check form-switch">
5
- <input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDefault" />
6
- <label class="form-check-label" for="flexSwitchCheckDefault">Default switch checkbox input</label>
7
- </div>
8
- </body>
@@ -1,16 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="theme-{{ theme }} checkbox flex-column align-items-center preview-body">
4
- <div class="form-check form-check-{{ state }} form-switch m-1">
5
- <input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckDisabled" disabled/>
6
- <label class="form-check-label" for="flexSwitchCheckDisabled">
7
- Switch Label
8
- </label>
9
- </div>
10
- <div class="form-check form-check-{{ state }} form-switch m-1">
11
- <input class="form-check-input" type="checkbox" role="switch" id="flexSwitchCheckCheckedDisabled" checked disabled/>
12
- <label class="form-check-label" for="flexSwitchCheckCheckedDisabled">
13
- Switch Label
14
- </label>
15
- </div>
16
- </body>
@@ -1,16 +0,0 @@
1
- <script src="/components/bundle.js"></script>
2
-
3
- <body class="gap-2 preview-body" style="padding-top:60px;padding-bottom:60px;">
4
- <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Tooltip on top">
5
- Tooltip on top
6
- </button>
7
- <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="Tooltip on right">
8
- Tooltip on right
9
- </button>
10
- <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Tooltip on bottom">
11
- Tooltip on bottom
12
- </button>
13
- <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="left" data-bs-title="Tooltip on left">
14
- Tooltip on left
15
- </button>
16
- </body>