juxscript 1.1.131 → 1.1.133

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 (34) hide show
  1. package/dom-structure-map.json +1 -1
  2. package/index.d.ts +1 -2
  3. package/index.d.ts.map +1 -1
  4. package/index.js +8 -9
  5. package/lib/components/base/Animations.d.ts +36 -0
  6. package/lib/components/base/Animations.d.ts.map +1 -0
  7. package/lib/components/base/Animations.js +70 -0
  8. package/lib/components/base/Animations.ts +112 -0
  9. package/lib/components/base/BaseComponent.d.ts +3 -0
  10. package/lib/components/base/BaseComponent.d.ts.map +1 -1
  11. package/lib/components/base/BaseComponent.js +4 -8
  12. package/lib/components/base/BaseComponent.ts +6 -10
  13. package/lib/components/stack/BaseStack.d.ts +40 -56
  14. package/lib/components/stack/BaseStack.d.ts.map +1 -1
  15. package/lib/components/stack/BaseStack.js +101 -173
  16. package/lib/components/stack/BaseStack.ts +114 -229
  17. package/lib/components/stack/HStack.d.ts +14 -4
  18. package/lib/components/stack/HStack.d.ts.map +1 -1
  19. package/lib/components/stack/HStack.js +16 -15
  20. package/lib/components/stack/HStack.ts +17 -19
  21. package/lib/components/stack/VStack.d.ts +15 -7
  22. package/lib/components/stack/VStack.d.ts.map +1 -1
  23. package/lib/components/stack/VStack.js +17 -17
  24. package/lib/components/stack/VStack.ts +18 -22
  25. package/lib/components/stack/ZStack.d.ts +14 -4
  26. package/lib/components/stack/ZStack.d.ts.map +1 -1
  27. package/lib/components/stack/ZStack.js +16 -15
  28. package/lib/components/stack/ZStack.ts +17 -19
  29. package/lib/styles/shadcn.css +1106 -0
  30. package/package.json +1 -1
  31. package/lib/components/base/LayoutExtensions.d.ts +0 -112
  32. package/lib/components/base/LayoutExtensions.d.ts.map +0 -1
  33. package/lib/components/base/LayoutExtensions.js +0 -187
  34. package/lib/components/base/LayoutExtensions.ts +0 -345
