mosaic 1.0.1 → 1.0.4

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.
Files changed (88) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -8
  3. package/cjs/attribute.js +90 -0
  4. package/cjs/constants.js +15 -0
  5. package/cjs/context.js +66 -0
  6. package/cjs/define.js +152 -0
  7. package/cjs/formControl.js +42 -0
  8. package/cjs/helpers.js +140 -0
  9. package/cjs/index.js +9 -0
  10. package/cjs/list.js +109 -0
  11. package/cjs/mergeSlots.js +37 -0
  12. package/cjs/proxy.js +42 -0
  13. package/cjs/render.js +395 -0
  14. package/cjs/token.js +63 -0
  15. package/cjs/update.js +128 -0
  16. package/dist/mosaic.js +1142 -0
  17. package/dist/mosaic.min.js +1 -0
  18. package/package.json +42 -25
  19. package/src/attribute.js +84 -0
  20. package/src/constants.js +5 -0
  21. package/src/context.js +60 -0
  22. package/src/define.js +158 -0
  23. package/src/formControl.js +36 -0
  24. package/src/helpers.js +123 -0
  25. package/src/index.js +1 -0
  26. package/src/list.js +100 -0
  27. package/src/mergeSlots.js +31 -0
  28. package/src/proxy.js +36 -0
  29. package/src/render.js +397 -0
  30. package/src/token.js +55 -0
  31. package/src/update.js +122 -0
  32. package/SCRATCH.md +0 -31
  33. package/cli.js +0 -17
  34. package/conf.json +0 -0
  35. package/docs/assets/css/main.css +0 -2638
  36. package/docs/assets/images/icons.png +0 -0
  37. package/docs/assets/images/icons@2x.png +0 -0
  38. package/docs/assets/images/widgets.png +0 -0
  39. package/docs/assets/images/widgets@2x.png +0 -0
  40. package/docs/assets/js/main.js +0 -248
  41. package/docs/assets/js/search.js +0 -1
  42. package/docs/index.html +0 -111
  43. package/docs/modules.html +0 -131
  44. package/example/components/x-drawer.html +0 -41
  45. package/example/mosaic/templates/mocha/index.html +0 -39
  46. package/example/mosaic/tests.d.ts +0 -13
  47. package/example/mosaic/tests.js +0 -28
  48. package/example/mosaic/website.d.ts +0 -31
  49. package/example/mosaic/website.js +0 -64
  50. package/example/mosaic.config.d.ts +0 -7
  51. package/example/mosaic.config.js +0 -8
  52. package/example/package-lock.json +0 -899
  53. package/example/package.json +0 -20
  54. package/example/pages/index.html +0 -12
  55. package/example/test/x-drawer.d.ts +0 -0
  56. package/example/test/x-drawer.js +0 -94
  57. package/index.d.ts +0 -85
  58. package/index.js +0 -122
  59. package/index.wdocs.js +0 -37
  60. package/out/fonts/OpenSans-Bold-webfont.eot +0 -0
  61. package/out/fonts/OpenSans-Bold-webfont.svg +0 -1830
  62. package/out/fonts/OpenSans-Bold-webfont.woff +0 -0
  63. package/out/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  64. package/out/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  65. package/out/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  66. package/out/fonts/OpenSans-Italic-webfont.eot +0 -0
  67. package/out/fonts/OpenSans-Italic-webfont.svg +0 -1830
  68. package/out/fonts/OpenSans-Italic-webfont.woff +0 -0
  69. package/out/fonts/OpenSans-Light-webfont.eot +0 -0
  70. package/out/fonts/OpenSans-Light-webfont.svg +0 -1831
  71. package/out/fonts/OpenSans-Light-webfont.woff +0 -0
  72. package/out/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  73. package/out/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  74. package/out/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  75. package/out/fonts/OpenSans-Regular-webfont.eot +0 -0
  76. package/out/fonts/OpenSans-Regular-webfont.svg +0 -1831
  77. package/out/fonts/OpenSans-Regular-webfont.woff +0 -0
  78. package/out/global.html +0 -912
  79. package/out/index.html +0 -65
  80. package/out/index.js.html +0 -239
  81. package/out/scripts/linenumber.js +0 -25
  82. package/out/scripts/prettify/Apache-License-2.0.txt +0 -202
  83. package/out/scripts/prettify/lang-css.js +0 -2
  84. package/out/scripts/prettify/prettify.js +0 -28
  85. package/out/styles/jsdoc-default.css +0 -358
  86. package/out/styles/prettify-jsdoc.css +0 -111
  87. package/out/styles/prettify-tomorrow.css +0 -132
  88. package/tsconfig.json +0 -11
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Matt Donkin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,18 +1,73 @@
1
1
  # mosaic
