@hozo/engine 0.2.0 → 0.3.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +34 -0
  3. package/dist/class-resolver.d.ts +28 -5
  4. package/dist/class-resolver.d.ts.map +1 -1
  5. package/dist/class-resolver.js +59 -22
  6. package/dist/class-resolver.js.map +1 -1
  7. package/dist/color-transition.d.ts.map +1 -1
  8. package/dist/color-transition.js +6 -0
  9. package/dist/color-transition.js.map +1 -1
  10. package/dist/generated/transform-slots.d.ts +2 -0
  11. package/dist/generated/transform-slots.d.ts.map +1 -0
  12. package/dist/generated/transform-slots.js +4 -0
  13. package/dist/generated/transform-slots.js.map +1 -0
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +1 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/interactive.d.ts +2 -0
  19. package/dist/interactive.d.ts.map +1 -1
  20. package/dist/interactive.js +4 -0
  21. package/dist/interactive.js.map +1 -1
  22. package/dist/project.d.ts +8 -0
  23. package/dist/project.d.ts.map +1 -1
  24. package/dist/project.js +9 -0
  25. package/dist/project.js.map +1 -1
  26. package/dist/project.native.d.ts +1 -1
  27. package/dist/project.native.d.ts.map +1 -1
  28. package/dist/project.native.js +1 -1
  29. package/dist/project.native.js.map +1 -1
  30. package/dist/transform-slots.d.ts +22 -0
  31. package/dist/transform-slots.d.ts.map +1 -0
  32. package/dist/transform-slots.js +108 -0
  33. package/dist/transform-slots.js.map +1 -0
  34. package/dist/view-base-css.d.ts +2 -0
  35. package/dist/view-base-css.d.ts.map +1 -0
  36. package/dist/view-base-css.js +20 -0
  37. package/dist/view-base-css.js.map +1 -0
  38. package/dist/view-base.d.ts +6 -0
  39. package/dist/view-base.d.ts.map +1 -0
  40. package/dist/view-base.js +15 -0
  41. package/dist/view-base.js.map +1 -0
  42. package/package.json +5 -1
  43. package/src/class-resolver.ts +93 -26
  44. package/src/color-transition.ts +6 -0
  45. package/src/generated/transform-slots.ts +3 -0
  46. package/src/index.ts +1 -1
  47. package/src/interactive.ts +4 -0
  48. package/src/project.native.ts +1 -1
  49. package/src/project.ts +11 -0
  50. package/src/transform-slots.ts +119 -0
  51. package/src/view-base-css.ts +19 -0
  52. package/src/view-base.ts +20 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @hozo/engine
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Interrupted colour transitions read the RGBA string produced by their previous
8
+ blend, preserving the intermediate colour when a new transition starts.
9
+
10
+ ### Minor Changes
11
+
12
+ - [#923](https://github.com/iray-tno/hozo/pull/923) [`8d58223`](https://github.com/iray-tno/hozo/commit/8d5822322607b6214fa7f57d233a9173a45815b6) Thanks [@iray-tno](https://github.com/iray-tno)! - Resolve Native pattern class-name slots through the project's runtime class resolver. Pattern controls now share the primitive interaction engine and deliver hover, focus, focus-visible and pressed facts to their actual owners instead of reporting pressed alone.
13
+
14
+ Static interaction styles are additionally wired for Chip, ColorPicker swatches, Pagination page controls and CommandPalette pointer-state item slots. Selection slots and nested controls retain their own ownership: a remove button does not inherit its row's focus, and a command item does not borrow the input's focus. Other static state slots and semantic predicates remain subject to their existing diagnostics.
15
+
16
+ Styled Button receives a pressed look; Checkbox and Switch indicators are real elements on both platforms rather than Native-invisible pseudo-elements. Non-transition Native Pressables and their Text children no longer allocate animation values/listeners. Interaction ownership remains mounted when transitions are added or removed. This removes idle animation work, not every initial-mount cost or every platform delivery difference; measured list mount/update tradeoffs remain tracked separately.
17
+
18
+ - [#923](https://github.com/iray-tno/hozo/pull/923) [`8d58223`](https://github.com/iray-tno/hozo/commit/8d5822322607b6214fa7f57d233a9173a45815b6) Thanks [@iray-tno](https://github.com/iray-tno)! - Compile project-defined Tailwind animations and their keyframes for both backends, including keyframes needed by dynamic class candidates. StyleX conditions inside property values now reach the shared condition model.
19
+
20
+ Extend Native negated conditions across supported environment, breakpoint, pixel-width, container, prop, sibling and interaction predicates. Link states use the existing interaction owner, descendant focus-visible follows that owner, and independent transform resets and runtime-state transform families compose without losing their other transform entries. Unsupported predicates are still diagnosed, not assumed false.
21
+
22
+ Respect project radius tokens and built-in radius overrides, discover runtime candidates in quoted class arrays, and preserve separate Native style keys for ternary branches. Caller classes override a component's resting look while explicit state classes retain their precedence. On Web, fallback candidate rules stay below authored Tailwind utilities, and conditional class selection reaches elements that remain components.
23
+
24
+ Native line-breaking utilities that cannot be represented now warn instead of failing the build. This does not implement Android/CJK line-break controls that React Native does not expose.
25
+
26
+ ### Patch Changes
27
+
28
+ - [#923](https://github.com/iray-tno/hozo/pull/923) [`8d58223`](https://github.com/iray-tno/hozo/commit/8d5822322607b6214fa7f57d233a9173a45815b6) Thanks [@iray-tno](https://github.com/iray-tno)! - Uncompiled View, Text and Image forward refs to their platform hosts. Container measurement preserves the host instead of replacing it, and Web View layout defaults agree between compiled output and fallback components.
29
+
30
+ An uncompiled Svg now uses its accessibility label as its name, as the compiled path already did. Web controls, including generated Canvas controls and form/pattern actions, show the shared clickable cursor without giving disabled controls an active pointer.
31
+
3
32
  ## 0.2.0
4
33
 
5
34
  - Add the Native `useHozoKeyframes` hook and generated animation ABI for the supported project-keyframe subset.
package/README.md CHANGED
@@ -13,6 +13,40 @@ platform adapter, because Hozo does not add a native module to every application
13
13
 
14
14
  **Contextual variants.** `dark:`, `sm:`/`md:`/`lg:`, and viewport-relative sizes are media queries on Web and subscriptions on Native. `useHozoDark`, `useHozoBreakpoint` and `useHozoViewport` are separate stores on purpose: a component using only `md:` must not re-render on every resize that does not cross a breakpoint.
15
15
 
16
+ **Native transform controls.** `rotate-none`, `scale-none`, `translate-none`, and
17
+ `transform-none` reset their own CSS transform property, not every transform.
18
+ For example, `rotate-45 scale-95 md:rotate-none` keeps its scale when the rotation
19
+ is reset. `transform`/`transform-cpu` restore the function-slot chain; they do not
20
+ switch Native rendering to a CPU backend. Unconditional controls compile into
21
+ plain StyleSheet values. Conditional controls and dynamic class strings use one
22
+ small slot composer, without extra state or subscriptions; dynamic results stay
23
+ cached by class string. `transform-gpu` still reports a diagnostic because a
24
+ browser compositing hint cannot force a Native hardware layer. Transform controls
25
+ combined with `starting:`/exit animation frames, or used as independent
26
+ `@keyframes` controls, remain explicitly unwired. Use explicit transform values
27
+ for those animation endpoints.
28
+
29
+ **Native negated variants.** `not-disabled:`, `not-enabled:`, `not-aria-*:`,
30
+ negated known sibling predicates such as `not-first:`/`not-last:`, and negated
31
+ supported environment queries such as `not-motion-reduce:` reuse the positive
32
+ predicate, including when stacked with other supported conditions. Prop predicates
33
+ need the same readable driver as their positive form; `not-disabled:` without a
34
+ `disabled` prop or an unreadable ARIA state is still a diagnostic, not a false value
35
+ to invert. `not-enabled:` follows the existing `enabled:` contract: without a
36
+ `disabled` prop, enabled is known true and its negation does not apply. Unknown
37
+ sibling positions and unsupported environment queries remain diagnostics too.
38
+ Boolean ARIA predicates match the literal `true` state; an optional state object
39
+ can be absent at runtime, and `checked: 'mixed'` is not treated as checked=true.
40
+ Known sibling predicates cost no runtime state; environment queries share their
41
+ existing hook. `not-focus:` and `not-focus-visible:` on Pressable/Button reuse
42
+ their existing interaction callback, including stacked conditions and transitions;
43
+ negated focus-visible alone enables the same pointer/keyboard modality inference
44
+ as its positive form. Text in that interaction context uses the owner's state,
45
+ not an independent text focus target, just as positive focus variants do. No new
46
+ store or subscription is added. Other elements without a readable focus driver
47
+ remain diagnostics. `not-hover:` and other unsupported selector negations remain
48
+ unwired.
49
+
16
50
  **Interaction state infrastructure.** The canonical `HozoPressable` in `@hozo/primitives` tracks
17
51
  pressed, hovered, focused and focus-visible state using the shared helpers owned here. Focus-visible
18
52
  follows the input modality, so a tap does not draw a focus ring and a Tab key does.
@@ -1,26 +1,49 @@
1
1
  /** A React Native style object, as the compiler emits it. */
2
2
  export type StyleObject = Record<string, unknown>;
3
+ /**
4
+ * The state an element is in when its runtime classes are resolved: what
5
+ * its pressable reports (`pressed`, `hovered`, `focused`, `focusVisible`)
6
+ * and what its props say: `disabled`, and `aria-checked`, `aria-selected` and
7
+ * the rest under their attribute names, so `aria-pressed` cannot be read as
8
+ * the pointer's `pressed`.
9
+ */
10
+ export type ClassState = Readonly<Record<string, unknown>>;
11
+ /**
12
+ * A class that applies only in a state: the state keys that all have to
13
+ * hold, and the style it applies then. `active:opacity-80` is
14
+ * `[['pressed'], { opacity: 0.8 }]`.
15
+ */
16
+ export type StateGroup = readonly [readonly string[], StyleObject];
3
17
  /**
4
18
  * Resolves whitespace-separated class names to React Native style objects.
5
19
  *
6
20
  * Returns an array, which is a valid `style` value on its own and also
7
21
  * nests inside one -- RN flattens arbitrarily nested style arrays, so
8
22
  * callers never have to spread it.
23
+ *
24
+ * `state` is what the element is in. Without it, a class that applies only
25
+ * in a state is reported as it always was; with it, that class applies
26
+ * when its state holds, after the unconditional ones.
9
27
  */
10
- export type ClassResolver = (value: unknown) => StyleObject[];
28
+ export type ClassResolver = (value: unknown, state?: ClassState) => StyleObject[];
11
29
  /**
12
30
  * Builds a resolver over one project's candidate map.
13
31
  *
14
32
  * Called by the generated candidate module rather than by application
15
- * code: `styles` and `unsupported` are build output, and binding them here
16
- * keeps the generated file to data plus one call.
33
+ * code: `styles`, `unsupported` and `states` are build output, and binding
34
+ * them here keeps the generated file to data plus one call.
17
35
  *
18
36
  * `unsupported` maps a class the compiler *recognized but can't express*
19
- * as a plain style object -- a conditional utility (`hover:`, `md:`), or
37
+ * as a plain style object -- a utility under a breakpoint or `dark:`, or
20
38
  * one that's Web-only -- to the reason. Those are reported when they're
21
39
  * actually used rather than at build time, because a class appearing in
22
40
  * the project's candidate scan doesn't mean any dynamic expression ever
23
41
  * produces it.
42
+ *
43
+ * `states` holds the classes whose only condition is the element's own
44
+ * state (#886). Those need no tracking here: the pressable that renders
45
+ * the element already tracks it and hands it in, so this stays a function
46
+ * of the class string and that state.
24
47
  */
25
- export declare function createClassResolver(styles: Record<string, StyleObject>, unsupported?: Record<string, string>): ClassResolver;
48
+ export declare function createClassResolver(styles: Record<string, StyleObject>, unsupported?: Record<string, string>, compose?: (styles: StyleObject[]) => StyleObject[], states?: Record<string, readonly StateGroup[]>): ClassResolver;
26
49
  //# sourceMappingURL=class-resolver.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"class-resolver.d.ts","sourceRoot":"","sources":["../src/class-resolver.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,WAAW,EAAE,CAAA;AAE7D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,WAAW,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACvC,aAAa,CA4Cf"}
1
+ {"version":3,"file":"class-resolver.d.ts","sourceRoot":"","sources":["../src/class-resolver.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEjD;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAE1D;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,SAAS,MAAM,EAAE,EAAE,WAAW,CAAC,CAAA;AAElE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,UAAU,KAAK,WAAW,EAAE,CAAA;AAYjF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,WAAW,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,EACxC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,EAClD,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,CAAM,GACjD,aAAa,CA0Ef"}
@@ -2,55 +2,92 @@
2
2
  * Builds a resolver over one project's candidate map.
3
3
  *
4
4
  * Called by the generated candidate module rather than by application
5
- * code: `styles` and `unsupported` are build output, and binding them here
6
- * keeps the generated file to data plus one call.
5
+ * code: `styles`, `unsupported` and `states` are build output, and binding
6
+ * them here keeps the generated file to data plus one call.
7
7
  *
8
8
  * `unsupported` maps a class the compiler *recognized but can't express*
9
- * as a plain style object -- a conditional utility (`hover:`, `md:`), or
9
+ * as a plain style object -- a utility under a breakpoint or `dark:`, or
10
10
  * one that's Web-only -- to the reason. Those are reported when they're
11
11
  * actually used rather than at build time, because a class appearing in
12
12
  * the project's candidate scan doesn't mean any dynamic expression ever
13
13
  * produces it.
14
+ *
15
+ * `states` holds the classes whose only condition is the element's own
16
+ * state (#886). Those need no tracking here: the pressable that renders
17
+ * the element already tracks it and hands it in, so this stays a function
18
+ * of the class string and that state.
14
19
  */
15
- export function createClassResolver(styles, unsupported = {}) {
20
+ export function createClassResolver(styles, unsupported = {}, compose, states = {}) {
16
21
  // Class strings repeat constantly across renders and list items, and the
17
22
  // result is immutable, so each distinct string is resolved once.
18
23
  const cache = new Map();
19
24
  // Warn once per class, not once per render -- a warning inside a list's
20
25
  // render path would otherwise repeat for every row, every frame.
21
26
  const warned = new Set();
22
- return function hozoClasses(value) {
23
- // Falsy is the normal case, not an error: `cond && 'p-4'` yields
24
- // `false` whenever the condition is off.
25
- if (typeof value !== 'string' || value === '') {
26
- return [];
27
- }
28
- const cached = cache.get(value);
29
- if (cached) {
30
- return cached;
31
- }
32
- const resolved = [];
27
+ const warn = (name, reason) => {
28
+ if (warned.has(name))
29
+ return;
30
+ warned.add(name);
31
+ // eslint-disable-next-line no-console
32
+ console.warn(`[hozo] ${reason}`);
33
+ };
34
+ function resolve(value) {
35
+ const base = [];
36
+ const groups = [];
37
+ const stateClasses = [];
33
38
  for (const name of value.split(/\s+/)) {
34
39
  if (name === '') {
35
40
  continue;
36
41
  }
37
42
  const style = styles[name];
38
43
  if (style) {
39
- resolved.push(style);
44
+ base.push(style);
45
+ continue;
46
+ }
47
+ const conditional = states[name];
48
+ if (conditional) {
49
+ groups.push(...conditional);
50
+ stateClasses.push(name);
40
51
  continue;
41
52
  }
42
53
  // An unknown class isn't necessarily a Hozo problem -- it may be an
43
54
  // app's own non-Tailwind class, or a testID-ish marker -- so only the
44
55
  // ones the compiler recognized and refused are reported.
45
56
  const reason = unsupported[name];
46
- if (reason && !warned.has(name)) {
47
- warned.add(name);
48
- // eslint-disable-next-line no-console
49
- console.warn(`[hozo] ${reason}`);
57
+ if (reason)
58
+ warn(name, reason);
59
+ }
60
+ return { base: compose ? compose(base) : base, raw: base, groups, stateClasses };
61
+ }
62
+ return function hozoClasses(value, state) {
63
+ // Falsy is the normal case, not an error: `cond && 'p-4'` yields
64
+ // `false` whenever the condition is off.
65
+ if (typeof value !== 'string' || value === '') {
66
+ return [];
67
+ }
68
+ let resolved = cache.get(value);
69
+ if (!resolved) {
70
+ resolved = resolve(value);
71
+ cache.set(value, resolved);
72
+ }
73
+ if (resolved.groups.length === 0)
74
+ return resolved.base;
75
+ if (state === undefined) {
76
+ for (const name of resolved.stateClasses) {
77
+ warn(name, `\`${name}\` applies in a state, and this element hands its classes no state to ` +
78
+ 'resolve it against. Put it on a Pressable, Button or Link, or write it as a static ' +
79
+ 'className so it compiles to a real style variant.');
50
80
  }
81
+ return resolved.base;
51
82
  }
52
- cache.set(value, resolved);
53
- return resolved;
83
+ const active = resolved.groups.filter(([keys]) => keys.every((key) => Boolean(state[key])));
84
+ if (active.length === 0)
85
+ return resolved.base;
86
+ const all = [...resolved.raw, ...active.map(([, style]) => style)];
87
+ // A state style can carry a transform, which `compose` folds into one;
88
+ // so it runs over the whole list, and the result is per render rather
89
+ // than cached -- it changes with the state.
90
+ return compose ? compose(all) : all;
54
91
  };
55
92
  }
56
93
  //# sourceMappingURL=class-resolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"class-resolver.js","sourceRoot":"","sources":["../src/class-resolver.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAmC,EACnC,WAAW,GAA2B,EAAE;IAExC,yEAAyE;IACzE,iEAAiE;IACjE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAA;IAC9C,wEAAwE;IACxE,iEAAiE;IACjE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;IAEhC,OAAO,SAAS,WAAW,CAAC,KAAc;QACxC,iEAAiE;QACjE,yCAAyC;QACzC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;YAC9C,OAAO,EAAE,CAAA;QACX,CAAC;QAED,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC/B,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAA;QACf,CAAC;QAED,MAAM,QAAQ,GAAkB,EAAE,CAAA;QAClC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;gBAChB,SAAQ;YACV,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;YAC1B,IAAI,KAAK,EAAE,CAAC;gBACV,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACpB,SAAQ;YACV,CAAC;YACD,oEAAoE;YACpE,sEAAsE;YACtE,yDAAyD;YACzD,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC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OAAO,QAAQ,CAAC,IAAI,CAAA;QACtD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,YAAY,EAAE,CAAC;gBACzC,IAAI,CACF,IAAI,EACJ,KAAK,IAAI,wEAAwE;oBAC/E,qFAAqF;oBACrF,mDAAmD,CACtD,CAAA;YACH,CAAC;YACD,OAAO,QAAQ,CAAC,IAAI,CAAA;QACtB,CAAC;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QAC3F,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,QAAQ,CAAC,IAAI,CAAA;QAC7C,MAAM,GAAG,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;QAClE,uEAAuE;QACvE,sEAAsE;QACtE,4CAA4C;QAC5C,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IACrC,CAAC,CAAA;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"color-transition.d.ts","sourceRoot":"","sources":["../src/color-transition.ts"],"names":[],"mappings":"AAeA,sFAAsF;AACtF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAUpE"}
1
+ {"version":3,"file":"color-transition.d.ts","sourceRoot":"","sources":["../src/color-transition.ts"],"names":[],"mappings":"AAqBA,sFAAsF;AACtF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAUpE"}
@@ -1,6 +1,12 @@
1
1
  function rgba(color) {
2
2
  if (color === 'transparent')
3
3
  return [0, 0, 0, 0];
4
+ // An interrupted blend must be able to read its own serialized result.
5
+ const blended = /^rgba\((\d+), (\d+), (\d+), ([\d.e+-]+)\)$/.exec(color);
6
+ if (blended) {
7
+ const channels = blended.slice(1).map(Number);
8
+ return channels.every(Number.isFinite) ? channels : null;
9
+ }
4
10
  const match = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(color);
5
11
  if (!match)
6
12
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"color-transition.js","sourceRoot":"","sources":["../src/color-transition.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,CAAC,KAAa;IACzB,IAAI,KAAK,KAAK,aAAa;QAAE,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAChD,MAAM,KAAK,GAAG,2CAA2C,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACrE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,CAAE,CAAA;IACnB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3E,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACxE,OAAO;QACL,QAAQ,CAAC,GAAG,CAAC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AAsF;AACtF,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,EAAU,EAAE,QAAgB;IACnE,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAA;IACpB,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAA;IAClB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/C,kEAAkE;IAClE,qEAAqE;IACrE,gEAAgE;IAChE,cAAc;IACd,MAAM,EAAE,GAAG,CAAC,KAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,QAAQ,CAAA;IAChF,OAAO,QAAQ,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;AAC3F,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { hozoTransformStyles } from '../transform-slots.ts';
2
+ //# sourceMappingURL=transform-slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-slots.d.ts","sourceRoot":"","sources":["../../src/generated/transform-slots.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,4 @@
1
+ // Only reset-bearing generated code imports the slot composer. Ordinary
2
+ // dynamic resolution must not pull this module into a Native bundle.
3
+ export { hozoTransformStyles } from '../transform-slots.js';
4
+ //# sourceMappingURL=transform-slots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-slots.js","sourceRoot":"","sources":["../../src/generated/transform-slots.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,qEAAqE;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA"}
package/dist/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export { hozoInteractive } from './interactive.ts';
8
8
  export { type HozoResponderEvent, type HozoResponderTouch, type HozoTouchHistory, type HozoTouchTrack, type ResponderProps, useResponderDomProps, } from './responder.ts';
9
9
  export { hozoScrollable } from './scrollable.ts';
10
10
  export { HOZO_DEFAULT_FONT_SIZE, HozoTextSizeContext, useHozoTextSize, } from './text-size.ts';
11
+ export { hozoViewBase, hozoViewClassName } from './view-base.ts';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACnC,yBAAyB,GAC1B,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,KAAK,aAAa,EAAE,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,KAAK,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,GAChB,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACnC,yBAAyB,GAC1B,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,KAAK,aAAa,EAAE,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAE,KAAK,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,oBAAoB,GACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,GAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -27,4 +27,5 @@ export { hozoInteractive } from './interactive.js';
27
27
  export { useResponderDomProps, } from './responder.js';
28
28
  export { hozoScrollable } from './scrollable.js';
29
29
  export { HOZO_DEFAULT_FONT_SIZE, HozoTextSizeContext, useHozoTextSize, } from './text-size.js';
30
+ export { hozoViewBase, hozoViewClassName } from './view-base.js';
30
31
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,+DAA+D;AAC/D,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,uBAAuB;AACvB,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,qEAAqE;AACrE,qEAAqE;AACrE,0EAA0E;AAC1E,0EAA0E;AAC1E,0DAA0D;AAE1D,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EAIrB,yBAAyB,GAC1B,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAsB,mBAAmB,EAAoB,MAAM,qBAAqB,CAAA;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAqB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAML,oBAAoB,GACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,GAChB,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,+DAA+D;AAC/D,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,uBAAuB;AACvB,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,qEAAqE;AACrE,qEAAqE;AACrE,0EAA0E;AAC1E,0EAA0E;AAC1E,0DAA0D;AAE1D,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EAIrB,yBAAyB,GAC1B,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAsB,mBAAmB,EAAoB,MAAM,qBAAqB,CAAA;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,EAAqB,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAML,oBAAoB,GACrB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,GAChB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
@@ -15,6 +15,7 @@ type PressHandler = (event: never) => void;
15
15
  export declare function hozoInteractive(onPress?: PressHandler, disabled?: unknown): {
16
16
  'aria-disabled': boolean;
17
17
  'data-hozo-disabled': string;
18
+ 'data-hozo-pressable': undefined;
18
19
  tabIndex: number;
19
20
  onClick: undefined;
20
21
  onKeyDown: undefined;
@@ -22,6 +23,7 @@ export declare function hozoInteractive(onPress?: PressHandler, disabled?: unkno
22
23
  } | {
23
24
  'aria-disabled': undefined;
24
25
  'data-hozo-disabled': undefined;
26
+ 'data-hozo-pressable': string | undefined;
25
27
  tabIndex: number;
26
28
  onClick: PressHandler | undefined;
27
29
  onKeyDown: typeof hozoActivateKeyDown;
@@ -1 +1 @@
1
- {"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtE,wEAAwE;AACxE,KAAK,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;AAE1C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,OAAO;;;;;;;;;;;;;;EA+BzE"}
1
+ {"version":3,"file":"interactive.d.ts","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtE,wEAAwE;AACxE,KAAK,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;AAE1C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,OAAO;;;;;;;;;;;;;;;;EAmCzE"}
@@ -44,6 +44,7 @@ export function hozoInteractive(onPress, disabled) {
44
44
  // a boolean here would have made every control permanently
45
45
  // disabled-looking. `undefined` is the only value React omits.
46
46
  'data-hozo-disabled': '',
47
+ 'data-hozo-pressable': undefined,
47
48
  tabIndex: -1,
48
49
  onClick: undefined,
49
50
  onKeyDown: undefined,
@@ -55,6 +56,9 @@ export function hozoInteractive(onPress, disabled) {
55
56
  // is noise a screen reader has to read past.
56
57
  'aria-disabled': undefined,
57
58
  'data-hozo-disabled': undefined,
59
+ // The pointer cursor's hook (see the view base CSS): present only
60
+ // while clicking does something.
61
+ 'data-hozo-pressable': onPress ? '' : undefined,
58
62
  tabIndex: 0,
59
63
  onClick: onPress,
60
64
  onKeyDown: hozoActivateKeyDown,
@@ -1 +1 @@
1
- {"version":3,"file":"interactive.js","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,0EAA0E;AAC1E,sDAAsD;AACtD,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,0EAA0E;AAC1E,yEAAyE;AACzE,qDAAqD;AACrD,EAAE;AACF,uEAAuE;AACvE,8BAA8B;AAC9B,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,0DAA0D;AAE1D,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAKtE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsB,EAAE,QAAkB;IACxE,OAAO,QAAQ;QACb,CAAC,CAAC;YACE,eAAe,EAAE,IAAI;YACrB,8DAA8D;YAC9D,kEAAkE;YAClE,kEAAkE;YAClE,4DAA4D;YAC5D,EAAE;YACF,iEAAiE;YACjE,iEAAiE;YACjE,kEAAkE;YAClE,2DAA2D;YAC3D,+DAA+D;YAC/D,oBAAoB,EAAE,EAAE;YACxB,QAAQ,EAAE,CAAC,CAAC;YACZ,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;SACnB;QACH,CAAC,CAAC;YACE,+DAA+D;YAC/D,mEAAmE;YACnE,6CAA6C;YAC7C,eAAe,EAAE,SAAS;YAC1B,oBAAoB,EAAE,SAAS;YAC/B,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,mBAAmB;YAC9B,OAAO,EAAE,iBAAiB;SAC3B,CAAA;AACP,CAAC"}
1
+ {"version":3,"file":"interactive.js","sourceRoot":"","sources":["../src/interactive.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,0EAA0E;AAC1E,sDAAsD;AACtD,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,0EAA0E;AAC1E,yEAAyE;AACzE,qDAAqD;AACrD,EAAE;AACF,uEAAuE;AACvE,8BAA8B;AAC9B,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,0DAA0D;AAE1D,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAKtE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsB,EAAE,QAAkB;IACxE,OAAO,QAAQ;QACb,CAAC,CAAC;YACE,eAAe,EAAE,IAAI;YACrB,8DAA8D;YAC9D,kEAAkE;YAClE,kEAAkE;YAClE,4DAA4D;YAC5D,EAAE;YACF,iEAAiE;YACjE,iEAAiE;YACjE,kEAAkE;YAClE,2DAA2D;YAC3D,+DAA+D;YAC/D,oBAAoB,EAAE,EAAE;YACxB,qBAAqB,EAAE,SAAS;YAChC,QAAQ,EAAE,CAAC,CAAC;YACZ,OAAO,EAAE,SAAS;YAClB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;SACnB;QACH,CAAC,CAAC;YACE,+DAA+D;YAC/D,mEAAmE;YACnE,6CAA6C;YAC7C,eAAe,EAAE,SAAS;YAC1B,oBAAoB,EAAE,SAAS;YAC/B,kEAAkE;YAClE,iCAAiC;YACjC,qBAAqB,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;YAC/C,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,mBAAmB;YAC9B,OAAO,EAAE,iBAAiB;SAC3B,CAAA;AACP,CAAC"}
package/dist/project.d.ts CHANGED
@@ -7,4 +7,12 @@
7
7
  * reset is the common case and was the fallback before this entry existed.
8
8
  */
9
9
  export declare const hozoPreflight = true;
10
+ /**
11
+ * The project's class resolver, for code the compiler does not lower --
12
+ * `@hozo/patterns`' Native components resolve their class props through it
13
+ * (#886). Redirected to the generated candidate module like `hozoPreflight`;
14
+ * unconfigured, there is no candidate map, so it resolves nothing, which is
15
+ * what those props did before.
16
+ */
17
+ export declare const hozoClasses: import("./class-resolver.ts").ClassResolver;
10
18
  //# sourceMappingURL=project.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,OAAO,CAAA"}
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,OAAO,CAAA;AAEjC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,6CAA0B,CAAA"}
package/dist/project.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { createClassResolver } from './class-resolver.js';
1
2
  /**
2
3
  * Project-wide Native defaults when no bundler integration supplies them.
3
4
  *
@@ -7,4 +8,12 @@
7
8
  * reset is the common case and was the fallback before this entry existed.
8
9
  */
9
10
  export const hozoPreflight = true;
11
+ /**
12
+ * The project's class resolver, for code the compiler does not lower --
13
+ * `@hozo/patterns`' Native components resolve their class props through it
14
+ * (#886). Redirected to the generated candidate module like `hozoPreflight`;
15
+ * unconfigured, there is no candidate map, so it resolves nothing, which is
16
+ * what those props did before.
17
+ */
18
+ export const hozoClasses = createClassResolver({});
10
19
  //# sourceMappingURL=project.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAA"}
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAA;AAEjC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC,EAAE,CAAC,CAAA"}
@@ -1,2 +1,2 @@
1
- export { hozoPreflight } from './project.ts';
1
+ export { hozoClasses, hozoPreflight } from './project.ts';
2
2
  //# sourceMappingURL=project.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.native.d.ts","sourceRoot":"","sources":["../src/project.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"project.native.d.ts","sourceRoot":"","sources":["../src/project.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
@@ -1,2 +1,2 @@
1
- export { hozoPreflight } from './project.js';
1
+ export { hozoClasses, hozoPreflight } from './project.js';
2
2
  //# sourceMappingURL=project.native.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.native.js","sourceRoot":"","sources":["../src/project.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"project.native.js","sourceRoot":"","sources":["../src/project.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,22 @@
1
+ export type TransformEntry = Record<string, number | string | readonly number[]>;
2
+ type Mode = 'slots' | 'authored' | 'none';
3
+ export interface TransformSlots {
4
+ translate?: Mode;
5
+ translateSlots?: TransformEntry[];
6
+ translateAuthored?: TransformEntry[];
7
+ rotate?: TransformEntry[];
8
+ scale?: Mode;
9
+ scaleSlots?: TransformEntry[];
10
+ scale3d?: boolean;
11
+ scaleAuthored?: TransformEntry[];
12
+ functions?: Mode;
13
+ functionsSlots?: TransformEntry[];
14
+ functionsAuthored?: TransformEntry[];
15
+ }
16
+ type Style = Record<string, unknown>;
17
+ export type TransformSpec = readonly [Style, TransformSlots];
18
+ export type TransformStyle = Style | false | null | undefined | readonly TransformStyle[];
19
+ /** Only generated reset-bearing boundaries need this; plain styles bypass it. */
20
+ export declare function hozoTransformStyles(styles: readonly TransformStyle[], specs: readonly TransformSpec[] | ReadonlyMap<Style, TransformSlots>): Style[];
21
+ export {};
22
+ //# sourceMappingURL=transform-slots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-slots.d.ts","sourceRoot":"","sources":["../src/transform-slots.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAA;AAChF,KAAK,IAAI,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAA;AACzC,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,cAAc,CAAC,EAAE,cAAc,EAAE,CAAA;IACjC,iBAAiB,CAAC,EAAE,cAAc,EAAE,CAAA;IACpC,MAAM,CAAC,EAAE,cAAc,EAAE,CAAA;IACzB,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,UAAU,CAAC,EAAE,cAAc,EAAE,CAAA;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,aAAa,CAAC,EAAE,cAAc,EAAE,CAAA;IAChC,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,cAAc,CAAC,EAAE,cAAc,EAAE,CAAA;IACjC,iBAAiB,CAAC,EAAE,cAAc,EAAE,CAAA;CACrC;AACD,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AACpC,MAAM,MAAM,aAAa,GAAG,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAAA;AAC5D,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,cAAc,EAAE,CAAA;AAEzF,iFAAiF;AACjF,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,cAAc,EAAE,EACjC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,GACnE,KAAK,EAAE,CA6FT"}
@@ -0,0 +1,108 @@
1
+ /** Only generated reset-bearing boundaries need this; plain styles bypass it. */
2
+ export function hozoTransformStyles(styles, specs) {
3
+ // Candidate maps can contain thousands of entries. They pre-index once;
4
+ // resolving one class string must never walk the entire project map.
5
+ const metadata = Array.isArray(specs)
6
+ ? new Map(specs)
7
+ : specs;
8
+ const result = [];
9
+ const families = {
10
+ translate: {
11
+ slots: new Map(),
12
+ authored: [],
13
+ mode: 'slots',
14
+ },
15
+ scale: {
16
+ slots: new Map(),
17
+ authored: [],
18
+ mode: 'slots',
19
+ },
20
+ functions: {
21
+ slots: new Map(),
22
+ authored: [],
23
+ mode: 'slots',
24
+ },
25
+ };
26
+ let rotate = [];
27
+ let scale3d = false;
28
+ let touched = false;
29
+ function visit(style) {
30
+ if (!style)
31
+ return;
32
+ if (Array.isArray(style)) {
33
+ for (const part of style)
34
+ visit(part);
35
+ return;
36
+ }
37
+ const object = style;
38
+ const slots = metadata.get(object);
39
+ if (!slots) {
40
+ result.push(object);
41
+ // An authored RN transform is a whole-array override, not CSS slots.
42
+ if ('transform' in object) {
43
+ for (const family of Object.values(families)) {
44
+ family.slots.clear();
45
+ family.authored = [];
46
+ family.mode = 'none';
47
+ }
48
+ rotate = [];
49
+ scale3d = false;
50
+ touched = false;
51
+ }
52
+ return;
53
+ }
54
+ const { transform: _transform, ...rest } = object;
55
+ if (Object.keys(rest).length)
56
+ result.push(rest);
57
+ touched = true;
58
+ if (slots.rotate)
59
+ rotate = slots.rotate;
60
+ if (slots.scale3d !== undefined)
61
+ scale3d = slots.scale3d;
62
+ for (const name of ['translate', 'scale', 'functions']) {
63
+ const family = families[name];
64
+ for (const entry of slots[`${name}Slots`] ?? []) {
65
+ // A uniform 2D scale writes both registers. Keep Z's matrix separate.
66
+ if (name === 'scale' && 'scale' in entry) {
67
+ family.slots.set('scaleX', { scaleX: entry.scale });
68
+ family.slots.set('scaleY', { scaleY: entry.scale });
69
+ }
70
+ else {
71
+ const key = Object.keys(entry)[0];
72
+ if (key)
73
+ family.slots.set(key, entry);
74
+ }
75
+ }
76
+ const authored = slots[`${name}Authored`];
77
+ if (authored)
78
+ family.authored = authored;
79
+ if (slots[name])
80
+ family.mode = slots[name];
81
+ }
82
+ }
83
+ for (const style of styles)
84
+ visit(style);
85
+ if (touched) {
86
+ const output = (name, keys) => {
87
+ const family = families[name];
88
+ if (family.mode === 'none')
89
+ return [];
90
+ if (family.mode === 'authored')
91
+ return family.authored;
92
+ return keys.flatMap((key) => {
93
+ const entry = family.slots.get(key);
94
+ return entry ? [entry] : [];
95
+ });
96
+ };
97
+ result.push({
98
+ transform: [
99
+ ...output('translate', ['translateX', 'translateY', 'matrix']),
100
+ ...rotate,
101
+ ...output('scale', scale3d ? ['scaleX', 'scaleY', 'matrix'] : ['scaleX', 'scaleY']),
102
+ ...output('functions', ['rotateX', 'rotateY', 'rotateZ', 'skewX', 'skewY']),
103
+ ],
104
+ });
105
+ }
106
+ return result;
107
+ }
108
+ //# sourceMappingURL=transform-slots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-slots.js","sourceRoot":"","sources":["../src/transform-slots.ts"],"names":[],"mappings":"AAqBA,iFAAiF;AACjF,MAAM,UAAU,mBAAmB,CACjC,MAAiC,EACjC,KAAoE;IAEpE,wEAAwE;IACxE,qEAAqE;IACrE,MAAM,QAAQ,GAAuC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACvE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC;QAChB,CAAC,CAAE,KAA4C,CAAA;IACjD,MAAM,MAAM,GAAY,EAAE,CAAA;IAC1B,MAAM,QAAQ,GAAG;QACf,SAAS,EAAE;YACT,KAAK,EAAE,IAAI,GAAG,EAA0B;YACxC,QAAQ,EAAE,EAAsB;YAChC,IAAI,EAAE,OAAe;SACtB;QACD,KAA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
+ export declare const HOZO_VIEW_BASE_CSS = "@layer base {\n :where(.hozo-view) {\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n position: relative;\n min-width: 0;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n border: 0 solid;\n }\n\n :where([data-hozo-pressable]:not(:disabled, [data-hozo-disabled], [aria-disabled=\"true\"])) {\n cursor: pointer;\n }\n}\n";
2
+ //# sourceMappingURL=view-base-css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-base-css.d.ts","sourceRoot":"","sources":["../src/view-base-css.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB,yXAiB9B,CAAA"}
@@ -0,0 +1,20 @@
1
+ // Generated by scripts/view-base.mjs from the Web backend's shared CSS.
2
+ export const HOZO_VIEW_BASE_CSS = `@layer base {
3
+ :where(.hozo-view) {
4
+ display: flex;
5
+ flex-direction: column;
6
+ flex-shrink: 0;
7
+ position: relative;
8
+ min-width: 0;
9
+ box-sizing: border-box;
10
+ margin: 0;
11
+ padding: 0;
12
+ border: 0 solid;
13
+ }
14
+
15
+ :where([data-hozo-pressable]:not(:disabled, [data-hozo-disabled], [aria-disabled="true"])) {
16
+ cursor: pointer;
17
+ }
18
+ }
19
+ `;
20
+ //# sourceMappingURL=view-base-css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-base-css.js","sourceRoot":"","sources":["../src/view-base-css.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;CAiBjC,CAAA"}
@@ -0,0 +1,6 @@
1
+ export declare function hozoViewBase(): import("react").ReactElement<{
2
+ href: string;
3
+ precedence: string;
4
+ }, string | import("react").JSXElementConstructor<any>>;
5
+ export declare function hozoViewClassName(className?: string): string;
6
+ //# sourceMappingURL=view-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-base.d.ts","sourceRoot":"","sources":["../src/view-base.ts"],"names":[],"mappings":"AAYA,wBAAgB,YAAY;;;wDAE3B;AAED,wBAAgB,iBAAiB,CAAC,SAAS,CAAC,EAAE,MAAM,UAGnD"}
@@ -0,0 +1,15 @@
1
+ import { createElement } from 'react';
2
+ import { HOZO_VIEW_BASE_CSS } from './view-base-css.js';
3
+ // A React 19 stylesheet resource, not an effect or a DOM mutation. React
4
+ // hoists and deduplicates it in SSR and on the client, even if every box asks
5
+ // for it. Defaults belong in CSS, not inline styles that defeat utilities.
6
+ const resource = createElement('style', { href: 'hozo-view-base', precedence: 'hozo-base' }, HOZO_VIEW_BASE_CSS);
7
+ export function hozoViewBase() {
8
+ return resource;
9
+ }
10
+ export function hozoViewClassName(className) {
11
+ if (!className)
12
+ return 'hozo-view';
13
+ return className.split(/\s+/).includes('hozo-view') ? className : `hozo-view ${className}`;
14
+ }
15
+ //# sourceMappingURL=view-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-base.js","sourceRoot":"","sources":["../src/view-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEvD,yEAAyE;AACzE,8EAA8E;AAC9E,2EAA2E;AAC3E,MAAM,QAAQ,GAAG,aAAa,CAC5B,OAAO,EACP,EAAE,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,EACnD,kBAAkB,CACnB,CAAA;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAkB;IAClD,IAAI,CAAC,SAAS;QAAE,OAAO,WAAW,CAAA;IAClC,OAAO,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,SAAS,EAAE,CAAA;AAC5F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hozo/engine",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Runtime fallback for genuinely dynamic styles, interactive behavior, and accessibility behavior.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -85,6 +85,10 @@
85
85
  "types": "./dist/generated/scrollable.d.ts",
86
86
  "default": "./dist/generated/scrollable.js"
87
87
  },
88
+ "./generated/transform-slots": {
89
+ "types": "./dist/generated/transform-slots.d.ts",
90
+ "default": "./dist/generated/transform-slots.js"
91
+ },
88
92
  "./package.json": "./package.json"
89
93
  },
90
94
  "files": [
@@ -1,74 +1,141 @@
1
1
  /** A React Native style object, as the compiler emits it. */
2
2
  export type StyleObject = Record<string, unknown>
3
3
 
4
+ /**
5
+ * The state an element is in when its runtime classes are resolved: what
6
+ * its pressable reports (`pressed`, `hovered`, `focused`, `focusVisible`)
7
+ * and what its props say: `disabled`, and `aria-checked`, `aria-selected` and
8
+ * the rest under their attribute names, so `aria-pressed` cannot be read as
9
+ * the pointer's `pressed`.
10
+ */
11
+ export type ClassState = Readonly<Record<string, unknown>>
12
+
13
+ /**
14
+ * A class that applies only in a state: the state keys that all have to
15
+ * hold, and the style it applies then. `active:opacity-80` is
16
+ * `[['pressed'], { opacity: 0.8 }]`.
17
+ */
18
+ export type StateGroup = readonly [readonly string[], StyleObject]
19
+
4
20
  /**
5
21
  * Resolves whitespace-separated class names to React Native style objects.
6
22
  *
7
23
  * Returns an array, which is a valid `style` value on its own and also
8
24
  * nests inside one -- RN flattens arbitrarily nested style arrays, so
9
25
  * callers never have to spread it.
26
+ *
27
+ * `state` is what the element is in. Without it, a class that applies only
28
+ * in a state is reported as it always was; with it, that class applies
29
+ * when its state holds, after the unconditional ones.
10
30
  */
11
- export type ClassResolver = (value: unknown) => StyleObject[]
31
+ export type ClassResolver = (value: unknown, state?: ClassState) => StyleObject[]
32
+
33
+ interface Resolved {
34
+ /** The unconditional styles, composed: what a string with no state classes returns. */
35
+ base: StyleObject[]
36
+ /** The same, before `compose`, for composing again with state styles. */
37
+ raw: StyleObject[]
38
+ groups: StateGroup[]
39
+ /** State classes in this string, named if it is resolved without a state. */
40
+ stateClasses: string[]
41
+ }
12
42
 
13
43
  /**
14
44
  * Builds a resolver over one project's candidate map.
15
45
  *
16
46
  * Called by the generated candidate module rather than by application
17
- * code: `styles` and `unsupported` are build output, and binding them here
18
- * keeps the generated file to data plus one call.
47
+ * code: `styles`, `unsupported` and `states` are build output, and binding
48
+ * them here keeps the generated file to data plus one call.
19
49
  *
20
50
  * `unsupported` maps a class the compiler *recognized but can't express*
21
- * as a plain style object -- a conditional utility (`hover:`, `md:`), or
51
+ * as a plain style object -- a utility under a breakpoint or `dark:`, or
22
52
  * one that's Web-only -- to the reason. Those are reported when they're
23
53
  * actually used rather than at build time, because a class appearing in
24
54
  * the project's candidate scan doesn't mean any dynamic expression ever
25
55
  * produces it.
56
+ *
57
+ * `states` holds the classes whose only condition is the element's own
58
+ * state (#886). Those need no tracking here: the pressable that renders
59
+ * the element already tracks it and hands it in, so this stays a function
60
+ * of the class string and that state.
26
61
  */
27
62
  export function createClassResolver(
28
63
  styles: Record<string, StyleObject>,
29
64
  unsupported: Record<string, string> = {},
65
+ compose?: (styles: StyleObject[]) => StyleObject[],
66
+ states: Record<string, readonly StateGroup[]> = {},
30
67
  ): ClassResolver {
31
68
  // Class strings repeat constantly across renders and list items, and the
32
69
  // result is immutable, so each distinct string is resolved once.
33
- const cache = new Map<string, StyleObject[]>()
70
+ const cache = new Map<string, Resolved>()
34
71
  // Warn once per class, not once per render -- a warning inside a list's
35
72
  // render path would otherwise repeat for every row, every frame.
36
73
  const warned = new Set<string>()
74
+ const warn = (name: string, reason: string) => {
75
+ if (warned.has(name)) return
76
+ warned.add(name)
77
+ // eslint-disable-next-line no-console
78
+ console.warn(`[hozo] ${reason}`)
79
+ }
37
80
 
38
- return function hozoClasses(value: unknown): StyleObject[] {
39
- // Falsy is the normal case, not an error: `cond && 'p-4'` yields
40
- // `false` whenever the condition is off.
41
- if (typeof value !== 'string' || value === '') {
42
- return []
43
- }
44
-
45
- const cached = cache.get(value)
46
- if (cached) {
47
- return cached
48
- }
49
-
50
- const resolved: StyleObject[] = []
81
+ function resolve(value: string): Resolved {
82
+ const base: StyleObject[] = []
83
+ const groups: StateGroup[] = []
84
+ const stateClasses: string[] = []
51
85
  for (const name of value.split(/\s+/)) {
52
86
  if (name === '') {
53
87
  continue
54
88
  }
55
89
  const style = styles[name]
56
90
  if (style) {
57
- resolved.push(style)
91
+ base.push(style)
92
+ continue
93
+ }
94
+ const conditional = states[name]
95
+ if (conditional) {
96
+ groups.push(...conditional)
97
+ stateClasses.push(name)
58
98
  continue
59
99
  }
60
100
  // An unknown class isn't necessarily a Hozo problem -- it may be an
61
101
  // app's own non-Tailwind class, or a testID-ish marker -- so only the
62
102
  // ones the compiler recognized and refused are reported.
63
103
  const reason = unsupported[name]
64
- if (reason && !warned.has(name)) {
65
- warned.add(name)
66
- // eslint-disable-next-line no-console
67
- console.warn(`[hozo] ${reason}`)
68
- }
104
+ if (reason) warn(name, reason)
105
+ }
106
+ return { base: compose ? compose(base) : base, raw: base, groups, stateClasses }
107
+ }
108
+
109
+ return function hozoClasses(value: unknown, state?: ClassState): StyleObject[] {
110
+ // Falsy is the normal case, not an error: `cond && 'p-4'` yields
111
+ // `false` whenever the condition is off.
112
+ if (typeof value !== 'string' || value === '') {
113
+ return []
69
114
  }
70
115
 
71
- cache.set(value, resolved)
72
- return resolved
116
+ let resolved = cache.get(value)
117
+ if (!resolved) {
118
+ resolved = resolve(value)
119
+ cache.set(value, resolved)
120
+ }
121
+ if (resolved.groups.length === 0) return resolved.base
122
+ if (state === undefined) {
123
+ for (const name of resolved.stateClasses) {
124
+ warn(
125
+ name,
126
+ `\`${name}\` applies in a state, and this element hands its classes no state to ` +
127
+ 'resolve it against. Put it on a Pressable, Button or Link, or write it as a static ' +
128
+ 'className so it compiles to a real style variant.',
129
+ )
130
+ }
131
+ return resolved.base
132
+ }
133
+ const active = resolved.groups.filter(([keys]) => keys.every((key) => Boolean(state[key])))
134
+ if (active.length === 0) return resolved.base
135
+ const all = [...resolved.raw, ...active.map(([, style]) => style)]
136
+ // A state style can carry a transform, which `compose` folds into one;
137
+ // so it runs over the whole list, and the result is per render rather
138
+ // than cached -- it changes with the state.
139
+ return compose ? compose(all) : all
73
140
  }
74
141
  }
@@ -1,5 +1,11 @@
1
1
  function rgba(color: string): [number, number, number, number] | null {
2
2
  if (color === 'transparent') return [0, 0, 0, 0]
3
+ // An interrupted blend must be able to read its own serialized result.
4
+ const blended = /^rgba\((\d+), (\d+), (\d+), ([\d.e+-]+)\)$/.exec(color)
5
+ if (blended) {
6
+ const channels = blended.slice(1).map(Number) as [number, number, number, number]
7
+ return channels.every(Number.isFinite) ? channels : null
8
+ }
3
9
  const match = /^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(color)
4
10
  if (!match) return null
5
11
  let hex = match[1]!
@@ -0,0 +1,3 @@
1
+ // Only reset-bearing generated code imports the slot composer. Ordinary
2
+ // dynamic resolution must not pull this module into a Native bundle.
3
+ export { hozoTransformStyles } from '../transform-slots.ts'
package/src/index.ts CHANGED
@@ -42,9 +42,9 @@ export {
42
42
  useResponderDomProps,
43
43
  } from './responder.ts'
44
44
  export { hozoScrollable } from './scrollable.ts'
45
-
46
45
  export {
47
46
  HOZO_DEFAULT_FONT_SIZE,
48
47
  HozoTextSizeContext,
49
48
  useHozoTextSize,
50
49
  } from './text-size.ts'
50
+ export { hozoViewBase, hozoViewClassName } from './view-base.ts'
@@ -49,6 +49,7 @@ export function hozoInteractive(onPress?: PressHandler, disabled?: unknown) {
49
49
  // a boolean here would have made every control permanently
50
50
  // disabled-looking. `undefined` is the only value React omits.
51
51
  'data-hozo-disabled': '',
52
+ 'data-hozo-pressable': undefined,
52
53
  tabIndex: -1,
53
54
  onClick: undefined,
54
55
  onKeyDown: undefined,
@@ -60,6 +61,9 @@ export function hozoInteractive(onPress?: PressHandler, disabled?: unknown) {
60
61
  // is noise a screen reader has to read past.
61
62
  'aria-disabled': undefined,
62
63
  'data-hozo-disabled': undefined,
64
+ // The pointer cursor's hook (see the view base CSS): present only
65
+ // while clicking does something.
66
+ 'data-hozo-pressable': onPress ? '' : undefined,
63
67
  tabIndex: 0,
64
68
  onClick: onPress,
65
69
  onKeyDown: hozoActivateKeyDown,
@@ -1 +1 @@
1
- export { hozoPreflight } from './project.ts'
1
+ export { hozoClasses, hozoPreflight } from './project.ts'
package/src/project.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { createClassResolver } from './class-resolver.ts'
2
+
1
3
  /**
2
4
  * Project-wide Native defaults when no bundler integration supplies them.
3
5
  *
@@ -7,3 +9,12 @@
7
9
  * reset is the common case and was the fallback before this entry existed.
8
10
  */
9
11
  export const hozoPreflight = true
12
+
13
+ /**
14
+ * The project's class resolver, for code the compiler does not lower --
15
+ * `@hozo/patterns`' Native components resolve their class props through it
16
+ * (#886). Redirected to the generated candidate module like `hozoPreflight`;
17
+ * unconfigured, there is no candidate map, so it resolves nothing, which is
18
+ * what those props did before.
19
+ */
20
+ export const hozoClasses = createClassResolver({})
@@ -0,0 +1,119 @@
1
+ // CSS has four independently cascading transform properties. Metadata lives
2
+ // beside, never inside, RN StyleSheet entries; no private style key reaches RN.
3
+ export type TransformEntry = Record<string, number | string | readonly number[]>
4
+ type Mode = 'slots' | 'authored' | 'none'
5
+ export interface TransformSlots {
6
+ translate?: Mode
7
+ translateSlots?: TransformEntry[]
8
+ translateAuthored?: TransformEntry[]
9
+ rotate?: TransformEntry[]
10
+ scale?: Mode
11
+ scaleSlots?: TransformEntry[]
12
+ scale3d?: boolean
13
+ scaleAuthored?: TransformEntry[]
14
+ functions?: Mode
15
+ functionsSlots?: TransformEntry[]
16
+ functionsAuthored?: TransformEntry[]
17
+ }
18
+ type Style = Record<string, unknown>
19
+ export type TransformSpec = readonly [Style, TransformSlots]
20
+ export type TransformStyle = Style | false | null | undefined | readonly TransformStyle[]
21
+
22
+ /** Only generated reset-bearing boundaries need this; plain styles bypass it. */
23
+ export function hozoTransformStyles(
24
+ styles: readonly TransformStyle[],
25
+ specs: readonly TransformSpec[] | ReadonlyMap<Style, TransformSlots>,
26
+ ): Style[] {
27
+ // Candidate maps can contain thousands of entries. They pre-index once;
28
+ // resolving one class string must never walk the entire project map.
29
+ const metadata: ReadonlyMap<Style, TransformSlots> = Array.isArray(specs)
30
+ ? new Map(specs)
31
+ : (specs as ReadonlyMap<Style, TransformSlots>)
32
+ const result: Style[] = []
33
+ const families = {
34
+ translate: {
35
+ slots: new Map<string, TransformEntry>(),
36
+ authored: [] as TransformEntry[],
37
+ mode: 'slots' as Mode,
38
+ },
39
+ scale: {
40
+ slots: new Map<string, TransformEntry>(),
41
+ authored: [] as TransformEntry[],
42
+ mode: 'slots' as Mode,
43
+ },
44
+ functions: {
45
+ slots: new Map<string, TransformEntry>(),
46
+ authored: [] as TransformEntry[],
47
+ mode: 'slots' as Mode,
48
+ },
49
+ }
50
+ let rotate: TransformEntry[] = []
51
+ let scale3d = false
52
+ let touched = false
53
+ function visit(style: TransformStyle): void {
54
+ if (!style) return
55
+ if (Array.isArray(style)) {
56
+ for (const part of style) visit(part)
57
+ return
58
+ }
59
+ const object = style as Style
60
+ const slots = metadata.get(object)
61
+ if (!slots) {
62
+ result.push(object)
63
+ // An authored RN transform is a whole-array override, not CSS slots.
64
+ if ('transform' in object) {
65
+ for (const family of Object.values(families)) {
66
+ family.slots.clear()
67
+ family.authored = []
68
+ family.mode = 'none'
69
+ }
70
+ rotate = []
71
+ scale3d = false
72
+ touched = false
73
+ }
74
+ return
75
+ }
76
+ const { transform: _transform, ...rest } = object
77
+ if (Object.keys(rest).length) result.push(rest)
78
+ touched = true
79
+ if (slots.rotate) rotate = slots.rotate
80
+ if (slots.scale3d !== undefined) scale3d = slots.scale3d
81
+ for (const name of ['translate', 'scale', 'functions'] as const) {
82
+ const family = families[name]
83
+ for (const entry of slots[`${name}Slots`] ?? []) {
84
+ // A uniform 2D scale writes both registers. Keep Z's matrix separate.
85
+ if (name === 'scale' && 'scale' in entry) {
86
+ family.slots.set('scaleX', { scaleX: entry.scale })
87
+ family.slots.set('scaleY', { scaleY: entry.scale })
88
+ } else {
89
+ const key = Object.keys(entry)[0]
90
+ if (key) family.slots.set(key, entry)
91
+ }
92
+ }
93
+ const authored = slots[`${name}Authored`]
94
+ if (authored) family.authored = authored
95
+ if (slots[name]) family.mode = slots[name]
96
+ }
97
+ }
98
+ for (const style of styles) visit(style)
99
+ if (touched) {
100
+ const output = (name: keyof typeof families, keys: string[]): TransformEntry[] => {
101
+ const family = families[name]
102
+ if (family.mode === 'none') return []
103
+ if (family.mode === 'authored') return family.authored
104
+ return keys.flatMap((key) => {
105
+ const entry = family.slots.get(key)
106
+ return entry ? [entry] : []
107
+ })
108
+ }
109
+ result.push({
110
+ transform: [
111
+ ...output('translate', ['translateX', 'translateY', 'matrix']),
112
+ ...rotate,
113
+ ...output('scale', scale3d ? ['scaleX', 'scaleY', 'matrix'] : ['scaleX', 'scaleY']),
114
+ ...output('functions', ['rotateX', 'rotateY', 'rotateZ', 'skewX', 'skewY']),
115
+ ],
116
+ })
117
+ }
118
+ return result
119
+ }
@@ -0,0 +1,19 @@
1
+ // Generated by scripts/view-base.mjs from the Web backend's shared CSS.
2
+ export const HOZO_VIEW_BASE_CSS = `@layer base {
3
+ :where(.hozo-view) {
4
+ display: flex;
5
+ flex-direction: column;
6
+ flex-shrink: 0;
7
+ position: relative;
8
+ min-width: 0;
9
+ box-sizing: border-box;
10
+ margin: 0;
11
+ padding: 0;
12
+ border: 0 solid;
13
+ }
14
+
15
+ :where([data-hozo-pressable]:not(:disabled, [data-hozo-disabled], [aria-disabled="true"])) {
16
+ cursor: pointer;
17
+ }
18
+ }
19
+ `
@@ -0,0 +1,20 @@
1
+ import { createElement } from 'react'
2
+ import { HOZO_VIEW_BASE_CSS } from './view-base-css.ts'
3
+
4
+ // A React 19 stylesheet resource, not an effect or a DOM mutation. React
5
+ // hoists and deduplicates it in SSR and on the client, even if every box asks
6
+ // for it. Defaults belong in CSS, not inline styles that defeat utilities.
7
+ const resource = createElement(
8
+ 'style',
9
+ { href: 'hozo-view-base', precedence: 'hozo-base' },
10
+ HOZO_VIEW_BASE_CSS,
11
+ )
12
+
13
+ export function hozoViewBase() {
14
+ return resource
15
+ }
16
+
17
+ export function hozoViewClassName(className?: string) {
18
+ if (!className) return 'hozo-view'
19
+ return className.split(/\s+/).includes('hozo-view') ? className : `hozo-view ${className}`
20
+ }