Browse Source

more work on theme api docs and mock script

sisyphus
Dustin Falgout 9 years ago
parent
commit
96587a0b31
  1. 118
      themes/_vendor/js/mock.js

118
themes/_vendor/js/mock.js vendored

@ -34,7 +34,8 @@ if ('undefined' !== typeof lightdm) {
/** /**
* Interface for object that holds info about a session. Session objects are not * Interface for object that holds info about a session. Session objects are not
* created by the theme's code, but rather by the {@link lightdm} class. * created by the theme's code, but rather by the {@link window.lightdm} class.
* @type {Object}
* @interface * @interface
*/ */
let LightDMSession = { let LightDMSession = {
@ -63,7 +64,8 @@ let LightDMSession = {
/** /**
* Interface for object that holds info about a language on this system. Language objects are not * Interface for object that holds info about a language on this system. Language objects are not
* created by the theme's code, but rather by the {@link lightdm} class. * created by the theme's code, but rather by the {@link window.lightdm} class.
* @type {Object}
* @interface * @interface
*/ */
let LightDMLanguage = { let LightDMLanguage = {
@ -92,7 +94,8 @@ let LightDMLanguage = {
/** /**
* Interface for object that holds info about a keyboard layout on this system. Language * Interface for object that holds info about a keyboard layout on this system. Language
* objects are not created by the theme's code, but rather by the {@link lightdm} class. * objects are not created by the theme's code, but rather by the {@link window.lightdm} class.
* @type {Object}
* @interface * @interface
*/ */
let LightDMLayout = { let LightDMLayout = {
@ -121,67 +124,80 @@ let LightDMLayout = {
/** /**
* Interface for object that holds info about a user account on this system. User * Interface for object that holds info about a user account on this system. User
* objects are not created by the theme's code, but rather by the {@link lightdm} class. * objects are not created by the theme's code, but rather by the {@link window.lightdm} class.
* @type {Object}
* @interface * @interface
*/ */
let LightDMUser = { let LightDMUser = {
/** /**
* The display name for the user. * The display name for the user.
* @type {String} * @type {String}
* @readonly
*/ */
display_name: '', display_name: '',
/** /**
* The language for the user. * The language for the user.
* @type {String} * @type {String}
* @readonly
*/ */
language: '', language: '',
/** /**
* The keyboard layout for the user. * The keyboard layout for the user.
* @type {String} * @type {String}
* @readonly
*/ */
layout: '', layout: '',
/** /**
* The image for the user. * The image for the user.
* @type {String} * @type {String}
* @readonly
*/ */
image: '', image: '',
/** /**
* The home_directory for the user. * The home_directory for the user.
* @type {String} * @type {String}
* @readonly
*/ */
home_directory: '', home_directory: '',
/** /**
* The username for the user. * The username for the user.
* @type {String} * @type {String}
* @readonly
*/ */
username: '', username: '',
/** /**
* Whether or not the user is currently logged in. * Whether or not the user is currently logged in.
* @type {Boolean} * @type {Boolean}
* @readonly
*/ */
logged_in: false, logged_in: false,
/** /**
* The last session that the user logged into. * The last session that the user logged into.
* @type {String|null} * @type {String|null}
* @readonly
*/ */
session: '', session: '',
/** /**
* DEPRECATED!
* @deprecated See {@link LightDMUser.username}. * @deprecated See {@link LightDMUser.username}.
* @type {String} * @type {String}
* @readonly
*/ */
name: '', name: '',
/** /**
* DEPRECATED!
* @deprecated See {@link LightDMUser.display_name}. * @deprecated See {@link LightDMUser.display_name}.
* @type {String} * @type {String}
* @readonly
*/ */
real_name: '' real_name: ''
}; };
@ -191,9 +207,9 @@ let LightDMUser = {
* Singleton class which implements the LightDMGreeter Interface. Greeter themes will * Singleton class which implements the LightDMGreeter Interface. Greeter themes will
* interact directly with this class to facilitate the user log in processes. * interact directly with this class to facilitate the user log in processes.
* The greeter will automatically create an instance of this class when it starts. * The greeter will automatically create an instance of this class when it starts.
* The instance can be accessed through the {@link lightdm} global variable. * The instance can be accessed through the {@link window.lightdm} global variable.
*/ */
window.lightdm = class LightDMGreeter { window.lightdm = new (class LightDMGreeter {
constructor() { constructor() {
if ( null !== _greeter ) { if ( null !== _greeter ) {
@ -522,11 +538,11 @@ window.lightdm = class LightDMGreeter {
*/ */
suspend() {} suspend() {}
}; })();
/** /**
* Mock data to simulate the greeter's API in any web browser. * Mock data to simulate the greeter's API in any web browser.
* @type {Object} * @ignore
*/ */
const MockData = { const MockData = {
greeter: { greeter: {
@ -544,92 +560,24 @@ const MockData = {
'null': ['language', 'layout'] 'null': ['language', 'layout']
} }
}, },
/**
* @property {Object[]} languages
*/
languages: [ languages: [
/**
* @implements {LightDMLanguage}
* @instance
*/
{name: 'English', code: 'en_US.utf8', territory: 'USA'}, {name: 'English', code: 'en_US.utf8', territory: 'USA'},
/**
* @implements {LightDMLanguage}
* @instance
*/
{name: 'Catalan', code: 'ca_ES.utf8', territory: 'Spain'}, {name: 'Catalan', code: 'ca_ES.utf8', territory: 'Spain'},
/**
* @implements {LightDMLanguage}
* @instance
*/
{name: 'French', code: 'fr_FR.utf8', territory: 'France'} {name: 'French', code: 'fr_FR.utf8', territory: 'France'}
], ],
/**
* @property {Object[]} layouts
*/
layouts: [ layouts: [
/** @implements {LightDMLayout} */
{name: 'us', short_description: 'en', description: 'English (US)'}, {name: 'us', short_description: 'en', description: 'English (US)'},
/** @implements {LightDMLayout} */
{name: 'at', short_description: 'de', description: 'German (Austria)'}, {name: 'at', short_description: 'de', description: 'German (Austria)'},
/** @implements {LightDMLayout} */
{name: 'us rus', short_description: 'ru', description: 'Russian (US, phonetic)'} {name: 'us rus', short_description: 'ru', description: 'Russian (US, phonetic)'}
], ],
/** sessions: [
* @property {Object} sessions {key: 'gnome', name: 'GNOME', comment: 'This session logs you into GNOME'},
*/ {key: 'cinnamon', name: 'Cinnamon', comment: 'This session logs you into Cinnamon'},
sessions: { {key: 'plasma', name: 'Plasma', comment: 'Plasma by KDE'},
/** {key: 'mate', name: 'MATE', comment: 'This session logs you into MATE'},
* @property {Object} gnome {key: 'openbox', name: 'Openbox', comment: 'This session logs you into Openbox'}
* @implements {LightDMSession} ],
*/
gnome: {
key: 'gnome',
name: 'GNOME',
comment: 'This session logs you into GNOME'
},
/**
* @property {Object} cinnamon
* @implements {LightDMSession}
*/
cinnamon: {
key: 'cinnamon',
name: 'Cinnamon',
comment: 'This session logs you into Cinnamon'
},
/**
* @property {Object} plasma
* @implements {LightDMSession}
*/
plasma: {
key: 'plasma',
name: 'Plasma',
comment: 'Plasma by KDE'
},
/**
* @property {Object} mate
* @implements {LightDMSession}
*/
mate: {
key: 'mate',
name: 'MATE',
comment: 'This session logs you into MATE'
},
/**
* @property {Object} openbox
* @implements {LightDMSession}
*/
openbox: {
key: 'openbox',
name: 'Openbox',
comment: 'This session logs you into Openbox'
}
},
/**
* @property {Object[]} users
*/
users: [ users: [
/** @implements {LightDMUser} */
{ {
display_name: 'Clark Kent', display_name: 'Clark Kent',
language: null, language: null,
@ -643,7 +591,6 @@ const MockData = {
name: 'superman', name: 'superman',
real_name: 'Clark Kent' real_name: 'Clark Kent'
}, },
/** @implements {LightDMUser} */
{ {
display_name: 'Bruce Wayne', display_name: 'Bruce Wayne',
language: null, language: null,
@ -657,7 +604,6 @@ const MockData = {
name: 'batman', name: 'batman',
real_name: 'Bruce Wayne' real_name: 'Bruce Wayne'
}, },
/** @implements {LightDMUser} */
{ {
display_name: 'Peter Parker', display_name: 'Peter Parker',
language: null, language: null,
@ -817,5 +763,3 @@ function _lightdm_mock_get_user(username) {
return user; return user;
} }
*/ */
new window.lightdm();

Loading…
Cancel
Save