├── .editorconfig ├── .gitignore ├── .gitmodules ├── .travis.yml ├── .ycm_extra_conf.py ├── LICENSE ├── LICENSE_frontend ├── LICENSE_nidiumcore ├── LICENSE_server ├── README.md ├── configure_frontend ├── configure_libnidiumcore ├── configure_server ├── docs ├── JSAV.cpp.py ├── JSCanvas.cpp.py ├── JSCanvas2DContext.cpp.py ├── JSConsole.cpp.py ├── JSDB.cpp.py ├── JSDebug.cpp.py ├── JSDebugger.cpp.py ├── JSDocument.cpp.py ├── JSExposer.h.py ├── JSFS.cpp.py ├── JSFile.cpp.py ├── JSGlobal.cpp.py ├── JSHTTP.cpp.py ├── JSHTTPServer.cpp.py ├── JSImage.cpp.py ├── JSKeyboard.cpp.py ├── JSModules.cpp.py ├── JSOS.cpp.py ├── JSProcess.cpp.py ├── JSSocket.cpp.py ├── JSStream.cpp.py ├── JSThread.cpp.py ├── JSVM.cpp.py ├── JSWebGL.cpp.py ├── JSWebSocket.cpp.py ├── JSWebSocketClient.cpp.py ├── JSWindow.cpp.py └── en │ └── guide │ ├── getting-started │ ├── hello-world.md │ ├── installing.md │ └── introduction.md │ ├── graphics │ └── general-concepts.md │ ├── internals │ ├── classmapper.md │ ├── logging.md │ └── rooting.md │ ├── menu.json │ └── misc │ ├── building.md │ ├── contributing.md │ └── reinventing-the-wheel.md ├── gyp ├── .gitignore ├── actions.gyp ├── all.gyp ├── av.gypi ├── common.gypi ├── config.gypi ├── crashreporter.gyp ├── interface.gypi ├── libnidium.gyp ├── libnidium_android.gyp ├── libnidiumcore-tests.gyp ├── libnidiumcore.gyp ├── nidium-server.gyp ├── nidium.gyp ├── third-party │ ├── SDL2-android.gyp │ ├── breakpad.gyp │ └── breakpad_tools.gypi └── tools.gyp ├── patch ├── SDL2_android.patch ├── angle_android.patch ├── basekit.patch ├── giflib_android.patch ├── leveldb.patch ├── libcoroutine.debug.patch ├── libcoroutine.patch ├── mozilla_android.patch ├── portaudio.patch ├── rapidxml.patch ├── setproctitle.patch ├── skia_android.patch ├── skia_gl.patch ├── skia_gl_config.h ├── skia_gr_gl_callback.patch ├── skia_zlib_osx.patch └── zita.patch ├── resources ├── icons │ ├── nidium.eps │ ├── nidium.iconset │ │ ├── nidium_128x128.png │ │ ├── nidium_128x128@2x.png │ │ ├── nidium_16x16.png │ │ ├── nidium_16x16@2x.png │ │ ├── nidium_256x256.png │ │ ├── nidium_256x256@2x.png │ │ ├── nidium_32x32.png │ │ ├── nidium_32x32@2x.png │ │ ├── nidium_512x512.png │ │ └── nidium_512x512@2x.png │ ├── nidium.png │ ├── nidium.svg │ └── update_icons.sh ├── linux │ ├── installer.sh │ ├── nidium.desktop │ └── x-application-nidium.xml └── osx │ ├── Info.plist │ ├── create_icns.sh │ ├── demo-sla.r │ ├── dmg-background.png │ ├── en.lproj │ ├── InfoPlist.strings │ └── MainMenu.xib │ └── nidium.icns ├── src ├── AV │ ├── AV.cpp │ ├── AV.h │ ├── Audio.cpp │ ├── Audio.h │ ├── AudioNode.cpp │ ├── AudioNode.h │ ├── AudioNodeDelay.cpp │ ├── AudioNodeDelay.h │ ├── AudioNodeGain.cpp │ ├── AudioNodeGain.h │ ├── AudioParameters.h │ ├── Video.cpp │ ├── Video.h │ └── processor │ │ ├── Delay.h │ │ └── Gain.h ├── Binding │ ├── ClassMapper.h │ ├── ClassMapperWithEvents.h │ ├── JSAV.cpp │ ├── JSAV.h │ ├── JSAudio.cpp │ ├── JSAudio.h │ ├── JSAudioContext.cpp │ ├── JSAudioContext.h │ ├── JSAudioNode.cpp │ ├── JSAudioNode.h │ ├── JSCanvas.cpp │ ├── JSCanvas.h │ ├── JSCanvas2DContext.cpp │ ├── JSCanvas2DContext.h │ ├── JSConsole.cpp │ ├── JSConsole.h │ ├── JSDB.cpp │ ├── JSDB.h │ ├── JSDebug.cpp │ ├── JSDebug.h │ ├── JSDebugger.cpp │ ├── JSDebugger.h │ ├── JSDocument.cpp │ ├── JSDocument.h │ ├── JSEvents.cpp │ ├── JSEvents.h │ ├── JSFS.cpp │ ├── JSFS.h │ ├── JSFile.cpp │ ├── JSFile.h │ ├── JSGlobal.cpp │ ├── JSGlobal.h │ ├── JSHTTP.cpp │ ├── JSHTTP.h │ ├── JSHTTPServer.cpp │ ├── JSHTTPServer.h │ ├── JSImage.cpp │ ├── JSImage.h │ ├── JSImageData.h │ ├── JSKeyboard.cpp │ ├── JSKeyboard.h │ ├── JSMacros.h │ ├── JSModules.cpp │ ├── JSModules.h │ ├── JSNFS.cpp │ ├── JSNFS.h │ ├── JSNML.cpp │ ├── JSNML.h │ ├── JSOS.cpp │ ├── JSOS.h │ ├── JSProcess.cpp │ ├── JSProcess.h │ ├── JSSocket.cpp │ ├── JSSocket.h │ ├── JSStream.cpp │ ├── JSStream.h │ ├── JSThread.cpp │ ├── JSThread.h │ ├── JSUtils.cpp │ ├── JSUtils.h │ ├── JSVM.cpp │ ├── JSVM.h │ ├── JSVideo.cpp │ ├── JSVideo.h │ ├── JSWebGL.cpp │ ├── JSWebGL.h │ ├── JSWebSocket.cpp │ ├── JSWebSocket.h │ ├── JSWebSocketClient.cpp │ ├── JSWebSocketClient.h │ ├── JSWindow.cpp │ ├── JSWindow.h │ ├── NidiumJS.cpp │ ├── NidiumJS.h │ ├── ThreadLocalContext.cpp │ ├── ThreadLocalContext.h │ └── WebGL_Types.h ├── Core │ ├── Args.h │ ├── Atomic.h │ ├── Context.cpp │ ├── Context.h │ ├── DB.cpp │ ├── DB.h │ ├── Events.h │ ├── Hash.h │ ├── Messages.cpp │ ├── Messages.h │ ├── NativeEvents.cpp │ ├── Path.cpp │ ├── Path.h │ ├── SharedMessages.cpp │ ├── SharedMessages.h │ ├── TaskManager.cpp │ ├── TaskManager.h │ ├── Utils.cpp │ └── Utils.h ├── Embed │ ├── MVVM.js │ ├── ShadowRoot.js │ ├── StyleContainer.js │ ├── Symbols.js │ ├── additions │ │ ├── Canvas.js │ │ ├── Context.js │ │ ├── HTTP.js │ │ ├── NML.js │ │ ├── console.js │ │ ├── document.js │ │ └── window.js │ ├── default.nml │ ├── framework │ │ ├── components │ │ │ ├── button.nc │ │ │ ├── icon.nc │ │ │ ├── listview.nc │ │ │ ├── navbar.nc │ │ │ ├── sidebar.nc │ │ │ ├── spinner.nc │ │ │ └── statusbar.nc │ │ ├── core │ │ │ ├── drawer.js │ │ │ ├── observer.js │ │ │ └── responsive.js │ │ ├── elements │ │ │ ├── canvas.js │ │ │ ├── checkbox.js │ │ │ ├── comment.js │ │ │ ├── component.js │ │ │ ├── div.js │ │ │ ├── element.js │ │ │ ├── fieldset.js │ │ │ ├── grid │ │ │ │ ├── col.js │ │ │ │ ├── grid.js │ │ │ │ └── row.js │ │ │ ├── h1.js │ │ │ ├── img.js │ │ │ ├── label.js │ │ │ ├── layout.js │ │ │ ├── li.js │ │ │ ├── node.js │ │ │ ├── nodeoverlay.js │ │ │ ├── nss.js │ │ │ ├── overlay.js │ │ │ ├── p.js │ │ │ ├── radio.js │ │ │ ├── script.js │ │ │ ├── section.js │ │ │ ├── slot.js │ │ │ ├── span.js │ │ │ ├── template.js │ │ │ ├── textnode.js │ │ │ └── view.js │ │ ├── fonts │ │ │ ├── Ranga-Regular.ttf │ │ │ ├── default.js │ │ │ ├── droid-sans │ │ │ │ ├── DroidSans-Bold.ttf │ │ │ │ └── DroidSans.ttf │ │ │ ├── fontawesome.js │ │ │ ├── fontawesome.ttf │ │ │ ├── ionicons.js │ │ │ ├── ionicons.ttf │ │ │ └── roboto │ │ │ │ ├── Roboto-Black.ttf │ │ │ │ ├── Roboto-BlackItalic.ttf │ │ │ │ ├── Roboto-Bold.ttf │ │ │ │ ├── Roboto-BoldItalic.ttf │ │ │ │ ├── Roboto-Italic.ttf │ │ │ │ ├── Roboto-Light.ttf │ │ │ │ ├── Roboto-LightItalic.ttf │ │ │ │ ├── Roboto-Medium.ttf │ │ │ │ ├── Roboto-MediumItalic.ttf │ │ │ │ ├── Roboto-Regular.ttf │ │ │ │ ├── Roboto-Thin.ttf │ │ │ │ ├── Roboto-ThinItalic.ttf │ │ │ │ ├── RobotoCondensed-Bold.ttf │ │ │ │ ├── RobotoCondensed-BoldItalic.ttf │ │ │ │ ├── RobotoCondensed-Italic.ttf │ │ │ │ ├── RobotoCondensed-Light.ttf │ │ │ │ ├── RobotoCondensed-LightItalic.ttf │ │ │ │ └── RobotoCondensed-Regular.ttf │ │ └── index.js │ ├── html5.js │ ├── lib │ │ ├── AnimationBlock.js │ │ ├── Component.js │ │ ├── Elements.js │ │ ├── ElementsStyles.js │ │ ├── Modal.js │ │ ├── Navigator.js │ │ ├── RemoteDebug.js │ │ ├── TemplateEngine.js │ │ └── nidium.js │ ├── modules │ │ ├── css-parse.js │ │ └── easing.js │ ├── nunjucks.js │ ├── preload.js │ └── resources │ │ ├── logo-128x128.png │ │ ├── logo-64x64.png │ │ └── logo-white.png ├── Frontend │ ├── App.cpp │ ├── App.h │ ├── Assets.cpp │ ├── Assets.h │ ├── Context.cpp │ ├── Context.h │ ├── InputHandler.cpp │ ├── InputHandler.h │ ├── NML.cpp │ ├── NML.h │ └── app │ │ ├── SDLTests │ │ └── .idea │ │ │ └── modules.xml │ │ ├── android │ │ ├── .gitignore │ │ ├── .idea │ │ │ ├── compiler.xml │ │ │ ├── copyright │ │ │ │ └── profiles_settings.xml │ │ │ ├── dictionaries │ │ │ │ └── efyx.xml │ │ │ ├── gradle.xml │ │ │ ├── misc.xml │ │ │ ├── modules.xml │ │ │ ├── runConfigurations.xml │ │ │ └── vcs.xml │ │ ├── app │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── build.gradle │ │ │ ├── proguard-rules.pro │ │ │ └── src │ │ │ │ ├── androidTest │ │ │ │ └── java │ │ │ │ │ └── com │ │ │ │ │ └── nidium │ │ │ │ │ └── android │ │ │ │ │ └── ExampleInstrumentedTest.java │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ │ ├── com │ │ │ │ │ │ └── nidium │ │ │ │ │ │ │ └── android │ │ │ │ │ │ │ ├── DevelopmentActivity.java │ │ │ │ │ │ │ ├── Extractor.java │ │ │ │ │ │ │ ├── Flinger.java │ │ │ │ │ │ │ ├── Keyboard.java │ │ │ │ │ │ │ ├── NMLFileAdapter.java │ │ │ │ │ │ │ ├── NidiumActivity.java │ │ │ │ │ │ │ └── Nidroid.java │ │ │ │ │ └── org │ │ │ │ │ │ └── libsdl │ │ │ │ │ │ └── app │ │ │ │ │ │ └── SDLActivity.java │ │ │ │ └── res │ │ │ │ │ ├── drawable │ │ │ │ │ ├── border_bottom.xml │ │ │ │ │ └── startup.xml │ │ │ │ │ ├── layout │ │ │ │ │ ├── activity_main.xml │ │ │ │ │ └── nml_list_item_row.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values-w820dp │ │ │ │ │ └── dimens.xml │ │ │ │ │ └── values │ │ │ │ │ ├── colors.xml │ │ │ │ │ ├── dimens.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ └── styles.xml │ │ │ │ └── test │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── nidium │ │ │ │ └── android │ │ │ │ └── ExampleUnitTest.java │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── gradlew │ │ ├── gradlew.bat │ │ └── settings.gradle │ │ ├── linux │ │ ├── CrashReporter.c │ │ └── main.cpp │ │ └── osx │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ └── main.mm ├── Graphics │ ├── Canvas3DContext.cpp │ ├── Canvas3DContext.h │ ├── CanvasContext.cpp │ ├── CanvasContext.h │ ├── CanvasHandler.cpp │ ├── CanvasHandler.h │ ├── CanvasSurface.cpp │ ├── CanvasSurface.h │ ├── GLContext.h │ ├── GLHeader.h │ ├── GLResources.cpp │ ├── GLResources.h │ ├── GLState.cpp │ ├── GLState.h │ ├── Geometry.h │ ├── Gradient.cpp │ ├── Gradient.h │ ├── Image.cpp │ ├── Image.h │ ├── ShadowLooper.cpp │ ├── ShadowLooper.h │ ├── SkiaContext.cpp │ ├── SkiaContext.h │ ├── SurfaceCache.cpp │ └── SurfaceCache.h ├── IO │ ├── EmbedStream.h │ ├── File.cpp │ ├── File.h │ ├── FileStream.cpp │ ├── FileStream.h │ ├── NFS.cpp │ ├── NFS.h │ ├── NFSStream.cpp │ ├── NFSStream.h │ ├── Stream.cpp │ ├── Stream.h │ ├── SystemStream.cpp │ └── SystemStream.h ├── Interface │ ├── SDL_keycode_translate.h │ ├── SystemInterface.h │ ├── UIInterface.cpp │ ├── UIInterface.h │ ├── android │ │ ├── AndroidMain.cpp │ │ ├── AndroidUIInterface.cpp │ │ ├── AndroidUIInterface.h │ │ ├── System.cpp │ │ └── System.h │ ├── linux │ │ ├── System.cpp │ │ ├── System.h │ │ ├── X11UIInterface.cpp │ │ └── X11UIInterface.h │ └── osx │ │ ├── CocoaUIInterface.h │ │ ├── CocoaUIInterface.mm │ │ ├── DragNSView.h │ │ ├── DragNSView.mm │ │ ├── System.h │ │ ├── System.mm │ │ ├── UIConsole.h │ │ └── UIConsole.mm ├── Macros.h ├── Net │ ├── HTTP.cpp │ ├── HTTP.h │ ├── HTTPParser.cpp │ ├── HTTPParser.h │ ├── HTTPServer.cpp │ ├── HTTPServer.h │ ├── HTTPStream.cpp │ ├── HTTPStream.h │ ├── WebSocket.cpp │ ├── WebSocket.h │ ├── WebSocketClient.cpp │ └── WebSocketClient.h ├── Server │ ├── ASCII.h │ ├── Context.cpp │ ├── Context.h │ ├── REPL.cpp │ ├── REPL.h │ ├── Server.cpp │ ├── Server.h │ └── app │ │ └── main.cpp └── Tools │ └── dir2nvfs.cpp ├── tests ├── assert.js ├── gunittest │ ├── args.cpp │ ├── db.cpp │ ├── events.cpp │ ├── file.cpp │ ├── filestream.cpp │ ├── hash.cpp │ ├── http.cpp │ ├── httpserver.cpp │ ├── httpstream.cpp │ ├── jshttp.cpp │ ├── jshttpserver.cpp │ ├── jsprocess.cpp │ ├── jssocket.cpp │ ├── jsutils.cpp │ ├── jswebsocket.cpp │ ├── jswebsocketclient.cpp │ ├── messages.cpp │ ├── nfs.cpp │ ├── nfsstream.cpp │ ├── nidiumjs.cpp │ ├── path.cpp │ ├── sharedmessages.cpp │ ├── streaminterface.cpp │ ├── taskmanager.cpp │ ├── unittest.cpp │ ├── unittest.h │ └── utils.cpp ├── jsautotest │ └── autotests.nml ├── jsunittest │ ├── .gitignore │ ├── AV │ │ ├── 358232_j_s_song.mp3 │ │ ├── AudioContext.js │ │ ├── AudioThread.js │ │ ├── CustomSourceNode.js │ │ ├── CustomeNode.js │ │ ├── GainNode.js │ │ ├── SourceNode.js │ │ ├── Video.js │ │ ├── test.mp3 │ │ └── video.ogg │ ├── Canvas.js │ ├── DB.js │ ├── File │ │ ├── File.js │ │ └── doesexists │ │ │ ├── .gitignore │ │ │ └── simplefile.txt │ ├── Global │ │ ├── .gitignore │ │ ├── Global_require.js │ │ ├── dummy.js │ │ └── dummy_symlink.js │ ├── HTTP │ │ ├── HTTPClient.js │ │ └── HTTPServer.js │ ├── Image.js │ ├── JS │ │ ├── JS_btoa.js │ │ └── JS_timers.js │ ├── Modules │ │ ├── .gitignore │ │ └── Modules_libHello.js │ ├── OS.js │ ├── Process │ │ └── process.js │ ├── Socket │ │ ├── basic.js │ │ ├── websocket-client.js │ │ └── websocket-server.js │ ├── System │ │ └── System_getOpenFileStats.js │ ├── Thread.js │ ├── VM.js │ ├── gr │ │ ├── base │ │ │ ├── linux │ │ │ │ ├── Canvas_fillRect.png │ │ │ │ └── Canvas_left.png │ │ │ └── mac │ │ │ │ ├── Canvas_fillRect.png │ │ │ │ └── Canvas_left.png │ │ ├── comparison │ │ │ └── .gitignore │ │ └── results │ │ │ └── .gitignore │ ├── unittests.js │ └── unittests.nml ├── testrunner.js └── tests-server │ ├── Dockerfile │ ├── README.md │ ├── certbot.sh │ ├── crontab │ ├── dhparams.pem │ ├── docker-compose.yml │ ├── localhost.cert │ ├── localhost.key │ ├── nginx.conf │ ├── nidium_32x32.png │ ├── requirements.txt │ ├── server.py │ └── start.sh ├── third-party ├── jnipp │ └── jnipp.h ├── linenoise │ ├── LICENSE │ ├── Makefile │ ├── README.markdown │ ├── example.c │ ├── linenoise.c │ └── linenoise.h ├── setproctitle │ └── setproctitle.c └── yoga │ ├── YGEnums.c │ ├── YGEnums.h │ ├── YGMacros.h │ ├── YGNodeList.c │ ├── YGNodeList.h │ ├── YGStringEnums.c │ ├── YGStringEnums.h │ ├── Yoga.c │ └── Yoga.h └── tools ├── doc2md.py ├── installer ├── linux │ ├── makeself-header.sh │ └── makeself.sh └── osx │ ├── create-dmg │ └── support │ ├── dmg-license.py │ └── template.applescript ├── osx_incbuild.sh ├── package.py └── python /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | charset = utf-8 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true 8 | 9 | 10 | [{src,tests}/**.js] 11 | indent_style = space 12 | indent_size = 4 13 | 14 | [{src,tests}/**.{h,cpp}] 15 | indent_style = space 16 | indent_size = 4 17 | 18 | [{tools,third-party,gyp,resources,patch,docs}/**] 19 | indent_style = ignore 20 | indent_size = ignore 21 | end_of_line = ignore 22 | trim_trailing_whitespace = ignore 23 | charset = ignore 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | konstruct*.log 2 | configure*c 3 | bin 4 | build 5 | tests/jsautotest/autotests.js 6 | tools/pprof 7 | tools/android-toolchain 8 | third-party/ 9 | !third-party/setproctitle/ 10 | !third-party/rapidxml/ 11 | !third-party/linenoise/ 12 | **.pyc 13 | **.venv 14 | **.DS_Store 15 | .ctags 16 | scripts 17 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/libapenetwork"] 2 | path = src/libapenetwork 3 | url = https://github.com/nidium/libapenetwork.git 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - sudo apt-get -qq update 3 | - sudo apt-get install -y python2.7 patch pkg-config libbz2-1.0 4 | - git clone https://github.com/nidium/NidiumTools.git 5 | 6 | compiler: clang 7 | 8 | 9 | script: 10 | - ASAN_OPTIONS=detect_leaks=0 PYTHONPATH=./NidiumTools/src ./configure_server --debug --asan --no-fork --unit-tests --assume-yes 11 | 12 | cache: 13 | directories: 14 | - third-party 15 | 16 | language: cpp 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This Software is MIT licensed but builds upon third-party libraries. 2 | 3 | The software is structured in a way, so that you can use what you need. To match this structure we also grouped the licenses in a convienient way. 4 | 5 | * If you use/modify/distribute nidiumcore as a library you need: LICENSE_libnidiumcore 6 | * If you use/modify/distribute Nidium Server you need: LICENSE_server + LICENSE_libnidiumcore 7 | * If you use/modify/distribute Nidium you need: LICENSE_frontend + LICENSE_libnidiumcore 8 | -------------------------------------------------------------------------------- /docs/JSFS.cpp.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Nidium Inc. All rights reserved. 2 | # Use of this source code is governed by a MIT license 3 | # that can be found in the LICENSE file. 4 | 5 | from dokumentor import * 6 | 7 | NamespaceDoc( "fs", "Filesystem access.", 8 | [ SeeDoc( "process.cwd" ), SeeDoc( "File" ) ], 9 | [ ExampleDoc( """fs.readDir( ".", function( err, entries ) { 10 | console.log( JSON.stringify( entries ) ); } );""") ], 11 | products=["Frontend", "Server"] 12 | ) 13 | 14 | FunctionDoc( "fs.readDir", "Read the content of a directory.", 15 | [ SeeDoc( "process.cwd" ), SeeDoc( "File.isDir" ), 16 | SeeDoc( "fs.readDir" ), SeeDoc( "File.rmrf" ) ], 17 | [ ExampleDoc( """fs.readDir( ".", function( err, entries ) { 18 | console.log( JSON.stringify( entries ) ) ; } );""") ] , 19 | IS_Static, IS_Public, IS_Fast, 20 | [ 21 | ParamDoc("dir", "Directory relative to the 'start' point (for frontend: the nml file, for server this is the js file on the commandline", 'string', NO_Default, IS_Obligated), 22 | CallbackDoc( 'fn', 'The function to be called', [ 23 | ParamDoc( 'err', 'error', 'integer', NO_Default, IS_Optional ), 24 | ParamDoc( 'entry', 'Object describing the file listing', ObjectDoc([("name", "The filename", "string")]),NO_Default, IS_Obligated) 25 | ]) 26 | ], 27 | NO_Returns 28 | ) 29 | 30 | -------------------------------------------------------------------------------- /docs/JSKeyboard.cpp.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Nidium Inc. All rights reserved. 2 | # Use of this source code is governed by a MIT license 3 | # that can be found in the LICENSE file. 4 | 5 | from dokumentor import * 6 | 7 | NamespaceDoc("Keyboard", "Manage virtual keyboard state on mobile devices", 8 | NO_Sees, 9 | NO_Examples, 10 | products=["Frontend"] 11 | ) 12 | 13 | FunctionDoc("Keyboard.show", "Show the virtual keyboard", 14 | [ 15 | SeeDoc("Keyboard.show"), 16 | SeeDoc("Keyboard.OPTION_NORMAL"), 17 | SeeDoc("Keyboard.OPTION_NUMERIC"), 18 | SeeDoc("Keyboard.OPTION_TEXT_ONLY") 19 | ], 20 | [ExampleDoc("var Keyboard= require(\"Keyboard\");\nKeyboard.show();")], 21 | IS_Static, 22 | params=[ 23 | ParamDoc("options", "Virtual keyboard options", "integer", NO_Default, IS_Optional), 24 | ] 25 | ) 26 | 27 | FunctionDoc("Keyboard.hide", "Hide the virtual keyboard", 28 | [SeeDoc("Keyboard.show")], 29 | [ExampleDoc("var Keyboard= require(\"Keyboard\");\nKeyboard.show();\nsetTimeout(function() { Keyboard.hide() }, 3000);")], 30 | IS_Static, 31 | params=NO_Params 32 | ) 33 | 34 | FieldDoc("Keyboard.OPTION_NORMAL", "Normal android keyboard (default)", 35 | [SeeDoc("Keyboard.show")], 36 | NO_Examples, 37 | IS_Static, IS_Public, IS_Readonly, 38 | "integer" 39 | ) 40 | 41 | FieldDoc("Keyboard.OPTION_NUMERIC", "Numeric only keyboard", 42 | [SeeDoc("Keyboard.show")], 43 | [ExampleDoc("var Keyboard= require(\"Keyboard\");\nKeyboard.show(Keyboard.OPTION_NUMERIC);")], 44 | IS_Static, IS_Public, IS_Readonly, 45 | "integer" 46 | ) 47 | 48 | FieldDoc("Keyboard.OPTION_TEXT_ONLY", "Text only virtual keyboard (no auto-completion, emoji, etc..)", 49 | [SeeDoc("Keyboard.show")], 50 | NO_Examples, 51 | IS_Static, IS_Public, IS_Readonly, 52 | "integer" 53 | ) 54 | -------------------------------------------------------------------------------- /docs/JSModules.cpp.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Nidium Inc. All rights reserved. 2 | # Use of this source code is governed by a MIT license 3 | # that can be found in the LICENSE file. 4 | 5 | from dokumentor import * 6 | 7 | NamespaceDoc( "Module", "Module that is exported.", 8 | SeesDocs( "global.modules" ), 9 | examples=[ 10 | ExampleDoc("module.exports = {\"lorem\":\"ipsum\"}"), 11 | ExampleDoc("""var foobar = require(\"foobar.js\");\n console.log(foobar.lorem); // Print \"ipsum\" """, run_code=False) 12 | ], 13 | products=["Frontend", "Server"] 14 | ) 15 | 16 | FieldDoc( "Module.exports", "Exported Module.", 17 | SeesDocs( "Module|global.modules" ), 18 | NO_Examples, 19 | IS_Static, IS_Public, IS_Readonly, 20 | "any", 21 | NO_Default 22 | ) 23 | 24 | FieldDoc( "Module.id", "The module name.", 25 | SeesDocs( "Module" ), 26 | NO_Examples, 27 | IS_Static, IS_Public, IS_Readonly, 28 | "integer", 29 | NO_Default 30 | ) 31 | 32 | FunctionDoc( "global.require", """`require` implementation similar to NodeJS `require()`""", 33 | SeesDocs( "Module|global.load" ), 34 | NO_Examples, 35 | IS_Static, IS_Public, IS_Fast, 36 | [ParamDoc( "path", "modulename", "string", NO_Default, IS_Obligated ) ], 37 | ReturnDoc( "modulename", "string" ) 38 | ) 39 | 40 | FieldDoc( "global.modules", "Exposed Modules.", 41 | SeesDocs( "Module" ), 42 | NO_Examples, 43 | IS_Static, IS_Public, IS_Readonly, 44 | '[Module]', 45 | NO_Default 46 | ) 47 | -------------------------------------------------------------------------------- /docs/JSOS.cpp.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Nidium Inc. All rights reserved. 2 | # Use of this source code is governed by a MIT license 3 | # that can be found in the LICENSE file. 4 | 5 | from dokumentor import * 6 | 7 | NamespaceDoc( "OS", "Operating system-related utility method", 8 | NO_Sees, 9 | NO_Examples, 10 | products=["Frontend", "Server"] 11 | ) 12 | 13 | FieldDoc("OS.language", "The language of the OS.", 14 | NO_Sees, 15 | [ExampleDoc("var OS = require(\"OS\");\nconsole.log(OS.language)")], 16 | IS_Static, IS_Public, IS_Readonly, 17 | 'string', 18 | NO_Default, 19 | products=["Frontend"] 20 | ) 21 | 22 | FieldDoc("OS.platform", """The platform running Nidium 23 | 24 | Possible values are : 25 | * linux 26 | * win 27 | * mac 28 | * android 29 | * ios 30 | * bsd""", 31 | NO_Sees, 32 | [ExampleDoc("var OS = require(\"OS\");\nconsole.log(OS.platform)")], 33 | IS_Static, IS_Public, IS_Readonly, 34 | 'string', 35 | NO_Default 36 | ) 37 | 38 | -------------------------------------------------------------------------------- /docs/en/guide/getting-started/hello-world.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: nidium Hello World 3 | --- 4 | 5 | -------------------------------------------------------------------------------- /docs/en/guide/getting-started/installing.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Download and install nidium 3 | --- 4 | 5 | >Important: Please note that we are actively working on nidium and some key features are still a work in progress: 6 | >* Microsoft Windows support 7 | >* Mobile support 8 | >* App distribution 9 | >For these reasons, nidium is **not ready** for production apps yet 10 | 11 | ## Download binary 12 | 13 | Go to [http://www.nidium.com/downloads/](http://www.nidium.com/downloads/) 14 | -------------------------------------------------------------------------------- /docs/en/guide/graphics/general-concepts.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: General concept - nidium 3 | --- 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/en/guide/menu.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "title": "Getting started", 3 | "folder": "getting-started", 4 | "pages": [ 5 | {"file": "introduction", "title": "Introduction"}, 6 | {"file": "hello-world", "title": "Hello World"}, 7 | {"file": "installing", "title": "Installing"} 8 | ] 9 | }, 10 | { 11 | "title": "Graphics", 12 | "folder": "graphics", 13 | "pages": [ 14 | {"file": "general-concepts", "title": "General concept"} 15 | ] 16 | }, 17 | { 18 | "title": "Misc", 19 | "folder": "misc", 20 | "pages": [ 21 | {"file": "reinventing-the-wheel", "title": "Reinventing the wheel"}, 22 | {"file": "contributing", "title": "Contributing"}, 23 | {"file": "building", "title": "Building from the sources"} 24 | ] 25 | }, 26 | { 27 | "title": "Internals", 28 | "folder": "internals", 29 | "pages": [ 30 | {"file": "classmapper", "title": "C++ to JavaScript Binding"}, 31 | {"file": "logging", "title": "Internal logging"}, 32 | {"file": "rooting", "title": "JSAPI Rooting Howto"} 33 | ] 34 | }] 35 | -------------------------------------------------------------------------------- /docs/en/guide/misc/building.md: -------------------------------------------------------------------------------- 1 | --- 2 | description: Building nidium 3 | --- 4 | 5 | In order to build nidium you need at least 5GB of disk space. A build from scratch could takes from 20 to 60 minutes, depending of the speed of your computer. 6 | 7 | 8 | ## GNU/Linux dependencies 9 | Typically, on a **debian** based system you'll require the following dependencies : 10 | 11 | ```bash 12 | $ apt-get install libpci-dev python2.7 git make patch clang pkg-config libgtk2.0-dev libgtk-3-dev mesa-common-dev libglu1-mesa-dev yasm libasound2 libasound2-dev libbz2-1.0 13 | ``` 14 | 15 | ## macOS dependencies 16 | 17 | Building nidium on macOS requires Xcode to be installed. 18 | 19 | ## Building 20 | 21 | Building nidium on macOS or GNU/Linux : 22 | 23 | ```bash 24 | $ git clone https://github.com/nidium/NidiumTools.git 25 | $ git clone --recursive https://github.com/nidium/Nidium.git 26 | $ export PYTHONPATH=$(pwd)/NidiumTools/src 27 | $ cd Nidium 28 | $ ./configure_frontend 29 | $ ./bin/nidium 30 | ``` 31 | -------------------------------------------------------------------------------- /gyp/.gitignore: -------------------------------------------------------------------------------- 1 | *.xcodeproj 2 | 3 | -------------------------------------------------------------------------------- /gyp/all.gyp: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Nidium Inc. All rights reserved. 2 | # Use of this source code is governed by a MIT license 3 | # that can be found in the LICENSE file. 4 | 5 | { 6 | 'targets': [{ 7 | 'conditions': [ 8 | ['target_os=="android"', { 9 | 'target_name': 'nidiumapp', 10 | 'type': 'none', 11 | 'dependencies': [ 12 | 'libnidium_android.gyp:libnidium_android', 13 | ], 14 | }, 15 | { 16 | 'target_name': 'nidiumapp', 17 | 'type': 'none', 18 | 'dependencies': [ 19 | 'nidium.gyp:<(nidium_exec_name)', 20 | ], 21 | }] 22 | ] 23 | }] 24 | } 25 | 26 | -------------------------------------------------------------------------------- /gyp/crashreporter.gyp: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Nidium Inc. All rights reserved. 2 | # Use of this source code is governed by a MIT license 3 | # that can be found in the LICENSE file. 4 | 5 | { 6 | 'targets': [{ 7 | 'target_name': 'nidium-crash-reporter', 8 | 'type': 'executable', 9 | 'product_dir': '<(nidium_exec_path)', 10 | 'sources': [ 11 | '<(nidium_app_path)/linux/CrashReporter.c', 12 | ], 13 | }], 14 | } 15 | 16 | -------------------------------------------------------------------------------- /gyp/nidium-server.gyp: -------------------------------------------------------------------------------- 1 | # Copyright 2016 Nidium Inc. All rights reserved. 2 | # Use of this source code is governed by a MIT license 3 | # that can be found in the LICENSE file. 4 | 5 | { 6 | 'targets': [{ 7 | 'target_name': 'nidium-server', 8 | 'type': 'executable', 9 | 'product_dir': '<(nidium_exec_path)', 10 | 'dependencies': [ 11 | 'libnidiumcore.gyp:*', 12 | '<(nidium_network_path)/gyp/network.gyp:*' 13 | ], 14 | 'include_dirs': [ 15 | '<(third_party_path)/linenoise/', 16 | '<(nidium_src_path)', 17 | ], 18 | 'cflags': [ 19 | "-Wno-expansion-to-defined", 20 | ], 21 | 'sources': [ 22 | '<(nidium_src_path)/Server/app/main.cpp', 23 | '<(nidium_src_path)/Server/Server.cpp', 24 | '<(nidium_src_path)/Server/Context.cpp', 25 | '<(nidium_src_path)/Server/REPL.cpp', 26 | 27 | '<(third_party_path)/setproctitle/setproctitle.c', 28 | '<(third_party_path)/linenoise/linenoise.c', 29 | ], 30 | 'defines':[ 31 | 'LINENOISE_INTERRUPTIBLE', 32 | ], 33 | 'conditions': [ 34 | ['OS=="linux"', { 35 | 'ldflags': [ 36 | '-rdynamic', 37 | ], 38 | }], 39 | ['OS=="mac"', { 40 | "xcode_settings": { 41 | "OTHER_LDFLAGS": [ 42 | '-rdynamic', 43 | ] 44 | }, 45 | }], 46 | ['nofork==1', { 47 | 'defines':['NIDIUM_NO_FORK'] 48 | }], 49 | ], 50 | }] 51 | } 52 | -------------------------------------------------------------------------------- /gyp/third-party/breakpad_tools.gypi: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | { 6 | 'conditions': [ 7 | ['OS=="linux" or OS=="android"', { 8 | 'variables': { 9 | 'host_arch': '/dev/null < 11 | - int main() {} 12 | -EOF 13 | - if [ "$?" = 0 ]; then 14 | - COMMON_FLAGS="$COMMON_FLAGS -DSNAPPY" 15 | - PLATFORM_LIBS="$PLATFORM_LIBS -lsnappy" 16 | - fi 17 | - 18 | - # Test whether tcmalloc is available 19 | - $CXX $CXXFLAGS -x c++ - -o $CXXOUTPUT -ltcmalloc 2>/dev/null </dev/null 27 | fi 28 | 29 | -------------------------------------------------------------------------------- /patch/libcoroutine.debug.patch: -------------------------------------------------------------------------------- 1 | --- libcoroutine/Makefile.lib 2009-10-20 21:20:10.000000000 +0200 2 | +++ libcoroutine.old/Makefile.lib 2013-03-12 10:48:38.626672271 +0100 3 | @@ -51,7 +51,7 @@ 4 | CFLAGS = $(OPTIMIZE) $(WARN) $(HEADERS) #--param max-inline-insns-single=500 5 | 6 | # Uncommment for Coros to register their stack with Valgrind 7 | -#CFLAGS += -DUSE_VALGRIND 8 | +CFLAGS += -DUSE_VALGRIND 9 | 10 | ### PLATFORM ##################################################### 11 | 12 | -------------------------------------------------------------------------------- /patch/mozilla_android.patch: -------------------------------------------------------------------------------- 1 | # JSAPI45 has been tested with NDK R10, but we are using R13 2 | # This patch fix various stuff to support the new NDK version 3 | --- mozilla-central/js/src/configure 2016-12-21 16:16:45.914235729 +0100 4 | +++ mozilla-central/js/src/configure 2016-12-21 17:11:48.584307204 +0100 5 | @@ -6673,9 +6673,9 @@ 6 | 7 | if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then 8 | cpu_arch_dir="$ANDROID_CPU_ARCH" 9 | - if test "$MOZ_THUMB2" = 1; then 10 | - cpu_arch_dir="$cpu_arch_dir/thumb" 11 | - fi 12 | + #if test "$MOZ_THUMB2" = 1; then 13 | + # cpu_arch_dir="$cpu_arch_dir/thumb" 14 | + #fi 15 | 16 | if test -z "$STLPORT_CPPFLAGS$STLPORT_LIBS"; then 17 | case "$android_cxx_stl" in 18 | 19 | --- mozilla-central/js/src/configure 2017-01-05 13:04:58.663926251 +0100 20 | +++ mozilla-central/js/src/configure 2017-01-05 13:05:28.583926899 +0100 21 | @@ -6706,7 +6706,7 @@ 22 | { echo "configure: error: Couldn't find path to llvm-libc++ in the android ndk" 1>&2; echo "configure: error: Couldn't find path to llvm-libc++ in the android ndk" 1>&5; exit 1; } 23 | fi 24 | 25 | - STLPORT_LIBS="-L$cxx_libs -lc++_static" 26 | + STLPORT_LIBS="-L$cxx_libs -lc++_static -lc++abi" 27 | # Add android/support/include/ for prototyping long double math 28 | # functions, locale-specific C library functions, multibyte support, 29 | # etc. 30 | 31 | -------------------------------------------------------------------------------- /patch/setproctitle.patch: -------------------------------------------------------------------------------- 1 | --- libnostd/bsd/stdlib/setproctitle.c 2016-05-09 07:14:59.962555311 +0200 2 | +++ libnostd/bsd/stdlib/setproctitle_redis.c 2016-05-09 07:15:32.913996427 +0200 3 | @@ -2,6 +2,8 @@ 4 | * setproctitle.c - Linux/Darwin setproctitle. 5 | * -------------------------------------------------------------------------- 6 | * Copyright (C) 2010 William Ahern 7 | + * Copyright (C) 2013 Salvatore Sanfilippo 8 | + * Copyright (C) 2013 Stam He 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a 11 | * copy of this software and associated documentation files (the 12 | @@ -36,15 +38,15 @@ 13 | 14 | #include /* errno program_invocation_name program_invocation_short_name */ 15 | 16 | - 17 | #if !defined(HAVE_SETPROCTITLE) 18 | #define HAVE_SETPROCTITLE (defined __NetBSD__ || defined __FreeBSD__ || defined __OpenBSD__) 19 | #endif 20 | 21 | 22 | #if !HAVE_SETPROCTITLE 23 | -#if (defined __linux || defined __APPLE__) && defined __GNUC__ 24 | +#if (defined __linux || defined __APPLE__) 25 | 26 | +extern char **environ; 27 | 28 | static struct { 29 | /* original value */ 30 | @@ -81,7 +83,7 @@ 31 | return 0; 32 | #else 33 | extern char **environ; 34 | - char **tmp; 35 | + static char **tmp; 36 | 37 | if (!(tmp = malloc(sizeof *tmp))) 38 | return errno; 39 | @@ -143,9 +145,8 @@ 40 | } /* spt_copyargs() */ 41 | 42 | 43 | -void spt_init(int argc, char *argv[], char *envp[]) __attribute__((constructor)); 44 | - 45 | -void spt_init(int argc, char *argv[], char *envp[]) { 46 | +void spt_init(int argc, char *argv[]) { 47 | + char **envp = environ; 48 | char *base, *end, *nul, *tmp; 49 | int i, error; 50 | 51 | -------------------------------------------------------------------------------- /patch/skia_gl_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | 7 | #define GR_GL_USE_BUFFER_DATA_NULL_HINT 0 8 | #define GR_GL_MUST_USE_VBO 1 9 | #ifdef SK_BUILD_FOR_ANDROID 10 | #define GR_GL_USE_NEW_SHADER_SOURCE_SIGNATURE 1 11 | #endif 12 | 13 | /* nidium use per GL-call callback to reset the context */ 14 | #define GR_GL_PER_GL_FUNC_CALLBACK 1 15 | -------------------------------------------------------------------------------- /patch/skia_zlib_osx.patch: -------------------------------------------------------------------------------- 1 | diff --git a/gyp/zlib.gyp b/gyp/zlib.gyp 2 | index 78adc34b..acd2ff6 100644 3 | --- a/gyp/zlib.gyp 4 | +++ b/gyp/zlib.gyp 5 | @@ -60,7 +60,7 @@ 6 | 'conditions': [ 7 | [ 'skia_os == "mac" or skia_os == "ios"', { 8 | 'libraries': [ 9 | - '$(SDKROOT)/usr/lib/libz.dylib', 10 | + 'libz.a', 11 | ] 12 | }, { # skia_os != "mac" and skia_os != "ios" 13 | 'libraries': [ 14 | -------------------------------------------------------------------------------- /patch/zita.patch: -------------------------------------------------------------------------------- 1 | --- zita-resampler.org/libs/Makefile 2012-10-26 22:58:55.000000000 +0200 2 | +++ zita-resampler/libs/Makefile 2017-04-13 18:23:14.456841988 +0200 3 | @@ -28,11 +28,13 @@ 4 | MINVERS = 3.0 5 | VERSION = $(MAJVERS).$(MINVERS) 6 | DISTDIR = zita-resampler-$(VERSION) 7 | - 8 | +CC ?= g++ 9 | 10 | CPPFLAGS += -I. -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS 11 | CXXFLAGS += -Wall -fPIC -O2 -ffast-math 12 | -CXXFLAGS += -march=native 13 | +ifeq ($(CC),gcc) 14 | + CXXFLAGS += -march=native 15 | +endif 16 | LDFLAGS += 17 | LDLIBS += 18 | 19 | @@ -45,8 +47,10 @@ 20 | ZITA-RESAMPLER_H = zita-resampler/resampler.h zita-resampler/resampler-table.h zita-resampler/vresampler.h 21 | 22 | 23 | +libzita-resampler.a : $(ZITA-RESAMPLER_O) 24 | + ar rcs $@ $(ZITA-RESAMPLER_O) 25 | $(ZITA-RESAMPLER_MIN): $(ZITA-RESAMPLER_O) 26 | - g++ -shared $(LDFLAGS) -Wl,-soname,$(ZITA-RESAMPLER_MAJ) -o $(ZITA-RESAMPLER_MIN) $(ZITA-RESAMPLER_O) $(ZITA-RESAMPLER_DEP) 27 | + $(CC) -shared $(LDFLAGS) -Wl,-soname,$(ZITA-RESAMPLER_MAJ) -o $(ZITA-RESAMPLER_MIN) $(ZITA-RESAMPLER_O) $(ZITA-RESAMPLER_DEP) 28 | 29 | $(ZITA-RESAMPLER_O): $(ZITA-RESAMPLER_H) 30 | 31 | -------------------------------------------------------------------------------- /resources/icons/nidium.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.eps -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_128x128.png -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_128x128@2x.png -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_16x16.png -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_16x16@2x.png -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_256x256.png -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_256x256@2x.png -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_32x32.png -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_32x32@2x.png -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_512x512.png -------------------------------------------------------------------------------- /resources/icons/nidium.iconset/nidium_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.iconset/nidium_512x512@2x.png -------------------------------------------------------------------------------- /resources/icons/nidium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/icons/nidium.png -------------------------------------------------------------------------------- /resources/icons/update_icons.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2016 Nidium Inc. All rights reserved. 4 | # Use of this source code is governed by a MIT license 5 | # that can be found in the LICENSE file. 6 | 7 | platform=`uname` 8 | if [[ $platform == 'Linux' ]]; then 9 | inkscape=inkscape 10 | function resize { 11 | convert $1 -resize $2 $3 12 | } 13 | elif [[ $platform == 'Darwin' ]]; then 14 | inkscape=/Applications/Inkscape.app/Contents/Resources/bin/inkscape 15 | function resize { 16 | sips -z $2 $2 $1 --out $3 17 | } 18 | fi 19 | 20 | printf "=> Converting svg to png\n" 21 | $inkscape $(pwd)/nidium.svg --export-png $(pwd)/nidium.png --export-dpi 300 22 | 23 | printf "=> Generating icon variants\n" 24 | 25 | resize nidium.png 16 nidium_16x16.png 26 | resize nidium.png 32 nidium_32x32.png 27 | resize nidium.png 64 nidium_64x64.png 28 | resize nidium.png 128 nidium_128x128.png 29 | resize nidium.png 256 nidium_256x256.png 30 | resize nidium.png 512 nidium_512x512.png 31 | resize nidium.png 1024 nidium_1024x1024.png 32 | 33 | if [[ $platform == 'Darwin' ]]; then 34 | cd ../osx/ 35 | ./update_icns.sh 36 | cd - 37 | fi 38 | 39 | printf "=> Done !\n" 40 | -------------------------------------------------------------------------------- /resources/linux/nidium.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=Nidium 4 | Icon=x-application-nidium 5 | MimeType=application/nidium; 6 | -------------------------------------------------------------------------------- /resources/linux/x-application-nidium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Nidium Application 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /resources/osx/create_icns.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2016 Nidium Inc. All rights reserved. 4 | # Use of this source code is governed by a MIT license 5 | # that can be found in the LICENSE file. 6 | 7 | rm -fr nidium.iconset/ 8 | mkdir nidium.iconset/ 9 | 10 | printf "=> Creating iconset\n" 11 | cp ../icons/nidium_16x16.png nidium.iconset/icon_16x16.png 12 | cp ../icons/nidium_32x32.png nidium.iconset/icon_16x16@2x.png 13 | 14 | cp ../icons/nidium_32x32.png nidium.iconset/icon_32x32.png 15 | cp ../icons/nidium_64x64.png nidium.iconset/icon_32x32@2x.png 16 | 17 | cp ../icons/nidium_128x128.png nidium.iconset/icon_128x128.png 18 | cp ../icons/nidium_256x256.png nidium.iconset/icon_128x128@2x.png 19 | 20 | cp ../icons/nidium_256x256.png nidium.iconset/icon_256x256.png 21 | cp ../icons/nidium_512x512.png nidium.iconset/icon_256x256@2x.png 22 | 23 | cp ../icons/nidium_512x512.png nidium.iconset/icon_512x512.png 24 | cp ../icons/nidium_1024x1024.png nidium.iconset/icon_512x512@2x.png 25 | 26 | printf "=> Generating icns\n" 27 | iconutil -c icns nidium.iconset 28 | 29 | printf "=> Done !\n" 30 | -------------------------------------------------------------------------------- /resources/osx/demo-sla.r: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/osx/demo-sla.r -------------------------------------------------------------------------------- /resources/osx/dmg-background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/osx/dmg-background.png -------------------------------------------------------------------------------- /resources/osx/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /resources/osx/nidium.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/resources/osx/nidium.icns -------------------------------------------------------------------------------- /src/AV/AudioNodeDelay.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #include "AudioNodeDelay.h" 7 | 8 | namespace Nidium { 9 | namespace AV { 10 | 11 | AudioNodeDelay::AudioNodeDelay(int inCount, int outCount, Audio *audio) 12 | : AudioNodeProcessor(inCount, outCount, audio) 13 | { 14 | m_Args[0] 15 | = new ExportsArgs("wet", DOUBLE, WET, AudioNodeDelay::argCallback); 16 | m_Args[1] 17 | = new ExportsArgs("delay", INT, DELAY, AudioNodeDelay::argCallback); 18 | m_Args[2] = new ExportsArgs("feedback", DOUBLE, FEEDBACK, 19 | AudioNodeDelay::argCallback); 20 | 21 | m_DelayProcessor = new AudioProcessorDelay( 22 | m_Audio->m_OutputParameters->m_SampleRate, 2000); 23 | 24 | this->setProcessor(0, m_DelayProcessor); 25 | this->setProcessor(1, m_DelayProcessor); 26 | } 27 | 28 | void AudioNodeDelay::argCallback(AudioNode *node, int id, void *tmp, int size) 29 | { 30 | AudioNodeDelay *thiz = static_cast(node); 31 | switch (id) { 32 | case DELAY: 33 | thiz->m_DelayProcessor->setDelay(*static_cast(tmp)); 34 | break; 35 | case WET: 36 | thiz->m_DelayProcessor->setWet(*static_cast(tmp)); 37 | break; 38 | case FEEDBACK: 39 | thiz->m_DelayProcessor->setFeedback(*static_cast(tmp)); 40 | break; 41 | } 42 | } 43 | 44 | } // namespace AV 45 | } // namespace Nidium 46 | -------------------------------------------------------------------------------- /src/AV/AudioNodeDelay.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef av_audionodedelay_h__ 7 | #define av_audionodedelay_h__ 8 | 9 | #include "Core/Utils.h" 10 | #include "Audio.h" 11 | #include "AudioNode.h" 12 | 13 | #include "processor/Delay.h" 14 | 15 | namespace Nidium { 16 | namespace AV { 17 | 18 | class AudioProcessorDelay; 19 | 20 | class AudioNodeDelay : public AudioNodeProcessor 21 | { 22 | public: 23 | AudioNodeDelay(int inCount, int outCount, Audio *audio); 24 | 25 | enum Args 26 | { 27 | WET, 28 | DELAY, 29 | FEEDBACK 30 | }; 31 | 32 | static void argCallback(AudioNode *node, int id, void *val, int size); 33 | 34 | ~AudioNodeDelay(){}; 35 | 36 | private: 37 | AudioProcessorDelay *m_DelayProcessor; 38 | }; 39 | 40 | } // namespace AV 41 | } // namespace Nidium 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/AV/AudioNodeGain.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #include "AudioNodeGain.h" 7 | #include "processor/Gain.h" 8 | 9 | namespace Nidium { 10 | namespace AV { 11 | 12 | AudioNodeGain::AudioNodeGain(int inCount, int outCount, Audio *audio) 13 | : AudioNodeProcessor(inCount, outCount, audio) 14 | { 15 | m_Args[0] 16 | = new ExportsArgs("gain", DOUBLE, GAIN, AudioNodeGain::argCallback); 17 | m_GainProcessor = new AudioProcessorGain(); 18 | 19 | this->setProcessor(0, m_GainProcessor); 20 | this->setProcessor(1, m_GainProcessor); 21 | } 22 | 23 | void AudioNodeGain::argCallback(AudioNode *node, int id, void *tmp, int size) 24 | { 25 | AudioNodeGain *thiz = static_cast(node); 26 | switch (id) { 27 | case GAIN: 28 | thiz->m_GainProcessor->setGain(*static_cast(tmp)); 29 | break; 30 | } 31 | } 32 | 33 | } // namespace AV 34 | } // namespace Nidium 35 | -------------------------------------------------------------------------------- /src/AV/AudioNodeGain.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef av_audionodegain_h__ 7 | #define av_audionodegain_h__ 8 | 9 | #include "Audio.h" 10 | #include "AudioNode.h" 11 | 12 | namespace Nidium { 13 | namespace AV { 14 | 15 | class AudioProcessorGain; 16 | 17 | class AudioNodeGain : public AudioNodeProcessor 18 | { 19 | public: 20 | AudioNodeGain(int inCount, int outCount, Audio *audio); 21 | 22 | enum Args 23 | { 24 | GAIN 25 | }; 26 | 27 | static void argCallback(AudioNode *node, int id, void *val, int size); 28 | 29 | ~AudioNodeGain(){}; 30 | 31 | private: 32 | AudioProcessorGain *m_GainProcessor; 33 | }; 34 | 35 | } // namespace AV 36 | } // namespace Nidium 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/AV/AudioParameters.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef av_audionparameters_h__ 7 | #define av_audionparameters_h__ 8 | 9 | namespace Nidium { 10 | namespace AV { 11 | 12 | class AudioParameters 13 | { 14 | public: 15 | int m_BufferSize, m_Channels, m_SampleFmt, m_SampleRate, m_FramesPerBuffer; 16 | AudioParameters(int bufferSize, int channels, int sampleFmt, int sampleRate) 17 | : m_BufferSize(bufferSize), m_Channels(channels), 18 | m_SampleFmt(sampleFmt), m_SampleRate(sampleRate), 19 | m_FramesPerBuffer(bufferSize / (sampleFmt * channels)) 20 | { 21 | } 22 | }; 23 | 24 | } // namespace AV 25 | } // namespace Nidium 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/AV/processor/Gain.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef av_processor_gain_h__ 7 | #define av_processor_gain_h__ 8 | 9 | #include "../AudioNode.h" 10 | 11 | namespace Nidium { 12 | namespace AV { 13 | 14 | class AudioProcessorGain : public AudioProcessor 15 | { 16 | public: 17 | AudioProcessorGain() : m_Gain(1){}; 18 | 19 | void process(float *in, int *i) 20 | { 21 | *in = *in * m_Gain; 22 | } 23 | 24 | void setGain(double gain) 25 | { 26 | m_Gain = gain; 27 | } 28 | 29 | ~AudioProcessorGain(){}; 30 | 31 | private: 32 | double m_Gain; 33 | }; 34 | 35 | } // namespace AV 36 | } // namespace Nidium 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/Binding/JSAudio.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsaudio_h__ 7 | #define binding_jsaudio_h__ 8 | 9 | #include "AV/Audio.h" 10 | #include "Binding/JSAudioContext.h" 11 | 12 | using namespace Nidium::AV; 13 | 14 | namespace Nidium { 15 | namespace Binding { 16 | 17 | class JSAudio : public ClassMapper 18 | { 19 | public: 20 | static JSFunctionSpec *ListMethods(); 21 | static void RegisterObject(JSContext *cx); 22 | static void RegisterAllObjects(JSContext *cx); 23 | 24 | protected: 25 | NIDIUM_DECL_JSCALL(getContext); 26 | }; 27 | 28 | } // namespace Binding 29 | } // namespace Nidium 30 | 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/Binding/JSConsole.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsconsole_h__ 7 | #define binding_jsconsole_h__ 8 | 9 | #include "Binding/ClassMapper.h" 10 | 11 | namespace Nidium { 12 | namespace Binding { 13 | 14 | class JSConsole : public ClassMapper 15 | { 16 | public: 17 | static JSFunctionSpec *ListMethods(); 18 | 19 | static void RegisterObject(JSContext *cx); 20 | protected: 21 | NIDIUM_DECL_JSCALL(log); 22 | NIDIUM_DECL_JSCALL(write); 23 | NIDIUM_DECL_JSCALL(hide); 24 | NIDIUM_DECL_JSCALL(clear); 25 | NIDIUM_DECL_JSCALL(show); 26 | }; 27 | 28 | } // namespace Binding 29 | } // namespace Nidium 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/Binding/JSDB.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsdb_h__ 7 | #define binding_jsdb_h__ 8 | 9 | #include "Core/DB.h" 10 | 11 | #include 12 | 13 | #include "Binding/ClassMapper.h" 14 | 15 | namespace Nidium { 16 | namespace Binding { 17 | 18 | class JSDB : public ClassMapper, public Nidium::Core::DB 19 | { 20 | public: 21 | JSDB(const char *name); 22 | bool set(JSContext *cx, const char *key, JS::HandleValue val); 23 | bool get(JSContext *cx, const char *key, JS::MutableHandleValue val); 24 | static void RegisterObject(JSContext *cx); 25 | 26 | static JSDB *Constructor(JSContext *cx, JS::CallArgs &args, 27 | JS::HandleObject obj); 28 | 29 | static JSFunctionSpec *ListMethods(); 30 | protected: 31 | 32 | NIDIUM_DECL_JSCALL(get); 33 | NIDIUM_DECL_JSCALL(set); 34 | NIDIUM_DECL_JSCALL(delete); 35 | NIDIUM_DECL_JSCALL(close); 36 | NIDIUM_DECL_JSCALL(drop); 37 | 38 | }; 39 | 40 | } // namespace Binding 41 | } // namespace Nidium 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/Binding/JSDebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsdebug_h__ 7 | #define binding_jsdebug_h__ 8 | 9 | #include "Binding/ClassMapper.h" 10 | 11 | namespace Nidium { 12 | namespace Binding { 13 | 14 | class JSDebug : public ClassMapper 15 | { 16 | public: 17 | virtual ~JSDebug(){}; 18 | 19 | static JSFunctionSpec *ListMethods(); 20 | static void RegisterObject(JSContext *cx); 21 | protected: 22 | NIDIUM_DECL_JSCALL(serialize); 23 | NIDIUM_DECL_JSCALL(unserialize); 24 | 25 | }; 26 | 27 | } // namespace Binding 28 | } // namespace Nidium 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/Binding/JSDebugger.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsdebugger_h__ 7 | #define binding_jsdebugger_h__ 8 | 9 | #include "Binding/ClassMapper.h" 10 | 11 | namespace Nidium { 12 | namespace Binding { 13 | 14 | class JSDebuggerCompartment : public ClassMapper 15 | { 16 | public: 17 | static void RegisterObject(JSContext *cx) 18 | { 19 | JSDebuggerCompartment::ExposeClass<0>(cx, "DebuggerCompartment"); 20 | } 21 | 22 | static JSDebuggerCompartment * 23 | Constructor(JSContext *cx, JS::CallArgs &args, JS::HandleObject obj); 24 | 25 | static JSFunctionSpec *ListMethods(); 26 | 27 | JSDebuggerCompartment(JSContext *cx); 28 | virtual ~JSDebuggerCompartment(); 29 | 30 | protected: 31 | NIDIUM_DECL_JSCALL(run); 32 | 33 | private: 34 | JS::Heap m_Debugger; 35 | JS::Heap m_Global; 36 | JSCompartment *m_Compartment; 37 | 38 | bool run(JSContext *cx, 39 | const char *funStr, 40 | const JS::HandleValueArray &args, 41 | JS::MutableHandleValue rval); 42 | }; 43 | 44 | } // namespace Binding 45 | } // namespace Nidium 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/Binding/JSGlobal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsglobal_h__ 7 | #define binding_jsglobal_h__ 8 | 9 | #include "Binding/ClassMapper.h" 10 | #include "Binding/NidiumJS.h" 11 | #include 12 | 13 | namespace Nidium { 14 | namespace Binding { 15 | 16 | class JSGlobal : public ClassMapper 17 | { 18 | public: 19 | JSGlobal(NidiumJS *njs) : m_JS(njs) {} 20 | virtual ~JSGlobal(){} 21 | 22 | static JSFunctionSpec *ListMethods(); 23 | static JSPropertySpec *ListProperties(); 24 | static void RegisterObject(JSContext *cx, JS::HandleObject global, 25 | NidiumJS *njs); 26 | 27 | static inline JSGlobal *GetInstance(JSObject *obj, JSContext *cx) 28 | { 29 | if (cx == nullptr) { 30 | return nullptr; 31 | } 32 | 33 | return static_cast(JS_GetPrivate(JS::CurrentGlobalOrNull(cx))); 34 | } 35 | 36 | /* 37 | Override ClassMapper::GetJSClass, 38 | since the global class has some special flags 39 | */ 40 | static JSClass *GetJSClass(); 41 | protected: 42 | NIDIUM_DECL_JSCALL(load); 43 | NIDIUM_DECL_JSCALL(setTimeout); 44 | NIDIUM_DECL_JSCALL(setImmediate); 45 | NIDIUM_DECL_JSCALL(setInterval); 46 | NIDIUM_DECL_JSCALL(clearTimeout); 47 | NIDIUM_DECL_JSCALL(btoa); 48 | 49 | NIDIUM_DECL_JSGETTER(__filename); 50 | NIDIUM_DECL_JSGETTER(__dirname); 51 | NIDIUM_DECL_JSGETTER(global); 52 | private: 53 | NidiumJS *m_JS; 54 | }; 55 | 56 | 57 | } // namespace Binding 58 | } // namespace Nidium 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/Binding/JSImage.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsimage_h__ 7 | #define binding_jsimage_h__ 8 | 9 | #include "Core/Messages.h" 10 | #include "IO/Stream.h" 11 | #include "Binding/ClassMapperWithEvents.h" 12 | 13 | using Nidium::Core::Path; 14 | 15 | namespace Nidium { 16 | namespace Graphics { 17 | class Image; 18 | } 19 | namespace Binding { 20 | 21 | class JSImage : public ClassMapperWithEvents, public Core::Messages 22 | { 23 | public: 24 | JSImage(); 25 | virtual ~JSImage(); 26 | static JSPropertySpec *ListProperties(); 27 | static JSImage *Constructor(JSContext *cx, JS::CallArgs &args, 28 | JS::HandleObject obj); 29 | 30 | static Graphics::Image *JSObjectToImage(JS::HandleObject obj); 31 | static void RegisterObject(JSContext *cx); 32 | static bool JSObjectIs(JSContext *cx, JS::HandleObject obj); 33 | static JSObject *BuildImageObject(JSContext *cx, 34 | Graphics::Image *image, 35 | const char name[] = NULL); 36 | 37 | void onMessage(const Core::SharedMessages::Message &msg); 38 | 39 | Graphics::Image *getImage() const { 40 | return m_Image; 41 | } 42 | 43 | protected: 44 | NIDIUM_DECL_JSGETTERSETTER(src); 45 | NIDIUM_DECL_JSGETTER(width); 46 | NIDIUM_DECL_JSGETTER(height); 47 | private: 48 | bool setupWithBuffer(buffer *buf); 49 | 50 | Graphics::Image *m_Image; 51 | IO::Stream *m_Stream; 52 | Path *m_Path; 53 | }; 54 | 55 | } // namespace Binding 56 | } // namespace Nidium 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /src/Binding/JSImageData.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsimagedata_h__ 7 | #define binding_jsimagedata_h__ 8 | 9 | #include "Binding/ClassMapper.h" 10 | 11 | namespace Nidium { 12 | namespace Binding { 13 | 14 | class JSImageData : public ClassMapper 15 | { 16 | public: 17 | static void RegisterObject(JSContext *cx) 18 | { 19 | ExposeClass(cx, "ImageData"); 20 | } 21 | }; 22 | 23 | } // Binding 24 | } // Nidium 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/Binding/JSKeyboard.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Copyright 2016 Nidium Inc. All rights reserved. 4 | Use of this source code is governed by a MIT license 5 | that can be found in the LICENSE file. 6 | */ 7 | #ifndef binding_jskeyboard_h__ 8 | #define binding_jskeyboard_h__ 9 | 10 | #include "Binding/ClassMapper.h" 11 | 12 | using Nidium::Binding::ClassMapper; 13 | 14 | namespace Nidium { 15 | namespace Binding { 16 | 17 | class JSKeyboard : public ClassMapper 18 | { 19 | public: 20 | // Always keep in sync with platform implementation code 21 | enum KeyboardOptions { 22 | kOption_Normal = 1 << 0, 23 | kOption_Numeric = 1 << 1, 24 | kOption_TextOnly = 1 << 2 25 | }; 26 | 27 | JSKeyboard(); 28 | static void RegisterObject(JSContext *cx); 29 | static JSObject *RegisterModule(JSContext *cx); 30 | static JSFunctionSpec *ListStaticMethods(); 31 | static JSConstDoubleSpec *ListConstDoubles(); 32 | 33 | protected: 34 | NIDIUM_DECL_JSCALL_STATIC(show); 35 | NIDIUM_DECL_JSCALL_STATIC(hide); 36 | }; 37 | 38 | } // namespace Binding 39 | } // namespce Nidium 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/Binding/JSNFS.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsnfs_h__ 7 | #define binding_jsnfs_h__ 8 | 9 | #include "IO/NFS.h" 10 | 11 | #include 12 | 13 | namespace Nidium { 14 | namespace Binding { 15 | 16 | class JSNFS : public Nidium::IO::NFS 17 | { 18 | public: 19 | JSNFS(JSContext *cx); 20 | bool writeFile(const char *name_utf8, 21 | size_t name_len, 22 | char *content, 23 | size_t len, 24 | int flags = 0); 25 | 26 | private: 27 | void *buildJS(const char *data, 28 | size_t len, 29 | const char *filename, 30 | uint32_t *outlen); 31 | void initRoot(); 32 | struct 33 | { 34 | JSRuntime *rt; 35 | JSContext *cx; 36 | } m_JS; 37 | }; 38 | 39 | #endif 40 | 41 | } // namespace Binding 42 | } // namespace Nidium 43 | -------------------------------------------------------------------------------- /src/Binding/JSNML.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #include "Binding/JSNML.h" 7 | #include "Frontend/NML.h" 8 | 9 | 10 | namespace Nidium { 11 | namespace Binding { 12 | 13 | bool JSNML::JSStatic_parse(JSContext *cx, JS::CallArgs &args) 14 | { 15 | if (!args[0].isString()) { 16 | JS_ReportError(cx, "parse() first argument must be a string"); 17 | return false; 18 | } 19 | 20 | JSAutoByteString str; 21 | 22 | str.encodeUtf8(cx, JS::RootedString(cx, args[0].toString())); 23 | 24 | JS::RootedObject tree(cx, Frontend::NML::BuildLST(cx, str.ptr())); 25 | 26 | // NML::BuildLST() may throw an exception is case of multiple 27 | // properties defined with the same name. 28 | if (JS_IsExceptionPending(cx)) { 29 | return false; 30 | } 31 | 32 | args.rval().setObjectOrNull(tree); 33 | 34 | return true; 35 | } 36 | 37 | JSFunctionSpec *JSNML::ListStaticMethods() 38 | { 39 | static JSFunctionSpec funcs[] = { 40 | CLASSMAPPER_FN_STATIC(JSNML, parse, 1), 41 | JS_FS_END 42 | }; 43 | 44 | return funcs; 45 | } 46 | 47 | 48 | void JSNML::RegisterObject(JSContext *cx) 49 | { 50 | JSNML::ExposeClass<0>(cx, "NML"); 51 | } 52 | 53 | 54 | } // namespace Binding 55 | } // namespace Nidium 56 | -------------------------------------------------------------------------------- /src/Binding/JSNML.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsnml_h__ 7 | #define binding_jsnml_h__ 8 | 9 | 10 | #include "Binding/ClassMapper.h" 11 | 12 | namespace Nidium { 13 | namespace Binding { 14 | 15 | class JSNML : public ClassMapper 16 | { 17 | public: 18 | JSNML(); 19 | 20 | static void RegisterObject(JSContext *cx); 21 | 22 | static JSFunctionSpec *ListStaticMethods(); 23 | protected: 24 | 25 | NIDIUM_DECL_JSCALL_STATIC(parse); 26 | //NIDIUM_DECL_JSCALL_STATIC(stringify); 27 | }; 28 | 29 | } // namespace Binding 30 | } // namespace Nidium 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/Binding/JSOS.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #include "JSOS.h" 7 | 8 | #include "JSUtils.h" 9 | #include "JSModules.h" 10 | #ifdef NIDIUM_PRODUCT_FRONTEND 11 | #include "Interface/SystemInterface.h" 12 | #endif 13 | 14 | namespace Nidium { 15 | namespace Binding { 16 | 17 | 18 | void JSOS::RegisterObject(JSContext *cx) 19 | { 20 | JSModules::RegisterEmbedded("OS", JSOS::RegisterModule); 21 | } 22 | 23 | JSObject *JSOS::RegisterModule(JSContext *cx) 24 | { 25 | JS::RootedObject exports(cx, JSOS::ExposeObject(cx, "OS")); 26 | 27 | // Platform 28 | JS::RootedString platformStr(cx, JSUtils::NewStringWithEncoding(cx, 29 | NIDIUM_PLATFORM, strlen(NIDIUM_PLATFORM), "utf8")); 30 | JS::RootedValue platform(cx, JS::StringValue(platformStr)); 31 | 32 | JS_DefineProperty(cx, exports, "platform", platform, 33 | JSPROP_PERMANENT | JSPROP_READONLY | JSPROP_ENUMERATE); 34 | 35 | // Language 36 | #ifdef NIDIUM_PRODUCT_FRONTEND 37 | Interface::SystemInterface* interface = Interface::SystemInterface::GetInstance(); 38 | const char *clang = interface->getLanguage(); 39 | JS::RootedString langStr(cx, JSUtils::NewStringWithEncoding(cx, 40 | clang, strlen(clang), "utf8")); 41 | JS::RootedValue lang(cx, JS::StringValue(langStr)); 42 | 43 | JS_DefineProperty(cx, exports, "language", lang, 44 | JSPROP_PERMANENT | JSPROP_READONLY | JSPROP_ENUMERATE); 45 | #endif 46 | 47 | return exports; 48 | } 49 | 50 | } // namespace Binding 51 | } // namespace Nidium 52 | 53 | -------------------------------------------------------------------------------- /src/Binding/JSOS.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jssystem_h__ 7 | #define binding_jssystem_h__ 8 | 9 | #include "Binding/ClassMapper.h" 10 | 11 | using Nidium::Binding::ClassMapper; 12 | 13 | namespace Nidium { 14 | namespace Binding { 15 | 16 | class JSOS : public ClassMapper 17 | { 18 | public: 19 | JSOS(); 20 | static void RegisterObject(JSContext *cx); 21 | static JSObject *RegisterModule(JSContext *cx); 22 | }; 23 | 24 | } // namespace Binding 25 | } // namespce Nidium 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/Binding/JSProcess.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsprocess_h__ 7 | #define binding_jsprocess_h__ 8 | 9 | #include "Binding/ClassMapper.h" 10 | 11 | namespace Nidium { 12 | namespace Binding { 13 | 14 | class JSProcess : public ClassMapper 15 | { 16 | public: 17 | virtual ~JSProcess(){}; 18 | 19 | static void RegisterObject(JSContext *cx, char **argv, 20 | int argc, int workerId = 0); 21 | 22 | static JSFunctionSpec *ListMethods(); 23 | protected: 24 | NIDIUM_DECL_JSCALL(getOwner); 25 | NIDIUM_DECL_JSCALL(setOwner); 26 | NIDIUM_DECL_JSCALL(setSignalHandler); 27 | NIDIUM_DECL_JSCALL(exit); 28 | NIDIUM_DECL_JSCALL(shutdown); 29 | NIDIUM_DECL_JSCALL(cwd); 30 | }; 31 | 32 | } // namespace Binding 33 | } // namespace Nidium 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/Binding/JSStream.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsstream_h__ 7 | #define binding_jsstream_h__ 8 | 9 | #include "Core/Messages.h" 10 | #include "IO/Stream.h" 11 | #include "Binding/ClassMapper.h" 12 | 13 | namespace Nidium { 14 | namespace Binding { 15 | 16 | class JSStream : public ClassMapper, public Nidium::Core::Messages 17 | { 18 | public: 19 | static void RegisterObject(JSContext *cx); 20 | JSStream(ape_global *net, 21 | const char *url); 22 | ~JSStream(); 23 | Nidium::IO::Stream *getStream() const 24 | { 25 | return m_Stream; 26 | } 27 | 28 | void onMessage(const Nidium::Core::SharedMessages::Message &msg); 29 | static JSStream *Constructor(JSContext *cx, JS::CallArgs &args, 30 | JS::HandleObject obj); 31 | static JSFunctionSpec *ListMethods(); 32 | static JSPropertySpec *ListProperties(); 33 | protected: 34 | NIDIUM_DECL_JSCALL(seek); 35 | NIDIUM_DECL_JSCALL(start); 36 | NIDIUM_DECL_JSCALL(stop); 37 | NIDIUM_DECL_JSCALL(getNextPacket); 38 | 39 | NIDIUM_DECL_JSGETTER(filesize); 40 | private: 41 | Nidium::IO::Stream *m_Stream; 42 | }; 43 | 44 | } // namespace Binding 45 | } // namespace Nidium 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/Binding/JSThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jsthread_h__ 7 | #define binding_jsthread_h__ 8 | 9 | #include 10 | 11 | #include "Core/SharedMessages.h" 12 | #include "Core/Messages.h" 13 | #include "Binding/ClassMapperWithEvents.h" 14 | 15 | 16 | namespace Nidium { 17 | namespace Binding { 18 | 19 | class NidiumJS; 20 | 21 | class JSThread : public ClassMapperWithEvents, 22 | public Nidium::Core::Messages 23 | { 24 | 25 | public: 26 | JSThread(); 27 | enum Thread 28 | { 29 | kThread_Message = 0, 30 | kThread_Complete = 1 31 | }; 32 | virtual ~JSThread(); 33 | static void RegisterObject(JSContext *cx); 34 | void onComplete(JS::HandleValue vp); 35 | void onMessage(const Nidium::Core::SharedMessages::Message &msg); 36 | static JSThread *Constructor(JSContext *cx, JS::CallArgs &args, 37 | JS::HandleObject obj); 38 | static JSFunctionSpec *ListMethods(); 39 | 40 | JS::Heap m_JsFunction; 41 | JSRuntime *m_JsRuntime; 42 | JSRuntime *m_ParentRuntime; 43 | JSContext *m_JsCx; 44 | NidiumJS *m_Njs; 45 | struct 46 | { 47 | int argc; 48 | uint64_t **argv; 49 | size_t *nbytes; 50 | } m_Params; 51 | bool m_MarkedStop; 52 | 53 | pthread_t m_ThreadHandle; 54 | 55 | char *m_CallerFileName; 56 | uint32_t m_CallerLineNo; 57 | protected: 58 | NIDIUM_DECL_JSCALL(start); 59 | }; 60 | #endif 61 | 62 | } // namespace Binding 63 | } // namespace Nidium 64 | -------------------------------------------------------------------------------- /src/Binding/JSWebSocket.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jswebsocket_h__ 7 | #define binding_jswebsocket_h__ 8 | 9 | #include "Core/Messages.h" 10 | #include "Net/WebSocket.h" 11 | #include "Binding/ClassMapper.h" 12 | 13 | namespace Nidium { 14 | namespace Binding { 15 | 16 | class JSWebSocketClientConnection; 17 | 18 | class JSWebSocketServer : public ClassMapper, 19 | public Nidium::Core::Messages 20 | { 21 | public: 22 | JSWebSocketServer(const char *host, 23 | unsigned short port); 24 | virtual ~JSWebSocketServer(); 25 | bool start(); 26 | static void RegisterObject(JSContext *cx); 27 | void onMessage(const Core::SharedMessages::Message &msg); 28 | static JSWebSocketServer *Constructor(JSContext *cx, JS::CallArgs &args, 29 | JS::HandleObject obj); 30 | protected: 31 | private: 32 | Net::WebSocketServer *m_WebSocketServer; 33 | 34 | JSWebSocketClientConnection * 35 | createClient(Net::WebSocketClientConnection *client); 36 | }; 37 | 38 | class JSWebSocketClientConnection: 39 | public ClassMapper 40 | { 41 | public: 42 | JSWebSocketClientConnection(Net::WebSocketClientConnection *client) : 43 | m_WebSocketClientConnection(client) {} 44 | 45 | virtual ~JSWebSocketClientConnection(){}; 46 | static JSFunctionSpec *ListMethods(); 47 | protected: 48 | NIDIUM_DECL_JSCALL(send); 49 | NIDIUM_DECL_JSCALL(close); 50 | private: 51 | Net::WebSocketClientConnection *m_WebSocketClientConnection; 52 | }; 53 | 54 | } // namespace Binding 55 | } // namespace Nidium 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/Binding/JSWebSocketClient.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef binding_jswebsocketclient_h__ 7 | #define binding_jswebsocketclient_h__ 8 | 9 | #include 10 | 11 | #include "Core/Messages.h" 12 | #include "Net/WebSocketClient.h" 13 | #include "Binding/ClassMapper.h" 14 | 15 | namespace Nidium { 16 | namespace Binding { 17 | 18 | class JSWebSocket : public ClassMapper, public Nidium::Core::Messages 19 | { 20 | public: 21 | JSWebSocket(JSContext *cx, const char *host, 22 | unsigned short port, 23 | const char *path, 24 | bool ssl = false); 25 | virtual ~JSWebSocket(); 26 | bool start(); 27 | static void RegisterObject(JSContext *cx); 28 | void onMessage(const Nidium::Core::SharedMessages::Message &msg); 29 | 30 | Nidium::Net::WebSocketClient *ws() const 31 | { 32 | return m_WebSocketClient; 33 | } 34 | static JSWebSocket *Constructor(JSContext *cx, JS::CallArgs &args, 35 | JS::HandleObject obj); 36 | 37 | static JSFunctionSpec *ListMethods(); 38 | protected: 39 | NIDIUM_DECL_JSCALL(send); 40 | NIDIUM_DECL_JSCALL(close); 41 | NIDIUM_DECL_JSCALL(ping); 42 | private: 43 | Nidium::Net::WebSocketClient *m_WebSocketClient; 44 | }; 45 | 46 | } // namespace Binding 47 | } // namespace Nidium 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/Core/DB.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | #ifndef core_db_h__ 7 | #define core_db_h__ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | namespace leveldb { 15 | class DB; 16 | }; 17 | 18 | namespace Nidium { 19 | namespace Core { 20 | 21 | class DB 22 | { 23 | public: 24 | explicit DB(const char *name); 25 | ~DB(); 26 | 27 | /* 28 | Check status after the constructor is caller 29 | */ 30 | bool ok() const 31 | { 32 | return m_Status; 33 | } 34 | 35 | bool set(const char *key, const uint8_t *data, size_t data_len); 36 | bool set(const char *key, const char *string); 37 | bool set(const char *key, const std::string &string); 38 | bool get(const char *key, std::string &ret); 39 | bool del(const char *key); 40 | bool close(); 41 | bool drop(); 42 | 43 | protected: 44 | leveldb::DB *m_Database; 45 | 46 | private: 47 | bool m_Status; 48 | char *m_Name; 49 | }; 50 | 51 | } // namespace Core 52 | } // namespace Nidium 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/Core/NativeEvents.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | 7 | -------------------------------------------------------------------------------- /src/Embed/Symbols.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | module.exports = { 8 | "ElementShadowRoot": Symbol("ElementShadowRoot"), 9 | "ElementShadowHost": Symbol("ElementShadowHost"), 10 | "ComponentShadowRoot": Symbol("ComponentShadowRoot") 11 | } 12 | -------------------------------------------------------------------------------- /src/Embed/additions/HTTP.js: -------------------------------------------------------------------------------- 1 | HTTP.get = function(url, callback) { 2 | var h = new HTTP(url); 3 | 4 | h.on("error", (err) => { 5 | callback(err, null); 6 | }); 7 | 8 | h.on("response", (ev) => { 9 | callback(undefined, ev); 10 | }); 11 | 12 | h.request({ 13 | method: 'GET' 14 | }); 15 | } -------------------------------------------------------------------------------- /src/Embed/additions/NML.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | { 7 | const Elements = require("Elements"); 8 | 9 | function walk(elements, parent, shadowRoot) { 10 | if (!elements) { 11 | return []; 12 | } 13 | 14 | let ret = []; 15 | 16 | for (let node of elements) { 17 | let name = node.type; 18 | 19 | /* 20 | ES6 destructuring object default value doesnt work 21 | https://bugzilla.mozilla.org/show_bug.cgi?id=932080 22 | */ 23 | let {id} = node.attributes || {id: null}; 24 | 25 | let el = Elements.Create( 26 | node.type, node.attributes || node.text, shadowRoot 27 | ); 28 | 29 | if (parent) { 30 | parent.add(el); 31 | } else { 32 | ret.push(el); 33 | } 34 | 35 | el.createTree(node.children); 36 | } 37 | 38 | return ret; 39 | } 40 | 41 | NML.CreateTree = function(nml, parent, shadowRoot) { 42 | let tree; 43 | if (typeof(nml) == "string") { 44 | tree = NML.parse(nml); 45 | if (!tree) { 46 | /* If the NML couldnt be parsed, issue a textnode */ 47 | return [Elements.Create("textnode", nml, shadowRoot)]; 48 | } 49 | } else if (!Array.isArray(nml)) { 50 | throw new Error("NML.CreateTree expect an array"); 51 | } else { 52 | tree = nml; 53 | } 54 | return walk(tree, parent, shadowRoot); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Embed/additions/window.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2017 Nidium Inc. All rights reserved. 3 | Use of this source code is governed by a MIT license 4 | that can be found in the LICENSE file. 5 | */ 6 | 7 | window.location = { 8 | href: "nidium:app", // XXX : Get the app name from the NML ? 9 | } 10 | 11 | window.location[Symbol.toPrimitive] = function(hint) { 12 | return this.href; 13 | } 14 | -------------------------------------------------------------------------------- /src/Embed/default.nml: -------------------------------------------------------------------------------- 1 | 2 | 3 | nidium 4 | 375x667 5 | com.nidium.app 6 | 7 | 8 | 9 | 10 | 11 | bg: { 12 | backgroundColor: "rgb(15, 24, 29);", 13 | flexDirection: "row", 14 | justifyContent: "center", 15 | }, 16 | 17 | bgimg: { 18 | top: -128, 19 | width: 100, 20 | height: 100, 21 | position: "relative" 22 | }, 23 | 24 | mainbar: { 25 | left: "-100%", 26 | backgroundColor: "steelblue" 27 | } 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/Embed/framework/components/button.nc: -------------------------------------------------------------------------------- 1 | 2 | 3 | button: { 4 | cursor: "pointer", 5 | overflow: false, 6 | backgroundColor: "#3388ee", 7 | color: "#ffffff", 8 | radius: 4, 9 | height: 40, 10 | minWidth: 90, 11 | lineHeight: 30, 12 | coating: 10, 13 | 14 | paddingTop: 6, 15 | paddingBottom: 6, 16 | paddingLeft: 10, 17 | paddingRight: 10, 18 | 19 | fontSize: 14, 20 | textAlign: "center", 21 | textOffsetY: 0, 22 | 23 | opacity: 1.0, 24 | borderWidth: 2, 25 | borderColor: "rgba(0, 0, 0, 0.03)", 26 | 27 | shadowBlur: 3, 28 | shadowColor: "rgba(0, 0, 0, 0.02)", 29 | shadowOffsetX: 0, 30 | shadowOffsetY: 2 31 | } 32 | 33 | 34 | Button 35 | 36 | 47 | 48 | -------------------------------------------------------------------------------- /src/Embed/framework/components/icon.nc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon: { 4 | width: 24, 5 | height: 24, 6 | fontFamily: "ionicons" 7 | } 8 | 9 | 10 | 11 | 51 | 52 | -------------------------------------------------------------------------------- /src/Embed/framework/components/statusbar.nc: -------------------------------------------------------------------------------- 1 | 2 | 3 | clean: { 4 | backgroundColor: "#03387e", 5 | height: 20, 6 | lineHeight: 20, 7 | flexDirection: "row", 8 | color: "#ffffff", 9 | fontSize: 10 10 | }, 11 | 12 | left: { 13 | flexGrow: 1, 14 | textAlign: "left" 15 | }, 16 | 17 | center: { 18 | flexGrow: 3, 19 | textAlign: "center" 20 | }, 21 | 22 | right: { 23 | flexGrow: 1, 24 | textAlign: "right" 25 | } 26 | 27 | 28 | .: 29 | 30 | :. 31 | 32 | 39 | 40 | -------------------------------------------------------------------------------- /src/Embed/framework/core/drawer.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | var drawer = { 8 | setShadow : function(ctx, style){ 9 | ctx.shadowOffsetX = style.shadowOffsetX; 10 | ctx.shadowOffsetY = style.shadowOffsetY; 11 | ctx.shadowColor = style.shadowColor; 12 | ctx.shadowBlur = style.shadowBlur; 13 | }, 14 | 15 | disableShadow : function(ctx){ 16 | this.setShadow(ctx, { 17 | shadowOffsetX : 0, 18 | shadowOffsetY : 0, 19 | shadowColor : 0, 20 | shadowBlur : 0 21 | }); 22 | }, 23 | 24 | roundbox : function(ctx, bounds, radius, fill, stroke, lineWidth) { 25 | if (!stroke && !fill) return false; 26 | 27 | if (fill) { 28 | ctx.fillStyle = fill; 29 | ctx.fillRect(bounds.x, bounds.y, bounds.w, bounds.h, radius); 30 | } 31 | 32 | if (stroke && lineWidth) { 33 | ctx.lineWidth = lineWidth; 34 | ctx.strokeStyle = stroke; 35 | 36 | ctx.strokeRect( 37 | bounds.x-lineWidth/2, 38 | bounds.y-lineWidth/2, 39 | bounds.w + lineWidth, 40 | bounds.h + lineWidth, 41 | radius + lineWidth/2 42 | ); 43 | } 44 | } 45 | }; 46 | 47 | module.exports = drawer; -------------------------------------------------------------------------------- /src/Embed/framework/core/responsive.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | "use strict"; 8 | 9 | var responsive = function(){ 10 | const w = window.innerWidth; 11 | 12 | if (w < 350) { 13 | return 'xs'; 14 | } 15 | 16 | if (w >= 350 && w < 768) { 17 | return 'sm'; 18 | } 19 | 20 | if (w >= 768 && w < 1024) { 21 | return 'md'; 22 | } 23 | 24 | if (w >= 1024 && w < 1280) { 25 | return 'lg'; 26 | } 27 | 28 | if (w >= 1280) { 29 | return 'xl'; 30 | } 31 | }; 32 | 33 | module.exports = responsive; -------------------------------------------------------------------------------- /src/Embed/framework/elements/canvas.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.canvas = class extends Elements.Element { 12 | onpaint() {} 13 | } 14 | 15 | ElementStyle.Inherit(Elements.canvas); 16 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/comment.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | 10 | Elements.comment = class extends Elements.Node { 11 | constructor(data) { 12 | super({}); 13 | this.hide(); 14 | this.nodeValue = data; 15 | } 16 | 17 | get nodeType() { 18 | return Elements.NodeType.COMMENT_NODE; 19 | } 20 | 21 | get nodevalue() { 22 | return this._comment; 23 | } 24 | 25 | set nodeValue(comment) { 26 | this._comment = comment; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Embed/framework/elements/div.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.div = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | 15 | this.style.flexDirection = "row"; 16 | this.style.justifyContent = "space-between"; 17 | this.style.alignItems = "center"; 18 | this.style.flexWrap = "nowrap"; 19 | } 20 | } 21 | 22 | ElementStyle.Inherit(Elements.div); 23 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/fieldset.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.fieldset = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | 15 | this.style.flexGrow = 1; 16 | this.style.flexDirection = "row"; 17 | this.style.justifyContent = "flex-start"; 18 | this.style.alignItems = "center"; 19 | } 20 | } 21 | 22 | ElementStyle.Inherit(Elements.fieldset); 23 | } 24 | -------------------------------------------------------------------------------- /src/Embed/framework/elements/grid/col.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const responsive = require("../../core/responsive.js"); 10 | 11 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 12 | 13 | Elements.col = class extends Elements.Element { 14 | constructor(a={}) { 15 | super(a); 16 | 17 | var size = a.size || 1; 18 | 19 | this.style.flexGrow = size; 20 | this.style.flexDirection = "column"; 21 | 22 | this.style.alignItems = a.align || "stretch"; 23 | this.style.justifyContent = a.valign || "flex-start"; 24 | 25 | this.responsive = { 26 | xs: a.xs || size, 27 | sm: a.sm || size, 28 | md: a.md || size, 29 | lg: a.lg || size, 30 | xl: a.xl || size 31 | }; 32 | } 33 | 34 | paint(ctx, w, h) { 35 | super.paint(ctx, w, h); 36 | 37 | var r = responsive(), size = this.responsive[r]; 38 | 39 | 40 | if (size == "hidden") { 41 | this.style.display = "none"; 42 | } else { 43 | this.style.display = "flex"; 44 | } 45 | } 46 | }; 47 | 48 | ElementStyle.Inherit(Elements.col); 49 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/grid/grid.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.grid = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | 15 | this.flexGrow = 1; 16 | this.style.flexDirection = "column"; 17 | this.style.justifyContent = "space-between"; 18 | this.style.alignItems = "stretch"; 19 | this.style.flexWrap = "nowrap"; 20 | } 21 | }; 22 | 23 | ElementStyle.Inherit(Elements.grid); 24 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/grid/row.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.row = class extends Elements.Element { 12 | constructor(a={}) { 13 | super(a); 14 | 15 | var size = a.size || 1; 16 | 17 | this.style.flexGrow = size; 18 | this.style.flexDirection = "row"; 19 | 20 | this.style.alignItems = a.valign || "stretch"; 21 | this.style.justifyContent = a.align || "flex-start"; 22 | 23 | this.responsive = { 24 | xs: a.xs || size, 25 | sm: a.sm || size, 26 | md: a.md || size, 27 | lg: a.lg || size, 28 | xl: a.xl || size 29 | }; 30 | } 31 | } 32 | 33 | ElementStyle.Inherit(Elements.row); 34 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/h1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.h1 = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | 15 | this.setDefaultStyle({ 16 | fontSize: 34, 17 | lineHeight: 34, 18 | width: "100%", 19 | textAlign: "left", 20 | minHeight: this.style.lineHeight || 20, 21 | marginTop: 6, 22 | marginBottom: 6 23 | }); 24 | 25 | /* FROZEN ------ */ 26 | } 27 | } 28 | 29 | ElementStyle.Inherit(Elements.h1); 30 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/label.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.label = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | 15 | this.style.flexGrow = 1; 16 | } 17 | 18 | onload() { 19 | let prev = this.prevSibling; 20 | 21 | if (!prev) return; 22 | 23 | let name = prev.tagName; 24 | 25 | if (name == 'radio' || name == 'checkbox') { 26 | 27 | if (prev.disabled) { 28 | this.style.color = "#c0c0c0"; 29 | } 30 | 31 | this.cursor = prev.cursor; 32 | this.on("click", () => { 33 | prev.emit("click", {}); 34 | }); 35 | 36 | } 37 | 38 | } 39 | } 40 | 41 | ElementStyle.Inherit(Elements.label); 42 | } 43 | -------------------------------------------------------------------------------- /src/Embed/framework/elements/layout.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.layout = class extends Elements.Element { 12 | constructor(attr) { 13 | super(attr); 14 | this.style.flexGrow = 1; 15 | this.style.flexDirection = "column"; 16 | } 17 | } 18 | 19 | ElementStyle.Inherit(Elements.layout); 20 | } 21 | -------------------------------------------------------------------------------- /src/Embed/framework/elements/li.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.li = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | 15 | this.style.flexDirection = "row"; 16 | this.style.justifyContent = "space-between"; 17 | this.style.alignItems = "center"; 18 | this.style.flexWrap = "nowrap"; 19 | this.coating = 1; 20 | } 21 | } 22 | 23 | ElementStyle.Inherit(Elements.li); 24 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/nodeoverlay.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.nodeoverlay = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | 15 | this.style.position = "absolute"; 16 | } 17 | 18 | paint(ctx, width, height) { 19 | ctx.fillStyle = "rgba(111, 108, 220, 0.6)"; 20 | ctx.strokeStyle = "rgba(111, 108, 220, 1.0)"; 21 | ctx.fillRect(0, 0, width, height); 22 | ctx.strokeRect(0.5, 0.5, width-1, height-1); 23 | } 24 | 25 | goto(elem) { 26 | let { aleft, atop, width, height } = elem.getDimensions(); 27 | 28 | setAnimation((elem) => { 29 | elem.left = aleft; 30 | elem.top = atop; 31 | elem.width = width; 32 | elem.height = height; 33 | }, 200, Easing.Exponential.Out, this); 34 | } 35 | } 36 | 37 | ElementStyle.Inherit(Elements.nodeoverlay); 38 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/nss.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const VM = require("VM"); 9 | const Elements = require("Elements"); 10 | const s_ShadowRoot = require("../../Symbols.js").ElementShadowRoot; 11 | 12 | class NSS { 13 | constructor(shadowRoot, nss, filename) { 14 | this.shadowRoot = shadowRoot; 15 | this.filename = filename; 16 | this.nss = nss; 17 | 18 | this.shadowRoot.addNSS(this); 19 | } 20 | 21 | eval() { 22 | return VM.run(`(function() { return {${this.nss}} })()`, { 23 | "scope": this.shadowRoot.getJSScope(), 24 | "filename": this.filename 25 | }) 26 | } 27 | } 28 | 29 | Elements.nss = class extends Elements.Node { 30 | constructor(attributes) { 31 | super(attributes); 32 | 33 | this.hide(); 34 | 35 | this.filename = "inline nss"; 36 | 37 | if (attributes.src) { 38 | this.data = Elements.Loader(attributes); 39 | this.filename = attributes.src; 40 | } 41 | } 42 | 43 | createTree(children) { 44 | let nss = this.data || children[0].text; 45 | this.nss = new NSS(this[s_ShadowRoot], nss, this.filename); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Embed/framework/elements/p.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.p = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | 15 | this.setDefaultStyle({ 16 | fontSize : 15, 17 | lineHeight : 20 18 | }); 19 | 20 | this.style.minHeight = this.style.lineHeight || 20; 21 | this.style.textAlign = "left"; 22 | this.style.flexWrap = "nowrap"; 23 | this.style.width = "100%"; 24 | this.style.marginTop = 6; 25 | this.style.marginBottom = 6; 26 | } 27 | } 28 | 29 | ElementStyle.Inherit(Elements.p); 30 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/script.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const VM = require("VM"); 9 | const Elements = require("Elements"); 10 | const s_ShadowRoot = require("../../Symbols.js").ElementShadowRoot; 11 | 12 | Elements.script = class extends Elements.Node { 13 | constructor(attributes) { 14 | super(attributes); 15 | this.hide(); 16 | if (attributes.src) { 17 | this.data = Elements.Loader(attributes); 18 | } 19 | } 20 | 21 | createTree(children) { 22 | let code = this.data; 23 | if (!code) { 24 | code = children[0].text; 25 | } 26 | VM.run(code, {"scope": this[s_ShadowRoot].getJSScope()}) 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Embed/framework/elements/section.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.section = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | } 15 | } 16 | 17 | ElementStyle.Inherit(Elements.section); 18 | } 19 | -------------------------------------------------------------------------------- /src/Embed/framework/elements/slot.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.slot = class extends Elements.Element { } 12 | ElementStyle.Inherit(Elements.slot); 13 | } 14 | -------------------------------------------------------------------------------- /src/Embed/framework/elements/span.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.span = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | } 15 | } 16 | 17 | ElementStyle.Inherit(Elements.span); 18 | } -------------------------------------------------------------------------------- /src/Embed/framework/elements/template.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const TemplateEngine = require("TemplateEngine"); 10 | 11 | Elements.template = class extends Elements.Node { 12 | constructor(attributes) { 13 | super(attributes); 14 | 15 | let engine = TemplateEngine.GetDefaultEngine(); 16 | 17 | if (attributes && attributes.type && 18 | !(engine = TemplateEngine.Get(attributes.type))) { 19 | console.warn(`Template compiler ${attributes.type} not found. Using default compiler.`); 20 | engine = TemplateEngine.GetDefaultEngine(); 21 | } 22 | 23 | if (attributes.src) { 24 | this.data = Elements.Loader(attributes); 25 | } 26 | 27 | this.engine = new engine(this, attributes); 28 | } 29 | 30 | createTree(children) { 31 | this.data = this.data || children[0].text; 32 | this.engine.compile(this.data); 33 | } 34 | 35 | compile(data) { 36 | return this.engine.compile(data); 37 | } 38 | 39 | render(scope) { 40 | return this.engine.render(scope); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Embed/framework/elements/view.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Nidium Inc. All rights reserved. 3 | * Use of this source code is governed by a MIT license 4 | * that can be found in the LICENSE file. 5 | */ 6 | 7 | { 8 | const Elements = require("Elements"); 9 | const { StyleContainer, ElementStyle } = require("ElementsStyles"); 10 | 11 | Elements.view = class extends Elements.Element { 12 | constructor(attributes) { 13 | super(attributes); 14 | this.style.position = "absolute"; 15 | this.style.left = 0; 16 | this.style.top = 0; 17 | this.style.right = 0; 18 | this.style.bottom = 0; 19 | } 20 | } 21 | 22 | ElementStyle.Inherit(Elements.view); 23 | } -------------------------------------------------------------------------------- /src/Embed/framework/fonts/Ranga-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/Ranga-Regular.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/default.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | document.loadFont({ 4 | name : "Ranga", 5 | file : "embed://framework/fonts/Ranga-Regular.ttf" 6 | }); 7 | 8 | document.loadFont({ 9 | name : "Roboto Regular", 10 | file : "embed://framework/fonts/roboto/Roboto-Regular.ttf" 11 | }); 12 | 13 | document.loadFont({ 14 | name : "Droid Sans", 15 | file : "embed://framework/fonts/droid-sans/DroidSans.ttf" 16 | }); -------------------------------------------------------------------------------- /src/Embed/framework/fonts/droid-sans/DroidSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/droid-sans/DroidSans-Bold.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/droid-sans/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/droid-sans/DroidSans.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/fontawesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/fontawesome.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/ionicons.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-Black.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-BlackItalic.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-Bold.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-BoldItalic.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-Italic.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-Light.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-LightItalic.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-Medium.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-MediumItalic.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-Regular.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-Thin.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/Roboto-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/Roboto-ThinItalic.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/RobotoCondensed-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/RobotoCondensed-Bold.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/RobotoCondensed-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/RobotoCondensed-BoldItalic.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/RobotoCondensed-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/RobotoCondensed-Italic.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/RobotoCondensed-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/RobotoCondensed-Light.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/RobotoCondensed-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/RobotoCondensed-LightItalic.ttf -------------------------------------------------------------------------------- /src/Embed/framework/fonts/roboto/RobotoCondensed-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nidium/Nidium/f514e57ce4941df57268f1407d8777cee31f5f14/src/Embed/framework/fonts/roboto/RobotoCondensed-Regular.ttf -------------------------------------------------------------------------------- /src/Embed/lib/TemplateEngine.js: -------------------------------------------------------------------------------- 1 | const g_Engines = {} 2 | const Elements = require("Elements"); 3 | const s_Node = Symbol("TemplateNode"); 4 | let g_DefaultEngine = null; 5 | 6 | class TemplateEngine { 7 | constructor(node, attributes) { 8 | if (!node || !(node instanceof Elements.template)) { 9 | throw new Error("TemplateEngine constructor called without an element or with an element that is not a