Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refocus the docs on a library consumer instead of maintainer #77

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* WAMS code to be executed in the client browser.
*/

/**
* This file defines the entry point for the client side of a WAMS application.
*
Expand All @@ -12,6 +8,7 @@
* style = "max-height: 200px;"
* >
*
* @ignore
* @module client
*/

Expand Down
1 change: 1 addition & 0 deletions src/client/ClientController.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const symbols = Object.freeze({
* messages based on user interaction with the canvas and receives messages from
* the server detailing changes to post to the view.
*
* @private
* @memberof module:client
*
* @param {HTMLCanvasElement} canvas - The underlying CanvasElement object, (not
Expand Down
3 changes: 2 additions & 1 deletion src/client/ClientElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ const { Point2D, WamsElement } = require('../shared.js');
/**
* The ClientElement class exposes the draw() funcitonality of wams elements.
*
* @extends module:shared.WamsElement
* @private
* @memberof module:client
* @extends module:shared.WamsElement
*
* @param {module:shared.WamsElement} data - The data from the server describing this item.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/client/ClientImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ function createImage(src) {
/**
* The ClientImage class exposes the draw() funcitonality of wams items.
*
* @extends module:shared.WamsImage
* @private
* @memberof module:client
* @extends module:shared.WamsImage
*
* @param {module:shared.Item} data - The data from the server describing this item.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/client/ClientItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ const { CanvasSequence } = require('canvas-sequencer');
/**
* The ClientItem class exposes the draw() funcitonality of wams items.
*
* @extends module:shared.CanvasItem
* @private
* @memberof module:client
* @extends module:shared.CanvasItem
*
* @param {module:shared.CanvasItem} data - The data from the server describing this item.
*/
Expand Down
1 change: 1 addition & 0 deletions src/client/ClientModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const REQUIRED_DATA = Object.freeze(['viewId', 'items', 'views']);
* The ClientModel is a client-side copy of those aspects of the model that are
* necessary for rendering the view for the user.
*
* @private
* @memberof module:client
*/
class ClientModel {
Expand Down
3 changes: 2 additions & 1 deletion src/client/ClientView.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ const DEFAULT_CONFIG = Object.freeze({
* track of its own position, scale, and orientation, as well as those values
* for all items and all other views (which will be represented with outlines).
*
* @extends module:shared.View
* @private
* @memberof module:client
* @extends module:shared.View
*
* @param {CanvasRenderingContext2D} context - The canvas context in which to
* render the model.
Expand Down
3 changes: 2 additions & 1 deletion src/client/ShadowView.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ const symbols = Object.freeze({
* The ShadowView class exposes a simple draw() function which renders a shadowy
* outline of the view onto the canvas.
*
* @extends module:shared.View
* @private
* @memberof module:client
* @extends module:shared.View
*
* @param {module:shared.View} values - server-provided data describing this
* view.
Expand Down
8 changes: 4 additions & 4 deletions src/mixins.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* Mixins used by the WAMS project.
* Mixins used by the WAMS project. These provide much of the functionality for
* manipulating items and views.
*
* <br>
* <img
Expand All @@ -9,11 +10,10 @@
* >
* <p>
*
* @see For a rundown on the mixin pattern I use: {@link
* @see For a rundown on the mixin pattern used: {@link
* http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/}.
* Note that I actually like the base syntax, and prefer not to add another
* dependency by requiring the module implemented by the author of that article.
*
* @private
* @module mixins
*/

Expand Down
1 change: 1 addition & 0 deletions src/mixins/Hittable.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const Interactable = require('./Interactable.js');
* The purpose of the Hittable mixin is simply to provide functionality for
* interacting with the 'hitbox' property.
*
* @private
* @memberof module:mixins
*
* @mixin
Expand Down
1 change: 1 addition & 0 deletions src/mixins/Identifiable.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const STAMPER = new IdStamper();
* Labels each instantiated object with a unique, immutable ID. All classes that
* use this mixin will share the same pool of IDs.
*
* @private
* @memberof module:mixins
*
* @mixin
Expand Down
1 change: 1 addition & 0 deletions src/mixins/Interactable.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Transformable2D = require('./Transformable2D.js');
* This mixin combines the Transformable2D, Lockable, and Publishable mixins to
* produce an object that can be interacted with by a WAMS application.
*
* @private
* @memberof module:mixins
*
* @mixin
Expand Down
1 change: 1 addition & 0 deletions src/mixins/Lockable.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const holder = Symbol.for('holder');
* The Lockable mixin allows a class to enable itself to be locked and unlocked,
* with the default being unlocked.
*
* @private
* @memberof module:mixins
*
* @mixin
Expand Down
1 change: 1 addition & 0 deletions src/mixins/Locker.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const lockedItem = Symbol('lockedItem');
/**
* The Locker mixin allows a class to obtain and release a lock on an item.
*
* @private
* @memberof module:mixins
*
* @mixin
Expand Down
1 change: 1 addition & 0 deletions src/mixins/Publishable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const symbols = Object.freeze({
* is ensure that the publication will not be sent until all transformations
* relating to an event have been applied.
*
* @private
* @memberof module:mixins
*
* @mixin
Expand Down
1 change: 1 addition & 0 deletions src/mixins/Transformable2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { Point2D } = require('../shared.js');
* This mixin provides 2D transformation operations for classes with 'x', 'y',
* 'scale' and 'rotation' properties.
*
* @private
* @memberof module:mixins
*
* @mixin
Expand Down
14 changes: 14 additions & 0 deletions src/predefined/layouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ class TableLayout {
device.rotateBy(-constants.ROTATE_90);
}

/**
* Apply the layout to a newly connected view and its device.
*
* @param {module:server.ServerView} view
* @param {module:server.Device} device
*/
layout(view, device) {
const index = view.index > 0 ? (view.index % 4) + 1 : 0;
console.log('INDEX', index);
Expand Down Expand Up @@ -128,6 +134,12 @@ class LineLayout {
this.deviceRights = [];
}

/**
* Apply the layout to a newly connected view and its device.
*
* @param {module:server.ServerView} view
* @param {module:server.Device} device
*/
layout(view, device) {
if (this.views.length > 0) {
// Challenge with the layout is to position the new view correctly in the
Expand Down Expand Up @@ -157,6 +169,7 @@ class LineLayout {
}

/**
* @private
* @deprecated
* @param {number} overlap
* @returns {TableLayout}
Expand All @@ -168,6 +181,7 @@ function table(overlap) {
}

/**
* @private
* @deprecated
* @param {number} overlap
* @returns {LineLayout}
Expand Down
1 change: 1 addition & 0 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* style = "max-height: 260px;"
* >
*
* @private
* @module server
*/

Expand Down
1 change: 1 addition & 0 deletions src/server/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { Transformable2D } = require('../mixins.js');
* A Device keeps track of the physical position of a device connected to an
* application.
*
* @private
* @memberof module:server
* @extends module:shared.View
* @mixes module:mixins.Transformable2D
Expand Down
1 change: 1 addition & 0 deletions src/server/GestureController.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const { Region, Pan, Rotate, Pinch, Swipe, Swivel, Tap } = require('westures/ind
* The GestureController is in charge of processing server-side gestures for the
* purpose of enabling multi-device gestures.
*
* @private
* @memberof module:server
*
* @param {module:server.MessageHandler} messageHandler - For responding to
Expand Down
1 change: 1 addition & 0 deletions src/server/MessageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* The MessageHandler logs listeners that are attached by the user and receives
* messages from clients, which it then uses to call the appropriate listener.
*
* @private
* @memberof module:server
*
* @param {module:server.Application} application - The WAMS application for
Expand Down
1 change: 1 addition & 0 deletions src/server/ServerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const symbols = Object.freeze({
* A ServerController maintains a socket.io connection between a client and the
* server. It tracks a view associated with the client.
*
* @private
* @memberof module:server
*
* @param {number} index - The index of this ServerController in the workspace,
Expand Down
1 change: 1 addition & 0 deletions src/server/Switchboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function logConnection(id, status) {
* server establishment, and establishing connections when new clients connect
* to the server.
*
* @private
* @memberof module:server
*
* @param {module:server.Application} application - The WAMS application for
Expand Down
1 change: 1 addition & 0 deletions src/server/ViewSpace.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const ServerView = require('./ServerView');
/**
* The ViewSpace keeps track of views and view groups.
*
* @private
* @memberof module:server
*
* @param {module:server.MessageHandler} messageHandler - The message handler for
Expand Down
1 change: 1 addition & 0 deletions src/server/WorkSpace.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ServerItem = require('./ServerItem.js');
* The WorkSpace keeps track of items, and can handle events on those items
* which allow them to be interacted with.
*
* @private
* @memberof module:server
*
* @param {Namespace} namespace - Socket.io namespace for publishing changes.
Expand Down
1 change: 1 addition & 0 deletions src/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* style = "max-height: 250px;"
* >
*
* @private
* @module shared
*/

Expand Down
1 change: 1 addition & 0 deletions src/shared/IdStamper.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function getUniqueId(previous) {
* IdStamper.cloneId(danger, obj.id); // Will work. 'danger' & 'obj' are
* // now both using the same Id.
*
* @private
* @memberof module:shared
*/
class IdStamper {
Expand Down
1 change: 1 addition & 0 deletions src/shared/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/**
* Enum of the various message types.
*
* @private
* @name Message
* @enum {string}
* @readonly
Expand Down
19 changes: 14 additions & 5 deletions src/shared/bases.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This Item class provides a common interface between the client and the server
* by which the Items can interact safely.
*
* @class Item
* @private
* @memberof module:shared
* @param {Object} values - User-supplied data detailing the item.
*/
Expand Down Expand Up @@ -89,6 +89,15 @@ class Item {
}
}

/**
* This CanvasItem class provides a common interface between the client and the
* server by which items that are defined by sequences of canvas instructions
* can be rendered safely.
*
* @private
* @memberof module:shared
* @param {Object} values - User-supplied data detailing the item.
*/
class CanvasItem extends Item {
constructor(values = {}) {
super({
Expand Down Expand Up @@ -124,7 +133,7 @@ class CanvasItem extends Item {
* This RectangularItem class provides a common interface between the client and
* the server by which the RectangularItems can interact safely.
*
* @class RectangularItem
* @private
* @extends module:shared.Item
* @memberof module:shared
* @param {Object} values - User-supplied data detailing the item.
Expand Down Expand Up @@ -172,7 +181,7 @@ class RectangularItem extends Item {
* This WamsElement class provides a common interface between the client and the
* server by which the elements interact safely.
*
* @class WamsElement
* @private
* @extends module:shared.RectangularItem
* @memberof module:shared
* @param {Object} values - User-supplied data detailing the item.
Expand Down Expand Up @@ -232,7 +241,7 @@ class WamsElement extends RectangularItem {
* This WamsImage class provides a common interface between the client and the
* server by which the images can interact safely.
*
* @class WamsImage
* @private
* @extends module:shared.RectangularItem
* @memberof module:shared
* @param {Object} values - User-supplied data detailing the item.
Expand Down Expand Up @@ -274,7 +283,7 @@ class WamsImage extends RectangularItem {
* This View class provides a common interface between the client and
* the server by which the Views can interact safely.
*
* @class View
* @private
* @memberof module:shared
* @extends module:shared.RectangularItem
* @param {Object} values - User-supplied data detailing the item.
Expand Down
3 changes: 2 additions & 1 deletion src/shared/utilities.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
'use strict';

/**
* @namespace utilities
* @memberof module:shared
*/

/**
* Plain, simple NOP definition. If there's a faster NOP, redefine it here.
*
* @private
* @memberof module:shared.utilities
*/
const NOP = () => {};

/**
* Removes the given item from the given array, according to its Id.
*
* @private
* @memberof module:shared.utilities
*
* @param {Object[]} array - The array to modify.
Expand Down