@nocoo/basalt 2.0.0-rc.1 → 2.0.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/dist/charts/area.d.ts +8 -4
- package/dist/charts/area.js +41 -42
- package/dist/charts/area.js.map +1 -1
- package/dist/charts/bar.d.ts +7 -4
- package/dist/charts/bar.js +34 -27
- package/dist/charts/bar.js.map +1 -1
- package/dist/charts/bullet.d.ts +6 -4
- package/dist/charts/bullet.js +18 -23
- package/dist/charts/bullet.js.map +1 -1
- package/dist/charts/chart-colors.d.ts +3 -0
- package/dist/charts/charts.d.ts +6 -4
- package/dist/charts/charts.js +4 -3
- package/dist/charts/charts.js.map +1 -1
- package/dist/charts/config.d.ts +26 -15
- package/dist/charts/config.js +58 -44
- package/dist/charts/config.js.map +1 -1
- package/dist/charts/custom-chart.d.ts +6 -4
- package/dist/charts/custom-chart.js +4 -3
- package/dist/charts/custom-chart.js.map +1 -1
- package/dist/charts/date-navigation.d.ts +5 -0
- package/dist/charts/date-navigation.js.map +1 -1
- package/dist/charts/donut.d.ts +6 -4
- package/dist/charts/donut.js +38 -28
- package/dist/charts/donut.js.map +1 -1
- package/dist/charts/frame.d.ts +7 -3
- package/dist/charts/frame.js +30 -7
- package/dist/charts/frame.js.map +1 -1
- package/dist/charts/funnel.d.ts +6 -4
- package/dist/charts/funnel.js +16 -17
- package/dist/charts/funnel.js.map +1 -1
- package/dist/charts/gauge.d.ts +6 -3
- package/dist/charts/gauge.js +18 -17
- package/dist/charts/gauge.js.map +1 -1
- package/dist/charts/grouped-bar.d.ts +8 -4
- package/dist/charts/grouped-bar.js +36 -29
- package/dist/charts/grouped-bar.js.map +1 -1
- package/dist/charts/heatmap-calendar.d.ts +11 -5
- package/dist/charts/heatmap-calendar.js +25 -20
- package/dist/charts/heatmap-calendar.js.map +1 -1
- package/dist/charts/item-list.d.ts +9 -7
- package/dist/charts/item-list.js +1 -5
- package/dist/charts/item-list.js.map +1 -1
- package/dist/charts/legend.d.ts +7 -0
- package/dist/charts/legend.js +56 -0
- package/dist/charts/legend.js.map +1 -0
- package/dist/charts/line.d.ts +7 -4
- package/dist/charts/line.js +33 -41
- package/dist/charts/line.js.map +1 -1
- package/dist/charts/palette.d.ts +3 -2
- package/dist/charts/palette.js.map +1 -1
- package/dist/charts/radar.d.ts +6 -4
- package/dist/charts/radar.js +18 -18
- package/dist/charts/radar.js.map +1 -1
- package/dist/charts/sample.d.ts +8 -42
- package/dist/charts/sample.js.map +1 -1
- package/dist/charts/sankey.d.ts +5 -4
- package/dist/charts/sankey.js +15 -16
- package/dist/charts/sankey.js.map +1 -1
- package/dist/charts/series.d.ts +48 -0
- package/dist/charts/series.js +19 -0
- package/dist/charts/series.js.map +1 -0
- package/dist/charts/slot-bar.d.ts +12 -5
- package/dist/charts/slot-bar.js +27 -22
- package/dist/charts/slot-bar.js.map +1 -1
- package/dist/charts/sparkline.d.ts +6 -4
- package/dist/charts/sparkline.js +12 -11
- package/dist/charts/sparkline.js.map +1 -1
- package/dist/charts/stacked-bar.d.ts +8 -4
- package/dist/charts/stacked-bar.js +40 -37
- package/dist/charts/stacked-bar.js.map +1 -1
- package/dist/charts/stat-card.d.ts +7 -5
- package/dist/charts/stat-card.js +1 -1
- package/dist/charts/stat-card.js.map +1 -1
- package/dist/charts/timeline.d.ts +15 -8
- package/dist/charts/timeline.js +9 -14
- package/dist/charts/timeline.js.map +1 -1
- package/dist/charts/timeseries.d.ts +6 -4
- package/dist/charts/timeseries.js +4 -3
- package/dist/charts/timeseries.js.map +1 -1
- package/dist/charts/tooltip.d.ts +16 -0
- package/dist/charts/tooltip.js +105 -0
- package/dist/charts/tooltip.js.map +1 -0
- package/dist/components/confirm-dialog.d.ts +5 -1
- package/dist/components/confirm-dialog.js +52 -25
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/delete-resource.d.ts +5 -0
- package/dist/components/delete-resource.js +38 -0
- package/dist/components/delete-resource.js.map +1 -0
- package/dist/components/loading-screen.js +9 -5
- package/dist/components/loading-screen.js.map +1 -1
- package/dist/components/resource-list.d.ts +10 -0
- package/dist/components/resource-list.js +30 -0
- package/dist/components/resource-list.js.map +1 -0
- package/dist/providers/accent.d.ts +22 -0
- package/dist/providers/accent.js +110 -0
- package/dist/providers/accent.js.map +1 -0
- package/dist/styles/standalone.css +5 -19
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accent.js","names":[],"sources":["../../src/providers/accent.tsx"],"sourcesContent":["import {\n\tcreateContext,\n\ttype ReactNode,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseSyncExternalStore,\n} from \"react\";\n\nexport type AccentSwatch = {\n\tid: string;\n\tlabel: string;\n\tlight: string;\n\tdark: string;\n\tforeground: string;\n};\n\nexport const ACCENT_SWATCHES: readonly AccentSwatch[] = [\n\t{ id: \"blue\", label: \"Blue\", light: \"217 80% 36%\", dark: \"217 80% 38%\", foreground: \"0 0% 100%\" },\n\t{ id: \"teal\", label: \"Teal\", light: \"186 72% 28%\", dark: \"186 72% 32%\", foreground: \"0 0% 100%\" },\n\t{\n\t\tid: \"green\",\n\t\tlabel: \"Green\",\n\t\tlight: \"142 64% 28%\",\n\t\tdark: \"142 64% 32%\",\n\t\tforeground: \"0 0% 100%\",\n\t},\n\t{ id: \"amber\", label: \"Amber\", light: \"38 88% 44%\", dark: \"38 88% 56%\", foreground: \"0 0% 10%\" },\n\t{\n\t\tid: \"orange\",\n\t\tlabel: \"Orange\",\n\t\tlight: \"24 86% 36%\",\n\t\tdark: \"24 86% 38%\",\n\t\tforeground: \"0 0% 100%\",\n\t},\n\t{ id: \"rose\", label: \"Rose\", light: \"340 72% 36%\", dark: \"340 72% 38%\", foreground: \"0 0% 100%\" },\n\t{\n\t\tid: \"purple\",\n\t\tlabel: \"Purple\",\n\t\tlight: \"270 52% 36%\",\n\t\tdark: \"270 52% 38%\",\n\t\tforeground: \"0 0% 100%\",\n\t},\n\t{\n\t\tid: \"indigo\",\n\t\tlabel: \"Indigo\",\n\t\tlight: \"250 52% 36%\",\n\t\tdark: \"250 52% 38%\",\n\t\tforeground: \"0 0% 100%\",\n\t},\n] as const;\n\nexport const DEFAULT_ACCENT_ID = \"blue\";\nconst STORAGE_KEY = \"basalt-accent\";\n\ntype AccentContextValue = {\n\taccent: string;\n\tsetAccent: (id: string) => void;\n\tswatches: readonly AccentSwatch[];\n};\n\nconst AccentContext = createContext<AccentContextValue | null>(null);\n\nexport function accentSwatchById(id: string | null | undefined): AccentSwatch {\n\treturn ACCENT_SWATCHES.find((swatch) => swatch.id === id) ?? ACCENT_SWATCHES[0];\n}\n\nexport function applyAccent(id: string, dark = false) {\n\tconst swatch = accentSwatchById(id);\n\tconst value = dark ? swatch.dark : swatch.light;\n\tconst root = document.documentElement;\n\troot.style.setProperty(\"--basalt-primary\", value);\n\troot.style.setProperty(\"--basalt-primary-foreground\", swatch.foreground);\n\troot.style.setProperty(\"--basalt-ring\", value);\n\troot.style.setProperty(\"--basalt-chart-1\", value);\n\troot.dataset.accent = swatch.id;\n}\n\nfunction readAccent(): string {\n\treturn accentSwatchById(window.localStorage.getItem(STORAGE_KEY)).id;\n}\n\nfunction subscribe(onStoreChange: () => void) {\n\twindow.addEventListener(\"storage\", onStoreChange);\n\treturn () => window.removeEventListener(\"storage\", onStoreChange);\n}\n\nfunction isDarkMode(): boolean {\n\treturn document.documentElement.classList.contains(\"dark\");\n}\n\nexport function AccentProvider({ children }: { children: ReactNode }) {\n\tconst accent = useSyncExternalStore(subscribe, readAccent, () => DEFAULT_ACCENT_ID);\n\tuseEffect(() => {\n\t\tapplyAccent(accent, isDarkMode());\n\t\tconst observer = new MutationObserver(() => applyAccent(accent, isDarkMode()));\n\t\tobserver.observe(document.documentElement, { attributes: true, attributeFilter: [\"class\"] });\n\t\treturn () => observer.disconnect();\n\t}, [accent]);\n\tconst setAccent = useCallback((id: string) => {\n\t\tconst next = accentSwatchById(id).id;\n\t\twindow.localStorage.setItem(STORAGE_KEY, next);\n\t\tapplyAccent(next, isDarkMode());\n\t\twindow.dispatchEvent(new Event(\"storage\"));\n\t}, []);\n\tconst value = useMemo(\n\t\t() => ({ accent, setAccent, swatches: ACCENT_SWATCHES }),\n\t\t[accent, setAccent],\n\t);\n\treturn <AccentContext.Provider value={value}>{children}</AccentContext.Provider>;\n}\n\nexport function useAccent() {\n\tconst ctx = useContext(AccentContext);\n\tif (!ctx) {\n\t\tthrow new Error(\"useAccent must be used within AccentProvider\");\n\t}\n\treturn ctx;\n}\n"],"mappings":";;;;AAkBA,IAAa,IAA2C;CACvD;EAAE,IAAI;EAAQ,OAAO;EAAQ,OAAO;EAAe,MAAM;EAAe,YAAY;CAAY;CAChG;EAAE,IAAI;EAAQ,OAAO;EAAQ,OAAO;EAAe,MAAM;EAAe,YAAY;CAAY;CAChG;EACC,IAAI;EACJ,OAAO;EACP,OAAO;EACP,MAAM;EACN,YAAY;CACb;CACA;EAAE,IAAI;EAAS,OAAO;EAAS,OAAO;EAAc,MAAM;EAAc,YAAY;CAAW;CAC/F;EACC,IAAI;EACJ,OAAO;EACP,OAAO;EACP,MAAM;EACN,YAAY;CACb;CACA;EAAE,IAAI;EAAQ,OAAO;EAAQ,OAAO;EAAe,MAAM;EAAe,YAAY;CAAY;CAChG;EACC,IAAI;EACJ,OAAO;EACP,OAAO;EACP,MAAM;EACN,YAAY;CACb;CACA;EACC,IAAI;EACJ,OAAO;EACP,OAAO;EACP,MAAM;EACN,YAAY;CACb;AACD,GAEa,IAAoB,QAC3B,IAAc,iBAQd,IAAgB,EAAyC,IAAI;AAEnE,SAAgB,EAAiB,GAA6C;CAC7E,OAAO,EAAgB,MAAM,MAAW,EAAO,OAAO,CAAE,KAAK,EAAgB;AAC9E;AAEA,SAAgB,EAAY,GAAY,IAAO,IAAO;CACrD,IAAM,IAAS,EAAiB,CAAE,GAC5B,IAAQ,IAAO,EAAO,OAAO,EAAO,OACpC,IAAO,SAAS;CAKtB,AAJ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,8CAA8C;CAE/D,OAAO;AACR"}
|
|
@@ -329,9 +329,6 @@
|
|
|
329
329
|
.inset-0 {
|
|
330
330
|
inset: 0px;
|
|
331
331
|
}
|
|
332
|
-
.inset-\[-4px\] {
|
|
333
|
-
inset: -4px;
|
|
334
|
-
}
|
|
335
332
|
.inset-x-0 {
|
|
336
333
|
inset-inline: 0px;
|
|
337
334
|
}
|
|
@@ -496,15 +493,9 @@
|
|
|
496
493
|
.h-14 {
|
|
497
494
|
height: calc(var(--spacing) * 14);
|
|
498
495
|
}
|
|
499
|
-
.h-28 {
|
|
500
|
-
height: calc(var(--spacing) * 28);
|
|
501
|
-
}
|
|
502
496
|
.h-36 {
|
|
503
497
|
height: calc(var(--spacing) * 36);
|
|
504
498
|
}
|
|
505
|
-
.h-72 {
|
|
506
|
-
height: calc(var(--spacing) * 72);
|
|
507
|
-
}
|
|
508
499
|
.h-80 {
|
|
509
500
|
height: calc(var(--spacing) * 80);
|
|
510
501
|
}
|
|
@@ -595,9 +586,6 @@
|
|
|
595
586
|
.w-64 {
|
|
596
587
|
width: calc(var(--spacing) * 64);
|
|
597
588
|
}
|
|
598
|
-
.w-72 {
|
|
599
|
-
width: calc(var(--spacing) * 72);
|
|
600
|
-
}
|
|
601
589
|
.w-80 {
|
|
602
590
|
width: calc(var(--spacing) * 80);
|
|
603
591
|
}
|
|
@@ -773,6 +761,11 @@
|
|
|
773
761
|
margin-block-start: calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));
|
|
774
762
|
margin-block-end: calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)));
|
|
775
763
|
}
|
|
764
|
+
:where(.space-y-4 > :not(:last-child)) {
|
|
765
|
+
--tw-space-y-reverse: 0;
|
|
766
|
+
margin-block-start: calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));
|
|
767
|
+
margin-block-end: calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)));
|
|
768
|
+
}
|
|
776
769
|
.self-stretch {
|
|
777
770
|
align-self: stretch;
|
|
778
771
|
}
|
|
@@ -846,10 +839,6 @@
|
|
|
846
839
|
border-style: var(--tw-border-style);
|
|
847
840
|
border-width: 2px;
|
|
848
841
|
}
|
|
849
|
-
.border-\[3px\] {
|
|
850
|
-
border-style: var(--tw-border-style);
|
|
851
|
-
border-width: 3px;
|
|
852
|
-
}
|
|
853
842
|
.border-t {
|
|
854
843
|
border-top-style: var(--tw-border-style);
|
|
855
844
|
border-top-width: 1px;
|
|
@@ -883,9 +872,6 @@
|
|
|
883
872
|
.border-transparent {
|
|
884
873
|
border-color: transparent;
|
|
885
874
|
}
|
|
886
|
-
.border-t-basalt-primary {
|
|
887
|
-
border-top-color: hsl(var(--basalt-primary));
|
|
888
|
-
}
|
|
889
875
|
.border-t-transparent {
|
|
890
876
|
border-top-color: transparent;
|
|
891
877
|
}
|