@stacksjs/components 0.2.990 → 0.2.997

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 (95) hide show
  1. package/dist/ApiOperation-369y1zgt.stx +114 -0
  2. package/dist/ApiReference-ww45jj32.stx +92 -0
  3. package/dist/ApiSchema-dsx4tsv4.stx +47 -0
  4. package/dist/AreaChart-8fy34adp.stx +77 -0
  5. package/dist/BarChart-4xdrjhhn.stx +77 -0
  6. package/dist/{Combobox-9n04ec5w.stx → Combobox-fgbpxbty.stx} +174 -5
  7. package/dist/ComboboxOptions-sfkc98a9.stx +36 -0
  8. package/dist/{CommandPalette-cj6pe5ph.stx → CommandPalette-sf03s7b2.stx} +3 -1
  9. package/dist/LineChart-ctebkkm8.stx +77 -0
  10. package/dist/{List-5ey6k813.stx → List-mjkged1z.stx} +1 -1
  11. package/dist/{Notification-b3cz24f0.stx → Notification-1pvt347q.stx} +16 -4
  12. package/dist/{Popover-jjt7p7sn.stx → Popover-gntg33xd.stx} +1 -1
  13. package/dist/PricingPlan-h7jt2696.stx +67 -0
  14. package/dist/PricingTable-v3vdn6av.stx +149 -0
  15. package/dist/SecretField-q2xgth94.stx +219 -0
  16. package/dist/{Select-36s22z6d.stx → Select-yhmtvqcx.stx} +7 -4
  17. package/dist/Sparkline-gp859n4h.stx +29 -0
  18. package/dist/StatCard-gff0yx6b.stx +93 -0
  19. package/dist/StatGroup-e0d5dmt7.stx +17 -0
  20. package/dist/components/CodeBlock.d.ts +4 -1
  21. package/dist/components/CodeGroup.d.ts +34 -0
  22. package/dist/components/code-group.d.ts +19 -0
  23. package/dist/components/index.d.ts +2 -0
  24. package/dist/index.d.ts +13 -0
  25. package/dist/index.js +25 -22
  26. package/dist/ui/api-reference/ApiOperation.d.ts +17 -0
  27. package/dist/ui/api-reference/ApiReference.d.ts +28 -0
  28. package/dist/ui/api-reference/ApiSchema.d.ts +17 -0
  29. package/dist/ui/api-reference/index.d.ts +30 -0
  30. package/dist/ui/api-reference/openapi.d.ts +137 -0
  31. package/dist/ui/chart/AreaChart.d.ts +33 -0
  32. package/dist/ui/chart/BarChart.d.ts +33 -0
  33. package/dist/ui/chart/LineChart.d.ts +33 -0
  34. package/dist/ui/chart/Sparkline.d.ts +19 -0
  35. package/dist/ui/chart/core.d.ts +111 -0
  36. package/dist/ui/chart/index.d.ts +51 -0
  37. package/dist/ui/chart/interaction.d.ts +11 -0
  38. package/dist/ui/combobox/Combobox.d.ts +10 -1
  39. package/dist/ui/combobox/ComboboxOptions.d.ts +6 -0
  40. package/dist/ui/combobox/index.d.ts +7 -0
  41. package/dist/ui/command-palette/CommandPalette.d.ts +2 -0
  42. package/dist/ui/input/SecretField.d.ts +56 -0
  43. package/dist/ui/input/index.d.ts +21 -0
  44. package/dist/ui/notification/Notification.d.ts +2 -0
  45. package/dist/ui/pricing/PricingPlan.d.ts +21 -0
  46. package/dist/ui/pricing/PricingTable.d.ts +50 -0
  47. package/dist/ui/pricing/index.d.ts +38 -0
  48. package/dist/ui/pricing/pricing.d.ts +64 -0
  49. package/dist/ui/select/Select.d.ts +2 -0
  50. package/dist/ui/stat/StatCard.d.ts +42 -0
  51. package/dist/ui/stat/StatGroup.d.ts +12 -0
  52. package/dist/ui/stat/format.d.ts +37 -0
  53. package/dist/ui/stat/index.d.ts +23 -0
  54. package/package.json +3 -3
  55. package/src/components/CodeBlock.stx +4 -1
  56. package/src/components/CodeGroup.stx +217 -0
  57. package/src/components/code-group.ts +57 -0
  58. package/src/components/index.ts +2 -0
  59. package/src/index.ts +18 -0
  60. package/src/ui/api-reference/ApiOperation.stx +114 -0
  61. package/src/ui/api-reference/ApiReference.stx +92 -0
  62. package/src/ui/api-reference/ApiSchema.stx +47 -0
  63. package/src/ui/api-reference/README.md +44 -0
  64. package/src/ui/api-reference/index.ts +35 -0
  65. package/src/ui/api-reference/openapi.ts +825 -0
  66. package/src/ui/chart/AreaChart.stx +77 -0
  67. package/src/ui/chart/BarChart.stx +77 -0
  68. package/src/ui/chart/LineChart.stx +77 -0
  69. package/src/ui/chart/README.md +97 -0
  70. package/src/ui/chart/Sparkline.stx +29 -0
  71. package/src/ui/chart/core.ts +730 -0
  72. package/src/ui/chart/index.ts +71 -0
  73. package/src/ui/chart/interaction.ts +175 -0
  74. package/src/ui/combobox/Combobox.stx +174 -5
  75. package/src/ui/combobox/ComboboxOptions.stx +20 -0
  76. package/src/ui/combobox/README.md +41 -0
  77. package/src/ui/combobox/index.ts +13 -0
  78. package/src/ui/command-palette/CommandPalette.stx +3 -1
  79. package/src/ui/input/SecretField.stx +219 -0
  80. package/src/ui/input/index.ts +32 -0
  81. package/src/ui/list/List.stx +1 -1
  82. package/src/ui/notification/Notification.stx +16 -4
  83. package/src/ui/popover/Popover.stx +1 -1
  84. package/src/ui/pricing/PricingPlan.stx +67 -0
  85. package/src/ui/pricing/PricingTable.stx +149 -0
  86. package/src/ui/pricing/README.md +74 -0
  87. package/src/ui/pricing/index.ts +49 -0
  88. package/src/ui/pricing/pricing.ts +177 -0
  89. package/src/ui/select/Select.stx +7 -4
  90. package/src/ui/stat/README.md +60 -0
  91. package/src/ui/stat/StatCard.stx +93 -0
  92. package/src/ui/stat/StatGroup.stx +17 -0
  93. package/src/ui/stat/format.ts +147 -0
  94. package/src/ui/stat/index.ts +38 -0
  95. package/dist/ComboboxOptions-zhr9b6rx.stx +0 -16
@@ -0,0 +1,17 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare const __dtsx_component__: __DtsxStxComponentType;
3
+ /*
4
+ * <ApiOperation> (stacksjs/stx#2324): one operation from buildApiReference,
5
+ * as a section with its own anchor: method and path, summary, description,
6
+ * deprecation, the auth it needs, parameters, the request body, each response
7
+ * with its schema, and request examples in curl, JavaScript and Python as a
8
+ * CodeGroup, so the reader's language follows them across the page.
9
+ */
10
+ export declare const op: boolean;
11
+ export declare const syncKey: unknown;
12
+ export declare const className: unknown;
13
+ export declare const methodClasses: string;
14
+ export declare const groups: unknown;
15
+ export declare const statusTone: unknown;
16
+ declare type __DtsxStxComponentType = DefineComponent<{ operation?: unknown, syncKey?: string, className?: string }>;
17
+ export default __dtsx_component__;
@@ -0,0 +1,28 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare const __dtsx_component__: __DtsxStxComponentType;
3
+ /*
4
+ * <ApiReference> (stacksjs/stx#2324): a whole API reference from an OpenAPI
5
+ * 3.0 or 3.1 document, read at build time.
6
+ *
7
+ * <ApiReference spec="./openapi.json" />
8
+ *
9
+ * `spec` is a path (JSON or YAML), a URL, or the parsed document. Everything
10
+ * is rendered on the server: a table of contents, the authentication
11
+ * schemes, each tag's operations (<ApiOperation>) and every named schema
12
+ * (<ApiSchema>), each with a stable anchor. No script is needed to read it;
13
+ * the examples' language tabs are a CodeGroup.
14
+ *
15
+ * A document that does not validate throws an OpenApiError naming the
16
+ * offending path. It is a declared build failure (`stxBuildFailure`), so a
17
+ * static build or `build-views` stops with that message instead of writing
18
+ * the page without its reference; in development it is logged and the
19
+ * component renders a notice in its place.
20
+ */
21
+ export declare const reference: unknown;
22
+ export declare const syncKey: unknown;
23
+ export declare const showToc: unknown;
24
+ export declare const className: unknown;
25
+ /* The search index entries, for a docs site's search to read off the page (escaped as an attribute). */
26
+ export declare const searchJson: ReturnType<typeof JSON.stringify>;
27
+ declare type __DtsxStxComponentType = DefineComponent<{ spec?: unknown, baseUrl?: string, syncKey?: string, toc?: unknown, className?: string }>;
28
+ export default __dtsx_component__;
@@ -0,0 +1,17 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare const __dtsx_component__: __DtsxStxComponentType;
3
+ /*
4
+ * <ApiSchema> (stacksjs/stx#2324): a schema's fields as a table. Given a
5
+ * named `schema` from buildApiReference it is a section with its own anchor
6
+ * (`schema-<name>`); given only `rows` it is the table, as an operation's
7
+ * body and responses use it. A field whose type is a named schema links to
8
+ * that schema's section rather than expanding it again.
9
+ */
10
+ declare const named: boolean;
11
+ export declare const schema: unknown;
12
+ export declare const rows: unknown;
13
+ export declare const caption: unknown;
14
+ export declare const className: unknown;
15
+ export declare const indent: ReturnType<typeof rows.map>;
16
+ declare type __DtsxStxComponentType = DefineComponent<{ schema?: unknown, rows?: unknown, caption?: unknown, className?: string }>;
17
+ export default __dtsx_component__;
@@ -0,0 +1,30 @@
1
+ export declare interface ApiReferenceProps {
2
+ spec: string | Record<string, unknown>
3
+ baseUrl?: string
4
+ syncKey?: string
5
+ toc?: boolean
6
+ className?: string
7
+ }
8
+ export { default as ApiOperation } from './ApiOperation';
9
+ export { default as ApiReference } from './ApiReference';
10
+ export { default as ApiSchema } from './ApiSchema';
11
+ export {
12
+ type ApiBody,
13
+ type ApiOperation as ApiOperationModel,
14
+ type ApiParameter,
15
+ type ApiReferenceModel,
16
+ type ApiResponse,
17
+ type ApiSchema as ApiSchemaModel,
18
+ type ApiSecurityScheme,
19
+ type ApiTag,
20
+ buildApiReference,
21
+ exampleFor,
22
+ loadOpenApi,
23
+ OpenApiError,
24
+ parseOpenApiText,
25
+ requestExamples,
26
+ resolveRef,
27
+ type SchemaRow,
28
+ schemaRows,
29
+ validateOpenApi,
30
+ } from './openapi';
@@ -0,0 +1,137 @@
1
+ /** Parse JSON or YAML text. */
2
+ export declare function parseOpenApiText(text: string, source?: string): JsonObject;
3
+ /**
4
+ * Inline every `$ref` to another file (`./schemas/key.yaml#/Key`), relative
5
+ * to the document that holds it, so the rest of the renderer only ever meets
6
+ * local references. A file is read once; a cycle through files keeps its
7
+ * reference rather than recursing.
8
+ */
9
+ export declare function bundleExternalRefs(doc: JsonObject, location: string): Promise<JsonObject>;
10
+ /** Read a document from an object, a file path or a URL, at build time, and validate it. */
11
+ export declare function loadOpenApi(input: unknown): Promise<JsonObject>;
12
+ /** The checks a renderer depends on. Throws `OpenApiError` naming the first offending path. */
13
+ export declare function validateOpenApi(doc: unknown): asserts doc is JsonObject;
14
+ /** Follow a local `$ref` (`#/components/schemas/Key`). */
15
+ export declare function resolveRef(doc: JsonObject, node: unknown, at?: string): any;
16
+ export declare function slugify(value: string): string;
17
+ /**
18
+ * A schema as rows, depth-first. A named schema met below the top is one row
19
+ * linking to its own section, so a recursive or shared schema is never
20
+ * expanded twice; `maxDepth` bounds an anonymous one.
21
+ */
22
+ export declare function schemaRows(doc: JsonObject, raw: unknown, options?: { expandTopRef?: boolean, maxDepth?: number }): SchemaRow[];
23
+ /** An example value for a schema: its own example, else one made from its shape. */
24
+ export declare function exampleFor(doc: JsonObject, raw: unknown, depth?: number, seen?: unknown): unknown;
25
+ /** Request examples that include every required parameter and the auth the operation needs. */
26
+ export declare function requestExamples(op: Omit<ApiOperation, 'examples' | 'webhook'>, baseUrl: string, schemes: ApiSecurityScheme[]): NonNullable<ApiOperation['examples']>;
27
+ /** The whole reference, ready for a template. The document must already be valid (`loadOpenApi`). */
28
+ export declare function buildApiReference(doc: JsonObject, options?: { baseUrl?: string }): ApiReferenceModel;
29
+ declare const METHODS: readonly ['get', 'put', 'post', 'delete', 'options', 'head', 'patch', 'trace'];
30
+ export declare interface SchemaRow {
31
+ name: string
32
+ depth: number
33
+ type: string
34
+ required: boolean
35
+ description: string
36
+ notes: string[]
37
+ ref?: string
38
+ combinator?: 'oneOf' | 'anyOf' | 'allOf'
39
+ }
40
+ export declare interface ApiParameter {
41
+ name: string
42
+ in: 'query' | 'header' | 'path' | 'cookie'
43
+ required: boolean
44
+ type: string
45
+ description: string
46
+ deprecated: boolean
47
+ example?: unknown
48
+ }
49
+ export declare interface ApiBody {
50
+ mediaType: string
51
+ required: boolean
52
+ description: string
53
+ rows: SchemaRow[]
54
+ ref?: string
55
+ schema?: string
56
+ example: string
57
+ }
58
+ export declare interface ApiResponse {
59
+ status: string
60
+ description: string
61
+ mediaType: string
62
+ rows: SchemaRow[]
63
+ ref?: string
64
+ schema?: string
65
+ example: string
66
+ headers: Array<{ name: string, type: string, description: string, required: boolean }>
67
+ }
68
+ export declare interface ApiSecurityScheme {
69
+ name: string
70
+ anchor: string
71
+ type: string
72
+ summary: string
73
+ description: string
74
+ in?: string
75
+ paramName?: string
76
+ scheme?: string
77
+ }
78
+ export declare interface ApiOperation {
79
+ id: string
80
+ anchor: string
81
+ method: string
82
+ path: string
83
+ summary: string
84
+ description: string
85
+ deprecated: boolean
86
+ tag: string
87
+ parameters: ApiParameter[]
88
+ body: ApiBody | null
89
+ responses: ApiResponse[]
90
+ security: Array<Array<{ name: string, anchor: string, scopes: string[] }>>
91
+ examples: { curl: string, javascript: string, python: string } | null
92
+ webhook: boolean
93
+ }
94
+ export declare interface ApiTag {
95
+ name: string
96
+ anchor: string
97
+ description: string
98
+ operations: ApiOperation[]
99
+ }
100
+ export declare interface ApiSchema {
101
+ name: string
102
+ anchor: string
103
+ description: string
104
+ type: string
105
+ rows: SchemaRow[]
106
+ }
107
+ export declare interface ApiReferenceModel {
108
+ title: string
109
+ version: string
110
+ description: string
111
+ baseUrl: string
112
+ tags: ApiTag[]
113
+ schemas: ApiSchema[]
114
+ securitySchemes: ApiSecurityScheme[]
115
+ toc: Array<{ text: string, anchor: string, children: Array<{ text: string, anchor: string, method?: string }> }>
116
+ search: Array<{ title: string, anchor: string, text: string, kind: 'operation' | 'schema' | 'tag' }>
117
+ }
118
+ /**
119
+ * OpenAPI 3.0 / 3.1 to an API reference model (stacksjs/stx#2324).
120
+ *
121
+ * `loadOpenApi` reads a document (an object, a path to JSON or YAML, or a URL)
122
+ * and validates it, failing with a message that names the offending path.
123
+ * `buildApiReference` turns it into a model a template renders without any
124
+ * logic of its own: operations grouped by tag, parameters and bodies and
125
+ * responses with `$ref` resolved, schemas flattened to rows, the security each
126
+ * operation needs, request examples in curl, JavaScript and Python, stable
127
+ * anchors, a table of contents and search index entries.
128
+ *
129
+ * No dependency: YAML goes through Bun's own parser.
130
+ */
131
+ export type JsonObject = Record<string, any>;
132
+ declare type Method = typeof METHODS[number];
133
+ export declare class OpenApiError extends Error {
134
+ readonly path: string;
135
+ readonly stxBuildFailure: boolean;
136
+ constructor(path: string, message: string);
137
+ }
@@ -0,0 +1,33 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare const __dtsx_component__: __DtsxStxComponentType;
3
+ /*
4
+ * <AreaChart> (stacksjs/stx#2318). The SVG is drawn here, on the server, so
5
+ * the chart shows before any script runs; the client script only lays it out
6
+ * again at its real width and adds the crosshair, tooltip and keyboard.
7
+ *
8
+ * The data and the accessors stay on the server (`serverOnlyProps`): the
9
+ * client gets the prepared model, every label already formatted, so a
10
+ * `formatY` function works and the records are not shipped twice.
11
+ * @defaultValue `['data', 'x', 'y', 'series', 'formatX', 'formatY', 'colors', 'yDomain']`
12
+ */
13
+ export declare const serverOnlyProps: string[];
14
+ declare const chart: unknown;
15
+ export declare const label: unknown;
16
+ export declare const loading: ReturnType<typeof $bool>;
17
+ export declare const emptyText: unknown;
18
+ export declare const empty: unknown;
19
+ export declare const svg: unknown;
20
+ export declare const modelJson: unknown;
21
+ export declare const summary: unknown;
22
+ export declare const tableHead: unknown;
23
+ export declare const tableRows: unknown;
24
+ export declare const legend: unknown;
25
+ export declare const height: unknown;
26
+ export declare const chartId: unknown;
27
+ export declare const summaryId: string;
28
+ export declare const className: unknown;
29
+ export declare const figureClasses: unknown;
30
+ export declare const surfaceClasses: 'relative rounded-control outline-none focus-visible:ring-2 focus-visible:ring-accent';
31
+ export declare const tooltipClasses: 'pointer-events-none absolute top-2 z-10 min-w-32 rounded-panel bg-inverse px-3 py-2 text-xs text-inverse-ink shadow-lg';
32
+ declare type __DtsxStxComponentType = DefineComponent<{ label?: string, loading?: unknown, emptyText?: string, id?: string, className?: string }> & { readonly __stxEmits?: ["hover"] }
33
+ export default __dtsx_component__;
@@ -0,0 +1,33 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare const __dtsx_component__: __DtsxStxComponentType;
3
+ /*
4
+ * <BarChart> (stacksjs/stx#2318). The SVG is drawn here, on the server, so
5
+ * the chart shows before any script runs; the client script only lays it out
6
+ * again at its real width and adds the crosshair, tooltip and keyboard.
7
+ *
8
+ * The data and the accessors stay on the server (`serverOnlyProps`): the
9
+ * client gets the prepared model, every label already formatted, so a
10
+ * `formatY` function works and the records are not shipped twice.
11
+ * @defaultValue `['data', 'x', 'y', 'series', 'formatX', 'formatY', 'colors', 'yDomain']`
12
+ */
13
+ export declare const serverOnlyProps: string[];
14
+ declare const chart: unknown;
15
+ export declare const label: unknown;
16
+ export declare const loading: ReturnType<typeof $bool>;
17
+ export declare const emptyText: unknown;
18
+ export declare const empty: unknown;
19
+ export declare const svg: unknown;
20
+ export declare const modelJson: unknown;
21
+ export declare const summary: unknown;
22
+ export declare const tableHead: unknown;
23
+ export declare const tableRows: unknown;
24
+ export declare const legend: unknown;
25
+ export declare const height: unknown;
26
+ export declare const chartId: unknown;
27
+ export declare const summaryId: string;
28
+ export declare const className: unknown;
29
+ export declare const figureClasses: unknown;
30
+ export declare const surfaceClasses: 'relative rounded-control outline-none focus-visible:ring-2 focus-visible:ring-accent';
31
+ export declare const tooltipClasses: 'pointer-events-none absolute top-2 z-10 min-w-32 rounded-panel bg-inverse px-3 py-2 text-xs text-inverse-ink shadow-lg';
32
+ declare type __DtsxStxComponentType = DefineComponent<{ label?: string, loading?: unknown, emptyText?: string, id?: string, className?: string }> & { readonly __stxEmits?: ["hover"] }
33
+ export default __dtsx_component__;
@@ -0,0 +1,33 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare const __dtsx_component__: __DtsxStxComponentType;
3
+ /*
4
+ * <LineChart> (stacksjs/stx#2318). The SVG is drawn here, on the server, so
5
+ * the chart shows before any script runs; the client script only lays it out
6
+ * again at its real width and adds the crosshair, tooltip and keyboard.
7
+ *
8
+ * The data and the accessors stay on the server (`serverOnlyProps`): the
9
+ * client gets the prepared model, every label already formatted, so a
10
+ * `formatY` function works and the records are not shipped twice.
11
+ * @defaultValue `['data', 'x', 'y', 'series', 'formatX', 'formatY', 'colors', 'yDomain']`
12
+ */
13
+ export declare const serverOnlyProps: string[];
14
+ declare const chart: unknown;
15
+ export declare const label: unknown;
16
+ export declare const loading: ReturnType<typeof $bool>;
17
+ export declare const emptyText: unknown;
18
+ export declare const empty: unknown;
19
+ export declare const svg: unknown;
20
+ export declare const modelJson: unknown;
21
+ export declare const summary: unknown;
22
+ export declare const tableHead: unknown;
23
+ export declare const tableRows: unknown;
24
+ export declare const legend: unknown;
25
+ export declare const height: unknown;
26
+ export declare const chartId: unknown;
27
+ export declare const summaryId: string;
28
+ export declare const className: unknown;
29
+ export declare const figureClasses: unknown;
30
+ export declare const surfaceClasses: 'relative rounded-control outline-none focus-visible:ring-2 focus-visible:ring-accent';
31
+ export declare const tooltipClasses: 'pointer-events-none absolute top-2 z-10 min-w-32 rounded-panel bg-inverse px-3 py-2 text-xs text-inverse-ink shadow-lg';
32
+ declare type __DtsxStxComponentType = DefineComponent<{ label?: string, loading?: unknown, emptyText?: string, id?: string, className?: string }> & { readonly __stxEmits?: ["hover"] }
33
+ export default __dtsx_component__;
@@ -0,0 +1,19 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare const __dtsx_component__: __DtsxStxComponentType;
3
+ /*
4
+ * <Sparkline> (stacksjs/stx#2318): a word-sized trend line with no axes and
5
+ * no script. `data` is an array of numbers, or records with `x` and `y`
6
+ * accessors like the other charts. It is an image to assistive technology,
7
+ * named by `label` and a sentence: "from 120 to 180, low 96, high 210".
8
+ */
9
+ declare const chart: unknown;
10
+ export declare const label: unknown;
11
+ export declare const empty: unknown;
12
+ export declare const description: string;
13
+ export declare const height: unknown;
14
+ export declare const className: unknown;
15
+ export declare const svg: unknown;
16
+ export declare const color: unknown;
17
+ export declare const sparkClasses: unknown;
18
+ declare type __DtsxStxComponentType = DefineComponent<{ height?: unknown, area?: unknown, width?: unknown, label?: string, className?: string }>;
19
+ export default __dtsx_component__;
@@ -0,0 +1,111 @@
1
+ export declare function escapeXml(value: unknown): string;
2
+ /** Extend a domain to round ends and list the ticks inside it. */
3
+ export declare function niceLinear(min: number, max: number, count?: number): { domain: [number, number], ticks: number[] };
4
+ /** Ticks on round instants: aligned multiples up to a week, then calendar months and years (UTC). */
5
+ export declare function timeTicks(min: number, max: number, count?: number): { ticks: number[], step: number };
6
+ /** Build the JSON-safe model of a chart from its props. Never throws on bad data; it draws less. */
7
+ export declare function buildChartModel(input: ChartInput): ChartModel;
8
+ /** Where everything goes at `width`. Shared by the server render and the client's hit testing. */
9
+ export declare function layoutChart(model: ChartModel, width: number): ChartLayout;
10
+ export declare function curvePath(points: Point[], curve: ChartCurve): string;
11
+ /** The whole chart as an SVG string at `width`, with the interaction layer drawn hidden. */
12
+ export declare function renderChartSvg(model: ChartModel, width: number): string;
13
+ /** Index of the datum nearest a pixel x. */
14
+ export declare function nearestIndex(model: ChartModel, layout: ChartLayout, px: number): number;
15
+ /** What a datum says in words: "Mar 3, 2026: Requests 1,234, Errors 12". */
16
+ export declare function describeDatum(model: ChartModel, index: number): string;
17
+ /** A one-sentence summary for a sparkline or a chart's description. */
18
+ export declare function summarize(model: ChartModel): string;
19
+ /** JSON for a `<script>`: no `</script>` or `<!--` can close or confuse the element. */
20
+ export declare function scriptJson(value: unknown): string;
21
+ /**
22
+ * Everything a chart component's template needs, from its props. Each of the
23
+ * four components calls this with its type, so they differ only in markup.
24
+ */
25
+ export declare function prepareChart(type: ChartType, props: Record<string, any>, width?: number): PreparedChart;
26
+ /**
27
+ * Role tokens, so a chart follows dark mode and an app's palette.
28
+ * @defaultValue `[ 'var(--stx-accent, #2563eb)', 'var(--stx-info, #0891b2)', 'var(--stx-success, #16a34a)', 'var(--stx-warning, #d97706)', 'var(--stx-danger, #dc2626)', 'var(--stx-secondary, #7c3aed)', ]`
29
+ */
30
+ export declare const DEFAULT_COLORS: string[];
31
+ export declare interface ChartSeriesInput {
32
+ key: Accessor
33
+ label?: string
34
+ color?: string
35
+ }
36
+ export declare interface ChartInput {
37
+ type?: ChartType
38
+ data?: unknown
39
+ x?: Accessor
40
+ y?: Accessor | Accessor[]
41
+ series?: Array<Accessor | ChartSeriesInput>
42
+ xType?: ChartXType
43
+ yDomain?: [number | null | undefined, number | null | undefined]
44
+ curve?: ChartCurve
45
+ colors?: string[]
46
+ formatX?: Formatter
47
+ formatY?: Formatter
48
+ height?: number
49
+ label?: string
50
+ locale?: string
51
+ timeZone?: string
52
+ ticks?: number
53
+ axes?: boolean
54
+ fill?: boolean
55
+ }
56
+ export declare interface ChartSeries {
57
+ key: string
58
+ label: string
59
+ color: string
60
+ values: Array<number | null>
61
+ labels: string[]
62
+ }
63
+ export declare interface ChartTick {
64
+ value: number
65
+ label: string
66
+ }
67
+ export declare interface ChartModel {
68
+ type: ChartType
69
+ curve: ChartCurve
70
+ xType: ChartXType
71
+ height: number
72
+ axes: boolean
73
+ fill: boolean
74
+ label: string
75
+ xs: number[]
76
+ xLabels: string[]
77
+ xDomain: [number, number]
78
+ yDomain: [number, number]
79
+ xTicks: ChartTick[]
80
+ yTicks: ChartTick[]
81
+ series: ChartSeries[]
82
+ data: unknown[]
83
+ }
84
+ export declare interface ChartLayout {
85
+ width: number
86
+ height: number
87
+ left: number
88
+ top: number
89
+ plotWidth: number
90
+ plotHeight: number
91
+ x: (i: number) => number
92
+ xValue: (value: number) => number
93
+ y: (value: number) => number
94
+ bandWidth: number
95
+ }
96
+ export declare interface PreparedChart {
97
+ model: ChartModel
98
+ empty: boolean
99
+ svg: string
100
+ modelJson: string
101
+ summary: string
102
+ tableHead: string[]
103
+ tableRows: string[][]
104
+ legend: Array<{ label: string, color: string }>
105
+ }
106
+ export type ChartType = 'line' | 'area' | 'bar' | 'sparkline';
107
+ export type ChartXType = 'time' | 'linear' | 'band';
108
+ export type ChartCurve = 'linear' | 'monotone' | 'step';
109
+ export type Accessor = string | ((datum: any, index: number) => unknown);
110
+ export type Formatter = string | ((value: any, index?: number) => string);
111
+ declare type Point = [number, number];
@@ -0,0 +1,51 @@
1
+ import type { Accessor, ChartCurve, ChartSeriesInput, ChartXType, Formatter } from './core';
2
+ export type { HoverDetail } from './interaction';
3
+ export type { Accessor, ChartCurve, ChartSeriesInput, ChartXType, Formatter };
4
+ export declare interface ChartProps {
5
+ data: unknown[]
6
+ x?: Accessor
7
+ y?: Accessor | Accessor[]
8
+ series?: Array<Accessor | ChartSeriesInput>
9
+ height?: number
10
+ xType?: ChartXType
11
+ yDomain?: [number | null, number | null]
12
+ curve?: ChartCurve
13
+ colors?: string[]
14
+ formatX?: Formatter
15
+ formatY?: Formatter
16
+ label?: string
17
+ xLabel?: string
18
+ locale?: string
19
+ timeZone?: string
20
+ ticks?: number
21
+ loading?: boolean
22
+ emptyText?: string
23
+ id?: string
24
+ className?: string
25
+ onHover?: (detail: import('./interaction').HoverDetail | null) => void
26
+ }
27
+ export declare interface SparklineProps {
28
+ data: unknown[]
29
+ x?: Accessor
30
+ y?: Accessor
31
+ label?: string
32
+ height?: number
33
+ area?: boolean
34
+ curve?: ChartCurve
35
+ colors?: string[]
36
+ formatY?: Formatter
37
+ className?: string
38
+ }
39
+ export { default as AreaChart } from './AreaChart';
40
+ export { default as BarChart } from './BarChart';
41
+ export { default as LineChart } from './LineChart';
42
+ export { default as Sparkline } from './Sparkline';
43
+ export {
44
+ buildChartModel,
45
+ type ChartInput,
46
+ type ChartModel,
47
+ type ChartSeries,
48
+ type ChartTick,
49
+ type ChartType,
50
+ renderChartSvg,
51
+ } from './core';
@@ -0,0 +1,11 @@
1
+ import type { ChartModel } from './core';
2
+ export declare function mountChart(root: HTMLElement, model: ChartModel, options?: MountOptions): () => void;
3
+ export declare interface HoverDetail {
4
+ index: number
5
+ datum: unknown
6
+ x: string
7
+ values: Array<{ series: string, value: number | null, label: string }>
8
+ }
9
+ export declare interface MountOptions {
10
+ onHover?: (detail: HoverDetail | null) => void
11
+ }
@@ -8,6 +8,15 @@ export declare const value: unknown;
8
8
  export declare const valueJson: unknown;
9
9
  export declare const className: unknown;
10
10
  export declare const as: unknown;
11
+ /*
12
+ * Remote suggestions (stacksjs/stx#2319). `source` is a client function,
13
+ * `(query, { signal }) => Promise<Option[]>`, so it can only arrive through a
14
+ * bound attribute (`:source="search"`) and the client reads it live. These are
15
+ * the knobs around it.
16
+ */
17
+ export declare const debounce: unknown;
18
+ export declare const minLength: unknown;
19
+ export declare const limit: unknown;
11
20
  export declare const comboboxClasses: unknown;
12
21
  export declare const comboboxInstanceId: unknown;
13
22
  /*
@@ -36,5 +45,5 @@ declare const query: unknown;
36
45
  * aria-activedescendant was absent until there was something to point it at.
37
46
  */
38
47
  declare const activeIndex: unknown;
39
- declare type __DtsxStxComponentType = DefineComponent<{ value?: unknown, className?: string, as?: string }> & { readonly __stxExposed?: { isOpen: typeof isOpen, selected: typeof selected, query: typeof query, activeIndex: typeof activeIndex, toggle: typeof toggle, open: typeof open, close: typeof close, selectValue: typeof selectValue } }
48
+ declare type __DtsxStxComponentType = DefineComponent<{ value?: unknown, className?: string, as?: string, debounce?: unknown, minLength?: unknown, limit?: unknown }> & { readonly __stxExposed?: { isOpen: typeof isOpen, selected: typeof selected, query: typeof query, activeIndex: typeof activeIndex, toggle: typeof toggle, open: typeof open, close: typeof close, selectValue: typeof selectValue, results: unknown, loading: unknown, error: unknown } }
40
49
  export default __dtsx_component__;
@@ -2,6 +2,12 @@ import type { DefineComponent } from '@stacksjs/stx';
2
2
  declare const __dtsx_component__: __DtsxStxComponentType;
3
3
  export declare const className: unknown;
4
4
  export declare const as: unknown;
5
+ /*
6
+ * The status rows for remote suggestions (stacksjs/stx#2319) are list items in
7
+ * a list and divs otherwise, so a `<ul>` keeps only `<li>` children.
8
+ */
9
+ export declare const statusTag: === 'ol' ? 'li' : 'div';
5
10
  export declare const optionsClasses: unknown;
11
+ export declare const statusClasses: 'relative cursor-default select-none py-2 px-4 text-sm text-fg-soft';
6
12
  declare type __DtsxStxComponentType = DefineComponent<{ className?: string, as?: string }>;
7
13
  export default __dtsx_component__;
@@ -3,6 +3,10 @@ export declare interface ComboboxProps {
3
3
  onChange?: (value: any) => void
4
4
  className?: string
5
5
  as?: string
6
+ source?: ComboboxSource
7
+ debounce?: number
8
+ minLength?: number
9
+ limit?: number
6
10
  }
7
11
  export declare interface ComboboxInputProps {
8
12
  displayValue?: any
@@ -28,6 +32,9 @@ export declare interface ComboboxOptionProps {
28
32
  currentValue?: any
29
33
  onChange?: (value: any) => void
30
34
  }
35
+ /** A remote suggestion: a string, or an object whose `label` is shown and whose `value` (or the object itself) is selected. */
36
+ export type ComboboxSourceOption = string | { label?: string, value?: any, description?: string, disabled?: boolean, [key: string]: any }
37
+ export type ComboboxSource = (query: string, context: { signal: AbortSignal }) => Promise<ComboboxSourceOption[] | null | undefined> | ComboboxSourceOption[] | null | undefined;
31
38
  export { default as Combobox } from './Combobox';
32
39
  export { default as ComboboxButton } from './ComboboxButton';
33
40
  export { default as ComboboxInput } from './ComboboxInput';
@@ -7,6 +7,8 @@ export declare const initialQuery: unknown;
7
7
  export declare const className: unknown;
8
8
  export declare const paletteClasses: unknown;
9
9
  export declare const paletteInstanceId: unknown;
10
+ // Live, so a parent's `:open="paletteOpen()"` opens and closes it after mount,
11
+ // as it does a Dialog or Drawer (stacksjs/stx#2327).
10
12
  declare const isOpen: unknown;
11
13
  declare const query: unknown;
12
14
  declare type __DtsxStxComponentType = DefineComponent<{ open?: unknown, query?: string, className?: string }> & { readonly __stxExposed?: { isOpen: typeof isOpen, query: typeof query, show: typeof show, close: typeof close } }
@@ -0,0 +1,56 @@
1
+ import type { DefineComponent } from '@stacksjs/stx';
2
+ declare function hide(): undefined;
3
+ declare function reveal(): Promise<undefined>;
4
+ declare function copy(): Promise<undefined>;
5
+ declare const __dtsx_component__: __DtsxStxComponentType;
6
+ /*
7
+ * <SecretField>: a read-only field for a secret such as an API key
8
+ * (stacksjs/stx#2320). It shows a recognisable prefix and suffix,
9
+ * `mapshq_sk_3f9a…c21d`, and keeps the middle off the page.
10
+ *
11
+ * `value` is listed in `serverOnlyProps`, so it is NOT serialized into the
12
+ * page for the client the way every other prop is: the server reads it to
13
+ * draw the mask and nothing else carries it. That is also why revealing and
14
+ * copying a masked key need a way to ask for it -- `src` (a URL answering the
15
+ * key as text or `{ value }`) or `:resolve` (a client function) -- and why
16
+ * neither button is drawn without one. A key shown `once`, at creation, is on
17
+ * the page in full by design, and copies from there.
18
+ * @defaultValue `['value']`
19
+ */
20
+ export declare const serverOnlyProps: string[];
21
+ export declare const once: ReturnType<typeof $bool>;
22
+ export declare const visiblePrefix: unknown;
23
+ export declare const visibleSuffix: unknown;
24
+ export declare const revealTimeout: unknown;
25
+ export declare const label: unknown;
26
+ export declare const src: boolean;
27
+ export declare const className: unknown;
28
+ export declare const warning: unknown;
29
+ export declare const fieldId: unknown;
30
+ export declare const labelId: string;
31
+ export declare const warningId: string;
32
+ export declare const masked: unknown;
33
+ /* Only `once` puts the whole value in the markup. */
34
+ export declare const initialText: unknown;
35
+ /*
36
+ * A bound `:resolve` is a client function and never reaches the server, so
37
+ * whether one exists is only known in the browser; the buttons are rendered
38
+ * and the client hides what it cannot do. `src` is known here.
39
+ */
40
+ export declare const revealable: unknown;
41
+ export declare const copyable: unknown;
42
+ export declare const hasSource: unknown;
43
+ export declare const revealLabel: string;
44
+ export declare const hideLabel: string;
45
+ export declare const copyLabel: string;
46
+ export declare const wrapperClasses: unknown;
47
+ export declare const fieldClasses: 'flex items-center gap-1 w-full rounded-control bg-surface ring-1 ring-inset ring-line-strong px-3 py-1.5';
48
+ export declare const valueClasses: 'flex-1 min-w-0 truncate font-mono text-sm text-fg select-all';
49
+ export declare const buttonClasses: 'inline-flex items-center justify-center shrink-0 h-8 w-8 rounded-control text-fg-soft hover:text-fg hover:bg-accent-soft focus:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 disabled:cursor-not-allowed';
50
+ export declare const labelClasses: 'block text-sm font-medium leading-6 mb-2 text-fg';
51
+ export declare const warningClasses: 'mt-2 text-sm text-warning';
52
+ /* The secret lives here, in memory, and in the DOM only while revealed. */
53
+ declare const secret: unknown;
54
+ declare const revealed: ReturnType<typeof state>;
55
+ declare type __DtsxStxComponentType = DefineComponent<{ value?: unknown, once?: unknown, visiblePrefix?: unknown, visibleSuffix?: unknown, revealTimeout?: unknown, label?: string, src?: unknown, className?: string, warning?: string, id?: string, revealable?: unknown, copyable?: unknown }> & { readonly __stxEmits?: ["reveal", "hide", "copy", "error"], readonly __stxExposed?: { reveal: typeof reveal, hide: typeof hide, copy: typeof copy, revealed: typeof revealed } }
56
+ export default __dtsx_component__;