Skip to content

Commit

Permalink
MINOR: feat: add ability to register smart components with vue plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Jun 30, 2023
1 parent 85df00e commit 82fe518
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/BIMDataSmartComponents/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "../assets/css/_BIMDataVariables.css";
import "../assets/css/variables.css";

import "../assets/css/utilities/_colors.css";
import "../assets/css/utilities/_flex.css";
Expand Down
2 changes: 1 addition & 1 deletion src/assets/css/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
font-weight: 100 400;
font-style: normal;
font-display: fallback;
}
}
15 changes: 13 additions & 2 deletions vue3-plugin.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import * as Components from "./src/BIMDataComponents/index.js";
import * as SmartComponents from "./src/BIMDataSmartComponents/index.js";
import * as Directives from "./src/BIMDataDirectives/index.js";

/**
* Register all components and directives from the design system.
*
* @param {
* {
* directives?: boolean,
* includedComponents?: string[],
* excludedComponents?: string[]
* excludedComponents?: string[],
* smartComponents?: boolean,
* directives?: boolean,
* }
* } [cfg]
*/
Expand All @@ -35,6 +37,15 @@ const pluginFactory = cfg => {
}
});

// SMART COMPONENTS
if (cfg?.smartComponents) {
Object.entries(SmartComponents).forEach(
([componentName, component]) => {
app.component(componentName, component);
}
);
}

// DIRECTIVES
if (!cfg || cfg.directives !== false) {
Object.entries(Directives).forEach(([directiveName, directive]) =>
Expand Down

0 comments on commit 82fe518

Please sign in to comment.