@fusion.dev/helix-templates 0.169.0 → 0.171.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-templates",
3
3
  "description": "Starter templates for Helix, as data. Read by `helix new` and by `npm create @fusion.dev/helix-app`.",
4
- "version": "0.169.0",
4
+ "version": "0.171.0",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -63,6 +63,17 @@ export const members: readonly Member[] = [
63
63
  { id: 'm-12', name: 'Lena Fischer', reviews: 12, role: 'Engineer', team: 'Design' },
64
64
  ]
65
65
 
66
+ /**
67
+ * The first page, in the table's sort and page size: by name, six to a page.
68
+ *
69
+ * Written out as rows under the columns, so a page rendered on a server carries
70
+ * the values and the table is readable before the script runs. The table draws
71
+ * its own rows from `members` in their place.
72
+ */
73
+ export const firstPage: readonly Member[] = members
74
+ .toSorted((a, b) => a.name.localeCompare(b.name))
75
+ .slice(0, 6)
76
+
66
77
  /** The teams the form offers, read from the roster so the two cannot disagree. */
67
78
  export const teams: readonly string[] = [...new Set(members.map((one) => one.team))].toSorted()
68
79
 
@@ -33,6 +33,17 @@
33
33
  Reviews
34
34
  </helix-table-column>
35
35
 
36
+ <!-- The first page as rows, so a page rendered on a server carries the
37
+ values. The table draws its own rows from `members` in their place. -->
38
+ @for (member of firstPage; track member.id) {
39
+ <helix-table-row>
40
+ <helix-table-cell header>{{ member.name }}</helix-table-cell>
41
+ <helix-table-cell>{{ member.team }}</helix-table-cell>
42
+ <helix-table-cell>{{ member.role }}</helix-table-cell>
43
+ <helix-table-cell>{{ member.reviews }}</helix-table-cell>
44
+ </helix-table-row>
45
+ }
46
+
36
47
  <!-- The footer is a row across the table: anything you slot goes at the
37
48
  start, and the table's own pagination sits at the end. -->
38
49
  <helix-text emphasis="subtle" slot="footer" variant="caption">
@@ -1,5 +1,5 @@
1
1
  import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
2
- import { members } from './data'
2
+ import { firstPage, members } from './data'
3
3
  import { DOCS } from './docs'
4
4
 
5
5
  /**
@@ -21,5 +21,6 @@ import { DOCS } from './docs'
21
21
  })
22
22
  export class Overview {
23
23
  protected readonly docs = DOCS
24
+ protected readonly firstPage = firstPage
24
25
  protected readonly members = members
25
26
  }
@@ -63,6 +63,17 @@ export const members: readonly Member[] = [
63
63
  { id: 'm-12', name: 'Lena Fischer', reviews: 12, role: 'Engineer', team: 'Design' },
64
64
  ]
65
65
 
66
+ /**
67
+ * The first page, in the table's sort and page size: by name, six to a page.
68
+ *
69
+ * Written out as rows under the columns, so a page rendered on a server carries
70
+ * the values and the table is readable before the script runs. The table draws
71
+ * its own rows from `members` in their place.
72
+ */
73
+ export const firstPage: readonly Member[] = members
74
+ .toSorted((a, b) => a.name.localeCompare(b.name))
75
+ .slice(0, 6)
76
+
66
77
  /** The teams the form offers, read from the roster so the two cannot disagree. */
67
78
  export const teams: readonly string[] = [...new Set(members.map((one) => one.team))].toSorted()
68
79
 
@@ -1,4 +1,4 @@
1
- import { members } from './data'
1
+ import { firstPage, members } from './data'
2
2
  import { DOCS } from './docs'
3
3
 
4
4
  /**
@@ -10,6 +10,11 @@ import { DOCS } from './docs'
10
10
  * table sorts, pages, and selects out of that array on its own, with no handler
11
11
  * for you to write.
12
12
  *
13
+ * **The first page is markup too**, so the values are in the HTML the server
14
+ * sends and the table is readable before the script runs. It is the same array,
15
+ * sorted and paged as the table sorts and pages it, and the table draws its own
16
+ * rows in its place once it upgrades.
17
+ *
13
18
  * **Selection is keyed on `row-key`, so it survives a sort and a page.** A row
14
19
  * is chosen by its identity, wherever it sits, and `app.css` paints the chosen
15
20
  * row through the parts the table names for it.
@@ -67,6 +72,15 @@ export function Overview() {
67
72
  Reviews
68
73
  </helix-table-column>
69
74
 
75
+ {firstPage.map((member) => (
76
+ <helix-table-row key={member.id}>
77
+ <helix-table-cell header>{member.name}</helix-table-cell>
78
+ <helix-table-cell>{member.team}</helix-table-cell>
79
+ <helix-table-cell>{member.role}</helix-table-cell>
80
+ <helix-table-cell>{member.reviews}</helix-table-cell>
81
+ </helix-table-row>
82
+ ))}
83
+
70
84
  {/* The footer is a row across the table: anything you slot goes at the
71
85
  start, and the table's own pagination sits at the end. */}
