Skip to content

Commit

Permalink
feat: support solved-icon component by vendoring stoplight/elements
Browse files Browse the repository at this point in the history
  • Loading branch information
RanolP committed Mar 1, 2024
1 parent db968a0 commit f2a04ed
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 1 deletion.
58 changes: 57 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<meta name="twitter:card" content="summary_large_image" />

<link rel="icon" type="svg" href="favicon.svg" />
<script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
<script src="vendors/stoplight-elements.min.js"></script>
<link
rel="stylesheet"
href="https://unpkg.com/@stoplight/elements/styles.min.css"
Expand All @@ -59,6 +59,33 @@
display: block;
height: 100vh;
}
/* directly taken from solved.ac */
.solve-tier-bronze {
color: #c67739;
}
.solve-tier-silver {
color: #4e6a86;
}
.solve-tier-gold {
color: #ffb028;
}
.solve-tier-platinum {
color: #51fdbd;
}
.solve-tier-diamond {
color: #2bbfff;
}
.solve-tier-ruby {
color: #ff3071;
}
.solve-tier-master {
background-color: #b491ff;
background-image: linear-gradient(0deg, #ff7ca8, #b491ff, #7cf9ff);
background-size: 80%;
background-repeat: repeat;
background-clip: text;
-webkit-text-fill-color: transparent;
}
</style>
</head>

Expand All @@ -72,4 +99,33 @@
layout="responsive"
/>
</body>
<script type="module">
import { define, html } from 'https://esm.sh/hybrids@^8';

define({
tag: 'solved-icon',
type: '',
content: ({ type }) => {
const iconMap = {
'solve-tier': () => {
const match = /solve-tier:(\d+)/.exec(type);
return match
? `https://static.solved.ac/tier_small/${match[1]}.svg`
: null;
},
};
const src = Object.entries(iconMap).find(([namespace, f]) =>
type?.startsWith(namespace),
)?.[1]();
return html` <img src="${src}" /> `.css`
img {
display: inline-block;
width: 1em;
height: 1em;
vertical-align: middle;
}
`;
},
});
</script>
</html>
2 changes: 2 additions & 0 deletions vendors/stoplight-elements.min.js

Large diffs are not rendered by default.

177 changes: 177 additions & 0 deletions vendors/stoplight-elements.min.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/

/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/

/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/

/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/*!
* EventEmitter v5.2.9 - git.io/ee
* Unlicense - http://unlicense.org/
* Oliver Caldwell - https://oli.me.uk/
* @preserve
*/

/*!
* Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2022 Fonticons, Inc.
*/

/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/

/*!
* URI.js - Mutating URLs
*
* Version: 1.19.11
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/

/*!
* URI.js - Mutating URLs
* IPv6 Support
*
* Version: 1.19.11
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/

/*!
* URI.js - Mutating URLs
* Second Level Domain (SLD) Support
*
* Version: 1.19.11
*
* Author: Rodney Rehm
* Web: http://medialize.github.io/URI.js/
*
* Licensed under
* MIT License http://www.opensource.org/licenses/mit-license
*
*/

/*!
* repeat-string <https://github.com/jonschlinkert/repeat-string>
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/

/*!
* focus-trap 7.5.4
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
*/

/*!
* tabbable 6.2.0
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

/*! https://mths.be/punycode v1.3.2 by @mathias */

/*! https://mths.be/punycode v1.4.0 by @mathias */

/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/

/** @license React v0.19.1
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.14.0
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.14.0
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

/** @license React v16.14.0
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

0 comments on commit f2a04ed

Please sign in to comment.