@brickflow/ui 0.0.32 → 0.0.34
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/dist/module.json +1 -1
- package/dist/module.mjs +291 -28
- package/dist/runtime/components/Button/index.d.vue.ts +31 -25
- package/dist/runtime/components/Button/index.vue +10 -62
- package/dist/runtime/components/Button/index.vue.d.ts +31 -25
- package/dist/runtime/components/Button/variants.demo.vue +26 -182
- package/dist/runtime/components/Icon/basic.demo.vue +3 -3
- package/dist/runtime/components/Link/basic.demo.vue +2 -2
- package/dist/runtime/composables/useScreen.d.ts +10 -12
- package/dist/runtime/composables/useScreen.js +26 -32
- package/dist/runtime/config.d.ts +24 -1
- package/dist/runtime/pages/ui.vue +77 -68
- package/dist/runtime/tailwind.d.ts +33 -5
- package/dist/runtime/tailwind.js +46 -0
- package/dist/runtime/ui.css +1 -0
- package/package.json +5 -1
- package/dist/runtime/assets/css/main.css +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useHead, useRoute, useRouter } from "nuxt/app";
|
|
3
|
-
import { computed, nextTick, ref, watch } from "vue";
|
|
3
|
+
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
|
4
4
|
import { uiComponents } from "#brickflow-ui-catalog";
|
|
5
5
|
import { uiThemeEnabled } from "#brickflow-ui-options";
|
|
6
6
|
import { useTheme } from "../composables/useTheme";
|
|
@@ -18,6 +18,7 @@ const router = useRouter();
|
|
|
18
18
|
const expandedDemoCode = ref(/* @__PURE__ */ new Set());
|
|
19
19
|
const isNavigationOpen = ref(false);
|
|
20
20
|
const mobileNavigation = ref();
|
|
21
|
+
const colorSwatchesReady = ref(false);
|
|
21
22
|
const stylesExpanded = ref(false);
|
|
22
23
|
const theme = uiThemeEnabled ? useTheme() : void 0;
|
|
23
24
|
const isDark = computed(() => theme?.isDark.value ?? false);
|
|
@@ -231,17 +232,20 @@ const highlightTailwindValue = (value) => {
|
|
|
231
232
|
return html + token("ui-code-string", escapeHtml(value.slice(lastIndex)));
|
|
232
233
|
};
|
|
233
234
|
const getTailwindColorSwatch = (utility) => {
|
|
234
|
-
const
|
|
235
|
-
|
|
235
|
+
const match = utility.match(
|
|
236
|
+
/^(?:accent|bg|border|caret|decoration|divide|fill|from|outline|ring|shadow|stroke|text|to|via)-([a-z][a-z0-9-]*)(?:\/(\d{1,3}))?$/
|
|
236
237
|
);
|
|
237
|
-
|
|
238
|
-
const match = themeColor ?? neutralColor;
|
|
239
|
-
if (!match) {
|
|
238
|
+
if (!colorSwatchesReady.value || !match || typeof window === "undefined") {
|
|
240
239
|
return "";
|
|
241
240
|
}
|
|
242
|
-
const [, name,
|
|
243
|
-
const
|
|
244
|
-
const
|
|
241
|
+
const [, name, opacity] = match;
|
|
242
|
+
const colorVariable = `--color-${name}`;
|
|
243
|
+
const color = getComputedStyle(document.body).getPropertyValue(colorVariable).trim();
|
|
244
|
+
if (!color || !CSS.supports("color", color)) {
|
|
245
|
+
return "";
|
|
246
|
+
}
|
|
247
|
+
const opacityValue = opacity && Number(opacity) <= 100 ? Number(opacity) : void 0;
|
|
248
|
+
const background = opacityValue ? `color-mix(in srgb, var(${colorVariable}) ${opacityValue}%, transparent)` : `var(${colorVariable})`;
|
|
245
249
|
return `<span aria-hidden="true" class="ui-color-swatch" style="--ui-color-swatch: ${background}"></span>`;
|
|
246
250
|
};
|
|
247
251
|
const highlightTailwindUtility = (utility) => {
|
|
@@ -302,6 +306,9 @@ const toggleDemoCode = (demoId) => {
|
|
|
302
306
|
const closeNavigation = () => {
|
|
303
307
|
isNavigationOpen.value = false;
|
|
304
308
|
};
|
|
309
|
+
onMounted(() => {
|
|
310
|
+
colorSwatchesReady.value = true;
|
|
311
|
+
});
|
|
305
312
|
watch(isNavigationOpen, async (isOpen) => {
|
|
306
313
|
if (isOpen) {
|
|
307
314
|
await nextTick();
|
|
@@ -339,17 +346,17 @@ watch(
|
|
|
339
346
|
</script>
|
|
340
347
|
|
|
341
348
|
<template>
|
|
342
|
-
<main class="min-h-screen">
|
|
349
|
+
<main class="min-h-screen bg-zinc-950 text-zinc-100">
|
|
343
350
|
<header
|
|
344
|
-
class="sticky top-0 z-30 flex items-center justify-between gap-4 border-b border-
|
|
351
|
+
class="sticky top-0 z-30 flex items-center justify-between gap-4 border-b border-zinc-800 bg-zinc-950/95 px-4 py-3 backdrop-blur dk:hidden"
|
|
345
352
|
>
|
|
346
353
|
<div class="min-w-0">
|
|
347
|
-
<p class="text-xs font-medium tracking-widest text-
|
|
348
|
-
<p class="truncate text-sm font-medium text-
|
|
354
|
+
<p class="text-xs font-medium tracking-widest text-zinc-500 uppercase">Components</p>
|
|
355
|
+
<p class="truncate text-sm font-medium text-zinc-100">{{ activeComponent?.name }}</p>
|
|
349
356
|
</div>
|
|
350
357
|
<button
|
|
351
358
|
type="button"
|
|
352
|
-
class="flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-
|
|
359
|
+
class="flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-zinc-700 text-zinc-200 transition hover:border-blue-700 hover:bg-blue-900 hover:text-blue-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400"
|
|
353
360
|
aria-controls="ui-mobile-navigation"
|
|
354
361
|
:aria-expanded="isNavigationOpen"
|
|
355
362
|
aria-label="Open components menu"
|
|
@@ -371,7 +378,7 @@ watch(
|
|
|
371
378
|
|
|
372
379
|
<div
|
|
373
380
|
v-if="isNavigationOpen"
|
|
374
|
-
class="fixed inset-0 z-40
|
|
381
|
+
class="fixed inset-0 z-40 dk:hidden"
|
|
375
382
|
@keydown.esc="closeNavigation"
|
|
376
383
|
>
|
|
377
384
|
<button
|
|
@@ -383,16 +390,16 @@ watch(
|
|
|
383
390
|
<aside
|
|
384
391
|
id="ui-mobile-navigation"
|
|
385
392
|
ref="mobileNavigation"
|
|
386
|
-
class="relative flex h-full flex-col border-r border-
|
|
393
|
+
class="relative flex h-full flex-col border-r border-zinc-800 bg-zinc-950 p-4 shadow-2xl"
|
|
387
394
|
:class="$style.mobileNavigation"
|
|
388
395
|
aria-label="UI components"
|
|
389
396
|
tabindex="-1"
|
|
390
397
|
>
|
|
391
398
|
<div class="flex items-center justify-between gap-4 px-2 py-1">
|
|
392
|
-
<p class="text-xs font-medium tracking-widest text-
|
|
399
|
+
<p class="text-xs font-medium tracking-widest text-zinc-500 uppercase">Components</p>
|
|
393
400
|
<button
|
|
394
401
|
type="button"
|
|
395
|
-
class="flex size-8 cursor-pointer items-center justify-center rounded-lg text-
|
|
402
|
+
class="flex size-8 cursor-pointer items-center justify-center rounded-lg text-zinc-400 transition hover:bg-zinc-900 hover:text-zinc-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400"
|
|
396
403
|
aria-label="Close components menu"
|
|
397
404
|
@click="closeNavigation"
|
|
398
405
|
>
|
|
@@ -419,7 +426,7 @@ watch(
|
|
|
419
426
|
:aria-current="activeComponent?.id === component.id ? 'page' : void 0"
|
|
420
427
|
:class="[
|
|
421
428
|
'block rounded-lg px-3 py-2.5 text-sm transition',
|
|
422
|
-
activeComponent?.id === component.id ? 'bg-
|
|
429
|
+
activeComponent?.id === component.id ? 'bg-blue-900 text-blue-100' : 'text-zinc-400 hover:bg-zinc-900 hover:text-zinc-100'
|
|
423
430
|
]"
|
|
424
431
|
:to="{
|
|
425
432
|
path: '/ui',
|
|
@@ -437,8 +444,8 @@ watch(
|
|
|
437
444
|
</div>
|
|
438
445
|
|
|
439
446
|
<div class="mx-auto flex min-h-screen max-w-7xl">
|
|
440
|
-
<aside class="hidden w-64 shrink-0 border-r border-
|
|
441
|
-
<p class="px-3 text-xs font-medium tracking-widest text-
|
|
447
|
+
<aside class="hidden w-64 shrink-0 border-r border-zinc-800 px-4 py-6 dk:block">
|
|
448
|
+
<p class="px-3 text-xs font-medium tracking-widest text-zinc-500 uppercase">Components</p>
|
|
442
449
|
|
|
443
450
|
<nav
|
|
444
451
|
class="sticky top-2 mt-4 space-y-1"
|
|
@@ -450,7 +457,7 @@ watch(
|
|
|
450
457
|
:aria-current="activeComponent?.id === component.id ? 'page' : void 0"
|
|
451
458
|
:class="[
|
|
452
459
|
'block rounded-lg px-3 py-2 text-sm transition',
|
|
453
|
-
activeComponent?.id === component.id ? 'bg-
|
|
460
|
+
activeComponent?.id === component.id ? 'bg-blue-900 text-blue-100' : 'text-zinc-400 hover:bg-zinc-900 hover:text-zinc-100'
|
|
454
461
|
]"
|
|
455
462
|
:to="{
|
|
456
463
|
path: '/ui',
|
|
@@ -465,14 +472,14 @@ watch(
|
|
|
465
472
|
</nav>
|
|
466
473
|
</aside>
|
|
467
474
|
|
|
468
|
-
<section class="min-w-0 flex-1 px-
|
|
475
|
+
<section class="min-w-0 flex-1 px-10 py-6 lp:px-6 mb:px-4">
|
|
469
476
|
<template v-if="activeComponent">
|
|
470
477
|
<div class="flex items-center gap-3">
|
|
471
|
-
<h1 class="text-
|
|
478
|
+
<h1 class="text-3xl leading-tight font-semibold mb:text-2xl">{{ activeComponent.name }}</h1>
|
|
472
479
|
<button
|
|
473
480
|
v-if="uiThemeEnabled"
|
|
474
481
|
type="button"
|
|
475
|
-
class="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-
|
|
482
|
+
class="flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-zinc-700 text-zinc-400 transition hover:border-blue-700 hover:bg-blue-900 hover:text-blue-200 focus-visible:outline-2 focus-visible:outline-offset-2"
|
|
476
483
|
:aria-label="isDark ? 'Switch to light theme' : 'Switch to dark theme'"
|
|
477
484
|
:title="isDark ? 'Switch to light theme' : 'Switch to dark theme'"
|
|
478
485
|
@click="toggleTheme"
|
|
@@ -515,16 +522,16 @@ watch(
|
|
|
515
522
|
<section
|
|
516
523
|
v-for="demo in activeComponent.demos"
|
|
517
524
|
:key="demo.title"
|
|
518
|
-
class="mt-6 overflow-hidden rounded-2xl border border-
|
|
525
|
+
class="mt-6 overflow-hidden rounded-2xl border border-zinc-800 bg-zinc-900/50 first:mt-8"
|
|
519
526
|
>
|
|
520
527
|
<header
|
|
521
|
-
class="flex items-start justify-between gap-
|
|
528
|
+
class="flex items-start justify-between gap-4 border-b border-zinc-800 bg-zinc-900 px-8 py-4 mb:gap-3 mb:px-4 mb:py-3"
|
|
522
529
|
>
|
|
523
530
|
<div>
|
|
524
|
-
<h2 class="text-base font-medium text-
|
|
531
|
+
<h2 class="text-base font-medium text-zinc-100">{{ demo.title }}</h2>
|
|
525
532
|
<p
|
|
526
533
|
v-if="demo.description"
|
|
527
|
-
class="mt-1 text-sm text-
|
|
534
|
+
class="mt-1 text-sm text-zinc-400"
|
|
528
535
|
>
|
|
529
536
|
{{ demo.description }}
|
|
530
537
|
</p>
|
|
@@ -533,8 +540,8 @@ watch(
|
|
|
533
540
|
type="button"
|
|
534
541
|
:aria-label="isDemoCodeExpanded(demo.id) ? 'Hide code' : 'View code'"
|
|
535
542
|
:class="[
|
|
536
|
-
'flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md border transition focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-
|
|
537
|
-
isDemoCodeExpanded(demo.id) ? 'border-
|
|
543
|
+
'flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md border transition focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-400',
|
|
544
|
+
isDemoCodeExpanded(demo.id) ? 'border-blue-700 bg-blue-900 text-blue-200' : 'border-zinc-700 text-zinc-400 hover:border-blue-700 hover:text-blue-200'
|
|
538
545
|
]"
|
|
539
546
|
:title="isDemoCodeExpanded(demo.id) ? 'Hide code' : 'View code'"
|
|
540
547
|
@click="toggleDemoCode(demo.id)"
|
|
@@ -555,56 +562,58 @@ watch(
|
|
|
555
562
|
</svg>
|
|
556
563
|
</button>
|
|
557
564
|
</header>
|
|
558
|
-
<div class="p-
|
|
565
|
+
<div class="p-8 mb:p-4">
|
|
559
566
|
<component :is="demo.component" />
|
|
560
567
|
</div>
|
|
561
568
|
<div
|
|
562
569
|
v-if="isDemoCodeExpanded(demo.id)"
|
|
563
|
-
class="border-t border-
|
|
570
|
+
class="border-t border-zinc-800 bg-zinc-950/80 p-8 mb:p-4"
|
|
564
571
|
>
|
|
565
572
|
<pre
|
|
566
|
-
class="overflow-x-auto text-sm leading-6 text-
|
|
573
|
+
class="overflow-x-auto text-sm leading-6 text-zinc-300"
|
|
567
574
|
><code v-html="highlightDemoCode(demo.code.trim())" /></pre>
|
|
568
575
|
</div>
|
|
569
576
|
</section>
|
|
570
577
|
<p
|
|
571
578
|
v-if="activeComponent.demos.length === 0"
|
|
572
|
-
class="mt-8 text-
|
|
579
|
+
class="mt-8 text-zinc-400"
|
|
573
580
|
>
|
|
574
581
|
Add a
|
|
575
|
-
<code class="text-
|
|
582
|
+
<code class="text-zinc-200">*.demo.vue</code>
|
|
576
583
|
file to this component folder.
|
|
577
584
|
</p>
|
|
578
|
-
<section class="mt-8 overflow-hidden rounded-2xl border border-
|
|
579
|
-
<header class="border-b border-
|
|
580
|
-
<h2 class="text-base font-medium text-
|
|
585
|
+
<section class="mt-8 overflow-hidden rounded-2xl border border-zinc-800 bg-zinc-900/50">
|
|
586
|
+
<header class="border-b border-zinc-800 bg-zinc-900 px-8 py-4 mb:px-4 mb:py-3">
|
|
587
|
+
<h2 class="text-base font-medium text-zinc-100">Component API</h2>
|
|
581
588
|
</header>
|
|
582
589
|
|
|
583
|
-
<div
|
|
584
|
-
|
|
585
|
-
|
|
590
|
+
<div
|
|
591
|
+
class="grid grid-cols-2 divide-x divide-y-0 divide-zinc-800 tb:grid-cols-1 tb:divide-x-0 tb:divide-y"
|
|
592
|
+
>
|
|
593
|
+
<section class="px-6 py-5 mb:px-4">
|
|
594
|
+
<h3 class="text-sm font-medium text-zinc-200">Props</h3>
|
|
586
595
|
<div class="mt-4 overflow-x-auto">
|
|
587
|
-
<table class="w-full min-w-
|
|
588
|
-
<!-- <thead class="text-xs tracking-wider text-
|
|
596
|
+
<table class="w-full min-w-96 text-left text-sm mb:min-w-80">
|
|
597
|
+
<!-- <thead class="text-xs tracking-wider text-zinc-500 uppercase">
|
|
589
598
|
<tr>
|
|
590
599
|
<th class="pb-3 font-medium">Name</th>
|
|
591
600
|
<th class="pb-3 font-medium">Type</th>
|
|
592
601
|
<th class="pb-3 text-right font-medium">Required</th>
|
|
593
602
|
</tr>
|
|
594
603
|
</thead> -->
|
|
595
|
-
<tbody class="divide-y divide-
|
|
604
|
+
<tbody class="divide-y divide-zinc-800 text-zinc-300">
|
|
596
605
|
<tr
|
|
597
606
|
v-for="prop in activeComponent.props"
|
|
598
607
|
:key="prop.name"
|
|
599
608
|
>
|
|
600
|
-
<td class="py-3 pr-4 font-mono text-
|
|
609
|
+
<td class="py-3 pr-4 font-mono text-zinc-400">{{ prop.name }}</td>
|
|
601
610
|
<td
|
|
602
611
|
class="py-3 pr-4 font-mono text-xs break-all"
|
|
603
612
|
v-html="highlightPropType(prop.type)"
|
|
604
613
|
/>
|
|
605
614
|
<td
|
|
606
615
|
class="py-3 text-right text-xs"
|
|
607
|
-
:class="prop.required ? 'text-
|
|
616
|
+
:class="prop.required ? 'text-red-600' : 'text-zinc-500'"
|
|
608
617
|
>
|
|
609
618
|
{{ prop.required ? "*" : "-" }}
|
|
610
619
|
</td>
|
|
@@ -612,7 +621,7 @@ watch(
|
|
|
612
621
|
<tr v-if="activeComponent.props.length === 0">
|
|
613
622
|
<td
|
|
614
623
|
colspan="3"
|
|
615
|
-
class="py-3 text-
|
|
624
|
+
class="py-3 text-zinc-500"
|
|
616
625
|
>
|
|
617
626
|
No props declared.
|
|
618
627
|
</td>
|
|
@@ -622,8 +631,8 @@ watch(
|
|
|
622
631
|
</div>
|
|
623
632
|
</section>
|
|
624
633
|
|
|
625
|
-
<section class="px-
|
|
626
|
-
<h3 class="text-sm font-medium text-
|
|
634
|
+
<section class="px-6 py-5 mb:px-4">
|
|
635
|
+
<h3 class="text-sm font-medium text-zinc-200">Slots</h3>
|
|
627
636
|
<div
|
|
628
637
|
v-if="activeComponent.slots.length"
|
|
629
638
|
class="mt-4 flex flex-wrap gap-2"
|
|
@@ -631,15 +640,15 @@ watch(
|
|
|
631
640
|
<code
|
|
632
641
|
v-for="slot in activeComponent.slots"
|
|
633
642
|
:key="slot"
|
|
634
|
-
class="rounded-md border border-
|
|
635
|
-
:class="slot === 'default' ? 'text-
|
|
643
|
+
class="rounded-md border border-zinc-800 bg-zinc-950 px-2.5 py-1.5 text-xs"
|
|
644
|
+
:class="slot === 'default' ? 'text-zinc-500' : 'text-zinc-400'"
|
|
636
645
|
>
|
|
637
646
|
{{ slot }}
|
|
638
647
|
</code>
|
|
639
648
|
</div>
|
|
640
649
|
<p
|
|
641
650
|
v-else
|
|
642
|
-
class="mt-4 text-sm text-
|
|
651
|
+
class="mt-4 text-sm text-zinc-500"
|
|
643
652
|
>
|
|
644
653
|
No slots detected.
|
|
645
654
|
</p>
|
|
@@ -649,32 +658,32 @@ watch(
|
|
|
649
658
|
|
|
650
659
|
<section
|
|
651
660
|
v-if="activeComponent.styles.length"
|
|
652
|
-
class="mt-6 overflow-hidden rounded-2xl border border-
|
|
661
|
+
class="mt-6 overflow-hidden rounded-2xl border border-zinc-800 bg-zinc-900/50"
|
|
653
662
|
>
|
|
654
663
|
<header
|
|
655
|
-
class="flex items-center justify-between gap-
|
|
664
|
+
class="flex items-center justify-between gap-4 border-b border-zinc-800 bg-zinc-900 px-8 py-4 mb:gap-3 mb:px-4 mb:py-3"
|
|
656
665
|
>
|
|
657
666
|
<div class="flex items-center gap-3">
|
|
658
667
|
<div>
|
|
659
|
-
<h2 class="text-base font-medium text-
|
|
668
|
+
<h2 class="text-base font-medium text-zinc-100">UI styles</h2>
|
|
660
669
|
</div>
|
|
661
670
|
</div>
|
|
662
|
-
<span class="rounded-full border border-
|
|
671
|
+
<span class="rounded-full border border-zinc-700 px-2.5 py-1 text-xs text-zinc-400">
|
|
663
672
|
{{ activeComponent.styles.length }} fields
|
|
664
673
|
</span>
|
|
665
674
|
</header>
|
|
666
675
|
|
|
667
|
-
<div class="px-
|
|
668
|
-
<div class="divide-y divide-
|
|
676
|
+
<div class="px-8 py-2 mb:px-4">
|
|
677
|
+
<div class="divide-y divide-zinc-800">
|
|
669
678
|
<div
|
|
670
679
|
v-for="style in visibleStyles"
|
|
671
680
|
:key="style.path"
|
|
672
|
-
class="grid gap-
|
|
681
|
+
class="grid gap-6 py-4 mb:gap-2"
|
|
673
682
|
:class="$style.styleGrid"
|
|
674
683
|
>
|
|
675
|
-
<code class="font-mono text-xs text-
|
|
684
|
+
<code class="font-mono text-xs text-blue-300">{{ style.path }}</code>
|
|
676
685
|
<code
|
|
677
|
-
class="font-mono text-xs wrap-break-word text-
|
|
686
|
+
class="font-mono text-xs wrap-break-word text-zinc-300"
|
|
678
687
|
:class="$style.styleValue"
|
|
679
688
|
v-html="highlightStyleValue(style.value)"
|
|
680
689
|
/>
|
|
@@ -684,11 +693,11 @@ watch(
|
|
|
684
693
|
|
|
685
694
|
<footer
|
|
686
695
|
v-if="activeComponent.styles.length > 5"
|
|
687
|
-
class="sticky bottom-0 z-10 border-t border-
|
|
696
|
+
class="sticky bottom-0 z-10 border-t border-zinc-800 bg-zinc-900/95 px-8 py-3 backdrop-blur mb:px-4"
|
|
688
697
|
>
|
|
689
698
|
<button
|
|
690
699
|
type="button"
|
|
691
|
-
class="flex w-full cursor-pointer items-center justify-center text-sm font-medium text-
|
|
700
|
+
class="flex w-full cursor-pointer items-center justify-center text-sm font-medium text-cyan-500 transition hover:text-cyan-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-400"
|
|
692
701
|
@click="stylesExpanded = !stylesExpanded"
|
|
693
702
|
>
|
|
694
703
|
{{ stylesExpanded ? "Collapse styles" : `Show all ${activeComponent.styles.length} styles` }}
|
|
@@ -699,12 +708,12 @@ watch(
|
|
|
699
708
|
|
|
700
709
|
<p
|
|
701
710
|
v-else
|
|
702
|
-
class="text-
|
|
711
|
+
class="text-zinc-400"
|
|
703
712
|
>
|
|
704
713
|
Add
|
|
705
|
-
<code class="text-
|
|
714
|
+
<code class="text-zinc-200">Component/index.vue</code>
|
|
706
715
|
and a
|
|
707
|
-
<code class="text-
|
|
716
|
+
<code class="text-zinc-200">*.demo.vue</code>
|
|
708
717
|
file to show it here.
|
|
709
718
|
</p>
|
|
710
719
|
</section>
|
|
@@ -713,5 +722,5 @@ watch(
|
|
|
713
722
|
</template>
|
|
714
723
|
|
|
715
724
|
<style module>
|
|
716
|
-
:global(.ui-code-comment){color:var(--color-
|
|
725
|
+
:global(.ui-code-comment){color:var(--color-zinc-500)}:global(.ui-code-string){color:var(--color-emerald-400)}:global(.ui-code-keyword){color:var(--color-blue-400)}:global(.ui-code-number){color:var(--color-amber-300)}:global(.ui-code-tag){color:var(--color-cyan-500)}:global(.ui-code-attribute){color:var(--color-violet-300)}:global(.ui-code-punctuation){color:var(--color-zinc-400)}:global(.ui-color-swatch){background:var(--ui-color-swatch);border:1px solid hsla(0,0%,100%,.1);border-radius:.2rem;display:inline-block;height:.65rem;margin-right:.25rem;opacity:.85;vertical-align:-.1rem;width:.65rem}.mobileNavigation{width:min(18rem,calc(100vw - 3rem))}@media (width >= 40rem){.styleGrid{grid-template-columns:minmax(12rem,.8fr) minmax(0,1.8fr)}}.styleValue :global(.ui-code-keyword){color:var(--color-zinc-500)}.styleValue :global(.ui-code-attribute){color:var(--color-zinc-200)}.styleValue :global(.ui-code-string){color:var(--color-zinc-300)}.styleValue :global(.ui-code-number){color:var(--color-zinc-400)}.styleValue :global(.ui-code-punctuation){color:var(--color-zinc-500)}
|
|
717
726
|
</style>
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
declare const UI_STYLE_REFERENCE: unique symbol;
|
|
2
|
+
export interface BrickflowUiConfig<TStyles = BrickflowUiStyles, TConfig = BrickflowUiConfigObject> {
|
|
3
|
+
uiConfig: TConfig;
|
|
2
4
|
uiStyles: TStyles;
|
|
3
5
|
}
|
|
6
|
+
export type BrickflowUiConfigObject = {
|
|
7
|
+
readonly [key: string]: BrickflowUiConfigValue;
|
|
8
|
+
};
|
|
9
|
+
export type BrickflowUiConfigValue = BrickflowUiConfigObject | BrickflowUiStyleReference | string;
|
|
10
|
+
export interface BrickflowUiStyleReference {
|
|
11
|
+
readonly [UI_STYLE_REFERENCE]: readonly string[];
|
|
12
|
+
}
|
|
4
13
|
declare global {
|
|
14
|
+
interface BrickflowUiConfigSchema {
|
|
15
|
+
}
|
|
5
16
|
interface BrickflowUiConfigStylePaths {
|
|
6
17
|
}
|
|
7
18
|
type BrickflowUiStyleObject = {
|
|
8
19
|
readonly [key: string]: BrickflowUiStyleObject | string;
|
|
9
20
|
};
|
|
10
21
|
}
|
|
11
|
-
export type BrickflowUiConfigInput<TStyles extends BrickflowUiStyleObject = BrickflowUiStyles> = {
|
|
22
|
+
export type BrickflowUiConfigInput<TStyles extends BrickflowUiStyleObject = BrickflowUiStyles, TConfig extends BrickflowUiConfigObject = BrickflowUiConfigObject> = BrickflowUiConfigInputConfig<TConfig> & {
|
|
12
23
|
readonly uiStyles?: TStyles;
|
|
13
24
|
};
|
|
14
25
|
export type BrickflowUiNoExtraKeys<TValue, TShape> = TValue extends string ? TShape extends string ? TValue : never : TShape extends string ? never : {
|
|
@@ -16,10 +27,27 @@ export type BrickflowUiNoExtraKeys<TValue, TShape> = TValue extends string ? TSh
|
|
|
16
27
|
};
|
|
17
28
|
export type BrickflowUiStrictStyles<TStyles extends BrickflowUiConfigStylePaths> = BrickflowUiNoExtraKeys<TStyles, BrickflowUiConfigStylePaths> & TStyles;
|
|
18
29
|
export type BrickflowUiStyles = BrickflowUiStyleObject;
|
|
30
|
+
type BrickflowUiConfigContext = keyof BrickflowUiConfigSchema extends never ? unknown : {
|
|
31
|
+
readonly uiConfig: BrickflowUiConfigSchema;
|
|
32
|
+
};
|
|
33
|
+
type BrickflowUiConfigInputConfig<TConfig extends BrickflowUiConfigObject> = keyof BrickflowUiConfigSchema extends never ? {
|
|
34
|
+
readonly uiConfig?: TConfig;
|
|
35
|
+
} : {
|
|
36
|
+
readonly uiConfig: TConfig;
|
|
37
|
+
};
|
|
38
|
+
type BrickflowUiConfigValidation<TConfig extends BrickflowUiConfigObject> = keyof BrickflowUiConfigSchema extends never ? unknown : TConfig extends BrickflowUiConfigSchema ? unknown : {
|
|
39
|
+
readonly __brickflowUiConfigError: 'uiConfig does not satisfy a component config schema';
|
|
40
|
+
};
|
|
19
41
|
export declare const emptyUiStyles: {};
|
|
20
|
-
export declare const
|
|
21
|
-
export declare
|
|
22
|
-
export declare function defineBrickflowUiConfig
|
|
42
|
+
export declare const emptyUiConfig: {};
|
|
43
|
+
export declare const emptyBrickflowUiConfig: BrickflowUiConfig<typeof emptyUiStyles, typeof emptyUiConfig>;
|
|
44
|
+
export declare function defineBrickflowUiConfig(): BrickflowUiConfig<typeof emptyUiStyles, typeof emptyUiConfig>;
|
|
45
|
+
export declare function defineBrickflowUiConfig<const TStyles extends BrickflowUiConfigStylePaths, const TConfig extends BrickflowUiConfigObject>(config: BrickflowUiConfigContext & BrickflowUiConfigInput<BrickflowUiStrictStyles<TStyles>, TConfig> & BrickflowUiConfigValidation<TConfig>): BrickflowUiConfig<TStyles, TConfig>;
|
|
23
46
|
export declare const uiStyles: {};
|
|
47
|
+
export declare const uiConfig: {};
|
|
48
|
+
/** A compile-time reference to a value in `uiStyles`, for use inside `uiConfig`. */
|
|
49
|
+
export declare const UI_STYLE: BrickflowUiStyleReference;
|
|
50
|
+
export declare const isBrickflowUiStyleReference: (value: unknown) => value is BrickflowUiStyleReference;
|
|
51
|
+
export declare const getBrickflowUiStyleReferencePath: (value: BrickflowUiStyleReference) => readonly string[];
|
|
24
52
|
export default emptyBrickflowUiConfig;
|
|
25
53
|
//# sourceMappingURL=tailwind.d.ts.map
|
package/dist/runtime/tailwind.js
CHANGED
|
@@ -1,22 +1,68 @@
|
|
|
1
|
+
const UI_STYLE_REFERENCE = Symbol.for("@brickflow/ui/style-reference");
|
|
1
2
|
export const emptyUiStyles = {};
|
|
3
|
+
export const emptyUiConfig = {};
|
|
2
4
|
export const emptyBrickflowUiConfig = {
|
|
5
|
+
uiConfig: emptyUiConfig,
|
|
3
6
|
uiStyles: emptyUiStyles
|
|
4
7
|
};
|
|
5
8
|
export function defineBrickflowUiConfig(config = {}) {
|
|
9
|
+
const uiConfig2 = config.uiConfig ?? emptyUiConfig;
|
|
6
10
|
const uiStyles2 = config.uiStyles ?? emptyUiStyles;
|
|
11
|
+
validateUiConfig(uiConfig2);
|
|
7
12
|
validateUiStyles(uiStyles2);
|
|
8
13
|
return {
|
|
14
|
+
uiConfig: uiConfig2,
|
|
9
15
|
uiStyles: uiStyles2
|
|
10
16
|
};
|
|
11
17
|
}
|
|
12
18
|
export const uiStyles = emptyBrickflowUiConfig.uiStyles;
|
|
19
|
+
export const uiConfig = emptyBrickflowUiConfig.uiConfig;
|
|
20
|
+
const createUiStyleReference = (path = []) => new Proxy(
|
|
21
|
+
{ [UI_STYLE_REFERENCE]: path },
|
|
22
|
+
{
|
|
23
|
+
get(target, key) {
|
|
24
|
+
if (key === UI_STYLE_REFERENCE) {
|
|
25
|
+
return target[UI_STYLE_REFERENCE];
|
|
26
|
+
}
|
|
27
|
+
return typeof key === "string" ? createUiStyleReference([...path, key]) : void 0;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
export const UI_STYLE = createUiStyleReference();
|
|
32
|
+
export const isBrickflowUiStyleReference = (value) => Boolean(value && typeof value === "object" && UI_STYLE_REFERENCE in value);
|
|
33
|
+
export const getBrickflowUiStyleReferencePath = (value) => value[UI_STYLE_REFERENCE];
|
|
34
|
+
if (!("UI_STYLE" in globalThis)) {
|
|
35
|
+
Object.defineProperty(globalThis, "UI_STYLE", {
|
|
36
|
+
configurable: true,
|
|
37
|
+
value: UI_STYLE
|
|
38
|
+
});
|
|
39
|
+
}
|
|
13
40
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41
|
+
function validateUiConfig(value, path = "uiConfig") {
|
|
42
|
+
if (!isRecord(value)) {
|
|
43
|
+
throw new TypeError(`${path} must be an object.`);
|
|
44
|
+
}
|
|
45
|
+
for (const [key, childValue] of Object.entries(value)) {
|
|
46
|
+
const childPath = `${path}.${key}`;
|
|
47
|
+
if (typeof childValue === "string" || isBrickflowUiStyleReference(childValue)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (isRecord(childValue)) {
|
|
51
|
+
validateUiConfig(childValue, childPath);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
throw new TypeError(`${childPath} must be a string, UI_STYLE reference, or an object.`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
14
57
|
function validateUiStyles(value, path = "uiStyles") {
|
|
15
58
|
if (!isRecord(value)) {
|
|
16
59
|
throw new TypeError(`${path} must be an object.`);
|
|
17
60
|
}
|
|
18
61
|
for (const [key, childValue] of Object.entries(value)) {
|
|
19
62
|
const childPath = `${path}.${key}`;
|
|
63
|
+
if (isBrickflowUiStyleReference(childValue)) {
|
|
64
|
+
throw new TypeError(`${childPath} cannot reference UI_STYLE.`);
|
|
65
|
+
}
|
|
20
66
|
if (typeof childValue === "string") {
|
|
21
67
|
continue;
|
|
22
68
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@theme{--breakpoint-*:initial}@custom-variant dk (@media (width >= 1440px));@custom-variant lp (@media (width < 1440px));@custom-variant tb (@media (width < 1024px));@custom-variant mb (@media (width < 768px));@custom-variant ms (@media (width < 480px));@media (width < 1440px){.dkHidden{display:none!important}}@media (width < 1024px),(width >= 1440px){.lpHidden{display:none!important}}@media (width < 768px),(width >= 1024px){.tbHidden{display:none!important}}@media (width < 480px),(width >= 768px){.mbHidden{display:none!important}}@media (width >= 480px){.msHidden{display:none!important}}@source "./";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brickflow/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "brickflow UI Nuxt module.",
|
|
6
6
|
"files": [
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"./tailwind": {
|
|
16
16
|
"types": "./dist/runtime/tailwind.d.ts",
|
|
17
17
|
"import": "./dist/runtime/tailwind.js"
|
|
18
|
+
},
|
|
19
|
+
"./ui.css": {
|
|
20
|
+
"development": "./src/runtime/ui.css",
|
|
21
|
+
"default": "./dist/runtime/ui.css"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
20
24
|
"scripts": {
|
|
File without changes
|