@stacksjs/components 0.2.164 → 0.2.166

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.
@@ -16,6 +16,19 @@ export const clear = $props.clear || null
16
16
  export const theme = $props.theme || 'arc'
17
17
  export const active = $props.active ?? false
18
18
 
19
+ // Render the shell without its contents.
20
+ //
21
+ // Every space's rows are rendered on the server even though the Arc design
22
+ // shows one at a time, and that cost is linear in the number of spaces: a host
23
+ // with fourteen projects pays for fourteen panels on every page load to display
24
+ // one. `deferred` keeps the panel — the track's geometry, the tab role and the
25
+ // swipe all depend on it existing — and drops what is inside it.
26
+ //
27
+ // The space still announces itself as a tabpanel, so the switcher and keyboard
28
+ // navigation are unchanged; `data-space-deferred` tells the controller this one
29
+ // has nothing yet, and `spaceChange` is where a host fills it or navigates.
30
+ export const deferred = $props.deferred ?? false
31
+
19
32
  const themeStyle = resolveSidebarTheme(theme)
20
33
  export const scrollAreaClasses = themeStyle.scrollArea
21
34
 
@@ -64,6 +77,7 @@ function onAction(event) {
64
77
  data-space
65
78
  data-space-id="{{ id }}"
66
79
  data-space-active="{{ active ? 'true' : 'false' }}"
80
+ @if(deferred)data-space-deferred@endif
67
81
  @if(!active)inert@endif
68
82
  class="flex min-w-0 flex-1 flex-col"
69
83
  role="tabpanel"
@@ -71,7 +85,9 @@ function onAction(event) {
71
85
  @click="onAction($event)"
72
86
  >
73
87
  <div class="{{ scrollAreaClasses }} stx-sidebar-scroll">
74
- <SidebarPinned :items="pinned" />
88
+ @if(!deferred)
89
+ <SidebarPinned :items="pinned" />
90
+ @endif
75
91
 
76
92
  @if(label)
77
93
  <div class="{{ titleClasses }}">
@@ -82,6 +98,12 @@ function onAction(event) {
82
98
  </div>
83
99
  @endif
84
100
 
101
+ <!--
102
+ Rows, and the actions that belong with them, are what a deferred panel
103
+ drops. The title above stays: it is a single line, and it is what tells
104
+ you which space you are swiping into.
105
+ -->
106
+ @if(!deferred)
85
107
  @foreach(sections as section)
86
108
  <SidebarSection
87
109
  :id="section.id"
@@ -123,6 +145,7 @@ function onAction(event) {
123
145
  <span class="truncate">{{ action.label }}</span>
124
146
  </button>
125
147
  @endif
148
+ @endif
126
149
  </div>
127
150
  </section>
128
151
 
@@ -514,6 +514,7 @@ defineExpose({
514
514
  :action="space.action"
515
515
  :clear="space.clear"
516
516
  :active="space.id === activeId"
517
+ :deferred="space.deferred === true"
517
518
  :theme="theme"
518
519
  />
519
520
  @endforeach
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  // @bun
2
- // ../../../../../../../tmp/stx-components-build-oM6fYt/stubs/stub-0.js
2
+ // ../../../../../../../tmp/stx-components-build-dyAtys/stubs/stub-0.js
3
3
  var stub_0_default = { __stx: true, src: "./components/CodeBlock.stx" };
4
- // ../../../../../../../tmp/stx-components-build-oM6fYt/stubs/stub-1.js
4
+ // ../../../../../../../tmp/stx-components-build-dyAtys/stubs/stub-1.js
5
5
  var stub_1_default = { __stx: true, src: "./components/Footer.stx" };
6
- // ../../../../../../../tmp/stx-components-build-oM6fYt/stubs/stub-2.js
6
+ // ../../../../../../../tmp/stx-components-build-dyAtys/stubs/stub-2.js
7
7
  var stub_2_default = { __stx: true, src: "./components/Hero.stx" };
8
- // ../../../../../../../tmp/stx-components-build-oM6fYt/stubs/stub-3.js
8
+ // ../../../../../../../tmp/stx-components-build-dyAtys/stubs/stub-3.js
9
9
  var stub_3_default = { __stx: true, src: "./components/Installation.stx" };
10
10
  // src/composables/useCopyCode.ts
11
11
  function useCopyCode(options) {
@@ -1144,9 +1144,9 @@ var SidebarPinned_default = "./SidebarPinned-tvj28bm0.stx";
1144
1144
  // src/ui/sidebar/SidebarSection.stx
1145
1145
  var SidebarSection_default = "./SidebarSection-zd9z35ch.stx";
1146
1146
  // src/ui/sidebar/SidebarSpace.stx
1147
- var SidebarSpace_default = "./SidebarSpace-h50n47va.stx";
1147
+ var SidebarSpace_default = "./SidebarSpace-t68ywe45.stx";
1148
1148
  // src/ui/sidebar/SidebarSpaces.stx
1149
- var SidebarSpaces_default = "./SidebarSpaces-sy8dy0gb.stx";
1149
+ var SidebarSpaces_default = "./SidebarSpaces-w17e6ma4.stx";
1150
1150
  // src/ui/sidebar/SidebarSpaceSwitcher.stx
1151
1151
  var SidebarSpaceSwitcher_default = "./SidebarSpaceSwitcher-882njcxq.stx";
1152
1152
  // src/ui/sidebar/themes.ts
@@ -1427,7 +1427,8 @@ function normalizeSpace(space) {
1427
1427
  action: normalizeAction(space.action, space.id, "action", "i-f7-plus"),
1428
1428
  clear: normalizeAction(space.clear, space.id, "clear", "i-f7-arrow-down"),
1429
1429
  tint,
1430
- style: spaceTintVars(tint)
1430
+ style: spaceTintVars(tint),
1431
+ deferred: space.deferred === true
1431
1432
  };
1432
1433
  }
1433
1434
  function normalizeSpaces(spaces) {
@@ -81,6 +81,7 @@ export declare interface SidebarSpaceData {
81
81
  icon?: string
82
82
  tint?: string | SidebarSpaceTint
83
83
  pinned?: SidebarPinnedItemData[]
84
+ deferred?: boolean
84
85
  sections?: SidebarSectionData[]
85
86
  action?: SidebarSpaceActionData
86
87
  clear?: SidebarSpaceActionData
@@ -102,4 +103,5 @@ export declare interface NormalizedSidebarSpace {
102
103
  clear: SidebarSpaceActionData | null
103
104
  tint: SidebarSpaceTint
104
105
  style: string
106
+ deferred: boolean
105
107
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/components",
3
3
  "type": "module",
4
- "version": "0.2.164",
4
+ "version": "0.2.166",
5
5
  "description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -64,8 +64,8 @@
64
64
  "dependencies": {
65
65
  "@iconify-json/f7": "^1.2.2",
66
66
  "@cwcss/crosswind": "^0.2.14",
67
- "@stacksjs/stx": "0.2.164",
68
- "bun-plugin-stx": "0.2.164",
67
+ "@stacksjs/stx": "0.2.166",
68
+ "bun-plugin-stx": "0.2.166",
69
69
  "ts-syntax-highlighter": "^0.2.1"
70
70
  },
71
71
  "devDependencies": {
@@ -16,6 +16,19 @@ export const clear = $props.clear || null
16
16
  export const theme = $props.theme || 'arc'
17
17
  export const active = $props.active ?? false
18
18
 
19
+ // Render the shell without its contents.
20
+ //
21
+ // Every space's rows are rendered on the server even though the Arc design
22
+ // shows one at a time, and that cost is linear in the number of spaces: a host
23
+ // with fourteen projects pays for fourteen panels on every page load to display
24
+ // one. `deferred` keeps the panel — the track's geometry, the tab role and the
25
+ // swipe all depend on it existing — and drops what is inside it.
26
+ //
27
+ // The space still announces itself as a tabpanel, so the switcher and keyboard
28
+ // navigation are unchanged; `data-space-deferred` tells the controller this one
29
+ // has nothing yet, and `spaceChange` is where a host fills it or navigates.
30
+ export const deferred = $props.deferred ?? false
31
+
19
32
  const themeStyle = resolveSidebarTheme(theme)
20
33
  export const scrollAreaClasses = themeStyle.scrollArea
21
34
 
@@ -64,6 +77,7 @@ function onAction(event) {
64
77
  data-space
65
78
  data-space-id="{{ id }}"
66
79
  data-space-active="{{ active ? 'true' : 'false' }}"
80
+ @if(deferred)data-space-deferred@endif
67
81
  @if(!active)inert@endif
68
82
  class="flex min-w-0 flex-1 flex-col"
69
83
  role="tabpanel"
@@ -71,7 +85,9 @@ function onAction(event) {
71
85
  @click="onAction($event)"
72
86
  >
73
87
  <div class="{{ scrollAreaClasses }} stx-sidebar-scroll">
74
- <SidebarPinned :items="pinned" />
88
+ @if(!deferred)
89
+ <SidebarPinned :items="pinned" />
90
+ @endif
75
91
 
76
92
  @if(label)
77
93
  <div class="{{ titleClasses }}">
@@ -82,6 +98,12 @@ function onAction(event) {
82
98
  </div>
83
99
  @endif
84
100
 
101
+ <!--
102
+ Rows, and the actions that belong with them, are what a deferred panel
103
+ drops. The title above stays: it is a single line, and it is what tells
104
+ you which space you are swiping into.
105
+ -->
106
+ @if(!deferred)
85
107
  @foreach(sections as section)
86
108
  <SidebarSection
87
109
  :id="section.id"
@@ -123,6 +145,7 @@ function onAction(event) {
123
145
  <span class="truncate">{{ action.label }}</span>
124
146
  </button>
125
147
  @endif
148
+ @endif
126
149
  </div>
127
150
  </section>
128
151
 
@@ -514,6 +514,7 @@ defineExpose({
514
514
  :action="space.action"
515
515
  :clear="space.clear"
516
516
  :active="space.id === activeId"
517
+ :deferred="space.deferred === true"
517
518
  :theme="theme"
518
519
  />
519
520
  @endforeach
@@ -94,6 +94,20 @@ export interface SidebarSpaceData {
94
94
  tint?: string | SidebarSpaceTint
95
95
  /** Favorites grid pinned above the rows. */
96
96
  pinned?: SidebarPinnedItemData[]
97
+ /**
98
+ * Render this space's shell without its rows.
99
+ *
100
+ * Every space is server-rendered even though the Arc design shows one at a
101
+ * time, so the cost is linear in the number of spaces: fourteen projects
102
+ * means paying for fourteen panels on every page load to display one. A
103
+ * deferred space keeps its panel — the track geometry, the tab role and the
104
+ * swipe all depend on it existing — and its title, which is what identifies
105
+ * it mid-swipe, but drops the rows.
106
+ *
107
+ * The panel carries `data-space-deferred`, and `spaceChange` fires as usual,
108
+ * so a host can fill it in or navigate when the user arrives.
109
+ */
110
+ deferred?: boolean
97
111
  /** Row groups, identical in shape to a plain `<Sidebar>`'s sections. */
98
112
  sections?: SidebarSectionData[]
99
113
  /** Primary action row at the foot of the list. */
@@ -122,6 +136,8 @@ export interface NormalizedSidebarSpace {
122
136
  tint: SidebarSpaceTint
123
137
  /** `style` attribute value that publishes this space's palette. */
124
138
  style: string
139
+ /** See {@link SidebarSpaceData.deferred}. */
140
+ deferred: boolean
125
141
  }
126
142
 
127
143
  /**
@@ -228,6 +244,7 @@ export function normalizeSpace(space: SidebarSpaceData): NormalizedSidebarSpace
228
244
  clear: normalizeAction(space.clear, space.id, 'clear', 'i-f7-arrow-down'),
229
245
  tint,
230
246
  style: spaceTintVars(tint),
247
+ deferred: space.deferred === true,
231
248
  }
232
249
  }
233
250