@livenetworks/ashlar 2.0.7 → 2.0.8
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/LICENSE +641 -641
- package/components/COMPONENTS.md +1116 -1116
- package/components/index.js +81 -81
- package/components/ln-accordion/ln-accordion-dev.scss +8 -8
- package/components/ln-accordion/ln-accordion.js +1 -1
- package/components/ln-accordion/ln-accordion.schema.json +30 -30
- package/components/ln-ajax/ln-ajax-dev.scss +8 -8
- package/components/ln-ajax/ln-ajax.js +1 -1
- package/components/ln-ajax/ln-ajax.schema.json +30 -30
- package/components/ln-api-connector/ln-api-connector.js +1 -1
- package/components/ln-api-connector/ln-api-connector.schema.json +96 -96
- package/components/ln-api-connector/src/ln-api-connector.js +1 -0
- package/components/ln-api-queue/ln-api-queue.js +1 -1
- package/components/ln-api-queue/ln-api-queue.schema.json +34 -34
- package/components/ln-api-queue/src/ln-api-queue.js +3 -13
- package/components/ln-autoresize/ln-autoresize-dev.scss +8 -8
- package/components/ln-autoresize/ln-autoresize.js +1 -1
- package/components/ln-autoresize/ln-autoresize.schema.json +22 -22
- package/components/ln-autosave/ln-autosave-dev.scss +13 -13
- package/components/ln-autosave/ln-autosave.js +1 -1
- package/components/ln-autosave/ln-autosave.schema.json +48 -48
- package/components/ln-autosave/src/autosave-model.js +34 -34
- package/components/ln-chart/ln-chart.js +1 -1
- package/components/ln-chart/ln-chart.schema.json +146 -146
- package/components/ln-chart/src/chart-model.js +154 -154
- package/components/ln-circular-progress/ln-circular-progress.js +1 -1
- package/components/ln-circular-progress/ln-circular-progress.schema.json +42 -42
- package/components/ln-confirm/ln-confirm-dev.scss +24 -24
- package/components/ln-confirm/ln-confirm.js +1 -1
- package/components/ln-confirm/ln-confirm.schema.json +66 -66
- package/components/ln-confirm/src/ln-confirm.js +178 -178
- package/components/ln-core/crypto.js +286 -265
- package/components/ln-core/dom.js +115 -115
- package/components/ln-core/form.js +136 -136
- package/components/ln-core/helpers.js +33 -33
- package/components/ln-core/http.js +48 -48
- package/components/ln-core/index.js +1 -1
- package/components/ln-core/ln-core.schema.json +109 -109
- package/components/ln-core/locale.js +55 -55
- package/components/ln-core/matching.js +78 -78
- package/components/ln-core/number.js +125 -125
- package/components/ln-core/template.js +206 -206
- package/components/ln-couchdb-connector/ln-couchdb-connector.js +1 -1
- package/components/ln-couchdb-connector/ln-couchdb-connector.schema.json +50 -50
- package/components/ln-couchdb-connector/src/ln-couchdb-connector.js +1 -0
- package/components/ln-data-coordinator/README.md +9 -38
- package/components/ln-data-coordinator/ln-data-coordinator-dev.scss +8 -8
- package/components/ln-data-coordinator/ln-data-coordinator.js +1 -1
- package/components/ln-data-coordinator/ln-data-coordinator.schema.json +16 -16
- package/components/ln-data-coordinator/src/data-read-policy.js +0 -7
- package/components/ln-data-coordinator/src/ln-data-coordinator.js +428 -1308
- package/components/ln-data-store/ln-data-store-dev.scss +13 -13
- package/components/ln-data-store/ln-data-store.js +1 -1
- package/components/ln-data-store/ln-data-store.schema.json +84 -84
- package/components/ln-data-store/src/data-store-model.js +184 -184
- package/components/ln-data-store/src/ln-data-store.js +1 -1
- package/components/ln-date/ln-date.js +1 -1
- package/components/ln-date/ln-date.schema.json +92 -92
- package/components/ln-date/src/date-model.js +186 -186
- package/components/ln-debug/ln-debug.js +1 -1
- package/components/ln-debug/ln-debug.schema.json +28 -28
- package/components/ln-debug/src/console-sink.js +19 -19
- package/components/ln-debug/src/gate.js +95 -95
- package/components/ln-debug/src/generated-attributes.js +2 -2
- package/components/ln-dropdown/ln-dropdown-dev.scss +13 -13
- package/components/ln-dropdown/ln-dropdown.js +1 -1
- package/components/ln-dropdown/ln-dropdown.schema.json +90 -90
- package/components/ln-editor/ln-editor.js +1 -1
- package/components/ln-editor/ln-editor.schema.json +58 -58
- package/components/ln-external-links/ln-external-links.js +1 -1
- package/components/ln-external-links/ln-external-links.schema.json +18 -18
- package/components/ln-fill/ln-fill.js +1 -1
- package/components/ln-fill/ln-fill.schema.json +23 -23
- package/components/ln-filter/ln-filter.js +1 -1
- package/components/ln-filter/ln-filter.schema.json +153 -153
- package/components/ln-filter/src/filter-model.js +185 -185
- package/components/ln-form/ln-form-dev.scss +8 -8
- package/components/ln-form/ln-form.js +1 -1
- package/components/ln-form/ln-form.schema.json +45 -45
- package/components/ln-http/ln-http.js +1 -1
- package/components/ln-http/ln-http.schema.json +6 -6
- package/components/ln-icon/ln-icon.schema.json +6 -6
- package/components/ln-include/ln-include.js +1 -1
- package/components/ln-include/ln-include.schema.json +23 -23
- package/components/ln-key/ln-key-dev.scss +18 -18
- package/components/ln-key/ln-key.js +1 -1
- package/components/ln-key/ln-key.schema.json +56 -56
- package/components/ln-key/src/ln-key.js +10 -10
- package/components/ln-link/ln-link-dev.scss +8 -8
- package/components/ln-link/ln-link.js +1 -1
- package/components/ln-link/ln-link.schema.json +22 -22
- package/components/ln-list/README.md +152 -152
- package/components/ln-list/ln-list-dev.scss +8 -8
- package/components/ln-list/ln-list.js +1 -1
- package/components/ln-list/ln-list.schema.json +166 -166
- package/components/ln-modal/ln-modal.js +1 -1
- package/components/ln-modal/ln-modal.schema.json +65 -65
- package/components/ln-nav/ln-nav.js +1 -1
- package/components/ln-nav/ln-nav.schema.json +25 -25
- package/components/ln-number/ln-number.js +1 -1
- package/components/ln-number/ln-number.schema.json +63 -63
- package/components/ln-number/src/number-model.js +31 -31
- package/components/ln-obfuscator/README.md +60 -60
- package/components/ln-obfuscator/ln-obfuscator.js +1 -1
- package/components/ln-obfuscator/ln-obfuscator.schema.json +49 -49
- package/components/ln-obfuscator/src/ln-obfuscator.js +159 -159
- package/components/ln-obfuscator/src/obfuscator-model.js +250 -250
- package/components/ln-options/ln-options.js +1 -1
- package/components/ln-options/ln-options.schema.json +41 -41
- package/components/ln-persist/README.md +151 -151
- package/components/ln-persist/ln-persist.js +1 -1
- package/components/ln-persist/ln-persist.schema.json +28 -28
- package/components/ln-persist/src/ln-persist.js +83 -83
- package/components/ln-picklist/README.md +230 -230
- package/components/ln-picklist/ln-picklist-dev.scss +22 -22
- package/components/ln-picklist/ln-picklist.js +1 -1
- package/components/ln-picklist/ln-picklist.schema.json +49 -49
- package/components/ln-picklist/src/ln-picklist.js +228 -228
- package/components/ln-popover/ln-popover-dev.scss +13 -13
- package/components/ln-popover/ln-popover.js +1 -1
- package/components/ln-popover/ln-popover.schema.json +82 -82
- package/components/ln-progress/ln-progress-dev.scss +8 -8
- package/components/ln-progress/ln-progress.js +1 -1
- package/components/ln-progress/ln-progress.schema.json +40 -40
- package/components/ln-router/ln-router.js +1 -1
- package/components/ln-router/ln-router.schema.json +76 -76
- package/components/ln-scroll/README.md +45 -45
- package/components/ln-scroll/ln-scroll.js +1 -1
- package/components/ln-scroll/ln-scroll.schema.json +85 -85
- package/components/ln-scroll/src/ln-scroll.js +150 -150
- package/components/ln-search/README.md +188 -188
- package/components/ln-search/ln-search.js +1 -1
- package/components/ln-search/ln-search.schema.json +103 -103
- package/components/ln-slug/ln-slug.js +1 -1
- package/components/ln-slug/ln-slug.schema.json +23 -23
- package/components/ln-sort/ln-sort.js +1 -1
- package/components/ln-sort/ln-sort.schema.json +104 -104
- package/components/ln-sort/src/ln-sort.js +321 -321
- package/components/ln-sort/src/sort-model.js +117 -117
- package/components/ln-sortable/ln-sortable-dev.scss +13 -13
- package/components/ln-sortable/ln-sortable.js +1 -1
- package/components/ln-sortable/ln-sortable.schema.json +36 -36
- package/components/ln-stat/ln-stat-dev.scss +8 -8
- package/components/ln-stat/ln-stat.js +1 -1
- package/components/ln-stat/ln-stat.schema.json +32 -32
- package/components/ln-stat/src/stat-model.js +28 -28
- package/components/ln-table/ln-table.js +1 -1
- package/components/ln-table/ln-table.schema.json +211 -211
- package/components/ln-table/src/table-model.js +98 -98
- package/components/ln-table-coordinator/ln-table-coordinator.js +1 -1
- package/components/ln-table-coordinator/ln-table-coordinator.schema.json +93 -93
- package/components/ln-tabs/ln-tabs.js +1 -1
- package/components/ln-tabs/ln-tabs.schema.json +75 -75
- package/components/ln-tabs/src/ln-tabs.js +208 -208
- package/components/ln-tabs/src/tabs-model.js +82 -82
- package/components/ln-time/ln-time-dev.scss +13 -13
- package/components/ln-time/ln-time.js +1 -1
- package/components/ln-time/ln-time.schema.json +38 -38
- package/components/ln-toast/ln-toast.js +1 -1
- package/components/ln-toast/ln-toast.schema.json +65 -65
- package/components/ln-toggle/ln-toggle.js +1 -1
- package/components/ln-toggle/ln-toggle.schema.json +52 -52
- package/components/ln-tooltip/ln-tooltip.js +1 -1
- package/components/ln-tooltip/ln-tooltip.schema.json +86 -86
- package/components/ln-translations/ln-translations.js +1 -1
- package/components/ln-translations/ln-translations.schema.json +120 -120
- package/components/ln-ui-coordinator/README.md +62 -62
- package/components/ln-ui-coordinator/ln-ui-coordinator.js +1 -1
- package/components/ln-ui-coordinator/ln-ui-coordinator.schema.json +28 -28
- package/components/ln-ui-coordinator/src/ln-ui-coordinator.js +140 -140
- package/components/ln-upload/ln-upload.js +1 -1
- package/components/ln-upload/ln-upload.schema.json +193 -193
- package/components/ln-upload/src/upload-model.js +78 -78
- package/components/ln-validate/ln-validate.js +1 -1
- package/components/ln-validate/ln-validate.schema.json +50 -50
- package/components/ln-validate/src/validate-model.js +64 -64
- package/components/ln-websocket-connector/README.md +166 -166
- package/components/ln-websocket-connector/ln-websocket-connector.js +1 -1
- package/components/ln-websocket-connector/ln-websocket-connector.schema.json +29 -29
- package/components/ln-websocket-connector/src/ln-websocket-connector.js +283 -279
- package/ln-ashlar.html-data.json +7 -8
- package/package.json +84 -84
- package/theme/brand.css +73 -73
- package/theme/components/_confirm.scss +6 -6
- package/theme/components/_picklist.scss +3 -3
- package/theme/config/_palette.scss +274 -274
- package/theme/config/_theme.scss +292 -292
- package/theme/config/_tokens.scss +285 -285
- package/theme/config/mixins/_index.scss +62 -62
- package/theme/config/mixins/_picklist.scss +66 -66
- package/theme/ln-ashlar-dev.scss +66 -66
- package/theme/ln-ashlar-landing.scss +56 -56
- package/theme/ln-ashlar-theme.scss +63 -63
- package/theme/presentation/_bento.scss +151 -151
- package/theme/presentation/_cta.scss +111 -111
- package/theme/presentation/_effects.scss +216 -216
- package/theme/presentation/_features.scss +108 -108
- package/theme/presentation/_footer.scss +129 -129
- package/theme/presentation/_hero.scss +158 -158
- package/theme/presentation/_layout.scss +170 -170
- package/theme/presentation/_navbar.scss +140 -140
- package/theme/presentation/_pricing.scss +262 -262
- package/theme/presentation/_stats.scss +87 -87
- package/theme/presentation/_testimonials.scss +124 -124
- package/theme/presentation/_tokens.scss +39 -39
- package/theme/presentation/_typography.scss +163 -163
- package/web-types.json +12 -12
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
|
|
3
|
-
"component": "ln-chart",
|
|
4
|
-
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
-
"attributes": {
|
|
6
|
-
"data-ln-chart": {
|
|
7
|
-
"direction": null,
|
|
8
|
-
"sources": [
|
|
9
|
-
"ln-chart-dev.scss",
|
|
10
|
-
"src/ln-chart.js"
|
|
11
|
-
],
|
|
12
|
-
"type": "string",
|
|
13
|
-
"fallback": "",
|
|
14
|
-
"description": "Chart instance name or identifier"
|
|
15
|
-
},
|
|
16
|
-
"data-ln-chart-area": {
|
|
17
|
-
"direction": "author",
|
|
18
|
-
"sources": [
|
|
19
|
-
"src/ln-chart.js"
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
"data-ln-chart-count": {
|
|
23
|
-
"direction": "author",
|
|
24
|
-
"sources": [
|
|
25
|
-
"src/ln-chart.js"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"data-ln-chart-empty": {
|
|
29
|
-
"direction": "author",
|
|
30
|
-
"sources": [
|
|
31
|
-
"src/ln-chart.js"
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
"data-ln-chart-labels": {
|
|
35
|
-
"direction": "author",
|
|
36
|
-
"sources": [
|
|
37
|
-
"src/ln-chart.js"
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
"data-ln-chart-line": {
|
|
41
|
-
"direction": "author",
|
|
42
|
-
"sources": [
|
|
43
|
-
"ln-chart-dev.scss",
|
|
44
|
-
"src/ln-chart.js"
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
"data-ln-chart-max": {
|
|
48
|
-
"direction": "author",
|
|
49
|
-
"sources": [
|
|
50
|
-
"src/ln-chart.js"
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
"data-ln-chart-min": {
|
|
54
|
-
"direction": "author",
|
|
55
|
-
"sources": [
|
|
56
|
-
"src/ln-chart.js"
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
"data-ln-chart-padding": {
|
|
60
|
-
"direction": "author",
|
|
61
|
-
"sources": [
|
|
62
|
-
"src/ln-chart.js"
|
|
63
|
-
],
|
|
64
|
-
"type": "integer",
|
|
65
|
-
"fallback": 20,
|
|
66
|
-
"min": 0,
|
|
67
|
-
"description": "Internal plot padding in pixels"
|
|
68
|
-
},
|
|
69
|
-
"data-ln-chart-plot": {
|
|
70
|
-
"direction": "author",
|
|
71
|
-
"sources": [
|
|
72
|
-
"ln-chart-dev.scss",
|
|
73
|
-
"src/ln-chart.js"
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
"data-ln-chart-sort": {
|
|
77
|
-
"direction": "author",
|
|
78
|
-
"sources": [
|
|
79
|
-
"src/ln-chart.js"
|
|
80
|
-
],
|
|
81
|
-
"type": "string",
|
|
82
|
-
"description": "Field name to sort chart series data by"
|
|
83
|
-
},
|
|
84
|
-
"data-ln-chart-source": {
|
|
85
|
-
"direction": "author",
|
|
86
|
-
"sources": [
|
|
87
|
-
"src/ln-chart.js"
|
|
88
|
-
],
|
|
89
|
-
"type": "string",
|
|
90
|
-
"description": "Source store or coordinator identifier"
|
|
91
|
-
},
|
|
92
|
-
"data-ln-chart-type": {
|
|
93
|
-
"direction": "author",
|
|
94
|
-
"sources": [
|
|
95
|
-
"src/ln-chart.js"
|
|
96
|
-
],
|
|
97
|
-
"type": "enum",
|
|
98
|
-
"values": [
|
|
99
|
-
"line",
|
|
100
|
-
"bar",
|
|
101
|
-
"area",
|
|
102
|
-
"scatter"
|
|
103
|
-
],
|
|
104
|
-
"fallback": "line",
|
|
105
|
-
"description": "Visual chart render type"
|
|
106
|
-
},
|
|
107
|
-
"data-ln-chart-x": {
|
|
108
|
-
"direction": "author",
|
|
109
|
-
"sources": [
|
|
110
|
-
"ln-chart-dev.scss",
|
|
111
|
-
"src/ln-chart.js"
|
|
112
|
-
],
|
|
113
|
-
"type": "string",
|
|
114
|
-
"description": "Field name mapping to X axis"
|
|
115
|
-
},
|
|
116
|
-
"data-ln-chart-y": {
|
|
117
|
-
"direction": "author",
|
|
118
|
-
"sources": [
|
|
119
|
-
"ln-chart-dev.scss",
|
|
120
|
-
"src/ln-chart.js"
|
|
121
|
-
],
|
|
122
|
-
"type": "string",
|
|
123
|
-
"description": "Field name mapping to Y axis"
|
|
124
|
-
},
|
|
125
|
-
"data-ln-chart-zero": {
|
|
126
|
-
"direction": "author",
|
|
127
|
-
"sources": [
|
|
128
|
-
"src/ln-chart.js"
|
|
129
|
-
],
|
|
130
|
-
"type": "boolean",
|
|
131
|
-
"description": "Forces Y axis scale to start at zero"
|
|
132
|
-
},
|
|
133
|
-
"data-ln-debug": {
|
|
134
|
-
"direction": null,
|
|
135
|
-
"sources": [
|
|
136
|
-
"ln-chart-dev.scss"
|
|
137
|
-
]
|
|
138
|
-
},
|
|
139
|
-
"data-ln-template": {
|
|
140
|
-
"direction": null,
|
|
141
|
-
"sources": [
|
|
142
|
-
"src/ln-chart.js"
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$comment": "This file is partly generated. The $comment, component, generator, and each attribute's direction, sources, type, values, fallback, and description keys are owned by the generator and synchronized from JS source code. All other keys are preserved and safe to hand-author. Regenerate with `npm run sync:ln-schemas`.",
|
|
3
|
+
"component": "ln-chart",
|
|
4
|
+
"generator": "scripts/sync-ln-schemas.mjs",
|
|
5
|
+
"attributes": {
|
|
6
|
+
"data-ln-chart": {
|
|
7
|
+
"direction": null,
|
|
8
|
+
"sources": [
|
|
9
|
+
"ln-chart-dev.scss",
|
|
10
|
+
"src/ln-chart.js"
|
|
11
|
+
],
|
|
12
|
+
"type": "string",
|
|
13
|
+
"fallback": "",
|
|
14
|
+
"description": "Chart instance name or identifier"
|
|
15
|
+
},
|
|
16
|
+
"data-ln-chart-area": {
|
|
17
|
+
"direction": "author",
|
|
18
|
+
"sources": [
|
|
19
|
+
"src/ln-chart.js"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"data-ln-chart-count": {
|
|
23
|
+
"direction": "author",
|
|
24
|
+
"sources": [
|
|
25
|
+
"src/ln-chart.js"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"data-ln-chart-empty": {
|
|
29
|
+
"direction": "author",
|
|
30
|
+
"sources": [
|
|
31
|
+
"src/ln-chart.js"
|
|
32
|
+
]
|
|
33
|
+
},
|
|
34
|
+
"data-ln-chart-labels": {
|
|
35
|
+
"direction": "author",
|
|
36
|
+
"sources": [
|
|
37
|
+
"src/ln-chart.js"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"data-ln-chart-line": {
|
|
41
|
+
"direction": "author",
|
|
42
|
+
"sources": [
|
|
43
|
+
"ln-chart-dev.scss",
|
|
44
|
+
"src/ln-chart.js"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"data-ln-chart-max": {
|
|
48
|
+
"direction": "author",
|
|
49
|
+
"sources": [
|
|
50
|
+
"src/ln-chart.js"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"data-ln-chart-min": {
|
|
54
|
+
"direction": "author",
|
|
55
|
+
"sources": [
|
|
56
|
+
"src/ln-chart.js"
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
"data-ln-chart-padding": {
|
|
60
|
+
"direction": "author",
|
|
61
|
+
"sources": [
|
|
62
|
+
"src/ln-chart.js"
|
|
63
|
+
],
|
|
64
|
+
"type": "integer",
|
|
65
|
+
"fallback": 20,
|
|
66
|
+
"min": 0,
|
|
67
|
+
"description": "Internal plot padding in pixels"
|
|
68
|
+
},
|
|
69
|
+
"data-ln-chart-plot": {
|
|
70
|
+
"direction": "author",
|
|
71
|
+
"sources": [
|
|
72
|
+
"ln-chart-dev.scss",
|
|
73
|
+
"src/ln-chart.js"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"data-ln-chart-sort": {
|
|
77
|
+
"direction": "author",
|
|
78
|
+
"sources": [
|
|
79
|
+
"src/ln-chart.js"
|
|
80
|
+
],
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "Field name to sort chart series data by"
|
|
83
|
+
},
|
|
84
|
+
"data-ln-chart-source": {
|
|
85
|
+
"direction": "author",
|
|
86
|
+
"sources": [
|
|
87
|
+
"src/ln-chart.js"
|
|
88
|
+
],
|
|
89
|
+
"type": "string",
|
|
90
|
+
"description": "Source store or coordinator identifier"
|
|
91
|
+
},
|
|
92
|
+
"data-ln-chart-type": {
|
|
93
|
+
"direction": "author",
|
|
94
|
+
"sources": [
|
|
95
|
+
"src/ln-chart.js"
|
|
96
|
+
],
|
|
97
|
+
"type": "enum",
|
|
98
|
+
"values": [
|
|
99
|
+
"line",
|
|
100
|
+
"bar",
|
|
101
|
+
"area",
|
|
102
|
+
"scatter"
|
|
103
|
+
],
|
|
104
|
+
"fallback": "line",
|
|
105
|
+
"description": "Visual chart render type"
|
|
106
|
+
},
|
|
107
|
+
"data-ln-chart-x": {
|
|
108
|
+
"direction": "author",
|
|
109
|
+
"sources": [
|
|
110
|
+
"ln-chart-dev.scss",
|
|
111
|
+
"src/ln-chart.js"
|
|
112
|
+
],
|
|
113
|
+
"type": "string",
|
|
114
|
+
"description": "Field name mapping to X axis"
|
|
115
|
+
},
|
|
116
|
+
"data-ln-chart-y": {
|
|
117
|
+
"direction": "author",
|
|
118
|
+
"sources": [
|
|
119
|
+
"ln-chart-dev.scss",
|
|
120
|
+
"src/ln-chart.js"
|
|
121
|
+
],
|
|
122
|
+
"type": "string",
|
|
123
|
+
"description": "Field name mapping to Y axis"
|
|
124
|
+
},
|
|
125
|
+
"data-ln-chart-zero": {
|
|
126
|
+
"direction": "author",
|
|
127
|
+
"sources": [
|
|
128
|
+
"src/ln-chart.js"
|
|
129
|
+
],
|
|
130
|
+
"type": "boolean",
|
|
131
|
+
"description": "Forces Y axis scale to start at zero"
|
|
132
|
+
},
|
|
133
|
+
"data-ln-debug": {
|
|
134
|
+
"direction": null,
|
|
135
|
+
"sources": [
|
|
136
|
+
"ln-chart-dev.scss"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"data-ln-template": {
|
|
140
|
+
"direction": null,
|
|
141
|
+
"sources": [
|
|
142
|
+
"src/ln-chart.js"
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
function finiteNumber(value) {
|
|
2
|
-
if (value === null || value === undefined || value === '') return null;
|
|
3
|
-
const number = Number(value);
|
|
4
|
-
return Number.isFinite(number) ? number : null;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function coordinate(value) {
|
|
8
|
-
return String(Math.round(value * 1000) / 1000);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function clampPadding(padding, width, height) {
|
|
12
|
-
const parsed = finiteNumber(padding);
|
|
13
|
-
if (parsed === null || parsed < 0) return 0;
|
|
14
|
-
return Math.min(parsed, Math.min(width, height) / 2);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Parses SVG viewBox string into coordinates and dimensions.
|
|
19
|
-
* @param {string} value
|
|
20
|
-
* @returns {{ x: number, y: number, width: number, height: number }|null}
|
|
21
|
-
*/
|
|
22
|
-
export function parseChartViewBox(value) {
|
|
23
|
-
if (typeof value !== 'string') return null;
|
|
24
|
-
const parts = value.trim().split(/[\s,]+/).map(Number);
|
|
25
|
-
if (parts.length !== 4 || parts.some(part => !Number.isFinite(part))) return null;
|
|
26
|
-
if (parts[2] <= 0 || parts[3] <= 0) return null;
|
|
27
|
-
return { x: parts[0], y: parts[1], width: parts[2], height: parts[3] };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Parses chart sort string (e.g. "field:desc" or "field:asc").
|
|
32
|
-
* @param {string} raw
|
|
33
|
-
* @returns {{ field: string, direction: 'asc' | 'desc' }|null}
|
|
34
|
-
*/
|
|
35
|
-
export function parseChartSort(raw) {
|
|
36
|
-
if (!raw || typeof raw !== 'string') return null;
|
|
37
|
-
const parts = raw.split(':');
|
|
38
|
-
const field = parts[0].trim();
|
|
39
|
-
if (!field) return null;
|
|
40
|
-
return {
|
|
41
|
-
field,
|
|
42
|
-
direction: parts[1] && parts[1].trim().toLowerCase() === 'desc' ? 'desc' : 'asc'
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Builds points, geometries, and domain metadata for chart rendering.
|
|
48
|
-
* @param {Array<object>} records
|
|
49
|
-
* @param {object} options
|
|
50
|
-
* @returns {object}
|
|
51
|
-
*/
|
|
52
|
-
export function buildChartModel(records, options) {
|
|
53
|
-
options = options || {};
|
|
54
|
-
const viewBox = options.viewBox || { x: 0, y: 0, width: 1000, height: 320 };
|
|
55
|
-
const xField = options.xField || 'label';
|
|
56
|
-
const yField = options.yField || 'value';
|
|
57
|
-
const includeZero = options.includeZero !== false;
|
|
58
|
-
const padding = clampPadding(options.padding, viewBox.width, viewBox.height);
|
|
59
|
-
const source = Array.isArray(records) ? records : [];
|
|
60
|
-
|
|
61
|
-
const values = [];
|
|
62
|
-
for (let index = 0; index < source.length; index++) {
|
|
63
|
-
const record = source[index] || {};
|
|
64
|
-
const value = finiteNumber(record[yField]);
|
|
65
|
-
if (value === null) continue;
|
|
66
|
-
values.push({
|
|
67
|
-
record,
|
|
68
|
-
sourceIndex: index,
|
|
69
|
-
label: record[xField] == null ? String(index + 1) : String(record[xField]),
|
|
70
|
-
value
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (values.length === 0) {
|
|
75
|
-
return {
|
|
76
|
-
points: [],
|
|
77
|
-
linePoints: '',
|
|
78
|
-
areaPoints: '',
|
|
79
|
-
count: 0,
|
|
80
|
-
min: null,
|
|
81
|
-
max: null,
|
|
82
|
-
domainMin: 0,
|
|
83
|
-
domainMax: 1,
|
|
84
|
-
baselineY: viewBox.y + viewBox.height - padding
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
let min = values[0].value;
|
|
89
|
-
let max = values[0].value;
|
|
90
|
-
for (let i = 1; i < values.length; i++) {
|
|
91
|
-
if (values[i].value < min) min = values[i].value;
|
|
92
|
-
if (values[i].value > max) max = values[i].value;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
let domainMin = min;
|
|
96
|
-
let domainMax = max;
|
|
97
|
-
if (includeZero) {
|
|
98
|
-
domainMin = Math.min(0, domainMin);
|
|
99
|
-
domainMax = Math.max(0, domainMax);
|
|
100
|
-
}
|
|
101
|
-
if (domainMin === domainMax) {
|
|
102
|
-
if (domainMax === 0) {
|
|
103
|
-
domainMax = 1;
|
|
104
|
-
} else if (domainMax > 0) {
|
|
105
|
-
domainMin = 0;
|
|
106
|
-
} else {
|
|
107
|
-
domainMax = 0;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const usableWidth = Math.max(1, viewBox.width - padding * 2);
|
|
112
|
-
const usableHeight = Math.max(1, viewBox.height - padding * 2);
|
|
113
|
-
const valueRange = domainMax - domainMin;
|
|
114
|
-
const baselineY = viewBox.y + viewBox.height - padding - ((0 - domainMin) / valueRange) * usableHeight;
|
|
115
|
-
|
|
116
|
-
const points = [];
|
|
117
|
-
for (let i = 0; i < values.length; i++) {
|
|
118
|
-
const item = values[i];
|
|
119
|
-
const progress = values.length === 1 ? 0.5 : i / (values.length - 1);
|
|
120
|
-
const x = viewBox.x + padding + progress * usableWidth;
|
|
121
|
-
const y = viewBox.y + viewBox.height - padding - ((item.value - domainMin) / valueRange) * usableHeight;
|
|
122
|
-
points.push({
|
|
123
|
-
record: item.record,
|
|
124
|
-
sourceIndex: item.sourceIndex,
|
|
125
|
-
label: item.label,
|
|
126
|
-
value: item.value,
|
|
127
|
-
x,
|
|
128
|
-
y,
|
|
129
|
-
pointString: coordinate(x) + ',' + coordinate(y)
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const linePoints = points.map(point => point.pointString).join(' ');
|
|
134
|
-
let areaPoints = '';
|
|
135
|
-
if (points.length > 0) {
|
|
136
|
-
const first = points[0];
|
|
137
|
-
const last = points[points.length - 1];
|
|
138
|
-
const startBaseline = coordinate(first.x) + ',' + coordinate(baselineY);
|
|
139
|
-
const endBaseline = coordinate(last.x) + ',' + coordinate(baselineY);
|
|
140
|
-
areaPoints = startBaseline + ' ' + linePoints + ' ' + endBaseline;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
points,
|
|
145
|
-
linePoints,
|
|
146
|
-
areaPoints,
|
|
147
|
-
count: points.length,
|
|
148
|
-
min,
|
|
149
|
-
max,
|
|
150
|
-
domainMin,
|
|
151
|
-
domainMax,
|
|
152
|
-
baselineY
|
|
153
|
-
};
|
|
154
|
-
}
|
|
1
|
+
function finiteNumber(value) {
|
|
2
|
+
if (value === null || value === undefined || value === '') return null;
|
|
3
|
+
const number = Number(value);
|
|
4
|
+
return Number.isFinite(number) ? number : null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function coordinate(value) {
|
|
8
|
+
return String(Math.round(value * 1000) / 1000);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function clampPadding(padding, width, height) {
|
|
12
|
+
const parsed = finiteNumber(padding);
|
|
13
|
+
if (parsed === null || parsed < 0) return 0;
|
|
14
|
+
return Math.min(parsed, Math.min(width, height) / 2);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Parses SVG viewBox string into coordinates and dimensions.
|
|
19
|
+
* @param {string} value
|
|
20
|
+
* @returns {{ x: number, y: number, width: number, height: number }|null}
|
|
21
|
+
*/
|
|
22
|
+
export function parseChartViewBox(value) {
|
|
23
|
+
if (typeof value !== 'string') return null;
|
|
24
|
+
const parts = value.trim().split(/[\s,]+/).map(Number);
|
|
25
|
+
if (parts.length !== 4 || parts.some(part => !Number.isFinite(part))) return null;
|
|
26
|
+
if (parts[2] <= 0 || parts[3] <= 0) return null;
|
|
27
|
+
return { x: parts[0], y: parts[1], width: parts[2], height: parts[3] };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Parses chart sort string (e.g. "field:desc" or "field:asc").
|
|
32
|
+
* @param {string} raw
|
|
33
|
+
* @returns {{ field: string, direction: 'asc' | 'desc' }|null}
|
|
34
|
+
*/
|
|
35
|
+
export function parseChartSort(raw) {
|
|
36
|
+
if (!raw || typeof raw !== 'string') return null;
|
|
37
|
+
const parts = raw.split(':');
|
|
38
|
+
const field = parts[0].trim();
|
|
39
|
+
if (!field) return null;
|
|
40
|
+
return {
|
|
41
|
+
field,
|
|
42
|
+
direction: parts[1] && parts[1].trim().toLowerCase() === 'desc' ? 'desc' : 'asc'
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Builds points, geometries, and domain metadata for chart rendering.
|
|
48
|
+
* @param {Array<object>} records
|
|
49
|
+
* @param {object} options
|
|
50
|
+
* @returns {object}
|
|
51
|
+
*/
|
|
52
|
+
export function buildChartModel(records, options) {
|
|
53
|
+
options = options || {};
|
|
54
|
+
const viewBox = options.viewBox || { x: 0, y: 0, width: 1000, height: 320 };
|
|
55
|
+
const xField = options.xField || 'label';
|
|
56
|
+
const yField = options.yField || 'value';
|
|
57
|
+
const includeZero = options.includeZero !== false;
|
|
58
|
+
const padding = clampPadding(options.padding, viewBox.width, viewBox.height);
|
|
59
|
+
const source = Array.isArray(records) ? records : [];
|
|
60
|
+
|
|
61
|
+
const values = [];
|
|
62
|
+
for (let index = 0; index < source.length; index++) {
|
|
63
|
+
const record = source[index] || {};
|
|
64
|
+
const value = finiteNumber(record[yField]);
|
|
65
|
+
if (value === null) continue;
|
|
66
|
+
values.push({
|
|
67
|
+
record,
|
|
68
|
+
sourceIndex: index,
|
|
69
|
+
label: record[xField] == null ? String(index + 1) : String(record[xField]),
|
|
70
|
+
value
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (values.length === 0) {
|
|
75
|
+
return {
|
|
76
|
+
points: [],
|
|
77
|
+
linePoints: '',
|
|
78
|
+
areaPoints: '',
|
|
79
|
+
count: 0,
|
|
80
|
+
min: null,
|
|
81
|
+
max: null,
|
|
82
|
+
domainMin: 0,
|
|
83
|
+
domainMax: 1,
|
|
84
|
+
baselineY: viewBox.y + viewBox.height - padding
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let min = values[0].value;
|
|
89
|
+
let max = values[0].value;
|
|
90
|
+
for (let i = 1; i < values.length; i++) {
|
|
91
|
+
if (values[i].value < min) min = values[i].value;
|
|
92
|
+
if (values[i].value > max) max = values[i].value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let domainMin = min;
|
|
96
|
+
let domainMax = max;
|
|
97
|
+
if (includeZero) {
|
|
98
|
+
domainMin = Math.min(0, domainMin);
|
|
99
|
+
domainMax = Math.max(0, domainMax);
|
|
100
|
+
}
|
|
101
|
+
if (domainMin === domainMax) {
|
|
102
|
+
if (domainMax === 0) {
|
|
103
|
+
domainMax = 1;
|
|
104
|
+
} else if (domainMax > 0) {
|
|
105
|
+
domainMin = 0;
|
|
106
|
+
} else {
|
|
107
|
+
domainMax = 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const usableWidth = Math.max(1, viewBox.width - padding * 2);
|
|
112
|
+
const usableHeight = Math.max(1, viewBox.height - padding * 2);
|
|
113
|
+
const valueRange = domainMax - domainMin;
|
|
114
|
+
const baselineY = viewBox.y + viewBox.height - padding - ((0 - domainMin) / valueRange) * usableHeight;
|
|
115
|
+
|
|
116
|
+
const points = [];
|
|
117
|
+
for (let i = 0; i < values.length; i++) {
|
|
118
|
+
const item = values[i];
|
|
119
|
+
const progress = values.length === 1 ? 0.5 : i / (values.length - 1);
|
|
120
|
+
const x = viewBox.x + padding + progress * usableWidth;
|
|
121
|
+
const y = viewBox.y + viewBox.height - padding - ((item.value - domainMin) / valueRange) * usableHeight;
|
|
122
|
+
points.push({
|
|
123
|
+
record: item.record,
|
|
124
|
+
sourceIndex: item.sourceIndex,
|
|
125
|
+
label: item.label,
|
|
126
|
+
value: item.value,
|
|
127
|
+
x,
|
|
128
|
+
y,
|
|
129
|
+
pointString: coordinate(x) + ',' + coordinate(y)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const linePoints = points.map(point => point.pointString).join(' ');
|
|
134
|
+
let areaPoints = '';
|
|
135
|
+
if (points.length > 0) {
|
|
136
|
+
const first = points[0];
|
|
137
|
+
const last = points[points.length - 1];
|
|
138
|
+
const startBaseline = coordinate(first.x) + ',' + coordinate(baselineY);
|
|
139
|
+
const endBaseline = coordinate(last.x) + ',' + coordinate(baselineY);
|
|
140
|
+
areaPoints = startBaseline + ' ' + linePoints + ' ' + endBaseline;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
points,
|
|
145
|
+
linePoints,
|
|
146
|
+
areaPoints,
|
|
147
|
+
count: points.length,
|
|
148
|
+
min,
|
|
149
|
+
max,
|
|
150
|
+
domainMin,
|
|
151
|
+
domainMax,
|
|
152
|
+
baselineY
|
|
153
|
+
};
|
|
154
|
+
}
|