@snap-rail/ui 0.1.1 → 0.3.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.
Files changed (45) hide show
  1. package/lib/charts.js +12 -5
  2. package/lib/components/index.js +2195 -0
  3. package/lib/contract.js +138 -62
  4. package/lib/fallback.js +21 -4
  5. package/lib/index.js +4287 -261
  6. package/lib/runtime.js +206 -77
  7. package/lib/settings-pages/index.js +1326 -0
  8. package/lib/settings.js +122 -72
  9. package/lib/types/charts.d.ts +1 -1
  10. package/lib/types/charts.js +5 -5
  11. package/lib/types/components/alert.d.ts +57 -0
  12. package/lib/types/components/alert.js +46 -0
  13. package/lib/types/components/button.js +2 -2
  14. package/lib/types/components/combobox.d.ts +45 -0
  15. package/lib/types/components/combobox.js +108 -0
  16. package/lib/types/components/controls.d.ts +74 -11
  17. package/lib/types/components/controls.js +67 -24
  18. package/lib/types/components/dialog.js +1 -1
  19. package/lib/types/components/form-rhf.d.ts +56 -0
  20. package/lib/types/components/form-rhf.js +74 -0
  21. package/lib/types/components/form.d.ts +33 -5
  22. package/lib/types/components/form.js +22 -6
  23. package/lib/types/components/index.d.ts +8 -0
  24. package/lib/types/components/index.js +8 -0
  25. package/lib/types/components/input.d.ts +11 -5
  26. package/lib/types/components/input.js +34 -7
  27. package/lib/types/components/layout.d.ts +28 -6
  28. package/lib/types/components/layout.js +86 -13
  29. package/lib/types/components/overlay.d.ts +110 -0
  30. package/lib/types/components/overlay.js +185 -0
  31. package/lib/types/components/schema-form.d.ts +3 -1
  32. package/lib/types/components/schema-form.js +46 -40
  33. package/lib/types/components/slider.d.ts +18 -0
  34. package/lib/types/components/slider.js +15 -0
  35. package/lib/types/components/surface.js +12 -12
  36. package/lib/types/contract.d.ts +55 -30
  37. package/lib/types/contract.js +55 -30
  38. package/lib/types/runtime.js +3 -2
  39. package/lib/types/settings-pages/appearance.js +2 -2
  40. package/lib/types/settings-pages/plugins.js +2 -2
  41. package/lib/types/utils.d.ts +7 -1
  42. package/lib/types/utils.js +7 -1
  43. package/package.json +14 -7
  44. package/src/styles/base.css +315 -5
  45. package/src/styles/default.css +194 -6
package/lib/charts.js CHANGED
@@ -11,7 +11,13 @@ import { createContext, useContext, useSyncExternalStore } from "react";
11
11
  function cn(...values) {
12
12
  return values.filter((value) => typeof value === "string" && value.length > 0).join(" ");
13
13
  }
14
- /** The anatomy attributes every semantic component renders. */
14
+ /**
15
+ * The anatomy attributes every semantic component renders. The identity is
16
+ * component-owned: components spread these AFTER caller props so a composite
17
+ * can never mask a host part (a masked `button.root` loses every skin rule
18
+ * and falls back to the UA default look). Composites tag their own wrappers
19
+ * instead of pushing `part()` into a child component's props.
20
+ */
15
21
  function part(component, name) {
16
22
  return {
17
23
  "data-snap-component": component,
@@ -50,6 +56,7 @@ function ChartFrame({ title, description, actions, state = "ready", empty, error
50
56
  ...part("chart-frame", "title"),
51
57
  children: title
52
58
  }), description !== void 0 && jsx("div", {
59
+ ...part("chart-frame", "description"),
53
60
  className: "snap-chart-frame-description",
54
61
  children: description
55
62
  })] }), actions !== void 0 && jsx("div", {
@@ -61,20 +68,20 @@ function ChartFrame({ title, description, actions, state = "ready", empty, error
61
68
  className: "snap-chart-frame-body",
62
69
  "data-state": state,
63
70
  children: state === "loading" ? loading ?? jsx("div", {
64
- ...part("visualization", "loading"),
71
+ ...part("chart-frame", "loading"),
65
72
  children: "加载中…"
66
73
  }) : state === "empty" ? empty ?? jsx("div", {
67
- ...part("visualization", "empty"),
74
+ ...part("chart-frame", "empty"),
68
75
  children: "暂无数据"
69
76
  }) : state === "error" ? error ?? jsx("div", {
70
- ...part("visualization", "error"),
77
+ ...part("chart-frame", "error"),
71
78
  role: "alert",
72
79
  children: "图表加载失败"
73
80
  }) : children
74
81
  })]
75
82
  });
76
83
  }
77
- /** A chart frame that exposes the `visualization.*` anatomy as well. */
84
+ /** An alias of {@link ChartFrame} for pages that prefer the generic name. */
78
85
  function Visualization(props) {
79
86
  return jsx(ChartFrame, { ...props });
80
87
  }