@brika/ui-kit 0.3.0 → 0.3.1
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/package.json +9 -9
- package/src/__tests__/nodes.test.ts +811 -180
- package/src/descriptors.ts +0 -8
- package/src/index.ts +2 -24
- package/src/nodes/_shared.ts +30 -9
- package/src/nodes/avatar.ts +8 -2
- package/src/nodes/badge.ts +8 -2
- package/src/nodes/button.ts +5 -1
- package/src/nodes/callout.ts +4 -1
- package/src/nodes/chart.ts +4 -1
- package/src/nodes/checkbox.ts +8 -2
- package/src/nodes/code-block.ts +4 -1
- package/src/nodes/divider.ts +4 -1
- package/src/nodes/icon.ts +8 -2
- package/src/nodes/image.ts +8 -2
- package/src/nodes/key-value.ts +4 -1
- package/src/nodes/link.ts +4 -1
- package/src/nodes/markdown.ts +4 -1
- package/src/nodes/progress.ts +4 -1
- package/src/nodes/select.ts +5 -1
- package/src/nodes/skeleton.ts +4 -1
- package/src/nodes/slider.ts +5 -1
- package/src/nodes/spacer.ts +4 -1
- package/src/nodes/stat-value.ts +4 -1
- package/src/nodes/status.ts +4 -1
- package/src/nodes/table.ts +8 -2
- package/src/nodes/tabs.ts +6 -1
- package/src/nodes/text.ts +16 -3
- package/src/nodes/toggle.ts +5 -1
- package/src/nodes/video.ts +4 -1
- package/tailwind-theme.css +115 -0
- package/src/__tests__/define-brick.test.ts +0 -125
- package/src/__tests__/mutations.test.ts +0 -211
- package/src/define-brick.ts +0 -92
- package/src/jsx-dev-runtime.ts +0 -3
- package/src/jsx-runtime.ts +0 -60
- package/src/mutations.ts +0 -79
package/src/descriptors.ts
CHANGED
|
@@ -6,14 +6,6 @@ export interface ActionNode {
|
|
|
6
6
|
icon?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export const MUT = { CREATE: 0, REPLACE: 1, UPDATE: 2, REMOVE: 3 } as const;
|
|
10
|
-
|
|
11
|
-
export type Mutation =
|
|
12
|
-
| [op: 0, path: string, node: ComponentNode]
|
|
13
|
-
| [op: 1, path: string, node: ComponentNode]
|
|
14
|
-
| [op: 2, path: string, changes: Record<string, unknown>, removed?: string[]]
|
|
15
|
-
| [op: 3, path: string];
|
|
16
|
-
|
|
17
9
|
export interface BrickDescriptor {
|
|
18
10
|
id: string;
|
|
19
11
|
title: string;
|
package/src/index.ts
CHANGED
|
@@ -64,7 +64,7 @@ export type {
|
|
|
64
64
|
} from './nodes';
|
|
65
65
|
|
|
66
66
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
67
|
-
// Component Builders (PascalCase
|
|
67
|
+
// Component Builders (PascalCase)
|
|
68
68
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
69
69
|
|
|
70
70
|
export {
|
|
@@ -109,29 +109,7 @@ export {
|
|
|
109
109
|
// Descriptors
|
|
110
110
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
111
111
|
|
|
112
|
-
export type { ActionNode, BrickDescriptor
|
|
113
|
-
export { MUT } from './descriptors';
|
|
114
|
-
|
|
115
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
116
|
-
// defineBrick
|
|
117
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
118
|
-
|
|
119
|
-
export type {
|
|
120
|
-
BrickActionHandler,
|
|
121
|
-
BrickComponent,
|
|
122
|
-
BrickFamily,
|
|
123
|
-
BrickInstanceContext,
|
|
124
|
-
BrickTypeSpec,
|
|
125
|
-
CompiledBrickType,
|
|
126
|
-
} from './define-brick';
|
|
127
|
-
|
|
128
|
-
export { defineBrick } from './define-brick';
|
|
129
|
-
|
|
130
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
131
|
-
// Mutation Applicator (shared between Hub and UI)
|
|
132
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
133
|
-
|
|
134
|
-
export { applyMutations } from './mutations';
|
|
112
|
+
export type { ActionNode, BrickDescriptor } from './descriptors';
|
|
135
113
|
|
|
136
114
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
137
115
|
// Theme-aware color tokens
|
package/src/nodes/_shared.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface BaseNode {
|
|
|
7
7
|
|
|
8
8
|
function isMarker<T>(brand: string) {
|
|
9
9
|
return (v: unknown): v is T =>
|
|
10
|
-
v
|
|
10
|
+
v !== null && typeof v === 'object' && (v as Record<string, unknown>)[brand] === true;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
// ── I18n Reference ───────────────────────────────────────────────────────────
|
|
@@ -57,18 +57,25 @@ export type IntlRef = {
|
|
|
57
57
|
export const isIntlRef = isMarker<IntlRef>('__intl');
|
|
58
58
|
|
|
59
59
|
export function resolveIntlRef(ref: IntlRef, locale?: string): string {
|
|
60
|
-
if (!locale)
|
|
60
|
+
if (!locale) {
|
|
61
|
+
return ref.type === 'list' ? ref.value.join(', ') : String(ref.value);
|
|
62
|
+
}
|
|
61
63
|
switch (ref.type) {
|
|
62
64
|
case 'dateTime':
|
|
63
65
|
return new Intl.DateTimeFormat(locale, ref.options).format(ref.value);
|
|
64
66
|
case 'number':
|
|
65
67
|
return new Intl.NumberFormat(locale, ref.options).format(ref.value);
|
|
66
68
|
case 'relativeTime':
|
|
67
|
-
return new Intl.RelativeTimeFormat(locale, {
|
|
69
|
+
return new Intl.RelativeTimeFormat(locale, {
|
|
70
|
+
numeric: 'auto',
|
|
71
|
+
}).format(ref.value, ref.unit);
|
|
68
72
|
case 'list':
|
|
69
73
|
return new Intl.ListFormat(
|
|
70
74
|
locale,
|
|
71
|
-
ref.options ?? {
|
|
75
|
+
ref.options ?? {
|
|
76
|
+
style: 'long',
|
|
77
|
+
type: 'conjunction',
|
|
78
|
+
}
|
|
72
79
|
).format(ref.value);
|
|
73
80
|
}
|
|
74
81
|
}
|
|
@@ -87,7 +94,9 @@ export function _setActionRegistrar(fn: ((handler: ActionHandler) => string) | n
|
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
export function resolveAction(handler: ActionHandler): string {
|
|
90
|
-
if (_registrar)
|
|
97
|
+
if (_registrar) {
|
|
98
|
+
return _registrar(handler);
|
|
99
|
+
}
|
|
91
100
|
return `__action_${_fallbackIdx++}`;
|
|
92
101
|
}
|
|
93
102
|
|
|
@@ -108,19 +117,31 @@ export type ComponentNode = NodeTypeMap[keyof NodeTypeMap];
|
|
|
108
117
|
export type Child = ComponentNode | I18nRef | IntlRef | ComponentNode[] | false | null | undefined;
|
|
109
118
|
|
|
110
119
|
export function normalizeChildren(children: Child | Child[]): ComponentNode[] {
|
|
111
|
-
if (!children)
|
|
120
|
+
if (!children) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
112
123
|
const items = Array.isArray(children) ? children.flat() : [children];
|
|
113
124
|
const result: ComponentNode[] = [];
|
|
114
125
|
for (const c of items) {
|
|
115
|
-
if (c
|
|
126
|
+
if (c === null || c === false || c === undefined) {
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
116
129
|
if (isI18nRef(c)) {
|
|
117
130
|
result.push({
|
|
118
131
|
type: 'text',
|
|
119
132
|
content: c.key,
|
|
120
|
-
i18n: {
|
|
133
|
+
i18n: {
|
|
134
|
+
ns: c.ns,
|
|
135
|
+
key: c.key,
|
|
136
|
+
params: c.params,
|
|
137
|
+
},
|
|
121
138
|
} as ComponentNode);
|
|
122
139
|
} else if (isIntlRef(c)) {
|
|
123
|
-
result.push({
|
|
140
|
+
result.push({
|
|
141
|
+
type: 'text',
|
|
142
|
+
content: resolveIntlRef(c),
|
|
143
|
+
intl: c,
|
|
144
|
+
} as ComponentNode);
|
|
124
145
|
} else {
|
|
125
146
|
result.push(c);
|
|
126
147
|
}
|
package/src/nodes/avatar.ts
CHANGED
|
@@ -23,10 +23,16 @@ export interface AvatarNode extends BaseNode {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export function Avatar(
|
|
26
|
-
props: Omit<AvatarNode, 'type' | 'onPress'> & {
|
|
26
|
+
props: Omit<AvatarNode, 'type' | 'onPress'> & {
|
|
27
|
+
onPress?: ActionHandler;
|
|
28
|
+
}
|
|
27
29
|
): AvatarNode {
|
|
28
30
|
const { onPress, ...rest } = props;
|
|
29
|
-
return {
|
|
31
|
+
return {
|
|
32
|
+
type: 'avatar',
|
|
33
|
+
...rest,
|
|
34
|
+
onPress: onPress ? resolveAction(onPress) : undefined,
|
|
35
|
+
};
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
declare module './_shared' {
|
package/src/nodes/badge.ts
CHANGED
|
@@ -16,10 +16,16 @@ export interface BadgeNode extends BaseNode {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function Badge(
|
|
19
|
-
props: Omit<BadgeNode, 'type' | 'onPress'> & {
|
|
19
|
+
props: Omit<BadgeNode, 'type' | 'onPress'> & {
|
|
20
|
+
onPress?: ActionHandler;
|
|
21
|
+
}
|
|
20
22
|
): BadgeNode {
|
|
21
23
|
const { onPress, ...rest } = props;
|
|
22
|
-
return {
|
|
24
|
+
return {
|
|
25
|
+
type: 'badge',
|
|
26
|
+
...rest,
|
|
27
|
+
onPress: onPress ? resolveAction(onPress) : undefined,
|
|
28
|
+
};
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
declare module './_shared' {
|
package/src/nodes/button.ts
CHANGED
|
@@ -34,7 +34,11 @@ export function Button(props: {
|
|
|
34
34
|
fullWidth?: boolean;
|
|
35
35
|
}): ButtonNode {
|
|
36
36
|
const { onPress, ...rest } = props;
|
|
37
|
-
return {
|
|
37
|
+
return {
|
|
38
|
+
type: 'button',
|
|
39
|
+
...rest,
|
|
40
|
+
onPress: onPress ? resolveAction(onPress) : undefined,
|
|
41
|
+
};
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
declare module './_shared' {
|
package/src/nodes/callout.ts
CHANGED
|
@@ -13,7 +13,10 @@ export interface CalloutNode extends BaseNode {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function Callout(props: Omit<CalloutNode, 'type'>): CalloutNode {
|
|
16
|
-
return {
|
|
16
|
+
return {
|
|
17
|
+
type: 'callout',
|
|
18
|
+
...props,
|
|
19
|
+
};
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
declare module './_shared' {
|
package/src/nodes/chart.ts
CHANGED
package/src/nodes/checkbox.ts
CHANGED
|
@@ -14,10 +14,16 @@ export interface CheckboxNode extends BaseNode {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function Checkbox(
|
|
17
|
-
props: Omit<CheckboxNode, 'type' | 'onToggle'> & {
|
|
17
|
+
props: Omit<CheckboxNode, 'type' | 'onToggle'> & {
|
|
18
|
+
onToggle: ActionHandler;
|
|
19
|
+
}
|
|
18
20
|
): CheckboxNode {
|
|
19
21
|
const { onToggle, ...rest } = props;
|
|
20
|
-
return {
|
|
22
|
+
return {
|
|
23
|
+
type: 'checkbox',
|
|
24
|
+
...rest,
|
|
25
|
+
onToggle: resolveAction(onToggle),
|
|
26
|
+
};
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
declare module './_shared' {
|
package/src/nodes/code-block.ts
CHANGED
|
@@ -17,7 +17,10 @@ export interface CodeBlockNode extends BaseNode {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function CodeBlock(props: Omit<CodeBlockNode, 'type'>): CodeBlockNode {
|
|
20
|
-
return {
|
|
20
|
+
return {
|
|
21
|
+
type: 'code-block',
|
|
22
|
+
...props,
|
|
23
|
+
};
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
declare module './_shared' {
|
package/src/nodes/divider.ts
CHANGED
package/src/nodes/icon.ts
CHANGED
|
@@ -15,10 +15,16 @@ export interface IconNode extends BaseNode {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function Icon(
|
|
18
|
-
props: Omit<IconNode, 'type' | 'onPress'> & {
|
|
18
|
+
props: Omit<IconNode, 'type' | 'onPress'> & {
|
|
19
|
+
onPress?: ActionHandler;
|
|
20
|
+
}
|
|
19
21
|
): IconNode {
|
|
20
22
|
const { onPress, ...rest } = props;
|
|
21
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
type: 'icon',
|
|
25
|
+
...rest,
|
|
26
|
+
onPress: onPress ? resolveAction(onPress) : undefined,
|
|
27
|
+
};
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
declare module './_shared' {
|
package/src/nodes/image.ts
CHANGED
|
@@ -16,10 +16,16 @@ export interface ImageNode extends BaseNode {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function Image(
|
|
19
|
-
props: Omit<ImageNode, 'type' | 'onPress'> & {
|
|
19
|
+
props: Omit<ImageNode, 'type' | 'onPress'> & {
|
|
20
|
+
onPress?: ActionHandler;
|
|
21
|
+
}
|
|
20
22
|
): ImageNode {
|
|
21
23
|
const { onPress, ...rest } = props;
|
|
22
|
-
return {
|
|
24
|
+
return {
|
|
25
|
+
type: 'image',
|
|
26
|
+
...rest,
|
|
27
|
+
onPress: onPress ? resolveAction(onPress) : undefined,
|
|
28
|
+
};
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
declare module './_shared' {
|
package/src/nodes/key-value.ts
CHANGED
|
@@ -21,7 +21,10 @@ export interface KeyValueNode extends BaseNode {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function KeyValue(props: Omit<KeyValueNode, 'type'>): KeyValueNode {
|
|
24
|
-
return {
|
|
24
|
+
return {
|
|
25
|
+
type: 'key-value',
|
|
26
|
+
...props,
|
|
27
|
+
};
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
declare module './_shared' {
|
package/src/nodes/link.ts
CHANGED
package/src/nodes/markdown.ts
CHANGED
|
@@ -6,7 +6,10 @@ export interface MarkdownNode extends BaseNode {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export function Markdown(props: Omit<MarkdownNode, 'type'>): MarkdownNode {
|
|
9
|
-
return {
|
|
9
|
+
return {
|
|
10
|
+
type: 'markdown',
|
|
11
|
+
...props,
|
|
12
|
+
};
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
declare module './_shared' {
|
package/src/nodes/progress.ts
CHANGED
|
@@ -18,7 +18,10 @@ export interface ProgressNode extends BaseNode {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export function Progress(props: Omit<ProgressNode, 'type'>): ProgressNode {
|
|
21
|
-
return {
|
|
21
|
+
return {
|
|
22
|
+
type: 'progress',
|
|
23
|
+
...props,
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
declare module './_shared' {
|
package/src/nodes/select.ts
CHANGED
|
@@ -34,7 +34,11 @@ export function Select(props: {
|
|
|
34
34
|
icon?: string;
|
|
35
35
|
}): SelectNode {
|
|
36
36
|
const { onChange, ...rest } = props;
|
|
37
|
-
return {
|
|
37
|
+
return {
|
|
38
|
+
type: 'select',
|
|
39
|
+
...rest,
|
|
40
|
+
onChange: resolveAction(onChange),
|
|
41
|
+
};
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
declare module './_shared' {
|
package/src/nodes/skeleton.ts
CHANGED
|
@@ -13,7 +13,10 @@ export interface SkeletonNode extends BaseNode {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function Skeleton(props: Omit<SkeletonNode, 'type'>): SkeletonNode {
|
|
16
|
-
return {
|
|
16
|
+
return {
|
|
17
|
+
type: 'skeleton',
|
|
18
|
+
...props,
|
|
19
|
+
};
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
declare module './_shared' {
|
package/src/nodes/slider.ts
CHANGED
|
@@ -30,7 +30,11 @@ export function Slider(props: {
|
|
|
30
30
|
disabled?: boolean;
|
|
31
31
|
}): SliderNode {
|
|
32
32
|
const { onChange, ...rest } = props;
|
|
33
|
-
return {
|
|
33
|
+
return {
|
|
34
|
+
type: 'slider',
|
|
35
|
+
...rest,
|
|
36
|
+
onChange: resolveAction(onChange),
|
|
37
|
+
};
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
declare module './_shared' {
|
package/src/nodes/spacer.ts
CHANGED
|
@@ -7,7 +7,10 @@ export interface SpacerNode extends BaseNode {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function Spacer(props?: { size?: 'sm' | 'md' | 'lg' }): SpacerNode {
|
|
10
|
-
return {
|
|
10
|
+
return {
|
|
11
|
+
type: 'spacer',
|
|
12
|
+
...props,
|
|
13
|
+
};
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
declare module './_shared' {
|
package/src/nodes/stat-value.ts
CHANGED
|
@@ -16,7 +16,10 @@ export interface StatValueNode extends BaseNode {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function Stat(props: Omit<StatValueNode, 'type'>): StatValueNode {
|
|
19
|
-
return {
|
|
19
|
+
return {
|
|
20
|
+
type: 'stat-value',
|
|
21
|
+
...props,
|
|
22
|
+
};
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
declare module './_shared' {
|
package/src/nodes/status.ts
CHANGED
|
@@ -10,7 +10,10 @@ export interface StatusNode extends BaseNode {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function Status(props: Omit<StatusNode, 'type'>): StatusNode {
|
|
13
|
-
return {
|
|
13
|
+
return {
|
|
14
|
+
type: 'status',
|
|
15
|
+
...props,
|
|
16
|
+
};
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
declare module './_shared' {
|
package/src/nodes/table.ts
CHANGED
|
@@ -22,10 +22,16 @@ export interface TableNode extends BaseNode {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export function Table(
|
|
25
|
-
props: Omit<TableNode, 'type' | 'onRowPress'> & {
|
|
25
|
+
props: Omit<TableNode, 'type' | 'onRowPress'> & {
|
|
26
|
+
onRowPress?: ActionHandler;
|
|
27
|
+
}
|
|
26
28
|
): TableNode {
|
|
27
29
|
const { onRowPress, ...rest } = props;
|
|
28
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
type: 'table',
|
|
32
|
+
...rest,
|
|
33
|
+
onRowPress: onRowPress ? resolveAction(onRowPress) : undefined,
|
|
34
|
+
};
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
declare module './_shared' {
|
package/src/nodes/tabs.ts
CHANGED
|
@@ -27,7 +27,12 @@ export interface TabsNode extends BaseNode {
|
|
|
27
27
|
|
|
28
28
|
export function Tabs(props: {
|
|
29
29
|
value: string;
|
|
30
|
-
tabs: {
|
|
30
|
+
tabs: {
|
|
31
|
+
key: string;
|
|
32
|
+
label: string;
|
|
33
|
+
icon?: string;
|
|
34
|
+
children?: Child | Child[];
|
|
35
|
+
}[];
|
|
31
36
|
onChange: ActionHandler;
|
|
32
37
|
variant?: 'default' | 'pills';
|
|
33
38
|
}): TabsNode {
|
package/src/nodes/text.ts
CHANGED
|
@@ -7,7 +7,11 @@ export interface TextNode extends BaseNode {
|
|
|
7
7
|
type: 'text';
|
|
8
8
|
content: string;
|
|
9
9
|
/** When set, the UI renderer resolves this via i18next instead of using content. */
|
|
10
|
-
i18n?: {
|
|
10
|
+
i18n?: {
|
|
11
|
+
ns: string;
|
|
12
|
+
key: string;
|
|
13
|
+
params?: Record<string, string | number>;
|
|
14
|
+
};
|
|
11
15
|
/** When set, the UI renderer formats this value via Intl APIs with the user's locale. */
|
|
12
16
|
intl?: IntlRef;
|
|
13
17
|
variant?: 'body' | 'caption' | 'heading';
|
|
@@ -43,7 +47,11 @@ export function Text(props: TextProps): TextNode {
|
|
|
43
47
|
type: 'text',
|
|
44
48
|
...rest,
|
|
45
49
|
content: content.key,
|
|
46
|
-
i18n: {
|
|
50
|
+
i18n: {
|
|
51
|
+
ns: content.ns,
|
|
52
|
+
key: content.key,
|
|
53
|
+
params: content.params,
|
|
54
|
+
},
|
|
47
55
|
onPress: press,
|
|
48
56
|
};
|
|
49
57
|
}
|
|
@@ -56,7 +64,12 @@ export function Text(props: TextProps): TextNode {
|
|
|
56
64
|
onPress: press,
|
|
57
65
|
};
|
|
58
66
|
}
|
|
59
|
-
return {
|
|
67
|
+
return {
|
|
68
|
+
type: 'text',
|
|
69
|
+
...rest,
|
|
70
|
+
content,
|
|
71
|
+
onPress: press,
|
|
72
|
+
};
|
|
60
73
|
}
|
|
61
74
|
|
|
62
75
|
declare module './_shared' {
|
package/src/nodes/toggle.ts
CHANGED
|
@@ -22,7 +22,11 @@ export function Toggle(props: {
|
|
|
22
22
|
disabled?: boolean;
|
|
23
23
|
}): ToggleNode {
|
|
24
24
|
const { onToggle, ...rest } = props;
|
|
25
|
-
return {
|
|
25
|
+
return {
|
|
26
|
+
type: 'toggle',
|
|
27
|
+
...rest,
|
|
28
|
+
onToggle: resolveAction(onToggle),
|
|
29
|
+
};
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
declare module './_shared' {
|
package/src/nodes/video.ts
CHANGED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/* Shared Tailwind v4 theme tokens — imported by both the Vite frontend build
|
|
2
|
+
and the hub's ModuleCompiler (plugin page CSS). Single source of truth. */
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
/* ─────────────────────────────────────────────────────────────
|
|
7
|
+
BASE TOKENS (theme-independent)
|
|
8
|
+
───────────────────────────────────────────────────────────── */
|
|
9
|
+
@theme {
|
|
10
|
+
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
|
|
11
|
+
--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
|
|
12
|
+
|
|
13
|
+
--radius-sm: 0.375rem;
|
|
14
|
+
--radius-md: 0.5rem;
|
|
15
|
+
--radius-lg: 0.75rem;
|
|
16
|
+
--radius-xl: 1rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* ─────────────────────────────────────────────────────────────
|
|
20
|
+
SEMANTIC VARIABLES → TAILWIND UTILITIES
|
|
21
|
+
Makes them available as utilities: bg-primary, text-success, etc.
|
|
22
|
+
───────────────────────────────────────────────────────────── */
|
|
23
|
+
@theme inline {
|
|
24
|
+
/* Core semantic colors */
|
|
25
|
+
--color-background: var(--background);
|
|
26
|
+
--color-foreground: var(--foreground);
|
|
27
|
+
--color-card: var(--card);
|
|
28
|
+
--color-card-foreground: var(--card-foreground);
|
|
29
|
+
--color-popover: var(--popover);
|
|
30
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
31
|
+
--color-primary: var(--primary);
|
|
32
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
33
|
+
--color-secondary: var(--secondary);
|
|
34
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
35
|
+
--color-muted: var(--muted);
|
|
36
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
37
|
+
--color-accent: var(--accent);
|
|
38
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
39
|
+
--color-border: var(--border);
|
|
40
|
+
--color-input: var(--input);
|
|
41
|
+
--color-ring: var(--ring);
|
|
42
|
+
|
|
43
|
+
/* Semantic feedback colors */
|
|
44
|
+
--color-success: var(--success);
|
|
45
|
+
--color-success-foreground: var(--success-foreground);
|
|
46
|
+
--color-warning: var(--warning);
|
|
47
|
+
--color-warning-foreground: var(--warning-foreground);
|
|
48
|
+
--color-info: var(--info);
|
|
49
|
+
--color-info-foreground: var(--info-foreground);
|
|
50
|
+
--color-destructive: var(--destructive);
|
|
51
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
52
|
+
|
|
53
|
+
/* Status colors for workflows */
|
|
54
|
+
--color-status-idle: var(--status-idle);
|
|
55
|
+
--color-status-running: var(--status-running);
|
|
56
|
+
--color-status-completed: var(--status-completed);
|
|
57
|
+
--color-status-error: var(--status-error);
|
|
58
|
+
|
|
59
|
+
/* Data visualization colors */
|
|
60
|
+
--color-data-1: var(--data-1);
|
|
61
|
+
--color-data-2: var(--data-2);
|
|
62
|
+
--color-data-3: var(--data-3);
|
|
63
|
+
--color-data-4: var(--data-4);
|
|
64
|
+
--color-data-5: var(--data-5);
|
|
65
|
+
--color-data-6: var(--data-6);
|
|
66
|
+
--color-data-7: var(--data-7);
|
|
67
|
+
--color-data-8: var(--data-8);
|
|
68
|
+
|
|
69
|
+
/* Sidebar colors */
|
|
70
|
+
--color-sidebar: var(--sidebar);
|
|
71
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
72
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
73
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
74
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
75
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
76
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
77
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ─────────────────────────────────────────────────────────────
|
|
81
|
+
CORNER SHAPE UTILITIES
|
|
82
|
+
CSS corner-shape property for squircle and other corner styles
|
|
83
|
+
Requires border-radius to have effect
|
|
84
|
+
https://developer.mozilla.org/en-US/docs/Web/CSS/corner-shape
|
|
85
|
+
───────────────────────────────────────────────────────────── */
|
|
86
|
+
|
|
87
|
+
/* Static keyword utilities */
|
|
88
|
+
@utility corner-round {
|
|
89
|
+
corner-shape: round;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@utility corner-square {
|
|
93
|
+
corner-shape: square;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@utility corner-bevel {
|
|
97
|
+
corner-shape: bevel;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@utility corner-scoop {
|
|
101
|
+
corner-shape: scoop;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@utility corner-notch {
|
|
105
|
+
corner-shape: notch;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@utility corner-squircle {
|
|
109
|
+
corner-shape: squircle;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Functional utility for superellipse with custom values */
|
|
113
|
+
@utility corner-superellipse-* {
|
|
114
|
+
corner-shape: superellipse(--value(number));
|
|
115
|
+
}
|