sparkles: Properly formatted title
This commit is contained in:
parent
ddc8775275
commit
83aaa56bdf
10 changed files with 2694 additions and 4101 deletions
6551
packages/plugin-title/package-lock.json
generated
6551
packages/plugin-title/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,38 +1,65 @@
|
|||
{
|
||||
"name": "@freesewing-plugins/macro-title",
|
||||
"version": "0.1.1",
|
||||
"name": "@freesewing/plugin-title",
|
||||
"version": "0.2.0",
|
||||
"description": "A freesewing plugin to add a title to your pattern parts",
|
||||
"author": "Joost De Cock <joost@decock.org> (https://github.com/joostdecock)",
|
||||
"license": "MIT",
|
||||
"description": "A freesewing macro to add a title to your pattern parts",
|
||||
"homepage": "https://github.com/freesewing/plugin-title#readme",
|
||||
"repository": "github:freesewing/plugin-title",
|
||||
"bugs": {
|
||||
"url": "https://github.com/freesewing/plugin-title/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"freesewing",
|
||||
"macro",
|
||||
"plugin",
|
||||
"sewing",
|
||||
"patterns",
|
||||
"title"
|
||||
],
|
||||
"homepage": "https://github.com/freesewing-plugins/macro-title#readme",
|
||||
"repository": "github:freesewing-plugins/macro-title",
|
||||
"bugs": {
|
||||
"url": "https://github.com/freesewing-plugins/macro-title/issues"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"unpkg": "dist/_bundle.js",
|
||||
"main": "dist/node.js",
|
||||
"unpkg": "dist/browser.js",
|
||||
"browser": "dist/browser.js",
|
||||
"module": "src/index.js",
|
||||
"scripts": {
|
||||
"patch": "npm version patch -m \":bookmark: v%s\" && npm run build",
|
||||
"minor": "npm version minor -m \":bookmark: v%s\" && npm run build",
|
||||
"major": "npm version major -m \":bookmark: v%s\" && npm run build",
|
||||
"precommit": "npm run pretty && lint-staged",
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"clean": "rimraf dist",
|
||||
"nodebuild": "babel src -d dist --no-babelrc",
|
||||
"browserbuild": "npx webpack-cli --config webpack.config.js",
|
||||
"build": "npm run clean && npm run nodebuild && npm run browserbuild"
|
||||
"pretty": "npx prettier --write \"src/*.js\"",
|
||||
"lint": "eslint --fix \"src/*.js\"",
|
||||
"browserbuild": "rollup -c rollup.browser.js",
|
||||
"nodebuild": "rollup -c rollup.node.js",
|
||||
"build": "npm run clean && npm run browserbuild && npm run nodebuild"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,json}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.53",
|
||||
"@babel/preset-env": "7.0.0-beta.53",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-eslint": "^8.2.6",
|
||||
"eslint": "^5.2.0",
|
||||
"eslint-config-prettier": "^2.9.0",
|
||||
"eslint-plugin-prettier": "^2.6.2",
|
||||
"husky": "^0.14.3",
|
||||
"lint-staged": "^7.2.0",
|
||||
"prettier": "^1.13.7",
|
||||
"rimraf": "^2.6.2",
|
||||
"babel-cli": "6.26.0",
|
||||
"babel-loader": "8.0.0-beta.4",
|
||||
"webpack": "4.16.0",
|
||||
"webpack-cli": "3.0.8"
|
||||
"rollup-plugin-babel": "^3.0.7",
|
||||
"rollup-plugin-commonjs": "^9.1.3",
|
||||
"rollup-plugin-filesize": "^4.0.1",
|
||||
"rollup-plugin-json": "^3.0.0",
|
||||
"rollup-plugin-node-resolve": "^3.3.0",
|
||||
"rollup-plugin-terser": "^1.0.1"
|
||||
},
|
||||
"files": [
|
||||
"dist/*",
|
||||
|
|
34
packages/plugin-title/rollup.browser.js
Normal file
34
packages/plugin-title/rollup.browser.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { terser } from "rollup-plugin-terser";
|
||||
import babel from "rollup-plugin-babel";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import commonjs from "rollup-plugin-commonjs";
|
||||
import json from "rollup-plugin-json";
|
||||
import meta from "./package.json";
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
output: {
|
||||
file: "dist/browser.js",
|
||||
format: "iife",
|
||||
name: "freesewing.plugins.title"
|
||||
},
|
||||
plugins: [
|
||||
resolve({
|
||||
browser: true
|
||||
}),
|
||||
json(),
|
||||
commonjs(),
|
||||
babel({
|
||||
exclude: "node_modules/**"
|
||||
}),
|
||||
terser({
|
||||
output: {
|
||||
preamble: `/**\n * ${meta.name} | v${meta.version}\n * ${
|
||||
meta.description
|
||||
}\n * (c) ${new Date().getFullYear()} ${meta.author}\n * @license ${
|
||||
meta.license
|
||||
}\n */`
|
||||
}
|
||||
})
|
||||
]
|
||||
};
|
33
packages/plugin-title/rollup.node.js
Normal file
33
packages/plugin-title/rollup.node.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
import { terser } from "rollup-plugin-terser";
|
||||
import filesize from "rollup-plugin-filesize";
|
||||
import babel from "rollup-plugin-babel";
|
||||
import json from "rollup-plugin-json";
|
||||
import resolve from "rollup-plugin-node-resolve";
|
||||
import meta from "./package.json";
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
output: {
|
||||
file: "dist/node.js",
|
||||
format: "es"
|
||||
},
|
||||
plugins: [
|
||||
resolve({
|
||||
browser: false
|
||||
}),
|
||||
json(),
|
||||
babel({
|
||||
exclude: "node_modules/**"
|
||||
}),
|
||||
filesize()
|
||||
//terser({
|
||||
// output: {
|
||||
// preamble: `/**\n * ${meta.name} | v${meta.version}\n * ${
|
||||
// meta.description
|
||||
// }\n * (c) ${new Date().getFullYear()} ${meta.author}\n * @license ${
|
||||
// meta.license
|
||||
// }\n */`
|
||||
// }
|
||||
//})
|
||||
]
|
||||
};
|
|
@ -1,26 +1,30 @@
|
|||
import style from './lib/style';
|
||||
const VERSION = require('../package.json').version;
|
||||
import style from "./lib/style";
|
||||
import { version } from "../package.json";
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
hooks: {
|
||||
preRenderSvg: function(next) {
|
||||
// Without this, our custom attribute won't be valid
|
||||
this.attributes.add("xmlns:freesewing-plugins", "http://freesewing.org/namespaces/freesewing-plugins");
|
||||
this.attributes.add("freesewing-plugins:macro-title", VERSION);
|
||||
this.attributes.add("freesewing:plugin-title", version);
|
||||
this.style += style;
|
||||
next();
|
||||
}
|
||||
}
|
||||
, macros: {
|
||||
},
|
||||
macros: {
|
||||
title: function(next, so) {
|
||||
so.at.attr('data-text', so.nr).attr('data-text-class', 'title-nr');
|
||||
this.points.titleName = so.at.shift(-90, 20)
|
||||
.attr('data-text', title)
|
||||
.attr('data-text-class', 'title-name');
|
||||
this.points.titlePattern = so.at.shift(-90, 40)
|
||||
.attr('data-text', pattern)
|
||||
.attr('data-text-class', 'title-pattern');
|
||||
console.log("in plugin, so", so, this);
|
||||
so.at.attr("data-text", so.nr).attr("data-text-class", "title-nr note");
|
||||
this.points.titleName = so.at
|
||||
.shift(-90, 13)
|
||||
.attr("data-text", so.title || this.id)
|
||||
.attr("data-text-class", "title-name");
|
||||
this.points.titlePattern = so.at
|
||||
.shift(-90, 20)
|
||||
.attr(
|
||||
"data-text",
|
||||
this.context.config.name + " v" + this.context.config.version
|
||||
)
|
||||
.attr("data-text-class", "title-pattern fill-note");
|
||||
next();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
module.exports = `
|
||||
<marker orient="auto" refY="0.0" refX="0.0" id="cutonfoldFrom" style="overflow:visible;" >
|
||||
<path style="stroke: #ff5b77; fill: #ff5b77;" d="M 0,0 L 12,-4 C 10,-2 10,2 12, 4 z" />
|
||||
</marker>
|
||||
<marker orient="auto" refY="0.0" refX="0.0" id="cutonfoldTo" style="overflow:visible;" >
|
||||
<path style="stroke: #ff5b77; fill: #ff5b77;" d="M 0,0 L -12,-4 C -10,-2 -10,2 -12, 4 z" />
|
||||
</marker>
|
||||
`;
|
20
packages/plugin-title/src/lib/style.css
Normal file
20
packages/plugin-title/src/lib/style.css
Normal file
|
@ -0,0 +1,20 @@
|
|||
text.title-nr {
|
||||
font-size: 24pt;
|
||||
font-weight: 700;
|
||||
fill: none;
|
||||
text-anchor: middle;
|
||||
dominant-baseline: reset-size;
|
||||
}
|
||||
text.title-name {
|
||||
font-size: 7pt;
|
||||
font-weight: 500;
|
||||
text-anchor: middle;
|
||||
dominant-baseline: reset-size;
|
||||
}
|
||||
text.title-pattern {
|
||||
font-size: 4pt;
|
||||
font-weight: 500;
|
||||
dominant-baseline: reset-size;
|
||||
text-anchor: middle;
|
||||
font-style: italic;
|
||||
}
|
|
@ -1,5 +1 @@
|
|||
module.exports = `
|
||||
text.title-nr{ font-size: 24; }
|
||||
text.title-name{ font-size: 16; }
|
||||
text.title-pattern{ font-size: 6; }
|
||||
`;
|
||||
export default `text.title-nr{font-size:24pt;font-weight:700;fill:none;text-anchor:middle;dominant-baseline:reset-size}text.title-name{font-size:7pt;font-weight:500;text-anchor:middle;dominant-baseline:reset-size}text.title-pattern{font-size:4pt;font-weight:500;dominant-baseline:reset-size;text-anchor:middle;font-style:italic}`;
|
||||
|
|
1
packages/plugin-title/src/lib/style.min.css
vendored
Normal file
1
packages/plugin-title/src/lib/style.min.css
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
text.title-nr{font-size:24pt;font-weight:700;fill:none;text-anchor:middle;dominant-baseline:reset-size}text.title-name{font-size:7pt;font-weight:500;text-anchor:middle;dominant-baseline:reset-size}text.title-pattern{font-size:4pt;font-weight:500;dominant-baseline:reset-size;text-anchor:middle;font-style:italic}
|
|
@ -1,39 +0,0 @@
|
|||
const path = require('path');
|
||||
var webpack = require('webpack');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
target: 'web',
|
||||
entry: './src/index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: '_bundle.js',
|
||||
libraryTarget: 'var',
|
||||
library: 'freesewing_macro_title'
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
VERSION: JSON.stringify(require("./package.json").version)
|
||||
}),
|
||||
new webpack.IgnorePlugin(/^\.\.\/package.json$/)
|
||||
],
|
||||
module: {
|
||||
rules:[
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env']
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.txt$/,
|
||||
exclude: /node_modules/,
|
||||
use: 'raw-loader'
|
||||
},
|
||||
]
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue