@surreal-ui/catalog 0.14.1 → 0.16.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/README.md +27 -1
- package/dist/{chunk-K6AAK2NB.js → chunk-VEFEZH7Q.js} +631 -39
- package/dist/components.css +4 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1 -1
- package/dist/lazy.js +1 -1
- package/dist/node.d.ts +13 -2
- package/dist/node.js +21 -1
- package/dist/react/flair.d.ts +45 -1
- package/dist/react/flair.js +171 -18
- package/dist/sources/bar-chart/react.tsx +1 -1
- package/dist/sources/braid/react.tsx +1 -1
- package/dist/sources/donut-chart/react.tsx +1 -1
- package/dist/sources/flow/react.tsx +1 -1
- package/dist/sources/gauge/react.tsx +1 -1
- package/dist/sources/line-chart/react.tsx +1 -1
- package/dist/sources/lineage/react.tsx +1 -1
- package/dist/sources/loader/react.tsx +52 -0
- package/dist/sources/mindmap/react.tsx +1 -1
- package/dist/sources/sparkline/react.tsx +1 -1
- package/dist/sources/table/svelte.svelte +9 -0
- package/dist/sources/timeline/react.tsx +1 -1
- package/dist/sources/weave/react.tsx +1 -1
- package/dist/svelte/Table.svelte +9 -0
- package/llms.txt +4 -0
- package/package.json +7 -7
- package/skills/surreal-use/references/components.md +15 -11
package/README.md
CHANGED
|
@@ -151,6 +151,32 @@ getComponent('gauge'); // { entry: '@surreal-ui/catalog/react/flair', export: 'G
|
|
|
151
151
|
|
|
152
152
|
`findComponents` takes `group` (`baseline`, `data-visual`, `paradigm`), `category`, `tags`, `implements`, `platform`, `provider` and `text`. Every component reports its `category`, `group`, `runtime` (`engine` for a paradigm drawn by a runtime) and, where it can't run everywhere, a `fallback` type.
|
|
153
153
|
|
|
154
|
+
An engine type's provider also maps its data to that fallback, so a host without the engine (no WebGL, reduced motion, no script) shows the same thing as a baseline component. `engineFallback(component, data)` from `@surreal-ui/catalog/node` asks the provider (an optional peer) for it:
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { getComponent } from '@surreal-ui/catalog';
|
|
158
|
+
import { engineFallback } from '@surreal-ui/catalog/node';
|
|
159
|
+
|
|
160
|
+
await engineFallback(getComponent('gauge')!, {
|
|
161
|
+
value: 88,
|
|
162
|
+
max: 160,
|
|
163
|
+
unit: ' km/h',
|
|
164
|
+
label: 'Speed'
|
|
165
|
+
});
|
|
166
|
+
// { implements: 'progress', props: { value: 55, label: 'Speed: 88 km/h' } }
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Editor charts and diagrams fall back to a `table`; Flair's gauge and loaders to `progress` (a loader whose `value` is `null` gives a `spinner`).
|
|
170
|
+
|
|
171
|
+
A data visual or paradigm from a provider also says how to read it: `encodings` lists each visual channel, the prop it shows (a path such as `series[].values[]`) and what it means, and marks the parts that are only decoration, which name no prop:
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
getComponent('gauge')!.encodings;
|
|
175
|
+
// [{ channel: 'Needle angle', field: 'value', meaning: 'How far the reading is along the scale: …' },
|
|
176
|
+
// …,
|
|
177
|
+
// { channel: 'Green, amber and red bands', decoration: true, meaning: 'Fixed shares of the scale …' }]
|
|
178
|
+
```
|
|
179
|
+
|
|
154
180
|
### Loading components on demand
|
|
155
181
|
|
|
156
182
|
Where the catalog is browsed or offered to an agent and only some components are drawn, import `@surreal-ui/catalog/lazy`: it has the same metadata and queries, and `loadComponent(id)` imports one React component on first use (each component is its own chunk).
|
|
@@ -194,7 +220,7 @@ pnpm --filter @surreal-ui/catalog sync # after bumping @pixerate/flair or
|
|
|
194
220
|
MIT © Pixerate. Some components follow the structure and documentation of [shadcn/ui](https://ui.shadcn.com) and [Radix UI](https://www.radix-ui.com) (both MIT); see `THIRD_PARTY_NOTICES.md`.
|
|
195
221
|
An item that implements a type the catalog already has (Flair's toggle implements `switch`) is an
|
|
196
222
|
**alternative** for that type (`getComponent('switch').alternatives`,
|
|
197
|
-
`findComponents({ implements: 'switch' })`); any other item is a new type. After bumping a provider,
|
|
223
|
+
`findComponents({ implements: 'switch' })`); any other item is a new type, and later items implementing that type are its alternatives. A type's `fallback` and `encodings` come from the descriptor. After bumping a provider,
|
|
198
224
|
run `pnpm --filter @surreal-ui/catalog sync`: it rewrites the synced folders (never hand-written
|
|
199
225
|
ones), removes items the provider dropped, and regenerates the catalog. CI fails if the repo is
|
|
200
226
|
behind its installed providers (`check:sync`).
|