Initial commit

This commit is contained in:
Piotr Dobrowolski 2021-04-14 17:26:22 +02:00
commit a149b40b8e
23 changed files with 4883 additions and 0 deletions

69
.enyoconfig Normal file
View File

@ -0,0 +1,69 @@
{
"title": "",
"libDir": "lib",
"paths": [],
"libraries": [
"enyo",
"moonstone",
"spotlight",
"layout",
"svg",
"enyo-ilib"
],
"sources": {
"enyo": "https://github.com/enyojs/enyo.git",
"moonstone": "https://github.com/enyojs/moonstone.git",
"spotlight": "https://github.com/enyojs/spotlight.git",
"layout": "https://github.com/enyojs/layout.git",
"svg": "https://github.com/enyojs/svg.git",
"enyo-ilib": "https://github.com/enyojs/enyo-ilib.git"
},
"targets": {
"enyo": "2.7.0",
"moonstone": "2.7.0",
"spotlight": "2.7.0",
"layout": "2.7.0",
"svg": "2.7.0",
"enyo-ilib": "2.7.0"
},
"production": false,
"devMode": true,
"cache": true,
"resetCache": false,
"trustCache": false,
"cacheFile": ".enyocache",
"clean": false,
"sourceMaps": true,
"externals": true,
"strict": false,
"skip": [],
"library": false,
"wip": false,
"outDir": "dist",
"outFile": "index.html",
"lessPlugins": [
{
"name": "resolution-independence",
"options": {
"baseSize": 24
}
}
],
"assetRoots": [],
"lessOnlyLess": false,
"minifyCss": false,
"inlineCss": true,
"outCssFile": "output.css",
"outJsFile": "output.js",
"inlineJs": true,
"templateIndex": "",
"watch": false,
"watchPaths": [],
"polling": false,
"pollingInterval": 100,
"headScripts": [],
"tailScripts": [],
"promisePolyfill": false,
"styleOnly": false,
"lessVars": []
}

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.enyocache
dist/
node_modules/

18
.gitmodules vendored Normal file
View File

@ -0,0 +1,18 @@
[submodule "lib/enyo"]
path = lib/enyo
url = https://github.com/enyojs/enyo.git
[submodule "lib/moonstone"]
path = lib/moonstone
url = https://github.com/enyojs/moonstone.git
[submodule "lib/spotlight"]
path = lib/spotlight
url = https://github.com/enyojs/spotlight.git
[submodule "lib/layout"]
path = lib/layout
url = https://github.com/enyojs/layout.git
[submodule "lib/svg"]
path = lib/svg
url = https://github.com/enyojs/svg.git
[submodule "lib/enyo-ilib"]
path = lib/enyo-ilib
url = https://github.com/enyojs/enyo-ilib.git

4
.jshintignore Normal file
View File

@ -0,0 +1,4 @@
dist
assets
lib
node_modules

27
.jshintrc Normal file
View File

@ -0,0 +1,27 @@
{
"globals": {
"global": false,
"require": false,
"request": false,
"exports": true,
"module": true,
"module.exports": true,
"JSON": false
},
"es3": true,
"evil": false,
"regexdash": true,
"browser": true,
"node": true,
"wsh": false,
"trailing": false,
"sub": true,
"eqnull": true,
"laxbreak": true,
"laxcomma": true,
"curly": false,
"indent": 4,
"newcap": true,
"undef": true,
"unused": "vars"
}

3
.npmignore Normal file
View File

@ -0,0 +1,3 @@
.enyocache
dist/
lib/

14
css/main.less Normal file
View File

@ -0,0 +1,14 @@
/*
App-specific LESS/CSS would go here, but to make your application easier to
maintain, you should try to minimize the use of custom CSS.
Additionally, you can override any moonstone variables in this file. You
can also control the theme and change it from dark to light if desired by
adding the assignment:
@moon-theme: 'light';
*/
.main-view {
}

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

13
index.js Normal file
View File

@ -0,0 +1,13 @@
/**
Instantiate your enyo/Application kind in this file. Note, application
rendering should be deferred until the DOM is ready by wrapping it in a
call to ready().
*/
var
ready = require('enyo/ready'),
App = require('./src/App');
ready(function () {
new App();
});

1
lib/enyo Submodule

@ -0,0 +1 @@
Subproject commit 514d966a1465e93aae0c3ba96ce64c570b161e53

1
lib/enyo-ilib Submodule

@ -0,0 +1 @@
Subproject commit 8c26cea5ea6eb0e393f00b96c8af0eac8cc0387a

1
lib/layout Submodule

@ -0,0 +1 @@
Subproject commit 77803c63b0858c86ceefdce922f67fce12abdd34

1
lib/moonstone Submodule

@ -0,0 +1 @@
Subproject commit 7348fbb47cac3757edc97ed513adebbd605eacf1

1
lib/spotlight Submodule

@ -0,0 +1 @@
Subproject commit 0589121de0810dfb3ad5d90ea59563ec3a303d4b

1
lib/svg Submodule

