Skip to content

Commit 835f373

Browse files
committed
readme/doc
1 parent 2aad5ce commit 835f373

File tree

7 files changed

+84
-24
lines changed

7 files changed

+84
-24
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
* [XML](#xml)
4949
* [NativeScript + Angular](#nativescript--angular)
5050
* [NativeScript + Vue](#nativescript--vue)
51+
* [NativeScript + Svelte](#nativescript--svelte)
5152
* [Draw Method ](#draw-method-)
5253
* [Examples:](#examples)
5354
* [Demos and Development](#demos-and-development)
@@ -136,14 +137,41 @@ Vue.use(CanvasPlugin);
136137
```
137138
138139
140+
[](#nativescript--svelte)
141+
142+
143+
[](#nativescript--svelte)
144+
145+
## NativeScript + Svelte
146+
147+
```ts
148+
// app/app.ts
149+
import { registerNativeViewElement } from 'svelte-native/dom';
150+
registerNativeViewElement('canvasView', () => require('@nativescript-community/ui-canvas').CanvasView);
151+
```
152+
153+
```svelte
154+
<!-- app/components/Foo.svelte -->
155+
<stackLayout>
156+
<canvasView width="300" height="300" on:draw={draw} />
157+
</stackLayout>
158+
```
159+
160+
139161
[](#draw-method-)
140162
141163
142164
[](#draw-method-)
143165
144166
## Draw Method
145-
```typescript
167+
168+
```ts
169+
import type { Canvas } from '@nativescript-community/ui-canvas';
170+
import { Paint, createRect } from '@nativescript-community/ui-canvas';
171+
import { Color } from '@nativescript/core';
172+
146173
function draw(event: { canvas: Canvas }) {
174+
const canvas = event.canvas;
147175
const paint = new Paint();
148176
paint.setColor(new Color('black'));
149177
paint.strokeWidth = 10;
@@ -271,6 +299,7 @@ One easy solution is t modify `~/.gitconfig` and add
271299
## Questions
272300
273301
If you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord).
302+
274303
</details><details>
275304
<summary><b>ui-canvaslabel</b></summary>
276305
<!-- ⚠️ This README has been generated from the file(s) "blueprint.md" ⚠️-->
@@ -575,6 +604,8 @@ If you have any questions/issues/comments please feel free to create an issue or
575604
576605
* [Installation](#installation)
577606
* [Configuration](#configuration)
607+
* [NativeScript + Vue](#nativescript--vue)
608+
* [NativeScript + Svelte](#nativescript--svelte)
578609
* [Examples:](#examples)
579610
* [Demos and Development](#demos-and-development)
580611
* [Repo Setup](#repo-setup)
@@ -609,6 +640,8 @@ Run the following command from the root of your project:
609640
610641
For now only `vue` (and core) is supported.
611642
643+
### NativeScript + Vue
644+
612645
```ts
613646
import CanvasSVG from '@nativescript-community/ui-svg/vue';
614647
Vue.use(CanvasSVG);
@@ -642,6 +675,19 @@ Or within and Canvas View extending `CanvasView` like `CanvasLabel`
642675
</CanvasSVG>
643676
```
644677
678+
### NativeScript + Svelte
679+
680+
```ts
681+
// app/app.ts
682+
import { registerNativeViewElement } from 'svelte-native/dom';
683+
registerNativeViewElement('svgView', () => require('@nativescript-community/ui-svg').SVGView);
684+
```
685+
686+
```svelte
687+
<!-- app/components/Foo.svelte -->
688+
<svgView src="~/assets/foo.svg" aspectFit="stretch" />
689+
```
690+
645691
### Examples:
646692
647693
- [Basic](demo-snippets/vue/SVG.vue)
@@ -754,6 +800,7 @@ One easy solution is t modify `~/.gitconfig` and add
754800
## Questions
755801
756802
If you have any questions/issues/comments please feel free to create an issue or start a conversation in the [NativeScript Community Discord](https://nativescript.org/discord).
803+
757804
</details>
758805
759806
[](#demos-and-development)

docs/assets/highlight.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
--dark-hl-9: #569CD6;
2222
--light-hl-10: #CD3131;
2323
--dark-hl-10: #F44747;
24-
--light-hl-11: #267F99;
25-
--dark-hl-11: #4EC9B0;
26-
--light-hl-12: #0070C1;
27-
--dark-hl-12: #4FC1FF;
28-
--light-hl-13: #098658;
29-
--dark-hl-13: #B5CEA8;
30-
--light-hl-14: #008000;
31-
--dark-hl-14: #6A9955;
24+
--light-hl-11: #008000;
25+
--dark-hl-11: #6A9955;
26+
--light-hl-12: #098658;
27+
--dark-hl-12: #B5CEA8;
28+
--light-hl-13: #267F99;
29+
--dark-hl-13: #4EC9B0;
30+
--light-hl-14: #0070C1;
31+
--dark-hl-14: #4FC1FF;
3232
--light-hl-15: #000000;
3333
--dark-hl-15: #C8C8C8;
3434
--light-code-background: #FFFFFF;

docs/assets/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/classes/ui_canvas.CanvasView.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/classes/ui_svg.CanvasSVG.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/classes/ui_svg.SVGView.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)