mnfst 0.5.163 → 0.5.164
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/lib/manifest.appwrite.auth.js +107 -199
- package/lib/manifest.appwrite.data.js +1 -3
- package/lib/manifest.charts.js +34 -79
- package/lib/manifest.chat.js +515 -0
- package/lib/manifest.code.js +110 -340
- package/lib/manifest.colorpicker.js +252 -551
- package/lib/manifest.combobox.js +73 -91
- package/lib/manifest.components.js +34 -95
- package/lib/manifest.css +0 -132
- package/lib/manifest.data.js +189 -562
- package/lib/manifest.datepicker.js +43 -128
- package/lib/manifest.dropdowns.js +18 -39
- package/lib/manifest.export.js +29 -147
- package/lib/manifest.icons.js +9 -24
- package/lib/manifest.integrity.json +23 -23
- package/lib/manifest.js +62 -126
- package/lib/manifest.localization.js +67 -200
- package/lib/manifest.markdown.js +65 -174
- package/lib/manifest.min.css +1 -1
- package/lib/manifest.payments.js +40 -139
- package/lib/manifest.router.js +24 -73
- package/lib/manifest.status.js +20 -56
- package/lib/manifest.svg.js +12 -30
- package/lib/manifest.tooltips.js +28 -65
- package/lib/manifest.utilities.js +40 -107
- package/lib/manifest.virtual.js +15 -53
- package/package.json +1 -1
- package/lib/manifest.appwrite.presence.js +0 -1650
package/lib/manifest.charts.js
CHANGED
|
@@ -1,33 +1,18 @@
|
|
|
1
|
-
/* Manifest Charts
|
|
1
|
+
/* Manifest Charts — in-house SVG chart renderer (themeable, prerender-safe, a11y).
|
|
2
2
|
/* By Andrew Matlock under MIT license
|
|
3
3
|
/* https://manifestx.dev
|
|
4
|
-
/*
|
|
5
|
-
/* An in-house SVG chart renderer. SVG (not canvas) so charts inherit theme
|
|
6
|
-
/* colors via CSS variables, are restylable with the same selector
|
|
7
|
-
/* conventions as every other element, survive static prerendering as real
|
|
8
|
-
/* DOM, and expose accessible <title>/<desc>. The only dependencies are the
|
|
9
|
-
/* d3-scale / d3-shape / d3-array micro-modules (ISC, ~22KB), lazy-loaded
|
|
10
|
-
/* from esm.run on first scroll-into-view — the same posture as the code
|
|
11
|
-
/* plugin loading highlight.js on demand.
|
|
4
|
+
/* d3-scale/shape/array micro-modules (ISC) lazy-loaded from esm.run on scroll-in.
|
|
12
5
|
*/
|
|
13
6
|
|
|
14
7
|
(function () {
|
|
15
8
|
'use strict';
|
|
16
9
|
|
|
17
|
-
/*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* loaded. `_ui` is a reserved, self-identifying key: any loaded data source
|
|
21
|
-
* may carry a top-level `_ui` object, namespaced per element (`_ui.charts`,
|
|
22
|
-
* `_ui.colorpicker`, …); no manifest flag — overrides piggyback on the normal
|
|
23
|
-
* local-data/localization model. resolve() deep-merges every loaded source's
|
|
24
|
-
* `_ui[component]` onto the plugin's English fallbacks. Kept byte-identical
|
|
25
|
-
* across the date picker / color picker copies.
|
|
26
|
-
* ------------------------------------------------------------------ */
|
|
10
|
+
/* Shared localized-UI resolver: deep-merges every loaded source's `_ui[component]`
|
|
11
|
+
* onto the plugin's English fallbacks. Guarded; byte-identical across the picker
|
|
12
|
+
* copies (first plugin to load defines it). */
|
|
27
13
|
if (!window.ManifestUI) {
|
|
28
14
|
window.ManifestUI = {
|
|
29
|
-
/*
|
|
30
|
-
* sources only — never force-loads others just to scan them for `_ui`. */
|
|
15
|
+
/* Loaded data sources (current locale); never force-loads others. */
|
|
31
16
|
_loadedSourceNames() {
|
|
32
17
|
try {
|
|
33
18
|
const store = window.ManifestDataStore && window.ManifestDataStore.rawDataStore;
|
|
@@ -35,8 +20,7 @@
|
|
|
35
20
|
} catch (_) { }
|
|
36
21
|
return [];
|
|
37
22
|
},
|
|
38
|
-
/*
|
|
39
|
-
* Reads inside the caller's Alpine effect (if any) so $x/$locale make it reactive. */
|
|
23
|
+
/* Reads inside the caller's Alpine effect (if any) so $x/$locale stay reactive. */
|
|
40
24
|
resolve(component, fallbacks) {
|
|
41
25
|
const merged = JSON.parse(JSON.stringify(fallbacks || {}));
|
|
42
26
|
try {
|
|
@@ -256,19 +240,15 @@
|
|
|
256
240
|
t.appendChild(document.createTextNode(str == null ? '' : String(str))); // untrusted-safe
|
|
257
241
|
return t;
|
|
258
242
|
}
|
|
259
|
-
// Entry animations run only on
|
|
260
|
-
// (a bound value
|
|
261
|
-
// — otherwise dragging a slider replays the reveal every frame and the
|
|
262
|
-
// chart flickers. drawChart sets this before dispatching.
|
|
243
|
+
// Entry animations run only on first draw; redraws paint final state directly
|
|
244
|
+
// (else a bound value change replays the reveal every frame). Set by drawChart.
|
|
263
245
|
let _suppressAnim = false;
|
|
264
246
|
function animate(el, keyframes, opts) {
|
|
265
247
|
if (_suppressAnim || prefersReducedMotion() || typeof el.animate !== 'function') return;
|
|
266
248
|
try { el.animate(keyframes, Object.assign({ duration: 600, easing: 'cubic-bezier(0.22,1,0.36,1)', fill: 'backwards' }, opts)); } catch (_) { }
|
|
267
249
|
}
|
|
268
|
-
// Cursor-following tooltip
|
|
269
|
-
//
|
|
270
|
-
// box) — so charts use their own tip, themed to match, following the
|
|
271
|
-
// pointer (better UX for dense charts). aria-label carries AT semantics.
|
|
250
|
+
// Cursor-following tooltip: x-tooltip's CSS anchor positioning can't target SVG
|
|
251
|
+
// children (no layout box), so charts use their own themed tip. aria-label for AT.
|
|
272
252
|
function applyTip(seg, tip, cfg) {
|
|
273
253
|
seg.setAttribute('aria-label', tip);
|
|
274
254
|
if (!cfg.tooltip) return;
|
|
@@ -337,12 +317,8 @@
|
|
|
337
317
|
if (self.el.id) _registry[self.el.id] = self.api;
|
|
338
318
|
},
|
|
339
319
|
|
|
340
|
-
//
|
|
341
|
-
//
|
|
342
|
-
// tabs), and does NOT reset a pending timer on re-entry — a
|
|
343
|
-
// high-frequency reactive trigger (e.g. a plugin bumping the data-store
|
|
344
|
-
// version every tick) would otherwise perpetually reschedule and starve
|
|
345
|
-
// the draw.
|
|
320
|
+
// One draw per tick. setTimeout (not rAF) so backgrounded tabs still draw;
|
|
321
|
+
// doesn't reset a pending timer, so a high-frequency trigger can't starve it.
|
|
346
322
|
schedule() { if (this._t) return; this._t = setTimeout(() => { this._t = null; this.draw(); }, 0); },
|
|
347
323
|
|
|
348
324
|
renderError(msg) { this.el.innerHTML = ''; const d = document.createElement('small'); d.textContent = msg; this.el.appendChild(d); },
|
|
@@ -407,10 +383,8 @@
|
|
|
407
383
|
return 4 + n * cfg.rowHeight + 22;
|
|
408
384
|
}
|
|
409
385
|
|
|
410
|
-
// Palette size
|
|
411
|
-
//
|
|
412
|
-
// segment colours cycle through however many exist. Re-probed per draw
|
|
413
|
-
// so per-scope overrides apply.
|
|
386
|
+
// Palette size = count of consecutive --color-chart-N tokens (themes may extend
|
|
387
|
+
// past 8); colours cycle through them. Re-probed per draw for per-scope overrides.
|
|
414
388
|
let _paletteN = 8;
|
|
415
389
|
function probePalette(el) {
|
|
416
390
|
try {
|
|
@@ -649,13 +623,8 @@
|
|
|
649
623
|
if (cfg.legend) drawLegend(state, labels);
|
|
650
624
|
}
|
|
651
625
|
|
|
652
|
-
//
|
|
653
|
-
//
|
|
654
|
-
// bands (e.g. positive/warning/negative ranges). `unit` suffixes the
|
|
655
|
-
// centered readout; `min`/`max` default 0–100.
|
|
656
|
-
// Widest rendered label in px — exact via getComputedTextLength (the root
|
|
657
|
-
// SVG is already in the document); char-estimate fallback pre-layout. Used
|
|
658
|
-
// to size axis gutters to their content so charts sit balanced, not lopsided.
|
|
626
|
+
// Widest rendered label in px (exact via getComputedTextLength, char-estimate
|
|
627
|
+
// fallback). Sizes axis gutters to their content so charts sit balanced.
|
|
659
628
|
function labelWidth(root, items, cls) {
|
|
660
629
|
if (!items || !items.length) return 0;
|
|
661
630
|
const probe = svg('text', cls ? { class: cls, x: -9999, y: -9999 } : { x: -9999, y: -9999 }, root);
|
|
@@ -694,15 +663,12 @@
|
|
|
694
663
|
svg('path', { class: 'gauge-track', d: arc({ startAngle: START, endAngle: END }) }, g);
|
|
695
664
|
}
|
|
696
665
|
|
|
697
|
-
// Value arc — final geometry
|
|
698
|
-
//
|
|
699
|
-
// the sweep is a CSS reveal, never the source of the end state.
|
|
666
|
+
// Value arc — final geometry set unconditionally, so a background tab that
|
|
667
|
+
// skips the fade reveal still renders correctly.
|
|
700
668
|
const color = (cfg.series[0] && cfg.series[0].color) || 'var(--color-chart-1)';
|
|
701
669
|
const valueAngle = scale(value);
|
|
702
670
|
const vArc = svg('path', { class: 'gauge-value', d: arc({ startAngle: START, endAngle: valueAngle }), style: `--color-chart-color:${color}` }, g);
|
|
703
671
|
applyTip(vArc, (cfg.title ? cfg.title + ': ' : '') + value + unit, cfg);
|
|
704
|
-
// Reveal via fade (WAAPI, origin-independent) — the final geometry above
|
|
705
|
-
// is unconditional, so the gauge is correct even if this never runs.
|
|
706
672
|
animate(vArc, [{ opacity: 0 }, { opacity: 1 }], { duration: 500 });
|
|
707
673
|
|
|
708
674
|
// Centered readout + range end labels.
|
|
@@ -714,10 +680,8 @@
|
|
|
714
680
|
}
|
|
715
681
|
}
|
|
716
682
|
|
|
717
|
-
// Heatmap —
|
|
718
|
-
//
|
|
719
|
-
// --color-chart-heat-* tokens (no JS colour-interpolation dep), driven
|
|
720
|
-
// by the per-cell `--heat` percentage.
|
|
683
|
+
// Heatmap — matrix of cells (row per series, column per datum). Cell colour is a
|
|
684
|
+
// CSS color-mix of the --color-chart-heat-* tokens via a per-cell `--heat` %.
|
|
721
685
|
function drawHeatmap(state, root, width, height) {
|
|
722
686
|
const cfg = state.config, d3 = state.d3;
|
|
723
687
|
const rows = cfg.series;
|
|
@@ -747,9 +711,8 @@
|
|
|
747
711
|
|
|
748
712
|
const plot = svg('g', { transform: `translate(${m.left},${m.top})` }, root);
|
|
749
713
|
|
|
750
|
-
// Round only the grid's outer corners: square tiles clipped to
|
|
751
|
-
//
|
|
752
|
-
// last tile's inner edge, so the radius isn't clipping empty gutter).
|
|
714
|
+
// Round only the grid's outer corners: square tiles clipped to one rounded
|
|
715
|
+
// rect hugging the cell extent (so the radius doesn't clip empty gutter).
|
|
753
716
|
const clipId = 'mnfst-heat-' + (++_uid);
|
|
754
717
|
const cp = svg('clipPath', { id: clipId }, svg('defs', null, root));
|
|
755
718
|
svg('rect', { x: 0, y: 0, width: Math.max(0, iw - gap), height: Math.max(0, ih - gap), rx: cssRadius(state.el) }, cp);
|
|
@@ -790,12 +753,9 @@
|
|
|
790
753
|
state.el.appendChild(footer);
|
|
791
754
|
}
|
|
792
755
|
|
|
793
|
-
// Gantt — each series is a track
|
|
794
|
-
//
|
|
795
|
-
//
|
|
796
|
-
// date-ish values → time, other strings → category (ordinal stages). A
|
|
797
|
-
// segment with no `to` is a point marker. Single track = a status strip;
|
|
798
|
-
// many tracks = swimlanes / Gantt.
|
|
756
|
+
// Gantt — each series is a track of `{ from, to, status?, label?, color? }`
|
|
757
|
+
// segments on a shared X axis, adapting numbers→linear, dates→time, else
|
|
758
|
+
// category. A `to`-less segment is a point marker.
|
|
799
759
|
function drawGantt(state, root, width, height) {
|
|
800
760
|
const cfg = state.config, d3 = state.d3;
|
|
801
761
|
const tracks = cfg.series;
|
|
@@ -967,9 +927,8 @@
|
|
|
967
927
|
const valueById = {};
|
|
968
928
|
entries.forEach(([key, val]) => resolveRegion(key, geo).ids.forEach(id => { valueById[id] = val; }));
|
|
969
929
|
|
|
970
|
-
// Display
|
|
971
|
-
//
|
|
972
|
-
// redraw when they arrive.
|
|
930
|
+
// Display name: `_ui.map.regions` override → localized pack ($locale) →
|
|
931
|
+
// English atlas name. Async packs trigger a redraw on arrival.
|
|
973
932
|
const num2a2 = (geo.meta && geo.meta.num2a2) || {};
|
|
974
933
|
const locale = chartLocale();
|
|
975
934
|
const ui = (window.ManifestUI && window.ManifestUI.resolve) ? window.ManifestUI.resolve('map', {}) : {};
|
|
@@ -986,9 +945,8 @@
|
|
|
986
945
|
return eng;
|
|
987
946
|
};
|
|
988
947
|
|
|
989
|
-
// Author-supplied place gazetteer (config `places` or `_ui.map.cities`)
|
|
990
|
-
//
|
|
991
|
-
// source it from a third-party library in their own project.
|
|
948
|
+
// Author-supplied place gazetteer (config `places` or `_ui.map.cities`) for
|
|
949
|
+
// resolving point names → coords. No city data is bundled.
|
|
992
950
|
const placesSrc = cfg.places || ui.cities || null;
|
|
993
951
|
let places = null;
|
|
994
952
|
if (placesSrc) { places = {}; Object.keys(placesSrc).forEach(k => { places[k.toLowerCase()] = placesSrc[k]; }); }
|
|
@@ -1066,9 +1024,8 @@
|
|
|
1066
1024
|
state.el.appendChild(footer);
|
|
1067
1025
|
}
|
|
1068
1026
|
|
|
1069
|
-
// Legend is a <footer> sibling below the SVG
|
|
1070
|
-
//
|
|
1071
|
-
// a <span> with an <i> swatch carrying the series colour.
|
|
1027
|
+
// Legend is a <footer> sibling below the SVG, not an overlay, so it never
|
|
1028
|
+
// collides with axis labels. Each item: a <span> with an <i> colour swatch.
|
|
1072
1029
|
function drawLegend(state, labelsOverride) {
|
|
1073
1030
|
const cfg = state.config;
|
|
1074
1031
|
const items = labelsOverride || cfg.series.map(s => s.name).filter(Boolean);
|
|
@@ -1091,10 +1048,8 @@
|
|
|
1091
1048
|
const state = createState(el, expression, modifiers);
|
|
1092
1049
|
el._chartState = state;
|
|
1093
1050
|
el.classList.add('chart');
|
|
1094
|
-
// Reserve
|
|
1095
|
-
//
|
|
1096
|
-
// reliably trigger the lazy-load IntersectionObserver, and reserving it
|
|
1097
|
-
// also prevents a layout jump when the SVG renders.
|
|
1051
|
+
// Reserve height up front (config, default 240): a 0-height box doesn't
|
|
1052
|
+
// reliably trigger the lazy-load observer, and reserving avoids a layout jump.
|
|
1098
1053
|
const hm = expression && /height\s*:\s*(\d+)/.exec(expression);
|
|
1099
1054
|
el.style.minHeight = (hm ? +hm[1] : 240) + 'px';
|
|
1100
1055
|
observer().observe(el);
|