Skip to content

Commit

Permalink
fix(dx): prefix assets tickschart/
Browse files Browse the repository at this point in the history
  • Loading branch information
dmidz committed Mar 21, 2024
1 parent feff197 commit a4bfcfc
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Upload artifacts
uses: ./.github/actions/upload-pages-artifact
with:
path: './demo/vanilla-js . --directory ../../public ./data --directory . ./css'
path: './demo/vanilla-js . --directory ../../public/tickschart .'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion demo/vanilla-js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA="/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Ticks Chart Vue Example</title>
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/tickschart/assets/main.css">
</head>
<body>
<div id="app">
Expand Down
6 changes: 3 additions & 3 deletions demo/vanilla-js/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { Chart, Fetcher, intervalsMs } from 'https://cdn.jsdelivr.net/npm/@dmidz/tickschart/+esm';
import { Chart, Fetcher, intervalsMs } from 'https://cdn.jsdelivr.net/npm/@dmidz/tickschart@0.0/+esm';

const { m1, h1, d1 } = intervalsMs;

Expand All @@ -11,7 +11,7 @@ const mapTickProps = { open: 'open', high: 'high', low: 'low', close: 'close', v
// ! adapt this path to your public sample path
const sampleTimeStart = 1684800000000;
const ticksPerLoad = 1000;// must match the ticks count per fetch
const sampleTicksURL = `/data/ticks_BTC_4h/${ sampleTimeStart }-${ ticksPerLoad }.json`;
const sampleTicksURL = `/tickschart/data/ticks_BTC_4h/${ sampleTimeStart }-${ ticksPerLoad }.json`;
const timeScaleMs = h1 * 4;// must match time scale of fetched data ( here 4h )
const currentTime = new Date( Date.UTC( 2023, 9, 10 ) );// initial time position
const xOriginRatio = .75;// screen width delta ratio, .75 = 3/4 width from left
Expand All @@ -31,7 +31,7 @@ const fetcher = new Fetcher( defaultTick, async ( startTime, limit ) => {
}

//__ when github.io ( github pages ), must add sub directory ( repo name )
const url = new URL( `${ window.location.hostname.match(/github.io$/)?'/tickschart':''}${sampleTicksURL}`, window.location.origin );
const url = new URL( `${sampleTicksURL}`, window.location.origin );

url.search = new URLSearchParams( {// sample of params for API, useless here with local json fetch
symbol: 'BTCUSDT',
Expand Down
2 changes: 1 addition & 1 deletion demo/vanilla-ts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA="/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Ticks Chart Vue Example</title>
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="/tickschart/assets/main.css">
</head>
<body>
<div id="app">
Expand Down
2 changes: 1 addition & 1 deletion demo/vanilla-ts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const mapTickProps = { open: 'open', high: 'high', low: 'low', close: 'close', v
// ! adapt this path to your public sample path ( native fetch needs absolute URL )
const sampleTimeStart = 1684800000000;
const ticksPerLoad = 1000;// must match the ticks count per fetch
const sampleTicksURL = `/data/ticks_BTC_4h/${ sampleTimeStart }-${ ticksPerLoad }.json`;
const sampleTicksURL = `/tickschart/data/ticks_BTC_4h/${ sampleTimeStart }-${ ticksPerLoad }.json`;
const timeScaleMs = h1 * 4;// must match time scale of fetched data ( here 4h )
const currentTime = new Date( Date.UTC( 2023, 9, 10 ) );// initial time position
const xOriginRatio = .75;// screen width delta ratio, .75 = 3/4 width from left
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
12 changes: 12 additions & 0 deletions public/css/main.css → public/tickschart/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ body {
vertical-align: middle;
}

.icon.ic-close {
background-image: url("./icons/close.svg");
}

.icon.ic-settings {
background-image: url("./icons/settings.svg");
}

.icon.ic-chevron-double {
background-image: url("./icons/chevron-double.svg");
}

.chart .bt-link {
cursor: pointer;
font-size: 1rem;
Expand Down
2 changes: 1 addition & 1 deletion src/Chart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const defaultTick = { time: 0, open: 0, high: 0, low: 0, close: 0, vol: 0 } as c
const mapTickProps = { open: 'open', high: 'high', low: 'low', close: 'close', volume: 'vol' } as const;
const sampleTimeStart = 1684800000000;
const ticksPerLoad = 1000;// must match the ticks count per fetch
const sampleTicksURL = `/data/ticks_BTC_4h/${ sampleTimeStart }-${ ticksPerLoad }.json`;
const sampleTicksURL = `/tickschart/data/ticks_BTC_4h/${ sampleTimeStart }-${ ticksPerLoad }.json`;
const timeScaleMs = h1 * 4;// must match time scale of fetched data ( here 4h )
// const currentTime = new Date();// initial time position
// const currentTime = new Date( Date.UTC(2023, 6, 13 ) );// initial time position
Expand Down
3 changes: 1 addition & 2 deletions src/lib/Chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -972,9 +972,8 @@ export default class Chart<Tick extends AbstractTick = CandleTick> {
}
} );
createElement( 'span', this.elements.buttonGoMaxX, {
className: 'icon',
className: 'icon ic-chevron-double',
style: {
backgroundImage: 'url( "/icons/chevron-double.svg" )',
transform: 'rotate(90deg)',
marginBottom: '2px',
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/ChartRow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,9 @@ export default class ChartRow {
this.elements.set( 'name', name );
if( Object.keys( this.indicator.settings||{} ).length ){
createElement( 'div', name, {
className: 'icon',
className: 'icon ic-settings',
style: {
marginLeft: '4px',
backgroundImage: 'url( "/icons/settings.svg" )',
backgroundRepeat: 'no-repeat',
}
} );
Expand Down
3 changes: 1 addition & 2 deletions src/lib/UI/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ export default class Dialog {
this.elements.btClose.addEventListener( 'click', this.handleClose );

createElement( 'span', this.elements.btClose, {
className: 'icon',
className: 'icon ic-close',
style: {
backgroundImage: 'url( "/icons/close.svg" )',
width: '24px',
height: '24px',
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createApp } from 'vue';
import App from './App.vue';

import '@public/css/main.css';
import '@public/assets/main.css';


createApp(App).mount('#app')
createApp(App).mount('#app');
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
alias: {
'@': resolve( __dirname, 'src' ),
'@dmidz/tickschart': resolve( __dirname, 'dist' ),// trick to compile demo/vanilla-ts using real world package path
'@public': resolve( __dirname, 'public' ),
'@public': resolve( __dirname, 'public/tickschart' ),
},
// preserveSymlinks: true,
},
Expand Down

0 comments on commit a4bfcfc

Please sign in to comment.