@octane-xplat/ui 0.3.0 → 0.5.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 (129) hide show
  1. package/README.md +46 -0
  2. package/dist/native/octane-client-build.json +1 -1
  3. package/dist/native/ui.js +55 -40
  4. package/dist/native/ui10.js +20 -11
  5. package/dist/native/ui11.js +42 -109
  6. package/dist/native/ui12.js +17 -84
  7. package/dist/native/ui13.js +11 -41
  8. package/dist/native/ui14.js +133 -76
  9. package/dist/native/ui15.js +43 -92
  10. package/dist/native/ui16.js +106 -45
  11. package/dist/native/ui17.js +29 -42
  12. package/dist/native/ui18.js +34 -53
  13. package/dist/native/ui19.js +246 -32
  14. package/dist/native/ui20.js +27 -16
  15. package/dist/native/ui21.js +376 -86
  16. package/dist/native/ui22.js +26 -114
  17. package/dist/native/ui23.js +49 -97
  18. package/dist/native/ui24.js +79 -53
  19. package/dist/native/ui25.js +138 -16
  20. package/dist/native/ui26.js +8 -23
  21. package/dist/native/ui27.js +60 -34
  22. package/dist/native/ui28.js +36 -142
  23. package/dist/native/ui29.js +101 -21
  24. package/dist/native/ui3.js +22 -1
  25. package/dist/native/ui30.js +14 -31
  26. package/dist/native/ui31.js +55 -36
  27. package/dist/native/ui32.js +49 -61
  28. package/dist/native/ui33.js +36 -28
  29. package/dist/native/ui34.js +51 -8
  30. package/dist/native/ui35.js +98 -20
  31. package/dist/native/ui36.js +9 -33
  32. package/dist/native/ui37.js +42 -15
  33. package/dist/native/ui38.js +186 -57
  34. package/dist/native/ui39.js +96 -26
  35. package/dist/native/ui4.js +22 -20
  36. package/dist/native/ui40.js +179 -8
  37. package/dist/native/ui41.js +52 -98
  38. package/dist/native/ui42.js +14 -145
  39. package/dist/native/ui43.js +16 -19
  40. package/dist/native/ui44.js +6 -6
  41. package/dist/native/ui45.js +38 -0
  42. package/dist/native/ui46.js +267 -0
  43. package/dist/native/ui47.js +28 -0
  44. package/dist/native/ui48.js +35 -0
  45. package/dist/native/ui49.js +41 -0
  46. package/dist/native/ui5.js +37 -77
  47. package/dist/native/ui50.js +72 -0
  48. package/dist/native/ui51.js +66 -0
  49. package/dist/native/ui52.js +64 -0
  50. package/dist/native/ui53.js +27 -0
  51. package/dist/native/ui54.js +13 -0
  52. package/dist/native/ui55.js +92 -0
  53. package/dist/native/ui56.js +34 -0
  54. package/dist/native/ui57.js +19 -0
  55. package/dist/native/ui58.js +156 -0
  56. package/dist/native/ui59.js +33 -0
  57. package/dist/native/ui6.js +94 -9
  58. package/dist/native/ui60.js +14 -0
  59. package/dist/native/ui61.js +22 -0
  60. package/dist/native/ui62.js +8 -0
  61. package/dist/native/ui63.js +108 -0
  62. package/dist/native/ui64.js +76 -0
  63. package/dist/native/ui7.js +42 -26
  64. package/dist/native/ui8.js +22 -12
  65. package/dist/native/ui9.js +18 -9
  66. package/dist/web/octane-client-build.json +1 -1
  67. package/dist/web/ui.js +53 -40
  68. package/dist/web/ui10.js +33 -186
  69. package/dist/web/ui11.js +28 -409
  70. package/dist/web/ui12.js +21 -68
  71. package/dist/web/ui13.js +265 -96
  72. package/dist/web/ui14.js +85 -95
  73. package/dist/web/ui15.js +368 -25
  74. package/dist/web/ui16.js +13 -101
  75. package/dist/web/ui17.js +246 -42
  76. package/dist/web/ui18.js +237 -28
  77. package/dist/web/ui19.js +36 -10
  78. package/dist/web/ui20.js +73 -102
  79. package/dist/web/ui21.js +102 -73
  80. package/dist/web/ui22.js +95 -55
  81. package/dist/web/ui23.js +94 -55
  82. package/dist/web/ui24.js +31 -15
  83. package/dist/web/ui25.js +105 -19
  84. package/dist/web/ui26.js +29 -23
  85. package/dist/web/ui27.js +12 -123
  86. package/dist/web/ui28.js +9 -110
  87. package/dist/web/ui29.js +52 -102
  88. package/dist/web/ui3.js +29 -18
  89. package/dist/web/ui30.js +32 -41
  90. package/dist/web/ui31.js +120 -39
  91. package/dist/web/ui32.js +41 -74
  92. package/dist/web/ui33.js +148 -32
  93. package/dist/web/ui34.js +145 -62
  94. package/dist/web/ui35.js +140 -7
  95. package/dist/web/ui36.js +86 -41
  96. package/dist/web/ui37.js +19 -44
  97. package/dist/web/ui38.js +5 -15
  98. package/dist/web/ui39.js +24 -86
  99. package/dist/web/ui4.js +46 -152
  100. package/dist/web/ui40.js +150 -37
  101. package/dist/web/ui41.js +36 -10
  102. package/dist/web/ui42.js +40 -7
  103. package/dist/web/ui43.js +73 -19
  104. package/dist/web/ui44.js +40 -6
  105. package/dist/web/ui45.js +62 -0
  106. package/dist/web/ui46.js +50 -0
  107. package/dist/web/ui47.js +9 -0
  108. package/dist/web/ui48.js +45 -0
  109. package/dist/web/ui49.js +13 -0
  110. package/dist/web/ui5.js +131 -27
  111. package/dist/web/ui50.js +63 -0
  112. package/dist/web/ui51.js +47 -0
  113. package/dist/web/ui52.js +19 -0
  114. package/dist/web/ui53.js +273 -0
  115. package/dist/web/ui54.js +42 -0
  116. package/dist/web/ui55.js +17 -0
  117. package/dist/web/ui56.js +9 -0
  118. package/dist/web/ui57.js +22 -0
  119. package/dist/web/ui58.js +8 -0
  120. package/dist/web/ui59.js +44 -0
  121. package/dist/web/ui6.js +81 -45
  122. package/dist/web/ui60.js +46 -0
  123. package/dist/web/ui7.js +43 -21
  124. package/dist/web/ui8.js +27 -21
  125. package/dist/web/ui9.js +29 -18
  126. package/package.json +17 -4
  127. package/src/theme/tokens.css +597 -141
  128. package/types/index.d.ts +112 -58
  129. package/types/props.d.ts +291 -16
