@citrusworx/juiceui 0.9.3 → 0.9.4

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.
@@ -0,0 +1,123 @@
1
+ /**
2
+ * DOM-first runtime for Juice touchable-row chrome.
3
+ *
4
+ * Markup contract (Slice A — do not rename attrs):
5
+ * [touchable-row] host. Any value is still a row. Words
6
+ * compose, same as the CSS: dense,
7
+ * chevron, undivided, plus the two words
8
+ * this runtime owns.
9
+ * [touchable-row~="select"] opt-in. Activation toggles selection.
10
+ * Absent, the row does not toggle.
11
+ * getState().selected still reports the
12
+ * CSS selected state.
13
+ * [touchable-row~="activate"] explicit opt-in for keyboard chrome
14
+ * when the row is not [pressable] and
15
+ * not selectable. See below.
16
+ * [selected] selected signal, with aria-selected
17
+ * or aria-current. CSS paints the start
18
+ * bar from any of the three.
19
+ * [pressable] press feedback stays on Pressable.
20
+ * This runtime does not set [pressed].
21
+ *
22
+ * Why those words, and not [touchable-row-select]: dense, chevron,
23
+ * and undivided already compose on the host attribute. Selection and
24
+ * the keyboard opt-in are host behavior, not slots.
25
+ * [touchable-row-leading], [touchable-row-content], [touchable-row-title],
26
+ * [touchable-row-subtitle], and [touchable-row-trailing] are the parts.
27
+ * A [touchable-row-select] attribute would read as another part.
28
+ *
29
+ * Keyboard activation:
30
+ * Enter or Space on a non-native host (not `a` or `button`) dispatches
31
+ * one bubbling click. Repeat keydowns do not. Enter is never
32
+ * preventDefault'd. Space is preventDefault'd only on those
33
+ * non-native hosts, so the page does not scroll (the same reason as
34
+ * the Pressable Space fix, applied to every li/div row rather than
35
+ * only to a button-like role). Native `a` and `button` already
36
+ * activate from the platform — Enter on a link, Enter and Space on
37
+ * a button — and this runtime does not dispatch a second click and
38
+ * does not preventDefault Space on them. An `<a>` without href is
39
+ * still native: give it an href, or use a div with select / activate
40
+ * / pressable. An editing host is left alone so Space can type.
41
+ * A [menuitem] host (the attribute, or a menuitem role) is left
42
+ * alone on the key. The menu runtime owns Enter and Space and clicks
43
+ * the item once. This runtime still sees that click.
44
+ *
45
+ * Keys and clicks that start in an interactive descendant do not
46
+ * activate the row, so a trailing control works on its own. The
47
+ * descendant is a button, a, input, textarea, select, summary,
48
+ * [switch], [icon-button], [menuitem], an editing host, or an
49
+ * element whose first role token is button, switch, checkbox, radio,
50
+ * link, menuitem, menuitemcheckbox, menuitemradio, option, tab,
51
+ * textbox, searchbox, combobox, slider, or spinbutton.
52
+ *
53
+ * Role and tabindex:
54
+ * A plain row is a layout shell. Sync does not give it a role or a
55
+ * tabindex, or it would enter the tab order just by being drawn.
56
+ * Chrome is added only when the row is interactive, the author has
57
+ * not set that attribute, the host is not native, and the host is
58
+ * not a menuitem:
59
+ * [pressable] the row is a press target
60
+ * [touchable-row~="select"] the row toggles selection
61
+ * [touchable-row~="activate"] explicit opt-in
62
+ * The added role is "button" and the added tabindex is "0". An
63
+ * author role or tabindex is kept, including role="link". Native
64
+ * links and buttons already have a platform role and tab stop.
65
+ * Menuitems keep the role the menu runtime writes. A disabled row
66
+ * is not given a tab stop it did not already have. Destroy does
67
+ * not remove a role or tabindex this runtime added.
68
+ *
69
+ * Selection:
70
+ * Independent toggles. There is no single-select group. List has
71
+ * no runtime, and its [selected] wash is author state. Tabs are a
72
+ * different widget (panels and a roving tabindex). Radio groups use
73
+ * the native name on inputs. This row has no container. Activating
74
+ * one selectable row does not clear its siblings.
75
+ * Activation is the click, including the click this runtime
76
+ * dispatches for a non-native host. The written signal is [selected]
77
+ * plus aria-selected on a host that is not a link, or aria-current
78
+ * on `a` and role="link". CSS treats aria-current other than "false"
79
+ * as selected, which is the link-shaped signal. Turning a row off
80
+ * clears [selected] and writes the chosen aria attribute to "false",
81
+ * and clears the other aria signal when that signal is still
82
+ * selected, so one toggle fully unselects the row. Rows without
83
+ * [touchable-row~="select"] do not toggle.
84
+ *
85
+ * Long-press:
86
+ * Not implemented here. A row with [pressable][pressable-longpress]
87
+ * uses Pressable's juice:longpress. Pressable suppresses the click
88
+ * that follows a long-press on the capture phase (preventDefault
89
+ * and stopPropagation) unless that event was canceled. Selection
90
+ * listens for click on the bubble phase, so the suppressed click
91
+ * never toggles. A later click does.
92
+ *
93
+ * Disabled:
94
+ * :disabled (the disabled property), [disabled], and
95
+ * [aria-disabled="true"] are ignored entirely. No click is
96
+ * synthesized, selection does not change, and the attempt does not
97
+ * dispatch juice:change.
98
+ *
99
+ * State is { selected, disabled }. selected is the CSS selected
100
+ * state, not the select word. The first observation is recorded and
101
+ * does not dispatch. Later changes dispatch a bubbling juice:change
102
+ * CustomEvent with detail { runtime: "touchable-row", state }.
103
+ *
104
+ * No Sig TouchableRow factory. Touchable-row is the thirtieth
105
+ * Emerging auto-enhance runtime.
106
+ */
107
+ export type TouchableRowOptions = {
108
+ root?: ParentNode;
109
+ touchableRowSelector?: string;
110
+ };
111
+ export type TouchableRowState = {
112
+ selected: boolean;
113
+ disabled: boolean;
114
+ };
115
+ export type TouchableRowController = {
116
+ destroy: () => void;
117
+ sync: () => void;
118
+ getState: (target?: HTMLElement | null) => TouchableRowState | null;
119
+ };
120
+ export declare const createTouchableRow: (options?: TouchableRowOptions) => TouchableRowController;
121
+ export declare const initTouchableRow: (options?: TouchableRowOptions) => TouchableRowController;
122
+ export declare const startTouchableRowRuntime: () => TouchableRowController | null;
123
+ export declare const stopTouchableRowRuntime: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citrusworx/juiceui",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -174,7 +174,7 @@
174
174
  "access": "public"
175
175
  },
176
176
  "dependencies": {
177
- "@citrusworx/sigjs": "^0.7.0"
177
+ "@citrusworx/sigjs": "^1.0.0"
178
178
  },
179
179
  "devDependencies": {
180
180
  "@testing-library/jest-dom": "^6.9.1",