Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
938 changed files
with
45,085 additions
and
4,192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/build/ | ||
/vendor/ | ||
/composer.lock | ||
/composer.phar | ||
/composer.lock |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/coverage | ||
/node_modules | ||
npm-debug.log | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type ArcanesoftConfig = { | ||
vue?: { | ||
rootContainer: string, | ||
} | ||
} |
Oops, something went wrong.