├── .github └── logo.png ├── .gitignore ├── .jsbeautifyrc ├── .jshintrc ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── circle.yml ├── doc-timestamp.js ├── package.json ├── release.sh ├── shell └── e2e.sh ├── src ├── Base │ ├── AttributeManager.ts │ ├── Constants.ts │ ├── EEObject.ts │ ├── Ensure.ts │ ├── IDObject.ts │ ├── IdResolver.ts │ ├── ListenerFunction.ts │ ├── MessageException.ts │ ├── NSDictionary.ts │ ├── NSIdentity.ts │ ├── NSSet.ts │ ├── Namespace.ts │ ├── Types.ts │ ├── Utility.ts │ ├── XMLHttpRequestAsync.ts │ └── XMLReader.ts ├── Components │ └── GrimoireComponent.ts ├── Converters │ ├── ArrayConverter.ts │ ├── BooleanConverter.ts │ ├── ComponentConverter.ts │ ├── EnumConverter.ts │ ├── NumberArrayConverter.ts │ ├── NumberConverter.ts │ ├── ObjectConverter.ts │ ├── StringArrayConverter.ts │ └── StringConverter.ts ├── Declaration │ └── IAttributeConverterDeclaration.ts ├── Interface │ ├── GomlInterfaceImpl.ts │ ├── GrimoireInterface.ts │ ├── GrimoireInterfaceImpl.ts │ └── NodeInterface.ts ├── Node │ ├── Attribute.ts │ ├── Component.ts │ ├── ComponentDeclaration.ts │ ├── GomlLoader.ts │ ├── GomlNode.ts │ ├── GomlParser.ts │ ├── IAttributeDeclaration.ts │ ├── ITreeInitializedInfo.ts │ ├── NodeDeclaration.ts │ └── NodeUtility.ts ├── main.ts └── static │ └── color.json ├── test ├── @ │ └── GrimoireInterfaceTest.ts ├── AsyncSupport.ts ├── Base │ ├── AttributeManagerTest.ts │ ├── EnsureTest.ts │ ├── IdResolverTest.ts │ ├── NSIdentityTest.ts │ ├── NamespaceTest.ts │ ├── NamespacedDictionaryTest.ts │ ├── UtilityTest.ts │ └── XMLReaderTest.ts ├── Converters │ └── StringConverterTest.ts ├── Interfaces │ └── NodeInterfaceTest.ts ├── JsDOMAsync.ts ├── Node │ ├── GomlLoaderTest.ts │ ├── GomlNode2Test.ts │ ├── GomlNodeTest.ts │ ├── GomlParserTest.ts │ ├── GomlParserTest_Registering.ts │ └── NamespacedSetTest.ts ├── PageLoadingHelper.ts ├── XMLDomInit.ts ├── _TestResource │ ├── GomlLoaderTest_Case1.html │ ├── GomlLoaderTest_Case2.html │ ├── GomlLoaderTest_Case3.html │ ├── GomlLoaderTest_Case4.html │ ├── GomlNodeTest_Case1.goml │ ├── GomlNodeTest_Case1.html │ ├── GomlParserTest_Case1.goml │ ├── GomlParserTest_Case2.goml │ ├── GomlParserTest_Case3.goml │ ├── GomlParserTest_Case4.goml │ ├── GrimoireInterfaceTest_Case1.html │ ├── NSDictionary_QueryDOM.xml │ └── XMLReader_Case1.xml ├── fileHelper.ts └── tsconfig.json ├── tsconfig.json ├── tsconfig.test.json ├── tslint.json ├── typedoc.json └── webpack.config.js /.github/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GrimoireGL/GrimoireJS/9298762cac2a95e729707e129fea76e1de6b9c0a/.github/logo.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node,osx,windows,linux 3 | 4 | ### Node ### 5 | # Logs 6 | logs 7 | *.log 8 | npm-debug.log* 9 | 10 | # Runtime data 11 | pids 12 | *.pid 13 | *.seed 14 | *.pid.lock 15 | 16 | # Directory for instrumented libs generated by jscoverage/JSCover 17 | lib-cov 18 | 19 | # Coverage directory used by tools like istanbul 20 | coverage 21 | 22 | # nyc test coverage 23 | .nyc_output 24 | 25 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 26 | .grunt 27 | 28 | # node-waf configuration 29 | .lock-wscript 30 | 31 | # Compiled binary addons (http://nodejs.org/api/addons.html) 32 | build/Release 33 | 34 | # Dependency directories 35 | node_modules 36 | jspm_packages 37 | 38 | # Optional npm cache directory 39 | .npm 40 | 41 | # Optional REPL history 42 | .node_repl_history 43 | 44 | 45 | ### OSX ### 46 | *.DS_Store 47 | .AppleDouble 48 | .LSOverride 49 | 50 | # Icon must end with two \r 51 | Icon 52 | 53 | 54 | # Thumbnails 55 | ._* 56 | 57 | # Files that might appear in the root of a volume 58 | .DocumentRevisions-V100 59 | .fseventsd 60 | .Spotlight-V100 61 | .TemporaryItems 62 | .Trashes 63 | .VolumeIcon.icns 64 | .com.apple.timemachine.donotpresent 65 | 66 | # Directories potentially created on remote AFP share 67 | .AppleDB 68 | .AppleDesktop 69 | Network Trash Folder 70 | Temporary Items 71 | .apdisk 72 | 73 | 74 | ### Windows ### 75 | # Windows image file caches 76 | Thumbs.db 77 | ehthumbs.db 78 | 79 | # Folder config file 80 | Desktop.ini 81 | 82 | # Recycle Bin used on file shares 83 | $RECYCLE.BIN/ 84 | 85 | # Windows Installer files 86 | *.cab 87 | *.msi 88 | *.msm 89 | *.msp 90 | 91 | # Windows shortcuts 92 | *.lnk 93 | 94 | 95 | ### Linux ### 96 | *~ 97 | 98 | # temporary files which can be created if a process still has a handle open of a deleted file 99 | .fuse_hidden* 100 | 101 | # KDE directory preferences 102 | .directory 103 | 104 | # Linux trash folder which might appear on any partition or disk 105 | .Trash-* 106 | 107 | ### Grimoire.js ### 108 | 109 | # Generated codes included in package publishing. 110 | lib 111 | lib-es5 112 | 113 | # Generated codes just used in local environment 114 | lib-ts 115 | lib-test 116 | product 117 | src/**/*.js 118 | test/**/*.js 119 | 120 | .grimoire.dependency 121 | 122 | ci 123 | register 124 | ref 125 | test-es5 126 | src/index.ts 127 | yarn.lock 128 | docs 129 | test-lib 130 | test-lib-es5 131 | package-lock.json 132 | .vscode -------------------------------------------------------------------------------- /.jsbeautifyrc: -------------------------------------------------------------------------------- 1 | { 2 | "indent_size": 2, 3 | "indent_char": " ", 4 | "indent_level": 0, 5 | "indent_with_tabs": false, 6 | "preserve_newlines": true, 7 | "max_preserve_newlines": 10, 8 | "space_after_anon_function": false, 9 | "brace_style": "collapse-preserve-inline", 10 | "keep_array_indentation": false, 11 | "keep_function_indentation": false, 12 | "space_before_conditional": true, 13 | "break_chained_methods": false, 14 | "eval_code": false, 15 | "unescape_strings": false, 16 | "wrap_line_length": 0 17 | } 18 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "esnext":true 3 | } 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Guideline for contribution 2 | 3 | This contribution guide is not only for core package, also for plugins of grimoire.js maintained by our organization. 4 | It is not necessary, but we encourage the other plugins made by third party should use same contribution guide line if possible. 5 | 6 | ## Got a questions or problem? 7 | 8 | Using slack is the best way to ask main contributors. 9 | Stack overflow is another choice to ask. 10 | 11 | ## Found bugs? 12 | 13 | Please report them with issues. You can write it in English or Japanese. 14 | If reporter write an issue with Japanese and it is fatal problem of this library, 15 | main contributors would translate them for convenience. 16 | 17 | ## Contributing to translation 18 | 19 | We prepare to translate all of our documents written in Japanese to English. 20 | Currently official site and most of documents are written in Japanese, but we will move the main language as English. 21 | This is including a lot of stuff to do, we need contributors. Even if you correct our English syntax, we are welcome. 22 | 23 | ## Contributing to code 24 | 25 | Reducing works we need to do manually is very important. 26 | Please read this guideline for keeping clean repository and keeping developing environment efficiently. 27 | 28 | ### Build library 29 | 30 | You need to use npm to setup project build environment.(You can use yarn also) 31 | 32 | ```sh 33 | $ git clone . 34 | $ npm install 35 | $ npm start 36 | ``` 37 | 38 | `npm start` trigger watch task to rebuild when you changed the codes in `src` folder. 39 | This command will change `register/index.js` only. 40 | 41 | If you want to generate `grimoire.js` or `grimoirejs-.js` to link these script with ` 17 | 26 | 27 | 28 | 31 | 32 | 33 |

