@f-ewald/components 0.1.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/LICENSE +28 -0
- package/README.md +147 -0
- package/custom-elements.json +3398 -0
- package/dist/address-autocomplete.d.ts +75 -0
- package/dist/address-autocomplete.d.ts.map +1 -0
- package/dist/address-autocomplete.js +342 -0
- package/dist/address-autocomplete.js.map +1 -0
- package/dist/animate-confetti.d.ts +53 -0
- package/dist/animate-confetti.d.ts.map +1 -0
- package/dist/animate-confetti.js +180 -0
- package/dist/animate-confetti.js.map +1 -0
- package/dist/autocomplete-input.d.ts +73 -0
- package/dist/autocomplete-input.d.ts.map +1 -0
- package/dist/autocomplete-input.js +309 -0
- package/dist/autocomplete-input.js.map +1 -0
- package/dist/confirm-dialog.d.ts +36 -0
- package/dist/confirm-dialog.d.ts.map +1 -0
- package/dist/confirm-dialog.js +191 -0
- package/dist/confirm-dialog.js.map +1 -0
- package/dist/copy-link-button.d.ts +27 -0
- package/dist/copy-link-button.d.ts.map +1 -0
- package/dist/copy-link-button.js +84 -0
- package/dist/copy-link-button.js.map +1 -0
- package/dist/distance-value.d.ts +24 -0
- package/dist/distance-value.d.ts.map +1 -0
- package/dist/distance-value.js +50 -0
- package/dist/distance-value.js.map +1 -0
- package/dist/distribution-chart.d.ts +52 -0
- package/dist/distribution-chart.d.ts.map +1 -0
- package/dist/distribution-chart.js +299 -0
- package/dist/distribution-chart.js.map +1 -0
- package/dist/icons.d.ts +32 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +35 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/percent-bar-chart.d.ts +29 -0
- package/dist/percent-bar-chart.d.ts.map +1 -0
- package/dist/percent-bar-chart.js +92 -0
- package/dist/percent-bar-chart.js.map +1 -0
- package/dist/price-history-chart.d.ts +39 -0
- package/dist/price-history-chart.d.ts.map +1 -0
- package/dist/price-history-chart.js +217 -0
- package/dist/price-history-chart.js.map +1 -0
- package/dist/relative-time.d.ts +26 -0
- package/dist/relative-time.d.ts.map +1 -0
- package/dist/relative-time.js +64 -0
- package/dist/relative-time.js.map +1 -0
- package/dist/reveal-button.d.ts +19 -0
- package/dist/reveal-button.d.ts.map +1 -0
- package/dist/reveal-button.js +62 -0
- package/dist/reveal-button.js.map +1 -0
- package/dist/roman-numeral.d.ts +18 -0
- package/dist/roman-numeral.d.ts.map +1 -0
- package/dist/roman-numeral.js +54 -0
- package/dist/roman-numeral.js.map +1 -0
- package/dist/slide-panel.d.ts +27 -0
- package/dist/slide-panel.d.ts.map +1 -0
- package/dist/slide-panel.js +149 -0
- package/dist/slide-panel.js.map +1 -0
- package/dist/toast-notification.d.ts +53 -0
- package/dist/toast-notification.d.ts.map +1 -0
- package/dist/toast-notification.js +173 -0
- package/dist/toast-notification.js.map +1 -0
- package/dist/tokens.css +21 -0
- package/dist/tokens.d.ts +16 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +79 -0
- package/dist/tokens.js.map +1 -0
- package/dist/utils/distance.d.ts +11 -0
- package/dist/utils/distance.d.ts.map +1 -0
- package/dist/utils/distance.js +25 -0
- package/dist/utils/distance.js.map +1 -0
- package/dist/utils/time.d.ts +10 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +33 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/weight-bar-chart.d.ts +29 -0
- package/dist/weight-bar-chart.d.ts.map +1 -0
- package/dist/weight-bar-chart.js +96 -0
- package/dist/weight-bar-chart.js.map +1 -0
- package/docs/address-autocomplete.md +68 -0
- package/docs/animate-confetti.md +34 -0
- package/docs/autocomplete-input.md +79 -0
- package/docs/confirm-dialog.md +65 -0
- package/docs/copy-link-button.md +46 -0
- package/docs/distance-value.md +38 -0
- package/docs/distribution-chart.md +51 -0
- package/docs/mcp-evaluation.md +31 -0
- package/docs/percent-bar-chart.md +40 -0
- package/docs/price-history-chart.md +44 -0
- package/docs/relative-time.md +37 -0
- package/docs/reveal-button.md +43 -0
- package/docs/roman-numeral.md +33 -0
- package/docs/slide-panel.md +56 -0
- package/docs/toast-notification.md +52 -0
- package/docs/weight-bar-chart.md +53 -0
- package/llms.txt +361 -0
- package/package.json +69 -0
package/llms.txt
ADDED
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
# @f-ewald/components
|
|
2
|
+
|
|
3
|
+
A collection of self-contained Lit web components sharing a Tailwind-inspired
|
|
4
|
+
design token system. Every component is individually importable and ships
|
|
5
|
+
its own TypeScript types and a checked-in custom-elements.json manifest.
|
|
6
|
+
|
|
7
|
+
Install: `npm install @f-ewald/components`
|
|
8
|
+
|
|
9
|
+
Import patterns:
|
|
10
|
+
- Whole library: `import "@f-ewald/components";` (registers every component)
|
|
11
|
+
- Individual component: `import "@f-ewald/components/<tag-name>.js";` (tree-shakes
|
|
12
|
+
everything else, including d3 for non-chart components)
|
|
13
|
+
|
|
14
|
+
Theming: components use `var(--ui-*, <fallback>)` custom properties, so they
|
|
15
|
+
render correctly with zero external CSS. Override any `--ui-*` property on
|
|
16
|
+
`:root` (or an ancestor) to retheme, or import the optional
|
|
17
|
+
`@f-ewald/components/tokens.css` stylesheet as a starting point.
|
|
18
|
+
|
|
19
|
+
## <address-autocomplete>
|
|
20
|
+
|
|
21
|
+
Form-associated text input with a suggestion dropdown. Works as a
|
|
22
|
+
drop-in replacement for a plain `<input name="address">`: consumers keep
|
|
23
|
+
reading `new FormData(form).get("address")` and calling `form.reset()`
|
|
24
|
+
unchanged.
|
|
25
|
+
|
|
26
|
+
Supports two suggestion sources:
|
|
27
|
+
- **API** (default): fetches from `endpoint`, a Mapbox Geocoding v6-shaped
|
|
28
|
+
forward-geocode URL, debounced as the user types.
|
|
29
|
+
- **Local array**: set `suggestions` to a fixed `AddressSuggestion[]` and
|
|
30
|
+
the component filters it client-side instead of making any network
|
|
31
|
+
request. Useful for small/fixed address lists, offline use, or tests.
|
|
32
|
+
Takes priority over `endpoint` whenever it's non-null.
|
|
33
|
+
|
|
34
|
+
Import: `import "@f-ewald/components/address-autocomplete.js";`
|
|
35
|
+
|
|
36
|
+
Properties: `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `types` (attribute `types`) : string, default "address"; `endpoint` (attribute `endpoint`) : string, default "https://api.mapbox.com/search/geocode/v6/forward"; `accessToken` (attribute `access-token`) : string, default ""; `bbox` (attribute `bbox`) : string, default ""; `proximity` (attribute `proximity`) : string, default ""; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3; `suggestions` (JS property only) : AddressSuggestion[] | null, default null; `selectedSuggestion` (JS property only) : AddressSuggestion | null, default —
|
|
37
|
+
Events: `address-select`
|
|
38
|
+
CSS custom properties: `--ui-border`, `--ui-font`, `--ui-font-size-sm`, `--ui-radius-sm`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`
|
|
39
|
+
|
|
40
|
+
Example:
|
|
41
|
+
```html
|
|
42
|
+
<address-autocomplete
|
|
43
|
+
placeholder="Start typing an address…"
|
|
44
|
+
access-token="pk.your-mapbox-token"
|
|
45
|
+
></address-autocomplete>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## <animate-confetti>
|
|
49
|
+
|
|
50
|
+
Fullscreen confetti animation overlay, rendered on a fixed-position canvas.
|
|
51
|
+
Starts automatically on first render and stops after `duration` ms.
|
|
52
|
+
|
|
53
|
+
Import: `import "@f-ewald/components/animate-confetti.js";`
|
|
54
|
+
|
|
55
|
+
Properties: `duration` (attribute `duration`) : number, default 6000
|
|
56
|
+
Events: none
|
|
57
|
+
CSS custom properties: none
|
|
58
|
+
|
|
59
|
+
Example:
|
|
60
|
+
```html
|
|
61
|
+
<animate-confetti duration="6000"></animate-confetti>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## <autocomplete-input>
|
|
65
|
+
|
|
66
|
+
Generic form-associated text input with a suggestion dropdown, for any
|
|
67
|
+
"type to filter a list of `{key, value}` options" use case. Works as a
|
|
68
|
+
drop-in replacement for a plain `<input>` inside a `<form>`: set `name` on
|
|
69
|
+
the element itself and consumers keep reading
|
|
70
|
+
`new FormData(form).get(name)` and calling `form.reset()` unchanged — the
|
|
71
|
+
submitted value is the picked option's `value`, while `key` is available
|
|
72
|
+
via the `option-select` event and the `selectedOption` getter for cases
|
|
73
|
+
that need the underlying id rather than the display text.
|
|
74
|
+
|
|
75
|
+
Supports two suggestion sources:
|
|
76
|
+
- **API**: set `endpoint` to a URL that, given a `?<query-param>=<text>`
|
|
77
|
+
query string, responds with a JSON array of `{key, value}` objects.
|
|
78
|
+
Requests are debounced as the user types.
|
|
79
|
+
- **Local array**: set `options` to a fixed `AutocompleteOption[]` and the
|
|
80
|
+
component filters it client-side instead of making any network
|
|
81
|
+
request. Useful for small/fixed lists, offline use, or tests. Takes
|
|
82
|
+
priority over `endpoint` whenever it's non-null.
|
|
83
|
+
|
|
84
|
+
Import: `import "@f-ewald/components/autocomplete-input.js";`
|
|
85
|
+
|
|
86
|
+
Properties: `value` (attribute `value`) : string, default ""; `placeholder` (attribute `placeholder`) : string, default ""; `required` (attribute `required`) : boolean, default false; `endpoint` (attribute `endpoint`) : string, default ""; `queryParam` (attribute `query-param`) : string, default "q"; `debounce` (attribute `debounce`) : number, default 300; `minLength` (attribute `min-length`) : number, default 3; `options` (JS property only) : AutocompleteOption[] | null, default null; `selectedOption` (JS property only) : AutocompleteOption | null, default —
|
|
87
|
+
Events: `option-select`
|
|
88
|
+
CSS custom properties: `--ui-border`, `--ui-font`, `--ui-font-size-sm`, `--ui-radius-sm`, `--ui-shadow`, `--ui-surface`, `--ui-surface-muted`
|
|
89
|
+
|
|
90
|
+
Example:
|
|
91
|
+
```html
|
|
92
|
+
<form>
|
|
93
|
+
<autocomplete-input name="language" placeholder="Start typing a language…"></autocomplete-input>
|
|
94
|
+
</form>
|
|
95
|
+
<script type="module">
|
|
96
|
+
// Local mode: filters client-side, no network request.
|
|
97
|
+
document.querySelector("autocomplete-input").options = [
|
|
98
|
+
{ key: "ts", value: "TypeScript" },
|
|
99
|
+
{ key: "py", value: "Python" },
|
|
100
|
+
];
|
|
101
|
+
|
|
102
|
+
// API mode: omit `options` and set `endpoint` instead — it's queried as
|
|
103
|
+
// `${endpoint}?${queryParam}=<text>` and must respond with [{key, value}].
|
|
104
|
+
</script>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## <confirm-dialog>
|
|
108
|
+
|
|
109
|
+
Reusable confirmation dialog: overlay + centered card with a slotted body,
|
|
110
|
+
an optional error line, and Cancel/Confirm actions. Instant `display:none`
|
|
111
|
+
→ `display:flex` toggle (no transitions). Fires `confirm`/`cancel`
|
|
112
|
+
(bubbling, composed) instead of owning any deletion logic itself —
|
|
113
|
+
callers stay in charge of the request.
|
|
114
|
+
|
|
115
|
+
Import: `import "@f-ewald/components/confirm-dialog.js";`
|
|
116
|
+
|
|
117
|
+
Properties: `open` (attribute `open`) : boolean, default false; `confirmLabel` (attribute `confirm-label`) : string, default "Delete"; `cancelLabel` (attribute `cancel-label`) : string, default "Cancel"; `danger` (attribute `danger`) : boolean, default true; `busy` (attribute `busy`) : boolean, default false; `error` (attribute `error`) : string | null, default null
|
|
118
|
+
Events: `confirm`, `cancel`
|
|
119
|
+
CSS custom properties: `--ui-border`, `--ui-danger`, `--ui-danger-hover`, `--ui-font`, `--ui-font-size`, `--ui-font-size-sm`, `--ui-overlay`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius`, `--ui-radius-sm`, `--ui-shadow-lg`, `--ui-surface`, `--ui-text`, `--ui-text-muted`
|
|
120
|
+
|
|
121
|
+
Example:
|
|
122
|
+
```html
|
|
123
|
+
<confirm-dialog open confirm-label="Delete" cancel-label="Cancel">
|
|
124
|
+
Are you sure you want to delete this item?
|
|
125
|
+
</confirm-dialog>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## <copy-link-button>
|
|
129
|
+
|
|
130
|
+
Small icon button that copies `value` to the clipboard and shows a toast
|
|
131
|
+
on success/failure (if a `<toast-notification>` element is present), and
|
|
132
|
+
always dispatches a `copy-success`/`copy-error` CustomEvent so consumers
|
|
133
|
+
without a toast element can react. Defaults to the current page URL if
|
|
134
|
+
`value` is unset.
|
|
135
|
+
|
|
136
|
+
Import: `import "@f-ewald/components/copy-link-button.js";`
|
|
137
|
+
|
|
138
|
+
Properties: `value` (attribute `value`) : string, default ""; `label` (attribute `label`) : string, default "Copy link"
|
|
139
|
+
Events: `copy-success`, `copy-error`
|
|
140
|
+
CSS custom properties: `--ui-radius-sm`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
141
|
+
|
|
142
|
+
Example:
|
|
143
|
+
```html
|
|
144
|
+
<copy-link-button value="https://example.com/listing/42" label="Copy listing link"></copy-link-button>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## <distance-value>
|
|
148
|
+
|
|
149
|
+
Inline distance display. Renders miles/feet or km/m, switching units at
|
|
150
|
+
sensible thresholds (< 0.25 mi → ft; < 0.5 km → m).
|
|
151
|
+
|
|
152
|
+
Supply exactly one of `miles` or `km`; the other stays null.
|
|
153
|
+
km support is present but reserved for future use.
|
|
154
|
+
|
|
155
|
+
Import: `import "@f-ewald/components/distance-value.js";`
|
|
156
|
+
|
|
157
|
+
Properties: `miles` (attribute `miles`) : number | null, default null; `km` (attribute `km`) : number | null, default null
|
|
158
|
+
Events: none
|
|
159
|
+
CSS custom properties: none
|
|
160
|
+
|
|
161
|
+
Example:
|
|
162
|
+
```html
|
|
163
|
+
<distance-value miles="5"></distance-value>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## <distribution-chart>
|
|
167
|
+
|
|
168
|
+
Renders a KDE distribution curve for a named metric with one or more value
|
|
169
|
+
markers. The SVG viewBox is kept in sync with the element's pixel width via
|
|
170
|
+
ResizeObserver so that font sizes and stroke widths are always in real pixels
|
|
171
|
+
regardless of container width.
|
|
172
|
+
|
|
173
|
+
Pass `fontSize` to control all text size (default 11). Pass a single
|
|
174
|
+
`{label:'', value}` for a single-value display or multiple
|
|
175
|
+
`{label:'A'|'B'|...}` entries to compare several values.
|
|
176
|
+
|
|
177
|
+
Import: `import "@f-ewald/components/distribution-chart.js";`
|
|
178
|
+
|
|
179
|
+
Properties: `metric` (attribute `metric`) : string, default ""; `values` (JS property only) : DistributionValue[], default []; `markerColors` (JS property only) : string[], default ["#4f46e5", "#d97706", "#0d9488", "#e11d48"]; `fontSize` (attribute `font-size`) : number, default 11
|
|
180
|
+
Events: none
|
|
181
|
+
CSS custom properties: `--ui-danger`, `--ui-font-size-sm`, `--ui-radius-sm`, `--ui-text-muted`
|
|
182
|
+
|
|
183
|
+
Example:
|
|
184
|
+
```html
|
|
185
|
+
<distribution-chart metric="sqft"></distribution-chart>
|
|
186
|
+
<script type="module">
|
|
187
|
+
document.querySelector("distribution-chart").values = [{ label: "", value: 1450 }];
|
|
188
|
+
</script>
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## <percent-bar-chart>
|
|
192
|
+
|
|
193
|
+
Horizontal bar chart for labeled percentage rows, using D3's linear scale.
|
|
194
|
+
Each group gets its own labeled row; bars are proportional to percentage of 100.
|
|
195
|
+
|
|
196
|
+
Import: `import "@f-ewald/components/percent-bar-chart.js";`
|
|
197
|
+
|
|
198
|
+
Properties: `groups` (JS property only) : PercentBarGroup[], default []
|
|
199
|
+
Events: none
|
|
200
|
+
CSS custom properties: none
|
|
201
|
+
|
|
202
|
+
Example:
|
|
203
|
+
```html
|
|
204
|
+
<percent-bar-chart></percent-bar-chart>
|
|
205
|
+
<script type="module">
|
|
206
|
+
document.querySelector("percent-bar-chart").groups = [
|
|
207
|
+
{ key: "a", label: "White", pct: 45.2, color: "#4f46e5" },
|
|
208
|
+
{ key: "b", label: "Asian", pct: 28.1, color: "#0d9488" },
|
|
209
|
+
];
|
|
210
|
+
</script>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## <price-history-chart>
|
|
214
|
+
|
|
215
|
+
D3-powered SVG line chart for property price history.
|
|
216
|
+
|
|
217
|
+
Uses scaleTime (X) + scaleLinear (Y) from d3-scale and line/area path
|
|
218
|
+
generators from d3-shape. Adapts to container width via ResizeObserver.
|
|
219
|
+
|
|
220
|
+
Import: `import "@f-ewald/components/price-history-chart.js";`
|
|
221
|
+
|
|
222
|
+
Properties: `history` (attribute `history`) : PricePoint[], default []; `yLabels` (attribute `y-labels`) : "auto" | "always" | "never", default "auto"; `maxXLabels` (attribute `max-x-labels`) : number, default 3
|
|
223
|
+
Events: none
|
|
224
|
+
CSS custom properties: none
|
|
225
|
+
|
|
226
|
+
Example:
|
|
227
|
+
```html
|
|
228
|
+
<price-history-chart></price-history-chart>
|
|
229
|
+
<script type="module">
|
|
230
|
+
document.querySelector("price-history-chart").history = [
|
|
231
|
+
{ date: "2023-01-01", price: 620000, eventType: "Listed" },
|
|
232
|
+
{ date: "2024-02-01", price: 680000, eventType: "Sold" },
|
|
233
|
+
];
|
|
234
|
+
</script>
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## <relative-time>
|
|
238
|
+
|
|
239
|
+
Inline relative-time display (e.g. "3 hours ago"). Accepts either a
|
|
240
|
+
standard ISO 8601 string or a SQLite `datetime('now')` string
|
|
241
|
+
("YYYY-MM-DD HH:MM:SS", UTC, no zone marker) via `datetime`. Shows the
|
|
242
|
+
full date/time in the viewer's local timezone as a hover tooltip, and
|
|
243
|
+
re-renders on an interval so the text stays current while visible.
|
|
244
|
+
|
|
245
|
+
Import: `import "@f-ewald/components/relative-time.js";`
|
|
246
|
+
|
|
247
|
+
Properties: `datetime` (attribute `datetime`) : string | null, default null
|
|
248
|
+
Events: none
|
|
249
|
+
CSS custom properties: none
|
|
250
|
+
|
|
251
|
+
Example:
|
|
252
|
+
```html
|
|
253
|
+
<relative-time datetime="2026-07-17T07:00:00Z"></relative-time>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## <reveal-button>
|
|
257
|
+
|
|
258
|
+
Button that reveals hidden slotted content when clicked.
|
|
259
|
+
|
|
260
|
+
Import: `import "@f-ewald/components/reveal-button.js";`
|
|
261
|
+
|
|
262
|
+
Properties: `label` (attribute `label`) : string, default "Reveal hidden content"
|
|
263
|
+
Events: none
|
|
264
|
+
CSS custom properties: `--ui-font`, `--ui-font-size`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-sm`
|
|
265
|
+
|
|
266
|
+
Example:
|
|
267
|
+
```html
|
|
268
|
+
<reveal-button label="Show the secret">
|
|
269
|
+
Surprise! This content was hidden.
|
|
270
|
+
</reveal-button>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## <roman-numeral>
|
|
274
|
+
|
|
275
|
+
Converts an integer to a roman numeral inline.
|
|
276
|
+
|
|
277
|
+
Import: `import "@f-ewald/components/roman-numeral.js";`
|
|
278
|
+
|
|
279
|
+
Properties: `value` (attribute `value`) : number | undefined, default —
|
|
280
|
+
Events: none
|
|
281
|
+
CSS custom properties: none
|
|
282
|
+
|
|
283
|
+
Example:
|
|
284
|
+
```html
|
|
285
|
+
<roman-numeral value="2004"></roman-numeral>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## <slide-panel>
|
|
289
|
+
|
|
290
|
+
Generic sliding panel shell. Handles positioning, open/close animation,
|
|
291
|
+
header chrome, and a close button. Body content is provided via the
|
|
292
|
+
default slot; the consumer controls its own padding and overflow.
|
|
293
|
+
|
|
294
|
+
Desktop: 300 px fixed right-side panel that slides from the right.
|
|
295
|
+
Mobile (≤768px): bottom-sheet drawer (60vh) — reserved for future use.
|
|
296
|
+
|
|
297
|
+
Import: `import "@f-ewald/components/slide-panel.js";`
|
|
298
|
+
|
|
299
|
+
Properties: `open` (attribute `open`) : boolean, default false; `heading` (attribute `heading`) : string, default ""
|
|
300
|
+
Events: `panel-close`
|
|
301
|
+
CSS custom properties: `--ui-border`, `--ui-font`, `--ui-font-size`, `--ui-radius-sm`, `--ui-shadow-lg`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
302
|
+
|
|
303
|
+
Example:
|
|
304
|
+
```html
|
|
305
|
+
<slide-panel open heading="Property details">
|
|
306
|
+
Panel body content goes here.
|
|
307
|
+
</slide-panel>
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## <toast-notification>
|
|
311
|
+
|
|
312
|
+
Fixed-position stack of dismissible notifications, anchored top-right
|
|
313
|
+
(top-full-width on mobile). Not wired to any app state yet — callers add
|
|
314
|
+
toasts imperatively via the `show()` method on a live element reference,
|
|
315
|
+
e.g. `document.querySelector('toast-notification')?.show('Offline', { variant: 'error' })`,
|
|
316
|
+
or via the `notifySuccess`/`notifyError`/`notifyInfo` module-level helpers
|
|
317
|
+
exported from this file. Each toast auto-dismisses after `duration` ms and
|
|
318
|
+
can also be dismissed via its ✕ button. Appears/disappears instantly — no
|
|
319
|
+
slide/fade transitions.
|
|
320
|
+
|
|
321
|
+
Import: `import "@f-ewald/components/toast-notification.js";`
|
|
322
|
+
|
|
323
|
+
Properties: none
|
|
324
|
+
Events: none
|
|
325
|
+
CSS custom properties: `--ui-danger`, `--ui-font`, `--ui-font-size`, `--ui-primary`, `--ui-radius`, `--ui-radius-sm`, `--ui-shadow-lg`, `--ui-success`, `--ui-text`
|
|
326
|
+
|
|
327
|
+
Example:
|
|
328
|
+
```html
|
|
329
|
+
<toast-notification></toast-notification>
|
|
330
|
+
<script type="module">
|
|
331
|
+
import { notifySuccess } from "@f-ewald/components/toast-notification.js";
|
|
332
|
+
notifySuccess("Saved!");
|
|
333
|
+
</script>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## <weight-bar-chart>
|
|
337
|
+
|
|
338
|
+
Sorted horizontal bar chart of labeled weights (normalized fractions
|
|
339
|
+
summing to ~1). Bars sort descending — the order IS the priority ranking.
|
|
340
|
+
Widths scale relative to the largest weight (which fills its track); the
|
|
341
|
+
percent labels carry the absolute values. Rows are keyed by item id
|
|
342
|
+
(repeat directive) so a re-render with new weights moves the existing
|
|
343
|
+
rows; bar widths animate via CSS, re-sorting is instant.
|
|
344
|
+
|
|
345
|
+
Import: `import "@f-ewald/components/weight-bar-chart.js";`
|
|
346
|
+
|
|
347
|
+
Properties: `items` (JS property only) : WeightBarItem[], default []
|
|
348
|
+
Events: none
|
|
349
|
+
CSS custom properties: `--ui-font`, `--ui-font-size-sm`, `--ui-primary`, `--ui-radius-sm`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
|
|
350
|
+
|
|
351
|
+
Example:
|
|
352
|
+
```html
|
|
353
|
+
<weight-bar-chart></weight-bar-chart>
|
|
354
|
+
<script type="module">
|
|
355
|
+
document.querySelector("weight-bar-chart").items = [
|
|
356
|
+
{ id: "price", label: "Price", value: 0.4 },
|
|
357
|
+
{ id: "schools", label: "Schools", value: 0.35 },
|
|
358
|
+
{ id: "commute", label: "Commute", value: 0.25 },
|
|
359
|
+
];
|
|
360
|
+
</script>
|
|
361
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@f-ewald/components",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "A collection of universally usable web components for various tasks.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./*.js": {
|
|
16
|
+
"types": "./dist/*.d.ts",
|
|
17
|
+
"default": "./dist/*.js"
|
|
18
|
+
},
|
|
19
|
+
"./tokens.css": "./dist/tokens.css",
|
|
20
|
+
"./custom-elements.json": "./custom-elements.json",
|
|
21
|
+
"./llms.txt": "./llms.txt"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"custom-elements.json",
|
|
26
|
+
"llms.txt",
|
|
27
|
+
"docs"
|
|
28
|
+
],
|
|
29
|
+
"sideEffects": [
|
|
30
|
+
"./dist/**/*.js"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"dev": "vite",
|
|
34
|
+
"build": "rm -rf dist && tsc && node scripts/generate-tokens-css.mjs",
|
|
35
|
+
"build:demo": "vite build",
|
|
36
|
+
"analyze": "cem analyze --litelement --globs \"src/**/*.ts\"",
|
|
37
|
+
"docs": "npm run analyze && node scripts/generate-docs.mjs",
|
|
38
|
+
"icons": "node scripts/generate-icons.mjs",
|
|
39
|
+
"test": "playwright test",
|
|
40
|
+
"prepublishOnly": "npm run build && npm run docs && npm run test"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"web-components"
|
|
44
|
+
],
|
|
45
|
+
"author": "Friedrich Ewald",
|
|
46
|
+
"license": "BSD-3-Clause",
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"d3-array": "^3.2.4",
|
|
49
|
+
"d3-scale": "^4.0.2",
|
|
50
|
+
"d3-shape": "^3.2.0",
|
|
51
|
+
"lit": "^3.3.3"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"customElements": "custom-elements.json",
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
59
|
+
"@playwright/test": "^1.61.1",
|
|
60
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
61
|
+
"@types/d3-array": "^3.2.2",
|
|
62
|
+
"@types/d3-scale": "^4.0.9",
|
|
63
|
+
"@types/d3-shape": "^3.1.8",
|
|
64
|
+
"heroicons": "^2.2.0",
|
|
65
|
+
"tailwindcss": "^4.3.3",
|
|
66
|
+
"typescript": "^7.0.2",
|
|
67
|
+
"vite": "^8.1.5"
|
|
68
|
+
}
|
|
69
|
+
}
|