72
86
  <helix-text emphasis="subtle" slot="footer" variant="caption">
@@ -63,6 +63,17 @@ export const members: readonly Member[] = [
63
63
  { id: 'm-12', name: 'Lena Fischer', reviews: 12, role: 'Engineer', team: 'Design' },
64
64
  ]
65
65
 
66
+ /**
67
+ * The first page, in the table's sort and page size: by name, six to a page.
68
+ *
69
+ * Written out as rows under the columns, so a page rendered on a server carries
70
+ * the values and the table is readable before the script runs. The table draws
71
+ * its own rows from `members` in their place.
72
+ */
73
+ export const firstPage: readonly Member[] = members
74
+ .toSorted((a, b) => a.name.localeCompare(b.name))
75
+ .slice(0, 6)
76
+
66
77
  /** The teams the form offers, read from the roster so the two cannot disagree. */
67
78
  export const teams: readonly string[] = [...new Set(members.map((one) => one.team))].toSorted()
68
79
 
@@ -1,4 +1,4 @@
1
- import { members } from './data.js'
1
+ import { firstPage, members } from './data.js'
2
2
  import { DOCS } from './docs.js'
3
3
 
4
4
  /**
@@ -10,6 +10,11 @@ import { DOCS } from './docs.js'
10
10
  * table sorts, pages, and selects out of that array on its own, with no handler
11
11
  * for you to write.
12
12
  *
13
+ * **The first page is markup too.** A page rendered on a server sends these rows
14
+ * in its HTML, so the table is readable before the script runs. Here the table
15
+ * draws its own rows from `members` at once, and the rows keep the page the same
16
+ * as one a server renders.
17
+ *
13
18
  * **Selection is keyed on `row-key`, so it survives a sort and a page.** A row
14
19
  * is chosen by its identity, wherever it sits, and `app.css` paints the chosen
15
20
  * row through the parts the table names for it.
@@ -67,6 +72,15 @@ export function Overview() {
67
72
  Reviews
68
73
  </helix-table-column>
69
74
 
75
+ {firstPage.map((member) => (
76
+ <helix-table-row key={member.id}>
77
+ <helix-table-cell header>{member.name}</helix-table-cell>
78
+ <helix-table-cell>{member.team}</helix-table-cell>
79
+ <helix-table-cell>{member.role}</helix-table-cell>
80
+ <helix-table-cell>{member.reviews}</helix-table-cell>
81
+ </helix-table-row>
82
+ ))}
83
+
70
84
  {/* The footer is a row across the table: anything you slot goes at the
71
85
  start, and the table's own pagination sits at the end. */}
72
86
  <helix-text emphasis="subtle" slot="footer" variant="caption">
@@ -63,6 +63,17 @@ export const members: readonly Member[] = [
63
63
  { id: 'm-12', name: 'Lena Fischer', reviews: 12, role: 'Engineer', team: 'Design' },
64
64
  ]
65
65
 
66
+ /**
67
+ * The first page, in the table's sort and page size: by name, six to a page.
68
+ *
69
+ * Written out as rows under the columns, so a page rendered on a server carries
70
+ * the values and the table is readable before the script runs. The table draws
71
+ * its own rows from `members` in their place.
72
+ */
73
+ export const firstPage: readonly Member[] = members
74
+ .toSorted((a, b) => a.name.localeCompare(b.name))
75
+ .slice(0, 6)
76
+
66
77
  /** The teams the form offers, read from the roster so the two cannot disagree. */
67
78
  export const teams: readonly string[] = [...new Set(members.map((one) => one.team))].toSorted()
68
79
 
@@ -1,4 +1,5 @@
1
- import { members } from './data.ts'
1
+ import { For } from 'solid-js'
2
+ import { firstPage, members } from './data.ts'
2
3
  import { DOCS } from './docs.ts'
3
4
 
4
5
  /**
@@ -9,6 +10,11 @@ import { DOCS } from './docs.ts'
9
10
  * at once, since a table of ten thousand rows cannot be written out as
10
11
  * elements. The table sorts, pages, and selects out of that array on its own.
11
12
  *
13
+ * **The first page is markup too.** A page rendered on a server sends these rows
14
+ * in its HTML, so the table is readable before the script runs. Here the table
15
+ * draws its own rows from `members` at once, and the rows keep the page the same
16
+ * as one a server renders.
17
+ *
12
18
  * **Selection is keyed on `row-key`, so it survives a sort and a page.**
13
19
  * `app.css` paints the chosen row through the parts the table names for it.
14
20
  */
