@peerproblem/sw3-ui 0.0.0-stage → 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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -2
  3. package/agent/components/accordion.md +95 -0
  4. package/agent/components/action-square.md +106 -0
  5. package/agent/components/agent-bridge.md +87 -0
  6. package/agent/components/agent-console.md +123 -0
  7. package/agent/components/alert-dialog.md +82 -0
  8. package/agent/components/app-shell.md +105 -0
  9. package/agent/components/area-chart.md +56 -0
  10. package/agent/components/async-options.md +47 -0
  11. package/agent/components/autocomplete.md +69 -0
  12. package/agent/components/avatar.md +88 -0
  13. package/agent/components/badge.md +51 -0
  14. package/agent/components/bar-chart.md +56 -0
  15. package/agent/components/bar-list.md +49 -0
  16. package/agent/components/breadcrumbs.md +43 -0
  17. package/agent/components/button.md +109 -0
  18. package/agent/components/calendar.md +114 -0
  19. package/agent/components/canvas.md +105 -0
  20. package/agent/components/card.md +78 -0
  21. package/agent/components/carousel.md +113 -0
  22. package/agent/components/chart-card.md +41 -0
  23. package/agent/components/chart-surface.md +56 -0
  24. package/agent/components/checkbox.md +88 -0
  25. package/agent/components/citation-chip.md +61 -0
  26. package/agent/components/collapsible.md +69 -0
  27. package/agent/components/color-picker.md +82 -0
  28. package/agent/components/combobox.md +104 -0
  29. package/agent/components/command.md +92 -0
  30. package/agent/components/dashboard-grid.md +73 -0
  31. package/agent/components/date-input.md +87 -0
  32. package/agent/components/date-picker.md +122 -0
  33. package/agent/components/dialog.md +97 -0
  34. package/agent/components/donut-chart.md +50 -0
  35. package/agent/components/drawer.md +101 -0
  36. package/agent/components/empty-state.md +52 -0
  37. package/agent/components/field.md +80 -0
  38. package/agent/components/file-input.md +84 -0
  39. package/agent/components/hover-card.md +64 -0
  40. package/agent/components/image-cropper.md +77 -0
  41. package/agent/components/input.md +49 -0
  42. package/agent/components/label.md +53 -0
  43. package/agent/components/line-chart.md +60 -0
  44. package/agent/components/listbox.md +84 -0
  45. package/agent/components/map-view.md +104 -0
  46. package/agent/components/menu.md +117 -0
  47. package/agent/components/menubar.md +67 -0
  48. package/agent/components/meter.md +59 -0
  49. package/agent/components/navigation-menu.md +98 -0
  50. package/agent/components/number-input.md +81 -0
  51. package/agent/components/otp-input.md +67 -0
  52. package/agent/components/pagination.md +80 -0
  53. package/agent/components/password-input.md +67 -0
  54. package/agent/components/pill-button.md +116 -0
  55. package/agent/components/popover.md +85 -0
  56. package/agent/components/poster-card.md +61 -0
  57. package/agent/components/preferences.md +92 -0
  58. package/agent/components/progress.md +63 -0
  59. package/agent/components/provider.md +47 -0
  60. package/agent/components/radio.md +91 -0
  61. package/agent/components/rating.md +66 -0
  62. package/agent/components/reorder.md +61 -0
  63. package/agent/components/resizable.md +87 -0
  64. package/agent/components/scatter-chart.md +49 -0
  65. package/agent/components/scroll-area.md +81 -0
  66. package/agent/components/segmented-control.md +56 -0
  67. package/agent/components/select.md +130 -0
  68. package/agent/components/separator.md +60 -0
  69. package/agent/components/shortcuts.md +50 -0
  70. package/agent/components/sidebar-nav.md +68 -0
  71. package/agent/components/skeleton.md +58 -0
  72. package/agent/components/slider.md +79 -0
  73. package/agent/components/sparkline.md +39 -0
  74. package/agent/components/squircle.md +58 -0
  75. package/agent/components/stat.md +58 -0
  76. package/agent/components/switch.md +48 -0
  77. package/agent/components/table.md +58 -0
  78. package/agent/components/tabs.md +108 -0
  79. package/agent/components/textarea.md +68 -0
  80. package/agent/components/time-input.md +84 -0
  81. package/agent/components/timeline.md +91 -0
  82. package/agent/components/toast.md +85 -0
  83. package/agent/components/toggle.md +76 -0
  84. package/agent/components/token-input.md +66 -0
  85. package/agent/components/toolbar.md +76 -0
  86. package/agent/components/tooltip.md +83 -0
  87. package/agent/components/tracker.md +47 -0
  88. package/agent/components/tree.md +87 -0
  89. package/agent/components/treemap.md +72 -0
  90. package/agent/components/trend-chart.md +80 -0
  91. package/agent/components/trigger-menu.md +67 -0
  92. package/agent/components/typography.md +51 -0
  93. package/agent/components/waterfall.md +78 -0
  94. package/agent/components/week-schedule.md +113 -0
  95. package/agent/llms/actions-and-layout.txt +1749 -0
  96. package/agent/llms/agents.txt +505 -0
  97. package/agent/llms/charts.txt +778 -0
  98. package/agent/llms/dashboards.txt +457 -0
  99. package/agent/llms/extend.txt +132 -0
  100. package/agent/llms/extras.txt +527 -0
  101. package/agent/llms/forms.txt +2152 -0
  102. package/agent/llms/foundations.txt +674 -0
  103. package/agent/llms/hooks.txt +178 -0
  104. package/agent/llms/maps.txt +229 -0
  105. package/agent/llms/overlays-and-navigation.txt +1167 -0
  106. package/agent/llms-full.txt +8717 -0
  107. package/agent/llms.txt +145 -0
  108. package/agent/registry.json +11289 -0
  109. package/agent/tokens.md +66 -0
  110. package/dist/agent/index.d.ts +235 -0
  111. package/dist/agent/index.js +21 -0
  112. package/dist/card-Ipm-Cj5f.d.ts +490 -0
  113. package/dist/charts/index.d.ts +289 -0
  114. package/dist/charts/index.js +815 -0
  115. package/dist/check/cli.d.ts +1 -0
  116. package/dist/check/cli.js +48 -0
  117. package/dist/check/rendered.d.ts +11 -0
  118. package/dist/check/rendered.js +77 -0
  119. package/dist/check/source.d.ts +13 -0
  120. package/dist/check/source.js +182 -0
  121. package/dist/chunk-3DXBM65D.js +65 -0
  122. package/dist/chunk-3H5X4ZP6.js +55 -0
  123. package/dist/chunk-6XC4BC5C.js +92 -0
  124. package/dist/chunk-7H6TEAWD.js +507 -0
  125. package/dist/chunk-I63ZTJOI.js +1089 -0
  126. package/dist/chunk-JCIRUM4W.js +33 -0
  127. package/dist/chunk-LTBEHZ3P.js +25 -0
  128. package/dist/chunk-QDPPLO4U.js +60 -0
  129. package/dist/chunk-U2XFBPU4.js +56 -0
  130. package/dist/chunk-UY2WH5AY.js +681 -0
  131. package/dist/extras.d.ts +203 -0
  132. package/dist/extras.js +904 -0
  133. package/dist/icons-BJiGEAnU.d.ts +68 -0
  134. package/dist/index.d.ts +3737 -0
  135. package/dist/index.js +14477 -0
  136. package/dist/map/index.d.ts +115 -0
  137. package/dist/map/index.js +394 -0
  138. package/dist/meta/index.d.ts +3314 -0
  139. package/dist/meta/index.js +5106 -0
  140. package/dist/rules-1RIZ_JZr.d.ts +38 -0
  141. package/dist/styles.css +4037 -0
  142. package/dist/themes/calm.css +42 -0
  143. package/dist/themes/frost.css +40 -0
  144. package/package.json +142 -4
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+
3
+ // src/agent/binding.ts
4
+ import { useEffect, useRef } from "react";
5
+ var agentRegistry = /* @__PURE__ */ new Set();
6
+ var acting = 0;
7
+ var isAgentChange = () => acting > 0;
8
+ async function runAsAgent(fn) {
9
+ acting++;
10
+ try {
11
+ return await fn();
12
+ } finally {
13
+ acting--;
14
+ }
15
+ }
16
+ function useAgentBinding(ref, spec) {
17
+ const latest = useRef(spec);
18
+ latest.current = spec;
19
+ useEffect(() => {
20
+ const entry = { element: () => ref.current, spec: () => latest.current };
21
+ agentRegistry.add(entry);
22
+ return () => {
23
+ agentRegistry.delete(entry);
24
+ };
25
+ }, [ref]);
26
+ }
27
+
28
+ export {
29
+ agentRegistry,
30
+ isAgentChange,
31
+ runAsAgent,
32
+ useAgentBinding
33
+ };
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+
3
+ // src/primitives/variants.ts
4
+ function defineVariants(config) {
5
+ const keys = Object.keys(config.variants);
6
+ const resolve = (props) => {
7
+ const out = {};
8
+ for (const key of keys) out[key] = props[key] ?? config.defaults[key];
9
+ return out;
10
+ };
11
+ return {
12
+ schema: { name: config.name, variants: config.variants, defaults: config.defaults, cssVars: config.cssVars ?? {} },
13
+ resolve,
14
+ attrs(props) {
15
+ const values = resolve(props);
16
+ const out = { "data-sw": config.name };
17
+ for (const key of keys) out[`data-${key}`] = String(values[key]);
18
+ return out;
19
+ }
20
+ };
21
+ }
22
+
23
+ export {
24
+ defineVariants
25
+ };
@@ -0,0 +1,60 @@
1
+ 'use client';
2
+ import {
3
+ defineVariants
4
+ } from "./chunk-LTBEHZ3P.js";
5
+
6
+ // src/recipes/actions.ts
7
+ var actionSquareRecipe = defineVariants({
8
+ name: "action-square",
9
+ variants: {
10
+ /** light = pale tile on light media · ink = dark tile (Close) · glass = translucent on dark/photo */
11
+ tone: ["light", "ink", "glass"],
12
+ /** md = 48px tile · lg = 60px tile */
13
+ size: ["md", "lg"]
14
+ },
15
+ defaults: { tone: "light", size: "md" },
16
+ // Per-tone overrides for themes: --sw-action-square-<tone>-tile-bg, -tile-bg-hover, -tile-bg-active, -tile-fg, -fg.
17
+ cssVars: {
18
+ "--sw-action-square-tile-size": "Tile width and height.",
19
+ "--sw-action-square-tile-bg": "Tile fill.",
20
+ "--sw-action-square-tile-border": "Tile 1px frame (light tone: --sw-frame; ink and glass: none).",
21
+ "--sw-action-square-tile-bg-hover": "Tile fill on hover.",
22
+ "--sw-action-square-tile-bg-active": "Tile fill while pressed.",
23
+ "--sw-action-square-tile-fg": "Icon color.",
24
+ "--sw-action-square-fg": "Label color.",
25
+ "--sw-action-square-gap": "Space between label and tile.",
26
+ "--sw-action-square-font-size": "Label size."
27
+ }
28
+ });
29
+ var pillButtonRecipe = defineVariants({
30
+ name: "pill-button",
31
+ variants: {
32
+ /**
33
+ * night = raised grey on near-black · ink = black on light · soft = muted fill on light ·
34
+ * glass = 50% white + blur over imagery, turns black on hover
35
+ */
36
+ tone: ["night", "ink", "soft", "glass"],
37
+ /** sm = 36px · md = 48px · lg = 60px · fluid = 48→100px with the viewport (hero navigation) */
38
+ size: ["sm", "md", "lg", "fluid"]
39
+ },
40
+ defaults: { tone: "night", size: "lg" },
41
+ // Per-tone overrides for themes: --sw-pill-button-<tone>-bg, -bg-hover, -fg, -fg-hover, -blur.
42
+ cssVars: {
43
+ "--sw-pill-button-bg": "Fill.",
44
+ "--sw-pill-button-bg-hover": "Fill on hover, and while aria-expanded / aria-pressed is true.",
45
+ "--sw-pill-button-fg": "Text and icon color.",
46
+ "--sw-pill-button-fg-hover": "Text color on hover / active.",
47
+ "--sw-pill-button-height": "Height.",
48
+ "--sw-pill-button-padding-x": "Horizontal padding.",
49
+ "--sw-pill-button-radius": "Corner radius. 999px = full pill.",
50
+ "--sw-pill-button-font-size": "Label size.",
51
+ "--sw-pill-button-font-weight": "Label weight.",
52
+ "--sw-pill-button-gap": "Space between icon and label.",
53
+ "--sw-pill-button-blur": "Backdrop blur (5px on glass)."
54
+ }
55
+ });
56
+
57
+ export {
58
+ actionSquareRecipe,
59
+ pillButtonRecipe
60
+ };
@@ -0,0 +1,56 @@
1
+ 'use client';
2
+ import {
3
+ SquircleLayers,
4
+ cx,
5
+ mergeRefs,
6
+ press,
7
+ useSquircle
8
+ } from "./chunk-UY2WH5AY.js";
9
+
10
+ // src/components/button.tsx
11
+ import { forwardRef } from "react";
12
+ import { motion } from "motion/react";
13
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ var defaultRadius = { "2xs": 4, xs: "xs", sm: "xs", md: "sm", lg: "md", xl: "lg" };
15
+ var Button = forwardRef(function Button2({ variant = "primary", size = "md", radius, smoothing, leading, trailing, iconOnly, loading, fullWidth, href, target, rel, className, children, disabled, ...rest }, ref) {
16
+ const sq = useSquircle({ radius: radius ?? defaultRadius[size], smoothing });
17
+ const squareIcon = iconOnly && !fullWidth && children == null && Boolean(leading) !== Boolean(trailing);
18
+ const common = {
19
+ "data-sw": "button",
20
+ "data-variant": variant,
21
+ "data-size": size,
22
+ "data-icon-only": squareIcon ? "" : void 0,
23
+ "data-loading": loading ? "" : void 0,
24
+ className: cx("sw-button sw-sq", fullWidth && "sw-button--full", className),
25
+ ...disabled || loading ? {} : press
26
+ };
27
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ /* @__PURE__ */ jsx(SquircleLayers, { paths: sq.paths, radius: sq.radius, ringOffset: sq.ringOffset, borderWidth: variant === "outline" ? 1 : 0 }),
29
+ loading ? /* @__PURE__ */ jsx("span", { className: "sw-button__spinner", "aria-hidden": true }) : leading && /* @__PURE__ */ jsx("span", { className: "sw-button__icon", children: leading }),
30
+ children != null && /* @__PURE__ */ jsx("span", { className: "sw-button__label", children }),
31
+ trailing && !(squareIcon && loading) && /* @__PURE__ */ jsx("span", { className: "sw-button__icon sw-button__icon--trailing", children: trailing })
32
+ ] });
33
+ if (href) {
34
+ return /* @__PURE__ */ jsx(motion.a, { ref: mergeRefs(ref, sq.ref), href, target, rel, ...common, ...rest, children: inner });
35
+ }
36
+ return /* @__PURE__ */ jsx(
37
+ motion.button,
38
+ {
39
+ ref: mergeRefs(ref, sq.ref),
40
+ type: "button",
41
+ disabled: disabled || loading,
42
+ "aria-busy": loading || void 0,
43
+ ...common,
44
+ ...rest,
45
+ children: inner
46
+ }
47
+ );
48
+ });
49
+ function ArrowIcon() {
50
+ return /* @__PURE__ */ jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M5 12h14M13 6l6 6-6 6" }) });
51
+ }
52
+
53
+ export {
54
+ Button,
55
+ ArrowIcon
56
+ };