@sigx/lynx-zero 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/dist/components/SwiperIndicator.d.ts +43 -0
- package/dist/components/SwiperIndicator.d.ts.map +1 -0
- package/dist/components/SwiperIndicator.js +272 -0
- package/dist/components/SwiperIndicator.js.map +1 -0
- package/dist/contract.d.ts +95 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +30 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/layout/Center.d.ts +7 -0
- package/dist/layout/Center.d.ts.map +1 -0
- package/dist/layout/Center.js +25 -0
- package/dist/layout/Center.js.map +1 -0
- package/dist/layout/Col.d.ts +8 -0
- package/dist/layout/Col.d.ts.map +1 -0
- package/dist/layout/Col.js +34 -0
- package/dist/layout/Col.js.map +1 -0
- package/dist/layout/Row.d.ts +8 -0
- package/dist/layout/Row.d.ts.map +1 -0
- package/dist/layout/Row.js +34 -0
- package/dist/layout/Row.js.map +1 -0
- package/dist/layout/ScrollView.d.ts +6 -0
- package/dist/layout/ScrollView.d.ts.map +1 -0
- package/dist/layout/ScrollView.js +19 -0
- package/dist/layout/ScrollView.js.map +1 -0
- package/dist/layout/Spacer.d.ts +4 -0
- package/dist/layout/Spacer.d.ts.map +1 -0
- package/dist/layout/Spacer.js +12 -0
- package/dist/layout/Spacer.js.map +1 -0
- package/dist/preset/index.d.ts +31 -0
- package/dist/preset/index.d.ts.map +1 -0
- package/dist/preset/index.js +72 -0
- package/dist/preset/index.js.map +1 -0
- package/dist/shared/press.d.ts +3 -0
- package/dist/shared/press.d.ts.map +1 -0
- package/dist/shared/press.js +7 -0
- package/dist/shared/press.js.map +1 -0
- package/dist/shared/styles.d.ts +27 -0
- package/dist/shared/styles.d.ts.map +1 -0
- package/dist/shared/styles.js +62 -0
- package/dist/shared/styles.js.map +1 -0
- package/dist/shared/tabs-selection.d.ts +25 -0
- package/dist/shared/tabs-selection.d.ts.map +1 -0
- package/dist/shared/tabs-selection.js +45 -0
- package/dist/shared/tabs-selection.js.map +1 -0
- package/dist/styles/tokens.css +98 -0
- package/dist/theme/StatusBarSync.d.ts +42 -0
- package/dist/theme/StatusBarSync.d.ts.map +1 -0
- package/dist/theme/StatusBarSync.js +89 -0
- package/dist/theme/StatusBarSync.js.map +1 -0
- package/dist/theme/ThemeProvider.d.ts +144 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +328 -0
- package/dist/theme/ThemeProvider.js.map +1 -0
- package/dist/theme/color-mix.d.ts +21 -0
- package/dist/theme/color-mix.d.ts.map +1 -0
- package/dist/theme/color-mix.js +65 -0
- package/dist/theme/color-mix.js.map +1 -0
- package/dist/theme/registry.d.ts +182 -0
- package/dist/theme/registry.d.ts.map +1 -0
- package/dist/theme/registry.js +182 -0
- package/dist/theme/registry.js.map +1 -0
- package/dist/theme/theme-state.d.ts +43 -0
- package/dist/theme/theme-state.d.ts.map +1 -0
- package/dist/theme/theme-state.js +94 -0
- package/dist/theme/theme-state.js.map +1 -0
- package/dist/theme/use-screen-theme.d.ts +4 -0
- package/dist/theme/use-screen-theme.d.ts.map +1 -0
- package/dist/theme/use-screen-theme.js +43 -0
- package/dist/theme/use-screen-theme.js.map +1 -0
- package/dist/theme/use-theme-colors.d.ts +48 -0
- package/dist/theme/use-theme-colors.d.ts.map +1 -0
- package/dist/theme/use-theme-colors.js +69 -0
- package/dist/theme/use-theme-colors.js.map +1 -0
- package/package.json +80 -0
- package/src/components/SwiperIndicator.tsx +519 -0
- package/src/contract.ts +136 -0
- package/src/index.ts +101 -0
- package/src/layout/Center.tsx +41 -0
- package/src/layout/Col.tsx +53 -0
- package/src/layout/Row.tsx +53 -0
- package/src/layout/ScrollView.tsx +38 -0
- package/src/layout/Spacer.tsx +18 -0
- package/src/preset/index.ts +77 -0
- package/src/shared/press.ts +6 -0
- package/src/shared/styles.ts +82 -0
- package/src/shared/tabs-selection.ts +57 -0
- package/src/styles/tokens.css +98 -0
- package/src/theme/StatusBarSync.tsx +104 -0
- package/src/theme/ThemeProvider.tsx +492 -0
- package/src/theme/color-mix.ts +68 -0
- package/src/theme/registry.ts +290 -0
- package/src/theme/theme-state.ts +112 -0
- package/src/theme/use-screen-theme.ts +42 -0
- package/src/theme/use-theme-colors.ts +99 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Andreas Ekdahl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @sigx/lynx-zero
|
|
2
|
+
|
|
3
|
+
Design-system-neutral UI foundation for sigx-lynx. Design-system packages
|
|
4
|
+
(`@sigx/lynx-daisyui`, `@sigx/lynx-heroui`, …) build on it; apps normally
|
|
5
|
+
import from their chosen design system, which re-exports what it uses from
|
|
6
|
+
here.
|
|
7
|
+
|
|
8
|
+
What lives here (growing per the phases in
|
|
9
|
+
[signalxjs/lynx#219](https://github.com/signalxjs/lynx/issues/219)):
|
|
10
|
+
|
|
11
|
+
- **The shared contract** (`SizeScale`, `ColorVariant`, `ColorToken`,
|
|
12
|
+
common prop fragments like `WithColor`/`WithDisabled`/`PressEvent`) —
|
|
13
|
+
the vocabulary every design system agrees on, so switching an app from
|
|
14
|
+
one DS to another is mostly an import swap.
|
|
15
|
+
- **Token-name conventions** — every theme resolves against the same CSS
|
|
16
|
+
custom-property names (`--color-*`, `--radius-*`, `--size-*`, `--text-*`).
|
|
17
|
+
- **Style utilities** — `resolveBoxStyle`, `resolveSpacing`,
|
|
18
|
+
`resolveColorToken`.
|
|
19
|
+
- **Press-feedback defaults** — `PRESSED_SCALE`, `PRESSED_OPACITY`.
|
|
20
|
+
- *(Later phases)* layout primitives (`Row`, `Col`, `Center`, `Spacer`,
|
|
21
|
+
`ScrollView`) and the theme engine (`ThemeProvider`, `themeController`,
|
|
22
|
+
theme registry).
|
|
23
|
+
|
|
24
|
+
What deliberately does **not** live here: visual components, component CSS,
|
|
25
|
+
class-name recipes, theme palettes — those are per-design-system.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Define, type PrimitiveSignal, type SharedValue } from '@sigx/lynx';
|
|
2
|
+
import { type ColorToken } from '../contract.js';
|
|
3
|
+
/**
|
|
4
|
+
* Visual style for the swiper page indicator.
|
|
5
|
+
*
|
|
6
|
+
* - `dots` — equally-spaced circles, the active one fades in via opacity.
|
|
7
|
+
* Today's default. Cheap (opacity-only MT mapper, no layout each frame).
|
|
8
|
+
* - `bar` — fixed track with a single sliding thumb. Single MT binding
|
|
9
|
+
* regardless of page count, so cheapest for very long carousels.
|
|
10
|
+
* - `pill` — the active dot stretches horizontally into a pill while
|
|
11
|
+
* neighbours stay circular. Uses `scaleX` so siblings don't reflow.
|
|
12
|
+
* - `numbered` — text counter like `2 / 5`. Pure BG-thread, no animation.
|
|
13
|
+
* - `scale-pulse` — circles where the active one scales up. No colour
|
|
14
|
+
* crossfade — pairs well with monochrome palettes.
|
|
15
|
+
*/
|
|
16
|
+
export type SwiperIndicatorVariant = 'dots' | 'bar' | 'pill' | 'numbered' | 'scale-pulse';
|
|
17
|
+
export type SwiperIndicatorSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
18
|
+
export type SwiperIndicatorProps = Define.Prop<'variant', SwiperIndicatorVariant, false>
|
|
19
|
+
/**
|
|
20
|
+
* Live MT pixel offset from the parent `<Swiper>` — full scroll-linked
|
|
21
|
+
* fidelity for the animated variants. When omitted but `index` is wired,
|
|
22
|
+
* the indicator derives one internally (#211): it glides between page
|
|
23
|
+
* positions with a timing curve on every index change. Mode is fixed at
|
|
24
|
+
* mount.
|
|
25
|
+
*/
|
|
26
|
+
& Define.Prop<'offset', SharedValue<number>, false>
|
|
27
|
+
/** Page width in CSS px. Must match the Swiper's effective page width. */
|
|
28
|
+
& Define.Prop<'pageWidth', number, false>
|
|
29
|
+
/** Total page count. */
|
|
30
|
+
& Define.Prop<'count', number, true>
|
|
31
|
+
/**
|
|
32
|
+
* Current page (whole-units). Required for `numbered`, drives the
|
|
33
|
+
* derived offset in index-only mode, and consumed by all variants for
|
|
34
|
+
* tap-to-jump.
|
|
35
|
+
*/
|
|
36
|
+
& Define.Prop<'index', PrimitiveSignal<number>, false> & Define.Prop<'color', ColorToken, false> & Define.Prop<'inactiveColor', ColorToken, false> & Define.Prop<'size', SwiperIndicatorSize, false>
|
|
37
|
+
/**
|
|
38
|
+
* Tap-to-jump handler. The receiver should typically write
|
|
39
|
+
* `index.value = i` to glide the swiper to that page.
|
|
40
|
+
*/
|
|
41
|
+
& Define.Prop<'onDotPress', (index: number) => void, false> & Define.Prop<'class', string, false> & Define.Prop<'style', Record<string, string | number>, false>;
|
|
42
|
+
export declare const SwiperIndicator: import("@sigx/runtime-core").ComponentFactory<SwiperIndicatorProps, void, {}>;
|
|
43
|
+
//# sourceMappingURL=SwiperIndicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwiperIndicator.d.ts","sourceRoot":"","sources":["../../src/components/SwiperIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAQpB,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,sBAAsB,GAC9B,MAAM,GACN,KAAK,GACL,MAAM,GACN,UAAU,GACV,aAAa,CAAC;AAElB,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAoB5D,MAAM,MAAM,oBAAoB,GAC5B,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,EAAE,KAAK,CAAC;AACvD;;;;;;GAMG;GACD,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;AACnD,0EAA0E;GACxE,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC;AACzC,wBAAwB;GACtB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC;AACpC;;;;GAIG;GACD,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GACpD,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,GACvC,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,EAAE,KAAK,CAAC,GAC/C,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,CAAC;AACjD;;;GAGG;GACD,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,EAAE,KAAK,CAAC,GACzD,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,GACnC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC;AA8CjE,eAAO,MAAM,eAAe,+EA0F1B,CAAC"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@sigx/lynx/jsx-runtime";
|
|
2
|
+
import { component, effect, runOnMainThread, signal, useSharedValue, } from '@sigx/lynx';
|
|
3
|
+
import { useSwiperDotProgress, useSwiperDotScale, useSwiperDotGrowX, useSwiperDotTranslate, } from '@sigx/lynx-gestures';
|
|
4
|
+
import { withTiming } from '@sigx/lynx-motion';
|
|
5
|
+
import { resolveColorToken } from '../contract.js';
|
|
6
|
+
const SIZE_TABLE = {
|
|
7
|
+
xs: { dot: 4, gap: 4, barHeight: 3, fontSize: 11 },
|
|
8
|
+
sm: { dot: 6, gap: 6, barHeight: 4, fontSize: 12 },
|
|
9
|
+
md: { dot: 8, gap: 8, barHeight: 5, fontSize: 14 },
|
|
10
|
+
lg: { dot: 12, gap: 10, barHeight: 6, fontSize: 16 },
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Themed swiper page indicator with five preset variants. Each variant
|
|
14
|
+
* is a thin shell over a headless hook from `@sigx/lynx-gestures` (see
|
|
15
|
+
* `useSwiperDotProgress`, `useSwiperDotScale`, `useSwiperDotGrowX`,
|
|
16
|
+
* `useSwiperDotTranslate`). For a fully custom indicator, compose the
|
|
17
|
+
* hooks yourself rather than forking this file.
|
|
18
|
+
*
|
|
19
|
+
* @example Scroll-linked (full fidelity, wired to a `<Swiper>`)
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const offset = useSharedValue(0);
|
|
22
|
+
* const idx = signal({ value: 0 });
|
|
23
|
+
* <Swiper offset={offset} index={idx} width={W}>…</Swiper>
|
|
24
|
+
* <SwiperIndicator
|
|
25
|
+
* variant="pill"
|
|
26
|
+
* offset={offset}
|
|
27
|
+
* pageWidth={W}
|
|
28
|
+
* count={photos.length}
|
|
29
|
+
* index={idx}
|
|
30
|
+
* color="primary"
|
|
31
|
+
* onDotPress={(i) => { idx.value = i; }}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example Index-only (no Swiper — the offset is derived internally)
|
|
36
|
+
* ```tsx
|
|
37
|
+
* const idx = signal({ value: 0 });
|
|
38
|
+
* <SwiperIndicator
|
|
39
|
+
* variant="dots"
|
|
40
|
+
* count={5}
|
|
41
|
+
* index={idx}
|
|
42
|
+
* onDotPress={(i) => { idx.value = i; }}
|
|
43
|
+
* />
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Nominal page width for the internally-derived offset (index-only mode).
|
|
48
|
+
* The animated variants consume `offset` and `pageWidth` only as the ratio
|
|
49
|
+
* `offset / pageWidth`, so any non-zero constant works.
|
|
50
|
+
*/
|
|
51
|
+
const SYNTHETIC_PAGE_WIDTH = 100;
|
|
52
|
+
/** Timing used when gliding the derived offset between page positions. */
|
|
53
|
+
const SYNTHETIC_GLIDE_SECONDS = 0.28;
|
|
54
|
+
export const SwiperIndicator = component(({ props }) => {
|
|
55
|
+
// Index-only mode (#211), fixed at mount: with no live `offset` wired but
|
|
56
|
+
// an `index`, own a SharedValue and glide it to `index × nominal width`
|
|
57
|
+
// with a timing curve whenever the index changes — the same push a real
|
|
58
|
+
// `<Swiper>` makes, minus the scroll-linked in-between frames.
|
|
59
|
+
const indexOnly = props.offset == null && props.index != null;
|
|
60
|
+
const derivedOffset = useSharedValue(indexOnly ? (props.index.value | 0) * SYNTHETIC_PAGE_WIDTH : 0);
|
|
61
|
+
if (indexOnly) {
|
|
62
|
+
// Hoisted once — wrapping per call would allocate a new MT runner on
|
|
63
|
+
// every index change.
|
|
64
|
+
const glideTo = runOnMainThread((to) => {
|
|
65
|
+
'main thread';
|
|
66
|
+
withTiming(derivedOffset, to, { duration: SYNTHETIC_GLIDE_SECONDS });
|
|
67
|
+
});
|
|
68
|
+
effect(() => {
|
|
69
|
+
glideTo((props.index.value | 0) * SYNTHETIC_PAGE_WIDTH);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return () => {
|
|
73
|
+
const variant = props.variant ?? 'dots';
|
|
74
|
+
const size = SIZE_TABLE[props.size ?? 'md'];
|
|
75
|
+
const activeColor = resolveColorToken(props.color ?? 'primary');
|
|
76
|
+
const inactiveColor = resolveColorToken(props.inactiveColor ?? 'base-content');
|
|
77
|
+
const offset = indexOnly ? derivedOffset : props.offset;
|
|
78
|
+
const pageWidth = indexOnly ? SYNTHETIC_PAGE_WIDTH : props.pageWidth;
|
|
79
|
+
if (variant === 'numbered') {
|
|
80
|
+
return (_jsx(NumberedIndicator, { count: props.count, index: props.index ?? FALLBACK_INDEX, color: activeColor, fontSize: size.fontSize, class: props.class, style: props.style }));
|
|
81
|
+
}
|
|
82
|
+
if (variant === 'bar') {
|
|
83
|
+
if (offset == null || pageWidth == null)
|
|
84
|
+
return null;
|
|
85
|
+
return (_jsx(BarIndicator, { offset: offset, pageWidth: pageWidth, count: props.count, activeColor: activeColor, inactiveColor: inactiveColor, barHeight: size.barHeight, dotSize: size.dot, gap: size.gap, onDotPress: props.onDotPress, class: props.class, style: props.style }));
|
|
86
|
+
}
|
|
87
|
+
if (offset == null || pageWidth == null)
|
|
88
|
+
return null;
|
|
89
|
+
return (_jsx("view", { class: props.class, style: {
|
|
90
|
+
display: 'flex',
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
justifyContent: 'center',
|
|
94
|
+
gap: size.gap + 'px',
|
|
95
|
+
...props.style,
|
|
96
|
+
}, children: Array.from({ length: props.count }, (_, i) => (_jsx(Dot, { index: i, offset: offset, pageWidth: pageWidth, variant: variant, size: size, activeColor: activeColor, inactiveColor: inactiveColor, onPress: props.onDotPress }, i))) }));
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
100
|
+
// Per-variant pieces. Each owns a single `useAnimatedStyle` call-site
|
|
101
|
+
// (per-iteration call inside `.map()` is fine — call-sites are stable).
|
|
102
|
+
const FALLBACK_INDEX = signal({ value: 0 });
|
|
103
|
+
const Dot = component(({ props }) => {
|
|
104
|
+
// Each branch picks a different headless hook. Variants that need
|
|
105
|
+
// *two* simultaneous channels (opacity AND scale, or scale AND scaleX)
|
|
106
|
+
// need two refs — one per element — because `useAnimatedStyle` is
|
|
107
|
+
// one-binding-per-element.
|
|
108
|
+
if (props.variant === 'dots') {
|
|
109
|
+
return DotsBody(props);
|
|
110
|
+
}
|
|
111
|
+
if (props.variant === 'pill') {
|
|
112
|
+
return PillBody(props);
|
|
113
|
+
}
|
|
114
|
+
// scale-pulse
|
|
115
|
+
return ScalePulseBody(props);
|
|
116
|
+
});
|
|
117
|
+
function DotsBody(props) {
|
|
118
|
+
const overlayRef = useSwiperDotProgress({
|
|
119
|
+
offset: props.offset,
|
|
120
|
+
pageWidth: props.pageWidth,
|
|
121
|
+
index: props.index,
|
|
122
|
+
});
|
|
123
|
+
return () => (_jsx("view", { catchtap: props.onPress ? () => props.onPress?.(props.index) : undefined, style: {
|
|
124
|
+
width: props.size.dot + 'px',
|
|
125
|
+
height: props.size.dot + 'px',
|
|
126
|
+
borderRadius: (props.size.dot / 2) + 'px',
|
|
127
|
+
backgroundColor: withAlpha(props.inactiveColor, 0.4),
|
|
128
|
+
position: 'relative',
|
|
129
|
+
overflow: 'hidden',
|
|
130
|
+
}, children: _jsx("view", { "main-thread:ref": overlayRef, style: {
|
|
131
|
+
position: 'absolute',
|
|
132
|
+
left: '0',
|
|
133
|
+
top: '0',
|
|
134
|
+
right: '0',
|
|
135
|
+
bottom: '0',
|
|
136
|
+
backgroundColor: props.activeColor,
|
|
137
|
+
opacity: '0',
|
|
138
|
+
} }) }));
|
|
139
|
+
}
|
|
140
|
+
function PillBody(props) {
|
|
141
|
+
// Pill stretches horizontally via scaleX (no layout cost) and brightens
|
|
142
|
+
// via opacity on the active-colour overlay. Both channels target the
|
|
143
|
+
// same dot — but each needs its own bound element, so we wrap the
|
|
144
|
+
// overlay inside a scaling shell.
|
|
145
|
+
const shellRef = useSwiperDotGrowX({
|
|
146
|
+
offset: props.offset,
|
|
147
|
+
pageWidth: props.pageWidth,
|
|
148
|
+
index: props.index,
|
|
149
|
+
inactive: 1,
|
|
150
|
+
active: 3,
|
|
151
|
+
});
|
|
152
|
+
const overlayRef = useSwiperDotProgress({
|
|
153
|
+
offset: props.offset,
|
|
154
|
+
pageWidth: props.pageWidth,
|
|
155
|
+
index: props.index,
|
|
156
|
+
});
|
|
157
|
+
return () => (_jsx("view", { catchtap: props.onPress ? () => props.onPress?.(props.index) : undefined, "main-thread:ref": shellRef, style: {
|
|
158
|
+
width: props.size.dot + 'px',
|
|
159
|
+
height: props.size.dot + 'px',
|
|
160
|
+
borderRadius: (props.size.dot / 2) + 'px',
|
|
161
|
+
backgroundColor: withAlpha(props.inactiveColor, 0.4),
|
|
162
|
+
position: 'relative',
|
|
163
|
+
overflow: 'hidden',
|
|
164
|
+
transformOrigin: 'center center',
|
|
165
|
+
}, children: _jsx("view", { "main-thread:ref": overlayRef, style: {
|
|
166
|
+
position: 'absolute',
|
|
167
|
+
left: '0',
|
|
168
|
+
top: '0',
|
|
169
|
+
right: '0',
|
|
170
|
+
bottom: '0',
|
|
171
|
+
backgroundColor: props.activeColor,
|
|
172
|
+
opacity: '0',
|
|
173
|
+
} }) }));
|
|
174
|
+
}
|
|
175
|
+
function ScalePulseBody(props) {
|
|
176
|
+
// No colour crossfade — pure scale. Active dot uses `activeColor`,
|
|
177
|
+
// inactive uses `inactiveColor` at low alpha. Visual is monochrome
|
|
178
|
+
// friendly.
|
|
179
|
+
const scaleRef = useSwiperDotScale({
|
|
180
|
+
offset: props.offset,
|
|
181
|
+
pageWidth: props.pageWidth,
|
|
182
|
+
index: props.index,
|
|
183
|
+
inactive: 1,
|
|
184
|
+
active: 1.6,
|
|
185
|
+
});
|
|
186
|
+
const opacityRef = useSwiperDotProgress({
|
|
187
|
+
offset: props.offset,
|
|
188
|
+
pageWidth: props.pageWidth,
|
|
189
|
+
index: props.index,
|
|
190
|
+
});
|
|
191
|
+
return () => (_jsx("view", { catchtap: props.onPress ? () => props.onPress?.(props.index) : undefined, "main-thread:ref": scaleRef, style: {
|
|
192
|
+
width: props.size.dot + 'px',
|
|
193
|
+
height: props.size.dot + 'px',
|
|
194
|
+
borderRadius: (props.size.dot / 2) + 'px',
|
|
195
|
+
backgroundColor: withAlpha(props.inactiveColor, 0.4),
|
|
196
|
+
position: 'relative',
|
|
197
|
+
overflow: 'hidden',
|
|
198
|
+
}, children: _jsx("view", { "main-thread:ref": opacityRef, style: {
|
|
199
|
+
position: 'absolute',
|
|
200
|
+
left: '0',
|
|
201
|
+
top: '0',
|
|
202
|
+
right: '0',
|
|
203
|
+
bottom: '0',
|
|
204
|
+
backgroundColor: props.activeColor,
|
|
205
|
+
opacity: '0',
|
|
206
|
+
} }) }));
|
|
207
|
+
}
|
|
208
|
+
const BarIndicator = component(({ props }) => {
|
|
209
|
+
// The thumb advances by (dot + gap) per page. We use the headless
|
|
210
|
+
// translate hook — a single MT binding regardless of page count.
|
|
211
|
+
const step = props.dotSize + props.gap;
|
|
212
|
+
const thumbRef = useSwiperDotTranslate({
|
|
213
|
+
offset: props.offset,
|
|
214
|
+
pageWidth: props.pageWidth,
|
|
215
|
+
step,
|
|
216
|
+
});
|
|
217
|
+
return () => {
|
|
218
|
+
const trackWidth = props.count * props.dotSize + Math.max(0, props.count - 1) * props.gap;
|
|
219
|
+
return (_jsxs("view", { class: props.class, style: {
|
|
220
|
+
position: 'relative',
|
|
221
|
+
width: trackWidth + 'px',
|
|
222
|
+
height: props.barHeight + 'px',
|
|
223
|
+
borderRadius: (props.barHeight / 2) + 'px',
|
|
224
|
+
backgroundColor: withAlpha(props.inactiveColor, 0.25),
|
|
225
|
+
overflow: 'visible',
|
|
226
|
+
...props.style,
|
|
227
|
+
}, children: [props.onDotPress
|
|
228
|
+
? (_jsx("view", { style: {
|
|
229
|
+
position: 'absolute',
|
|
230
|
+
inset: '0',
|
|
231
|
+
display: 'flex',
|
|
232
|
+
flexDirection: 'row',
|
|
233
|
+
alignItems: 'center',
|
|
234
|
+
}, children: Array.from({ length: props.count }, (_, i) => (_jsx("view", { catchtap: () => props.onDotPress?.(i), style: {
|
|
235
|
+
width: (props.dotSize + props.gap) + 'px',
|
|
236
|
+
height: '100%',
|
|
237
|
+
} }, i))) }))
|
|
238
|
+
: null, _jsx("view", { "main-thread:ref": thumbRef, style: {
|
|
239
|
+
position: 'absolute',
|
|
240
|
+
left: '0',
|
|
241
|
+
top: '0',
|
|
242
|
+
width: props.dotSize + 'px',
|
|
243
|
+
height: '100%',
|
|
244
|
+
borderRadius: (props.barHeight / 2) + 'px',
|
|
245
|
+
backgroundColor: props.activeColor,
|
|
246
|
+
} })] }));
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
const NumberedIndicator = component(({ props }) => {
|
|
250
|
+
const label = signal({ value: '' });
|
|
251
|
+
effect(() => {
|
|
252
|
+
label.value = `${(props.index.value | 0) + 1} / ${props.count}`;
|
|
253
|
+
});
|
|
254
|
+
return () => (_jsx("text", { class: props.class, style: {
|
|
255
|
+
color: props.color,
|
|
256
|
+
fontSize: props.fontSize + 'px',
|
|
257
|
+
fontWeight: '600',
|
|
258
|
+
...props.style,
|
|
259
|
+
}, children: label.value }));
|
|
260
|
+
});
|
|
261
|
+
// ─────────────────────────────────────────────────────────────────────
|
|
262
|
+
// Helpers
|
|
263
|
+
/**
|
|
264
|
+
* Apply an alpha to a CSS colour value. Works for `var(--color-*)`
|
|
265
|
+
* (uses `color-mix`) and for raw rgb/hex strings (uses `color-mix`
|
|
266
|
+
* too — broadly supported on the platforms Lynx targets).
|
|
267
|
+
*/
|
|
268
|
+
function withAlpha(color, alpha) {
|
|
269
|
+
const pct = Math.round(Math.max(0, Math.min(1, alpha)) * 100);
|
|
270
|
+
return `color-mix(in srgb, ${color} ${pct}%, transparent)`;
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=SwiperIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwiperIndicator.js","sourceRoot":"","sources":["../../src/components/SwiperIndicator.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,MAAM,EACN,eAAe,EACf,MAAM,EACN,cAAc,GAIf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAmB,MAAM,gBAAgB,CAAC;AAmCpE,MAAM,UAAU,GAA0C;IACxD,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClD,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAClD,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EA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H,wEAAwE;AACxE,UAAU;AAEV;;;;GAIG;AACH,SAAS,SAAS,CAAC,KAAa,EAAE,KAAa;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IAC9D,OAAO,sBAAsB,KAAK,IAAI,GAAG,iBAAiB,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared design-system contract.
|
|
3
|
+
*
|
|
4
|
+
* `@sigx/lynx-zero` is the design-system-neutral foundation that DS packages
|
|
5
|
+
* (`@sigx/lynx-daisyui`, `@sigx/lynx-heroui`, …) build on. This module is the
|
|
6
|
+
* *vocabulary* they agree on — size scales, semantic colors, theme token
|
|
7
|
+
* names, and common prop shapes — so that switching an app from one design
|
|
8
|
+
* system to another is mostly an import swap, not a rewrite.
|
|
9
|
+
*
|
|
10
|
+
* Rules of the contract:
|
|
11
|
+
*
|
|
12
|
+
* - DS packages **extend** these types, they never redeclare them. A daisy
|
|
13
|
+
* button is `color: ColorVariant` plus daisy-specific extras; its size IS
|
|
14
|
+
* `SizeScale`. Drift fails `pnpm typecheck`.
|
|
15
|
+
* - `variant` is intentionally NOT in the contract — fill style (outline,
|
|
16
|
+
* soft, bordered, flat, …) is design-system chrome and differs per DS.
|
|
17
|
+
* - Theme CSS custom-property NAMES are part of the contract (see below);
|
|
18
|
+
* the *values* come from each DS's registered themes.
|
|
19
|
+
*
|
|
20
|
+
* ## Structural token-name contract
|
|
21
|
+
*
|
|
22
|
+
* Every DS theme resolves against the same custom-property names:
|
|
23
|
+
*
|
|
24
|
+
* - Colors: `--color-<ColorToken>` (e.g. `--color-primary`, `--color-base-100`)
|
|
25
|
+
* - Roundness: `--radius-selector` | `--radius-field` | `--radius-box`
|
|
26
|
+
* - Sizing: `--size-selector` | `--size-field`, `--size-xs` … `--size-lg`
|
|
27
|
+
* - Text ramp: `--text-xs` … `--text-3xl` (app text, font-scaled)
|
|
28
|
+
* - Controls: `--font-xs` … `--font-lg` (control-internal labels, unscaled)
|
|
29
|
+
* - Misc: `--disabled-opacity`
|
|
30
|
+
*/
|
|
31
|
+
import type { Define } from '@sigx/lynx';
|
|
32
|
+
/** The shared component size scale. */
|
|
33
|
+
export type SizeScale = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
34
|
+
/**
|
|
35
|
+
* Semantic color names — the shared `color` prop vocabulary. A DS maps each
|
|
36
|
+
* onto its palette (HeroUI: `danger`→`error`, `default`→`neutral`, …).
|
|
37
|
+
*
|
|
38
|
+
* Single source of truth: the `ColorVariant` union, the `-content` / `-soft`
|
|
39
|
+
* token derivations, and the runtime `COLOR_TOKENS` Set all derive from this
|
|
40
|
+
* tuple.
|
|
41
|
+
*/
|
|
42
|
+
export declare const COLOR_VARIANT_LIST: readonly ['primary', 'secondary', 'accent', 'neutral', 'info', 'success', 'warning', 'error'];
|
|
43
|
+
export type ColorVariant = typeof COLOR_VARIANT_LIST[number];
|
|
44
|
+
/**
|
|
45
|
+
* Tokens authored by every theme: each variant + its `-content` pairing,
|
|
46
|
+
* plus the base surfaces.
|
|
47
|
+
*/
|
|
48
|
+
export type CoreColorToken = ColorVariant | `${ColorVariant}-content` | 'base-100' | 'base-200' | 'base-300' | 'base-content';
|
|
49
|
+
/**
|
|
50
|
+
* Soft (tinted-surface) tokens — one per variant, emitted as
|
|
51
|
+
* `--color-<variant>-soft`. Lynx CSS can't alpha-compose `var()` colors, so
|
|
52
|
+
* these are *materialized in the palette*: computed at theme registration
|
|
53
|
+
* (`Theme.softMix` of the variant color mixed into `base-100`) unless the
|
|
54
|
+
* theme provides them explicitly. They are what soft/flat component fills
|
|
55
|
+
* read (`btn-soft`, hero's `flat`).
|
|
56
|
+
*/
|
|
57
|
+
export type SoftColorToken = `${ColorVariant}-soft`;
|
|
58
|
+
/**
|
|
59
|
+
* The full set of semantic color tokens every *registered* theme carries,
|
|
60
|
+
* exposed as `--color-<token>` CSS custom properties. Authors write the core
|
|
61
|
+
* tokens; the registry completes the soft ones.
|
|
62
|
+
*/
|
|
63
|
+
export type ColorToken = CoreColorToken | SoftColorToken;
|
|
64
|
+
/**
|
|
65
|
+
* Resolve a color value to a CSS color string.
|
|
66
|
+
*
|
|
67
|
+
* - Known semantic tokens (e.g. `'base-100'`) → `var(--color-base-100)`.
|
|
68
|
+
* - Anything else (`'#ffaa00'`, `'rgb(…)'`, `'var(--my-custom)'`) passes
|
|
69
|
+
* through unchanged.
|
|
70
|
+
*/
|
|
71
|
+
export declare function resolveColorToken(value: string): string;
|
|
72
|
+
/**
|
|
73
|
+
* Accepts a semantic color token (autocompleted) OR any raw CSS color
|
|
74
|
+
* string (`'#fff'`, `'rgb(…)'`, `'var(--foo)'`).
|
|
75
|
+
*/
|
|
76
|
+
export type BackgroundValue = ColorToken | (string & {});
|
|
77
|
+
/** Arbitrary extra classes appended after the DS-computed ones. */
|
|
78
|
+
export type WithClass = Define.Prop<'class', string, false>;
|
|
79
|
+
/** Disabled: non-interactive + DS disabled styling. */
|
|
80
|
+
export type WithDisabled = Define.Prop<'disabled', boolean, false>;
|
|
81
|
+
/** Semantic color of the component (`primary`, `error`, …). */
|
|
82
|
+
export type WithColor = Define.Prop<'color', ColorVariant, false>;
|
|
83
|
+
/** Component size on the shared scale. */
|
|
84
|
+
export type WithSize = Define.Prop<'size', SizeScale, false>;
|
|
85
|
+
/** The shared press event — sigx convention is `onPress`, not `onTap`/`onClick`. */
|
|
86
|
+
export type PressEvent = Define.Event<'press', void>;
|
|
87
|
+
/**
|
|
88
|
+
* Accessibility passthrough for interactive components — mirrors the
|
|
89
|
+
* `accessibility-*` surface `@sigx/lynx-gestures`'s `Pressable` accepts on
|
|
90
|
+
* its host view (the same node that owns the gesture handler, so
|
|
91
|
+
* screen-reader activation works). DS components intersect this and forward
|
|
92
|
+
* the props verbatim.
|
|
93
|
+
*/
|
|
94
|
+
export type WithAccessibility = Define.Prop<'accessibility-element', boolean, false> & Define.Prop<'accessibility-label', string, false> & Define.Prop<'accessibility-role', string, false> & Define.Prop<'accessibility-trait', string, false> & Define.Prop<'accessibility-status', string, false>;
|
|
95
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,uCAAuC;AACvC,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzD;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,YAC7B,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAC3C,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,CAC7B,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB,YAAY,GACZ,GAAG,YAAY,UAAU,GACzB,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,GAAG,YAAY,OAAO,CAAC;AAEpD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,cAAc,CAAC;AASzD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;;GAGG;AAEH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAOzD,mEAAmE;AACnE,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAE5D,uDAAuD;AACvD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAEnE,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;AAElE,0CAA0C;AAC1C,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AAE7D,oFAAoF;AACpF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GACzB,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE,OAAO,EAAE,KAAK,CAAC,GACpD,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,MAAM,EAAE,KAAK,CAAC,GACjD,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,MAAM,EAAE,KAAK,CAAC,GAChD,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,MAAM,EAAE,KAAK,CAAC,GACjD,MAAM,CAAC,IAAI,CAAC,sBAAsB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/contract.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic color names — the shared `color` prop vocabulary. A DS maps each
|
|
3
|
+
* onto its palette (HeroUI: `danger`→`error`, `default`→`neutral`, …).
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth: the `ColorVariant` union, the `-content` / `-soft`
|
|
6
|
+
* token derivations, and the runtime `COLOR_TOKENS` Set all derive from this
|
|
7
|
+
* tuple.
|
|
8
|
+
*/
|
|
9
|
+
export const COLOR_VARIANT_LIST = [
|
|
10
|
+
'primary', 'secondary', 'accent', 'neutral',
|
|
11
|
+
'info', 'success', 'warning', 'error',
|
|
12
|
+
];
|
|
13
|
+
const COLOR_TOKEN_LIST = [
|
|
14
|
+
...COLOR_VARIANT_LIST.flatMap((v) => [v, `${v}-content`, `${v}-soft`]),
|
|
15
|
+
'base-100', 'base-200', 'base-300', 'base-content',
|
|
16
|
+
];
|
|
17
|
+
const COLOR_TOKENS = new Set(COLOR_TOKEN_LIST);
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a color value to a CSS color string.
|
|
20
|
+
*
|
|
21
|
+
* - Known semantic tokens (e.g. `'base-100'`) → `var(--color-base-100)`.
|
|
22
|
+
* - Anything else (`'#ffaa00'`, `'rgb(…)'`, `'var(--my-custom)'`) passes
|
|
23
|
+
* through unchanged.
|
|
24
|
+
*/
|
|
25
|
+
export function resolveColorToken(value) {
|
|
26
|
+
return COLOR_TOKENS.has(value)
|
|
27
|
+
? `var(--color-${value})`
|
|
28
|
+
: value;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAmCA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS;IAC3C,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO;CAC7B,CAAC;AA8BX,MAAM,gBAAgB,GAA0B;IAC9C,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACpF,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc;CACnD,CAAC;AAEF,MAAM,YAAY,GAA4B,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAQ,YAAoC,CAAC,GAAG,CAAC,KAAK,CAAC;QACrD,CAAC,CAAC,eAAe,KAAK,GAAG;QACzB,CAAC,CAAC,KAAK,CAAC;AACZ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type { SizeScale, ColorVariant, ColorToken, CoreColorToken, SoftColorToken, BackgroundValue, WithClass, WithDisabled, WithColor, WithSize, WithAccessibility, PressEvent, } from './contract.js';
|
|
2
|
+
export { resolveColorToken, COLOR_VARIANT_LIST } from './contract.js';
|
|
3
|
+
export type { SpacingValue, BoxProps } from './shared/styles.js';
|
|
4
|
+
export { resolveSpacing, resolveBoxStyle } from './shared/styles.js';
|
|
5
|
+
export { PRESSED_SCALE, PRESSED_OPACITY } from './shared/press.js';
|
|
6
|
+
export { useTabsSelection, provideTabsSelection } from './shared/tabs-selection.js';
|
|
7
|
+
export type { TabsSelection } from './shared/tabs-selection.js';
|
|
8
|
+
export { ThemeProvider, useTheme, listThemes, registerTheme, extendTheme, pickThemeFor, pairOf, variantOf, colorsOf, radiusOf, sizesOf, } from './theme/ThemeProvider.js';
|
|
9
|
+
export type { ThemeName, ThemeController, ThemeProviderProps, Theme, ThemePalette, ThemeRadius, ThemeSizes, ThemeVariant, } from './theme/ThemeProvider.js';
|
|
10
|
+
export { completeTheme } from './theme/registry.js';
|
|
11
|
+
export type { ThemeInput, ThemePaletteInput } from './theme/registry.js';
|
|
12
|
+
export { mixColors } from './theme/color-mix.js';
|
|
13
|
+
export { useThemeColors, toHexColor, withAlpha } from './theme/use-theme-colors.js';
|
|
14
|
+
export type { ThemeColors } from './theme/use-theme-colors.js';
|
|
15
|
+
export { themeController } from './theme/theme-state.js';
|
|
16
|
+
export { StatusBarSync } from './theme/StatusBarSync.js';
|
|
17
|
+
export type { StatusBarSyncProps } from './theme/StatusBarSync.js';
|
|
18
|
+
export { Row } from './layout/Row.js';
|
|
19
|
+
export type { RowProps } from './layout/Row.js';
|
|
20
|
+
export { Col } from './layout/Col.js';
|
|
21
|
+
export type { ColProps } from './layout/Col.js';
|
|
22
|
+
export { Center } from './layout/Center.js';
|
|
23
|
+
export type { CenterProps } from './layout/Center.js';
|
|
24
|
+
export { Spacer } from './layout/Spacer.js';
|
|
25
|
+
export type { SpacerProps } from './layout/Spacer.js';
|
|
26
|
+
export { ScrollView } from './layout/ScrollView.js';
|
|
27
|
+
export type { ScrollViewProps } from './layout/ScrollView.js';
|
|
28
|
+
export { SwiperIndicator } from './components/SwiperIndicator.js';
|
|
29
|
+
export type { SwiperIndicatorProps, SwiperIndicatorVariant, SwiperIndicatorSize, } from './components/SwiperIndicator.js';
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,YAAY,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,SAAS,EACT,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGtE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACpF,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAKhE,OAAO,EACL,aAAa,EACb,QAAQ,EACR,UAAU,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,M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oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,iCAAiC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// @sigx/lynx-zero — design-system-neutral UI foundation.
|
|
2
|
+
//
|
|
3
|
+
// Holds what every design-system package (@sigx/lynx-daisyui,
|
|
4
|
+
// @sigx/lynx-heroui, …) shares: the props/token contract, the theme engine,
|
|
5
|
+
// layout primitives, style utilities and press-feedback defaults
|
|
6
|
+
// (see signalxjs/lynx#219).
|
|
7
|
+
export { resolveColorToken, COLOR_VARIANT_LIST } from './contract.js';
|
|
8
|
+
export { resolveSpacing, resolveBoxStyle } from './shared/styles.js';
|
|
9
|
+
// Press-feedback defaults for interactive components.
|
|
10
|
+
export { PRESSED_SCALE, PRESSED_OPACITY } from './shared/press.js';
|
|
11
|
+
// Headless tabs selection — shared behavior behind every DS's Tabs/Tab.
|
|
12
|
+
export { useTabsSelection, provideTabsSelection } from './shared/tabs-selection.js';
|
|
13
|
+
// Theme engine — registry mechanism, provider, headless controller. Theme
|
|
14
|
+
// *data* (palettes, generated first-paint CSS classes) lives in each
|
|
15
|
+
// design-system package, which seeds the registry at module load.
|
|
16
|
+
export { ThemeProvider, useTheme, listThemes, registerTheme, extendTheme, pickThemeFor, pairOf, variantOf, colorsOf, radiusOf, sizesOf, } from './theme/ThemeProvider.js';
|
|
17
|
+
// Palette completion (soft tints) + the JS-side color mixer behind it.
|
|
18
|
+
export { completeTheme } from './theme/registry.js';
|
|
19
|
+
export { mixColors } from './theme/color-mix.js';
|
|
20
|
+
// Scoped palette → concrete values for native consumers that can't read
|
|
21
|
+
// CSS custom properties (platform inputs, sigx-richtext, SVG fills).
|
|
22
|
+
export { useThemeColors, toHexColor, withAlpha } from './theme/use-theme-colors.js';
|
|
23
|
+
// Headless theme handle: import and call from anywhere — stores, services,
|
|
24
|
+
// effects, app-boot — with no `<ThemeProvider>` ancestor required.
|
|
25
|
+
export { themeController } from './theme/theme-state.js';
|
|
26
|
+
export { StatusBarSync } from './theme/StatusBarSync.js';
|
|
27
|
+
// Per-screen theming (`useScreenTheme`) is deliberately NOT re-exported here:
|
|
28
|
+
// it statically imports the optional `@sigx/lynx-navigation` peer, and a
|
|
29
|
+
// barrel re-export would force that resolution onto every consumer. Import it
|
|
30
|
+
// from the subpath instead: `@sigx/lynx-zero/screen-theme`.
|
|
31
|
+
// Layout primitives — design-system-neutral structure (flex containers,
|
|
32
|
+
// spacing, scrolling); no design-system class names involved.
|
|
33
|
+
export { Row } from './layout/Row.js';
|
|
34
|
+
export { Col } from './layout/Col.js';
|
|
35
|
+
export { Center } from './layout/Center.js';
|
|
36
|
+
export { Spacer } from './layout/Spacer.js';
|
|
37
|
+
export { ScrollView } from './layout/ScrollView.js';
|
|
38
|
+
// Swiper page indicator — design-system-neutral (pure tokens + headless
|
|
39
|
+
// gesture/motion hooks, no DS class names). Both design systems re-export it.
|
|
40
|
+
export { SwiperIndicator } from './components/SwiperIndicator.js';
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,EAAE;AACF,8DAA8D;AAC9D,4EAA4E;AAC5E,iEAAiE;AACjE,4BAA4B;AAkB5B,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAItE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErE,sDAAsD;AACtD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEnE,wEAAwE;AACxE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGpF,0EAA0E;AAC1E,qEAAqE;AACrE,kEAAkE;AAClE,OAAO,EACL,aAAa,EACb,QAAQ,EACR,UAAU,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,GACR,MAAM,0BAA0B,CAAC;AAWlC,uEAAuE;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,wEAAwE;AACxE,qEAAqE;AACrE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAEpF,2EAA2E;AAC3E,mEAAmE;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,8EAA8E;AAC9E,yEAAyE;AACzE,8EAA8E;AAC9E,4DAA4D;AAE5D,wEAAwE;AACxE,8DAA8D;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,wEAAwE;AACxE,8EAA8E;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Define } from '@sigx/lynx';
|
|
2
|
+
import type { BackgroundValue } from '../contract.js';
|
|
3
|
+
export type CenterProps = Define.Prop<'width', number | string, false> & Define.Prop<'height', number | string, false> & Define.Prop<'flex', number, false> & Define.Prop<'background', BackgroundValue, false> & Define.Prop<'borderRadius', number, false> & Define.Prop<'class', string, false> & Define.Slot<'default'>;
|
|
4
|
+
export declare const Center: import("@sigx/runtime-core").ComponentFactory<CenterProps, void, {
|
|
5
|
+
default: () => import("@sigx/runtime-core").JSXElement | import("@sigx/runtime-core").JSXElement[] | null;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=Center.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Center.d.ts","sourceRoot":"","sources":["../../src/layout/Center.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,MAAM,WAAW,GACnB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,GAC5C,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,CAAC,GAC7C,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAClC,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,EAAE,KAAK,CAAC,GACjD,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,GAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,GACnC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAE3B,eAAO,MAAM,MAAM;;EA2BjB,CAAC"}
|