Hello world! This is HTML5 Boilerplate.

34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /test/_TestResource/GomlLoaderTest_Case2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 |

Hello world! This is HTML5 Boilerplate.

26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /test/_TestResource/GomlLoaderTest_Case3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 25 | 26 | 27 |

Hello world! This is HTML5 Boilerplate.

28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /test/_TestResource/GomlLoaderTest_Case4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 27 | 28 | 29 | 30 | 33 | 34 | 35 |

Hello world! This is HTML5 Boilerplate.

36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /test/_TestResource/GomlNodeTest_Case1.goml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/_TestResource/GomlNodeTest_Case1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 |

Hello world! This is HTML5 Boilerplate.

25 | 26 | -------------------------------------------------------------------------------- /test/_TestResource/GomlParserTest_Case1.goml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/_TestResource/GomlParserTest_Case2.goml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/_TestResource/GomlParserTest_Case3.goml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/_TestResource/GomlParserTest_Case4.goml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/_TestResource/GrimoireInterfaceTest_Case1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 28 | 29 | 30 |

Hello world! This is HTML5 Boilerplate.

31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /test/_TestResource/NSDictionary_QueryDOM.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/_TestResource/XMLReader_Case1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/fileHelper.ts: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const pathaa = require("path"); 3 | 4 | export default class FileHelper { 5 | public static readFile(path: string): string { 6 | return fs.readFileSync(pathaa.join(__dirname, path), "utf8"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "es6", 5 | "outDir":"../test-lib", 6 | "moduleResolution": "node", 7 | "allowJs":true, 8 | "sourceMap": true 9 | }, 10 | "include": [ 11 | "**/*.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "es6", 5 | "declaration": true, 6 | "moduleResolution": "node", 7 | "outDir": "./lib", 8 | "declarationDir": "./ref", 9 | "noImplicitReturns": true, 10 | "noUnusedParameters": true, 11 | "noUnusedLocals": false, 12 | "strict": true 13 | }, 14 | "include": [ 15 | "src/**/*.ts" 16 | ] 17 | } -------------------------------------------------------------------------------- /tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "es6", 5 | "outDir":"./test-lib", 6 | "moduleResolution": "node", 7 | "inlineSourceMap": true 8 | }, 9 | "include": [ 10 | "src/**/*.ts", 11 | "test/**/*.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory":[], 3 | "rules": { 4 | "class-name": true, 5 | "comment-format": [true, "check-space"], 6 | "curly": true, 7 | "eofline": true, 8 | "indent": [true, "spaces"], 9 | "label-position": true, 10 | "member-access": true, 11 | "member-ordering": [true, 12 | "public-before-private", 13 | "static-before-instance", 14 | "variables-before-functions" 15 | ], 16 | "no-arg": true, 17 | "no-console": [true, 18 | "debug", 19 | "time", 20 | "timeEnd", 21 | "trace" 22 | ], 23 | "no-construct": true, 24 | "no-debugger": true, 25 | "no-duplicate-variable": true, 26 | "no-empty": true, 27 | "no-eval": true, 28 | "no-inferrable-types": true, 29 | "no-shadowed-variable": true, 30 | "no-switch-case-fall-through": true, 31 | "no-trailing-whitespace": true, 32 | "no-unused-expression": true, 33 | "no-use-before-declare": true, 34 | "no-var-keyword": true, 35 | "one-line": [true, 36 | "check-open-brace", 37 | "check-catch", 38 | "check-else", 39 | "check-whitespace" 40 | ], 41 | "quotemark": [true, "double", "avoid-escape"], 42 | "radix": true, 43 | "semicolon": true, 44 | "triple-equals": [true, "allow-null-check"], 45 | "typedef-whitespace": [true, { 46 | "call-signature": "nospace", 47 | "index-signature": "nospace", 48 | "parameter": "nospace", 49 | "property-declaration": "nospace", 50 | "variable-declaration": "nospace" 51 | }], 52 | "variable-name": false, 53 | "whitespace": [true, 54 | "check-branch", 55 | "check-decl", 56 | "check-operator", 57 | "check-separator", 58 | "check-type" 59 | ] 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "mode": "file", 3 | "moduleResolution": "node", 4 | "tsconfig": "tsconfig.json", 5 | "includeDeclarations": true, 6 | "ignoreCompilerErrors": true, 7 | "excludePrivate": true, 8 | "excludeExternals": true 9 | } 10 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const webpack = require("webpack"); 3 | const fs = require("fs"); 4 | 5 | // Shot package name will be used for prefix of filename 6 | const fnPrefix = JSON.parse(fs.readFileSync(path.resolve(__dirname, "package.json"), "utf-8")).name.replace("grimoirejs", "grimoire"); 7 | 8 | // Copy task for optimization 9 | class CopyPlugin { 10 | constructor(copyFrom, copyTo) { 11 | this.copyFrom = copyFrom; 12 | this.copyTo = copyTo; 13 | } 14 | apply(compiler) { 15 | compiler.plugin("after-emit", (compiler, callback) => { 16 | fs.createReadStream(this.copyFrom).pipe(fs.createWriteStream(this.copyTo)); 17 | callback(); 18 | }); 19 | } 20 | } 21 | 22 | // Couldron generate-expose and generate-reference execute with build tasks. 23 | class CauldronPlugin { 24 | apply(compiler) { 25 | compiler.plugin("compile", () => { 26 | try { 27 | console.log(require('child_process').execSync('npm run generate-expose').toString()); 28 | } catch (e) { 29 | console.log(e); 30 | } 31 | }); 32 | compiler.plugin('after-emit', (compiler, callback) => { 33 | try { 34 | console.log(require('child_process').execSync('npm run generate-reference').toString()); 35 | } catch (e) { 36 | console.log(e); 37 | } finally { 38 | callback(); 39 | } 40 | }); 41 | } 42 | } 43 | 44 | const getBuildTask = (fileName, plugins, needPolyfill) => { 45 | return { 46 | cache: true, 47 | entry: needPolyfill ? ['babel-polyfill', path.resolve(__dirname, "src/index.ts")] : path.resolve(__dirname, "src/index.ts"), 48 | output: { 49 | path: __dirname, 50 | filename: "./register/" + fileName, 51 | libraryTarget: "umd" 52 | }, 53 | module: { 54 | loaders: [{ 55 | test: /\.ts$/, 56 | exclude: /node_modules/, 57 | loader: "babel-loader?presets[]=es2015,presets[]=stage-2!ts-loader" 58 | }] 59 | }, 60 | resolve: { 61 | extensions: ['.ts', '.js'] 62 | }, 63 | plugins: plugins, 64 | devtool: 'source-map' 65 | } 66 | }; 67 | 68 | module.exports = (env = {}) => { 69 | // This line might need to be modified for each plugin build environment. 70 | // If the plugin containing grimoirejs directly(calling require("grimoirejs/register")), 71 | // browser build and production build should contain babel-polyfill. 72 | // Make sure this is not require("grimoirejs") 73 | let includeCore = true; 74 | // 75 | // 76 | // 77 | if(!env.browser && !env.npm && !env.prod){ 78 | env.browser = true; 79 | } 80 | const productPlugins = [new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}}),new webpack.optimize.OccurrenceOrderPlugin(),new webpack.optimize.AggressiveMergingPlugin()]; 81 | let buildTasks = []; 82 | let skipIndex = false; 83 | let cauldron = new CauldronPlugin(); 84 | if (env.browser || env.prod) { 85 | const plugins = []; 86 | // if needs index also and it was not including core, index.js must be copied from fnPrefix.js 87 | // since these are completely same build task. Yeah, optimization. 88 | if (!includeCore && (env.prod || env.npm)) { 89 | plugins.push(new CopyPlugin(`./register/${fnPrefix}.js`, './register/index.js')); 90 | plugins.push(new CopyPlugin(`./register/${fnPrefix}.js.map`, './register/index.js.map')); 91 | skipIndex = true; 92 | console.log(`${index}.js will be generated for NPM environment by copy`); 93 | } 94 | buildTasks.push(getBuildTask(`${fnPrefix}.js`, [cauldron,...plugins], includeCore)); 95 | console.log(`${fnPrefix}.js will be generated for browser environment`); 96 | } 97 | if (!skipIndex && (env.npm || env.prod)) { 98 | buildTasks.push(getBuildTask("index.js", [cauldron], false)); 99 | console.log(`index.js will be generated for NPM environment`); 100 | } 101 | if (env.prod) { 102 | buildTasks.push(getBuildTask(fnPrefix + ".min.js", [cauldron,...productPlugins],includeCore)); 103 | console.log(`${fnPrefix}.min.js will be generated for browser environment`); 104 | } 105 | return buildTasks; 106 | }; 107 | --------------------------------------------------------------------------------