-
-
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
248 changed files
with
11,891 additions
and
832 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page"> | ||
<Page.actionBar> | ||
<ActionBar title="canvas-svg" icon="" class="action-bar"> | ||
</ActionBar> | ||
</Page.actionBar> | ||
<StackLayout class="p-20"> | ||
<ScrollView class="h-full"> | ||
<StackLayout> | ||
<Button text="Test canvas-svg" tap="{{ testIt }}" class="btn btn-primary"/> | ||
|
||
</StackLayout> | ||
</ScrollView> | ||
</StackLayout> | ||
</Page> | ||
<Page xmlns:ui="@nativescript/canvas-svg" xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" | ||
class="page"> | ||
<Page.actionBar> | ||
<ActionBar title="canvas-svg" icon="" class="action-bar"> | ||
</ActionBar> | ||
</Page.actionBar> | ||
<GridLayout columns="*,*" rows="*,*"> | ||
<ui:Svg id="1" width="100%" height="100%" src="{{src1}}" loaded="{{svgViewLoaded}}"/> | ||
<!--<ui:Svg id="2" col="1" width="100%" height="100%" src="{{src2}}" loaded="{{svgViewLoaded}}"/> | ||
<ui:Svg id="3" row="1" width="100%" height="100%" src="{{src3}}" loaded="{{svgViewLoaded}}"/> | ||
<ui:Svg id="4" row="1" col="1" width="100%" height="100%" src="{{src4}}" loaded="{{svgViewLoaded}}"/>--> | ||
</GridLayout> | ||
</Page> |
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
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
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
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,16 @@ | ||
import { HTMLElement } from './HTMLElement'; | ||
import { StackLayout } from '@nativescript/core'; | ||
|
||
export class HTMLDivElement extends HTMLElement { | ||
constructor() { | ||
super('div'); | ||
const div = arguments[0]; | ||
|
||
// using StackLayout for now | ||
if (!(div instanceof StackLayout)) { | ||
this.nativeElement = new StackLayout(); | ||
} else { | ||
this.nativeElement = arguments[0]; | ||
} | ||
} | ||
} |
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,57 @@ | ||
import { Element } from './Element'; | ||
import { ViewBase } from '@nativescript/core'; | ||
import setValue from 'set-value'; | ||
|
||
export class Style { | ||
proxy; | ||
|
||
constructor() { | ||
const values = new Map(); | ||
this.proxy = new Proxy(this, { | ||
set(target, prop, value) { | ||
target.setProperty(prop, value); | ||
return true; | ||
}, | ||
get(target, prop, receiver) { | ||
return target.getPropertyValue(prop); | ||
} | ||
}); | ||
this._values = values; | ||
} | ||
|
||
_values: Map<any, any>; | ||
nativeElement: WeakRef<ViewBase>; | ||
|
||
setProperty(key: string | symbol, val: unknown) { | ||
this._values.set(key, val); | ||
// const nativeElement = this.nativeElement?.deref?.(); | ||
// if (nativeElement !== null) { | ||
// setValue(nativeElement, key, val); | ||
// } | ||
} | ||
|
||
getPropertyValue(key: string | symbol) { | ||
// const nativeElement = this.nativeElement?.deref?.(); | ||
// if (nativeElement !== null) { | ||
// return nativeElement[key]; | ||
// } | ||
return this._values.get(key); | ||
} | ||
} | ||
|
||
export class HTMLElement extends Element { | ||
|
||
private _style = new Style(); | ||
|
||
constructor(tagName: string = '') { | ||
super(tagName ?? ''); | ||
} | ||
|
||
get style() { | ||
if (this.nativeElement) { | ||
return this.nativeElement.style; | ||
} | ||
return this._style; | ||
} | ||
|
||
} |
Oops, something went wrong.