@ -0,0 +1 @@
Subproject commit 860ed9e6014820b1715b5d99817a0faa3683020a

4415
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

19
package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "newproject",
"version": "0.0.1",
"description": "An Enyo-based template to build web applications using HTML, CSS and JavaScript.",
"main": "index.js",
"moduleDir": "src",
"assets": [
"favicon.ico",
"assets/**/*.*",
"webosbrew-repository/**"
],
"styles": [
"css/*.less",
"css/*.css"
],
"devDependencies": {
"enyo-dev": "^1.0.0"
}
}

13
src/App.js Normal file
View File

@ -0,0 +1,13 @@
/**
Define your enyo/Application kind in this file.
*/
var
kind = require('enyo/kind'),
Application = require('enyo/Application'),
MainView = require('./views/MainView');
module.exports = kind({
kind: Application,
view: MainView
});

109
src/views/BrowserPanel.js Normal file
View File

@ -0,0 +1,109 @@
var
kind = require('enyo/kind'),
DetailsPanel = require('./DetailsPanel'),
Overlay = require('moonstone/Overlay'),
Item = require('moonstone/Item'),
IconButton = require('moonstone/IconButton'),
Scroller = require('moonstone/Scroller'),
MoonImage = require('moonstone/Image'),
EnyoImage = require('enyo/Image'),
Marquee = require('moonstone/Marquee'),
Panel = require('moonstone/Panel'),
Popup = require('moonstone/Popup'),
Spinner = require('moonstone/Spinner'),
DataGridList = require('moonstone/DataGridList'),
GridListImageItem = require('moonstone/GridListImageItem'), // FIXME: we use styles from that :/
AjaxSource = require('enyo/AjaxSource'),
Collection = require('enyo/Collection'),
SettingsPanel = require('./SettingsPanel.js');
var AppListItem = kind({
name: 'AppListItem',
kind: Item,
classes: 'moon-gridlist-imageitem horizontal-gridList-item horizontal-gridList-image-item', // moon-imageitem',
mixins: [Overlay.Support, Overlay.Selection],
components: [
{
kind: MoonImage,
name: 'img',
// placeholder: EnyoImage.placeholder,
style: 'width: 100px; height: 100px; float: left; padding-right: 20px; padding-top: 5px',
sizing: 'contain',
},
{name: 'caption', classes: 'caption', kind: Marquee.Text},
{name: 'subCaption', classes: 'sub-caption', kind: Marquee.Text},
],
published: {
caption: '',
subCaption: '',
},
bindings: [
{from: 'model.name', to: '$.caption.content'},
{from: 'model.id', to: '$.subCaption.content'},
{from: 'model.iconUri', to: '$.img.src'},
]
});
module.exports = kind({
name: 'BrowserPanel',
kind: Panel,
title: 'Homebrew Channel',
titleBelow: 'webosbrew.org',
// headerType: 'small',
headerComponents: [
{kind: IconButton, icon: 'rollbackward', ontap: 'refresh'},
{kind: IconButton, icon: 'gear', ontap: 'openSettings'},
],
components: [
{kind: Spinner, name: 'spinner', content: 'Loading...', center: true, middle: true},
{kind: Popup, name: 'errorPopup', content: 'An error occured while downloading repository.', modal: false, autoDismiss: true, allowBackKey: true},
{
name: 'appList', selection: false, fit: true, spacing: 20, minWidth: 500, minHeight: 120, kind: DataGridList, scrollerOptions: {kind: Scroller, vertical: 'scroll', horizontal: 'hidden', spotlightPagingControls: true}, components: [
{kind: AppListItem}
], ontap: 'itemSelected',
},
],
bindings: [
{from: 'apps', to: '$.appList.collection'},
{
from: 'apps.status', to: '$.spinner.showing', transform: function (value) {
return this.apps.isBusy() && !this.apps.isError();
}
},
{
from: 'apps.status', to: '$.errorPopup.showing', transform: function (value) {
return this.apps.isError();
}
},
],
create: function () {
this.inherited(arguments);
this.refresh();
},
refresh: function () {
console.info('refresh');
this.set('apps', new Collection({
source: new AjaxSource(),
url: '/webosbrew-repository/index.json',
}));
this.apps.fetch();
},
events: {
onRequestPushPanel: ''
},
itemSelected: function (sender, ev) {
if (ev.model) {
this.doRequestPushPanel({panel: {kind: DetailsPanel, model: ev.model}});
}
},
openSettings: function (sender, ev) {
this.doRequestPushPanel({
panel: {
kind: SettingsPanel,
}
});
},
});

15
src/views/DetailsPanel.js Normal file
View File

@ -0,0 +1,15 @@
var
kind = require('enyo/kind'),
Panel = require('moonstone/Panel');
module.exports = kind({
name: 'DetailsPanel',
kind: Panel,
title: '',
titleBelow: '',
headerType: 'medium',
bindings: [
{from: 'model.name', to: 'title'},
{from: 'model.id', to: 'titleBelow'},
],
});

44
src/views/MainView.js Normal file
View File