package/dist/web/ui36.js CHANGED
@@ -1,45 +1,90 @@
1
- import { applyWebProps } from "./ui35.js";
2
- import { bag5, clone, ifBlock, queueRefAttach, queueRefDetach, setStyle, template } from "octane";
3
- import { bindSignalAttribute, enableSignalBindings, replaceRef, updateFreshClassName } from "octane/internal/client";
4
- //#region src/ActivityIndicator.web.tsrx
5
- enableSignalBindings(1, true);
6
- var _t$0 = /* @__PURE__ */ template("<div role=\"progressbar\"></div>");
7
- var _rm$1 = [
8
- "r",
9
- "e",
10
- "b"
11
- ];
12
- function __then$0(__props, __s, __extra) {
13
- const props = __extra[0];
14
- let _b = __s.slots[0];
15
- if (_b === void 0) {
16
- let _m1, _m4;
17
- const _root = clone(_t$0);
18
- _m1 = _root;
19
- queueRefAttach(__s, _m4 = (el) => applyWebProps(el, props.web), _m1);
20
- (__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.e, _b.b));
21
- _b = bag5(__s, _root, void 0, _m1, void 0, void 0, _m4);
22
- __s.refFields = _rm$1;
23
- } else {
24
- const _r = (el) => applyWebProps(el, props.web);
25
- if (_r !== _b.e) _b.e = replaceRef(__s, _b.e, _r, _b.b);
26
- }
27
- _b.a = bindSignalAttribute(__s, _b.a, _b.b, "id", props.id, "b:718dded3", "attr");
28
- _b.c = updateFreshClassName(["vx-spinner", props.className], _b.c, _b.b);
29
- {
30
- const _v = props.style;
31
- if (_b.d !== _v) {
32
- setStyle(_b.b, _v, _b.d);
33
- _b.d = _v;
1
+ import { hookSlots, useRef } from "octane";
2
+ //#region src/anim.web.tsrx
3
+ var _h$0 = /* @__PURE__ */ Symbol(/* @__PURE__ */ hookSlots(1));
4
+ var transformProps = {
5
+ translateX: (v) => `translateX(${v}px)`,
6
+ translateY: (v) => `translateY(${v}px)`,
7
+ translateZ: (v) => `translateZ(${v}px)`,
8
+ scale: (v) => `scale(${v})`,
9
+ scaleX: (v) => `scaleX(${v})`,
10
+ scaleY: (v) => `scaleY(${v})`,
11
+ rotate: (v) => `rotate(${v}deg)`,
12
+ rotateX: (v) => `rotateX(${v}deg)`,
13
+ rotateY: (v) => `rotateY(${v}deg)`,
14
+ skewX: (v) => `skewX(${v}deg)`,
15
+ skewY: (v) => `skewY(${v}deg)`
16
+ };
17
+ var transformStates = /* @__PURE__ */ new WeakMap();
18
+ function writeAnimatedValue(el, prop, value) {
19
+ if (Object.prototype.hasOwnProperty.call(transformProps, prop)) {
20
+ const transformProp = prop;
21
+ let state = transformStates.get(el);
22
+ if (!state) {
23
+ const computed = getComputedStyle(el).transform;
24
+ state = {
25
+ base: computed === "none" ? "" : computed,
26
+ values: /* @__PURE__ */ new Map()
27
+ };
28
+ transformStates.set(el, state);
34
29
  }
30
+ state.values.set(transformProp, value);
31
+ const transforms = Object.entries(transformProps).filter(([name]) => state.values.has(name)).map(([name, toTransform]) => toTransform(state.values.get(name)));
32
+ el.style.transform = [state.base, ...transforms].filter(Boolean).join(" ");
33
+ return;
35
34
  }
35
+ el.style[prop] = value;
36
+ }
37
+ function createAnimated(initial, prop) {
38
+ let el = null;
39
+ let current = initial;
40
+ let raf = 0;
41
+ const apply = (v) => {
42
+ current = v;
43
+ if (el) writeAnimatedValue(el, prop, v);
44
+ };
45
+ const run = (step) => {
46
+ cancelAnimationFrame(raf);
47
+ const start = Date.now();
48
+ const tick = () => {
49
+ const v = step(Date.now() - start);
50
+ if (v === null) return;
51
+ apply(v);
52
+ raf = requestAnimationFrame(tick);
53
+ };
54
+ raf = requestAnimationFrame(tick);
55
+ };
56
+ return {
57
+ get value() {
58
+ return current;
59
+ },
60
+ bind(e) {
61
+ el = e;
62
+ if (el) writeAnimatedValue(el, prop, current);
63
+ },
64
+ to(target, opts) {
65
+ const dur = opts?.duration ?? 300;
66
+ const from = current;
67
+ run((t) => t >= dur ? (apply(target), null) : from + (target - from) * (t / dur));
68
+ },
69
+ spring(target, opts) {
70
+ const damping = opts?.damping ?? 14, stiffness = opts?.stiffness ?? 120;
71
+ let v = 0, x = current;
72
+ run(() => {
73
+ const dt = 1 / 60;
74
+ v += (-stiffness * (x - target) - damping * v) * dt;
75
+ x += v * dt;
76
+ return Math.abs(v) < .5 && Math.abs(x - target) < .5 ? (apply(target), null) : x;
77
+ });
78
+ },
79
+ stop() {
80
+ cancelAnimationFrame(raf);
81
+ }
82
+ };
83
+ }
84
+ function useAnimation(initial = 0, prop = "translateX") {
85
+ const c = useRef(null, _h$0);
86
+ if (!c.current) c.current = createAnimated(initial, prop);
87
+ return c.current;
36
88
  }
37
- var ActivityIndicator = function ActivityIndicator(props, __s, __extra) {
38
- const __block = __s.block;
39
- {
40
- const __ifCondition = !(props.busy === false);
41
- ifBlock(__s, 0, __block.parentNode, __ifCondition, __then$0, null, __block.endMarker, __ifCondition ? [props] : void 0);
42
- }
43
- };
44
89
  //#endregion
45
- export { ActivityIndicator };
90
+ export { useAnimation };
package/dist/web/ui37.js CHANGED
@@ -1,47 +1,22 @@
1
- import { applyWebProps } from "./ui35.js";
2
- import { __s, bag9, clone, delegateEvents, queueRefAttach, queueRefDetach, setEventHandler, setStyle, template } from "octane";
3
- import { bindSignalAttribute, bindSignalValue, enableSignalBindings, replaceRef, updateFreshClassName } from "octane/internal/client";
4
- //#region src/Slider.web.tsrx
5
- enableSignalBindings(1, true);
6
- delegateEvents(["input"]);
7
- var _t$0 = /* @__PURE__ */ template("<input type=\"range\" data-octane-input=\"i:c0018a58\"/>");
8
- var _rm$0 = [
9
- "r",
10
- "i",
11
- "b"
12
- ];
13
- var Slider = /* @__PURE__ */ __s(function Slider(props, __s, __extra) {
14
- let _b = __s.slots[0];
15
- if (_b === void 0) {
16
- let _m1, _m4, _m8;
17
- const _root = clone(_t$0);
18
- _m1 = _root;
19
- _m4 = bindSignalValue(__s, void 0, _root, props.value, "i:c0018a58");
20
- setEventHandler(_root, "$$input", (e) => props.onValueChange?.(Number(e.target.value)));
21
- queueRefAttach(__s, _m8 = (el) => applyWebProps(el, props.web), _m1);
22
- (__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.i, _b.b));
23
- _b = bag9(__s, _root, void 0, _m1, void 0, void 0, _m4, void 0, void 0, void 0, _m8);
24
- __s.refFields = _rm$0;
25
- } else {
26
- _b.e = bindSignalValue(__s, _b.e, _b.b, props.value, "i:c0018a58");
27
- setEventHandler(_b.b, "$$input", (e) => props.onValueChange?.(Number(e.target.value)));
28
- {
29
- const _r = (el) => applyWebProps(el, props.web);
30
- if (_r !== _b.i) _b.i = replaceRef(__s, _b.i, _r, _b.b);
1
+ import { componentSlot } from "octane";
2
+ //#region src/styled.web.tsrx
3
+ function styled(Base, def) {
4
+ function Styled(props, __s, __extra) {
5
+ const __block = __s.block;
6
+ const cls = [def.base];
7
+ const rest = { ...props };
8
+ for (const k of Object.keys(def.variants ?? {})) {
9
+ if (props[k]) cls.push(def.variants[k]);
10
+ delete rest[k];
31
11
  }
12
+ if (props.className) cls.push(props.className);
13
+ if (__s.block.pending && !__s.block.crossRenderUpdate) return;
14
+ componentSlot(__s, 0, __block.parentNode, Base, {
15
+ ...rest,
16
+ "className": cls
17
+ }, __block.endMarker, void 0, void 0, true, void 0, "c:2dad67ff");
32
18
  }
33
- _b.a = bindSignalAttribute(__s, _b.a, _b.b, "id", props.id, "b:97ef4e10", "attr");
34
- _b.c = updateFreshClassName(["vx-slider", props.className], _b.c, _b.b);
35
- {
36
- const _v = props.style;
37
- if (_b.d !== _v) {
38
- setStyle(_b.b, _v, _b.d);
39
- _b.d = _v;
40
- }
41
- }
42
- _b.f = bindSignalAttribute(__s, _b.f, _b.b, "min", props.minValue ?? 0, "b:7991c980", "attr");
43
- _b.g = bindSignalAttribute(__s, _b.g, _b.b, "max", props.maxValue ?? 100, "b:ff7f1a7c", "attr");
44
- _b.h = bindSignalAttribute(__s, _b.h, _b.b, "disabled", props.disabled, "b:91d4cdb7", "booleanAttr");
45
- });
19
+ return Styled;
20
+ }
46
21
  //#endregion
47
- export { Slider };
22
+ export { styled };
package/dist/web/ui38.js CHANGED
@@ -1,17 +1,7 @@
1
- //#region src/icons.ts
2
- /**
3
- * App-owned icon registry. `svg` is SVG path `d` data (not a full SVG
4
- * markup string). Native `font` glyphs render only when the app ships that font.
5
- */
6
- var icons = /* @__PURE__ */ new Map();
7
- function registerIcon(name, glyph) {
8
- icons.set(name, glyph);
9
- }
10
- function registerIcons(record) {
11
- for (const [name, glyph] of Object.entries(record)) icons.set(name, glyph);
12
- }
13
- function getIcon(name) {
14
- return icons.get(name);
1
+ //#region src/windows.web.ts
2
+ /** Open a browser window using the current route unless a URL is supplied. */
3
+ function openWindow(options = {}) {
4
+ return window.open(options.url ?? window.location.href, "_blank");
15
5
  }
16
6
  //#endregion
17
- export { getIcon, registerIcon, registerIcons };
7
+ export { openWindow };
package/dist/web/ui39.js CHANGED
@@ -1,100 +1,38 @@
1
- import { applyWebProps } from "./ui35.js";
2
- import { getIcon } from "./ui38.js";
3
- import { bag8, bag9, clone, hookSlots, ifBlock, queueRefAttach, queueRefDetach, template } from "octane";
4
- import { bindSignalAttribute, compilerMemoRegion, createElementFromConfig, enableSignalBindings, hookMemoCreate, hookMemoEqual, hookMemoPublish1, replaceRef, updateFreshClassAttr, updateFreshClassName } from "octane/internal/client";
5
- //#region src/Icon.web.tsrx
1
+ import { applyEscapeProps } from "./ui2.js";
2
+ import { __s, bag7, clone, queueRefAttach, queueRefDetach, setStyle, template } from "octane";
3
+ import { bindSignalAttribute, bindSignalChild, enableSignalBindings, replaceRef, setPlainAttribute, updateFreshClassName } from "octane/internal/client";
4
+ //#region src/Screen.web.tsrx
6
5
  enableSignalBindings(1, true);
7
- var _t$0 = /* @__PURE__ */ template("<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path></path></svg>", 1);
8
- var _t$1 = /* @__PURE__ */ template("<img/>");
6
+ var _t$0 = /* @__PURE__ */ template("<div></div>");
9
7
  var _rm$1 = [
10
8
  "r",
11
- "f",
9
+ "c",
12
10
  "b"
13
11
  ];
14
- function __then$0(__props, __s, __extra) {
15
- const glyph = __extra[0];
16
- const props = __extra[1];
17
- const size = __extra[2];
12
+ var Screen = /* @__PURE__ */ __s(function Screen(props, __s, __extra) {
18
13
  let _b = __s.slots[0];
19
14
  if (_b === void 0) {
20
- let _m1, _m5, _m7;
15
+ let _m1, _m2;
21
16
  const _root = clone(_t$0);
22
17
  _m1 = _root;
23
- queueRefAttach(__s, _m5 = (el) => applyWebProps(el, props.web), _m1);
24
- (__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.f, _b.b));
25
- _m7 = _root.firstChild;
26
- _b = bag9(__s, _root, void 0, _m1, void 0, void 0, void 0, _m5, void 0, _m7, void 0);
18
+ queueRefAttach(__s, _m2 = (e) => applyEscapeProps(e, props), _m1);
19
+ (__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.c, _b.b));
20
+ _b = bag7(__s, _root, void 0, _m1, _m2, void 0, void 0, null, void 0);
27
21
  __s.refFields = _rm$1;
28
22
  } else {
29
- const _r = (el) => applyWebProps(el, props.web);
30
- if (_r !== _b.f) _b.f = replaceRef(__s, _b.f, _r, _b.b);
23
+ const _r = (e) => applyEscapeProps(e, props);
24
+ if (_r !== _b.c) _b.c = replaceRef(__s, _b.c, _r, _b.b);
31
25
  }
32
- _b.a = bindSignalAttribute(__s, _b.a, _b.b, "id", props.id, "b:c2998a08", "attr");
33
- _b.c = updateFreshClassAttr(["vx-icon", props.className], _b.c, _b.b);
34
- _b.d = bindSignalAttribute(__s, _b.d, _b.b, "width", size, "b:2cb24e58", "attr");
35
- _b.e = bindSignalAttribute(__s, _b.e, _b.b, "height", size, "b:030dffd1", "attr");
36
- _b.g = bindSignalAttribute(__s, _b.g, _b.h, "d", glyph.svg, "b:87ff75cb", "attr");
37
- _b.i = bindSignalAttribute(__s, _b.i, _b.h, "fill", props.color ?? "currentColor", "b:5bd1a218", "attr");
38
- }
39
- var _rm$4 = [
40
- "r",
41
- "h",
42
- "b"
43
- ];
44
- function __then$3(__props, __s, __extra) {
45
- const glyph = __extra[0];
46
- const props = __extra[1];
47
- const size = __extra[2];
48
- let _b = __s.slots[0];
49
- if (_b === void 0) {
50
- let _m1, _m7;
51
- const _root = clone(_t$1);
52
- _m1 = _root;
53
- queueRefAttach(__s, _m7 = (el) => applyWebProps(el, props.web), _m1);
54
- (__s.cleanups ??= []).push(() => _b && queueRefDetach(_b.h, _b.b));
55
- _b = bag8(__s, _root, void 0, _m1, void 0, void 0, void 0, void 0, void 0, _m7);
56
- __s.refFields = _rm$4;
57
- } else {
58
- const _r = (el) => applyWebProps(el, props.web);
59
- if (_r !== _b.h) _b.h = replaceRef(__s, _b.h, _r, _b.b);
26
+ _b.a = bindSignalAttribute(__s, _b.a, _b.b, "id", props.id, "b:4057121c", setPlainAttribute);
27
+ _b.d = updateFreshClassName(["vx-screen", props.className], _b.d, _b.b);
28
+ {
29
+ const _v = props.style;
30
+ if (_b.e !== _v) {
31
+ setStyle(_b.b, _v, _b.e);
32
+ _b.e = _v;
33
+ }
60
34
  }
61
- _b.a = bindSignalAttribute(__s, _b.a, _b.b, "id", props.id, "b:e7755c5a", "attr");
62
- _b.c = updateFreshClassName(["vx-icon", props.className], _b.c, _b.b);
63
- _b.d = bindSignalAttribute(__s, _b.d, _b.b, "src", glyph.src, "b:c1db93e6", "attr");
64
- _b.e = bindSignalAttribute(__s, _b.e, _b.b, "width", size, "b:ea1c538f", "attr");
65
- _b.f = bindSignalAttribute(__s, _b.f, _b.b, "height", size, "b:a3678376", "attr");
66
- _b.g = bindSignalAttribute(__s, _b.g, _b.b, "alt", props.name, "b:056826c3", "attr");
67
- }
68
- function __else$2(__props, __s, __extra) {
69
- const __block = __s.block;
70
- const glyph = __extra[0];
71
- __extra[1];
72
- __extra[2];
73
- ifBlock(__s, 0, __block.parentNode, glyph.src, __then$3, null, __block.endMarker, __extra);
74
- }
75
- function _frag$0(props, __s, __extra) {
76
- const __block = __s.block;
77
- ifBlock(__s, 0, __block.parentNode, props.h0, props.h1, props.h2, __block.endMarker, props.h3);
78
- }
79
- var _hs$ = /* @__PURE__ */ hookSlots(5);
80
- var Icon = function Icon(props, __s, __extra) {
81
- const __memoRegion = compilerMemoRegion(__s, _hs$ + 0);
82
- let __hk = __memoRegion.hooks;
83
- if (__hk === void 0) __memoRegion.hooks = __hk = hookMemoCreate(3);
84
- let __hkd0;
85
- const glyph = (__hkd0 = props, __hk[0] !== true || !hookMemoEqual(__hk[1], __hkd0) ? hookMemoPublish1(__hk, 0, getIcon(props.name), __hkd0) : __hk[2]);
86
- if (!glyph) return null;
87
- const size = props.size ?? 24;
88
- return createElementFromConfig("c:96c53b1e", _frag$0, {
89
- h0: glyph.svg,
90
- h1: __then$0,
91
- h2: __else$2,
92
- h3: [
93
- glyph,
94
- props,
95
- size
96
- ]
97
- });
98
- };
35
+ _b.h = bindSignalChild(__s, _b.h, 1, _b.b, props.children, "b:80ad049e", null, void 0, void 0, void 0, true);
36
+ });
99
37
  //#endregion
100
- export { Icon };
38
+ export { Screen };
package/dist/web/ui4.js CHANGED
@@ -1,153 +1,47 @@
1
- import { applyEscapeProps } from "./ui2.js";
2
- import { layoutChildProps } from "./ui3.js";
3
- import { __s, bag8, clone, hookSlots, snapshotSpread, template, useEffect, useRef } from "octane";
4
- import { bindSignalChild, bindSignalHostPropSources, enableSignalBindings } from "octane/internal/client";
5
- //#region src/View.web.tsrx
6
- enableSignalBindings(1, true);
7
- var _t$0 = /* @__PURE__ */ template("<div></div>");
8
- var _hs$ = /* @__PURE__ */ hookSlots(2);
9
- var _rm$1 = [
10
- "s",
11
- "f",
12
- "e"
13
- ];
14
- var View = /* @__PURE__ */ __s(function View(props, __s, __extra) {
15
- const el = useRef(null, _hs$ + 0);
16
- useEffect(() => {
17
- const node = el.current;
18
- const cb = props.onPan;
19
- if (!node || !cb) return;
20
- let sx = 0, sy = 0, active = false, last = 0, lx = 0, t0 = 0;
21
- const emit = (e, state) => {
22
- const now = performance.now();
23
- const dt = Math.max(now - t0, 1) / 1e3;
24
- const vx = (e.clientX - lx) / dt;
25
- const vy = (e.clientY - last) / dt;
26
- lx = e.clientX;
27
- last = e.clientY;
28
- t0 = now;
29
- cb({
30
- x: e.clientX - sx,
31
- y: e.clientY - sy,
32
- dx: e.clientX - sx,
33
- dy: e.clientY - sy,
34
- vx,
35
- vy,
36
- state,
37
- target: node
38
- });
39
- };
40
- const down = (e) => {
41
- active = true;
42
- sx = e.clientX;
43
- sy = e.clientY;
44
- t0 = performance.now();
45
- lx = sx;
46
- last = sy;
47
- node.setPointerCapture?.(e.pointerId);
48
- emit(e, "began");
49
- };
50
- const move = (e) => {
51
- if (active) emit(e, "moved");
52
- };
53
- const up = (e) => {
54
- if (active) {
55
- active = false;
56
- emit(e, "ended");
57
- }
58
- };
59
- const cancel = (e) => {
60
- if (active) {
61
- active = false;
62
- emit(e, "cancelled");
63
- }
64
- };
65
- node.addEventListener("pointerdown", down);
66
- node.addEventListener("pointermove", move);
67
- node.addEventListener("pointerup", up);
68
- node.addEventListener("pointercancel", cancel);
69
- return () => {
70
- node.removeEventListener("pointerdown", down);
71
- node.removeEventListener("pointermove", move);
72
- node.removeEventListener("pointerup", up);
73
- node.removeEventListener("pointercancel", cancel);
74
- };
75
- }, [props.onPan], _hs$ + 1);
76
- let _b = __s.slots[0];
77
- if (_b === void 0) {
78
- let _m0, _m1, _m2, _m3, _m4, _m5;
79
- const _root = clone(_t$0);
80
- _m0 = props.id;
81
- _m1 = (e) => {
82
- el.current = e;
83
- if (e) {
84
- applyEscapeProps(e, props);
85
- props.bind?.(e);
86
- }
87
- };
88
- _m2 = ["vx-view", props.className];
89
- _m3 = snapshotSpread(layoutChildProps(props));
90
- _m4 = _root;
91
- _m5 = bindSignalHostPropSources(__s, void 0, _root, [
92
- [
93
- false,
94
- "id",
95
- _m0
96
- ],
97
- [
98
- false,
99
- "ref",
100
- _m1
101
- ],
102
- [
103
- false,
104
- "className",
105
- _m2
106
- ],
107
- [true, _m3]
108
- ], "b:3f348e03", true);
109
- _b = bag8(__s, _root, _m0, _m1, _m2, _m3, _m4, _m5, null, void 0);
110
- __s.refFields = _rm$1;
111
- } else {
112
- {
113
- const _v = props.id;
114
- if (_b.a !== _v) _b.a = _v;
115
- }
116
- {
117
- const _v = (e) => {
118
- el.current = e;
119
- if (e) {
120
- applyEscapeProps(e, props);
121
- props.bind?.(e);
122
- }
123
- };
124
- if (_b.b !== _v) _b.b = _v;
125
- }
126
- {
127
- const _v = ["vx-view", props.className];
128
- if (_b.c !== _v) _b.c = _v;
129
- }
130
- _b.d = snapshotSpread(layoutChildProps(props));
131
- _b.f = bindSignalHostPropSources(__s, _b.f, _b.e, [
132
- [
133
- false,
134
- "id",
135
- _b.a
136
- ],
137
- [
138
- false,
139
- "ref",
140
- _b.b
141
- ],
142
- [
143
- false,
144
- "className",
145
- _b.c
146
- ],
147
- [true, _b.d]
148
- ], "b:3f348e03", true);
149
- }
150
- _b.i = bindSignalChild(__s, _b.i, 1, _b.e, props.children, "b:35b9af07", null, void 0, void 0, void 0, true);
151
- });
1
+ //#region src/layout-child.web.ts
2
+ /** The shared contract is "numbers are dips" (RN semantics), but octane's DOM
3
+ * renderer keeps React's unitless list — lineHeight is unitless there, so
4
+ * `style={{lineHeight: 40}}` would render a 40× multiplier instead of 40px.
5
+ * lineHeight is the one unitless-in-React prop that is a length in the
6
+ * shared vocabulary; force the px suffix. */
7
+ function normStyle(style) {
8
+ if (style && typeof style.lineHeight === "number") return {
9
+ ...style,
10
+ lineHeight: style.lineHeight + "px"
11
+ };
12
+ return style;
13
+ }
14
+ var FLEX_JUSTIFY = {
15
+ start: "flex-start",
16
+ end: "flex-end"
17
+ };
18
+ var FLEX_ALIGN = {
19
+ start: "flex-start",
20
+ end: "flex-end"
21
+ };
22
+ /** Convert parent-layout metadata to CSS on the web leaf. Native's `dock`
23
+ * attribute has no CSS equivalent and is ignored on web. Grid indices are
24
+ * zero-based in the shared API, matching NativeScript. */
25
+ function layoutChildProps(props, baseStyle = props.style) {
26
+ const style = { ...normStyle(baseStyle) };
27
+ if (props.row !== void 0) style.gridRow = `${props.row + 1} / span ${props.rowSpan ?? 1}`;
28
+ else if (props.rowSpan !== void 0) style.gridRow = `span ${props.rowSpan}`;
29
+ if (props.col !== void 0) style.gridColumn = `${props.col + 1} / span ${props.colSpan ?? 1}`;
30
+ else if (props.colSpan !== void 0) style.gridColumn = `span ${props.colSpan}`;
31
+ if (props.left !== void 0) style.left = props.left;
32
+ if (props.top !== void 0) style.top = props.top;
33
+ if (props.flexGrow !== void 0) style.flexGrow = props.flexGrow;
34
+ if (props.flexShrink !== void 0) style.flexShrink = props.flexShrink;
35
+ if (props.alignSelf !== void 0) style.alignSelf = props.alignSelf;
36
+ if (props.order !== void 0) style.order = props.order;
37
+ if (props.justifyContent !== void 0) style.justifyContent = FLEX_JUSTIFY[props.justifyContent] ?? props.justifyContent;
38
+ if (props.alignItems !== void 0) style.alignItems = FLEX_ALIGN[props.alignItems] ?? props.alignItems;
39
+ if (props.flexWrap !== void 0) style.flexWrap = props.flexWrap === true ? "wrap" : props.flexWrap === false ? "nowrap" : props.flexWrap;
40
+ if (props.gap !== void 0) style.gap = props.gap;
41
+ if (props.rowGap !== void 0) style.rowGap = props.rowGap;
42
+ if (props.columnGap !== void 0) style.columnGap = props.columnGap;
43
+ if (typeof style.lineHeight === "number") style.lineHeight = style.lineHeight + "px";
44
+ return { style };
45
+ }
152
46
  //#endregion
153
- export { View };
47
+ export { layoutChildProps, normStyle };