@@ -56,6 +62,17 @@ export function Overview() {
56
62
  Reviews
57
63
  </helix-table-column>
58
64
 
65
+ <For each={firstPage}>
66
+ {(member) => (
67
+ <helix-table-row>
68
+ <helix-table-cell header>{member.name}</helix-table-cell>
69
+ <helix-table-cell>{member.team}</helix-table-cell>
70
+ <helix-table-cell>{member.role}</helix-table-cell>
71
+ <helix-table-cell>{member.reviews}</helix-table-cell>
72
+ </helix-table-row>
73
+ )}
74
+ </For>
75
+
59
76
  {/* The footer is a row across the table: anything you slot goes at the
60
77
  start, and the table's own pagination sits at the end. */}
61
78
  <helix-text emphasis="subtle" slot="footer" variant="caption">
@@ -10,7 +10,7 @@
10
10
  `app.css` paints the chosen row through the parts the table names for it.
11
11
  -->
12
12
  <script lang="ts">
13
- import { members } from './data.ts'
13
+ import { firstPage, members } from './data.ts'
14
14
  import { DOCS } from './docs.ts'
15
15
  </script>
16
16
 
@@ -50,6 +50,17 @@
50
50
  Reviews
51
51
  </helix-table-column>
52
52
 
53
+ <!-- The first page as rows, so a page rendered on a server carries the
54
+ values. The table draws its own rows from `members` in their place. -->
55
+ {#each firstPage as member (member.id)}
56
+ <helix-table-row>
57
+ <helix-table-cell header>{member.name}</helix-table-cell>
58
+ <helix-table-cell>{member.team}</helix-table-cell>
59
+ <helix-table-cell>{member.role}</helix-table-cell>
60
+ <helix-table-cell>{member.reviews}</helix-table-cell>
61
+ </helix-table-row>
62
+ {/each}
63
+
53
64
  <!-- The footer is a row across the table: anything you slot goes at the
54
65
  start, and the table's own pagination sits at the end. -->
55
66
  <helix-text emphasis="subtle" slot="footer" variant="caption">
@@ -63,6 +63,17 @@ export const members: readonly Member[] = [
63
63
  { id: 'm-12', name: 'Lena Fischer', reviews: 12, role: 'Engineer', team: 'Design' },
64
64
  ]
65
65
 
66
+ /**
67
+ * The first page, in the table's sort and page size: by name, six to a page.
68
+ *
69
+ * Written out as rows under the columns, so a page rendered on a server carries
70
+ * the values and the table is readable before the script runs. The table draws
71
+ * its own rows from `members` in their place.
72
+ */
73
+ export const firstPage: readonly Member[] = members
74
+ .toSorted((a, b) => a.name.localeCompare(b.name))
75
+ .slice(0, 6)
76
+
66
77
  /** The teams the form offers, read from the roster so the two cannot disagree. */
67
78
  export const teams: readonly string[] = [...new Set(members.map((one) => one.team))].toSorted()
68
79
 
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { members } from './data.ts'
2
+ import { firstPage, members } from './data.ts'
3
3
  import { DOCS } from './docs.ts'
4
4
  </script>
5
5
 
@@ -51,6 +51,15 @@ import { DOCS } from './docs.ts'
51
51
  Reviews
52
52
  </helix-table-column>
53
53
 
54
+ <!-- The first page as rows, so a page rendered on a server carries the
55
+ values. The table draws its own rows from `members` in their place. -->
56
+ <helix-table-row v-for="member in firstPage" :key="member.id">
57
+ <helix-table-cell header>{{ member.name }}</helix-table-cell>
58
+ <helix-table-cell>{{ member.team }}</helix-table-cell>
59
+ <helix-table-cell>{{ member.role }}</helix-table-cell>
60
+ <helix-table-cell>{{ member.reviews }}</helix-table-cell>
61
+ </helix-table-row>
62
+
54
63
  <!-- The footer is a row across the table: anything you slot goes at the
55
64
  start, and the table's own pagination sits at the end. -->
56
65
  <helix-text emphasis="subtle" slot="footer" variant="caption">
@@ -63,6 +63,17 @@ export const members: readonly Member[] = [
63
63
  { id: 'm-12', name: 'Lena Fischer', reviews: 12, role: 'Engineer', team: 'Design' },
64
64
  ]
65
65
 
66
+ /**
67
+ * The first page, in the table's sort and page size: by name, six to a page.
68
+ *
69
+ * Written out as rows under the columns, so a page rendered on a server carries
70
+ * the values and the table is readable before the script runs. The table draws
71
+ * its own rows from `members` in their place.
72
+ */
73
+ export const firstPage: readonly Member[] = members
74
+ .toSorted((a, b) => a.name.localeCompare(b.name))
75
+ .slice(0, 6)
76
+
66
77
  /** The teams the form offers, read from the roster so the two cannot disagree. */
67
78
  export const teams: readonly string[] = [...new Set(members.map((one) => one.team))].toSorted()
68
79