Skip to content

Commit

Permalink
feat(schema): export base types without dom events
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Nov 10, 2022
1 parent 47ad433 commit 7b227f5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
37 changes: 21 additions & 16 deletions packages/schema/src/bodyAttributes.ts
@@ -1,19 +1,4 @@
export interface BodyAttributes {
/**
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
*/
class?: string
/**
* The style global attribute contains CSS styling declarations to be applied to the element.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
*/
style?: string
/**
* This attribute defines the unique ID.
*/
id?: string
export interface BodyEvents {
/**
* Script to be run after the document is printed
*/
Expand Down Expand Up @@ -75,3 +60,23 @@ export interface BodyAttributes {
*/
onunload?: string
}

export interface BaseBodyAttributes {
/**
* The class global attribute is a space-separated list of the case-sensitive classes of the element.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/class
*/
class?: string
/**
* The style global attribute contains CSS styling declarations to be applied to the element.
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/style
*/
style?: string
/**
* This attribute defines the unique ID.
*/
id?: string
}

export type BodyAttributes = BaseBodyAttributes & BodyEvents
4 changes: 3 additions & 1 deletion packages/schema/src/link.ts
Expand Up @@ -31,7 +31,7 @@ export type LinkRelTypes = 'alternate' |
'apple-touch-icon' |
'apple-touch-startup-image'

export interface Link extends HttpEventAttributes {
export interface LinkBase {
/**
* This attribute is only used when rel="preload" or rel="prefetch" has been set on the <link> element.
* It specifies the type of content being loaded by the <link>, which is necessary for request matching,
Expand Down Expand Up @@ -261,3 +261,5 @@ export interface Link extends HttpEventAttributes {
*/
id?: string
}

export type Link = LinkBase & HttpEventAttributes
4 changes: 3 additions & 1 deletion packages/schema/src/script.ts
@@ -1,7 +1,7 @@
import type { Booleanable } from './utils'
import type { HttpEventAttributes } from './attributes'

export interface Script extends HttpEventAttributes {
export interface ScriptBase {
/**
* For classic scripts, if the async attribute is present,
* then the classic script will be fetched in parallel to parsing and evaluated as soon as it is available.
Expand Down Expand Up @@ -98,3 +98,5 @@ export interface Script extends HttpEventAttributes {
*/
id?: string
}

export type Script = ScriptBase & HttpEventAttributes

0 comments on commit 7b227f5

Please sign in to comment.