@mozaic-ds/icons-vue 0.1.0-beta.0 → 0.1.0-beta.2

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/package.json CHANGED
@@ -1,20 +1,24 @@
1
1
  {
2
2
  "name": "@mozaic-ds/icons-vue",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.2",
4
4
  "description": "ADS icons for vue usage",
5
5
  "main": "index.js",
6
+ "files": [
7
+ "dist/*",
8
+ "src/*"
9
+ ],
6
10
  "scripts": {
7
11
  "clean": "rm -rf dist/",
8
12
  "icons:build": "node icons-builder/index.js",
9
13
  "build": "vue-tsc && vite build",
10
- "prepublishOnly": "npm run icons:build && npm run build && cp package.json dist",
14
+ "prepublishOnly": "npm run icons:build && npm run build",
11
15
  "release": "release-it",
12
16
  "release:beta": "release-it --preRelease=beta",
13
17
  "npm:publish": "npm publish --access public",
14
18
  "npm:publishBeta": "npm publish --tag beta --access public"
15
19
  },
16
20
  "dependencies": {
17
- "@mozaic-ds/icons": "^2.0.0-beta.22"
21
+ "@mozaic-ds/icons": "2.0.0-beta.47"
18
22
  },
19
23
  "devDependencies": {
20
24
  "@vitejs/plugin-vue": "^3.2.0",
@@ -26,8 +30,7 @@
26
30
  "glob": "^10.3.10",
27
31
  "release-it": "^17.1.1",
28
32
  "rimraf": "^5.0.5",
29
- "svg-parser": "^2.0.4",
30
- "svgo": "^3.2.0"
33
+ "svg-parser": "^2.0.4"
31
34
  },
32
35
  "repository": {
33
36
  "type": "git",
@@ -1,8 +0,0 @@
1
- # CODEOWNERS
2
- # Each line is a file pattern followed by one or more owners.
3
-
4
- # These owners will be the default owners for everything in
5
- # the repo. Unless a later match takes precedence,
6
- # @adeo/adeo-design-system will be requested for
7
- # review when someone opens a pull request.
8
- * @adeo/adeo-design-system
@@ -1,102 +0,0 @@
1
- name: 🐞 Bug Report
2
- description: Report a bug
3
- labels: ['bug']
4
- body:
5
- - type: markdown
6
- attributes:
7
- value: |
8
- Hi there! :wave: :smiley:
9
- Thanks for taking the time to fill out this bug report!
10
-
11
- > To expedite issue processing please search open and closed issues before submitting a new one.
12
- - type: dropdown
13
- id: about
14
- attributes:
15
- label: I am opening an issue for
16
- options:
17
- - New icons
18
- - Existing icons
19
- validations:
20
- required: true
21
- - type: input
22
- id: ads-icons-version
23
- attributes:
24
- label: Version of ADS-Icons
25
- description: Which version of ADS-Icons is affected?
26
- placeholder: ex. @mozaic-ds/icons@2.0.0
27
- validations:
28
- required: true
29
- - type: checkboxes
30
- id: regression
31
- attributes:
32
- label: Is this a regression?
33
- description: Did this behavior use to work in the previous version?
34
- options:
35
- - label: 'Yes'
36
- - label: 'No'
37
- - label: "I don't know"
38
- validations:
39
- required: true
40
- - type: textarea
41
- id: description
42
- attributes:
43
- label: Description
44
- placeholder: A clear and concise description of what the bug is.
45
- validations:
46
- required: true
47
- - type: input
48
- id: github-repository
49
- attributes:
50
- label: Github repository
51
- description: To better help you, please indicate the url of your GitHub repo
52
- placeholder: ex. https://github.com/adeo/ads-icons
53
- validations:
54
- required: true
55
- - type: input
56
- id: mockups
57
- attributes:
58
- label: Mock-up(s)
59
- description: Please, indicate the URL of your Figma mock-up to give us more context.
60
- placeholder: e.g., https://www.figma.com/file/b09kkFmjlH6RnLEDF2vppS/%5BBA%5D-Button-%F0%9F%9F%A2?node-id=0%3A1
61
- - type: textarea
62
- id: what-happened
63
- attributes:
64
- label: What happened?
65
- description: Tell us, what's happening?
66
- placeholder: |
67
- Tell us what you see.
68
-
69
- Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
70
- - type: textarea
71
- id: what-expected
72
- attributes:
73
- label: What is expected?
74
- description: Tell us, what did you expect to happen?
75
- placeholder: Describe the expected outcome.
76
- - type: textarea
77
- id: reproduce
78
- attributes:
79
- label: To Reproduce
80
- description: Steps to reproduce the issue.
81
- placeholder: |
82
- 1. Go to '...'
83
- 2. Click on '....'
84
- 3. Scroll down to '....'
85
- 4. See error
86
-
87
- Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
88
- - type: textarea
89
- id: code
90
- attributes:
91
- label: Code example
92
- description: Copy here the concerned code or an example of code. _(Consider using Stackbliz, Codepen or CodeSandbox to provide a testable code example.)_
93
- render: HTML
94
- - type: textarea
95
- id: additional-comments
96
- attributes:
97
- label: Additional comments
98
- description: Add any other comments about the problem here.
99
- placeholder: |
100
- Is this a browser specific issue? If so, please specify the browser and version.
101
- Do you have specific setup for sketch, plugins, etc.
102
- Do any of these matter: operating system, IDE, package manager, HTTP server, ...?
@@ -1,27 +0,0 @@
1
- name: 🚀 Feature request
2
- description: Suggest an idea for this project
3
- labels: [':rocket: feat']
4
- body:
5
- - type: markdown
6
- attributes:
7
- value: |
8
- Hi there! :wave: :smiley:
9
- Thank you for taking the time to fill out this feature request and helping us expand/improve the Design System!
10
-
11
- > To expedite issue processing please search open and closed issues before submitting a new one.
12
- - type: dropdown
13
- id: about
14
- attributes:
15
- label: I want to propose an evolution/improvement on
16
- options:
17
- - New icons
18
- - Existing icons
19
- validations:
20
- required: true
21
- - type: textarea
22
- id: description
23
- attributes:
24
- label: Description
25
- placeholder: A clear and concise description of the issue or what you are missing.
26
- validations:
27
- required: true
@@ -1,28 +0,0 @@
1
- ## I have read [the contributing guidelines](https://mozaic.adeo.cloud/contributing/)
2
-
3
- - [ ] Yes
4
- - [ ] No
5
-
6
- ## Does this PR introduce a breaking change?
7
-
8
- read [What is a breaking change ?](https://mozaic.adeo.cloud/contributing/developers/git-conventions/#breaking-changes-)
9
-
10
- - [ ] Yes
11
- - [ ] No
12
-
13
- ## Have you written a story about your changes?
14
-
15
- - [ ] Yes
16
- - [ ] No
17
-
18
- ## Describe the changes
19
-
20
- <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
21
-
22
- ## GitHub issue number _(or Jira issue URL)_
23
-
24
- <!-- Please indicate a link or a number related to the issue or the Jira concerned. -->
25
-
26
- ## Other information
27
-
28
- <!-- Add any other comments or anything else relevant about your request here. -->
package/.release-it.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "git": {
3
- "requireBranch": ["main", "beta", "beta/*", "chore", "chore/*", "next"],
4
- "requireCommits": true,
5
- "commitMessage": "chore(release): publish v${version}"
6
- },
7
- "npm": {
8
- "publish": false
9
- },
10
- "github": {
11
- "release": true,
12
- "releaseName": "v${version}",
13
- "skipChecks": false
14
- },
15
- "plugins": {
16
- "@release-it/conventional-changelog": {
17
- "preset": "angular",
18
- "infile": "CHANGELOG.md"
19
- }
20
- }
21
- }
package/CHANGELOG.md DELETED
@@ -1,13 +0,0 @@
1
-
2
-
3
- # 0.1.0-beta.0 (2024-03-06)
4
-
5
-
6
- ### Features
7
-
8
- * **compiler:** new compiler based on new ads-icons ([45142a9](https://github.com/adeo/ads-icons-vue/commit/45142a97a0a35428078d9ad47ce27721c73026db))
9
- * **icons:** add index for each components ([ed41659](https://github.com/adeo/ads-icons-vue/commit/ed416590332dcb034da8d1ff7b3eaf465a0ade1f))
10
- * **icons:** export all components ([94ec297](https://github.com/adeo/ads-icons-vue/commit/94ec297fa9214e4b17003093abee408f556b767f))
11
- * **icons:** update names and add comment ([f6c79d2](https://github.com/adeo/ads-icons-vue/commit/f6c79d2b081c4457abaf028bab38c8054c4e8a9b))
12
- * **init:** first vue icons ([aed6261](https://github.com/adeo/ads-icons-vue/commit/aed6261aed972afbb3ba1110ebb486fd9c4d4585))
13
- * **initial:** first commit ([319a2e6](https://github.com/adeo/ads-icons-vue/commit/319a2e6c39070f1d19dffeaa11a94b7fd110a693))
@@ -1,63 +0,0 @@
1
- const fs = require("fs").promises;
2
- const path = require("path");
3
- const templateVue = require("./vue-template");
4
- const { createComponentName } = require("../utils/tools");
5
-
6
-
7
- /**
8
- * Asynchronously generates Vue component files for a given array of icons. Each icon's data
9
- * is used to create a Vue component file and an index.js file for exports. It also aggregates
10
- * all component import statements into a single 'icons.js' file.
11
- *
12
- * @async
13
- * @param {Array<{file: string, data: string}>} icons - An array of objects representing icons,
14
- * each containing the 'file' name and the 'data' as a UTF-8 string.
15
- * @throws {Error} Throws an error if there is an issue creating directories, writing files,
16
- * or during any part of the file generation process.
17
- * @returns {Promise<void>} A promise that resolves when all Vue components have been successfully
18
- * generated and import statements have been aggregated and written to 'icons.js'.
19
- */
20
- const generateVueComponent = async (icons) => {
21
- try {
22
- // Aggregate import statements
23
- let importStatements = "";
24
-
25
- for (const icon of icons) {
26
- if (!icon.file) {
27
- continue;
28
- }
29
-
30
- const parsedName = createComponentName(icon.file);
31
- importStatements += `export { ${parsedName} } from './components/${parsedName}';\n`;
32
-
33
- const dataVue = templateVue(icon);
34
- const dataIndex = `import ${parsedName} from './${parsedName}.vue';
35
- export { ${parsedName} };`;
36
-
37
- const componentDir = path.join(
38
- process.cwd(),
39
- `${path.relative(process.cwd(), "src/components")}/${parsedName}`
40
- );
41
- await fs.mkdir(componentDir, { recursive: true });
42
-
43
- const writePath = path.join(componentDir, `${parsedName}.vue`);
44
- const writePathIndex = path.join(componentDir, "index.js");
45
-
46
- await fs.writeFile(writePath, dataVue, "utf8");
47
- await fs.writeFile(writePathIndex, dataIndex, "utf8");
48
- }
49
-
50
- // Write aggregated import statements to icons.js
51
- const writeIndex = path.join(
52
- process.cwd(),
53
- path.relative(process.cwd(), "src/components"),
54
- "icons.js"
55
- );
56
- await fs.appendFile(writeIndex, importStatements, "utf8");
57
- } catch (err) {
58
- console.error(`✗ ERROR : ${err}`);
59
- throw err; // Rethrow or handle error as needed
60
- }
61
- };
62
-
63
- module.exports = generateVueComponent;
@@ -1,66 +0,0 @@
1
- const { parse } = require("svg-parser");
2
- const { createComponentName, convertPxToRem } = require("../utils/tools");
3
-
4
- /**
5
- * Generates a Vue component template string from an icon object containing the file name and SVG data.
6
- * The function parses the SVG data to inject dynamic properties such as width, height (based on the file name),
7
- * and fill color. It constructs a Vue component with these dynamic properties and returns the component as a string.
8
- *
9
- * @param {Object} icon - An object containing the 'file' name and SVG 'data' of an icon.
10
- * @param {string} icon.file - The file name of the icon, used to derive the component name and size.
11
- * @param {string} icon.data - The raw SVG data of the icon.
12
- * @returns {string|null} A string containing the Vue component template, or null if the SVG content is invalid.
13
- */
14
- const vueIconComponent = ({ file, data }) => {
15
- const componentName = `${createComponentName(file)}`;
16
-
17
- const sizePx = file.replace(".svg", "").split("_").pop();
18
-
19
- const sizeRem = convertPxToRem(sizePx.replace("px", ""));
20
- const parsedSVG = parse(data);
21
-
22
- const parsedData = data.replace(
23
- "<svg",
24
- `<svg aria-hidden="true" width="${sizeRem}" height="${sizeRem}" :fill="color"`
25
- );
26
- const viewBox = parsedSVG.children.find((child) => child.tagName === "svg")
27
- ?.properties?.viewBox;
28
-
29
- const content =
30
- parsedSVG.children.find((child) => child.tagName === "svg")?.children || [];
31
-
32
- if (!sizeRem || content.length === 0 || !viewBox) {
33
- console.error(
34
- `✗ ERROR : Problem building ${file} for VueJS - missing or invalid SVG content`
35
- );
36
-
37
- return null;
38
- }
39
- return `<template>${parsedData}</template>
40
- <script lang="ts">
41
- export default {
42
- name: '${componentName}',
43
- props: {
44
- /**
45
- * Icon color
46
- */
47
- color: {
48
- type: String,
49
- default: 'currentColor',
50
- },
51
- },
52
- };
53
- </script>
54
- `;
55
- };
56
-
57
- /**
58
- * Wraps the `vueIconComponent` function to directly return a Vue component template string
59
- * for a given icon object.
60
- *
61
- * @param {Object} icon - An object containing the 'file' name and SVG 'data' of an icon.
62
- * @returns {string|null} A string containing the Vue component template, or null if the SVG content is invalid.
63
- */
64
- const templateVue = (icon) => `${vueIconComponent(icon, icon.data)}`;
65
-
66
- module.exports = templateVue;
@@ -1,44 +0,0 @@
1
- /**
2
- * Compiles icons by cleaning directories, fetching icons,
3
- * and generating Vue components for each icon. Logs progress and success messages
4
- * to the console. This function encapsulates the entire process of preparing
5
- * and compiling icons for use in VueJS applications.
6
- *
7
- * @async
8
- * @function compileIcons
9
- * @returns {Promise<void>} A promise that resolves when the icons have been compiled
10
- * successfully or rejects with an error if any step in the process fails.
11
- */
12
- const cleanDirectories = require("./utils/directory-cleaner");
13
- const fetchIcons = require("./utils/fetch-icons");
14
- const generateVueComponent = require("./component-generator");
15
-
16
- console.log(`
17
- •••••••••••••••••••••••••••••••••••••••
18
- + +
19
- + COMPILING ADS ICON FOR VUEJS +
20
- + +
21
- •••••••••••••••••••••••••••••••••••••••
22
- `);
23
-
24
- async function compileIcons() {
25
- try {
26
- await cleanDirectories();
27
- console.log("✓ SUCCESS : Icons Directories cleaned and recreated");
28
-
29
- const icons = await fetchIcons();
30
- console.log("✓ SUCCESS : Icons cleaned and saved as SVGs in the package");
31
-
32
- await generateVueComponent(icons);
33
- console.log(
34
- "✓ SUCCESS : Monochrom icons compiled into react and vue components"
35
- );
36
-
37
- // Assuming there's a step to compile or gather color icons as well, not shown in the original code.
38
- // const colorIcons = ...; // This line is just a placeholder for actual logic.
39
- } catch (err) {
40
- console.error(`✗ ERROR : ${err}`);
41
- }
42
- }
43
-
44
- compileIcons();
@@ -1,46 +0,0 @@
1
- const fs = require("fs").promises;
2
- const path = require("path");
3
- const { rimraf } = require("rimraf");
4
-
5
- /**
6
- * Recreates a directory at the specified path. If the directory already exists,
7
- * no action is taken. If the directory does not exist, it is created with all
8
- * necessary parent directories.
9
- *
10
- * @async
11
- * @param {string} componentPath - The path where the directory will be recreated.
12
- * @returns {Promise<boolean>} A promise that resolves to true if the directory
13
- * is successfully checked and possibly created.
14
- * @throws {Error} Throws an error if there is an issue accessing or creating the directory.
15
- */
16
- const recreateIconsDir = async (componentPath) => {
17
- try {
18
- await fs.access(componentPath);
19
- // If the directory exists, no further action is needed
20
- } catch (error) {
21
- // If the directory does not exist, it will throw an error, then we create the directory
22
- await fs.mkdir(componentPath, { recursive: true });
23
- }
24
- return true; // This return value is not strictly needed unless you use it for a condition
25
- };
26
-
27
-
28
- /**
29
- * Cleans and recreates the icons directory within the "src/components" path
30
- * relative to the current working directory. This function first attempts to
31
- * remove the existing icons directory and then recreates it.
32
- *
33
- * @async
34
- * @returns {Promise<void>} A promise that resolves when the icons directory has
35
- * been successfully cleaned and recreated.
36
- * @throws {Error} Throws an error if cleaning or recreating the directory fails.
37
- */
38
- const cleanRecreateIconsDirs = async () => {
39
- const componentPath = path.join(process.cwd(), "src/components");
40
- // Clean the directory first
41
- await rimraf(componentPath);
42
- // Then recreate the directory
43
- await recreateIconsDir(componentPath);
44
- };
45
-
46
- module.exports = cleanRecreateIconsDirs;
@@ -1,47 +0,0 @@
1
- #! /usr/bin/env node
2
- const fs = require("fs").promises; // Use the promise-based version of fs
3
- const path = require("path");
4
- const { glob } = require("glob");
5
-
6
- /**
7
- * Asynchronously reads the content of an icon file and returns an object containing
8
- * the file name and its data.
9
- *
10
- * @async
11
- * @param {string} file - The path to the icon file to be read.
12
- * @returns {Promise<{file: string, data: string}>} A promise that resolves to an object
13
- * containing the 'file' name (path) and the 'data' as a UTF-8 string.
14
- * @throws {Error} Throws an error if reading the file fails.
15
- */
16
- const readIcon = async (file) => {
17
- const data = await fs.readFile(file, "utf8");
18
- return { file, data };
19
- };
20
-
21
- /**
22
- * Asynchronously searches for SVG icon files within the 'node_modules/@mozaic-ds/icons/build/svg'
23
- * directory and reads their contents. Returns an array of objects, each representing an icon
24
- * with its file name and data.
25
- *
26
- * @async
27
- * @returns {Promise<Array<{file: string, data: string}>>} A promise that resolves to an array of
28
- * objects, where each object contains the 'file' name (only the basename) and the 'data' of an icon.
29
- * @throws {Error} Throws an error if the search or file reading fails.
30
- */
31
- const fetchIcons = async () => {
32
- try {
33
- const inputPath = path.relative(
34
- process.cwd(),
35
- "node_modules/@mozaic-ds/icons/build/svg/**/*.svg"
36
- );
37
- const icons = await glob(inputPath);
38
- const iconsData = await Promise.all(icons.map(readIcon));
39
- iconsData.forEach((icon) => (icon.file = path.basename(icon.file)));
40
- return iconsData;
41
- } catch (err) {
42
- console.error(err);
43
- throw err; // Rethrowing the error to be handled by the caller
44
- }
45
- };
46
-
47
- module.exports = fetchIcons;
@@ -1,20 +0,0 @@
1
- /**
2
- * Creates Component name from a string (usually the icon file name)
3
- * @param {string} str - The icon fileName
4
- */
5
- const createComponentName = (str) => {
6
- str = str?.replace('.svg', '')?.replace(/_/g, '')?.replace(str.split('_')[0], '')
7
- return (str?.match(/[a-zA-Z0-9]+/g) || [])
8
- .map((w) => `${w.charAt(0).toUpperCase()}${w.slice(1)}`)
9
- .join('')
10
- }
11
-
12
- /**
13
- * Create rem based ison size based on a 16 px standard
14
- */
15
- const convertPxToRem = (str) => parseInt(str, 10) / 16 + 'rem'
16
-
17
- module.exports = {
18
- createComponentName,
19
- convertPxToRem,
20
- }
package/product-info.json DELETED
@@ -1 +0,0 @@
1
- {"tangram_id": "8a7b40e6-1bb8-4654-8de8-8163e7dabc1f"}
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "useDefineForClassFields": true,
5
- "module": "ESNext",
6
- "moduleResolution": "Node",
7
- "strict": true,
8
- "jsx": "preserve",
9
- "resolveJsonModule": true,
10
- "isolatedModules": true,
11
- "esModuleInterop": true,
12
- "lib": ["ESNext", "DOM"],
13
- "skipLibCheck": true,
14
- "noEmit": true
15
- },
16
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue"],
17
- "references": [{ "path": "./tsconfig.node.json" }]
18
- }
@@ -1,9 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "module": "ESNext",
5
- "moduleResolution": "Node",
6
- "allowSyntheticDefaultImports": true
7
- },
8
- "include": ["vite.config.ts"]
9
- }
@@ -1,5 +0,0 @@
1
- // tsconfig.types.json
2
- {
3
- "include": ["src/**/*"],
4
- "exclude": ["node_modules/**"]
5
- }
package/vite.config.ts DELETED
@@ -1,29 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import { resolve } from "path";
3
- import vue from "@vitejs/plugin-vue";
4
-
5
- // https://vitejs.dev/config/
6
- export default defineConfig({
7
- plugins: [vue()],
8
- build: {
9
- lib: {
10
- // Could also be a dictionary or array of multiple entry points
11
- entry: resolve(__dirname, "src/main.ts"),
12
- name: "ads-icons-vue",
13
- // the proper extensions will be added
14
- fileName: "ads-icons-vue",
15
- },
16
- rollupOptions: {
17
- // make sure to externalize deps that shouldn't be bundled
18
- // into your library
19
- external: ["vue"],
20
- output: {
21
- // Provide global variables to use in the UMD build
22
- // for externalized deps
23
- globals: {
24
- vue: "Vue",
25
- },
26
- },
27
- },
28
- },
29
- });