Skip to content

Commit

Permalink
refactor: remove reflect-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
guiseek committed Aug 22, 2024
1 parent 81089dc commit d90c24e
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 84 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"vite-tsconfig-paths": "^5.0.1"
},
"dependencies": {
"@websqnl/di": "^0.2.5",
"reflect-metadata": "^0.2.2"
"@websqnl/di": "^0.2.5"
}
}
18 changes: 1 addition & 17 deletions src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {TitleBar} from '@elements/title-bar'
import {dispatch, h} from '@utils'
import {use} from '@websqnl/di'

// dispatch(login({username: 'user', password: 'pass'}))

export const loadApp = (container: HTMLElement) => {
const canvas = use(Canvas)

Expand Down Expand Up @@ -48,17 +46,11 @@ export const loadApp = (container: HTMLElement) => {
ev.preventDefault()

dispatch(submitPresentation(form.value))
// handler.emit('presentation.submitted', form.value)

accordion.closeAll()
}
}

// handler.on('presentation.submitted', onPresentationSubmitted)
// handler.on('presentation.handled', onPresentationHandled)
// handler.on('presentation.created', onPresentationCreated)
// handler.on('presentation.added', onPresentationAdded)

/**
* ___ _ __ ___ _ __ ___ ___ _ __
* / __| '_ \ / _ \| '_ \/ __|/ _ \| '__|
Expand All @@ -72,26 +64,18 @@ export const loadApp = (container: HTMLElement) => {
// handler.emit('sponsor.selected', file)
}

// handler.on('sponsor.selected', onSponsorSelected)
// handler.on('sponsor.created', onSponsorCreated)
// handler.on('sponsor.added', onSponsorAdded)

control.sponsor.button.onclick = () => {
control.sponsor.input.click()
}

control.logo.onchange = (ev) => {
console.log(ev.target);

console.log(ev.target)
}

const form = new Form<Schema>(() => {
dispatch(updateForm(form.value))
// handler.emit('form.updated', form.value)
})

// handler.on('form.updated', onFormChange)

layer.background.setDraggable(false).setSrc(form.value.logo).render()

layer.logo.setOrder(4).setSrc('logos/dev-parana.svg').render()
Expand Down
12 changes: 0 additions & 12 deletions src/app/elements/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import {PresentationForm} from '@components/presentation'
import {children, getChildren} from '@utils/decorators'
import {SidenavButton} from './sidenav-button'
import {builtIn} from '@utils/decorators'

Expand Down Expand Up @@ -34,18 +32,8 @@ export class Sidenav extends HTMLElement {

#isOpened = false

@children(PresentationForm)
presentationForm: PresentationForm[] = []

connectedCallback() {
this.classList.add('cw-sidenav')
// this.append(this.button)

const observer = new MutationObserver(() => {
console.log(getChildren(this, 'presentationForm'))
})

observer.observe(this, {childList: true, subtree: true})
}

add(...children: Node[]) {
Expand Down
20 changes: 0 additions & 20 deletions src/app/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,18 @@ export const state = store<EventMap>()
*/
export const updateForm = state.action('form.updated')
export const updateLogo = state.action('form.logo-updated')
// export const updateForm = action<Schema>('form.updated')
// export const updateLogo = action<HTMLOptionElement>('form.logo-updated')

/**
* Presentation
*/
export const submitPresentation = state.action('presentation.submitted')
// export const submitPresentation = action<SubmittedPresentation>(
// 'presentation.submitted'
// )

export const handlePresentation = state.action('presentation.handled')
// export const handlePresentation = action<Presentation>('presentation.handled')

export const createPresentation = state.action('presentation.created')
// export const createPresentation = action<PresentationLayer>(
// 'presentation.created'
// )

export const addPresentation = state.action('presentation.added')
// export const addPresentation = action<PresentationLayer>('presentation.added')

/**
* Sponsor
*/
export const selectSponsor = state.action('sponsor.selected')

export const createSponsor = state.action('sponsor.created')

export const addSponsor = state.action('sponsor.added')
// export const selectSponsor = action<File>('sponsor.selected')

// export const createSponsor = action<ImageLayer>('sponsor.created')

// export const addSponsor = action<ImageLayer>('sponsor.added')
3 changes: 0 additions & 3 deletions src/app/store/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ export const onLogoUpdated = state.select('form.logo-updated')
* Presentation
*/
export const onPresentationSubmitted = state.select('presentation.submitted')

export const onPresentationHandled = state.select('presentation.handled')

export const onPresentationCreated = state.select('presentation.created')

export const onPresentationAdded = state.select('presentation.added')

/**
Expand Down
29 changes: 0 additions & 29 deletions src/app/utils/decorators/children.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/app/utils/decorators/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './autonomous'
export * from './built-in'
export * from './children'

0 comments on commit d90c24e

Please sign in to comment.