From 7f859e4c7390e40c41f6789e085f2115d22ce44e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Thu, 5 Jul 2012 20:11:52 -0400 Subject: [PATCH] Initial implementation for generating manifest files. --- build/core.json | 45 +++++++++++++++ build/effects.json | 41 +++++++++++++ build/tasks/build.js | 74 ++++++++++++++++++++++++ build/widgets.json | 135 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 295 insertions(+) create mode 100644 build/core.json create mode 100644 build/effects.json create mode 100644 build/widgets.json diff --git a/build/core.json b/build/core.json new file mode 100644 index 000000000..e50a57b42 --- /dev/null +++ b/build/core.json @@ -0,0 +1,45 @@ +{ + "core": { + "description": "The core of jQuery UI, required for all interactions and widgets." + }, + "datepicker": { + "description": "A datepicker than can be toggled from a input or displayed inline.", + "dependencies": [ "core" ], + "keywords": [ + "form", + "calendar", + "date", + "i18n" + ] + }, + "effect": { + "description": "Extends the internal jQuery effects, includes morphing, easing and is required by all other effects.", + "keywords": [ + "animation", + "show", + "hide", + "color", + "class", + "transition", + "easing" + ] + }, + "position": { + "description": "A utility plugin for positioning elements relative to other elements.", + "keywords": [ + "offset", + "relative", + "absolute", + "fixed", + "collision" + ] + }, + "widget": { + "description": "Provides a factory for creating stateful widgets with a common API.", + "keywords": [ + "abstraction", + "state", + "factory" + ] + } +} diff --git a/build/effects.json b/build/effects.json new file mode 100644 index 000000000..ef69ef82b --- /dev/null +++ b/build/effects.json @@ -0,0 +1,41 @@ +{ + "blind": { + "description": "Blinds the element." + }, + "bounce": { + "description": "Bounces an element horizontally or vertically n-times." + }, + "clip": { + "description": "Clips the element on and off like an old TV." + }, + "drop": { + "description": "A Drop out effect by moving the element in one direction and hiding it at the same time." + }, + "explode": { + "description": "The element explodes in all directions into n pieces. Also supports imploding again." + }, + "fade": { + "description": "Fades the element." + }, + "fold": { + "description": "Folds the element first horizontally and then vertically." + }, + "highlight": { + "description": "Highlights the background of the element in a defined color for a custom duration." + }, + "pulsate": { + "description": "The element pulsates n times by changing the opacity to zero and back." + }, + "scale": { + "description": "Grow or shrink any element and its content and restore it again." + }, + "shake": { + "description": "Shakes the element horizontally or vertically n times." + }, + "slide": { + "description": "The element slides in and out of the viewport." + }, + "transfer": { + "description": "Transfer effect from one element to another." + } +} diff --git a/build/tasks/build.js b/build/tasks/build.js index 06a4b98a2..aeacc232d 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -2,6 +2,80 @@ module.exports = function( grunt ) { var path = require( "path" ); +grunt.registerTask( "manifest", "Generate jquery.json manifest files", function() { + var pkg = grunt.config( "pkg" ), + base = { + core: { + name: "ui.{plugin}", + title: "jQuery UI {Plugin}" + }, + widgets: { + name: "ui.{plugin}", + title: "jQuery UI {Plugin}", + dependencies: [ "core", "widget" ] + }, + effects: { + name: "ui.effect-{plugin}", + title: "jQuery UI {Plugin} Effect", + keywords: [ "effect", "show", "hide" ], + // TODO: Will we have individual pages for 1.9? + homepage: "http://jqueryui.com/effect/", + // TODO: Will we have individual pages for 1.9? + demo: "http://jqueryui.com/effect/", + docs: "http://api.jqueryui.com/{plugin}-effect/", + dependencies: [ "effect" ], + file: "ui.effect-{plugin}" + } + }; + + Object.keys( base ).forEach(function( type ) { + var baseManifest = base[ type ], + plugins = grunt.file.readJSON( "build/" + type + ".json" ); + + Object.keys( plugins ).forEach(function( plugin ) { + var manifest, + data = plugins[ plugin ], + name = plugin.charAt( 0 ).toUpperCase() + plugin.substr( 1 ); + + function replace( str ) { + return str.replace( "{plugin}", plugin ).replace( "{Plugin}", name ); + } + + manifest = { + name: replace( baseManifest.name ), + title: replace( baseManifest.title ), + description: data.description, + keywords: [ "ui", plugin ] + .concat( baseManifest.keywords || [] ) + .concat( data.keywords || [] ), + version: pkg.version, + author: pkg.author, + maintainers: pkg.maintainers, + bugs: pkg.bugs, + homepage: data.homepage || replace( baseManifest.homepage || + "http://jqueryui.com/{plugin}/" ), + demo: data.demo || replace( baseManifest.demo || + "http://jqueryui.com/{plugin}/" ), + docs: data.docs || replace( baseManifest.docs || + "http://api.jqueryui.com/{plugin}/" ), + download: "http://jqueryui.com/download/", + dependencies: { + jquery: ">=1.6" + } + }; + + (baseManifest.dependencies || []) + .concat(data.dependencies || []) + .forEach(function( dependency ) { + manifest.dependencies[ "ui." + dependency ] = pkg.version; + }); + + grunt.file.write( replace( baseManifest.file || "ui.{plugin}" ) + ".jquery.json", + JSON.stringify( manifest, null, "\t" ) ); + }); + }); +}); + grunt.registerMultiTask( "copy", "Copy files to destination folder and replace @VERSION with pkg.version", function() { function replaceVersion( source ) { return source.replace( /@VERSION/g, grunt.config( "pkg.version" ) ); diff --git a/build/widgets.json b/build/widgets.json new file mode 100644 index 000000000..e39b046a4 --- /dev/null +++ b/build/widgets.json @@ -0,0 +1,135 @@ +{ + "accordion": { + "dependencies": [], + "description": "Collapsable content panels for displaying information in a limited amount of space.", + "keywords": [ + "navigation", + "panel", + "collapse", + "expand" + ] + }, + "autocomplete": { + "dependencies": [ "menu", "position" ], + "description": "Provides a list of suggested words as the user is typing.", + "keywords": [ + "form", + "word", + "predict", + "suggest" + ] + }, + "button": { + "dependencies": [], + "description": "Enhance your forms with themable buttons.", + "keywords": [ + "form", + "radio", + "checkbox" + ] + }, + "dialog": { + "dependencies": [ "button", "draggable", "position", "resizable" ], + "description": "Customizable dialog windows.", + "keywords": [ + "modal", + "alert", + "popup" + ] + }, + "draggable": { + "dependencies": [ "mouse" ], + "description": "Enable dragging functionality for any element.", + "keywords": [ + "drag", + "drop" + ] + }, + "droppable": { + "dependencies": [ "draggable", "mouse" ], + "description": "Create drop targets for draggable elements.", + "keywords": [ + "drag", + "drop" + ] + }, + "menu": { + "dependencies": [ "position" ], + "description": "Easily create nestable menus.", + "keywords": [ + "dropdown", + "flyout" + ] + }, + "mouse": { + "dependencies": [], + "description": "An abstraction for any mouse-based interactions.", + "keywords": [ + "abstraction" + ] + }, + "progressbar": { + "dependencies": [], + "description": "A status indicator that can be used for a loading state and standard percentage indicators.", + "keywords": [ + "determinate", + "status" + ] + }, + "resizable": { + "dependencies": [ "mouse" ], + "description": "Enable resize functioality for any element.", + "keywords": [ + "resize" + ] + }, + "selectable": { + "dependencies": [ "mouse" ], + "description": "Create groups of elements that can be selected with the mouse.", + "keywords": [ + "selection" + ] + }, + "slider": { + "dependencies": [ "mouse" ], + "description": "A flexible slider with ranges and accessibility via keyboard.", + "keywords": [ + "form", + "number", + "range" + ] + }, + "sortable": { + "dependencies": [ "mouse" ], + "description": "Sort items in a list using the mouse.", + "keywords": [ + "sort", + "list" + ] + }, + "spinner": { + "dependencies": [ "button" ], + "description": "Easily input numbers via the keyboard or mouse.", + "keywords": [ + "form", + "number", + "spinbutton", + "stepper" + ] + }, + "tabs": { + "dependencies": [], + "description": "Transforms a set of container elements into a tab structure.", + "keywords": [ + "navigation", + "panel", + "collapse", + "expand" + ] + }, + "tooltip": { + "dependencies": [ "position" ], + "description": "Show additional information for any element on hover or focus.", + "keywords": [] + } +} -- 2.39.5