formacao
This commit is contained in:
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
|
||||
+11
-5
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
@@ -118,22 +117,29 @@ const createCssJsxDomObjects = ({ id }) => {
|
||||
});
|
||||
return [cssObject, Style2];
|
||||
};
|
||||
const createCssContext = ({ id }) => {
|
||||
const createCssContext = ({
|
||||
id,
|
||||
classNameSlug,
|
||||
onInvalidSlug
|
||||
}) => {
|
||||
const [cssObject, Style2] = createCssJsxDomObjects({ id });
|
||||
const newCssClassNameObject = (cssClassName) => {
|
||||
cssClassName.toString = cssObject.toString;
|
||||
return cssClassName;
|
||||
};
|
||||
const css2 = (strings, ...values) => {
|
||||
return newCssClassNameObject((0, import_common.cssCommon)(strings, values));
|
||||
return newCssClassNameObject((0, import_common.cssCommon)(strings, values, classNameSlug, onInvalidSlug));
|
||||
};
|
||||
const cx2 = (...args) => {
|
||||
args = (0, import_common.cxCommon)(args);
|
||||
return css2(Array(args.length).fill(""), ...args);
|
||||
};
|
||||
const keyframes2 = import_common.keyframesCommon;
|
||||
const keyframes2 = (strings, ...values) => (0, import_common.keyframesCommon)(strings, values, classNameSlug, onInvalidSlug);
|
||||
const viewTransition2 = ((strings, ...values) => {
|
||||
return newCssClassNameObject((0, import_common.viewTransitionCommon)(strings, values));
|
||||
return newCssClassNameObject(
|
||||
(0, import_common.viewTransitionCommon)(strings, values, classNameSlug, onInvalidSlug)
|
||||
// eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
);
|
||||
});
|
||||
return {
|
||||
css: css2,
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
|
||||
+40
-10
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
@@ -80,11 +79,16 @@ const documentMetadataTag = (tag, props, preserveNodeType, supportSort, supportB
|
||||
let element = null;
|
||||
let created = false;
|
||||
const deDupeKeys = import_common.deDupeKeyMap[tag];
|
||||
const deDupeByKey = (0, import_common.shouldDeDupeByKey)(tag, supportSort);
|
||||
const isDeDupeCandidateLink = (e) => e.getAttribute("rel") === "stylesheet" && e.getAttribute(import_common.dataPrecedenceAttr) !== null;
|
||||
let existingElements = void 0;
|
||||
if (deDupeKeys.length > 0) {
|
||||
if (deDupeByKey) {
|
||||
const tags = head.querySelectorAll(tag);
|
||||
LOOP: for (const e of tags) {
|
||||
for (const key of import_common.deDupeKeyMap[tag]) {
|
||||
if (tag === "link" && !isDeDupeCandidateLink(e)) {
|
||||
continue;
|
||||
}
|
||||
for (const key of deDupeKeys) {
|
||||
if (e.getAttribute(key) === props[key]) {
|
||||
element = e;
|
||||
break LOOP;
|
||||
@@ -103,9 +107,9 @@ const documentMetadataTag = (tag, props, preserveNodeType, supportSort, supportB
|
||||
if (props[key] !== void 0) {
|
||||
e.setAttribute(key, props[key]);
|
||||
}
|
||||
if (props.rel) {
|
||||
e.setAttribute("rel", props.rel);
|
||||
}
|
||||
}
|
||||
if (props.rel) {
|
||||
e.setAttribute("rel", props.rel);
|
||||
}
|
||||
return e;
|
||||
})();
|
||||
@@ -119,7 +123,26 @@ const documentMetadataTag = (tag, props, preserveNodeType, supportSort, supportB
|
||||
}
|
||||
const insert = (0, import_hooks.useCallback)(
|
||||
(e) => {
|
||||
if (deDupeKeys.length > 0) {
|
||||
if (deDupeByKey) {
|
||||
if (tag === "link" && precedence !== void 0) {
|
||||
let found2 = false;
|
||||
for (const existingElement of head.querySelectorAll(tag)) {
|
||||
const existingPrecedence = existingElement.getAttribute(import_common.dataPrecedenceAttr);
|
||||
if (existingPrecedence === null) {
|
||||
head.insertBefore(e, existingElement);
|
||||
return;
|
||||
}
|
||||
if (found2 && existingPrecedence !== precedence) {
|
||||
head.insertBefore(e, existingElement);
|
||||
return;
|
||||
}
|
||||
if (existingPrecedence === precedence) {
|
||||
found2 = true;
|
||||
}
|
||||
}
|
||||
head.appendChild(e);
|
||||
return;
|
||||
}
|
||||
let found = false;
|
||||
for (const existingElement of head.querySelectorAll(tag)) {
|
||||
if (found && existingElement.getAttribute(import_common.dataPrecedenceAttr) !== precedence) {
|
||||
@@ -131,6 +154,10 @@ const documentMetadataTag = (tag, props, preserveNodeType, supportSort, supportB
|
||||
}
|
||||
}
|
||||
head.appendChild(e);
|
||||
} else if (tag === "link") {
|
||||
if (!head.contains(e)) {
|
||||
head.appendChild(e);
|
||||
}
|
||||
} else if (existingElements) {
|
||||
let found = false;
|
||||
for (const existingElement of existingElements) {
|
||||
@@ -148,7 +175,7 @@ const documentMetadataTag = (tag, props, preserveNodeType, supportSort, supportB
|
||||
existingElements = void 0;
|
||||
}
|
||||
},
|
||||
[precedence]
|
||||
[deDupeByKey, precedence, tag]
|
||||
);
|
||||
const ref = composeRef(props.ref, (e) => {
|
||||
const key = deDupeKeys[0];
|
||||
@@ -161,6 +188,9 @@ const documentMetadataTag = (tag, props, preserveNodeType, supportSort, supportB
|
||||
if (!onError && !onLoad) {
|
||||
return;
|
||||
}
|
||||
if (!key) {
|
||||
return;
|
||||
}
|
||||
let promise = blockingPromiseMap[e.getAttribute(key)] ||= new Promise(
|
||||
(resolve, reject) => {
|
||||
e.addEventListener("load", resolve);
|
||||
@@ -178,7 +208,7 @@ const documentMetadataTag = (tag, props, preserveNodeType, supportSort, supportB
|
||||
});
|
||||
if (supportBlocking && blocking === "render") {
|
||||
const key = import_common.deDupeKeyMap[tag][0];
|
||||
if (props[key]) {
|
||||
if (key && props[key]) {
|
||||
const value = props[key];
|
||||
const promise = blockingPromiseMap[value] ||= new Promise((resolve, reject) => {
|
||||
insert(element);
|
||||
@@ -254,7 +284,7 @@ const link = (props) => {
|
||||
ref: props.ref
|
||||
};
|
||||
}
|
||||
return documentMetadataTag("link", props, 1, "precedence" in props, true);
|
||||
return documentMetadataTag("link", props, 1, (0, import_common.isStylesheetLinkWithPrecedence)(props), true);
|
||||
};
|
||||
const meta = (props) => {
|
||||
return documentMetadataTag("meta", props, void 0, false, false);
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
|
||||
+39
-18
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
@@ -69,6 +68,17 @@ const getEventSpec = (key) => {
|
||||
};
|
||||
const toAttributeName = (element, key) => nameSpaceContext && element instanceof SVGElement && /[A-Z]/.test(key) && (key in element.style || // Presentation attributes are findable in style object. "clip-path", "font-size", "stroke-width", etc.
|
||||
key.match(/^(?:o|pai|str|u|ve)/)) ? key.replace(/([A-Z])/g, "-$1").toLowerCase() : key;
|
||||
const normalizeFormValue = (value) => value === null || value === void 0 || value === false ? null : value;
|
||||
const applySelectValue = (select, props) => {
|
||||
if (!("value" in props)) {
|
||||
return;
|
||||
}
|
||||
select.value = normalizeFormValue(props["value"]);
|
||||
if (!select.multiple && select.selectedIndex === -1) {
|
||||
select.selectedIndex = 0;
|
||||
}
|
||||
};
|
||||
const isIgnorableAttributeError = (error) => error instanceof DOMException && error.name === "InvalidCharacterError";
|
||||
const applyProps = (container, attributes, oldAttributes) => {
|
||||
attributes ||= {};
|
||||
for (let key in attributes) {
|
||||
@@ -112,18 +122,14 @@ const applyProps = (container, attributes, oldAttributes) => {
|
||||
} else {
|
||||
if (key === "value") {
|
||||
const nodeName = container.nodeName;
|
||||
if (nodeName === "INPUT" || nodeName === "TEXTAREA" || nodeName === "SELECT") {
|
||||
if (nodeName === "SELECT") {
|
||||
continue;
|
||||
} else if (nodeName === "INPUT" || nodeName === "TEXTAREA") {
|
||||
;
|
||||
container.value = value === null || value === void 0 || value === false ? null : value;
|
||||
container.value = normalizeFormValue(value);
|
||||
if (nodeName === "TEXTAREA") {
|
||||
container.textContent = value;
|
||||
continue;
|
||||
} else if (nodeName === "SELECT") {
|
||||
if (container.selectedIndex === -1) {
|
||||
;
|
||||
container.selectedIndex = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (key === "checked" && container.nodeName === "INPUT" || key === "selected" && container.nodeName === "OPTION") {
|
||||
@@ -131,14 +137,20 @@ const applyProps = (container, attributes, oldAttributes) => {
|
||||
container[key] = value;
|
||||
}
|
||||
const k = toAttributeName(container, key);
|
||||
if (value === null || value === void 0 || value === false) {
|
||||
container.removeAttribute(k);
|
||||
} else if (value === true) {
|
||||
container.setAttribute(k, "");
|
||||
} else if (typeof value === "string" || typeof value === "number") {
|
||||
container.setAttribute(k, value);
|
||||
} else {
|
||||
container.setAttribute(k, value.toString());
|
||||
try {
|
||||
if (value === null || value === void 0 || value === false) {
|
||||
container.removeAttribute(k);
|
||||
} else if (value === true) {
|
||||
container.setAttribute(k, "");
|
||||
} else if (typeof value === "string" || typeof value === "number") {
|
||||
container.setAttribute(k, value);
|
||||
} else {
|
||||
container.setAttribute(k, value.toString());
|
||||
}
|
||||
} catch (e) {
|
||||
if (!isIgnorableAttributeError(e)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,7 +166,13 @@ const applyProps = (container, attributes, oldAttributes) => {
|
||||
} else if (key === "ref") {
|
||||
refCleanupMap.get(container)?.();
|
||||
} else {
|
||||
container.removeAttribute(toAttributeName(container, key));
|
||||
try {
|
||||
container.removeAttribute(toAttributeName(container, key));
|
||||
} catch (e) {
|
||||
if (!isIgnorableAttributeError(e)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,6 +310,9 @@ const applyNodeObject = (node, container, isNew) => {
|
||||
el = child.e ||= child.n ? document.createElementNS(child.n, child.tag) : document.createElement(child.tag);
|
||||
applyProps(el, child.props, child.pP);
|
||||
applyNodeObject(child, el, isNewLocal);
|
||||
if (child.tag === "select") {
|
||||
applySelectValue(el, child.props);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (child.tag === HONO_PORTAL_ELEMENT) {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
|
||||
Reference in New Issue
Block a user