@kirchdev/duxt 0.3.1 → 0.3.2

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.
@@ -154,6 +154,7 @@ function pathIn(version: { to?: string }) {
154
154
  scrolls at about ten entries instead of filling the screen. -->
155
155
  <UiDropdownMenuContent
156
156
  align="start"
157
+ :portal="props.variant !== 'block'"
157
158
  class="max-h-[min(20rem,var(--reka-dropdown-menu-content-available-height))]"
158
159
  :class="
159
160
  props.variant === 'block'
@@ -17,20 +17,27 @@ defineOptions({
17
17
  });
18
18
 
19
19
  const props = withDefaults(
20
- defineProps<DropdownMenuContentProps & { class?: HTMLAttributes['class'] }>(),
20
+ defineProps<
21
+ DropdownMenuContentProps & {
22
+ class?: HTMLAttributes['class'];
23
+ /** Keep the content inside a containing modal when it must receive taps. */
24
+ portal?: boolean;
25
+ }
26
+ >(),
21
27
  {
22
- sideOffset: 4
28
+ sideOffset: 4,
29
+ portal: true
23
30
  }
24
31
  );
25
32
  const emits = defineEmits<DropdownMenuContentEmits>();
26
33
 
27
- const delegatedProps = reactiveOmit(props, 'class');
34
+ const delegatedProps = reactiveOmit(props, 'class', 'portal');
28
35
 
29
36
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
30
37
  </script>
31
38
 
32
39
  <template>
33
- <DropdownMenuPortal>
40
+ <DropdownMenuPortal :disabled="!props.portal">
34
41
  <DropdownMenuContent
35
42
  data-slot="dropdown-menu-content"
36
43
  v-bind="{ ...$attrs, ...forwarded }"
@@ -11,6 +11,36 @@
11
11
  * rest of it is: every version bug this layer has had came from prefix work
12
12
  * done inline in a component, where it could only be checked by clicking.
13
13
  */
14
+ import { compareVersionTags } from '../../sources-resolve';
15
+
16
+ /**
17
+ * What a reader needs to see first: work that may change, the edition they
18
+ * normally read, then retired documentation. Version number only breaks ties
19
+ * inside one lifecycle group — a branch such as `main` therefore stays above
20
+ * the default release without pretending to be a semver tag.
21
+ */
22
+ function lifecycleOrder(source: DuxtResolvedSource): number {
23
+ if (source.status === 'upcoming') return 0;
24
+ if (source.isDefault) return 1;
25
+ if (source.status === 'current' || source.status === 'maintained') return 2;
26
+ if (source.status === 'deprecated') return 3;
27
+ return 4;
28
+ }
29
+
30
+ function compareEditions(a: DuxtResolvedSource, b: DuxtResolvedSource): number {
31
+ const lifecycle = lifecycleOrder(a) - lifecycleOrder(b);
32
+ if (lifecycle) return lifecycle;
33
+
34
+ const aVersion = a.version!;
35
+ const bVersion = b.version!;
36
+ const semver = /^v?\d+\.\d+\.\d+(?:-.+)?$/;
37
+
38
+ // The shared comparator knows full tags. Demo editions such as `v3.x` are
39
+ // deliberately not tags, but still sort newest-first inside their group.
40
+ return semver.test(aVersion) && semver.test(bVersion)
41
+ ? compareVersionTags(aVersion, bVersion)
42
+ : bVersion.localeCompare(aVersion);
43
+ }
14
44
 
15
45
  /**
16
46
  * Are these two collections versions of the SAME thing?
@@ -62,6 +92,7 @@ export function versionChoices(
62
92
  editions.add(edition);
63
93
  return true;
64
94
  })
95
+ .sort(compareEditions)
65
96
  .map((source) => ({
66
97
  label: source.version!,
67
98
  to: source.prefix || '/',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://www.schemastore.org/package.json",
3
3
  "name": "@kirchdev/duxt",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "description": "Nuxt documentation layer on Content v3 — multi-repo, versioned docs from one compact source list.",
6
6
  "keywords": [
7
7
  "content-v3",