@ -0,0 +1,44 @@
var
kind = require('enyo/kind'),
Panels = require('moonstone/Panels'),
IconButton = require('moonstone/IconButton'),
BrowserPanel = require('./BrowserPanel.js');
module.exports = kind({
name: 'myapp.MainView',
classes: 'moon enyo-fit main-view',
components: [
{
kind: Panels,
pattern: 'activity',
hasCloseButton: false,
wrap: true,
popOnBack: true,
components: [
{
kind: BrowserPanel,
},
],
onTransitionFinish: 'transitionFinish',
}
],
handlers: {
onRequestPushPanel: 'requestPushPanel',
},
transitionFinish: function (evt, sender) {
document.title = this.$.panels.getActive().title;
},
/*
observers: [
// the path can be a single string or an array of strings
{method: 'panelChanged', path: ['$.panels.index']}
],
panelChanged: function (oldIndex, newIndex) {
console.info('PANEL CHANGED', oldIndex, newIndex);
// document.title = this.$.panels.getActive().title;
},
*/
requestPushPanel: function (sender, ev) {
this.$.panels.pushPanel(ev.panel);
},
});

View File

@ -0,0 +1,84 @@
var
kind = require('enyo/kind'),
Panel = require('moonstone/Panel'),
Scroller = require('moonstone/Scroller'),
Divider = require('moonstone/Divider'),
ToggleItem = require('moonstone/ToggleItem'),
Tooltip = require('moonstone/Tooltip'),
Group = require('enyo/Group'),
Popup = require('moonstone/Popup'),
TooltipDecorator = require('moonstone/TooltipDecorator'),
LabeledTextItem = require('moonstone/LabeledTextItem');
var magic = {t: 0, n: 0};
module.exports = kind({
name: 'SettingsPanel',
kind: Panel,
title: 'Settings',
headerType: 'medium',
components: [
{
kind: Scroller, fit: true, components: [
{
classes: 'moon-hspacing', components: [
{
components: [
{kind: Divider, content: 'Root configuration'},
{kind: ToggleItem, content: 'Telnet', checked: true, onchange: 'itemChanged'},
{kind: ToggleItem, content: 'SSH Server', onchange: 'itemChanged'},
{
kind: TooltipDecorator, components: [
{kind: ToggleItem, content: 'Disable metrics', onchange: 'itemChanged'},
{kind: Tooltip, content: 'This disables certain metrics reporting to TV manufacturer (crash logs, system logs)', position: 'below'}, // , position: 'right-below'}
], style: 'width: 100%',
},
{kind: Divider, content: 'System information'},
{
kind: LabeledTextItem,
label: 'webosbrew version',
text: '0.1.2.3',
ontap: 'versionTap',
},
{
kind: LabeledTextItem,
label: 'Root status',
text: 'working',
disabled: true,
},
],
classes: 'moon-6h',
style: 'vertical-align: top',
},
{
components: [
{kind: Divider, content: 'Repositories'},
{
kind: Group, onActivate: 'groupChanged', components: [
{kind: ToggleItem, content: 'Group Option 1'},
{kind: ToggleItem, content: 'Group Option 5'}
]
}
],
classes: 'moon-16h',
style: 'vertical-align: top',
}
]
}
]
},
{kind: Popup, name: 'errorPopup', content: 'An error occured while downloading repository.', allowHtml: true, modal: true, allowBackKey: true},
],
versionTap: function (sender, evt) {
var t = new Date().getTime();
if (t - magic.t > 5000) magic.n = 0;
magic.n += 1;
magic.t = t;
if (magic.n == 7) {
magic.n = 0;
this.$.errorPopup.set('content', '<img src="https://data4.cupsell.pl/upload/generator/247026/640x420/4465398_print_1.png?resize=max_sizes&key=55f9a22768eed085006592c1174c0235" />');
this.$.errorPopup.show();
}
},
});

View File

@ -0,0 +1,27 @@
[
{
"id": "com.moonlight",
"name": "Moonlight <i>TV</i>",
"iconUri": "https://raw.githubusercontent.com/mariotaku/moonlight-tv/main/deploy/webos/icon.png"
},
{
"id": "hbchannel",
"name": "Homebrew Channel",
"iconUri": "https://raw.githubusercontent.com/webosbrew/webos-homebrew-channel/main/frontend/icon160.png"
},
{
"id": "choclate-doom",
"name": "Choclate Doom",
"iconUri": "https://raw.githubusercontent.com/webosbrew/chocolate-doom/webos-tv/data/doom.png"
},
{
"id": "youtube.webos",
"name": "YouTube (adfree)",
"iconUri": "https://raw.githubusercontent.com/FriedChickenButt/youtube-webos/main/largeIcon.png"
},
{
"id": "youtube.webosaaaaaaaaaaaaaaaaaaaaa",
"name": "YouTube (adfree) longnaaaaaaaaaaaaaaameeeeeeeeeeeeeeeeeeeee",
"iconUri": "https://raw.githubusercontent.com/FriedChickenButt/youtube-webos/main/largeIcon.png"
}
]