Skip to content

Commit

Permalink
➕ Add binder icon (#6)
Browse files Browse the repository at this point in the history
Co-authored-by: Rowan Cockett <[email protected]>
  • Loading branch information
agoose77 and rowanc1 authored Feb 6, 2025
1 parent 65fc6be commit 4295af6
Show file tree
Hide file tree
Showing 15 changed files with 237 additions and 188 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ npm install @scienceicons/react
Now each icon can be imported individually as a React component:

```js
import { OpenAccessIcon } from '@scienceicons/react/24/solid'
import { OpenAccessIcon } from '@scienceicons/react/24/solid';

function MyComponent() {
return (
<div>
<OpenAccessIcon className="h-6 w-6 text-blue-500" />
<p>...</p>
</div>
)
);
}
```

Expand Down Expand Up @@ -61,11 +61,11 @@ Now each icon can be imported individually as a Vue component:
</template>
<script>
import { OpenAccessIcon } from '@scienceicons/vue/24/solid'
import { OpenAccessIcon } from '@scienceicons/vue/24/solid';
export default {
components: { OpenAccessIcon },
}
};
</script>
```

Expand Down
1 change: 1 addition & 0 deletions myst/src/names.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
{ "name": "arxiv", "componentName": "ArxivIcon" },
{ "name": "binder", "componentName": "BinderIcon" },
{ "name": "cc-by", "componentName": "CcByIcon" },
{ "name": "cc-nc", "componentName": "CcNcIcon" },
{ "name": "cc-nd", "componentName": "CcNdIcon" },
Expand Down
5 changes: 5 additions & 0 deletions optimized/24/solid/binder.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"prebuild": "rimraf ./{20,24} ./{vue,react}/{20,24} ./optimized/{20,24}",
"build": "npm run build-24-outline && npm run build-20-solid && npm run build-24-solid && npm run build-react && npm run build-vue",
"build-react": "node ./scripts/build.js react",
"lint:format": "prettier --check \"scripts/*.{js,mjs,ts,tsx,md}\" \"./*.{js,mjs,ts,tsx,md}\"",
"build-vue": "node ./scripts/build.js vue",
"build-typst": "node ./scripts/typst.js; typst compile typst/docs/scienceicons.typ --root typst",
"build-24-outline": "rimraf ./24/outline ./optimized/24/outline && svgo --config=svgo.24.outline.yaml -f ./src/24/outline -o ./optimized/24/outline --pretty --indent=2 && mkdir -p ./24 && cp -R ./optimized/24/outline ./24/outline",
Expand All @@ -32,6 +33,7 @@
"@svgr/core": "^5.5.0",
"@vue/compiler-dom": "^3.0.5",
"camelcase": "^6.0.0",
"prettier": "^3.4.2",
"rimraf": "^3.0.2",
"svgo": "^1.3.2"
}
Expand Down
4 changes: 3 additions & 1 deletion prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module.exports = {
singleQuote: true,
semi: false,
trailingComma: 'all',
printWidth: 100,
semi: true,
tabWidth: 2,
};
108 changes: 55 additions & 53 deletions scienceicons.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// node_modules/nanoid/index.js
import { randomFillSync } from "crypto";
import { randomFillSync } from 'crypto';
var POOL_SIZE_MULTIPLIER = 128;
var pool;
var poolOffset;
Expand All @@ -15,19 +15,19 @@ var fillPool = (bytes) => {
poolOffset += bytes;
};
var random = (bytes) => {
fillPool(bytes -= 0);
fillPool((bytes -= 0));
return pool.subarray(poolOffset - bytes, poolOffset);
};
var customRandom = (alphabet, defaultSize, getRandom) => {
let mask = (2 << 31 - Math.clz32(alphabet.length - 1 | 1)) - 1;
let step = Math.ceil(1.6 * mask * defaultSize / alphabet.length);
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1;
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length);
return (size = defaultSize) => {
let id = "";
let id = '';
while (true) {
let bytes = getRandom(step);
let i = step;
while (i--) {
id += alphabet[bytes[i] & mask] || "";
id += alphabet[bytes[i] & mask] || '';
if (id.length === size) return id;
}
}
Expand All @@ -37,75 +37,77 @@ var customAlphabet = (alphabet, size = 21) => customRandom(alphabet, size, rando

// node_modules/myst-common/dist/utils.js
function addMessageInfo(message, info) {
if (info === null || info === void 0 ? void 0 : info.note)
message.note = info.note;
if (info === null || info === void 0 ? void 0 : info.url)
message.url = info.url;
if (info === null || info === void 0 ? void 0 : info.ruleId)
message.ruleId = info.ruleId;
if (info === null || info === void 0 ? void 0 : info.fatal)
message.fatal = true;
if (info === null || info === void 0 ? void 0 : info.note) message.note = info.note;
if (info === null || info === void 0 ? void 0 : info.url) message.url = info.url;
if (info === null || info === void 0 ? void 0 : info.ruleId) message.ruleId = info.ruleId;
if (info === null || info === void 0 ? void 0 : info.fatal) message.fatal = true;
return message;
}
function fileWarn(file, message, opts) {
return addMessageInfo(file.message(message, opts === null || opts === void 0 ? void 0 : opts.node, opts === null || opts === void 0 ? void 0 : opts.source), opts);
return addMessageInfo(
file.message(
message,
opts === null || opts === void 0 ? void 0 : opts.node,
opts === null || opts === void 0 ? void 0 : opts.source,
),
opts,
);
}
var az = "abcdefghijklmnopqrstuvwxyz";
var az = 'abcdefghijklmnopqrstuvwxyz';
var alpha = az + az.toUpperCase();
var numbers = "0123456789";
var numbers = '0123456789';
var nanoidAZ = customAlphabet(alpha, 1);
var nanoidAZ9 = customAlphabet(alpha + numbers, 9);

// src/names.json
var names_default = [
{ name: "arxiv", componentName: "ArxivIcon" },
{ name: "cc-by", componentName: "CcByIcon" },
{ name: "cc-nc", componentName: "CcNcIcon" },
{ name: "cc-nd", componentName: "CcNdIcon" },
{ name: "cc-sa", componentName: "CcSaIcon" },
{ name: "cc-zero", componentName: "CcZeroIcon" },
{ name: "cc", componentName: "CcIcon" },
{ name: "curvenote", componentName: "CurvenoteIcon" },
{ name: "discord", componentName: "DiscordIcon" },
{ name: "discourse", componentName: "DiscourseIcon" },
{ name: "email", componentName: "EmailIcon" },
{ name: "github", componentName: "GithubIcon" },
{ name: "jupyter-book", componentName: "JupyterBookIcon" },
{ name: "jupyter-text", componentName: "JupyterTextIcon" },
{ name: "jupyter", componentName: "JupyterIcon" },
{ name: "linkedin", componentName: "LinkedinIcon" },
{ name: "mastodon", componentName: "MastodonIcon" },
{ name: "myst", componentName: "MystIcon" },
{ name: "open-access", componentName: "OpenAccessIcon" },
{ name: "orcid", componentName: "OrcidIcon" },
{ name: "osi", componentName: "OsiIcon" },
{ name: "ror", componentName: "RorIcon" },
{ name: "slack", componentName: "SlackIcon" },
{ name: "twitter", componentName: "TwitterIcon" },
{ name: "website", componentName: "WebsiteIcon" },
{ name: "youtube", componentName: "YoutubeIcon" }
{ name: 'arxiv', componentName: 'ArxivIcon' },
{ name: 'binder', componentName: 'BinderIcon' },
{ name: 'cc-by', componentName: 'CcByIcon' },
{ name: 'cc-nc', componentName: 'CcNcIcon' },
{ name: 'cc-nd', componentName: 'CcNdIcon' },
{ name: 'cc-sa', componentName: 'CcSaIcon' },
{ name: 'cc-zero', componentName: 'CcZeroIcon' },
{ name: 'cc', componentName: 'CcIcon' },
{ name: 'curvenote', componentName: 'CurvenoteIcon' },
{ name: 'discord', componentName: 'DiscordIcon' },
{ name: 'discourse', componentName: 'DiscourseIcon' },
{ name: 'email', componentName: 'EmailIcon' },
{ name: 'github', componentName: 'GithubIcon' },
{ name: 'jupyter-book', componentName: 'JupyterBookIcon' },
{ name: 'jupyter-text', componentName: 'JupyterTextIcon' },
{ name: 'jupyter', componentName: 'JupyterIcon' },
{ name: 'linkedin', componentName: 'LinkedinIcon' },
{ name: 'mastodon', componentName: 'MastodonIcon' },
{ name: 'myst', componentName: 'MystIcon' },
{ name: 'open-access', componentName: 'OpenAccessIcon' },
{ name: 'orcid', componentName: 'OrcidIcon' },
{ name: 'osi', componentName: 'OsiIcon' },
{ name: 'ror', componentName: 'RorIcon' },
{ name: 'slack', componentName: 'SlackIcon' },
{ name: 'twitter', componentName: 'TwitterIcon' },
{ name: 'website', componentName: 'WebsiteIcon' },
{ name: 'youtube', componentName: 'YoutubeIcon' },
];

// src/scienceicons.ts
var SUPPORTED_ICONS = names_default.map((icon) => icon.name);
var iconRole = {
name: "scienceicon",
alias: ["scicon"],
name: 'scienceicon',
alias: ['scicon'],
body: {
type: String,
required: true,
doc: "The kind of icon to display"
doc: 'The kind of icon to display',
},
run(data, vfile, ctx) {
if (!SUPPORTED_ICONS.includes(data.body)) {
return fileWarn(vfile, `Unknown kind of scienceicon: ${data.body}`);
}
return [{ type: "scienceicon", value: data.body, kind: data.body }];
}
return [{ type: 'scienceicon', value: data.body, kind: data.body }];
},
};
var plugin = { name: "Science Icons by Curvenote", roles: [iconRole] };
var plugin = { name: 'Science Icons by Continuous Science Foundation', roles: [iconRole] };
var scienceicons_default = plugin;
export {
scienceicons_default as default
};
//# sourceMappingURL=scienceicons.mjs.map
export { scienceicons_default as default };
//# sourceMappingURL=scienceicons.mjs.map
Loading

0 comments on commit 4295af6

Please sign in to comment.