• R/O
  • SSH

micro-formelements: Commit

html form management library


Commit MetaInfo

Revisionf48588b7e28d5c29b0f9d399d6bf4831184f44e3 (tree)
Time2018-05-17 13:02:46
Authorfrostbane <frostbane@prog...>
Commiterfrostbane

Log Message

(empty log message)

Change Summary

Incremental Difference

diff -r 000000000000 -r f48588b7e28d .hgignore
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Thu May 17 13:02:46 2018 +0900
@@ -0,0 +1,9 @@
1+syntax: regexp
2+^.idea\/.*
3+^tmp\/.*
4+.zim\/.*
5+^bin/*
6+^doc/*
7+node_modules/*
8+
9+.*\.orig
diff -r 000000000000 -r f48588b7e28d Gruntfile.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Gruntfile.js Thu May 17 13:02:46 2018 +0900
@@ -0,0 +1,193 @@
1+/*
2+ * micro-form
3+ *
4+ *
5+ *
6+ */
7+
8+
9+module.exports = function(grunt){
10+
11+ 'use strict';
12+
13+ /* */// ------------------------------------------------ //
14+ /* */// 設定定義
15+ /* */// ------------------------------------------------ //
16+
17+ var jxUnitConfig = {
18+ test :{
19+ options :{
20+ stopOnFail :true,
21+ stopOnException :true,
22+ verbose :true,
23+ outputColor :true,
24+ debugMode :true,
25+ useLogIcons :true,
26+ },
27+ testsuites :[
28+ {
29+ target :"./src/microform.js",
30+ file :"./test/microform.test.js",
31+ },
32+ ],
33+ },
34+
35+ test_min :{
36+ options :{
37+ stopOnFail :true,
38+ stopOnException :true,
39+ verbose :false,
40+ outputColor :true,
41+ debugMode :false,
42+ useLogIcons :true,
43+ },
44+ testsuites :[
45+ {
46+ target :"./bin/microcheck/microform.js",
47+ file :"./test/microform.test.js",
48+ },
49+ ],
50+ },
51+
52+ },
53+
54+ jsDocConfig = {
55+ sable :{
56+ src :[
57+ './src/microcheck.js',
58+ //'./README.md',
59+ ],
60+ options :{
61+ destination :'./doc/microform',
62+ configure :"./jsdoc.conf.json",
63+ template :'./node_modules/jsdoc-sable'
64+ }
65+ },
66+ },
67+
68+ uglifyConfig = {
69+ release :{
70+ options :{
71+ preserveComments :function(node, comment){
72+ // preserve comments that start with a bang
73+ return /^!/.test(comment.value);
74+ },
75+ mangle :true,
76+ compress :true,
77+ },
78+
79+ files :{
80+ './bin/microform/microform.js' :[
81+ './src/microform.js',
82+ ],
83+ },
84+ },
85+ },
86+
87+ copyConfig = {
88+ release :{
89+ files :[
90+ {
91+ expand :false,
92+ src :[
93+ './LICENSE.md',
94+ ],
95+ dest :'./bin/microform/LICENSE.md',
96+ filter :'isFile'
97+ },
98+ {
99+ expand :false,
100+ src :[
101+ './package.json',
102+ ],
103+ dest :'./bin/microform/package.json',
104+ filter :'isFile'
105+ },
106+ ],
107+ },
108+ };
109+
110+ /* */// ------------------------------------------------ //
111+ /* */// 設定登録
112+ /* */// ------------------------------------------------ //
113+
114+ grunt.initConfig({
115+ jxunit :jxUnitConfig,
116+ jsdoc :jsDocConfig,
117+ uglify :uglifyConfig,
118+ copy :copyConfig,
119+
120+ });
121+
122+ /* */// ------------------------------------------------ //
123+ /* */// タスク読み込み
124+ /* */// ------------------------------------------------ //
125+
126+ [
127+ 'grunt-jxunit',
128+ 'grunt-jsdoc',
129+ 'grunt-contrib-uglify',
130+ 'grunt-contrib-copy',
131+ ]
132+ .map(function(task){
133+ grunt.loadNpmTasks(task);
134+ });
135+
136+ /* */// ------------------------------------------------ //
137+ /* */// タスク登録
138+ /* */// ------------------------------------------------ //
139+
140+ [
141+ {
142+ target :"test",
143+ commands :[
144+ "jxunit:test",
145+ ],
146+ },
147+ {
148+ summary :"test the minified source",
149+ target :"test_min",
150+ commands :[
151+ "jxunit:test_min",
152+ ],
153+ },
154+ {
155+ summary :"prepare the src dir for publish",
156+ target :"release",
157+ commands :[
158+ "uglify:release",
159+ "copy:release",
160+ "jsdoc:sable",
161+ "jxunit:test_min",
162+ ],
163+ },
164+ {
165+ summary :"document",
166+ target :"document:sable",
167+ alias :[
168+ "document",
169+ ],
170+ commands :[
171+ "jsdoc:sable",
172+ ],
173+ },
174+ ]
175+ .map(function(task){
176+ var alias = task.alias || [];
177+ if(alias.indexOf(task.name) < 0)
178+ alias = alias.concat([task.target]);
179+ alias.map(function(target){
180+ if(typeof target === typeof undefined ||
181+ target === null ||
182+ target.trim() === "")
183+ return;
184+
185+ grunt.registerTask(target, task.commands);
186+ });
187+
188+ });
189+
190+
191+ /* */// ------------------------------------------------ //
192+
193+};
diff -r 000000000000 -r f48588b7e28d LICENSE.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE.md Thu May 17 13:02:46 2018 +0900
@@ -0,0 +1,127 @@
1+# Copyright (c) 2018, Frostbane Ac #
2+All rights reserved.
3+
4+#### Definitions ####
5+
6+- **Copyright Holder** means the individual(s) or organization(s) named
7+in the copyright notice for the entire Package.
8+
9+- **Contributor** means any party that has contributed code or other
10+material to the Package, in accordance with the Copyright Holder's
11+procedures.
12+
13+- **You** and **your** means any person who would like to copy,
14+distribute, or modify the Package.
15+
16+- **Package** means the collection of files distributed by the Copyright
17+Holder, and derivatives of that collection and/or of those files. A
18+given Package may consist of either the Standard Version, or a Modified
19+Version.
20+
21+- **(Re)Distribute** means providing a copy of the Package or making it
22+accessible to anyone else, or in the case of a company or organization,
23+to others outside of your company or organization.
24+
25+- **Distributor Fee** means any fee that you charge for Distributing
26+this Package or providing support for this Package to another party. It
27+does not mean licensing fees.
28+
29+- **Standard Version** refers to the Package if it has not been
30+modified, or has been modified only in ways explicitly requested by the
31+Copyright Holder.
32+
33+- **Modified Version** means the Package, if it has been changed, and
34+such changes were not explicitly requested by the Copyright Holder.
35+
36+- **Original License** means this License as Distributed with the
37+Standard Version of the Package, in its current version or as it may be
38+modified by Frostbane Ac in the future.
39+
40+- **Source** form means the source code, documentation source, and
41+configuration files for the Package.
42+
43+- **Compiled** form means the compiled bytecode, object code, binary, or
44+any other form resulting from mechanical transformation or translation
45+of the Source form.
46+
47+#### Terms and Conditions ####
48+
49+Redistribution and use in source and binary forms are permitted provided
50+that the following terms and conditions are met:
51+
52+1. Redistributions of source code must retain the above copyright
53+notice, this list of conditions and the following disclaimer.
54+
55+2. Redistributions in binary form, or linking to the package must
56+reproduce the above copyright notice, this list of conditions and the
57+following disclaimer in the documentation and/or other materials
58+provided with the distribution.
59+
60+3. All advertising materials mentioning features or use of this software
61+must display the following acknowledgement:
62+
63+```
64+This product includes software developed by `Frostbane Ac`.
65+```
66+
67+4. Neither the name of micro-form nor the names of its
68+contributors may be used to endorse or promote products derived from
69+this software without specific prior written permission.
70+
71+5. Copying the source code and distributing it with another name results
72+to direct copyright infridgement.
73+
74+6. Modification of the source code is allowed without restrictions,
75+provided that you do not distribute the modified version.
76+
77+7. Modified versions may be distributed, provided that you include a
78+list of modifications together with the distribution and the modified
79+source code must be included with the distribution and available in
80+to the public.
81+
82+8. You may distribute the modified version without the source code
83+provided that you must include complete instructions on how to get
84+the Modified source. Such instructions must be valid at the time
85+of your distribution. If these instructions, at any time while you
86+are carrying out such distribution, become invalid, you must provide
87+new instructions on demand or cease further distribution. If you
88+provide valid instructions or cease distribution within thirty days
89+after you become aware that the instructions are invalid, then you
90+do not forfeit any of your rights under this license.
91+
92+9. Modifiying the source code and charging a license fee for the
93+modifications is not prohibited. The terms and conditions of this
94+license apply to the source-code modified or not. You may however charge
95+licensing fees for other components.
96+
97+10. Linking to the package, modified or not, is permitted as long as the
98+resulting binary does not expose a direct interface to the package.
99+The terms and conditions of this license will also apply to the
100+resulting binary.
101+
102+11. Modules and scripts extending or merely using this package, and do
103+not modify the package is not subject to this license.
104+
105+12. If your Modified Version has been derived from a Modified Version
106+made by someone other than you, you are nevertheless required to ensure
107+that your Modified Version complies with the requirements of this
108+license.
109+
110+12. Modifiying the original work to contain hidden harmful content is
111+prohibited.
112+
113+#### Disclaimer of Warranty ####
114+
115+```
116+THIS SOFTWARE IS PROVIDED BY {COPYRIGHT HOLDER} ''AS IS'' AND ANY
117+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
118+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
119+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL {COPYRIGHT HOLDER} BE LIABLE
120+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
121+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
122+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
123+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
124+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
125+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
126+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
127+```
diff -r 000000000000 -r f48588b7e28d dev/idea.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dev/idea.md Thu May 17 13:02:46 2018 +0900
@@ -0,0 +1,123 @@
1+# MicroForm API #
2+
3+
4+## private ##
5+
6+_String_ **MicroForm.__getJSON(**_Object_ data**)**
7+
8+> get the `JSON` of the specified form's element-value pair
9+
10+_String_ **MicroForm.__sha512(**_String_ data**)**
11+
12+> solve for the sha512 sum of the data string
13+
14+_null_ **MicroForm.__saveHash(**_String_ formName, _String_ hash**)**
15+
16+> save the hash
17+
18+
19+## public ##
20+
21+_null_ **MicroForm.init(**_null_**)**
22+
23+> calculate and save the hash of all forms that have no hash
24+
25+_null_ **MicroForm.init(**_String_ formName**)**
26+
27+> calculate and save the hash of the specified formName if it has no hash
28+>
29+> use `MicroForm.hash()` to replace the saved hash
30+
31+_[]_ **MicroForm.get(**_null_**)**
32+
33+> get all available form names
34+
35+```
36+ [form1name, form2name, ..., formNname]
37+```
38+
39+_{}_ **MicroForm.get(**_String_ formName**)**
40+
41+> get element-value pair `object` of the specified form
42+>
43+> `undefined` if formName does not exist
44+
45+```
46+ {
47+ formName : {
48+ element1name: element1value,
49+ element2name: element2value,
50+ ...,
51+ elementNname: elementNvalue,
52+ }
53+ }
54+```
55+
56+```
57+ undefined
58+```
59+
60+_[]_ **MicroForm.get(**_String[]_ formName**)**
61+
62+> get element-value pair `object` of the specified form
63+>
64+> `undefined` if formName does not exist
65+
66+```
67+ [
68+ {
69+ form1Name : {
70+ element1name: element1value,
71+ element2name: element2value,
72+ ...,
73+ elementNname: elementNvalue,
74+ },
75+ {
76+ form2Name : {
77+ element1name: element1value,
78+ element2name: element2value,
79+ ...,
80+ elementNname: elementNvalue,
81+ }
82+ },
83+ undefined,
84+ ]
85+```
86+
87+_null_ **MicroForm.setForm(**_String_ formName, _Object_ elementValueMap**)**
88+
89+> set the value of the specified form's elements
90+>
91+> nonexisting keys will be ignored
92+>
93+> missing keys will not be modified
94+
95+```
96+ MicroForm.set("formName",
97+ {element1name: element1value,});
98+```
99+
100+_null_ **MicroForm.set(**_Object_ form**)**
101+
102+> set the value of the specified form's elements
103+>
104+> nonexisting keys will be ignored
105+>
106+> missing keys will not be modified
107+
108+```
109+ MicroForm.set({formName :
110+ {element1name: element1value,}
111+ });
112+```
113+
114+_null_ **MicroForm.hash(**_String_ formName**)**
115+
116+> calculate and save the specified form's hash
117+
118+_bool_ **MicroForm.hasChanged(**_String_ formName**)**
119+
120+> calculate the specified form's hash and compare it with the saved hash
121+>
122+> returns `true` if there is no saved hash or the saved hash is not the same with the calculated hash
123+
diff -r 000000000000 -r f48588b7e28d jsdoc.conf.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jsdoc.conf.json Thu May 17 13:02:46 2018 +0900
@@ -0,0 +1,26 @@
1+{
2+ "plugins" : [],
3+ "templates": {
4+ "cleverLinks" : true,
5+ "monospaceLinks" : true,
6+ "default" : {
7+ "outputSourceFiles": true
8+ },
9+ "applicationName": "micro-form",
10+ "disqus" : "",
11+ "googleAnalytics": "",
12+ "openGraph" : {
13+ "title" : "",
14+ "type" : "website",
15+ "image" : "",
16+ "site_name": "",
17+ "url" : ""
18+ },
19+ "meta" : {
20+ "title" : "",
21+ "description": "",
22+ "keyword" : ""
23+ },
24+ "linenums" : true
25+ }
26+}
diff -r 000000000000 -r f48588b7e28d package.json
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package.json Thu May 17 13:02:46 2018 +0900
@@ -0,0 +1,34 @@
1+{
2+ "name" : "micro-form",
3+ "version" : "v0.0.1",
4+ "description" : "Form processing library",
5+ "repository" : {
6+ "type": "hg",
7+ "url" : "https://bitbucket.org/frostbane/micro-form"
8+ },
9+ "main" : "./microform.js",
10+ "license" : "SEE LICENSE IN LICENSE.md",
11+ "keywords" : [
12+ "micro-form",
13+ "form-micro",
14+ "form",
15+ ],
16+ "devDependencies": {
17+ "requirejs" : "2.3.5",
18+ "jxunit" : "latest",
19+ "grunt-jxunit" : "latest",
20+ "jsdoc" : "latest",
21+ "jsdoc-sable" : "latest",
22+ "grunt" : "latest",
23+ "grunt-cli" : "latest",
24+ "grunt-jsdoc" : "latest",
25+ "grunt-contrib-copy" : "latest",
26+ "grunt-contrib-uglify": "latest"
27+ },
28+ "dependencies" : {
29+ },
30+ "author" : {
31+ "name" : "Frostbane Ac",
32+ "email": "frostbane@programmer.net"
33+ }
34+}
diff -r 000000000000 -r f48588b7e28d src/microform.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/microform.js Thu May 17 13:02:46 2018 +0900
@@ -0,0 +1,128 @@
1+/*!
2+ .. ┌ -: .
3+ ([]▄▄├]▄▄▄¿┐`,
4+ .¡ ,. D{}▓███████████░█∩^} =
5+ ,▓¼ .▐▓▓█████████████▓██▓▓, (▓
6+ █▌╕. ─@╣████████████████████▄─ ./▀'
7+ :▓█▌Ç... └ '└▓██████████████████████Ö'` .. '└`'┌
8+ \ g█████▄Ü┌ C g██████████████████████████╗─ ² ² t▄▓██ù- `╞
9+ ¡ Å╠█▌╠█▓▓▓▓▌N@▌| ╓██████████████████████████▌ .╣▓▓▓▓▓▓▓]▐╙ÅÅ∩!
10+ ` ` ╫½┌▀▀▀▀▀▀░╫▌┘ ▀▀▀▀▀██████████████████▀█▀C :╝▀▀▀▀▀▀▀. `:
11+ L ─ⁿ'``' ─ ''' ─█████████████████▌─█= ╞º'`'º──
12+ ..Å╫█╛. ~
13+ ╔▄▄▓██▓▄¿ .
14+ - ]:├╣██▀▀▀▀▀▒Q¿.¿{ )=
15+ <─Ω╚█░▓███'──h⌂▓██╡██▌Ü─4
16+ `┌ ▐▓█▄▓██╟≤¡yQ▄███▓█▌▐▓M
17+ ^. └▀▀▄▓██▄▒▄▄╬▄████▀ └▀╙`
18+ «-'''█▓▓█▓██▓██▓▓██└``'⌐
19+ #╛ µ:▓▄;xφ(⌠ █
20+ ╗µ ~╙'` `┌█╣
21+ ╝Ñ. '' ' L▀▀
22+ ~ ,
23+ ^
24+ ÷ ─.
25+ N. ∩ts )
26+ ∩ ²⌠ ` ─
27+ (@ ~▒▒ .
28+ ` └▀/ .>▀▀ :
29+ ⌐ ,⌐
30+
31+
32+ Form processing library
33+ Version 0.0.1
34+ Copyright (c) 2018 Frostbane Ac
35+ See LICENSE.md.
36+ www.??.com
37+
38+
39+ */
40+
41+/*
42+ * 2018.05.17
43+ * frostbane
44+ *
45+ *
46+ *
47+ */
48+
49+// todo fix globals
50+/* global
51+isInt,
52+isFloat,
53+format,
54+getDecimalCount,
55+trim,
56+define
57+ */
58+
59+/* jshint
60+bitwise: false,
61+maxlen: 180
62+ */
63+
64+(function(global, factory){
65+ "use strict";
66+
67+ if(typeof define === typeof function(){} && define.amd !== undefined){
68+ define(function(){
69+ return factory;
70+ });
71+ }else if(typeof exports !== typeof undefined && global.exports !== exports){
72+ module.exports = factory;
73+ }else{
74+ global.MicroForm = factory;
75+ }
76+
77+}(this, (function(){
78+ "use strict";
79+
80+ var __getJSON = function(data){
81+ };
82+
83+ var __sha512sum = function(data){
84+ };
85+
86+ var __saveHash = function(formName, hash){
87+ }
88+
89+ var __init = function(formName){
90+ if(formName === undefined || formName === null || formName.trim() === ""){
91+ }else{
92+ }
93+ }
94+
95+ var __get = function(formName){
96+ if(formName === undefined || formName === null || formName.trim() === ""){
97+ }else{
98+ }
99+
100+ if(typeof formName === typeof ""){
101+ }
102+
103+ if(formName instanceof []){
104+ }
105+ }
106+
107+ var __set = function(formName, data){
108+ if(typeof formName == typeof ""){
109+ }
110+ else{
111+ }
112+ }
113+
114+ var __hash = function(formName){
115+ }
116+
117+ var __hasChanged = function(formName){
118+ }
119+
120+ return {
121+ init :__init,
122+ get :__get,
123+ set :__set,
124+ hash :__hash,
125+ hasChanged :__hasChanged,
126+ };
127+
128+}())));
Show on old repository browser