-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🏗 Drop prebuild in favor of dynamic components
- Loading branch information
Showing
11 changed files
with
61 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.idea/ | ||
dist/ | ||
node_modules/ | ||
src/components/generated/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import PComponent from "./Component"; | ||
|
||
const map = { | ||
// Path: ["instructions", "isClosed"], // FIXME: find a way to declare instructions | ||
Heart: ["radius"], | ||
Line: ["points"], | ||
Spline: ["points", "tension"], | ||
Polygon: ["points"], | ||
RegularPolygon: ["nbSides", "radius"], | ||
Star: ["radius", "nbBranches", "bevelRatio"], | ||
Triangle: ["radius"], | ||
Rectangle: ["width", "height"], | ||
Image: ["url"], | ||
Square: ["size"], | ||
Arc: ["width", "height", "startAngle", "endAngle"], | ||
Ellipse: ["width", "height"], | ||
Circle: ["radius"], | ||
Text: ["text"], | ||
Button: [], | ||
Checkbox: [], | ||
// Knob: [], // FIXME: draggable is not working | ||
// Slider: [], // FIXME: same | ||
ProgressBar: [], | ||
ProgressPie: [], | ||
Select: ["items"], | ||
}; | ||
|
||
const classes = {}; | ||
Object.keys(map).forEach((className) => { | ||
const pName = `P${className}`; | ||
classes[pName] = Pencil => ({ | ||
extends: PComponent(Pencil), | ||
props: map[className], | ||
beforeMount () { | ||
const props = ["position", ...map[className], "options"].map(p => this[p]); | ||
this.$pencil = new Pencil[className](...props); | ||
}, | ||
}); | ||
}); | ||
|
||
export default classes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import PContainer from "./Container"; | ||
import PScene from "./Scene"; | ||
import components from "./factory"; | ||
|
||
export { | ||
export default { | ||
PContainer, | ||
PScene, | ||
...components, | ||
}; | ||
export * from "./generated"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
import install from "./install"; | ||
|
||
// eslint-disable-next-line no-restricted-globals | ||
const global = self; | ||
|
||
const errors = []; | ||
if (!window.Vue) { | ||
if (!global.Vue) { | ||
errors.push(`Vue.js should be installed before vue-pencil.js using a <script> tag like: | ||
<script src="https://cdn.jsdelivr.net/npm/vue"></script>`); | ||
} | ||
if (!window.Pencil) { | ||
if (!global.Pencil) { | ||
errors.push(`Pencil.js should be installed before vue-pencil.js using a <script> tag like: | ||
<script src="https://unpkg.com/vue-pencil.js"></script>`); | ||
<script src="https://unpkg.com/pencil.js"></script>`); | ||
} | ||
|
||
if (errors.length) { | ||
errors.forEach(message => console.error(message)); | ||
} | ||
else { | ||
install(window.Pencil)(window.Vue); | ||
install(global.Pencil)(global.Vue); | ||
} |