@kirana-ui/angular 0.2.0 → 0.4.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 +140 -0
- package/fesm2022/kirana-ui-angular.mjs +11792 -3186
- package/fesm2022/kirana-ui-angular.mjs.map +1 -1
- package/llms.txt +2493 -859
- package/package.json +4 -3
- package/skills/kirana-ui-primitives/SKILL.md +53 -12
- package/types/kirana-ui-angular-agent.d.ts +3 -0
- package/types/kirana-ui-angular-testing.d.ts +3 -0
- package/types/kirana-ui-angular.d.ts +3747 -1027
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirana-ui/angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Kirana UI Primitives for Angular",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "The Kirana authors",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"./package.json": "./package.json"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@kirana-ui/core": "0.
|
|
25
|
+
"@kirana-ui/core": "0.4.0",
|
|
26
26
|
"tslib": "^2.8.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"REFERENCE.md",
|
|
48
48
|
"llms.txt",
|
|
49
49
|
"skills",
|
|
50
|
-
"LICENSE"
|
|
50
|
+
"LICENSE",
|
|
51
|
+
"CHANGELOG.md"
|
|
51
52
|
],
|
|
52
53
|
"module": "fesm2022/kirana-ui-angular.mjs",
|
|
53
54
|
"typings": "types/kirana-ui-angular.d.ts"
|
|
@@ -33,10 +33,16 @@ from one core. The package for a framework is all a project installs.
|
|
|
33
33
|
A popup that is placed against its trigger (a popover, a menu, a select, a combobox, a
|
|
34
34
|
tooltip, a hover card) is `Portal > Positioner > Popup`: the `Positioner` takes `side`
|
|
35
35
|
(also `inline-start` and `inline-end`, which turn with the reading direction, and which
|
|
36
|
-
`data-side` then says), `align`, `sideOffset
|
|
36
|
+
`data-side` then says), `align`, `sideOffset` and `alignOffset` (a number, or a function
|
|
37
|
+
of the anchor's and the positioner's sizes), `collisionPadding` (a number, or one a side),
|
|
38
|
+
`collisionBoundary`, `collisionAvoidance`, `sticky`, `arrowPadding`, `positionMethod`, and
|
|
37
39
|
`anchor` for another element than its trigger to be placed against (an element, the
|
|
38
|
-
framework's own ref to one, or a function that gives one). A
|
|
39
|
-
|
|
40
|
+
framework's own ref to one, or a function that gives one). A popup that holds an `Arrow`
|
|
41
|
+
is given `position: relative`, so the arrow is placed in it through its entrance and
|
|
42
|
+
after. A popover may have a `Backdrop` in its portal, is `modal` (`true`: the page is
|
|
43
|
+
inert and does not scroll; `"trap-focus"`: only Tab is kept inside), and its trigger's
|
|
44
|
+
`openOnHover` lets the pointer open it too. A dialog, an alert dialog and a drawer have
|
|
45
|
+
no positioner: `Portal > Backdrop` and `Popup`, placed by the design.
|
|
40
46
|
3. Style by attributes and variables, never by guessing class names:
|
|
41
47
|
- a boolean state is present or absent: `[data-open]`, never `[data-open="true"]`;
|
|
42
48
|
- an entrance starts from `[data-starting-style]`, an exit ends at
|
|
@@ -46,17 +52,19 @@ from one core. The package for a framework is all a project installs.
|
|
|
46
52
|
4. A value is controlled when given (`value` + `onValueChange`) and the component's own
|
|
47
53
|
otherwise (`defaultValue`). A callback beside a value the component holds is
|
|
48
54
|
`(value, details)`, and `details.cancel()` keeps the value as it was. A callback that
|
|
49
|
-
reports something that happened (`
|
|
50
|
-
|
|
55
|
+
reports something that happened (`onClearErrors`, `onMonthChange`) takes only that. The
|
|
56
|
+
names are Base UI's: `loopFocus`, `disablePointerDismissal`, a multiple Select's or
|
|
57
|
+
Combobox's list in `value`, One-Time Code's `validationType` and `onValueComplete`, a
|
|
58
|
+
toast's `timeout`; the older names still work and are marked deprecated.
|
|
51
59
|
5. A control with a `name` is submitted with its form and follows the form's reset. Wrap it
|
|
52
60
|
in `Field` for a label, a description and validation. `readOnly` and `keepMounted` are
|
|
53
61
|
props of the parts `llms.txt` lists them for, and of no others.
|
|
54
62
|
|
|
55
63
|
Per framework: React takes `render` for another element; Vue takes `as` / `as-child`, binds
|
|
56
64
|
with `v-model:value` and names props in kebab case; Svelte takes a `child` snippet and
|
|
57
|
-
`bind:value`; Solid takes `as` and `render`; Angular's parts are directives on your own
|
|
58
|
-
elements (`<button
|
|
59
|
-
a part that comes and goes is structural (`*
|
|
65
|
+
`bind:value`; Solid (2, with `@solidjs/web`) takes `as` and `render`; Angular's parts are directives on your own
|
|
66
|
+
elements (`<button kpDialogTrigger>`), bound with `[(value)]`, with `[kpId]` for an id, and
|
|
67
|
+
a part that comes and goes is structural (`*kpDialogPortal`, `*kpTabsPanel`: the list is in
|
|
60
68
|
`llms.txt`); custom elements name each part with `kui-part` inside `<kui-dialog>`.
|
|
61
69
|
|
|
62
70
|
Composing a part with another element: with React's `render={<a … />}` and Vue's `as-child`
|
|
@@ -72,9 +80,24 @@ the text a part writes (`Meter.Value`, `Select.Value`) stay inside it on React a
|
|
|
72
80
|
`props().children` on Solid, and are given to a Svelte `child` snippet to render
|
|
73
81
|
(`{ props, state, input }`, `{ props, state, text }`). A handler given to a part is typed
|
|
74
82
|
with `preventKiranaHandler()` (`PartEvent`, exported by each package). For an element of the
|
|
75
|
-
design system's own
|
|
76
|
-
`@kirana-ui/react/use-render`,
|
|
77
|
-
|
|
83
|
+
design system's own composed as a part is, use `useRender` and `mergeProps` from
|
|
84
|
+
`@kirana-ui/react/use-render`, `Primitive` from `@kirana-ui/vue/primitive`, or `Primitive`
|
|
85
|
+
and `mergeProps` from `@kirana-ui/solid/primitive` and `@kirana-ui/svelte/primitive` (Solid's
|
|
86
|
+
`as` and `render`, Svelte's `as` and `child`, a `state` written as `data-*`); never write
|
|
87
|
+
another merge. On Angular such an element is a directive of your own with host bindings, and
|
|
88
|
+
custom elements need nothing: the page writes its own element.
|
|
89
|
+
|
|
90
|
+
A design system on Angular hosts each primitive in a directive of its own
|
|
91
|
+
(`hostDirectives: [{ directive: KpDialog, inputs: [...], outputs: [...] }]`), exposing what
|
|
92
|
+
its callers set; gives the primitive the rest with `hostInputs(KpTooltip, { delay: () => 0 })`
|
|
93
|
+
in its constructor (each value a function read like a signal, so `computed` values follow;
|
|
94
|
+
an input the element binds wins), never a subclass of the primitive; draws a structural part
|
|
95
|
+
(`kpDialogPortal`) in a component's template around `<ng-content />` (a part given to it finds
|
|
96
|
+
its root where it is written); and names its own directives as it likes, `kui…` included:
|
|
97
|
+
the primitives are `kp…` so that no design system's selector is theirs (two directives with
|
|
98
|
+
one selector both match, silently, and a component whose selector is its host's recurses).
|
|
99
|
+
Tooltips need no provider on any
|
|
100
|
+
framework: a design system passes `delay` on its own tooltip root (`hostInputs` on Angular).
|
|
78
101
|
|
|
79
102
|
## When something is wrong
|
|
80
103
|
|
|
@@ -115,7 +138,25 @@ component's ref, kind, label, state and actions), `act({ steps: [{ ref, action,
|
|
|
115
138
|
through the component's own handlers: its callback runs with `details.source === "agent"`
|
|
116
139
|
and may cancel. Give every control an accessible name (a `<label>`, `aria-label`): it is how
|
|
117
140
|
an agent finds it. Mark a destructive control `data-agent-confirm="what it does"`, private
|
|
118
|
-
regions `data-agent-hidden`, secrets `data-agent-secret
|
|
141
|
+
regions `data-agent-hidden`, secrets `data-agent-secret` (whatever is inside is listed with its
|
|
142
|
+
name and its actions, never its value, its choices or whether it is checked). A bridge given a
|
|
143
|
+
`root` also reads what was opened from inside it (a dialog, a menu, a select's list), by the
|
|
144
|
+
`aria-controls` of what opened it. A step names its control by ref, by its label, by words of
|
|
145
|
+
the label, by the text of its row or by one of its choices; a name two controls answer to
|
|
146
|
+
fails with both. `subscribe((changed, changes) => …)` says of each change its `key`, `value`,
|
|
147
|
+
`previous`, `source` and `reason`; `record()` keeps a person's changes in `history()` beside
|
|
148
|
+
the agent's, each with its `source` and a sentence (`text`), and `undoSource("agent")` takes
|
|
149
|
+
back only the agent's. `stage({ steps })` shows a suggestion in the controls and gives
|
|
150
|
+
`revert()` and `keep()`. `act` takes a `signal`; `timeout` bounds a wait for `allow` or
|
|
151
|
+
`confirm`. A component of your own is read through `kinds` (`AgentKind`: a selector, `read`,
|
|
152
|
+
`perform`). A slider's `setValue` fails with what the slider holds when
|
|
153
|
+
its range or step does not hold the value asked for, and so does a spin button's (a Date or
|
|
154
|
+
Time Field's part, typed as a person types it). The thumbs of a range named by their group
|
|
155
|
+
are told apart by their place (`"Price, 1 of 2"`). A list of several values (a listbox, a
|
|
156
|
+
select with `multiple`, a tree) says `values` and takes a list in `setValue`; a closed
|
|
157
|
+
select's are known once its list has been read. A tree is one component: its shown nodes
|
|
158
|
+
are its `items` (with `level` below the top and `open` for a branch), and `setValue`,
|
|
159
|
+
`open` and `close` take a node's name. `allow(action)` is the policy,
|
|
119
160
|
asked for every step; `confirm(action)` is a person's answer, asked for a step on something
|
|
120
161
|
marked `data-agent-confirm`, and without it such a step fails with "Needs a person" whatever
|
|
121
162
|
`allow` says. Never write `confirm: () => true`: open a dialog and resolve with what the
|