🚧 Work on React components and releases
This commit is contained in:
parent
10fc688be1
commit
9d54e25020
93 changed files with 1253 additions and 1785 deletions
|
@ -29,6 +29,9 @@
|
|||
"pubtest": "npm publish --registry http://localhost:6662",
|
||||
"publish": "npm build && npm publish --access=public --tag=alpha"
|
||||
},
|
||||
"peerDependencies": {},
|
||||
"dependencies": {},
|
||||
"devDependencies": {},
|
||||
"files": [
|
||||
"dist/*",
|
||||
"README.md",
|
||||
|
@ -41,6 +44,5 @@
|
|||
"engines": {
|
||||
"node": ">=8.0.0",
|
||||
"npm": ">=5"
|
||||
},
|
||||
"gitHead": "aec02a355494839184b3ae4598322912386badf6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,9 @@ const formatImperial = (
|
|||
format = "html"
|
||||
) => {
|
||||
if (format === "html") {
|
||||
if (numo) return `<span>${neg}${inch}<sup>${numo}</sup>/<sub>${deno}</sub></span>`;
|
||||
else return `<span>{neg}{inch}</span>`;
|
||||
if (numo)
|
||||
return `<span>${neg}${inch}<sup>${numo}</sup>/<sub>${deno}</sub></span>`;
|
||||
else return `<span>${neg}${inch}</span>`;
|
||||
} else {
|
||||
if (numo) return `${neg}${inch}`;
|
||||
else return `${neg}${inch} ${numo}/${deno}`;
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
import defaultGist from "./defaultGist";
|
||||
import optionDefault from "./optionDefault";
|
||||
|
||||
const gistDefaults = (options, gist = false) => {
|
||||
if (!gist) gist = defaultGist;
|
||||
for (let option of Object.keys(options)) {
|
||||
if (
|
||||
typeof gist.options !== "undefined" &&
|
||||
typeof gist.options[option] !== undefined
|
||||
)
|
||||
options[option] = gist.options[option];
|
||||
else options[option] = optionDefault(options[option]);
|
||||
}
|
||||
delete gist.options;
|
||||
let settings = JSON.parse(JSON.stringify(defaultGist.settings));
|
||||
delete settings.locale;
|
||||
delete settings.units;
|
||||
for (let setting of Object.keys(settings)) {
|
||||
if (typeof gist.settings[setting] !== "undefined") {
|
||||
settings[setting] = gist.settings[setting];
|
||||
}
|
||||
}
|
||||
settings.options = options;
|
||||
|
||||
return settings;
|
||||
};
|
||||
|
||||
export default gistDefaults;
|
|
@ -1,14 +1,14 @@
|
|||
export { default as smallestImperialStep } from "./smallestImperialStep";
|
||||
export { default as cloneObject } from "./cloneObject";
|
||||
export { default as defaultGist } from "./defaultGist";
|
||||
export { default as defaultSa } from "./defaultSa";
|
||||
export { default as formatImperial } from "./formatImperial";
|
||||
export { default as formatMm } from "./formatMm";
|
||||
export { default as optionDefault } from "./optionDefault";
|
||||
export { default as optionType } from "./optionType";
|
||||
export { default as partList } from "./partList";
|
||||
export { default as roundMm } from "./roundMm";
|
||||
export { default as roundMmDown } from "./roundMmDown";
|
||||
export { default as roundMmUp } from "./roundMmUp";
|
||||
export { default as formatImperial } from "./formatImperial";
|
||||
export { default as formatMm } from "./formatMm";
|
||||
export { default as defaultSa } from "./defaultSa";
|
||||
export { default as sliderStep } from "./sliderStep";
|
||||
export { default as optionType } from "./optionType";
|
||||
export { default as defaultGist } from "./defaultGist";
|
||||
export { default as gistDefaults } from "./gistDefaults";
|
||||
export { default as optionDefault } from "./optionDefault";
|
||||
export { default as smallestImperialStep } from "./smallestImperialStep";
|
||||
export { default as storage } from "./storage";
|
||||
export { default as cloneObject } from "./cloneObject";
|
||||
|
|
29
packages/utils/src/partList.js
Normal file
29
packages/utils/src/partList.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
const partList = config => {
|
||||
let parts = {};
|
||||
if (config.parts) {
|
||||
for (let p of config.parts) parts[p] = p;
|
||||
}
|
||||
if (config.dependencies) {
|
||||
for (let p of Object.keys(config.dependencies)) {
|
||||
parts[p] = p;
|
||||
if (typeof config.dependencies[p] === "string") {
|
||||
parts[config.dependencies[p]] = config.dependencies[p];
|
||||
} else {
|
||||
for (let d of config.dependencies[p]) parts[d] = d;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config.inject) {
|
||||
for (let p of Object.keys(config.inject)) {
|
||||
parts[p] = p;
|
||||
parts[config.inject[p]] = config.inject[p];
|
||||
}
|
||||
}
|
||||
if (config.hide) {
|
||||
for (let p of config.hide) delete parts[p];
|
||||
}
|
||||
|
||||
return Object.keys(parts);
|
||||
};
|
||||
|
||||
export default partList;
|
Loading…
Add table
Add a link
Reference in a new issue