@@ -1,345 +0,0 @@
1
- /**
2
- * Layout Modifiers Extension
3
- *
4
- * Provides precision layout control via inline styles (for variable values)
5
- * and CSS classes (for fixed values like display, position, overflow).
6
- *
7
- * Automatically applied to BaseComponent - all components have these methods.
8
- */
9
-
10
- import type { BaseComponent } from './BaseComponent.js';
11
-
12
- export interface LayoutExtensions {
13
- // Spacing (inline styles - too variable for classes)
14
- padding(value: string): this;
15
- paddingTop(value: string): this;
16
- paddingRight(value: string): this;
17
- paddingBottom(value: string): this;
18
- paddingLeft(value: string): this;
19
- paddingHorizontal(value: string): this;
20
- paddingVertical(value: string): this;
21
- margin(value: string): this;
22
- marginTop(value: string): this;
23
- marginRight(value: string): this;
24
- marginBottom(value: string): this;
25
- marginLeft(value: string): this;
26
- marginHorizontal(value: string): this;
27
- marginVertical(value: string): this;
28
-
29
- // Sizing (inline styles)
30
- width(value: string): this;
31
- height(value: string): this;
32
- minWidth(value: string): this;
33
- maxWidth(value: string): this;
34
- minHeight(value: string): this;
35
- maxHeight(value: string): this;
36
-
37
- // Borders (inline styles for values, classes for style)
38
- border(value: string): this;
39
- borderTop(value: string): this;
40
- borderRight(value: string): this;
41
- borderBottom(value: string): this;
42
- borderLeft(value: string): this;
43
- borderRadius(value: string): this;
44
- borderWidth(value: string): this;
45
- borderColor(value: string): this;
46
- borderStyle(value: 'solid' | 'dashed' | 'dotted' | 'double' | 'none'): this;
47
-
48
- // Background (inline styles)
49
- background(value: string): this;
50
- backgroundColor(value: string): this;
51
- backgroundImage(value: string): this;
52
- backgroundSize(value: string): this;
53
- backgroundPosition(value: string): this;
54
- backgroundRepeat(value: string): this;
55
-
56
- // Gradient helpers (inline styles)
57
- linearGradient(direction: string, ...colorStops: string[]): this;
58
- radialGradient(shape: string, ...colorStops: string[]): this;
59
- conicGradient(from: string, ...colorStops: string[]): this;
60
-
61
-
62
- // Effects (inline styles)
63
- boxShadow(value: string): this;
64
- opacity(value: string | number): this;
65
-
66
- // Positioning (classes for type, inline for offsets)
67
- position(value: 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'): this;
68
- top(value: string): this;
69
- right(value: string): this;
70
- bottom(value: string): this;
71
- left(value: string): this;
72
- zIndex(value: string | number): this;
73
-
74
- // Overflow (CSS classes)
75
- overflow(value: 'visible' | 'hidden' | 'scroll' | 'auto'): this;
76
- overflowX(value: 'visible' | 'hidden' | 'scroll' | 'auto'): this;
77
- overflowY(value: 'visible' | 'hidden' | 'scroll' | 'auto'): this;
78
-
79
- // Display (CSS classes)
80
- display(value: 'block' | 'inline' | 'inline-block' | 'flex' | 'grid' | 'none'): this;
81
-
82
- // Flex (inline styles)
83
- flex(value: string | number): this;
84
- flexGrow(value: string | number): this;
85
- flexShrink(value: string | number): this;
86
- flexBasis(value: string): this;
87
- alignSelf(value: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch'): this;
88
- // ✅ NEW flex container properties
89
- flexDirection(value: 'row' | 'column' | 'row-reverse' | 'column-reverse'): this;
90
- flexWrap(value: 'nowrap' | 'wrap' | 'wrap-reverse'): this;
91
- alignItems(value: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch'): this;
92
- justifyContent(value: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly'): this;
93
- gap(value: string): this;
94
- rowGap(value: string): this;
95
- columnGap(value: string): this;
96
-
97
- // Transform (inline styles)
98
- transform(value: string): this;
99
- transformOrigin(value: string): this;
100
- rotate(degrees: number): this;
101
- rotateX(degrees: number): this; // ✅ NEW
102
- rotateY(degrees: number): this; // ✅ NEW
103
- rotateZ(degrees: number): this; // ✅ NEW
104
- scale(value: number): this;
105
- scaleX(value: number): this; // ✅ NEW
106
- scaleY(value: number): this; // ✅ NEW
107
- translateX(value: string): this;
108
- translateY(value: string): this;
109
- translate(x: string, y: string): this;
110
- flipX(): this; // ✅ NEW - Flip horizontally (scaleX(-1))
111
- flipY(): this; // ✅ NEW - Flip vertically (scaleY(-1))
112
- flipBoth(): this; // ✅ NEW - Flip both axes
113
-
114
- // Transition & Animation (inline styles)
115
- transition(value: string): this;
116
- transitionDuration(value: string): this;
117
- transitionDelay(value: string): this;
118
- animation(value: string): this;
119
-
120
- // Cursor & Interaction (CSS classes)
121
- cursor(value: string): this;
122
- pointerEvents(value: 'auto' | 'none'): this;
123
- userSelect(value: 'auto' | 'none' | 'text' | 'all'): this;
124
-
125
- // Text (inline styles for values, classes for alignment/transform)
126
- color(value: string): this;
127
- fontSize(value: string): this;
128
- fontWeight(value: string | number): this;
129
- fontFamily(value: string): this;
130
- textAlign(value: 'left' | 'center' | 'right' | 'justify'): this;
131
- lineHeight(value: string | number): this;
132
- letterSpacing(value: string): this;
133
- textDecoration(value: string): this;
134
- textTransform(value: 'none' | 'capitalize' | 'uppercase' | 'lowercase'): this;
135
- whiteSpace(value: 'normal' | 'nowrap' | 'pre' | 'pre-wrap' | 'pre-line'): this;
136
- wordWrap(value: 'normal' | 'break-word'): this;
137
- }
138
-
139
- /**
140
- * Helper to add inline style
141
- */
142
- function addInlineStyle(component: BaseComponent<any>, property: string, value: string): void {
143
- const currentStyle = component.state.style || '';
144
-
145
- // Parse existing styles into a map
146
- const styleMap = new Map<string, string>();
147
-
148
- currentStyle.split(';').forEach((style: string) => {
149
- const trimmed = style.trim();
150
- if (!trimmed) return;
151
-
152
- const colonIndex = trimmed.indexOf(':');
153
- if (colonIndex === -1) return;
154
-
155
- const prop = trimmed.substring(0, colonIndex).trim();
156
- const val = trimmed.substring(colonIndex + 1).trim();
157
-
158
- if (prop && val) {
159
- styleMap.set(prop, val);
160
- }
161
- });
162
-
163
- // Update or add the new property
164
- styleMap.set(property, value);
165
-
166
- // Rebuild style string
167
- const styles: string[] = [];
168
- styleMap.forEach((val, prop) => {
169
- styles.push(`${prop}: ${val}`);
170
- });
171
-
172
- component.state.style = styles.join('; ');
173
- }
174
-
175
- /**
176
- * Apply layout extensions to a component instance
177
- * Called automatically in BaseComponent constructor
178
- */
179
- export function applyLayoutExtensions<T extends BaseComponent<any>>(component: T): T & LayoutExtensions {
180
- const ext = component as T & LayoutExtensions;
181
-
182
- // Spacing (inline styles)
183
- ext.padding = (v) => { addInlineStyle(component, 'padding', v); return ext; };
184
- ext.paddingTop = (v) => { addInlineStyle(component, 'padding-top', v); return ext; };
185
- ext.paddingRight = (v) => { addInlineStyle(component, 'padding-right', v); return ext; };
186
- ext.paddingBottom = (v) => { addInlineStyle(component, 'padding-bottom', v); return ext; };
187
- ext.paddingLeft = (v) => { addInlineStyle(component, 'padding-left', v); return ext; };
188
- ext.paddingHorizontal = (v) => {
189
- addInlineStyle(component, 'padding-left', v);
190
- addInlineStyle(component, 'padding-right', v);
191
- return ext;
192
- };
193
- ext.paddingVertical = (v) => {
194
- addInlineStyle(component, 'padding-top', v);
195
- addInlineStyle(component, 'padding-bottom', v);
196
- return ext;
197
- };
198
-
199
- ext.margin = (v) => { addInlineStyle(component, 'margin', v); return ext; };
200
- ext.marginTop = (v) => { addInlineStyle(component, 'margin-top', v); return ext; };
201
- ext.marginRight = (v) => { addInlineStyle(component, 'margin-right', v); return ext; };
202
- ext.marginBottom = (v) => { addInlineStyle(component, 'margin-bottom', v); return ext; };
203
- ext.marginLeft = (v) => { addInlineStyle(component, 'margin-left', v); return ext; };
204
- ext.marginHorizontal = (v) => {
205
- addInlineStyle(component, 'margin-left', v);
206
- addInlineStyle(component, 'margin-right', v);
207
- return ext;
208
- };
209
- ext.marginVertical = (v) => {
210
- addInlineStyle(component, 'margin-top', v);
211
- addInlineStyle(component, 'margin-bottom', v);
212
- return ext;
213
- };
214
-
215
- // Sizing (inline styles)
216
- ext.width = (v) => { addInlineStyle(component, 'width', v); return ext; };
217
- ext.height = (v) => { addInlineStyle(component, 'height', v); return ext; };
218
- ext.minWidth = (v) => { addInlineStyle(component, 'min-width', v); return ext; };
219
- ext.maxWidth = (v) => { addInlineStyle(component, 'max-width', v); return ext; };
220
- ext.minHeight = (v) => { addInlineStyle(component, 'min-height', v); return ext; };
221
- ext.maxHeight = (v) => { addInlineStyle(component, 'max-height', v); return ext; };
222
-
223
- // Borders
224
- ext.border = (v) => { addInlineStyle(component, 'border', v); return ext; };
225
- ext.borderTop = (v) => { addInlineStyle(component, 'border-top', v); return ext; };
226
- ext.borderRight = (v) => { addInlineStyle(component, 'border-right', v); return ext; };
227
- ext.borderBottom = (v) => { addInlineStyle(component, 'border-bottom', v); return ext; };
228
- ext.borderLeft = (v) => { addInlineStyle(component, 'border-left', v); return ext; };
229
- ext.borderRadius = (v) => { addInlineStyle(component, 'border-radius', v); return ext; }; // ✅ HERE
230
- ext.borderWidth = (v) => { addInlineStyle(component, 'border-width', v); return ext; };
231
- ext.borderColor = (v) => { addInlineStyle(component, 'border-color', v); return ext; };
232
- ext.borderStyle = (v) => { component.addClass(`jux-border-${v}`); return ext; }; // ✅ CSS class
233
-
234
- // Background
235
- ext.background = (v) => { addInlineStyle(component, 'background', v); return ext; };
236
- ext.backgroundColor = (v) => { addInlineStyle(component, 'background-color', v); return ext; };
237
- ext.backgroundImage = (v) => { addInlineStyle(component, 'background-image', v); return ext; };
238
- ext.backgroundSize = (v) => { addInlineStyle(component, 'background-size', v); return ext; };
239
- ext.backgroundPosition = (v) => { addInlineStyle(component, 'background-position', v); return ext; };
240
- ext.backgroundRepeat = (v) => { addInlineStyle(component, 'background-repeat', v); return ext; };
241
-
242
- // Gradient helpers
243
- ext.linearGradient = (direction, ...colorStops) => {
244
- const value = `linear-gradient(${direction}, ${colorStops.join(', ')})`;
245
- addInlineStyle(component, 'background-image', value);
246
- return ext;
247
- };
248
- ext.radialGradient = (shape, ...colorStops) => {
249
- const value = `radial-gradient(${shape}, ${colorStops.join(', ')})`;
250
- addInlineStyle(component, 'background-image', value);
251
- return ext;
252
- };
253
- ext.conicGradient = (from, ...colorStops) => {
254
- const value = `conic-gradient(from ${from}, ${colorStops.join(', ')})`;
255
- addInlineStyle(component, 'background-image', value);
256
- return ext;
257
- };
258
-
259
- // Effects
260
- ext.boxShadow = (v) => { addInlineStyle(component, 'box-shadow', v); return ext; };
261
- ext.opacity = (v) => { addInlineStyle(component, 'opacity', String(v)); return ext; };
262
-
263
- // Positioning
264
- ext.position = (v) => { component.addClass(`jux-position-${v}`); return ext; }; // ✅ CSS class
265
- ext.top = (v) => { addInlineStyle(component, 'top', v); return ext; };
266
- ext.right = (v) => { addInlineStyle(component, 'right', v); return ext; };
267
- ext.bottom = (v) => { addInlineStyle(component, 'bottom', v); return ext; };
268
- ext.left = (v) => { addInlineStyle(component, 'left', v); return ext; };
269
- ext.zIndex = (v) => { addInlineStyle(component, 'z-index', String(v)); return ext; };
270
-
271
- // Overflow
272
- ext.overflow = (v) => { component.addClass(`jux-overflow-${v}`); return ext; }; // ✅ CSS class
273
- ext.overflowX = (v) => { component.addClass(`jux-overflow-x-${v}`); return ext; }; // ✅ CSS class
274
- ext.overflowY = (v) => { component.addClass(`jux-overflow-y-${v}`); return ext; }; // ✅ CSS class
275
-
276
- // Display
277
- ext.display = (v) => { component.addClass(`jux-display-${v}`); return ext; }; // ✅ CSS class
278
-
279
- // Flex
280
- ext.flex = (v) => { addInlineStyle(component, 'flex', String(v)); return ext; };
281
- ext.flexGrow = (v) => { addInlineStyle(component, 'flex-grow', String(v)); return ext; };
282
- ext.flexShrink = (v) => { addInlineStyle(component, 'flex-shrink', String(v)); return ext; };
283
- ext.flexBasis = (v) => { addInlineStyle(component, 'flex-basis', v); return ext; };
284
- ext.alignSelf = (v) => { addInlineStyle(component, 'align-self', v); return ext; };
285
-
286
- // ✅ NEW flex container properties
287
- ext.flexDirection = (v) => { addInlineStyle(component, 'flex-direction', v); return ext; };
288
- ext.flexWrap = (v) => { addInlineStyle(component, 'flex-wrap', v); return ext; };
289
- ext.alignItems = (v) => { addInlineStyle(component, 'align-items', v); return ext; };
290
- ext.justifyContent = (v) => { addInlineStyle(component, 'justify-content', v); return ext; };
291
- ext.gap = (v) => { addInlineStyle(component, 'gap', v); return ext; };
292
- ext.rowGap = (v) => { addInlineStyle(component, 'row-gap', v); return ext; };
293
- ext.columnGap = (v) => { addInlineStyle(component, 'column-gap', v); return ext; };
294
-
295
- // Transform
296
- ext.transform = (v) => { addInlineStyle(component, 'transform', v); return ext; };
297
- ext.transformOrigin = (v) => { addInlineStyle(component, 'transform-origin', v); return ext; };
298
-
299
- // ✅ Rotation (all axes)
300
- ext.rotate = (deg) => { addInlineStyle(component, 'transform', `rotate(${deg}deg)`); return ext; };
301
- ext.rotateX = (deg) => { addInlineStyle(component, 'transform', `rotateX(${deg}deg)`); return ext; };
302
- ext.rotateY = (deg) => { addInlineStyle(component, 'transform', `rotateY(${deg}deg)`); return ext; };
303
- ext.rotateZ = (deg) => { addInlineStyle(component, 'transform', `rotateZ(${deg}deg)`); return ext; };
304
-
305
- // ✅ Scale (all axes)
306
- ext.scale = (v) => { addInlineStyle(component, 'transform', `scale(${v})`); return ext; };
307
- ext.scaleX = (v) => { addInlineStyle(component, 'transform', `scaleX(${v})`); return ext; };
308
- ext.scaleY = (v) => { addInlineStyle(component, 'transform', `scaleY(${v})`); return ext; };
309
-
310
- // ✅ Translate
311
- ext.translateX = (v) => { addInlineStyle(component, 'transform', `translateX(${v})`); return ext; };
312
- ext.translateY = (v) => { addInlineStyle(component, 'transform', `translateY(${v})`); return ext; };
313
- ext.translate = (x, y) => { addInlineStyle(component, 'transform', `translate(${x}, ${y})`); return ext; };
314
-
315
- // ✅ Flip (mirror) transforms
316
- ext.flipX = () => { addInlineStyle(component, 'transform', 'scaleX(-1)'); return ext; };
317
- ext.flipY = () => { addInlineStyle(component, 'transform', 'scaleY(-1)'); return ext; };
318
- ext.flipBoth = () => { addInlineStyle(component, 'transform', 'scale(-1, -1)'); return ext; };
319
-
320
- // Transition & Animation
321
- ext.transition = (v) => { addInlineStyle(component, 'transition', v); return ext; };
322
- ext.transitionDuration = (v) => { addInlineStyle(component, 'transition-duration', v); return ext; };
323
- ext.transitionDelay = (v) => { addInlineStyle(component, 'transition-delay', v); return ext; };
324
- ext.animation = (v) => { addInlineStyle(component, 'animation', v); return ext; };
325
-
326
- // Cursor & Interaction
327
- ext.cursor = (v) => { component.addClass(`jux-cursor-${v}`); return ext; }; // ✅ CSS class
328
- ext.pointerEvents = (v) => { component.addClass(`jux-pointer-events-${v}`); return ext; }; // ✅ CSS class
329
- ext.userSelect = (v) => { component.addClass(`jux-select-${v}`); return ext; }; // ✅ CSS class
330
-
331
- // Text
332
- ext.color = (v) => { addInlineStyle(component, 'color', v); return ext; };
333
- ext.fontSize = (v) => { addInlineStyle(component, 'font-size', v); return ext; };
334
- ext.fontWeight = (v) => { addInlineStyle(component, 'font-weight', String(v)); return ext; };
335
- ext.fontFamily = (v) => { addInlineStyle(component, 'font-family', v); return ext; };
336
- ext.textAlign = (v) => { component.addClass(`jux-text-${v}`); return ext; }; // ✅ CSS class
337
- ext.lineHeight = (v) => { addInlineStyle(component, 'line-height', String(v)); return ext; };
338
- ext.letterSpacing = (v) => { addInlineStyle(component, 'letter-spacing', v); return ext; };
339
- ext.textDecoration = (v) => { addInlineStyle(component, 'text-decoration', v); return ext; };
340
- ext.textTransform = (v) => { component.addClass(`jux-text-${v}`); return ext; }; // ✅ CSS class
341
- ext.whiteSpace = (v) => { component.addClass(`jux-whitespace-${v}`); return ext; }; // ✅ CSS class
342
- ext.wordWrap = (v) => { component.addClass(`jux-word-wrap-${v === 'break-word' ? 'break' : 'normal'}`); return ext; }; // ✅ CSS class
343
-
344
- return ext;
345
- }