@davidsouther/jiffies 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assert.d.ts +23 -23
- package/build/assert.js +33 -33
- package/build/case.d.ts +1 -1
- package/build/case.js +5 -5
- package/build/components/button_bar.d.ts +8 -8
- package/build/components/button_bar.js +27 -27
- package/build/components/inline_edit.d.ts +12 -12
- package/build/components/inline_edit.js +48 -48
- package/build/components/logger.d.ts +6 -7
- package/build/components/logger.js +22 -22
- package/build/components/select.d.ts +13 -10
- package/build/components/select.js +3 -3
- package/build/components/test.d.ts +1 -1
- package/build/components/test.js +2 -2
- package/build/components/virtual_scroll.d.ts +40 -41
- package/build/components/virtual_scroll.js +94 -94
- package/build/components/virtual_scroll.test.d.ts +1 -1
- package/build/components/virtual_scroll.test.js +21 -21
- package/build/context.d.ts +15 -15
- package/build/context.js +43 -43
- package/build/context.test.d.ts +1 -1
- package/build/context.test.js +46 -46
- package/build/debounce.d.ts +1 -1
- package/build/debounce.js +7 -7
- package/build/display.d.ts +5 -5
- package/build/display.js +11 -11
- package/build/dom/css/border.d.ts +11 -11
- package/build/dom/css/border.js +27 -27
- package/build/dom/css/constants.d.ts +31 -31
- package/build/dom/css/constants.js +28 -28
- package/build/dom/css/core.d.ts +5 -5
- package/build/dom/css/core.js +24 -24
- package/build/dom/css/fstyle.d.ts +5 -5
- package/build/dom/css/fstyle.js +32 -32
- package/build/dom/css/sizing.d.ts +5 -5
- package/build/dom/css/sizing.js +10 -10
- package/build/dom/dom.d.ts +26 -27
- package/build/dom/dom.js +95 -95
- package/build/dom/fc.d.ts +14 -14
- package/build/dom/fc.js +36 -35
- package/build/dom/fc.test.d.ts +1 -1
- package/build/dom/fc.test.js +21 -21
- package/build/dom/form/form.app.d.ts +1 -1
- package/build/dom/form/form.app.js +23 -23
- package/build/dom/form/form.d.ts +26 -26
- package/build/dom/form/form.js +34 -34
- package/build/dom/form/form.test.js +1 -1
- package/build/dom/html.d.ts +113 -117
- package/build/dom/html.js +114 -114
- package/build/dom/html.test.d.ts +1 -1
- package/build/dom/html.test.js +58 -58
- package/build/dom/provide.d.ts +3 -3
- package/build/dom/provide.js +7 -7
- package/build/dom/router/link.d.ts +6 -6
- package/build/dom/router/link.js +3 -3
- package/build/dom/router/router.d.ts +12 -12
- package/build/dom/router/router.js +49 -49
- package/build/dom/svg.d.ts +64 -64
- package/build/dom/svg.js +65 -65
- package/build/dom/test.d.ts +1 -1
- package/build/dom/test.js +2 -2
- package/build/dom/types/css.d.ts +6612 -6612
- package/build/dom/types/css.js +23 -23
- package/build/dom/types/dom.js +1 -1
- package/build/dom/types/html.d.ts +616 -616
- package/build/dom/types/html.js +1 -1
- package/build/dom/xml.d.ts +1 -1
- package/build/dom/xml.js +4 -5
- package/build/equal.d.ts +5 -5
- package/build/equal.js +37 -37
- package/build/equal.test.d.ts +1 -1
- package/build/equal.test.js +20 -20
- package/build/flags.d.ts +7 -7
- package/build/flags.js +48 -48
- package/build/flags.test.d.ts +1 -1
- package/build/flags.test.js +35 -35
- package/build/fs.d.ts +48 -48
- package/build/fs.js +144 -144
- package/build/fs.test.d.ts +1 -1
- package/build/fs.test.js +43 -43
- package/build/generator.d.ts +1 -1
- package/build/generator.js +10 -10
- package/build/generator.test.d.ts +1 -1
- package/build/generator.test.js +24 -24
- package/build/is_browser.d.ts +1 -1
- package/build/is_browser.js +1 -1
- package/build/loader.d.mts +22 -22
- package/build/loader.mjs +35 -35
- package/build/lock.d.ts +1 -1
- package/build/lock.js +23 -23
- package/build/lock.test.d.ts +1 -1
- package/build/lock.test.js +16 -16
- package/build/log.d.ts +26 -26
- package/build/log.js +46 -46
- package/build/observable/observable.d.ts +83 -0
- package/build/observable/observable.js +148 -0
- package/build/observable/observable.test.d.ts +1 -0
- package/build/observable/observable.test.js +21 -0
- package/build/range.d.ts +1 -1
- package/build/range.js +7 -7
- package/build/result.d.ts +31 -31
- package/build/result.js +65 -65
- package/build/result.test.d.ts +1 -1
- package/build/result.test.js +71 -71
- package/build/safe.d.ts +1 -1
- package/build/safe.js +10 -10
- package/build/scope/describe.d.ts +18 -14
- package/build/scope/describe.js +61 -52
- package/build/scope/display/console.d.ts +2 -2
- package/build/scope/display/console.js +21 -21
- package/build/scope/display/dom.d.ts +3 -3
- package/build/scope/display/dom.js +26 -26
- package/build/scope/display/junit.d.ts +2 -2
- package/build/scope/display/junit.js +17 -17
- package/build/scope/execute.d.ts +12 -12
- package/build/scope/execute.js +85 -85
- package/build/scope/expect.d.ts +23 -23
- package/build/scope/expect.js +108 -108
- package/build/scope/fix.d.ts +4 -4
- package/build/scope/fix.js +22 -22
- package/build/scope/index.d.ts +3 -3
- package/build/scope/index.js +3 -3
- package/build/scope/scope.d.ts +17 -17
- package/build/scope/scope.js +1 -1
- package/build/server/http/apps.d.ts +5 -5
- package/build/server/http/apps.js +23 -23
- package/build/server/http/css.d.ts +5 -5
- package/build/server/http/css.js +50 -47
- package/build/server/http/index.d.ts +21 -21
- package/build/server/http/index.js +73 -73
- package/build/server/http/response.d.ts +4 -4
- package/build/server/http/response.js +40 -40
- package/build/server/http/sitemap.d.ts +2 -2
- package/build/server/http/sitemap.js +42 -42
- package/build/server/http/static.d.ts +2 -2
- package/build/server/http/static.js +21 -21
- package/build/server/http/typescript.d.ts +5 -5
- package/build/server/http/typescript.js +40 -40
- package/build/server/main.d.ts +2 -2
- package/build/server/main.js +9 -9
- package/build/test.d.mts +2 -2
- package/build/test.mjs +23 -23
- package/build/test_all.d.ts +7 -7
- package/build/test_all.js +18 -18
- package/build/transpile.d.mts +3 -3
- package/build/transpile.mjs +18 -18
- package/package.json +3 -3
- package/src/components/logger.ts +2 -3
- package/src/components/virtual_scroll.test.ts +4 -4
- package/src/components/virtual_scroll.ts +8 -8
- package/src/diff.test.ts +48 -0
- package/src/diff.ts +84 -0
- package/src/dom/dom.ts +73 -61
- package/src/dom/fc.ts +10 -9
- package/src/dom/html.test.ts +5 -5
- package/src/dom/html.ts +7 -10
- package/src/dom/observable.test.ts +43 -0
- package/src/dom/observable.ts +11 -0
- package/src/dom/router/router.ts +4 -4
- package/src/dom/test.ts +5 -1
- package/src/dom/xml.ts +1 -2
- package/src/index.html +6 -3
- package/src/observable/_notes +21 -8
- package/src/observable/event.ts +93 -0
- package/src/observable/observable.test.ts +73 -0
- package/src/observable/observable.ts +403 -0
- package/src/scope/describe.ts +14 -1
- package/src/scope/display/dom.ts +2 -2
- package/src/scope/execute.ts +2 -5
- package/src/server/http/css.ts +3 -1
- package/src/test_all.ts +10 -8
- package/src/observable/observable._js +0 -175
package/build/dom/html.js
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
import { up } from "./dom.js";
|
|
2
|
-
const makeHTMLElement = (name) => (attrs, ...children) => up(document.createElement(name), attrs, ...children);
|
|
3
|
-
export const a = makeHTMLElement("a");
|
|
4
|
-
export const abbr = makeHTMLElement("abbr");
|
|
5
|
-
export const address = makeHTMLElement("address");
|
|
6
|
-
export const area = makeHTMLElement("area");
|
|
7
|
-
export const article = makeHTMLElement("article");
|
|
8
|
-
export const aside = makeHTMLElement("aside");
|
|
9
|
-
export const audio = makeHTMLElement("audio");
|
|
10
|
-
export const b = makeHTMLElement("b");
|
|
11
|
-
export const base = makeHTMLElement("base");
|
|
12
|
-
export const bdi = makeHTMLElement("bdi");
|
|
13
|
-
export const bdo = makeHTMLElement("bdo");
|
|
14
|
-
export const blockquote = makeHTMLElement("blockquote");
|
|
15
|
-
export const body = makeHTMLElement("body");
|
|
16
|
-
export const br = makeHTMLElement("br");
|
|
17
|
-
export const button = makeHTMLElement("button");
|
|
18
|
-
export const canvas = makeHTMLElement("canvas");
|
|
19
|
-
export const caption = makeHTMLElement("caption");
|
|
20
|
-
export const cite = makeHTMLElement("cite");
|
|
21
|
-
export const code = makeHTMLElement("code");
|
|
22
|
-
export const col = makeHTMLElement("col");
|
|
23
|
-
export const colgroup = makeHTMLElement("colgroup");
|
|
24
|
-
export const data = makeHTMLElement("data");
|
|
25
|
-
export const datalist = makeHTMLElement("datalist");
|
|
26
|
-
export const dd = makeHTMLElement("dd");
|
|
27
|
-
export const del = makeHTMLElement("del");
|
|
28
|
-
export const details = makeHTMLElement("details");
|
|
29
|
-
export const dfn = makeHTMLElement("dfn");
|
|
30
|
-
export const dialog = makeHTMLElement("dialog");
|
|
31
|
-
export const div = makeHTMLElement("div");
|
|
32
|
-
export const dl = makeHTMLElement("dl");
|
|
33
|
-
export const dt = makeHTMLElement("dt");
|
|
34
|
-
export const em = makeHTMLElement("em");
|
|
35
|
-
export const embed = makeHTMLElement("embed");
|
|
36
|
-
export const fieldset = makeHTMLElement("fieldset");
|
|
37
|
-
export const figcaption = makeHTMLElement("figcaption");
|
|
38
|
-
export const figure = makeHTMLElement("figure");
|
|
39
|
-
export const footer = makeHTMLElement("footer");
|
|
40
|
-
export const form = makeHTMLElement("form");
|
|
41
|
-
export const h1 = makeHTMLElement("h1");
|
|
42
|
-
export const h2 = makeHTMLElement("h2");
|
|
43
|
-
export const h3 = makeHTMLElement("h3");
|
|
44
|
-
export const h4 = makeHTMLElement("h4");
|
|
45
|
-
export const h5 = makeHTMLElement("h5");
|
|
46
|
-
export const h6 = makeHTMLElement("h6");
|
|
47
|
-
export const head = makeHTMLElement("head");
|
|
48
|
-
export const header = makeHTMLElement("header");
|
|
49
|
-
export const hgroup = makeHTMLElement("hgroup");
|
|
50
|
-
export const hr = makeHTMLElement("hr");
|
|
51
|
-
export const html = makeHTMLElement("html");
|
|
52
|
-
export const i = makeHTMLElement("i");
|
|
53
|
-
export const iframe = makeHTMLElement("iframe");
|
|
54
|
-
export const img = makeHTMLElement("img");
|
|
55
|
-
export const input = makeHTMLElement("input");
|
|
56
|
-
export const ins = makeHTMLElement("ins");
|
|
57
|
-
export const kbd = makeHTMLElement("kbd");
|
|
58
|
-
export const label = makeHTMLElement("label");
|
|
59
|
-
export const legend = makeHTMLElement("legend");
|
|
60
|
-
export const li = makeHTMLElement("li");
|
|
61
|
-
export const link = makeHTMLElement("link");
|
|
62
|
-
export const main = makeHTMLElement("main");
|
|
63
|
-
export const map = makeHTMLElement("map");
|
|
64
|
-
export const mark = makeHTMLElement("mark");
|
|
65
|
-
export const menu = makeHTMLElement("menu");
|
|
66
|
-
export const meta = makeHTMLElement("meta");
|
|
67
|
-
export const meter = makeHTMLElement("meter");
|
|
68
|
-
export const nav = makeHTMLElement("nav");
|
|
69
|
-
export const noscript = makeHTMLElement("noscript");
|
|
70
|
-
export const object = makeHTMLElement("object");
|
|
71
|
-
export const ol = makeHTMLElement("ol");
|
|
72
|
-
export const optgroup = makeHTMLElement("optgroup");
|
|
73
|
-
export const option = makeHTMLElement("option");
|
|
74
|
-
export const output = makeHTMLElement("output");
|
|
75
|
-
export const p = makeHTMLElement("p");
|
|
76
|
-
export const param = makeHTMLElement("param");
|
|
77
|
-
export const picture = makeHTMLElement("picture");
|
|
78
|
-
export const pre = makeHTMLElement("pre");
|
|
79
|
-
export const progress = makeHTMLElement("progress");
|
|
80
|
-
export const q = makeHTMLElement("q");
|
|
81
|
-
export const rp = makeHTMLElement("rp");
|
|
82
|
-
export const rt = makeHTMLElement("rt");
|
|
83
|
-
export const ruby = makeHTMLElement("ruby");
|
|
84
|
-
export const s = makeHTMLElement("s");
|
|
85
|
-
export const samp = makeHTMLElement("samp");
|
|
86
|
-
export const script = makeHTMLElement("script");
|
|
87
|
-
export const section = makeHTMLElement("section");
|
|
88
|
-
export const select = makeHTMLElement("select");
|
|
89
|
-
export const slot = makeHTMLElement("slot");
|
|
90
|
-
export const small = makeHTMLElement("small");
|
|
91
|
-
export const source = makeHTMLElement("source");
|
|
92
|
-
export const span = makeHTMLElement("span");
|
|
93
|
-
export const strong = makeHTMLElement("strong");
|
|
94
|
-
export const style = makeHTMLElement("style");
|
|
95
|
-
export const sub = makeHTMLElement("sub");
|
|
96
|
-
export const summary = makeHTMLElement("summary");
|
|
97
|
-
export const sup = makeHTMLElement("sup");
|
|
98
|
-
export const table = makeHTMLElement("table");
|
|
99
|
-
export const tbody = makeHTMLElement("tbody");
|
|
100
|
-
export const td = makeHTMLElement("td");
|
|
101
|
-
export const template = makeHTMLElement("template");
|
|
102
|
-
export const textarea = makeHTMLElement("textarea");
|
|
103
|
-
export const tfoot = makeHTMLElement("tfoot");
|
|
104
|
-
export const th = makeHTMLElement("th");
|
|
105
|
-
export const thead = makeHTMLElement("thead");
|
|
106
|
-
export const time = makeHTMLElement("time");
|
|
107
|
-
export const title = makeHTMLElement("title");
|
|
108
|
-
export const tr = makeHTMLElement("tr");
|
|
109
|
-
export const track = makeHTMLElement("track");
|
|
110
|
-
export const u = makeHTMLElement("u");
|
|
111
|
-
export const ul = makeHTMLElement("ul");
|
|
112
|
-
export const htmlvar = makeHTMLElement("var"); // var is reserved, export as variable
|
|
113
|
-
export const video = makeHTMLElement("video");
|
|
114
|
-
export const wbr = makeHTMLElement("wbr");
|
|
1
|
+
import { up } from "./dom.js";
|
|
2
|
+
const makeHTMLElement = (name) => (attrs, ...children) => up(document.createElement(name), attrs, ...children);
|
|
3
|
+
export const a = makeHTMLElement("a");
|
|
4
|
+
export const abbr = makeHTMLElement("abbr");
|
|
5
|
+
export const address = makeHTMLElement("address");
|
|
6
|
+
export const area = makeHTMLElement("area");
|
|
7
|
+
export const article = makeHTMLElement("article");
|
|
8
|
+
export const aside = makeHTMLElement("aside");
|
|
9
|
+
export const audio = makeHTMLElement("audio");
|
|
10
|
+
export const b = makeHTMLElement("b");
|
|
11
|
+
export const base = makeHTMLElement("base");
|
|
12
|
+
export const bdi = makeHTMLElement("bdi");
|
|
13
|
+
export const bdo = makeHTMLElement("bdo");
|
|
14
|
+
export const blockquote = makeHTMLElement("blockquote");
|
|
15
|
+
export const body = makeHTMLElement("body");
|
|
16
|
+
export const br = makeHTMLElement("br");
|
|
17
|
+
export const button = makeHTMLElement("button");
|
|
18
|
+
export const canvas = makeHTMLElement("canvas");
|
|
19
|
+
export const caption = makeHTMLElement("caption");
|
|
20
|
+
export const cite = makeHTMLElement("cite");
|
|
21
|
+
export const code = makeHTMLElement("code");
|
|
22
|
+
export const col = makeHTMLElement("col");
|
|
23
|
+
export const colgroup = makeHTMLElement("colgroup");
|
|
24
|
+
export const data = makeHTMLElement("data");
|
|
25
|
+
export const datalist = makeHTMLElement("datalist");
|
|
26
|
+
export const dd = makeHTMLElement("dd");
|
|
27
|
+
export const del = makeHTMLElement("del");
|
|
28
|
+
export const details = makeHTMLElement("details");
|
|
29
|
+
export const dfn = makeHTMLElement("dfn");
|
|
30
|
+
export const dialog = makeHTMLElement("dialog");
|
|
31
|
+
export const div = makeHTMLElement("div");
|
|
32
|
+
export const dl = makeHTMLElement("dl");
|
|
33
|
+
export const dt = makeHTMLElement("dt");
|
|
34
|
+
export const em = makeHTMLElement("em");
|
|
35
|
+
export const embed = makeHTMLElement("embed");
|
|
36
|
+
export const fieldset = makeHTMLElement("fieldset");
|
|
37
|
+
export const figcaption = makeHTMLElement("figcaption");
|
|
38
|
+
export const figure = makeHTMLElement("figure");
|
|
39
|
+
export const footer = makeHTMLElement("footer");
|
|
40
|
+
export const form = makeHTMLElement("form");
|
|
41
|
+
export const h1 = makeHTMLElement("h1");
|
|
42
|
+
export const h2 = makeHTMLElement("h2");
|
|
43
|
+
export const h3 = makeHTMLElement("h3");
|
|
44
|
+
export const h4 = makeHTMLElement("h4");
|
|
45
|
+
export const h5 = makeHTMLElement("h5");
|
|
46
|
+
export const h6 = makeHTMLElement("h6");
|
|
47
|
+
export const head = makeHTMLElement("head");
|
|
48
|
+
export const header = makeHTMLElement("header");
|
|
49
|
+
export const hgroup = makeHTMLElement("hgroup");
|
|
50
|
+
export const hr = makeHTMLElement("hr");
|
|
51
|
+
export const html = makeHTMLElement("html");
|
|
52
|
+
export const i = makeHTMLElement("i");
|
|
53
|
+
export const iframe = makeHTMLElement("iframe");
|
|
54
|
+
export const img = makeHTMLElement("img");
|
|
55
|
+
export const input = makeHTMLElement("input");
|
|
56
|
+
export const ins = makeHTMLElement("ins");
|
|
57
|
+
export const kbd = makeHTMLElement("kbd");
|
|
58
|
+
export const label = makeHTMLElement("label");
|
|
59
|
+
export const legend = makeHTMLElement("legend");
|
|
60
|
+
export const li = makeHTMLElement("li");
|
|
61
|
+
export const link = makeHTMLElement("link");
|
|
62
|
+
export const main = makeHTMLElement("main");
|
|
63
|
+
export const map = makeHTMLElement("map");
|
|
64
|
+
export const mark = makeHTMLElement("mark");
|
|
65
|
+
export const menu = makeHTMLElement("menu");
|
|
66
|
+
export const meta = makeHTMLElement("meta");
|
|
67
|
+
export const meter = makeHTMLElement("meter");
|
|
68
|
+
export const nav = makeHTMLElement("nav");
|
|
69
|
+
export const noscript = makeHTMLElement("noscript");
|
|
70
|
+
export const object = makeHTMLElement("object");
|
|
71
|
+
export const ol = makeHTMLElement("ol");
|
|
72
|
+
export const optgroup = makeHTMLElement("optgroup");
|
|
73
|
+
export const option = makeHTMLElement("option");
|
|
74
|
+
export const output = makeHTMLElement("output");
|
|
75
|
+
export const p = makeHTMLElement("p");
|
|
76
|
+
export const param = makeHTMLElement("param");
|
|
77
|
+
export const picture = makeHTMLElement("picture");
|
|
78
|
+
export const pre = makeHTMLElement("pre");
|
|
79
|
+
export const progress = makeHTMLElement("progress");
|
|
80
|
+
export const q = makeHTMLElement("q");
|
|
81
|
+
export const rp = makeHTMLElement("rp");
|
|
82
|
+
export const rt = makeHTMLElement("rt");
|
|
83
|
+
export const ruby = makeHTMLElement("ruby");
|
|
84
|
+
export const s = makeHTMLElement("s");
|
|
85
|
+
export const samp = makeHTMLElement("samp");
|
|
86
|
+
export const script = makeHTMLElement("script");
|
|
87
|
+
export const section = makeHTMLElement("section");
|
|
88
|
+
export const select = makeHTMLElement("select");
|
|
89
|
+
export const slot = makeHTMLElement("slot");
|
|
90
|
+
export const small = makeHTMLElement("small");
|
|
91
|
+
export const source = makeHTMLElement("source");
|
|
92
|
+
export const span = makeHTMLElement("span");
|
|
93
|
+
export const strong = makeHTMLElement("strong");
|
|
94
|
+
export const style = makeHTMLElement("style");
|
|
95
|
+
export const sub = makeHTMLElement("sub");
|
|
96
|
+
export const summary = makeHTMLElement("summary");
|
|
97
|
+
export const sup = makeHTMLElement("sup");
|
|
98
|
+
export const table = makeHTMLElement("table");
|
|
99
|
+
export const tbody = makeHTMLElement("tbody");
|
|
100
|
+
export const td = makeHTMLElement("td");
|
|
101
|
+
export const template = makeHTMLElement("template");
|
|
102
|
+
export const textarea = makeHTMLElement("textarea");
|
|
103
|
+
export const tfoot = makeHTMLElement("tfoot");
|
|
104
|
+
export const th = makeHTMLElement("th");
|
|
105
|
+
export const thead = makeHTMLElement("thead");
|
|
106
|
+
export const time = makeHTMLElement("time");
|
|
107
|
+
export const title = makeHTMLElement("title");
|
|
108
|
+
export const tr = makeHTMLElement("tr");
|
|
109
|
+
export const track = makeHTMLElement("track");
|
|
110
|
+
export const u = makeHTMLElement("u");
|
|
111
|
+
export const ul = makeHTMLElement("ul");
|
|
112
|
+
export const htmlvar = makeHTMLElement("var"); // var is reserved, export as variable
|
|
113
|
+
export const video = makeHTMLElement("video");
|
|
114
|
+
export const wbr = makeHTMLElement("wbr");
|
package/build/dom/html.test.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/build/dom/html.test.js
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { describe, it } from "../scope/describe.js";
|
|
2
|
-
import { expect } from "../scope/expect.js";
|
|
3
|
-
import { table, tbody, td, th, thead, tr, button } from "./html.js";
|
|
4
|
-
describe("html", () => {
|
|
5
|
-
it("creates HTML Elements", () => {
|
|
6
|
-
let tableBody;
|
|
7
|
-
const myTable = table(thead(tr(th("Col A"), th("Col B"))), (tableBody = tbody()));
|
|
8
|
-
for (let x = 1; x <= 3; x++) {
|
|
9
|
-
tableBody.appendChild(tr(td(`${x}`), td(`${x * 2}`)));
|
|
10
|
-
}
|
|
11
|
-
expect(myTable.textContent).toEqual("Col ACol B122436");
|
|
12
|
-
});
|
|
13
|
-
it("attaches event handlers", () => {
|
|
14
|
-
let clicked = false;
|
|
15
|
-
const btn = button({
|
|
16
|
-
events: {
|
|
17
|
-
click: () => {
|
|
18
|
-
clicked = true;
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
btn.dispatchEvent(new Event("click"));
|
|
23
|
-
expect(clicked).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it("removes event handlers", () => {
|
|
26
|
-
let clicked = 0;
|
|
27
|
-
const btn = button({
|
|
28
|
-
events: {
|
|
29
|
-
click: () => {
|
|
30
|
-
clicked += 1;
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
btn.dispatchEvent(new Event("click"));
|
|
35
|
-
expect(clicked).toBe(1);
|
|
36
|
-
btn.update({ events: { click: undefined } });
|
|
37
|
-
btn.dispatchEvent(new Event("click"));
|
|
38
|
-
expect(clicked).toBe(1);
|
|
39
|
-
});
|
|
40
|
-
it("sets style properties", () => {
|
|
41
|
-
const btn = button({
|
|
42
|
-
style: { flexDirection: "column" },
|
|
43
|
-
});
|
|
44
|
-
expect(btn.style.flexDirection).toBe("column");
|
|
45
|
-
});
|
|
46
|
-
it("sets style, attributes, and events together", () => {
|
|
47
|
-
let clicked = false;
|
|
48
|
-
const btn = button({
|
|
49
|
-
class: "test-class",
|
|
50
|
-
style: { flexDirection: "column" },
|
|
51
|
-
events: { click: () => (clicked = true) },
|
|
52
|
-
});
|
|
53
|
-
btn.dispatchEvent(new Event("click"));
|
|
54
|
-
expect(btn.classList.contains("test-class")).toBe(true);
|
|
55
|
-
expect(btn.style.flexDirection).toBe("column");
|
|
56
|
-
expect(clicked).toBe(true);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
1
|
+
import { describe, it } from "../scope/describe.js";
|
|
2
|
+
import { expect } from "../scope/expect.js";
|
|
3
|
+
import { table, tbody, td, th, thead, tr, button } from "./html.js";
|
|
4
|
+
describe("html", () => {
|
|
5
|
+
it("creates HTML Elements", () => {
|
|
6
|
+
let tableBody;
|
|
7
|
+
const myTable = table(thead(tr(th("Col A"), th("Col B"))), (tableBody = tbody()));
|
|
8
|
+
for (let x = 1; x <= 3; x++) {
|
|
9
|
+
tableBody.appendChild(tr(td(`${x}`), td(`${x * 2}`)));
|
|
10
|
+
}
|
|
11
|
+
expect(myTable.textContent).toEqual("Col ACol B122436");
|
|
12
|
+
});
|
|
13
|
+
it("attaches event handlers", () => {
|
|
14
|
+
let clicked = false;
|
|
15
|
+
const btn = button({
|
|
16
|
+
events: {
|
|
17
|
+
click: () => {
|
|
18
|
+
clicked = true;
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
btn.dispatchEvent(new Event("click"));
|
|
23
|
+
expect(clicked).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
it("removes event handlers", () => {
|
|
26
|
+
let clicked = 0;
|
|
27
|
+
const btn = button({
|
|
28
|
+
events: {
|
|
29
|
+
click: () => {
|
|
30
|
+
clicked += 1;
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
btn.dispatchEvent(new Event("click"));
|
|
35
|
+
expect(clicked).toBe(1);
|
|
36
|
+
btn.update({ events: { click: undefined } });
|
|
37
|
+
btn.dispatchEvent(new Event("click"));
|
|
38
|
+
expect(clicked).toBe(1);
|
|
39
|
+
});
|
|
40
|
+
it("sets style properties", () => {
|
|
41
|
+
const btn = button({
|
|
42
|
+
style: { flexDirection: "column" },
|
|
43
|
+
});
|
|
44
|
+
expect(btn.style.flexDirection).toBe("column");
|
|
45
|
+
});
|
|
46
|
+
it("sets style, attributes, and events together", () => {
|
|
47
|
+
let clicked = false;
|
|
48
|
+
const btn = button({
|
|
49
|
+
class: "test-class",
|
|
50
|
+
style: { flexDirection: "column" },
|
|
51
|
+
events: { click: () => (clicked = true) },
|
|
52
|
+
});
|
|
53
|
+
btn.dispatchEvent(new Event("click"));
|
|
54
|
+
expect(btn.classList.contains("test-class")).toBe(true);
|
|
55
|
+
expect(btn.style.flexDirection).toBe("column");
|
|
56
|
+
expect(clicked).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
});
|
package/build/dom/provide.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Option } from "../result.js";
|
|
2
|
-
export declare function provide(items: Record<string, unknown>): void;
|
|
3
|
-
export declare function retrieve<T>(key: string): Option<T>;
|
|
1
|
+
import { Option } from "../result.js";
|
|
2
|
+
export declare function provide(items: Record<string, unknown>): void;
|
|
3
|
+
export declare function retrieve<T>(key: string): Option<T>;
|
package/build/dom/provide.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
let registry = {};
|
|
2
|
-
export function provide(items) {
|
|
3
|
-
registry = { ...registry, ...items };
|
|
4
|
-
}
|
|
5
|
-
export function retrieve(key) {
|
|
6
|
-
return registry[key];
|
|
7
|
-
}
|
|
1
|
+
let registry = {};
|
|
2
|
+
export function provide(items) {
|
|
3
|
+
registry = { ...registry, ...items };
|
|
4
|
+
}
|
|
5
|
+
export function retrieve(key) {
|
|
6
|
+
return registry[key];
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface Link {
|
|
2
|
-
href: string;
|
|
3
|
-
link: string;
|
|
4
|
-
target: () => Node;
|
|
5
|
-
}
|
|
6
|
-
export declare const link: ({ href, link }: Link) =>
|
|
1
|
+
export interface Link {
|
|
2
|
+
href: string;
|
|
3
|
+
link: string;
|
|
4
|
+
target: () => Node;
|
|
5
|
+
}
|
|
6
|
+
export declare const link: ({ href, link }: Link) => HTMLAnchorElement;
|
package/build/dom/router/link.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a } from "../html.js";
|
|
2
|
-
import { Router } from "./router.js";
|
|
3
|
-
export const link = ({ href, link }) => a({ href: Router.href(href), events: { click: Router.navigate(href) } }, link);
|
|
1
|
+
import { a } from "../html.js";
|
|
2
|
+
import { Router } from "./router.js";
|
|
3
|
+
export const link = ({ href, link }) => a({ href: Router.href(href), events: { click: Router.navigate(href) } }, link);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DOMElement
|
|
2
|
-
import { Link } from "./link";
|
|
3
|
-
export interface Router {
|
|
4
|
-
current?: string;
|
|
5
|
-
navigate: (url: string) => (event: Event) => void;
|
|
6
|
-
(target:
|
|
7
|
-
}
|
|
8
|
-
export declare const Router: {
|
|
9
|
-
for(links: Link[], index: string, setGlobalRouter?: boolean): Router;
|
|
10
|
-
href(link: string): string;
|
|
11
|
-
navigate(href: string): (event: Event) => void;
|
|
12
|
-
};
|
|
1
|
+
import { DOMElement } from "../dom";
|
|
2
|
+
import { Link } from "./link";
|
|
3
|
+
export interface Router {
|
|
4
|
+
current?: string;
|
|
5
|
+
navigate: (url: string) => (event: Event) => void;
|
|
6
|
+
(target: DOMElement): DOMElement;
|
|
7
|
+
}
|
|
8
|
+
export declare const Router: {
|
|
9
|
+
for(links: Link[], index: string, setGlobalRouter?: boolean): Router;
|
|
10
|
+
href(link: string): string;
|
|
11
|
+
navigate(href: string): (event: Event) => void;
|
|
12
|
+
};
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
let baseURI = `${document.baseURI}`;
|
|
2
|
-
const normalizeHref = () => {
|
|
3
|
-
return location.href + "/" === baseURI ? baseURI : location.href;
|
|
4
|
-
};
|
|
5
|
-
let globalRouter;
|
|
6
|
-
export const Router = {
|
|
7
|
-
for(links, index, setGlobalRouter = true) {
|
|
8
|
-
let target;
|
|
9
|
-
const partialRouter = (t) => {
|
|
10
|
-
target = t;
|
|
11
|
-
const href = normalizeHref();
|
|
12
|
-
const route = href === baseURI ? baseURI + index : href;
|
|
13
|
-
doNavigate(route);
|
|
14
|
-
window.addEventListener("popstate", () => {
|
|
15
|
-
doNavigate(location.href);
|
|
16
|
-
});
|
|
17
|
-
return target;
|
|
18
|
-
};
|
|
19
|
-
const doNavigate = (link) => {
|
|
20
|
-
link = link.replace(baseURI, "") || index;
|
|
21
|
-
if (link === partialRouter.current) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
partialRouter.current = link;
|
|
25
|
-
target.update((links.find(({ href }) => link.endsWith(href))?.target ??
|
|
26
|
-
(() => undefined))());
|
|
27
|
-
return true;
|
|
28
|
-
};
|
|
29
|
-
const navigate = (url) => {
|
|
30
|
-
return (event) => {
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
if (doNavigate(url || index)) {
|
|
33
|
-
history.pushState(null, "", url);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
partialRouter.navigate = navigate;
|
|
38
|
-
if (setGlobalRouter) {
|
|
39
|
-
globalRouter = partialRouter;
|
|
40
|
-
}
|
|
41
|
-
return partialRouter;
|
|
42
|
-
},
|
|
43
|
-
href(link) {
|
|
44
|
-
return `${baseURI}${link.replace(/^\//, "")}`;
|
|
45
|
-
},
|
|
46
|
-
navigate(href) {
|
|
47
|
-
return globalRouter?.navigate(href);
|
|
48
|
-
},
|
|
49
|
-
};
|
|
1
|
+
let baseURI = `${document.baseURI}`;
|
|
2
|
+
const normalizeHref = () => {
|
|
3
|
+
return location.href + "/" === baseURI ? baseURI : location.href;
|
|
4
|
+
};
|
|
5
|
+
let globalRouter;
|
|
6
|
+
export const Router = {
|
|
7
|
+
for(links, index, setGlobalRouter = true) {
|
|
8
|
+
let target;
|
|
9
|
+
const partialRouter = (t) => {
|
|
10
|
+
target = t;
|
|
11
|
+
const href = normalizeHref();
|
|
12
|
+
const route = href === baseURI ? baseURI + index : href;
|
|
13
|
+
doNavigate(route);
|
|
14
|
+
window.addEventListener("popstate", () => {
|
|
15
|
+
doNavigate(location.href);
|
|
16
|
+
});
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
const doNavigate = (link) => {
|
|
20
|
+
link = link.replace(baseURI, "") || index;
|
|
21
|
+
if (link === partialRouter.current) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
partialRouter.current = link;
|
|
25
|
+
target.update((links.find(({ href }) => link.endsWith(href))?.target ??
|
|
26
|
+
(() => undefined))());
|
|
27
|
+
return true;
|
|
28
|
+
};
|
|
29
|
+
const navigate = (url) => {
|
|
30
|
+
return (event) => {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
if (doNavigate(url || index)) {
|
|
33
|
+
history.pushState(null, "", url);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
partialRouter.navigate = navigate;
|
|
38
|
+
if (setGlobalRouter) {
|
|
39
|
+
globalRouter = partialRouter;
|
|
40
|
+
}
|
|
41
|
+
return partialRouter;
|
|
42
|
+
},
|
|
43
|
+
href(link) {
|
|
44
|
+
return `${baseURI}${link.replace(/^\//, "")}`;
|
|
45
|
+
},
|
|
46
|
+
navigate(href) {
|
|
47
|
+
return globalRouter?.navigate(href);
|
|
48
|
+
},
|
|
49
|
+
};
|