Init: RoggioApp Architecture, Prisma Schema, API MVP
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
// src/jsx/utils.ts
|
||||
var normalizeElementKeyMap = /* @__PURE__ */ new Map([
|
||||
["className", "class"],
|
||||
["htmlFor", "for"],
|
||||
["crossOrigin", "crossorigin"],
|
||||
["httpEquiv", "http-equiv"],
|
||||
["itemProp", "itemprop"],
|
||||
["fetchPriority", "fetchpriority"],
|
||||
["noModule", "nomodule"],
|
||||
["formAction", "formaction"]
|
||||
]);
|
||||
var normalizeIntrinsicElementKey = (key) => normalizeElementKeyMap.get(key) || key;
|
||||
var invalidAttributeNameCharRe = /[\s"'<>/=`\\\x00-\x1f\x7f-\x9f]/;
|
||||
var isValidAttributeName = (name) => {
|
||||
const len = name.length;
|
||||
if (len === 0) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < len; i++) {
|
||||
const c = name.charCodeAt(i);
|
||||
if (!(c >= 97 && c <= 122 || // a-z
|
||||
c >= 65 && c <= 90 || // A-Z
|
||||
c >= 48 && c <= 57 || // 0-9
|
||||
c === 45 || // -
|
||||
c === 95 || // _
|
||||
c === 46 || // .
|
||||
c === 58)) {
|
||||
return !invalidAttributeNameCharRe.test(name);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
var styleObjectForEach = (style, fn) => {
|
||||
for (const [k, v] of Object.entries(style)) {
|
||||
const key = k[0] === "-" || !/[A-Z]/.test(k) ? k : k.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
||||
fn(
|
||||
key,
|
||||
v == null ? null : typeof v === "number" ? !key.match(
|
||||
/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/
|
||||
) ? `${v}px` : `${v}` : v
|
||||
);
|
||||
}
|
||||
};
|
||||
export {
|
||||
isValidAttributeName,
|
||||
normalizeIntrinsicElementKey,
|
||||
styleObjectForEach
|
||||
};
|
||||
Reference in New Issue
Block a user