Skip to content

Commit 1be64d5

Browse files
authored
Add files via upload
1 parent 93d9ae2 commit 1be64d5

16 files changed

Lines changed: 18018 additions & 0 deletions

File tree

@types/hyper.d.ts

Lines changed: 16299 additions & 0 deletions
Large diffs are not rendered by default.

dist/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
function default_1(api, config) {
4+
// This is our init function
5+
// Everything inside the default export runs right after the widget is recognized by hyperbar.
6+
// Here you can create new ipcEvents, create new windows and other main process related tasks
7+
// Returning something from this function is useless.
8+
}
9+
exports.default = default_1;

dist/render.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5+
}) : (function(o, m, k, k2) {
6+
if (k2 === undefined) k2 = k;
7+
o[k2] = m[k];
8+
}));
9+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10+
Object.defineProperty(o, "default", { enumerable: true, value: v });
11+
}) : function(o, v) {
12+
o["default"] = v;
13+
});
14+
var __importStar = (this && this.__importStar) || function (mod) {
15+
if (mod && mod.__esModule) return mod;
16+
var result = {};
17+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18+
__setModuleDefault(result, mod);
19+
return result;
20+
};
21+
var __importDefault = (this && this.__importDefault) || function (mod) {
22+
return (mod && mod.__esModule) ? mod : { "default": mod };
23+
};
24+
Object.defineProperty(exports, "__esModule", { value: true });
25+
exports.styles = void 0;
26+
const react_1 = __importStar(require("../../../modules/react"));
27+
const dayjs_1 = __importDefault(require("../modules/dayjs"));
28+
class StateComponent extends react_1.Component {
29+
constructor(props) {
30+
super(props);
31+
}
32+
startClock() {
33+
const timeFormat = this.props.userConfig.getValue('widgets', 'hyper_clock', 'text');
34+
const timeContainer = document.querySelector('.hyperclock.wrapper .time');
35+
timeContainer.textContent = (0, dayjs_1.default)().format(timeFormat);
36+
setTimeout(() => {
37+
this.startClock();
38+
}, 1000);
39+
}
40+
componentDidMount() {
41+
// decided to go with useEffect / didMount
42+
// don't want the entire react rendering after each sec
43+
this.startClock();
44+
}
45+
render() {
46+
const showCallendar = this.props.userConfig.getValue('widgets', 'hyper_clock', 'showcallendar');
47+
return (react_1.default.createElement("div", { className: "hyperclock wrapper" },
48+
react_1.default.createElement("p", { className: "time" })));
49+
}
50+
}
51+
// Hyper carries our api & other stuff inside `this` context.
52+
// React contructor doesn't pass the values, so we call it as a function
53+
// Check hyper-menu module for a stateless component example
54+
function default_1() {
55+
return react_1.default.createElement(StateComponent, Object.assign({ key: 'hyper-clock', userConfig: this.config, ipcRenderer: this.api.ipcRenderer }, this.props));
56+
}
57+
exports.default = default_1;
58+
exports.styles = ['styles/index.css'];

modules/dayjs/dayjs.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/dayjs/esm/constant.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export var SECONDS_A_MINUTE = 60;
2+
export var SECONDS_A_HOUR = SECONDS_A_MINUTE * 60;
3+
export var SECONDS_A_DAY = SECONDS_A_HOUR * 24;
4+
export var SECONDS_A_WEEK = SECONDS_A_DAY * 7;
5+
export var MILLISECONDS_A_SECOND = 1e3;
6+
export var MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;
7+
export var MILLISECONDS_A_HOUR = SECONDS_A_HOUR * MILLISECONDS_A_SECOND;
8+
export var MILLISECONDS_A_DAY = SECONDS_A_DAY * MILLISECONDS_A_SECOND;
9+
export var MILLISECONDS_A_WEEK = SECONDS_A_WEEK * MILLISECONDS_A_SECOND; // English locales
10+
11+
export var MS = 'millisecond';
12+
export var S = 'second';
13+
export var MIN = 'minute';
14+
export var H = 'hour';
15+
export var D = 'day';
16+
export var W = 'week';
17+
export var M = 'month';
18+
export var Q = 'quarter';
19+
export var Y = 'year';
20+
export var DATE = 'date';
21+
export var FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ssZ';
22+
export var INVALID_DATE_STRING = 'Invalid Date'; // regex
23+
24+
export var REGEX_PARSE = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/;
25+
export var REGEX_FORMAT = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g;

0 commit comments

Comments
 (0)