Skip to content

Commit

Permalink
Merge 310757a into 2c24885
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Nov 21, 2020
2 parents 2c24885 + 310757a commit 716ccd1
Show file tree
Hide file tree
Showing 938 changed files with 45,085 additions and 4,192 deletions.
10 changes: 5 additions & 5 deletions .editorconfig
@@ -1,15 +1,15 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
22 changes: 13 additions & 9 deletions .gitattributes
@@ -1,9 +1,13 @@
/_docs export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/CONTRIBUTING.md export-ignore
/phpunit.xml.dist export-ignore
* text=auto

/.github export-ignore
/_docs export-ignore
/tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpcs.xml.dist export-ignore
phpunit.xml.dist export-ignore
CONTRIBUTING.md export-ignore
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,4 +1,4 @@
/build/
/vendor/
/composer.lock
/composer.phar
/composer.lock
35 changes: 0 additions & 35 deletions .scrutinizer.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .travis.yml

This file was deleted.

31 changes: 0 additions & 31 deletions CONTRIBUTING.md

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

62 changes: 0 additions & 62 deletions README.md

This file was deleted.

4 changes: 4 additions & 0 deletions assets/.gitignore
@@ -0,0 +1,4 @@
/coverage
/node_modules
npm-debug.log
yarn-error.log
16 changes: 16 additions & 0 deletions assets/jest.config.ts
@@ -0,0 +1,16 @@
import type { Config } from '@jest/types';

const config: Config.InitialOptions = {
verbose: true,
preset: 'ts-jest',
clearMocks: true,
testEnvironment: 'node',
collectCoverageFrom: [
"<rootDir>/src/**/*.ts",
],
moduleFileExtensions: [
'ts', 'js',
],
}

export default config
122 changes: 122 additions & 0 deletions assets/js/classes/arcanesoft/index.ts
@@ -0,0 +1,122 @@
import { App } from '@vue/runtime-core'
import emitter, { EventterInterface, EventType, WildcardHandler } from '@arcanescripts/eventter'
import { RequestInstance, RequestConfig } from '@arcanescripts/request'
import Csrf from '@arcanesoft/core/src/helpers/csrf'
import { Arcanesoft as ArcanesoftContract } from '@arcanesoft/core/src/contracts/arcanesoft'
import { ArcanesoftConfig } from './types'
import request from '../../helpers/request'
import app from '../../vue/app'
import UI from '../ui'

class Arcanesoft implements ArcanesoftContract {
// Properties
//----------------------------------

public app: App
public emitter: EventterInterface
public ui: UI
protected _config: ArcanesoftConfig
protected _started: Boolean = false

// Constructor
//----------------------------------

public constructor(config?: ArcanesoftConfig) {
this.app = app
this._config = config || {}
this.emitter = emitter()
this.ui = new UI
}

// Main Methods
//----------------------------------

public run(): void {
if (this._started === true)
return

this.emit('arcanesoft::starting', this)

this.app.mount(this._config.vue.rootContainer)

this.emit('arcanesoft::started', this)

this._started = true
}

public getLocale(): string {
return this._config['locale']
|| document.querySelector('html').getAttribute('lang')
}

/**
* Register a listener on built-in event bus
*/
public on(event: EventType, callback: WildcardHandler): this {
this.emitter.on(event, callback)

return this
}

/**
* Register a one-time listener on the event bus
*/
public once(event: EventType, handler: WildcardHandler): this {
this.emitter.once(event, handler)

return this
}

/**
* Unregister an listener on the event bus
*/
public off(type: EventType | '*', handler?: WildcardHandler): this {
this.emitter.off(type, handler)

return this
}

/**
* Emit an event on the event bus
*/
public emit(event: EventType, ...args: any[]): this {
this.emitter.emit(event, ...args)

return this
}

// Utilities
//----------------------------------

/**
* Return an instance configured to make HTTP requests.
*/
public request = (options?: RequestConfig): RequestInstance => request(options)

/**
* Get the CSRF Token.
*/
public csrf(): string {
return Csrf.token()
}

// Other Methods
//----------------------------------

public bootComponents(dom: Document): void {
this.ui.initToasts(dom)
this.ui.initTooltips(dom)
this.ui.initPageScrolled()
// this.ui.initTextAutosize()
}
}

export {
Arcanesoft,
ArcanesoftContract,
ArcanesoftConfig,
}

export default (config: ArcanesoftConfig): ArcanesoftContract => {
return window['ARCANESOFT'] = new Arcanesoft(config)
}
5 changes: 5 additions & 0 deletions assets/js/classes/arcanesoft/types.ts
@@ -0,0 +1,5 @@
export type ArcanesoftConfig = {
vue?: {
rootContainer: string,
}
}

0 comments on commit 716ccd1

Please sign in to comment.