2
2
 
3
- Mosaic is a node module made primarily for transforming and
4
- combining HTML assets. You can use it for things like
5
- creating dev/test servers and build pipelines.
3
+ ## [![npm](https://img.shields.io/npm/v/mosaic.svg)](http://npm.im/mosaic) [![Build Status](https://travis-ci.com/defx/mosaic.svg?branch=master)](https://travis-ci.com/defx/mosaic) [![Coverage Status](https://coveralls.io/repos/github/defx/mosaic/badge.svg?branch=master)](https://coveralls.io/github/defx/mosaic?branch=master) [![gzip size](https://img.badgesize.io/https://unpkg.com/mosaic/dist/mosaic.min.js?compression=gzip&label=gzip)]()
6
4
 
7
- Configuration allows developers to write custom tasks that
8
- they want to perform when bundling files together.
5
+ Mosaic is a framework for building user interfaces for the web
9
6
 
10
- ## Install
7
+ ## Features
11
8
 
12
- To install locally within your project...
9
+ - Simple templates for declarative data & event binding
10
+ - Reactive data bindings update your view efficiently and
11
+ automatically
12
+ - Full component workflow using standard Custom Elements
13
+ - Small footprint (~4k)
14
+ - No special compiler, plugins, required
15
+ - Minimal learning curve (almost entirely standard HTML, JS,
16
+ and CSS!)
17
+ - Interoperable with other libraries and frameworks
18
+
19
+ [Learn how to use Mosaic in your own project](https://mosaicjs.org/learn/introduction).
20
+
21
+ ## Installation
22
+
23
+ Mosaic is available from npm:
13
24
 
14
25
  ```bash
15
26
  $ npm i mosaic
16
27
  ```
17
28
 
18
- ## Configuration
29
+ You can also import Mosaic directly in the browser via CDN:
30
+
31
+ ```html
32
+ <script type="module">
33
+ import { define } from "https://unpkg.com/mosaic@1.0.4"
34
+ </script>
35
+ ```
36
+
37
+ ## Browser Support
38
+
39
+ (todo)
40
+
41
+ ## Documentation
42
+
43
+ (todo)
44
+
45
+ ## Example
46
+
47
+ ### Step 1. Define your custom element
48
+
49
+ ```html
50
+ <script type="module">
51
+ import { define } from "https://unpkg.com/mosaic@1.0.4"
52
+
53
+ define("hello-world", () => ({ name }), "<p>Hello {{ name }}!</p>")
54
+ </script>
55
+ ```
56
+
57
+ ### Step 2. Use the Custom Element
58
+
59
+ ```html
60
+ <hello-world name="kimberley"></hello-world>
61
+ ```
62
+
63
+ This example will render "Hello Kimberley!" into a container
64
+ on the page.
65
+
66
+ You'll notice that everything here is valid HTML and JS, and
67
+ you can copy and paste this example and run it directly in
68
+ the browser with no need to compile or install anything
69
+ special to make it work.
70
+
71
+ ### License
72
+
73
+ Mosaic is [MIT licensed](./LICENSE).
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var helpers = require('./helpers.js');
6
+
7
+ const pascalToKebab = (string) =>
8
+ string.replace(/[\w]([A-Z])/g, function (m) {
9
+ return m[0] + "-" + m[1].toLowerCase()
10
+ });
11
+
12
+ const kebabToPascal = (string) =>
13
+ string.replace(/[\w]-([\w])/g, function (m) {
14
+ return m[0] + m[2].toUpperCase()
15
+ });
16
+
17
+ const parseStyles = (value) => {
18
+ let type = typeof value;
19
+
20
+ if (type === "string")
21
+ return value.split(";").reduce((o, value) => {
22
+ const [k, v] = value.split(":").map((v) => v.trim());
23
+ if (k) o[k] = v;
24
+ return o
25
+ }, {})
26
+
27
+ if (type === "object") return value
28
+
29
+ return {}
30
+ };
31
+
32
+ const joinStyles = (value) =>
33
+ Object.entries(value)
34
+ .map(([k, v]) => `${k}: ${v};`)
35
+ .join(" ");
36
+
37
+ const convertStyles = (o) =>
38
+ Object.keys(o).reduce((a, k) => {
39
+ a[pascalToKebab(k)] = o[k];
40
+ return a
41
+ }, {});
42
+
43
+ const applyAttribute = (node, name, value) => {
44
+ if (name === "style") {
45
+ value = joinStyles(
46
+ convertStyles({
47
+ ...parseStyles(node.getAttribute("style")),
48
+ ...parseStyles(value),
49
+ })
50
+ );
51
+ } else if (name === "class") {
52
+ switch (helpers.typeOf(value)) {
53
+ case "Array":
54
+ value = value.join(" ");
55
+ break
56
+ case "Object":
57
+ value = Object.keys(value)
58
+ .reduce((a, k) => {
59
+ if (value[k]) a.push(k);
60
+ return a
61
+ }, [])
62
+ .join(" ");
63
+ break
64
+ }
65
+ } else if (!helpers.isPrimitive(value)) {
66
+ return (node[kebabToPascal(name)] = value)
67
+ }
68
+
69
+ name = pascalToKebab(name);
70
+
71
+ if (typeof value === "boolean") {
72
+ if (name.startsWith("aria-")) {
73
+ value = "" + value;
74
+ } else if (value) {
75
+ value = "";
76
+ }
77
+ }
78
+
79
+ let current = node.getAttribute(name);
80
+
81
+ if (value === current) return
82
+
83
+ if (typeof value === "string" || typeof value === "number") {
84
+ node.setAttribute(name, value);
85
+ } else {
86
+ node.removeAttribute(name);
87
+ }
88
+ };
89
+
90
+ exports.applyAttribute = applyAttribute;
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const TEXT = 1;
6
+ const ATTRIBUTE = 2;
7
+ const INPUT = 3;
8
+ const EVENT = 4;
9
+ const REPEAT = 5;
10
+
11
+ exports.ATTRIBUTE = ATTRIBUTE;
12
+ exports.EVENT = EVENT;
13
+ exports.INPUT = INPUT;
14
+ exports.REPEAT = REPEAT;
15
+ exports.TEXT = TEXT;
package/cjs/context.js ADDED
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var helpers = require('./helpers.js');
6
+
7
+ const handler = ({ path, identifier, key, index, i, k }) => ({
8
+ get(target, property) {
9
+ let x = helpers.getValueAtPath(path, target);
10
+
11
+ // x === the collection
12
+
13
+ if (property === identifier) {
14
+ for (let n in x) {
15
+ let v = x[n];
16
+ if (key) {
17
+ if (v[key] === k) return v
18
+ } else {
19
+ if (n == i) return v
20
+ }
21
+ }
22
+ }
23
+
24
+ if (property === index) {
25
+ for (let n in x) {
26
+ let v = x[n];
27
+ if (key) {
28
+ if (v[key] === k) return n
29
+ } else {
30
+ if (n == i) return n
31
+ }
32
+ }
33
+ }
34
+
35
+ let t = key ? x.find((v) => v[key] === k) : x[i];
36
+ if (t?.hasOwnProperty?.(property)) return t[property]
37
+
38
+ return Reflect.get(...arguments)
39
+ },
40
+ set(target, property, value) {
41
+ let x = helpers.getValueAtPath(path, target);
42
+ let t = key ? x.find((v) => v[key] === k) : x[i];
43
+ if (t && !helpers.isPrimitive(t)) {
44
+ t[property] = value;
45
+ return true
46
+ }
47
+
48
+ return Reflect.set(...arguments)
49
+ },
50
+ });
51
+
52
+ const createContext = (v = []) => {
53
+ let context = v;
54
+ return {
55
+ get: () => context,
56
+ push: (v) => context.push(v),
57
+ wrap: (state) => {
58
+ return context.reduce(
59
+ (target, ctx) => new Proxy(target, handler(ctx)),
60
+ state
61
+ )
62
+ },
63
+ }
64
+ };
65
+
66
+ exports.createContext = createContext;
package/cjs/define.js ADDED
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var update = require('./update.js');
6
+ var helpers = require('./helpers.js');
7
+ var render = require('./render.js');
8
+ var mergeSlots = require('./mergeSlots.js');
9
+
10
+ function getDataScript(node) {
11
+ return node.querySelector(`script[type="application/mosaic"]`)
12
+ }
13
+
14
+ function createDataScript(node) {
15
+ let ds = document.createElement("script");
16
+ ds.setAttribute("type", "application/mosaic");
17
+ node.append(ds);
18
+ return ds
19
+ }
20
+
21
+ function serialise(node, state) {
22
+ let ds = getDataScript(node) || createDataScript(node);
23
+
24
+ ds.innerText = JSON.stringify(state);
25
+ }
26
+
27
+ function deserialise(node) {
28
+ return JSON.parse(getDataScript(node)?.innerText || "{}")
29
+ }
30
+
31
+ const define = (name, factory, template) =>
32
+ customElements.define(
33
+ name,
34
+ class extends HTMLElement {
35
+ async connectedCallback() {
36
+ if (!this.initialised) {
37
+ let config = factory(this);
38
+
39
+ if (config instanceof Promise) config = await config;
40
+
41
+ let {
42
+ update: update$1,
43
+ middleware,
44
+ derivations,
45
+ subscribe,
46
+ shadow,
47
+ initialState = {},
48
+ } = config;
49
+
50
+ this.connectedCallback = config.connectedCallback;
51
+ this.disconnectedCallback = config.disconnectedCallback;
52
+
53
+ const { dispatch, getState, onUpdate, flush } = update.configure(
54
+ config,
55
+ this
56
+ );
57
+
58
+ dispatch({
59
+ type: "MERGE",
60
+ payload: deserialise(this),
61
+ });
62
+
63
+ initialState = getState();
64
+
65
+ let observedProps = Object.keys(initialState).filter(
66
+ (v) => v.charAt(0) === "$"
67
+ );
68
+
69
+ let observedAttributes = observedProps
70
+ .map((v) => v.slice(1))
71
+ .map(helpers.pascalToKebab);
72
+
73
+ let sa = this.setAttribute;
74
+ this.setAttribute = (k, v) => {
75
+ if (observedAttributes.includes(k)) {
76
+ let { name, value } = helpers.attributeToProp(k, v);
77
+ dispatch({
78
+ type: "SET",
79
+ payload: { name: "$" + name, value },
80
+ });
81
+ }
82
+ sa.apply(this, [k, v]);
83
+ };
84
+
85
+ observedAttributes.forEach((name) => {
86
+ let property = helpers.attributeToProp(name).name;
87
+
88
+ let value;
89
+
90
+ if (this.hasAttribute(name)) {
91
+ value = this.getAttribute(name);
92
+ } else {
93
+ value = this[property] || initialState["$" + property];
94
+ }
95
+
96
+ Object.defineProperty(this, property, {
97
+ get() {
98
+ return getState()["$" + property]
99
+ },
100
+ set(v) {
101
+ dispatch({
102
+ type: "SET",
103
+ payload: { name: "$" + property, value: v },
104
+ });
105
+ if (helpers.isPrimitive(v)) {
106
+ helpers.applyAttribute(this, property, v);
107
+ }
108
+ },
109
+ });
110
+
111
+ this[property] = value;
112
+ });
113
+
114
+ let beforeMountCallback;
115
+
116
+ if (shadow) {
117
+ this.attachShadow({
118
+ mode: shadow,
119
+ });
120
+ } else {
121
+ beforeMountCallback = (frag) => mergeSlots.mergeSlots(this, frag);
122
+ }
123
+
124
+ onUpdate(
125
+ render.render(
126
+ this.shadowRoot || this,
127
+ { getState, dispatch },
128
+ template,
129
+ () => {
130
+ serialise(this, getState());
131
+
132
+ observedProps.forEach((k) => {
133
+ let v = getState()[k];
134
+ if (helpers.isPrimitive(v)) helpers.applyAttribute(this, k.slice(1), v);
135
+ });
136
+ subscribe?.(getState());
137
+ flush();
138
+ },
139
+ beforeMountCallback
140
+ )
141
+ );
142
+ this.initialised = true;
143
+ }
144
+ this.connectedCallback?.();
145
+ }
146
+ disconnectedCallback() {
147
+ this.disconnectedCallback?.();
148
+ }
149
+ }
150
+ );
151
+
152
+ exports.define = define;
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const updateFormControl = (node, value) => {
6
+ if (node.nodeName === "SELECT") {
7
+ Array.from(node.querySelectorAll("option")).forEach((option) => {
8
+ option.selected = value.includes(option.value);
9
+ });
10
+ return
11
+ }
12
+
13
+ let checked;
14
+
15
+ switch (node.getAttribute("type")) {
16
+ case "checkbox":
17
+ checked = value;
18
+ if (node.checked === checked) break
19
+ if (checked) {
20
+ node.setAttribute("checked", "");
21
+ } else {
22
+ node.removeAttribute("checked");
23
+ }
24
+ break
25
+ case "radio":
26
+ checked = value === node.getAttribute("value");
27
+ if (node.checked === checked) break
28
+ node.checked = checked;
29
+ if (checked) {
30
+ node.setAttribute("checked", "");
31
+ } else {
32
+ node.removeAttribute("checked");
33
+ }
34
+ break
35
+ default:
36
+ if (node.value === value) break
37
+ node.setAttribute("value", (node.value = value || ""));
38
+ break
39
+ }
40
+ };
41
+
42
+ exports.updateFormControl = updateFormControl;
package/cjs/helpers.js ADDED
@@ -0,0 +1,140 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const last = (v = []) => v[v.length - 1];
6
+
7
+ const isWhitespace = (node) => {
8
+ return node.nodeType === node.TEXT_NODE && node.nodeValue.trim() === ""
9
+ };
10
+
11
+ const walk = (node, callback, deep = true) => {
12
+ if (!node) return
13
+ if (!isWhitespace(node)) {
14
+ let v = callback(node);
15
+ if (v === false) return
16
+ if (v?.nodeName) return walk(v, callback, deep)
17
+ }
18
+ if (deep) walk(node.firstChild, callback, deep);
19
+ walk(node.nextSibling, callback, deep);
20
+ };
21
+
22
+ const transformBrackets = (str = "") => {
23
+ let parts = str.split(/(\[[^\]]+\])/).filter((v) => v);
24
+ return parts.reduce((a, part) => {
25
+ let v = part.charAt(0) === "[" ? "." + part.replace(/\./g, ":") : part;
26
+ return a + v
27
+ }, "")
28
+ };
29
+
30
+ const getTarget = (path, target) => {
31
+ let parts = transformBrackets(path)
32
+ .split(".")
33
+ .map((k) => {
34
+ if (k.charAt(0) === "[") {
35
+ let p = k.slice(1, -1).replace(/:/g, ".");
36
+ return getValueAtPath(p, target)
37
+ } else {
38
+ return k
39
+ }
40
+ });
41
+
42
+ let t =
43
+ parts.slice(0, -1).reduce((o, k) => {
44
+ return o && o[k]
45
+ }, target) || target;
46
+ return [t, last(parts)]
47
+ };
48
+
49
+ const getValueAtPath = (path, target) => {
50
+ let [a, b] = getTarget(path, target);
51
+ let v = a?.[b];
52
+ if (typeof v === "function") return v.bind(a)
53
+ return v
54
+ };
55
+
56
+ const fragmentFromTemplate = (v) => {
57
+ if (typeof v === "string") {
58
+ let tpl = document.createElement("template");
59
+ tpl.innerHTML = v.trim();
60
+ return tpl.content
61
+ }
62
+ if (v.nodeName === "TEMPLATE") return v.cloneNode(true).content
63
+ if (v.nodeName === "defs") return v.firstElementChild.cloneNode(true)
64
+ };
65
+
66
+ const debounce = (fn) => {
67
+ let wait = false;
68
+ let invoke = false;
69
+ return () => {
70
+ if (wait) {
71
+ invoke = true;
72
+ } else {
73
+ wait = true;
74
+ fn();
75
+ requestAnimationFrame(() => {
76
+ if (invoke) fn();
77
+ wait = false;
78
+ });
79
+ }
80
+ }
81
+ };
82
+
83
+ const isPrimitive = (v) => v === null || typeof v !== "object";
84
+
85
+ const typeOf = (v) =>
86
+ Object.prototype.toString.call(v).match(/\s(.+[^\]])/)[1];
87
+
88
+ const pascalToKebab = (string) =>
89
+ string.replace(/[\w]([A-Z])/g, function (m) {
90
+ return m[0] + "-" + m[1].toLowerCase()
91
+ });
92
+
93
+ const kebabToPascal = (string) =>
94
+ string.replace(/[\w]-([\w])/g, function (m) {
95
+ return m[0] + m[2].toUpperCase()
96
+ });
97
+
98
+ const applyAttribute = (node, name, value) => {
99
+ name = pascalToKebab(name);
100
+
101
+ if (typeof value === "boolean") {
102
+ if (name.startsWith("aria-")) {
103
+ value = "" + value;
104
+ } else if (value) {
105
+ value = "";
106
+ }
107
+ }
108
+
109
+ if (typeof value === "string" || typeof value === "number") {
110
+ node.setAttribute(name, value);
111
+ } else {
112
+ node.removeAttribute(name);
113
+ }
114
+ };
115
+
116
+ const attributeToProp = (k, v) => {
117
+ let name = kebabToPascal(k);
118
+ if (v === "") v = true;
119
+ if (k.startsWith("aria-")) {
120
+ if (v === "true") v = true;
121
+ if (v === "false") v = false;
122
+ }
123
+ return {
124
+ name,
125
+ value: v,
126
+ }
127
+ };
128
+
129
+ exports.applyAttribute = applyAttribute;
130
+ exports.attributeToProp = attributeToProp;
131
+ exports.debounce = debounce;
132
+ exports.fragmentFromTemplate = fragmentFromTemplate;
133
+ exports.getValueAtPath = getValueAtPath;
134
+ exports.isPrimitive = isPrimitive;
135
+ exports.isWhitespace = isWhitespace;
136
+ exports.kebabToPascal = kebabToPascal;
137
+ exports.last = last;
138
+ exports.pascalToKebab = pascalToKebab;
139
+ exports.typeOf = typeOf;
140
+ exports.walk = walk;
package/cjs/index.js ADDED
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var define = require('./define.js');
6
+
7
+
8
+
9
+ exports.define = define.define;