viewkitjs 0.19.0 → 0.20.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/CHANGELOG.md +49 -0
- package/MIGRATION.md +116 -0
- package/README.md +7 -3
- package/fields/README.md +3 -3
- package/fields/dist/derived.d.ts +4 -0
- package/fields/dist/derived.js +39 -0
- package/fields/dist/entities.js +30 -30
- package/fields/dist/formula.js +2 -2
- package/fields/dist/query/evaluate.js +5 -5
- package/fields/dist/query/figures.js +5 -5
- package/fields/dist/query/filter.d.ts +15 -0
- package/fields/dist/query/filter.js +85 -0
- package/fields/dist/query/hold.js +2 -2
- package/fields/dist/query/option-counts.js +2 -2
- package/fields/dist/query/read-rule.js +2 -2
- package/fields/dist/query/search.js +2 -2
- package/fields/dist/query/set-aside.js +4 -4
- package/fields/dist/query/settings.d.ts +2 -15
- package/fields/dist/query/settings.js +3 -81
- package/fields/dist/query/sort.js +4 -4
- package/fields/dist/registry.d.ts +19 -5
- package/fields/dist/registry.js +371 -50
- package/fields/dist/types.d.ts +1 -1
- package/fields/docs/getting-started.md +2 -2
- package/fields/docs/guides/checking-definitions.md +17 -4
- package/fields/docs/guides/derived-fields.md +5 -5
- package/fields/docs/guides/queries.md +1 -1
- package/fields/docs/reference/design-category-colors.md +1 -1
- package/fields/docs/reference/design-status-slots.md +1 -1
- package/fields/docs/reference/fields.md +3 -3
- package/fields/docs/reference/query.md +1 -0
- package/fields/skills/viewkit/SKILL.md +2 -2
- package/package.json +13 -6
- package/postgres/README.md +2 -2
- package/postgres/dist/access.d.ts +12 -4
- package/postgres/dist/access.js +3 -0
- package/postgres/dist/calendar.js +3 -2
- package/postgres/dist/check.d.ts +6 -4
- package/postgres/dist/check.js +27 -16
- package/postgres/dist/counts.js +3 -2
- package/postgres/dist/definitions/build.js +7 -0
- package/postgres/dist/definitions/formula.d.ts +1 -1
- package/postgres/dist/definitions/formula.js +5 -3
- package/postgres/dist/definitions/lookup.js +5 -1
- package/postgres/dist/definitions/money.js +6 -1
- package/postgres/dist/definitions/place.d.ts +7 -0
- package/postgres/dist/definitions/place.js +8 -0
- package/postgres/dist/definitions/relations.js +36 -3
- package/postgres/dist/definitions/rollup.d.ts +1 -1
- package/postgres/dist/definitions/rollup.js +11 -6
- package/postgres/dist/field-values.js +11 -8
- package/postgres/dist/figures.js +4 -2
- package/postgres/dist/filled.js +2 -2
- package/postgres/dist/groups.d.ts +2 -1
- package/postgres/dist/groups.js +5 -3
- package/postgres/dist/index.d.ts +1 -0
- package/postgres/dist/index.js +1 -0
- package/postgres/dist/kept.js +8 -4
- package/postgres/dist/lanes.js +5 -3
- package/postgres/dist/phone.js +2 -2
- package/postgres/dist/predicates.js +2 -2
- package/postgres/dist/readable.d.ts +40 -0
- package/postgres/dist/readable.js +84 -0
- package/postgres/dist/records.js +7 -4
- package/postgres/dist/refusals.d.ts +8 -1
- package/postgres/dist/refusals.js +7 -0
- package/postgres/dist/relations.js +5 -4
- package/postgres/dist/search-indexes.js +2 -1
- package/postgres/dist/search.js +6 -4
- package/postgres/dist/several.js +8 -8
- package/postgres/dist/sort.d.ts +5 -3
- package/postgres/dist/sort.js +13 -8
- package/postgres/dist/value-rows.js +2 -2
- package/postgres/dist/values.js +4 -2
- package/postgres/docs/guides/definitions.md +2 -2
- package/postgres/docs/guides/field-map.md +43 -18
- package/postgres/docs/guides/test-kit.md +2 -0
- package/postgres/docs/reference/postgres.md +10 -4
- package/views/README.md +3 -2
- package/views/dist/styles.css +3165 -0
- package/views/dist/styles.unlayered.css +3164 -0
- package/views/docs/contract.md +13 -7
- package/views/docs/getting-started.md +1 -1
- package/views/docs/guides/the-grid.md +1 -1
- package/views/docs/install.md +35 -8
package/views/docs/contract.md
CHANGED
|
@@ -23,7 +23,8 @@ layout that can't break. Everything a person sees is the app's to dress, through
|
|
|
23
23
|
own only where an app hands nothing, and each such place names the option, component, atom or body that replaces
|
|
24
24
|
it;
|
|
25
25
|
- **a colour, size, gap, line, radius, shadow or timing** through a `--vk-*` variable with a default (Tokens), or
|
|
26
|
-
through the
|
|
26
|
+
through the scale ViewKit's class reads (`text-sm`, `rounded-md`): the Outright look's with the stylesheet, the
|
|
27
|
+
app's own Tailwind scale with `@source`;
|
|
27
28
|
- **a part** through its `data-slot` (Slots), and **a state** through its data attribute (States);
|
|
28
29
|
- **a choice a list makes** through an option with a default, today's look being the default.
|
|
29
30
|
|
|
@@ -215,7 +216,11 @@ rows read them.
|
|
|
215
216
|
**Colour is the app's, by the package's names.** The rendering paints every colour through a CSS
|
|
216
217
|
variable the app declares, spelled in a class as `text-(color:--vk-fg)` and in a value as
|
|
217
218
|
`var(--vk-ground)`, and names no variable of the app's own. An app maps each name onto its tokens
|
|
218
|
-
once; `docs/install.md` holds the block for stock shadcn.
|
|
219
|
+
once; `docs/install.md` holds the block for stock shadcn. The stylesheet (`viewkitjs/views/styles.css`)
|
|
220
|
+
declares each with the Outright look's value, light, and dark under `.dark` or `[data-theme="dark"]`, under the app's
|
|
221
|
+
own. It also draws the shadcn colour names `viewkitjs/fields/design/status-slots` and
|
|
222
|
+
`viewkitjs/fields/design/category-colors` write (`bg-muted`, `text-primary`,
|
|
223
|
+
`bg-success-soft`, …) on the kit tokens they stand for, through these names where one stands for it.
|
|
219
224
|
|
|
220
225
|
| colour | what it paints |
|
|
221
226
|
| ---------------------- | ----------------------------------------------------- |
|
|
@@ -253,12 +258,12 @@ active view's pill and the picker's chip), falling back to `--vk-neutral`; an ap
|
|
|
253
258
|
their states declares it beside `--vk-hovered` and `--vk-pressed`. The header's column glyphs ViewKit
|
|
254
259
|
draws (a field's or a type's, a binding's `AppIcon`) read `--vk-head-glyph-fg`, falling back to the
|
|
255
260
|
header's words' colour; they are drawn at 70% opacity either way, so a set colour shows at 70% of itself,
|
|
256
|
-
and an app that wants an exact colour sets it stronger. A column's own `icon` node is drawn as given. The corners come from the
|
|
257
|
-
Tailwind radius scale
|
|
261
|
+
and an app that wants an exact colour sets it stronger. A column's own `icon` node is drawn as given. The corners come from the
|
|
262
|
+
Outright look's radius scale with the stylesheet, or from the app's Tailwind radius scale with `@source`.
|
|
258
263
|
|
|
259
264
|
**The cell outlines are the app's to dress by five variables.** The line of the cell under the pointer and the
|
|
260
|
-
picked cell's ring share one geometry: `--vk-outline-radius` is the corners of both (undeclared, the
|
|
261
|
-
|
|
265
|
+
picked cell's ring share one geometry: `--vk-outline-radius` is the corners of both (undeclared, the small
|
|
266
|
+
radius, exactly what `rounded-sm` drew: the Outright look's with the stylesheet, the app's Tailwind one with `@source`), so an app that draws a picked cell straight declares `0` and the
|
|
262
267
|
hovered cell follows. Each line takes its own colour: `--vk-outline-hover` the hovered cell's (undeclared,
|
|
263
268
|
`--vk-border-bold`), `--vk-outline` the picked ring at rest (undeclared, `--vk-fg-subtle`) and
|
|
264
269
|
`--vk-outline-active` the picked ring under the pointer or while editing (undeclared, `--vk-border-brand`).
|
|
@@ -334,7 +339,8 @@ reads, and through which `GridTable`'s `fillWidth` has the columns share the gri
|
|
|
334
339
|
`--vk-foot-at` (how far above the rows' box's edge the footer pins: the app's inset, and the selection bar
|
|
335
340
|
while rows are selected), and
|
|
336
341
|
while the lab's lock is on `--vk-hold-x` and `--vk-sx` (the offsets that hold the frozen columns, the rail, a group's name and the empty message at the left while the table is scrolled
|
|
337
|
-
sideways) for itself.
|
|
342
|
+
sideways) for itself. The stylesheet declares `--vk-t-<name>`, its own theme values that differ in the
|
|
343
|
+
dark (a shadow) and the kit colours no `--vk-*` name stands for. They carry the prefix because they share the global namespace;
|
|
338
344
|
an app neither sets nor reads them, and they may change in any release.
|
|
339
345
|
|
|
340
346
|
## The components map
|
|
@@ -10,7 +10,7 @@ pnpm add viewkitjs zod
|
|
|
10
10
|
|
|
11
11
|
`react` and `react-dom` 19 are optional peers that the views part needs and you already have, and `zod` `^4.1.12` is a peer of the package. The dnd-kit packages are optional peers too, for the panels' parts that drag (the views row's pills, the sort's rules, the Columns list, the group order), which the door loads with `import()` as it loads: install them if your app renders one. The drawn panels' door (`viewkitjs/views/panels/react`) itself loads without them. The package is ESM only and runs on Node 20 or later.
|
|
12
12
|
|
|
13
|
-
The rendering
|
|
13
|
+
The rendering's look is one stylesheet: `@import "viewkitjs/views/styles.css";` draws it with no Tailwind, the Outright look by default, and one block mapping the `--vk-*` colours onto your theme makes it your app's. [Install](install.md) has both, and the `@source` line that lets your own Tailwind compile it instead.
|
|
14
14
|
|
|
15
15
|
The blocks below check their own results with `node:assert`. To run this page as a script, save the blocks in order as one `.tsx` file in an ES module project and run it with `tsx` (`pnpm add -D tsx @types/node`); in your app the asserts are only there to show you what each call returns.
|
|
16
16
|
|
|
@@ -119,7 +119,7 @@ const DEAL_FIELD_MAP: Readonly<Record<string, FieldDef>> = DEAL_FIELDS;
|
|
|
119
119
|
|
|
120
120
|
/** How the evaluator reads a deal: the field from the registry, the value from the row's own key. */
|
|
121
121
|
const dealReader: ViewFieldReader<Deal> = {
|
|
122
|
-
fieldOf: (key) => DEAL_FIELD_MAP[key],
|
|
122
|
+
fieldOf: (key) => (Object.hasOwn(DEAL_FIELD_MAP, key) ? DEAL_FIELD_MAP[key] : undefined),
|
|
123
123
|
read: (deal, key) => (deal as Record<string, unknown>)[key],
|
|
124
124
|
};
|
|
125
125
|
|
package/views/docs/install.md
CHANGED
|
@@ -11,21 +11,48 @@
|
|
|
11
11
|
Columns list, the group order), which the door loads with `import()` as it loads: install them if your app renders one. The drawn
|
|
12
12
|
panels' door (`viewkitjs/views/panels/react`) itself loads without them. ESM only, Node 20 or later.
|
|
13
13
|
|
|
14
|
-
2. **
|
|
15
|
-
|
|
14
|
+
2. **Import the stylesheet.** One line gives the rendering its whole look, with no Tailwind needed:
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
@import "viewkitjs/views/styles.css";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
It goes anywhere among your imports. Its rules sit in `components › viewkit`, a layer inside
|
|
21
|
+
`components`, and the file opens by declaring Tailwind's order (`theme, base, components, utilities`), so
|
|
22
|
+
your own components rules and your utilities win over ViewKit's whatever the order you import things in.
|
|
23
|
+
Its defaults are the Outright look (the look Outright's own apps wear), light, and dark under `.dark` or
|
|
24
|
+
`[data-theme="dark"]`. The reset it carries (Tailwind's preflight) touches only ViewKit's elements and what
|
|
25
|
+
your components draw inside them, and sits in `base › viewkit`, under your own base styles: a rule of yours
|
|
26
|
+
in `base` (shadcn's border colour) still wins there.
|
|
27
|
+
|
|
28
|
+
An app whose reset or styles sit in no layer (Tailwind 3, or a plain CSS reset, whose unlayered preflight
|
|
29
|
+
beats any layer) imports `viewkitjs/views/styles.unlayered.css` instead: ViewKit's classes outside any
|
|
30
|
+
layer, its reset and defaults still in `base › viewkit` and `components › viewkit`, and Tailwind's
|
|
31
|
+
fallbacks for browsers without `@property` in a `properties` layer. It declares no layer order, so it is
|
|
32
|
+
for an app with no layers of its own: a Tailwind 4 app takes `styles.css`.
|
|
33
|
+
|
|
34
|
+
Until each piece moves to CSS of its own, the stylesheet carries ViewKit's classes under Tailwind's names (`h-8`, `rounded-md`). Where your own Tailwind writes a class of the same name, your rule wins on ViewKit's element too: a stock Tailwind app that uses `rounded-md` itself draws ViewKit's corners at 6px, not the Outright look's 7.5px. The pieces move to their own `vk-*` classes one by one, and the overlap goes with them.
|
|
35
|
+
|
|
36
|
+
**Or let your Tailwind compile it.** An app on Tailwind 4 can still draw ViewKit on its own scale: leave
|
|
37
|
+
the import out and add one line to the stylesheet that imports Tailwind instead:
|
|
16
38
|
|
|
17
39
|
```css
|
|
18
40
|
@source "../../node_modules/viewkitjs/views";
|
|
19
41
|
```
|
|
20
42
|
|
|
21
43
|
(Adjust the relative path to where your stylesheet sits.) A missing line shows unstyled values and editors.
|
|
44
|
+
This way the rendering needs no base reset (Tailwind's preflight or any other): every button, input,
|
|
45
|
+
textarea and link it draws itself resets itself, at zero specificity, so it looks the same with or without
|
|
46
|
+
one, and your own classes and base styles elsewhere are untouched.
|
|
22
47
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
48
|
+
3. **Make the colours yours (optional).** The rendering paints through its own names. The stylesheet
|
|
49
|
+
already declares every one with the Outright look's value, light, and dark under `.dark` or `[data-theme="dark"]`;
|
|
50
|
+
declare them yourself to wear your own theme. A declaration in no layer, or in any layer above
|
|
51
|
+
`components`, wins over the stylesheet's. With `@source` instead of the stylesheet, nothing declares
|
|
52
|
+
them for you, and this block is required. Under the stylesheet, three fills keep the Outright look for
|
|
53
|
+
now, with no name of their own yet: a status's soft fill (success, warning, information), the text on a
|
|
54
|
+
filled status, and a category chip's fill (the chip's text follows `--vk-label-<hue>`). On stock shadcn
|
|
55
|
+
tokens:
|
|
29
56
|
|
|
30
57
|
```css
|
|
31
58
|
:root {
|