|
@@ -1,76 +1,44 @@
|
|
|
"""Display the title of the current page."""
|
|
|
|
|
|
-from typing import Optional
|
|
|
|
|
|
from pynecone.components.component import Component
|
|
|
-from pynecone.components.tags import Tag
|
|
|
from pynecone.var import Var
|
|
|
|
|
|
|
|
|
class Link(Component):
|
|
|
"""A component that displays the title of the current page."""
|
|
|
|
|
|
+ tag = "link"
|
|
|
+
|
|
|
# The href.
|
|
|
href: Var[str]
|
|
|
|
|
|
# The type of link.
|
|
|
rel: Var[str]
|
|
|
|
|
|
- def _render(self) -> Tag:
|
|
|
- return Tag(name="link").add_props(
|
|
|
- href=self.href,
|
|
|
- rel=self.rel,
|
|
|
- )
|
|
|
-
|
|
|
|
|
|
class ScriptTag(Component):
|
|
|
- """A component that creates a script tag with the speacified type and source.
|
|
|
-
|
|
|
-
|
|
|
- Args:
|
|
|
- type: This attribute indicates the type of script represented.
|
|
|
- The value of this attribute will be one of the following:
|
|
|
-
|
|
|
- - module: This value causes the code to be treated as a JavaScript module.
|
|
|
- - importmap: This value indicates that the body of the element
|
|
|
- contains an import map.
|
|
|
- - Any value: The embedded content is treated as a data block, and won't be
|
|
|
- processed by the browser.
|
|
|
- - blocking: This attribute explicitly indicates that certain operations
|
|
|
- should be blocked on the fetching of the script.
|
|
|
-
|
|
|
- source: This attribute specifies the URI of an external script; this can be
|
|
|
- used as an alternative to embedding a script directly within a document.
|
|
|
-
|
|
|
- integrity: This attribute contains inline metadata that a user agent can use
|
|
|
- to verify that a fetched resource has been delivered free of unexpected manipulation
|
|
|
-
|
|
|
- crossorigin: To allow error logging for sites which use a separate domain for static media,
|
|
|
- use this attribute.
|
|
|
-
|
|
|
- referrer_policy: Indicates which referrer to send when fetching the script, or resources fetched by the script
|
|
|
- refrence: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#:~:text=Indicates%20which%20referrer%20to%20send%20when%20fetching%20the%20script%2C%20or%20resources%20fetched%20by%20the%20script%3A
|
|
|
-
|
|
|
- is_async: This attribute allows the elimination of parser-blocking JavaScript where the browser would have to
|
|
|
- load and evaluate scripts before continuing to parse. defer has a similar effect in this case.
|
|
|
-
|
|
|
- defer: This Boolean attribute is set to indicate to a browser that the script is
|
|
|
- meant to be executed after the document has been parsed, but before firing DOMContentLoaded.
|
|
|
-
|
|
|
- """
|
|
|
+ """A script tag with the specified type and source."""
|
|
|
|
|
|
tag = "script"
|
|
|
|
|
|
- type: Var[str]
|
|
|
+ # The type of script represented.
|
|
|
+ type_: Var[str]
|
|
|
|
|
|
+ # The URI of an external script.
|
|
|
source: Var[str]
|
|
|
|
|
|
- integrity: Optional[Var[str]]
|
|
|
+ # Metadata to verify the content of the script.
|
|
|
+ integrity: Var[str]
|
|
|
|
|
|
- crossorigin: Optional[Var[str]]
|
|
|
+ # Whether to allow cross-origin requests.
|
|
|
+ crossorigin: Var[str]
|
|
|
|
|
|
- referrer_policy: Optional[Var[str]]
|
|
|
+ # Indicates which referrer to send when fetching the script.
|
|
|
+ referrer_policy: Var[str]
|
|
|
|
|
|
- is_async: Optional[Var[bool]]
|
|
|
+ # Whether to asynchronously load the script.
|
|
|
+ is_async: Var[bool]
|
|
|
|
|
|
- defer: Optional[Var[bool]]
|
|
|
+ # Whether to defer loading the script.
|
|
|
+ defer: Var[bool]
|