juxscript 1.0.35 → 1.0.37
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/lib/components/container.ts +36 -2
- package/package.json +1 -1
- package/presets/default/layout.css +146 -0
|
@@ -4,6 +4,20 @@ import { BaseComponent } from './base/BaseComponent.js';
|
|
|
4
4
|
const TRIGGER_EVENTS = [] as const;
|
|
5
5
|
const CALLBACK_EVENTS = [] as const;
|
|
6
6
|
|
|
7
|
+
// Deprecation warning constant
|
|
8
|
+
const DEPRECATION_WARNING = (feature: string) =>
|
|
9
|
+
`[JUX Deprecation Warning] Container.${feature} will be removed in v1.0.30+ (January 30, 2026). Please use CSS or the .style() method instead. See: https://juxscript.com/docs/migration`;
|
|
10
|
+
|
|
11
|
+
// Track which warnings we've already shown (to avoid spam)
|
|
12
|
+
const _shownWarnings = new Set<string>();
|
|
13
|
+
|
|
14
|
+
function warnOnce(feature: string): void {
|
|
15
|
+
if (!_shownWarnings.has(feature)) {
|
|
16
|
+
console.warn(DEPRECATION_WARNING(feature));
|
|
17
|
+
_shownWarnings.add(feature);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
export interface ContainerOptions {
|
|
8
22
|
direction?: 'row' | 'column'; // should deprecate.
|
|
9
23
|
gap?: number | string; // should deprecate.
|
|
@@ -28,6 +42,14 @@ type ContainerState = {
|
|
|
28
42
|
|
|
29
43
|
export class Container extends BaseComponent<ContainerState> {
|
|
30
44
|
constructor(id: string, options: ContainerOptions = {}) {
|
|
45
|
+
// Warn for deprecated options
|
|
46
|
+
if (options.direction !== undefined) warnOnce('direction (option)');
|
|
47
|
+
if (options.gap !== undefined) warnOnce('gap (option)');
|
|
48
|
+
if (options.wrap !== undefined) warnOnce('wrap (option)');
|
|
49
|
+
if (options.align !== undefined) warnOnce('align (option)');
|
|
50
|
+
if (options.justify !== undefined) warnOnce('justify (option)');
|
|
51
|
+
if (options.padding !== undefined) warnOnce('padding (option)');
|
|
52
|
+
|
|
31
53
|
super(id, {
|
|
32
54
|
direction: options.direction ?? 'column',// should deprecate.
|
|
33
55
|
gap: options.gap ?? 0, //should deprecate.
|
|
@@ -61,31 +83,37 @@ export class Container extends BaseComponent<ContainerState> {
|
|
|
61
83
|
// - bind(), sync(), renderTo()
|
|
62
84
|
|
|
63
85
|
direction(value: 'row' | 'column'): this {
|
|
86
|
+
warnOnce('direction()');
|
|
64
87
|
this.state.direction = value;
|
|
65
88
|
return this;
|
|
66
89
|
}
|
|
67
90
|
|
|
68
91
|
gap(value: number | string): this {
|
|
92
|
+
warnOnce('gap()');
|
|
69
93
|
this.state.gap = value;
|
|
70
94
|
return this;
|
|
71
95
|
}
|
|
72
96
|
|
|
73
97
|
wrap(value: boolean): this {
|
|
98
|
+
warnOnce('wrap()');
|
|
74
99
|
this.state.wrap = value;
|
|
75
100
|
return this;
|
|
76
101
|
}
|
|
77
102
|
|
|
78
103
|
align(value: 'start' | 'center' | 'end' | 'stretch'): this {
|
|
104
|
+
warnOnce('align()');
|
|
79
105
|
this.state.align = value;
|
|
80
106
|
return this;
|
|
81
107
|
}
|
|
82
108
|
|
|
83
109
|
justify(value: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly'): this {
|
|
110
|
+
warnOnce('justify()');
|
|
84
111
|
this.state.justify = value;
|
|
85
112
|
return this;
|
|
86
113
|
}
|
|
87
114
|
|
|
88
115
|
padding(value: string): this {
|
|
116
|
+
warnOnce('padding()');
|
|
89
117
|
this.state.padding = value;
|
|
90
118
|
return this;
|
|
91
119
|
}
|
|
@@ -112,28 +140,34 @@ export class Container extends BaseComponent<ContainerState> {
|
|
|
112
140
|
|
|
113
141
|
stateObj.subscribe((val: any) => {
|
|
114
142
|
const transformed = transform(val);
|
|
115
|
-
|
|
143
|
+
|
|
116
144
|
if (property === 'direction') {
|
|
145
|
+
warnOnce('direction (sync)');
|
|
117
146
|
this.state.direction = String(transformed);
|
|
118
147
|
wrapper.style.flexDirection = this.state.direction;
|
|
119
148
|
} else if (property === 'gap') {
|
|
149
|
+
warnOnce('gap (sync)');
|
|
120
150
|
this.state.gap = transformed;
|
|
121
151
|
const gapVal = typeof transformed === 'number' ? `${transformed}px` : transformed;
|
|
122
152
|
wrapper.style.gap = gapVal;
|
|
123
153
|
} else if (property === 'wrap') {
|
|
154
|
+
warnOnce('wrap (sync)');
|
|
124
155
|
this.state.wrap = Boolean(transformed);
|
|
125
156
|
wrapper.style.flexWrap = this.state.wrap ? 'wrap' : 'nowrap';
|
|
126
157
|
} else if (property === 'align') {
|
|
158
|
+
warnOnce('align (sync)');
|
|
127
159
|
this.state.align = String(transformed);
|
|
128
160
|
wrapper.style.alignItems = this.state.align;
|
|
129
161
|
} else if (property === 'justify') {
|
|
162
|
+
warnOnce('justify (sync)');
|
|
130
163
|
this.state.justify = String(transformed);
|
|
131
164
|
wrapper.style.justifyContent = this.state.justify;
|
|
132
165
|
} else if (property === 'padding') {
|
|
166
|
+
warnOnce('padding (sync)');
|
|
133
167
|
this.state.padding = String(transformed);
|
|
134
168
|
wrapper.style.padding = this.state.padding;
|
|
135
169
|
}
|
|
136
|
-
|
|
170
|
+
|
|
137
171
|
});
|
|
138
172
|
|
|
139
173
|
});
|
package/package.json
CHANGED
|
@@ -257,4 +257,150 @@ body {
|
|
|
257
257
|
#appfooter {
|
|
258
258
|
padding: var(--space-md) var(--space-lg);
|
|
259
259
|
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* ============================================
|
|
263
|
+
COMPONENT STYLES
|
|
264
|
+
============================================ */
|
|
265
|
+
|
|
266
|
+
/* Buttons */
|
|
267
|
+
.jux-button {
|
|
268
|
+
display: inline-flex;
|
|
269
|
+
align-items: center;
|
|
270
|
+
justify-content: center;
|
|
271
|
+
padding: 0 var(--space-lg);
|
|
272
|
+
height: 36px;
|
|
273
|
+
font-size: 0.875rem;
|
|
274
|
+
font-weight: 500;
|
|
275
|
+
font-family: var(--font-family-base);
|
|
276
|
+
color: #ffffff;
|
|
277
|
+
background: #0ea5e9;
|
|
278
|
+
border: none;
|
|
279
|
+
border-radius: var(--radius-md);
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
transition: background-color var(--transition-base), transform 100ms ease;
|
|
282
|
+
user-select: none;
|
|
283
|
+
white-space: nowrap;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.jux-button:hover {
|
|
287
|
+
background: #0284c7;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.jux-button:active {
|
|
291
|
+
transform: scale(0.98);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.jux-button:focus {
|
|
295
|
+
outline: 2px solid #0ea5e9;
|
|
296
|
+
outline-offset: 2px;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.jux-button:disabled {
|
|
300
|
+
opacity: 0.5;
|
|
301
|
+
cursor: not-allowed;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/* Button variants */
|
|
305
|
+
.jux-button-secondary {
|
|
306
|
+
background: var(--color-surface-hover);
|
|
307
|
+
color: var(--color-text-primary);
|
|
308
|
+
border: var(--border-width) solid var(--color-border);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.jux-button-secondary:hover {
|
|
312
|
+
background: var(--color-surface-active);
|
|
313
|
+
border-color: var(--color-border-hover);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.jux-button-ghost {
|
|
317
|
+
background: transparent;
|
|
318
|
+
color: var(--color-text-secondary);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.jux-button-ghost:hover {
|
|
322
|
+
background: var(--color-surface-hover);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/* Button sizes */
|
|
326
|
+
.jux-button-small {
|
|
327
|
+
height: 28px;
|
|
328
|
+
padding: 0 var(--space-md);
|
|
329
|
+
font-size: 0.8125rem;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.jux-button-large {
|
|
333
|
+
height: 44px;
|
|
334
|
+
padding: 0 var(--space-2xl);
|
|
335
|
+
font-size: 1rem;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/* Code blocks */
|
|
339
|
+
.jux-code {
|
|
340
|
+
background: var(--color-surface-base);
|
|
341
|
+
border: var(--border-width) solid var(--color-border);
|
|
342
|
+
border-radius: var(--radius-lg);
|
|
343
|
+
padding: var(--space-lg);
|
|
344
|
+
font-family: var(--font-family-mono);
|
|
345
|
+
font-size: 0.8125rem;
|
|
346
|
+
line-height: 1.6;
|
|
347
|
+
overflow-x: auto;
|
|
348
|
+
margin: var(--space-xl) 0;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/* Hero */
|
|
352
|
+
.jux-hero {
|
|
353
|
+
margin-bottom: var(--space-3xl);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.jux-hero h1 {
|
|
357
|
+
font-size: 2.5rem;
|
|
358
|
+
font-weight: 700;
|
|
359
|
+
line-height: 1.2;
|
|
360
|
+
margin-bottom: var(--space-md);
|
|
361
|
+
letter-spacing: -0.02em;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.jux-hero p {
|
|
365
|
+
font-size: 1.125rem;
|
|
366
|
+
color: var(--color-text-secondary);
|
|
367
|
+
line-height: 1.6;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/* Dividers */
|
|
371
|
+
.jux-divider {
|
|
372
|
+
height: 1px;
|
|
373
|
+
background: var(--color-border);
|
|
374
|
+
border: none;
|
|
375
|
+
margin: var(--space-2xl) 0;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/* Headings */
|
|
379
|
+
h1, h2, h3, h4, h5, h6 {
|
|
380
|
+
font-weight: 600;
|
|
381
|
+
line-height: 1.3;
|
|
382
|
+
color: var(--color-text-primary);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
h1 { font-size: 2rem; margin: var(--space-2xl) 0 var(--space-lg) 0; }
|
|
386
|
+
h2 { font-size: 1.5rem; margin: var(--space-2xl) 0 var(--space-md) 0; }
|
|
387
|
+
h3 { font-size: 1.25rem; margin: var(--space-xl) 0 var(--space-md) 0; }
|
|
388
|
+
|
|
389
|
+
/* Paragraphs */
|
|
390
|
+
p {
|
|
391
|
+
line-height: 1.6;
|
|
392
|
+
color: var(--color-text-secondary);
|
|
393
|
+
margin-bottom: var(--space-lg);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/* Lists */
|
|
397
|
+
ul, ol {
|
|
398
|
+
padding-left: var(--space-2xl);
|
|
399
|
+
margin-bottom: var(--space-xl);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
li {
|
|
403
|
+
line-height: 1.6;
|
|
404
|
+
color: var(--color-text-secondary);
|
|
405
|
+
margin-bottom: var(--space-sm);
|
|
260
406
|
}
|