aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-10-31 21:18:37 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-10-31 21:18:37 +0100
commit0712c416259e4860ff1910c4a5bcd7b37da6b237 (patch)
tree605a1117b33c377ccb08d21b56778fc16a1e30ab
parentEverything but lib. (diff)
downloadcalp-0712c416259e4860ff1910c4a5bcd7b37da6b237.tar.gz
calp-0712c416259e4860ff1910c4a5bcd7b37da6b237.tar.xz
lib.
-rw-r--r--static/clock.ts2
-rw-r--r--static/globals.ts1
-rw-r--r--static/jcal.ts1
-rw-r--r--static/lib.ts48
-rw-r--r--static/script.ts1
-rw-r--r--static/tsconfig.json2
-rw-r--r--static/vevent.ts1
7 files changed, 35 insertions, 21 deletions
diff --git a/static/clock.ts b/static/clock.ts
index 27c3e4e1..9171b8a8 100644
--- a/static/clock.ts
+++ b/static/clock.ts
@@ -1,5 +1,7 @@
export { SmallcalCellHighlight, Timebar }
+import { makeElement, date_to_percent } from './lib'
+
class Clock {
update(now: Date) {
}
diff --git a/static/globals.ts b/static/globals.ts
index 0ca2e3de..9045d4a9 100644
--- a/static/globals.ts
+++ b/static/globals.ts
@@ -19,6 +19,7 @@ export {
import { close_popup, toggle_popup } from './popup'
import { VEvent, xml_to_vcal } from './vevent'
import { bind_popup_control } from './dragable'
+import { uid, parseDate, gensym, to_local, boolean, makeElement } from './lib'
"use strict";
diff --git a/static/jcal.ts b/static/jcal.ts
index 51a1130b..327a560d 100644
--- a/static/jcal.ts
+++ b/static/jcal.ts
@@ -1,5 +1,6 @@
export { jcal_to_xcal }
import { ical_type, JCalProperty, JCal } from './types'
+import { xcal, asList } from './lib'
function jcal_type_to_xcal(doc: Document, type: ical_type, value: any): Element {
let el = doc.createElementNS(xcal, type);
diff --git a/static/lib.ts b/static/lib.ts
index e3d99007..fe5ef1bd 100644
--- a/static/lib.ts
+++ b/static/lib.ts
@@ -1,34 +1,42 @@
+export {
+ makeElement, date_to_percent, uid,
+ parseDate, gensym, to_local, boolean,
+ xcal, asList, round_time
+}
'use strict';
/*
General procedures which in theory could be used anywhere.
*/
-interface Object {
- format: (fmt: string) => string
-}
+declare global {
+ interface Object {
+ format: (fmt: string) => string
+ }
-interface HTMLElement {
- _addEventListener: (name: string, proc: (e: Event) => void) => void
- listeners: Record<string, ((e: Event) => void)[]>
-}
+ interface HTMLElement {
+ _addEventListener: (name: string, proc: (e: Event) => void) => void
+ listeners: Record<string, ((e: Event) => void)[]>
+ }
-interface Date {
- dateonly: boolean
- utc: boolean
- type: 'date' | 'date-time'
-}
+ interface Date {
+ format: (fmt: string) => string
+ dateonly: boolean
+ utc: boolean
+ type: 'date' | 'date-time'
+ }
-interface DOMTokenList {
- find: (regex: string) => [number, string] | undefined
-}
+ interface DOMTokenList {
+ find: (regex: string) => [number, string] | undefined
+ }
-interface HTMLCollection {
- forEach: (proc: ((el: Element) => void)) => void
-}
+ interface HTMLCollection {
+ forEach: (proc: ((el: Element) => void)) => void
+ }
-interface HTMLCollectionOf<T> {
- forEach: (proc: ((el: T) => void)) => void
+ interface HTMLCollectionOf<T> {
+ forEach: (proc: ((el: T) => void)) => void
+ }
}
type uid = string
diff --git a/static/script.ts b/static/script.ts
index 7d98a28a..7762173e 100644
--- a/static/script.ts
+++ b/static/script.ts
@@ -3,6 +3,7 @@
import { close_all_popups } from './popup'
import { VEvent } from './vevent'
import { SmallcalCellHighlight, Timebar } from './clock'
+import { makeElement, parseDate, gensym, round_time } from './lib'
/*
calp specific stuff
diff --git a/static/tsconfig.json b/static/tsconfig.json
index 090e2b59..82359e01 100644
--- a/static/tsconfig.json
+++ b/static/tsconfig.json
@@ -8,7 +8,7 @@
"target": "es2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
/* Modules */
- "module": "none", /* Specify what module code is generated. */
+ "module": "CommonJS", /* Specify what module code is generated. */
/* JavaScript Support */
"allowJs": false, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
diff --git a/static/vevent.ts b/static/vevent.ts
index f25c5341..0fef9685 100644
--- a/static/vevent.ts
+++ b/static/vevent.ts
@@ -1,4 +1,5 @@
import { ical_type, valid_input_types, JCal } from './types'
+import { uid, parseDate } from './lib'
export { VEvent, xml_to_vcal }
"use strict";