Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/ogone/src/classes/css2/Rules.ts>default

Advanced Web Composition for Future
Latest
class default
extends Utils
import { default } from "https://deno.land/x/ogone@revb3/src/classes/css2/Rules.ts";

class Rules that will define its own selector by fetching it into the parent Rule

Constructors

new
default(opts: RulesOptions)

Properties

private
_data: { [k: string]: Property; }

all the properties used inside the current rule

private
_selector: string | null
private
readonly
selector: string | null
children: Rules[]
readonly
dataRessources

returns the array with every defined data

readonly
isConst: boolean

if the rule is saved into the document

readonly
isDocument: boolean

if the rule is a document rule, not a document instance

readonly
isExport: boolean

if the rule is saved and is exportable

readonly
isExportableInterface: boolean
readonly
isExportableStructure: boolean
readonly
isExportableTrait: boolean
readonly
isInterface: boolean

need to provide specs here

readonly
isKeyframes: boolean

if the rule is defined for animations

readonly
isMedia: boolean

if the rule is a media query

readonly
isNotToRender: boolean

check if the rule should render

readonly
isStructure: boolean

this is an augmented interface but the querySelector is type checked and also the children are type checked

readonly
isSupports: boolean

if the rule is a supports rule

readonly
isTopLevel: boolean

if the rule has no parent.

readonly
isTrait: boolean

when a rule should implement a trait traits will only check if a property is used or not

readonly
isTyped: boolean
mapPseudoProperties: Map<string, PseudoProperty>
readonly
parent: Rules | undefined

returns the parent of the current rule

readonly
query: string | null

queryselector of the current rule

readonly
regExpIdentifier: RegExp

regular expression to identify the selector of the current rule

readonly
source: string

the content of the

readonly
typeInterferenceRegExp: RegExp

Methods

private
renderParentReference(query: string | null): string | null

method to transform the & token to the parent selector

start getting all the properties of the current rule those will be saved into the data object

get all pseudo properties of the rule

usage:

div {
   color::media(green; red: 400px);
}

where color as for default green and red when the min-width: 400px

saves all the defined variables into the current document

render(opts: { minify?: boolean; }): string

returns the output of the current rule

saveConst(): void

save the current rule if the property isConst or isExport is true