vanilla-jui 1.5.14 → 1.5.16

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.
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  createDeepStore,
3
3
  createEffect,
4
+ createSignal,
4
5
  flushSync,
5
6
  insert,
6
7
  jsx,
@@ -79,11 +80,14 @@ interface ResolvedOffcanvasProps extends Record<string, unknown> {
79
80
 
80
81
  interface OffcanvasState extends Record<string, unknown> {
81
82
  content: OffcanvasContent;
82
- resolvedContent: RenderableContent<Offcanvas>;
83
83
  visible: boolean;
84
84
  loading: boolean;
85
85
  }
86
86
 
87
+ interface ResolvedOffcanvasContent {
88
+ value: RenderableContent<Offcanvas>;
89
+ }
90
+
87
91
  interface OffcanvasCache {
88
92
  content: RenderableContent<Offcanvas>;
89
93
  hasContent: boolean;
@@ -157,7 +161,6 @@ const OFFCANVAS_PROPS_SCHEMA = {
157
161
 
158
162
  const OFFCANVAS_STATE_SCHEMA = {
159
163
  content: OFFCANVAS_PROPS_SCHEMA.content,
160
- resolvedContent: { type: 'renderable' },
161
164
  visible: { type: 'boolean' },
162
165
  loading: { type: 'boolean' },
163
166
  };
@@ -225,10 +228,13 @@ export function createOffcanvas(input: OffcanvasProps = {}): Offcanvas {
225
228
  const props = normalizeProps(input);
226
229
  const state = createDeepStore({
227
230
  content: props.content,
228
- resolvedContent: typeof props.content === 'function' ? null : props.content,
229
231
  visible: false,
230
232
  loading: false,
231
233
  }) as OffcanvasState;
234
+ const [resolvedContent, setResolvedContent] =
235
+ createSignal<ResolvedOffcanvasContent>({
236
+ value: typeof props.content === 'function' ? null : props.content,
237
+ });
232
238
  const runtime: OffcanvasRuntimeExtras = {
233
239
  cache: { content: null, hasContent: false, updatedAt: 0 },
234
240
  contentLoadId: 0,
@@ -303,13 +309,17 @@ export function createOffcanvas(input: OffcanvasProps = {}): Offcanvas {
303
309
  const ttl = normalizeTtl(props.ttl);
304
310
  return !ttl || Date.now() - runtime.cache.updatedAt <= ttl;
305
311
  };
312
+ const renderResolvedContent = (): RenderableContent<Offcanvas> => {
313
+ const content = resolvedContent().value;
314
+ return typeof content === 'function' ? content(offcanvas) : content;
315
+ };
306
316
 
307
317
  const loadContent = async (): Promise<void> => {
308
318
  const content = state.content;
309
319
  if (typeof content !== 'function') {
310
320
  runtime.contentLoadId += 1;
311
321
  flushSync(() => {
312
- state.resolvedContent = content;
322
+ setResolvedContent({ value: content });
313
323
  state.loading = false;
314
324
  });
315
325
  return;
@@ -317,7 +327,7 @@ export function createOffcanvas(input: OffcanvasProps = {}): Offcanvas {
317
327
  if (isCacheValid()) {
318
328
  runtime.contentLoadId += 1;
319
329
  flushSync(() => {
320
- state.resolvedContent = runtime.cache.content;
330
+ setResolvedContent({ value: runtime.cache.content });
321
331
  state.loading = false;
322
332
  });
323
333
  return;
@@ -326,7 +336,7 @@ export function createOffcanvas(input: OffcanvasProps = {}): Offcanvas {
326
336
  const loadId = ++runtime.contentLoadId;
327
337
  flushSync(() => {
328
338
  state.loading = true;
329
- state.resolvedContent = null;
339
+ setResolvedContent({ value: null });
330
340
  });
331
341
  try {
332
342
  const result = await Promise.resolve(content(offcanvas));
@@ -340,7 +350,7 @@ export function createOffcanvas(input: OffcanvasProps = {}): Offcanvas {
340
350
  };
341
351
  }
342
352
  flushSync(() => {
343
- state.resolvedContent = result;
353
+ setResolvedContent({ value: result });
344
354
  });
345
355
  } finally {
346
356
  if (!offcanvas.runtime.destroyed && loadId === runtime.contentLoadId) {
@@ -415,11 +425,11 @@ export function createOffcanvas(input: OffcanvasProps = {}): Offcanvas {
415
425
  );
416
426
  clearCache();
417
427
  if (typeof content === 'function') {
418
- state.resolvedContent = null;
428
+ setResolvedContent({ value: null });
419
429
  if (untrack(() => state.visible)) void loadContent();
420
430
  } else {
421
431
  runtime.contentLoadId += 1;
422
- state.resolvedContent = content;
432
+ setResolvedContent({ value: content });
423
433
  state.loading = false;
424
434
  }
425
435
  });
@@ -449,11 +459,7 @@ export function createOffcanvas(input: OffcanvasProps = {}): Offcanvas {
449
459
  'data-offcanvas-content': props.id,
450
460
  children: () =>
451
461
  asRenderable(
452
- state.loading
453
- ? createLoading()
454
- : typeof state.resolvedContent === 'function'
455
- ? state.resolvedContent(offcanvas)
456
- : state.resolvedContent
462
+ state.loading ? createLoading() : renderResolvedContent()
457
463
  ),
458
464
  }),
459
465
  }) as HTMLElement;
package/src/css/form.css CHANGED
@@ -15,6 +15,11 @@
15
15
  gap: var(--form-gap-horizontal, var(--s2));
16
16
  }
17
17
 
18
+ .j-form.is-lg {
19
+ --form-gap-vertical: var(--s3);
20
+ --form-gap-horizontal: var(--s3);
21
+ }
22
+
18
23
  .j-form .form-field {
19
24
  gap: var(--form-label-gap, var(--space));
20
25
  margin: 0;
@@ -15,11 +15,11 @@
15
15
  --z-badge: 2;
16
16
  --z-toolbar: 2;
17
17
  --z-submenu: 5;
18
- --z-overlay: 9500;
19
- --z-offcanvas: 9600;
20
- --z-popup: 9700;
21
- --z-toast: 9800;
22
- --z-drop: 9900;
18
+ --z-popup: 9000;
19
+ --z-overlay: 9000;
20
+ --z-offcanvas: 9200;
21
+ --z-toast: 9600;
22
+ --z-drop: 9800;
23
23
 
24
24
  /* --- Spacing --- */
25
25
  --space: 0.25rem;
@@ -126,8 +126,8 @@
126
126
  --ui-placeholder: #9ca3af;
127
127
  --ui-disabled-bg: rgba(0, 0, 0, 0.04);
128
128
  --ui-disabled-fg: #9ca3af;
129
- --ui-overlay: rgba(0, 0, 0, 0.5);
130
- --ui-overlay-muted: rgba(0, 0, 0, 0.25);
129
+ --ui-overlay: rgba(0, 0, 0, 0.25);
130
+ --ui-overlay-muted: rgba(0, 0, 0, 0.0625);
131
131
  --ui-popup-bg: rgba(0, 0, 0, 0.0625);
132
132
  --ui-input-color: #111827;
133
133
  --ui-input-border: rgba(0, 0, 0, 0.15);