mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
[semantic-ui-site] Add type definitions. (#16995)
This commit is contained in:
committed by
Mohamed Hegazy
parent
879a6039ac
commit
e366674da8
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
interface JQueryStatic {
|
||||
site: SemanticUI.Site;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
site: SemanticUI.Site;
|
||||
}
|
||||
|
||||
declare namespace SemanticUI {
|
||||
interface Site {
|
||||
settings: SiteSettings;
|
||||
|
||||
(behavior: 'destroy'): JQuery;
|
||||
<K extends keyof SiteSettings>(behavior: 'setting', name: K, value?: undefined): SiteSettings[K];
|
||||
<K extends keyof SiteSettings>(behavior: 'setting', name: K, value: SiteSettings[K]): JQuery;
|
||||
(behavior: 'setting', value: SiteSettings.Param): JQuery;
|
||||
(settings?: SiteSettings.Param): JQuery;
|
||||
}
|
||||
|
||||
interface SiteSettings extends Pick<SiteSettings._Impl, keyof SiteSettings._Impl> { }
|
||||
|
||||
namespace SiteSettings {
|
||||
type Param = SiteSettings | object;
|
||||
|
||||
interface _Impl {
|
||||
modules: string[];
|
||||
siteNamespace: string;
|
||||
namespaceStub: Site.NamespaceStubSettings;
|
||||
|
||||
// region Component Settings
|
||||
|
||||
// region DOM Settings
|
||||
|
||||
/**
|
||||
* Event namespace. Makes sure module teardown does not effect other events attached to an element.
|
||||
*/
|
||||
namespace: string;
|
||||
|
||||
// endregion
|
||||
|
||||
// region Debug Settings
|
||||
|
||||
/**
|
||||
* Name used in log statements
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Silences all console output including error messages, regardless of other debug settings.
|
||||
*/
|
||||
silent: boolean;
|
||||
/**
|
||||
* Debug output to console
|
||||
*/
|
||||
debug: boolean;
|
||||
/**
|
||||
* Show console.table output with performance metrics
|
||||
*/
|
||||
performance: boolean;
|
||||
/**
|
||||
* Debug output includes all internal behaviors
|
||||
*/
|
||||
verbose: boolean;
|
||||
|
||||
// endregion
|
||||
|
||||
// endregion
|
||||
}
|
||||
}
|
||||
|
||||
namespace Site {
|
||||
interface NamespaceStubSettings extends Pick<NamespaceStubSettings._Impl, keyof NamespaceStubSettings._Impl> { }
|
||||
|
||||
namespace NamespaceStubSettings {
|
||||
type Param = NamespaceStubSettings | object;
|
||||
|
||||
interface _Impl {
|
||||
cache: any;
|
||||
config: any;
|
||||
sections: any;
|
||||
section: any;
|
||||
utilities: any;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// Type definitions for semantic-ui-site 2.2
|
||||
// Project: http://www.semantic-ui.com
|
||||
// Definitions by: Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference path="global.d.ts" />
|
||||
|
||||
declare const site: SemanticUI.Site;
|
||||
export = site;
|
||||
@@ -0,0 +1,52 @@
|
||||
function test_site_static() {
|
||||
$.site.settings.namespace = 'namespace';
|
||||
$.site.settings.name = 'name';
|
||||
$.site.settings.silent = false;
|
||||
$.site.settings.debug = true;
|
||||
$.site.settings.performance = true;
|
||||
$.site.settings.verbose = true;
|
||||
|
||||
$.fn.site.settings.namespace = 'namespace';
|
||||
$.fn.site.settings.name = 'name';
|
||||
$.fn.site.settings.silent = false;
|
||||
$.fn.site.settings.debug = true;
|
||||
$.fn.site.settings.performance = true;
|
||||
$.fn.site.settings.verbose = true;
|
||||
}
|
||||
|
||||
function test_site() {
|
||||
const selector = '.ui.site';
|
||||
$(selector).site('destroy') === $();
|
||||
$(selector).site('setting', 'debug', undefined) === false;
|
||||
$(selector).site('setting', 'debug') === false;
|
||||
$(selector).site('setting', 'debug', true) === $();
|
||||
$(selector).site('setting', {
|
||||
namespace: 'namespace',
|
||||
name: 'name',
|
||||
silent: false,
|
||||
debug: true,
|
||||
performance: true,
|
||||
verbose: true
|
||||
}) === $();
|
||||
$(selector).site({
|
||||
modules: [
|
||||
'module1',
|
||||
'module2',
|
||||
],
|
||||
siteNamespace: 'siteNamespace',
|
||||
namespaceStub: {
|
||||
cache: {},
|
||||
config: {},
|
||||
sections: {},
|
||||
section: {},
|
||||
utilities: {}
|
||||
}
|
||||
}) === $();
|
||||
$(selector).site() === $();
|
||||
}
|
||||
|
||||
import site = require('semantic-ui-site');
|
||||
|
||||
function test_module() {
|
||||
$.fn.site = site;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"global.d.ts",
|
||||
"semantic-ui-site-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-empty-interface": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user