18 | |
19 | 📖sitemap
20 | |
21 | 🏔WangPF
22 |
23 |
24 | 本站采用
25 | NextJS
26 | 和
27 | ChakraUI
28 | 搭建,
29 | 感谢
30 | Github
31 | 提供的免费服务。
32 |
33 |
34 | );
35 |
36 | export default Footer;
37 |
--------------------------------------------------------------------------------
/src/components/githubLink.tsx:
--------------------------------------------------------------------------------
1 | import React from "react"
2 | import {IconButton, useColorMode} from "@chakra-ui/react"
3 | import {GoMarkGithub} from "react-icons/go";
4 | import {OutgoingLink} from "./link";
5 |
6 | interface Props {
7 | src?: string;
8 | }
9 |
10 | export const GithubLink: React.FC = (props) => {
11 | const {src} = props;
12 |
13 | const href = src ?? "https://github.com/pengfeiw/minicode";
14 |
15 | const {colorMode} = useColorMode();
16 | return (
17 |
18 | }
21 | isRound
22 | {...props}
23 | />
24 |
25 | );
26 | };
27 |
--------------------------------------------------------------------------------
/src/components/glslBackgrounds/glsl.ts:
--------------------------------------------------------------------------------
1 | import defaultBackground from "src/glsl/defaultBackground.fs";
2 | import waveBackground from "src/glsl/wave.fs";
3 | import vertLinesBackground from "src/glsl/vertLines.fs";
4 |
5 | const glslBackgrounds = {
6 | defaultBackground,
7 | waveBackground,
8 | vertLinesBackground
9 | };
10 |
11 | export type GlslBackgroundKeys = keyof typeof glslBackgrounds;
12 |
13 | export default glslBackgrounds;
14 |
--------------------------------------------------------------------------------
/src/components/glslBackgrounds/glslCanvas.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4 |
5 |
6 |
7 |
8 |
9 | function createCommonjsModule(fn, module) {
10 | return module = { exports: {} }, fn(module, module.exports), module.exports;
11 | }
12 |
13 | var win;
14 |
15 | if (typeof window !== "undefined") {
16 | win = window;
17 | } else if (typeof commonjsGlobal !== "undefined") {
18 | win = commonjsGlobal;
19 | } else if (typeof self !== "undefined"){
20 | win = self;
21 | } else {
22 | win = {};
23 | }
24 |
25 | var window_1 = win;
26 |
27 | var isFunction_1 = isFunction;
28 |
29 | var toString = Object.prototype.toString;
30 |
31 | function isFunction (fn) {
32 | var string = toString.call(fn);
33 | return string === '[object Function]' ||
34 | (typeof fn === 'function' && string !== '[object RegExp]') ||
35 | (typeof window !== 'undefined' &&
36 | // IE8 and below
37 | (fn === window.setTimeout ||
38 | fn === window.alert ||
39 | fn === window.confirm ||
40 | fn === window.prompt))
41 | }
42 |
43 | var trim_1 = createCommonjsModule(function (module, exports) {
44 | exports = module.exports = trim;
45 |
46 | function trim(str){
47 | return str.replace(/^\s*|\s*$/g, '');
48 | }
49 |
50 | exports.left = function(str){
51 | return str.replace(/^\s*/, '');
52 | };
53 |
54 | exports.right = function(str){
55 | return str.replace(/\s*$/, '');
56 | };
57 | });
58 |
59 | var forEach_1 = forEach;
60 |
61 | var toString$1 = Object.prototype.toString;
62 | var hasOwnProperty = Object.prototype.hasOwnProperty;
63 |
64 | function forEach(list, iterator, context) {
65 | if (!isFunction_1(iterator)) {
66 | throw new TypeError('iterator must be a function')
67 | }
68 |
69 | if (arguments.length < 3) {
70 | context = this;
71 | }
72 |
73 | if (toString$1.call(list) === '[object Array]')
74 | forEachArray$1(list, iterator, context);
75 | else if (typeof list === 'string')
76 | forEachString(list, iterator, context);
77 | else
78 | forEachObject(list, iterator, context);
79 | }
80 |
81 | function forEachArray$1(array, iterator, context) {
82 | for (var i = 0, len = array.length; i < len; i++) {
83 | if (hasOwnProperty.call(array, i)) {
84 | iterator.call(context, array[i], i, array);
85 | }
86 | }
87 | }
88 |
89 | function forEachString(string, iterator, context) {
90 | for (var i = 0, len = string.length; i < len; i++) {
91 | // no such thing as a sparse string.
92 | iterator.call(context, string.charAt(i), i, string);
93 | }
94 | }
95 |
96 | function forEachObject(object, iterator, context) {
97 | for (var k in object) {
98 | if (hasOwnProperty.call(object, k)) {
99 | iterator.call(context, object[k], k, object);
100 | }
101 | }
102 | }
103 |
104 | var isArray = function(arg) {
105 | return Object.prototype.toString.call(arg) === '[object Array]';
106 | };
107 |
108 | var parseHeaders = function (headers) {
109 | if (!headers)
110 | return {}
111 |
112 | var result = {};
113 |
114 | forEach_1(
115 | trim_1(headers).split('\n')
116 | , function (row) {
117 | var index = row.indexOf(':')
118 | , key = trim_1(row.slice(0, index)).toLowerCase()
119 | , value = trim_1(row.slice(index + 1));
120 |
121 | if (typeof(result[key]) === 'undefined') {
122 | result[key] = value;
123 | } else if (isArray(result[key])) {
124 | result[key].push(value);
125 | } else {
126 | result[key] = [ result[key], value ];
127 | }
128 | }
129 | );
130 |
131 | return result
132 | };
133 |
134 | var immutable = extend;
135 |
136 | var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
137 |
138 | function extend() {
139 | var target = {};
140 |
141 | for (var i = 0; i < arguments.length; i++) {
142 | var source = arguments[i];
143 |
144 | for (var key in source) {
145 | if (hasOwnProperty$1.call(source, key)) {
146 | target[key] = source[key];
147 | }
148 | }
149 | }
150 |
151 | return target
152 | }
153 |
154 | "use strict";
155 |
156 |
157 |
158 |
159 |
160 | var xhr = createXHR;
161 | // Allow use of default import syntax in TypeScript
162 | var default_1 = createXHR;
163 | createXHR.XMLHttpRequest = window_1.XMLHttpRequest || noop;
164 | createXHR.XDomainRequest = "withCredentials" in (new createXHR.XMLHttpRequest()) ? createXHR.XMLHttpRequest : window_1.XDomainRequest;
165 |
166 | forEachArray(["get", "put", "post", "patch", "head", "delete"], function(method) {
167 | createXHR[method === "delete" ? "del" : method] = function(uri, options, callback) {
168 | options = initParams(uri, options, callback);
169 | options.method = method.toUpperCase();
170 | return _createXHR(options)
171 | };
172 | });
173 |
174 | function forEachArray(array, iterator) {
175 | for (var i = 0; i < array.length; i++) {
176 | iterator(array[i]);
177 | }
178 | }
179 |
180 | function isEmpty(obj){
181 | for(var i in obj){
182 | if(obj.hasOwnProperty(i)) return false
183 | }
184 | return true
185 | }
186 |
187 | function initParams(uri, options, callback) {
188 | var params = uri;
189 |
190 | if (isFunction_1(options)) {
191 | callback = options;
192 | if (typeof uri === "string") {
193 | params = {uri:uri};
194 | }
195 | } else {
196 | params = immutable(options, {uri: uri});
197 | }
198 |
199 | params.callback = callback;
200 | return params
201 | }
202 |
203 | function createXHR(uri, options, callback) {
204 | options = initParams(uri, options, callback);
205 | return _createXHR(options)
206 | }
207 |
208 | function _createXHR(options) {
209 | if(typeof options.callback === "undefined"){
210 | throw new Error("callback argument missing")
211 | }
212 |
213 | var called = false;
214 | var callback = function cbOnce(err, response, body){
215 | if(!called){
216 | called = true;
217 | options.callback(err, response, body);
218 | }
219 | };
220 |
221 | function readystatechange() {
222 | if (xhr.readyState === 4) {
223 | setTimeout(loadFunc, 0);
224 | }
225 | }
226 |
227 | function getBody() {
228 | // Chrome with requestType=blob throws errors arround when even testing access to responseText
229 | var body = undefined;
230 |
231 | if (xhr.response) {
232 | body = xhr.response;
233 | } else {
234 | body = xhr.responseText || getXml(xhr);
235 | }
236 |
237 | if (isJson) {
238 | try {
239 | body = JSON.parse(body);
240 | } catch (e) {}
241 | }
242 |
243 | return body
244 | }
245 |
246 | function errorFunc(evt) {
247 | clearTimeout(timeoutTimer);
248 | if(!(evt instanceof Error)){
249 | evt = new Error("" + (evt || "Unknown XMLHttpRequest Error") );
250 | }
251 | evt.statusCode = 0;
252 | return callback(evt, failureResponse)
253 | }
254 |
255 | // will load the data & process the response in a special response object
256 | function loadFunc() {
257 | if (aborted) return
258 | var status;
259 | clearTimeout(timeoutTimer);
260 | if(options.useXDR && xhr.status===undefined) {
261 | //IE8 CORS GET successful response doesn't have a status field, but body is fine
262 | status = 200;
263 | } else {
264 | status = (xhr.status === 1223 ? 204 : xhr.status);
265 | }
266 | var response = failureResponse;
267 | var err = null;
268 |
269 | if (status !== 0){
270 | response = {
271 | body: getBody(),
272 | statusCode: status,
273 | method: method,
274 | headers: {},
275 | url: uri,
276 | rawRequest: xhr
277 | };
278 | if(xhr.getAllResponseHeaders){ //remember xhr can in fact be XDR for CORS in IE
279 | response.headers = parseHeaders(xhr.getAllResponseHeaders());
280 | }
281 | } else {
282 | err = new Error("Internal XMLHttpRequest Error");
283 | }
284 | return callback(err, response, response.body)
285 | }
286 |
287 | var xhr = options.xhr || null;
288 |
289 | if (!xhr) {
290 | if (options.cors || options.useXDR) {
291 | xhr = new createXHR.XDomainRequest();
292 | }else{
293 | xhr = new createXHR.XMLHttpRequest();
294 | }
295 | }
296 |
297 | var key;
298 | var aborted;
299 | var uri = xhr.url = options.uri || options.url;
300 | var method = xhr.method = options.method || "GET";
301 | var body = options.body || options.data;
302 | var headers = xhr.headers = options.headers || {};
303 | var sync = !!options.sync;
304 | var isJson = false;
305 | var timeoutTimer;
306 | var failureResponse = {
307 | body: undefined,
308 | headers: {},
309 | statusCode: 0,
310 | method: method,
311 | url: uri,
312 | rawRequest: xhr
313 | };
314 |
315 | if ("json" in options && options.json !== false) {
316 | isJson = true;
317 | headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json"); //Don't override existing accept header declared by user
318 | if (method !== "GET" && method !== "HEAD") {
319 | headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json"); //Don't override existing accept header declared by user
320 | body = JSON.stringify(options.json === true ? body : options.json);
321 | }
322 | }
323 |
324 | xhr.onreadystatechange = readystatechange;
325 | xhr.onload = loadFunc;
326 | xhr.onerror = errorFunc;
327 | // IE9 must have onprogress be set to a unique function.
328 | xhr.onprogress = function () {
329 | // IE must die
330 | };
331 | xhr.onabort = function(){
332 | aborted = true;
333 | };
334 | xhr.ontimeout = errorFunc;
335 | xhr.open(method, uri, !sync, options.username, options.password);
336 | //has to be after open
337 | if(!sync) {
338 | xhr.withCredentials = !!options.withCredentials;
339 | }
340 | // Cannot set timeout with sync request
341 | // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly
342 | // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent
343 | if (!sync && options.timeout > 0 ) {
344 | timeoutTimer = setTimeout(function(){
345 | if (aborted) return
346 | aborted = true;//IE9 may still call readystatechange
347 | xhr.abort("timeout");
348 | var e = new Error("XMLHttpRequest timeout");
349 | e.code = "ETIMEDOUT";
350 | errorFunc(e);
351 | }, options.timeout );
352 | }
353 |
354 | if (xhr.setRequestHeader) {
355 | for(key in headers){
356 | if(headers.hasOwnProperty(key)){
357 | xhr.setRequestHeader(key, headers[key]);
358 | }
359 | }
360 | } else if (options.headers && !isEmpty(options.headers)) {
361 | throw new Error("Headers cannot be set on an XDomainRequest object")
362 | }
363 |
364 | if ("responseType" in options) {
365 | xhr.responseType = options.responseType;
366 | }
367 |
368 | if ("beforeSend" in options &&
369 | typeof options.beforeSend === "function"
370 | ) {
371 | options.beforeSend(xhr);
372 | }
373 |
374 | // Microsoft Edge browser sends "undefined" when send is called with undefined value.
375 | // XMLHttpRequest spec says to pass null as body to indicate no body
376 | // See https://github.com/naugtur/xhr/issues/100.
377 | xhr.send(body || null);
378 |
379 | return xhr
380 |
381 |
382 | }
383 |
384 | function getXml(xhr) {
385 | // xhr.responseXML will throw Exception "InvalidStateError" or "DOMException"
386 | // See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML.
387 | try {
388 | if (xhr.responseType === "document") {
389 | return xhr.responseXML
390 | }
391 | var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror";
392 | if (xhr.responseType === "" && !firefoxBugTakenEffect) {
393 | return xhr.responseXML
394 | }
395 | } catch (e) {}
396 |
397 | return null
398 | }
399 |
400 | function noop() {}
401 |
402 | xhr.default = default_1;
403 |
404 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
405 | return typeof obj;
406 | } : function (obj) {
407 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
408 | };
409 |
410 |
411 |
412 |
413 |
414 | var asyncGenerator = function () {
415 | function AwaitValue(value) {
416 | this.value = value;
417 | }
418 |
419 | function AsyncGenerator(gen) {
420 | var front, back;
421 |
422 | function send(key, arg) {
423 | return new Promise(function (resolve, reject) {
424 | var request = {
425 | key: key,
426 | arg: arg,
427 | resolve: resolve,
428 | reject: reject,
429 | next: null
430 | };
431 |
432 | if (back) {
433 | back = back.next = request;
434 | } else {
435 | front = back = request;
436 | resume(key, arg);
437 | }
438 | });
439 | }
440 |
441 | function resume(key, arg) {
442 | try {
443 | var result = gen[key](arg);
444 | var value = result.value;
445 |
446 | if (value instanceof AwaitValue) {
447 | Promise.resolve(value.value).then(function (arg) {
448 | resume("next", arg);
449 | }, function (arg) {
450 | resume("throw", arg);
451 | });
452 | } else {
453 | settle(result.done ? "return" : "normal", result.value);
454 | }
455 | } catch (err) {
456 | settle("throw", err);
457 | }
458 | }
459 |
460 | function settle(type, value) {
461 | switch (type) {
462 | case "return":
463 | front.resolve({
464 | value: value,
465 | done: true
466 | });
467 | break;
468 |
469 | case "throw":
470 | front.reject(value);
471 | break;
472 |
473 | default:
474 | front.resolve({
475 | value: value,
476 | done: false
477 | });
478 | break;
479 | }
480 |
481 | front = front.next;
482 |
483 | if (front) {
484 | resume(front.key, front.arg);
485 | } else {
486 | back = null;
487 | }
488 | }
489 |
490 | this._invoke = send;
491 |
492 | if (typeof gen.return !== "function") {
493 | this.return = undefined;
494 | }
495 | }
496 |
497 | if (typeof Symbol === "function" && Symbol.asyncIterator) {
498 | AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
499 | return this;
500 | };
501 | }
502 |
503 | AsyncGenerator.prototype.next = function (arg) {
504 | return this._invoke("next", arg);
505 | };
506 |
507 | AsyncGenerator.prototype.throw = function (arg) {
508 | return this._invoke("throw", arg);
509 | };
510 |
511 | AsyncGenerator.prototype.return = function (arg) {
512 | return this._invoke("return", arg);
513 | };
514 |
515 | return {
516 | wrap: function (fn) {
517 | return function () {
518 | return new AsyncGenerator(fn.apply(this, arguments));
519 | };
520 | },
521 | await: function (value) {
522 | return new AwaitValue(value);
523 | }
524 | };
525 | }();
526 |
527 |
528 |
529 |
530 |
531 | var classCallCheck = function (instance, Constructor) {
532 | if (!(instance instanceof Constructor)) {
533 | throw new TypeError("Cannot call a class as a function");
534 | }
535 | };
536 |
537 | var createClass = function () {
538 | function defineProperties(target, props) {
539 | for (var i = 0; i < props.length; i++) {
540 | var descriptor = props[i];
541 | descriptor.enumerable = descriptor.enumerable || false;
542 | descriptor.configurable = true;
543 | if ("value" in descriptor) descriptor.writable = true;
544 | Object.defineProperty(target, descriptor.key, descriptor);
545 | }
546 | }
547 |
548 | return function (Constructor, protoProps, staticProps) {
549 | if (protoProps) defineProperties(Constructor.prototype, protoProps);
550 | if (staticProps) defineProperties(Constructor, staticProps);
551 | return Constructor;
552 | };
553 | }();
554 |
555 |
556 |
557 |
558 |
559 |
560 |
561 |
562 |
563 |
564 |
565 |
566 |
567 |
568 |
569 |
570 |
571 |
572 |
573 |
574 |
575 |
576 |
577 |
578 |
579 |
580 |
581 |
582 |
583 |
584 |
585 |
586 |
587 |
588 |
589 |
590 |
591 |
592 |
593 |
594 |
595 | var toConsumableArray = function (arr) {
596 | if (Array.isArray(arr)) {
597 | for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
598 |
599 | return arr2;
600 | } else {
601 | return Array.from(arr);
602 | }
603 | };
604 |
605 | var lastError = '';
606 |
607 | /**
608 | * Creates the HTLM for a failure message
609 | * @param {string} canvasContainerId id of container of th
610 | * canvas.
611 | * @return {string} The html.
612 | */
613 | function makeFailHTML(msg) {
614 | return '\n
\n
\n
\n
' + msg + '
\n
\n
\n';
615 | }
616 |
617 | /**
618 | * Message for getting a webgl browser
619 | * @type {string}
620 | */
621 | var GET_A_WEBGL_BROWSER = '\n\tThis page requires a browser that supports WebGL. \n\tClick here to upgrade your browser.\n';
622 |
623 | /**
624 | * Message for need better hardware
625 | * @type {string}
626 | */
627 | var OTHER_PROBLEM = '\n\tIt does not appear your computer can support WebGL. \n\tClick here for more information.\n';
628 |
629 | /**
630 | * Code to return in `onError` callback when the browser doesn't support webgl
631 | * @type {number}
632 | */
633 | var ERROR_BROWSER_SUPPORT = 1;
634 |
635 | /**
636 | * Code to return in `onError` callback there's any other problem related to webgl
637 | * @type {number}
638 | */
639 | var ERROR_OTHER = 2;
640 |
641 | /**
642 | * Creates a webgl context. If creation fails it will
643 | * change the contents of the container of the