@kolkrabbi/kol-styleguide 0.14.0 → 0.15.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-styleguide",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "private": false,
5
5
  "description": "Brand guide components and the brand tool",
6
6
  "license": "MIT",
@@ -21,11 +21,11 @@
21
21
  "react-dom": "^18.3.0 || ^19.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@kolkrabbi/kol-print": "^0.1.0",
25
- "@kolkrabbi/kol-component": "^0.311.0",
26
- "@kolkrabbi/kol-theme": "^0.196.0",
27
- "@kolkrabbi/kol-framework": "^0.61.0",
28
- "@kolkrabbi/kol-icons": "^0.52.0"
24
+ "@kolkrabbi/kol-component": "^0.313.0",
25
+ "@kolkrabbi/kol-framework": "^0.62.4",
26
+ "@kolkrabbi/kol-icons": "^0.52.0",
27
+ "@kolkrabbi/kol-print": "^0.1.1",
28
+ "@kolkrabbi/kol-theme": "^0.196.0"
29
29
  },
30
30
  "files": [
31
31
  "src",
package/src/A4Pages.jsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import { useRef, useState, useLayoutEffect } from 'react'
2
+ import { QuickLookFrame } from '@kolkrabbi/kol-component'
2
3
 
3
4
  /* A4 portrait @96dpi, with print-style page margins. */
4
5
  const A4_W = 794
@@ -22,7 +23,11 @@ const CONTENT_H = A4_H - MARGIN * 2 - PRINT_SAFETY
22
23
  *
23
24
  * Re-measured on resize and as images (heroes) finish loading.
24
25
  */
25
- export default function A4Pages({ children, label }) {
26
+ /* `paged` (LayoutsAppPages, 2026-10-29 — user: *"one in view at a time, then next … we are not reinventing anything, just LOOK
27
+ * AROUND"*): one sheet in view, centred, paged with QuickLookFrame's `nav` (‹ › and `n / N`, as MediaLibrary and
28
+ * DocumentIndex page a PDF). Print still prints every sheet. */
29
+ export default function A4Pages({ children, label, paged = false }) {
30
+ const [at, setAt] = useState(0)
26
31
  const measureRef = useRef(null)
27
32
  // breaks[k]..breaks[k+1] is page k's vertical slice of the content.
28
33
  const [breaks, setBreaks] = useState([0, CONTENT_H])
@@ -74,6 +79,37 @@ export default function A4Pages({ children, label }) {
74
79
  }, [])
75
80
 
76
81
  const pageCount = Math.max(1, breaks.length - 1)
82
+ const page = Math.min(at, pageCount - 1)
83
+
84
+ const sheets = Array.from({ length: pageCount }, (_, k) => {
85
+ const from = breaks[k] ?? 0
86
+ const to = breaks[k + 1] ?? from + CONTENT_H
87
+ return (
88
+ <section key={k} className={`kol-a4-sheet${paged && k !== page ? ' hidden print:block' : ''}`} aria-label={`${label} — page ${k + 1} of ${pageCount}`}>
89
+ <div className="kol-a4-clip" style={{ height: to - from }}>
90
+ {/* Negative margin (not transform) shifts the slice — Chrome's
91
+ print engine drops images inside transformed containers. */}
92
+ <div style={{ marginTop: -from }}>{children}</div>
93
+ </div>
94
+ </section>
95
+ )
96
+ })
97
+
98
+ if (paged) {
99
+ return (
100
+ <>
101
+ <div ref={measureRef} className="kol-a4-measure" aria-hidden="true">{children}</div>
102
+ <div className="flex justify-center print:block">
103
+ <QuickLookFrame
104
+ title={label}
105
+ nav={{ index: page, total: pageCount, onPrev: () => setAt((i) => (i - 1 + pageCount) % pageCount), onNext: () => setAt((i) => (i + 1) % pageCount) }}
106
+ >
107
+ <div className="flex justify-center p-6 print:p-0">{sheets}</div>
108
+ </QuickLookFrame>
109
+ </div>
110
+ </>
111
+ )
112
+ }
77
113
 
78
114
  return (
79
115
  <>
@@ -82,19 +118,7 @@ export default function A4Pages({ children, label }) {
82
118
  {children}
83
119
  </div>
84
120
 
85
- {Array.from({ length: pageCount }, (_, k) => {
86
- const from = breaks[k] ?? 0
87
- const to = breaks[k + 1] ?? from + CONTENT_H
88
- return (
89
- <section key={k} className="kol-a4-sheet" aria-label={`${label} — page ${k + 1} of ${pageCount}`}>
90
- <div className="kol-a4-clip" style={{ height: to - from }}>
91
- {/* Negative margin (not transform) shifts the slice — Chrome's
92
- print engine drops images inside transformed containers. */}
93
- <div style={{ marginTop: -from }}>{children}</div>
94
- </div>
95
- </section>
96
- )
97
- })}
121
+ {sheets}
98
122
  </>
99
123
  )
100
124
  }
@@ -101,40 +101,49 @@ export default function AssetTable({
101
101
  against the table's own ground — the consumer's behaviour, kept. */
102
102
  className: (row) =>
103
103
  `kol-table-cell-text${inkTokens && tokenFor(row.id) !== inkTokens.ink ? ' bg-fg-04' : ''}`,
104
- style: { minWidth: 160 },
104
+ style: { minWidth: 112 },
105
105
  render: (row) => <PreviewCell row={row} token={tokenFor(row.id)} onZoom={onPreviewZoom} />,
106
106
  },
107
107
  {
108
108
  accessor: 'name',
109
109
  header: 'Name',
110
- className: 'kol-table-cell-text',
110
+ /* a name wraps at its words (`lockup / hori / wide`); a path never does */
111
+ className: 'kol-table-cell-text kol-table-cell-text--wrap',
112
+ style: { minWidth: 80 },
111
113
  },
112
114
  hasPath && {
113
115
  accessor: 'path',
114
116
  header: 'Path',
115
- className: 'kol-table-cell-meta',
117
+ /* a path never wraps at its slash (LayoutsAppPages, 2026-10-29: `marks/` ⏎ `logomark-01.svg`) — it takes the width it
118
+ needs, from Preview, which has more than it uses */
119
+ className: 'kol-table-cell-meta whitespace-nowrap',
116
120
  render: (row) => (row.path ? <code>{row.path}</code> : null),
117
121
  },
118
122
  {
119
123
  accessor: 'format',
120
124
  header: 'Format',
121
- className: 'kol-table-cell-meta',
125
+ className: 'kol-table-cell-meta whitespace-nowrap',
126
+ /* the meta cell's 160px floor is for prose; `SVG` needs a word's width — the room goes to Path (LayoutsAppPages) */
127
+ style: { minWidth: 0 },
122
128
  },
123
129
  {
124
130
  accessor: 'dimensions',
125
131
  header: 'Dimensions',
126
- className: 'kol-table-cell-meta',
132
+ className: 'kol-table-cell-meta whitespace-nowrap',
133
+ style: { minWidth: 0 },
127
134
  },
128
135
  inkTokens && {
129
136
  accessor: 'color',
130
137
  header: 'Color',
131
- className: 'kol-table-cell-meta',
138
+ className: 'kol-table-cell-meta whitespace-nowrap',
139
+ style: { minWidth: 0 },
132
140
  render: (row) => <code>{tokenFor(row.id)}</code>,
133
141
  },
134
142
  hasDownload && {
135
143
  accessor: 'download',
136
144
  header: 'Download',
137
- style: { width: 96 },
145
+ /* no fixed 96px: the chips are wider than that, and the column was clipped ("Co…") */
146
+ className: 'whitespace-nowrap',
138
147
  render: (row) => (
139
148
  <DownloadControl
140
149
  row={row}
@@ -145,7 +154,8 @@ export default function AssetTable({
145
154
  },
146
155
  ].filter(Boolean)
147
156
 
148
- return <Table caption={caption} columns={columns} rows={withId} variant={variant} className={className} />
157
+ /* a DATA table: it runs the content column (Table `width="column"`), not the prose panel cap it stopped at */
158
+ return <Table caption={caption} columns={columns} rows={withId} variant={variant} className={className} width="column" />
149
159
  }
150
160
 
151
161
  /* Preview cell. With `onZoom` it is a zoom button; without, the bare node —
@@ -156,7 +166,8 @@ function PreviewCell({ row, token, onZoom }) {
156
166
 
157
167
  const style = {
158
168
  ...(token ? { color: `var(${token})` } : {}),
159
- ...(row.previewWidth ? { width: row.previewWidth } : {}),
169
+ /* up to its width, down to the column's — the preview scales before the table runs out of its column */
170
+ ...(row.previewWidth ? { width: '100%', maxWidth: row.previewWidth } : {}),
160
171
  }
161
172
 
162
173
  if (!onZoom) {
package/src/TypeBlock.jsx CHANGED
@@ -1,4 +1,4 @@
1
- import { familyFor } from './typographyCuts'
1
+ import { familyFor } from './typographyCuts.js'
2
2
 
3
3
  /**
4
4
  * TypeBlock — typography specimen primitive.