@tradecanvas/svelte 1.4.11 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/PoweredBy.svelte +53 -0
- package/dist/PoweredBy.svelte.d.ts +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,6 +33,18 @@ npm install @tradecanvas/svelte @tradecanvas/chart
|
|
|
33
33
|
|
|
34
34
|
Streams live Binance data by default. Pass `data={bars}` for static OHLC, or `adapter={...}` for any feed. `bind:chart` gives you the underlying `Chart` (or use `onReady`).
|
|
35
35
|
|
|
36
|
+
## Powered by badge
|
|
37
|
+
|
|
38
|
+
```svelte
|
|
39
|
+
<script lang="ts">
|
|
40
|
+
import { PoweredBy } from '@tradecanvas/svelte'
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<footer><PoweredBy size={14} /></footer>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
One link to tradecanvas.dev, named "Powered by TradeCanvas", in the text colour around it so it follows your theme; only the mark's candle is amber. `size` is the mark's height in px (default 16, at least 12), and `href`, `target` (default `_blank`) and `class` are passed to the link.
|
|
47
|
+
|
|
36
48
|
## Props
|
|
37
49
|
|
|
38
50
|
`symbol`, `timeframe`, `theme`, `chartType`, `indicators` (ids, or `{ id, params, position }`), `data` (bars of your own; no stream; bars that go on from the last, pushed or in a new array, go in as live ticks), `adapter`, `stream` (`false`: no stream of its own), `historyLimit`, `features` (changes apply after mount too), `autoScale`, `signalMarkers`, `signalMarkerStyle`, `tradeZones`, `tradeZoneStyle`, `overrides` (style overrides by key, all of your app's), `watermarkText`, `onReady`, and `bind:chart`.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// "Powered by TradeCanvas": the words in the host's own face, the TC mark and the
|
|
3
|
+
// wordmark, as one link. It takes the text colour around it, so it follows the
|
|
4
|
+
// page's theme; only the mark's candle keeps the brand's amber.
|
|
5
|
+
import {
|
|
6
|
+
opensElsewhere,
|
|
7
|
+
poweredByLayout,
|
|
8
|
+
safeBadgeHref,
|
|
9
|
+
POWERED_BY_LABEL,
|
|
10
|
+
TRADECANVAS_MARK_SVG,
|
|
11
|
+
TRADECANVAS_WORDMARK_SVG,
|
|
12
|
+
} from '@tradecanvas/chart';
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
/** The mark's height in CSS pixels; the words and the wordmark follow it. Default 16, at least 12. */
|
|
16
|
+
size?: number;
|
|
17
|
+
/** Where the link goes. Default https://tradecanvas.dev. */
|
|
18
|
+
href?: string;
|
|
19
|
+
/** The link's target. Default '_blank'; any target but _self, _parent or _top also gets rel="noopener noreferrer". */
|
|
20
|
+
target?: string;
|
|
21
|
+
/** A class for the link, to place it. */
|
|
22
|
+
class?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let { size = 16, href, target = '_blank', class: className = '' }: Props = $props();
|
|
26
|
+
|
|
27
|
+
const layout = $derived(poweredByLayout(size));
|
|
28
|
+
const link = $derived(safeBadgeHref(href));
|
|
29
|
+
const sized = (svg: string, width: number, height: number): string =>
|
|
30
|
+
svg.replace('<svg ', `<svg width="${width}" height="${height}" style="display:block" `);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<a
|
|
34
|
+
class={className || undefined}
|
|
35
|
+
href={link}
|
|
36
|
+
{target}
|
|
37
|
+
rel={opensElsewhere(target) ? 'noopener noreferrer' : undefined}
|
|
38
|
+
aria-label={POWERED_BY_LABEL}
|
|
39
|
+
style:display="inline-flex"
|
|
40
|
+
style:align-items="center"
|
|
41
|
+
style:color="inherit"
|
|
42
|
+
style:text-decoration="none"
|
|
43
|
+
style:line-height="1"
|
|
44
|
+
style:white-space="nowrap"
|
|
45
|
+
style:gap="{layout.gap}px"
|
|
46
|
+
style:height="{layout.height}px"
|
|
47
|
+
style:font-size="{layout.fontSize}px"
|
|
48
|
+
>
|
|
49
|
+
<span aria-hidden="true">Powered by</span>
|
|
50
|
+
<span style="display:flex;flex:none" aria-hidden="true">{@html sized(TRADECANVAS_MARK_SVG, layout.height, layout.height)}</span>
|
|
51
|
+
<span style="display:flex;flex:none" aria-hidden="true">{@html sized(TRADECANVAS_WORDMARK_SVG, layout.wordmarkWidth, layout.wordmarkHeight)}</span>
|
|
52
|
+
</a>
|
|
53
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** The mark's height in CSS pixels; the words and the wordmark follow it. Default 16, at least 12. */
|
|
3
|
+
size?: number;
|
|
4
|
+
/** Where the link goes. Default https://tradecanvas.dev. */
|
|
5
|
+
href?: string;
|
|
6
|
+
/** The link's target. Default '_blank'; any target but _self, _parent or _top also gets rel="noopener noreferrer". */
|
|
7
|
+
target?: string;
|
|
8
|
+
/** A class for the link, to place it. */
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const PoweredBy: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type PoweredBy = ReturnType<typeof PoweredBy>;
|
|
13
|
+
export default PoweredBy;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradecanvas/svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Svelte 5 component for @tradecanvas/chart — reactive props, runes, zero boilerplate.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"README.md"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@tradecanvas/chart": "1.
|
|
42
|
+
"@tradecanvas/chart": "1.77.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"svelte": ">=5.0.0"
|