-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
100 changed files
with
6,286 additions
and
2,743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
import { Node } from './Node'; | ||
|
||
export class CharacterData extends Node { | ||
constructor(data) { | ||
super(data); | ||
private _data: string; | ||
constructor(data: string) { | ||
super(''); | ||
this._data = data; | ||
} | ||
|
||
get data() { | ||
return this._data; | ||
} | ||
} | ||
|
||
get length() { | ||
return this._data.length; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { HTMLElement } from './HTMLElement'; | ||
|
||
export class HTMLUnknownElement extends HTMLElement { | ||
constructor(tagName: string) { | ||
super(tagName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import {CharacterData} from './CharacterData'; | ||
|
||
import { CharacterData } from './CharacterData'; | ||
export class Text extends CharacterData { | ||
constructor(data) { | ||
super(data); | ||
} | ||
__instance; | ||
constructor(data) { | ||
super(data); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { getValueAndUnit } from './SVGUnits'; | ||
|
||
export class SVGAnimatedNumber { | ||
_baseVal: number; | ||
_animVal: number; | ||
_element; | ||
_key: string; | ||
constructor(element?, key?) { | ||
this._baseVal = 0; | ||
this._animVal = 0; | ||
this._element = element; | ||
this._key = key; | ||
} | ||
|
||
get baseVal() { | ||
const value = this._element?.getAttribute?.(this._key); | ||
if (typeof value === 'string') { | ||
const ret = getValueAndUnit(value); | ||
if (ret.unit === '%') { | ||
const retValue = Number(ret.value); | ||
if (!isNaN(retValue)) { | ||
return retValue / 100; | ||
} | ||
} else { | ||
const retValue = Number(ret.value); | ||
if (!isNaN(retValue)) { | ||
return retValue; | ||
} | ||
} | ||
} | ||
|
||
return this._baseVal; | ||
} | ||
|
||
get animVal() { | ||
// todo | ||
const value = this._element?.getAttribute?.(this._key); | ||
if (typeof value === 'string') { | ||
const ret = getValueAndUnit(value); | ||
if (ret.unit === '%') { | ||
const retValue = Number(ret.value); | ||
if (!isNaN(retValue)) { | ||
return retValue / 100; | ||
} | ||
} else { | ||
const retValue = Number(ret.value); | ||
if (!isNaN(retValue)) { | ||
return retValue; | ||
} | ||
} | ||
} | ||
return this._animVal; | ||
} | ||
} |
Oops, something went wrong.