Home / File/ static-html.ts — astro Source File

static-html.ts — astro Source File

Architecture documentation for static-html.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.

File typescript CoreAstro RenderingEngine 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  06357adf_980f_5a11_ce9c_e9d12a8f406f["static-html.ts"]
  58645bbc_6680_4e2a_38e9_3e4f34edbed5["vue"]
  06357adf_980f_5a11_ce9c_e9d12a8f406f --> 58645bbc_6680_4e2a_38e9_3e4f34edbed5
  style 06357adf_980f_5a11_ce9c_e9d12a8f406f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { defineComponent, h } from 'vue';

/**
 * Astro passes `children` as a string of HTML, so we need
 * a wrapper `div` to render that content as VNodes.
 *
 * This is the Vue + JSX equivalent of using `<div v-html="value" />`
 */
const StaticHtml = defineComponent({
	props: {
		value: String,
		name: String,
		hydrate: {
			type: Boolean,
			default: true,
		},
	},
	setup({ name, value, hydrate }) {
		if (!value) return () => null;
		let tagName = hydrate ? 'astro-slot' : 'astro-static-slot';
		return () => h(tagName, { name, innerHTML: value });
	},
});

/**
 * Other frameworks have `shouldComponentUpdate` in order to signal
 * that this subtree is entirely static and will not be updated
 *
 * Fortunately, Vue is smart enough to figure that out without any
 * help from us, so this just works out of the box!
 */

export default StaticHtml;

Domain

Subdomains

Functions

Dependencies

  • vue

Frequently Asked Questions

What does static-html.ts do?
static-html.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in static-html.ts?
static-html.ts defines 1 function(s): StaticHtml.setup.
What does static-html.ts depend on?
static-html.ts imports 1 module(s): vue.
Where is static-html.ts in the architecture?
static-html.ts is located at packages/integrations/vue/src/static-html.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/integrations/vue/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free