blank project
This commit is contained in:
43
node_modules/astro/dist/assets/runtime.js
generated
vendored
Normal file
43
node_modules/astro/dist/assets/runtime.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import {
|
||||
createComponent,
|
||||
render,
|
||||
spreadAttributes,
|
||||
unescapeHTML
|
||||
} from "../runtime/server/index.js";
|
||||
function createSvgComponent({ meta, attributes, children }) {
|
||||
const Component = createComponent((_, props) => {
|
||||
const normalizedProps = normalizeProps(attributes, props);
|
||||
return render`<svg${spreadAttributes(normalizedProps)}>${unescapeHTML(children)}</svg>`;
|
||||
});
|
||||
if (import.meta.env.DEV) {
|
||||
makeNonEnumerable(Component);
|
||||
Object.defineProperty(Component, Symbol.for("nodejs.util.inspect.custom"), {
|
||||
value: (_, opts, inspect) => inspect(meta, opts)
|
||||
});
|
||||
}
|
||||
Object.defineProperty(Component, "toJSON", {
|
||||
value: () => meta,
|
||||
enumerable: false
|
||||
});
|
||||
return Object.assign(Component, meta);
|
||||
}
|
||||
const ATTRS_TO_DROP = ["xmlns", "xmlns:xlink", "version"];
|
||||
const DEFAULT_ATTRS = {};
|
||||
function dropAttributes(attributes) {
|
||||
for (const attr of ATTRS_TO_DROP) {
|
||||
delete attributes[attr];
|
||||
}
|
||||
return attributes;
|
||||
}
|
||||
function normalizeProps(attributes, props) {
|
||||
return dropAttributes({ ...DEFAULT_ATTRS, ...attributes, ...props });
|
||||
}
|
||||
function makeNonEnumerable(object) {
|
||||
for (const property in object) {
|
||||
Object.defineProperty(object, property, { enumerable: false });
|
||||
}
|
||||
}
|
||||
export {
|
||||
createSvgComponent,
|
||||
dropAttributes
|
||||
};
|
||||
Reference in New Issue
Block a user