Initial commit: 11ty website with Fire/Frost branding

This commit is contained in:
The Trinity
2026-04-02 18:39:00 -05:00
commit 40b45dff2e
1646 changed files with 329080 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { isPlainObject } from "@11ty/eleventy-utils";
// via https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
function DeepFreeze(obj, topLevelExceptions) {
for (let name of Reflect.ownKeys(obj)) {
if ((topLevelExceptions || []).find((key) => key === name)) {
continue;
}
const value = obj[name];
if (isPlainObject(value)) {
DeepFreeze(value);
}
}
return Object.freeze(obj);
}
export { DeepFreeze };

View File

@@ -0,0 +1,9 @@
export default function objectFilter(obj, callback) {
let newObject = {};
for (let [key, value] of Object.entries(obj || {})) {
if (callback(value, key)) {
newObject[key] = value;
}
}
return newObject;
}

View File

@@ -0,0 +1,118 @@
import types from "node:util/types";
import debugUtil from "debug";
import { isPlainObject } from "@11ty/eleventy-utils";
const debug = debugUtil("Dev:Eleventy:Proxy");
function wrapObject(target, fallback) {
if (Object.isFrozen(target)) {
return target;
}
return new Proxy(target, {
getOwnPropertyDescriptor(target, prop) {
let ret;
if (Reflect.has(target, prop)) {
ret = Reflect.getOwnPropertyDescriptor(target, prop);
} else if (Reflect.has(fallback, prop)) {
ret = Reflect.getOwnPropertyDescriptor(fallback, prop);
}
return ret;
},
has(target, prop) {
if (Reflect.has(target, prop)) {
return true;
}
return Reflect.has(fallback, prop);
},
ownKeys(target) {
let s = new Set();
// The fallback keys need to come first to preserve proper key order
// https://github.com/11ty/eleventy/issues/3849
if (isPlainObject(fallback)) {
for (let k of Reflect.ownKeys(fallback)) {
s.add(k);
}
}
for (let k of Reflect.ownKeys(target)) {
if (!s.has(k)) {
s.add(k);
}
}
return Array.from(s);
},
get(target, prop) {
debug("handler:get", prop);
let value = Reflect.get(target, prop);
if (Reflect.has(target, prop)) {
// Already proxied
if (types.isProxy(value)) {
return value;
}
if (isPlainObject(value) && Reflect.has(fallback, prop)) {
if (Object.isFrozen(value)) {
return value;
}
let ret = wrapObject(value, Reflect.get(fallback, prop));
debug("handler:get (primary, object)", prop);
return ret;
}
debug("handler:get (primary)", prop);
return value;
}
// Does not exist in primary
if (
(typeof fallback === "object" || typeof fallback === "function") &&
Reflect.has(fallback, prop)
) {
// fallback has prop
let fallbackValue = Reflect.get(fallback, prop);
if (isPlainObject(fallbackValue)) {
if (Object.isFrozen(fallbackValue)) {
return fallbackValue;
}
debug("handler:get (fallback, object)", prop);
// set empty object on primary
let emptyObject = {};
Reflect.set(target, prop, emptyObject);
return wrapObject(emptyObject, fallbackValue);
}
debug("handler:get (fallback)", prop);
return fallbackValue;
}
// primary *and* fallback do _not_ have prop
debug("handler:get (not on primary or fallback)", prop);
return value;
},
set(target, prop, value) {
debug("handler:set", prop);
return Reflect.set(target, prop, value);
},
});
}
function ProxyWrap(target, fallback) {
if (!isPlainObject(target) || !isPlainObject(fallback)) {
throw new Error("ProxyWrap expects objects for both the target and fallback");
}
return wrapObject(target, fallback);
}
export { ProxyWrap };

View File

@@ -0,0 +1 @@
export default {};

View File

@@ -0,0 +1,136 @@
class Sortable {
constructor() {
this.isSortAscending = true;
this.isSortNumeric = false;
this.items = [];
this._dirty = true;
this.sortFunctionStringMap = {
"A-Z": "sortFunctionAscending",
"Z-A": "sortFunctionDescending",
"0-9": "sortFunctionNumericAscending",
"9-0": "sortFunctionNumericDescending",
};
}
get length() {
return this.items.length;
}
add(item) {
this._dirty = true;
this.items.push(item);
}
sort(sortFunction) {
if (!sortFunction) {
sortFunction = this.getSortFunction();
} else if (typeof sortFunction === "string") {
let key = sortFunction;
let name;
if (key in this.sortFunctionStringMap) {
name = this.sortFunctionStringMap[key];
}
if (Sortable[name]) {
sortFunction = Sortable[name];
} else {
throw new Error(
`Invalid String argument for sort(). Received \`${key}\`. Valid values: ${Object.keys(
this.sortFunctionStringMap,
)}`,
);
}
}
return this.items.slice().sort(sortFunction);
}
sortAscending() {
return this.sort(this.getSortFunctionAscending());
}
sortDescending() {
return this.sort(this.getSortFunctionDescending());
}
setSortDescending(isDescending = true) {
this.isSortAscending = !isDescending;
}
setSortAscending(isAscending = true) {
this.isSortAscending = isAscending;
}
setSortNumeric(isNumeric) {
this.isSortNumeric = isNumeric;
}
/* Sort functions */
static sortFunctionNumericAscending(a, b) {
return a - b;
}
static sortFunctionNumericDescending(a, b) {
return b - a;
}
static sortFunctionAscending(a, b) {
if (a > b) {
return 1;
} else if (a < b) {
return -1;
}
return 0;
}
static sortFunctionDescending(a, b) {
return Sortable.sortFunctionAscending(b, a);
}
static sortFunctionAlphabeticAscending(a, b) {
return Sortable.sortFunctionAscending(a, b);
}
static sortFunctionAlphabeticDescending(a, b) {
return Sortable.sortFunctionAscending(b, a);
}
static sortFunctionDate(mapA, mapB) {
return Sortable.sortFunctionNumericAscending(mapA.date.getTime(), mapB.date.getTime());
}
static sortFunctionDateInputPath(mapA, mapB) {
let sortDate = Sortable.sortFunctionNumericAscending(mapA.date.getTime(), mapB.date.getTime());
if (sortDate === 0) {
return Sortable.sortFunctionAlphabeticAscending(mapA.inputPath, mapB.inputPath);
}
return sortDate;
}
/* End sort functions */
getSortFunction() {
if (this.isSortAscending) {
return this.getSortFunctionAscending();
} else {
return this.getSortFunctionDescending();
}
}
getSortFunctionAscending() {
if (this.isSortNumeric) {
return Sortable.sortFunctionNumericAscending;
} else {
return Sortable.sortFunctionAlphabeticAscending;
}
}
getSortFunctionDescending() {
if (this.isSortNumeric) {
return Sortable.sortFunctionNumericDescending;
} else {
return Sortable.sortFunctionAlphabeticDescending;
}
}
}
export default Sortable;

View File

@@ -0,0 +1,3 @@
export default function Unique(arr) {
return Array.from(new Set(arr));
}