@scalewing/react 1.41.0 → 1.44.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.
Files changed (136) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +180 -1
  3. package/dist/components/ActionMenu.d.ts +4 -2
  4. package/dist/components/ActionMenu.js +4 -8
  5. package/dist/components/Article.d.ts +60 -0
  6. package/dist/components/Article.js +42 -0
  7. package/dist/components/DescriptionList.d.ts +12 -2
  8. package/dist/components/DescriptionList.js +7 -3
  9. package/dist/components/DocumentViewer.d.ts +41 -0
  10. package/dist/components/DocumentViewer.js +72 -0
  11. package/dist/components/FileField.d.ts +55 -0
  12. package/dist/components/FileField.js +75 -0
  13. package/dist/components/FilterChips.d.ts +1 -1
  14. package/dist/components/FilterChips.js +1 -1
  15. package/dist/components/FilterChipsRow.d.ts +24 -0
  16. package/dist/components/FilterChipsRow.js +14 -0
  17. package/dist/components/ListRow.d.ts +31 -2
  18. package/dist/components/ListRow.js +19 -18
  19. package/dist/components/MarkdownView.d.ts +39 -0
  20. package/dist/components/MarkdownView.js +30 -0
  21. package/dist/components/NavCount.d.ts +15 -2
  22. package/dist/components/NavCount.js +16 -6
  23. package/dist/components/action-menu/assert-action-menu.d.ts +13 -0
  24. package/dist/components/action-menu/assert-action-menu.js +21 -0
  25. package/dist/components/chart/use-chart-width.js +2 -24
  26. package/dist/components/description-list-layout.d.ts +10 -0
  27. package/dist/components/description-list-layout.js +13 -0
  28. package/dist/components/document-viewer/document-viewer-labels.d.ts +23 -0
  29. package/dist/components/document-viewer/document-viewer-labels.js +23 -0
  30. package/dist/components/document-viewer/page-box.d.ts +8 -0
  31. package/dist/components/document-viewer/page-box.js +12 -0
  32. package/dist/components/document-viewer/pdf-document.d.ts +32 -0
  33. package/dist/components/document-viewer/pdf-document.js +66 -0
  34. package/dist/components/document-viewer/pdf-options.d.ts +36 -0
  35. package/dist/components/document-viewer/pdf-options.js +46 -0
  36. package/dist/components/document-viewer/render-pdf-page.d.ts +20 -0
  37. package/dist/components/document-viewer/render-pdf-page.js +38 -0
  38. package/dist/components/document-viewer/scroll-chain.d.ts +6 -0
  39. package/dist/components/document-viewer/scroll-chain.js +23 -0
  40. package/dist/components/document-viewer/use-error-report.d.ts +5 -0
  41. package/dist/components/document-viewer/use-error-report.js +13 -0
  42. package/dist/components/document-viewer/use-page-render.d.ts +21 -0
  43. package/dist/components/document-viewer/use-page-render.js +70 -0
  44. package/dist/components/document-viewer/use-pdf-document.d.ts +22 -0
  45. package/dist/components/document-viewer/use-pdf-document.js +47 -0
  46. package/dist/components/document-viewer/use-pinch-zoom.d.ts +12 -0
  47. package/dist/components/document-viewer/use-pinch-zoom.js +67 -0
  48. package/dist/components/document-viewer/use-zoom.d.ts +23 -0
  49. package/dist/components/document-viewer/use-zoom.js +70 -0
  50. package/dist/components/document-viewer/zoom.d.ts +29 -0
  51. package/dist/components/document-viewer/zoom.js +37 -0
  52. package/dist/components/file-field/file-field-checks.d.ts +13 -0
  53. package/dist/components/file-field/file-field-checks.js +23 -0
  54. package/dist/components/file-field/use-file-drop.d.ts +34 -0
  55. package/dist/components/file-field/use-file-drop.js +78 -0
  56. package/dist/components/file-field/use-swap-focus.d.ts +15 -0
  57. package/dist/components/file-field/use-swap-focus.js +40 -0
  58. package/dist/components/filter-chips/FilterChip.js +1 -1
  59. package/dist/components/filter-chips/options.d.ts +10 -0
  60. package/dist/components/filter-chips/options.js +8 -0
  61. package/dist/components/filter-chips/validate.d.ts +3 -3
  62. package/dist/components/filter-chips/validate.js +8 -4
  63. package/dist/components/list/ListRowContent.d.ts +9 -2
  64. package/dist/components/list/ListRowContent.js +6 -3
  65. package/dist/components/list/ListRowItem.d.ts +10 -0
  66. package/dist/components/list/ListRowItem.js +17 -0
  67. package/dist/components/list/row-naming.d.ts +17 -0
  68. package/dist/components/list/row-naming.js +19 -0
  69. package/dist/components/markdown/markdown-limits.d.ts +14 -0
  70. package/dist/components/markdown/markdown-limits.js +14 -0
  71. package/dist/components/markdown/markdown-model.d.ts +94 -0
  72. package/dist/components/markdown/markdown-model.js +8 -0
  73. package/dist/components/markdown/markdown-options.d.ts +18 -0
  74. package/dist/components/markdown/markdown-options.js +10 -0
  75. package/dist/components/markdown/markdown-rules.d.ts +28 -0
  76. package/dist/components/markdown/markdown-rules.js +81 -0
  77. package/dist/components/markdown/markdown-text.d.ts +17 -0
  78. package/dist/components/markdown/markdown-text.js +86 -0
  79. package/dist/components/markdown/parse-markdown.d.ts +4 -0
  80. package/dist/components/markdown/parse-markdown.js +21 -0
  81. package/dist/components/markdown/read-blocks.d.ts +8 -0
  82. package/dist/components/markdown/read-blocks.js +168 -0
  83. package/dist/components/markdown/read-inlines.d.ts +12 -0
  84. package/dist/components/markdown/read-inlines.js +126 -0
  85. package/dist/components/markdown/read-markdown.d.ts +9 -0
  86. package/dist/components/markdown/read-markdown.js +27 -0
  87. package/dist/components/markdown/reading-context.d.ts +18 -0
  88. package/dist/components/markdown/reading-context.js +35 -0
  89. package/dist/components/markdown/render-markdown.d.ts +10 -0
  90. package/dist/components/markdown/render-markdown.js +52 -0
  91. package/dist/components/slot.d.ts +9 -0
  92. package/dist/components/slot.js +13 -0
  93. package/dist/components/use-element-width.d.ts +11 -0
  94. package/dist/components/use-element-width.js +38 -0
  95. package/dist/css/css-action-menu-trigger.d.ts +6 -2
  96. package/dist/css/css-action-menu-trigger.js +50 -2
  97. package/dist/css/css-action-menu.js +4 -2
  98. package/dist/css/css-article.d.ts +2 -0
  99. package/dist/css/css-article.js +110 -0
  100. package/dist/css/css-components.js +15 -0
  101. package/dist/css/css-count-pill.js +14 -1
  102. package/dist/css/css-description-list.d.ts +1 -0
  103. package/dist/css/css-description-list.js +24 -0
  104. package/dist/css/css-document-viewer.d.ts +2 -0
  105. package/dist/css/css-document-viewer.js +186 -0
  106. package/dist/css/css-file-field.d.ts +2 -0
  107. package/dist/css/css-file-field.js +194 -0
  108. package/dist/css/css-filter-chip-tones.d.ts +3 -0
  109. package/dist/css/css-filter-chip-tones.js +28 -0
  110. package/dist/css/css-filter-chips-layout.d.ts +1 -0
  111. package/dist/css/css-filter-chips-layout.js +1 -1
  112. package/dist/css/css-filter-chips-row.d.ts +2 -0
  113. package/dist/css/css-filter-chips-row.js +79 -0
  114. package/dist/css/css-filter-chips.js +8 -0
  115. package/dist/css/css-font-mono.d.ts +3 -0
  116. package/dist/css/css-font-mono.js +23 -0
  117. package/dist/css/css-list-row-trailing.d.ts +2 -0
  118. package/dist/css/css-list-row-trailing.js +91 -0
  119. package/dist/css/css-list-row-truncate.d.ts +2 -0
  120. package/dist/css/css-list-row-truncate.js +29 -0
  121. package/dist/css/css-list.js +9 -1
  122. package/dist/css/css-markdown.d.ts +2 -0
  123. package/dist/css/css-markdown.js +144 -0
  124. package/dist/css/css-utilities.js +3 -0
  125. package/dist/css/css-variables.js +1 -0
  126. package/dist/css/spacing-classes.d.ts +1 -1
  127. package/dist/css/spacing-classes.js +1 -0
  128. package/dist/css/stylesheet.js +10 -0
  129. package/dist/document-viewer-worker.d.ts +9 -0
  130. package/dist/document-viewer-worker.js +9 -0
  131. package/dist/index.d.ts +11 -5
  132. package/dist/index.js +8 -3
  133. package/dist/list-options.d.ts +5 -2
  134. package/dist/list-options.js +7 -2
  135. package/dist/styles.css +649 -0
  136. package/package.json +10 -2
@@ -0,0 +1,91 @@
1
+ import { quietFill } from './quiet-fill.js';
2
+ /*
3
+ * The unread dot: an accent circle a space-2 across after the title's last
4
+ * word, on its line. It is drawn as a border, so forced colours keep it
5
+ * (in the text colour); the hidden words beside the title say what it is.
6
+ * Centred on the words' middle, as an inline mark.
7
+ */
8
+ function unreadRules() {
9
+ return `.sw-list-row-unread {
10
+ border: calc(var(--sw-space-2) / 2) solid var(--sw-color-accent);
11
+ border-radius: var(--sw-radius-pill);
12
+ box-sizing: border-box;
13
+ display: inline-block;
14
+ height: var(--sw-space-2);
15
+ margin-inline-start: var(--sw-space-2);
16
+ vertical-align: middle;
17
+ width: var(--sw-space-2);
18
+ }
19
+
20
+ @media (forced-colors: active) {
21
+ .sw-list-row-unread { border-color: CanvasText; }
22
+ }`;
23
+ }
24
+ /*
25
+ * The tag (a Badge, "Only in English") sits before the accessory, centred
26
+ * on the row's height and never shrunk or wrapped.
27
+ */
28
+ function tagRules() {
29
+ return `.sw-list-row-tag {
30
+ align-self: center;
31
+ display: inline-flex;
32
+ flex: none;
33
+ white-space: nowrap;
34
+ }`;
35
+ }
36
+ /*
37
+ * A row with an action is the row's button or link followed by the
38
+ * action's control in one list item, the control centred on the row's
39
+ * height after it and outside its press area. The row ends a space-2
40
+ * before the control, and the control keeps the row's inline end padding
41
+ * after it (a space-4 in a panel, none in a plain list). Where :has() is
42
+ * supported, the hover fill spans the whole item, so the row and its
43
+ * control read as one line; elsewhere the row keeps its own fill.
44
+ */
45
+ function actionRules() {
46
+ return `.sw-list-item-action {
47
+ align-items: center;
48
+ display: flex;
49
+ }
50
+
51
+ .sw-list-item-action > .sw-list-row {
52
+ flex: 1 1 auto;
53
+ min-width: 0;
54
+ padding-inline-end: var(--sw-space-2);
55
+ }
56
+
57
+ .sw-list-row-action {
58
+ display: inline-flex;
59
+ flex: none;
60
+ padding-inline-end: var(--sw-space-4);
61
+ }
62
+
63
+ .sw-list-group-plain .sw-list-row-action { padding-inline-end: 0; }
64
+
65
+ @supports selector(:has(*)) {
66
+ @media (hover: hover) {
67
+ .sw-list-item-action:has(> .sw-list-row-pressable:hover:not(.sw-list-row-disabled)) {
68
+ background: ${quietFill};
69
+ }
70
+
71
+ .sw-list-item-action > .sw-list-row-pressable:hover:not(.sw-list-row-disabled) {
72
+ background: transparent;
73
+ }
74
+ }
75
+ }`;
76
+ }
77
+ export function cssListRowTrailingClasses() {
78
+ return `${unreadRules()}
79
+
80
+ ${tagRules()}
81
+
82
+ ${actionRules()}`;
83
+ }
84
+ export function listRowTrailingClassCatalog() {
85
+ return [
86
+ 'sw-list-row-unread',
87
+ 'sw-list-row-tag',
88
+ 'sw-list-item-action',
89
+ 'sw-list-row-action',
90
+ ];
91
+ }
@@ -0,0 +1,2 @@
1
+ export declare function cssListRowTruncateClasses(): string;
2
+ export declare function listRowTruncateClassCatalog(): string[];
@@ -0,0 +1,29 @@
1
+ /*
2
+ * A truncated row keeps its title and its detail to one line each, cut
3
+ * with "…" where they do not fit. The title's words sit in their own box
4
+ * (`sw-list-row-title-text`) beside the unread dot, so the cut never hides
5
+ * the dot; the title is a one-line flex row centring them. The label
6
+ * column already shrinks (`min-width: 0`), so the value, the tag and the
7
+ * action keep their place and their words whole.
8
+ */
9
+ export function cssListRowTruncateClasses() {
10
+ return `.sw-list-row-truncate .sw-list-row-title {
11
+ align-items: center;
12
+ display: flex;
13
+ min-width: 0;
14
+ }
15
+
16
+ .sw-list-row-truncate .sw-list-row-unread { flex: none; }
17
+
18
+ .sw-list-row-truncate .sw-list-row-title-text,
19
+ .sw-list-row-truncate .sw-list-row-detail {
20
+ min-width: 0;
21
+ overflow: hidden;
22
+ overflow-wrap: normal;
23
+ text-overflow: ellipsis;
24
+ white-space: nowrap;
25
+ }`;
26
+ }
27
+ export function listRowTruncateClassCatalog() {
28
+ return ['sw-list-row-truncate', 'sw-list-row-title-text'];
29
+ }
@@ -1,5 +1,7 @@
1
1
  import { typographyVariants } from '@scalewing/tokens';
2
2
  import { cssListRowClasses, listRowClassCatalog } from './css-list-row.js';
3
+ import { cssListRowTrailingClasses, listRowTrailingClassCatalog, } from './css-list-row-trailing.js';
4
+ import { cssListRowTruncateClasses, listRowTruncateClassCatalog, } from './css-list-row-truncate.js';
3
5
  import { blockEdgeShadeRules, scrollRegionRules } from './css-scroll-region.js';
4
6
  const label = typographyVariants.label;
5
7
  const caption = typographyVariants.caption;
@@ -69,7 +71,11 @@ export function cssListClasses() {
69
71
 
70
72
  ${boundedRules()}
71
73
 
72
- ${cssListRowClasses()}`;
74
+ ${cssListRowClasses()}
75
+
76
+ ${cssListRowTrailingClasses()}
77
+
78
+ ${cssListRowTruncateClasses()}`;
73
79
  }
74
80
  export function listClassCatalog() {
75
81
  return [
@@ -81,5 +87,7 @@ export function listClassCatalog() {
81
87
  'sw-list-group-scroll',
82
88
  'sw-list-group-footer',
83
89
  ...listRowClassCatalog(),
90
+ ...listRowTrailingClassCatalog(),
91
+ ...listRowTruncateClassCatalog(),
84
92
  ];
85
93
  }
@@ -0,0 +1,2 @@
1
+ export declare function cssMarkdownClasses(): string;
2
+ export declare function markdownClassCatalog(): string[];
@@ -0,0 +1,144 @@
1
+ import { typographyVariants } from '@scalewing/tokens';
2
+ const { body, title, label, caption } = typographyVariants;
3
+ /*
4
+ * A page of Markdown in body type: blocks a space-4 apart, a heading a
5
+ * space-6 below what comes before it and a space-2 above what follows.
6
+ * `#` is the title size, `##` body size and `###` label size, all at the
7
+ * title's weight. At zero specificity (`:where`), so a consumer's layout
8
+ * can still space the view itself.
9
+ */
10
+ function flowRules() {
11
+ return `.sw-markdown {
12
+ color: var(--sw-color-text);
13
+ font-family: var(--sw-font-sans);
14
+ font-size: ${body.fontSize}px;
15
+ letter-spacing: ${body.letterSpacing}px;
16
+ line-height: ${body.lineHeight}px;
17
+ overflow-wrap: anywhere;
18
+ }
19
+
20
+ :where(.sw-markdown) > *,
21
+ :where(.sw-markdown-quote) > *,
22
+ :where(.sw-markdown-list li) > * { margin-block: 0; }
23
+
24
+ :where(.sw-markdown, .sw-markdown-quote, .sw-markdown-list li) > * + * {
25
+ margin-block-start: var(--sw-space-4);
26
+ }
27
+
28
+ :where(.sw-markdown) > * + .sw-markdown-heading { margin-block-start: var(--sw-space-6); }
29
+ :where(.sw-markdown) > .sw-markdown-heading + * { margin-block-start: var(--sw-space-2); }
30
+
31
+ .sw-markdown-heading {
32
+ color: var(--sw-color-text);
33
+ font-weight: ${title.fontWeight};
34
+ scroll-margin-block-start: var(--sw-space-6);
35
+ }
36
+
37
+ .sw-markdown-heading-1 {
38
+ font-size: ${title.fontSize}px;
39
+ letter-spacing: ${title.letterSpacing}px;
40
+ line-height: ${title.lineHeight}px;
41
+ }
42
+
43
+ .sw-markdown-heading-2 {
44
+ font-size: ${body.fontSize}px;
45
+ line-height: ${body.lineHeight}px;
46
+ }
47
+
48
+ .sw-markdown-heading-3 {
49
+ font-size: ${label.fontSize}px;
50
+ letter-spacing: ${label.letterSpacing}px;
51
+ line-height: ${label.lineHeight}px;
52
+ }`;
53
+ }
54
+ /*
55
+ * Lists hang their markers in the page's margin a space-5 in; a tight
56
+ * list's items are a space-2 apart. A link is the accent, underlined, so
57
+ * it never depends on colour alone, and thickens to the focus ring's
58
+ * width while hovered. In the highlighted box, whose tint neither the
59
+ * accent nor the muted colour clears at 4.5:1 in every palette, links
60
+ * (still underlined) and photo captions are the text colour.
61
+ */
62
+ function inlineRules() {
63
+ return `.sw-markdown-list {
64
+ padding-inline-start: var(--sw-space-5);
65
+ }
66
+
67
+ .sw-markdown-list > li + li { margin-block-start: var(--sw-space-2); }
68
+
69
+ [data-theme] .sw-markdown-link {
70
+ color: var(--sw-color-accent);
71
+ text-decoration-line: underline;
72
+ }
73
+
74
+ [data-theme] .sw-markdown-link:hover {
75
+ text-decoration-thickness: var(--sw-focus-ring-width);
76
+ }
77
+
78
+ [data-theme] .sw-markdown-quote :is(.sw-markdown-link, .sw-markdown-caption) {
79
+ color: var(--sw-color-text);
80
+ }`;
81
+ }
82
+ /*
83
+ * A block quote is the highlighted box: the accent's subtle tint with an
84
+ * accent bar at its start, at the small radius. A photo fills the page's
85
+ * width at the medium radius, its caption muted under it.
86
+ */
87
+ function boxRules() {
88
+ return `.sw-markdown-quote {
89
+ background: var(--sw-color-accentSubtle);
90
+ border-inline-start: var(--sw-space-1) solid var(--sw-color-accent);
91
+ border-radius: var(--sw-radius-sm);
92
+ margin-inline: 0;
93
+ padding: var(--sw-space-3) var(--sw-space-4);
94
+ }
95
+
96
+ .sw-markdown-figure {
97
+ display: flex;
98
+ flex-direction: column;
99
+ gap: var(--sw-space-2);
100
+ margin-inline: 0;
101
+ }
102
+
103
+ .sw-markdown-image {
104
+ border-radius: var(--sw-radius-md);
105
+ display: block;
106
+ height: auto;
107
+ width: 100%;
108
+ }
109
+
110
+ .sw-markdown-caption {
111
+ color: var(--sw-color-muted);
112
+ font-size: ${caption.fontSize}px;
113
+ letter-spacing: ${caption.letterSpacing}px;
114
+ line-height: ${caption.lineHeight}px;
115
+ }
116
+
117
+ @media (forced-colors: active) {
118
+ .sw-markdown-quote { border: 1px solid CanvasText; border-inline-start-width: var(--sw-space-1); }
119
+ }`;
120
+ }
121
+ export function cssMarkdownClasses() {
122
+ return `${flowRules()}
123
+
124
+ ${inlineRules()}
125
+
126
+ ${boxRules()}`;
127
+ }
128
+ export function markdownClassCatalog() {
129
+ return [
130
+ 'sw-markdown',
131
+ 'sw-markdown-paragraph',
132
+ 'sw-markdown-heading',
133
+ 'sw-markdown-heading-1',
134
+ 'sw-markdown-heading-2',
135
+ 'sw-markdown-heading-3',
136
+ 'sw-markdown-list',
137
+ 'sw-markdown-item-text',
138
+ 'sw-markdown-link',
139
+ 'sw-markdown-quote',
140
+ 'sw-markdown-figure',
141
+ 'sw-markdown-image',
142
+ 'sw-markdown-caption',
143
+ ];
144
+ }
@@ -41,6 +41,9 @@ const layoutRules = {
41
41
  'sw-grow': '.sw-grow { flex-grow: 1; }',
42
42
  'sw-full-width': '.sw-full-width { width: 100%; }',
43
43
  'sw-container': '.sw-container { width: 100%; max-width: var(--sw-container-max); margin-inline: auto; }',
44
+ // A narrower centred column at the reading width (Article's), for a
45
+ // form or text that reads better than it would across the container.
46
+ 'sw-container-reading': '.sw-container-reading { width: 100%; max-width: var(--sw-reading-max); margin-inline: auto; }',
44
47
  'sw-sr-only': `.sw-sr-only { ${visuallyHiddenDeclarations} }`,
45
48
  'sw-align-start': '.sw-align-start { align-items: flex-start; }',
46
49
  'sw-align-center': '.sw-align-center { align-items: center; }',
@@ -47,6 +47,7 @@ ${control}
47
47
  --sw-dialog-max: 32rem;
48
48
  --sw-dialog-max-lg: 56rem;
49
49
  --sw-dialog-max-xl: 65rem;
50
+ --sw-reading-max: 46rem;
50
51
  --sw-select-max: 16rem;
51
52
  --sw-split-min: ${splitScale.min}rem;
52
53
  --sw-split-size: ${splitScale.size}rem;
@@ -7,4 +7,4 @@ export type SpacingKind = 'padding' | 'gap';
7
7
  export declare function spacingClass(kind: SpacingKind, axis: PaddingAxis | GapAxis, step: SpacingStep): string;
8
8
  export declare function paddingClassNames(): string[];
9
9
  export declare function gapClassNames(): string[];
10
- export declare const layoutClassNames: readonly ["sw-stack", "sw-inline", "sw-wrap", "sw-grow", "sw-full-width", "sw-container", "sw-sr-only", "sw-align-start", "sw-align-center", "sw-align-end", "sw-align-stretch", "sw-justify-start", "sw-justify-center", "sw-justify-end", "sw-justify-between"];
10
+ export declare const layoutClassNames: readonly ["sw-stack", "sw-inline", "sw-wrap", "sw-grow", "sw-full-width", "sw-container", "sw-container-reading", "sw-sr-only", "sw-align-start", "sw-align-center", "sw-align-end", "sw-align-stretch", "sw-justify-start", "sw-justify-center", "sw-justify-end", "sw-justify-between"];
@@ -28,6 +28,7 @@ export const layoutClassNames = [
28
28
  'sw-grow',
29
29
  'sw-full-width',
30
30
  'sw-container',
31
+ 'sw-container-reading',
31
32
  'sw-sr-only',
32
33
  'sw-align-start',
33
34
  'sw-align-center',
@@ -7,7 +7,11 @@ import { switchClassCatalog } from './css-switch.js';
7
7
  import { dateFieldClassCatalog } from './css-date-field.js';
8
8
  import { calendarButtonClassCatalog } from './css-calendar-button.js';
9
9
  import { dateRangeClassCatalog } from './css-date-range.js';
10
+ import { fileFieldClassCatalog } from './css-file-field.js';
11
+ import { articleClassCatalog } from './css-article.js';
12
+ import { documentViewerClassCatalog } from './css-document-viewer.js';
10
13
  import { listClassCatalog } from './css-list.js';
14
+ import { markdownClassCatalog } from './css-markdown.js';
11
15
  import { countPillClassCatalog } from './css-count-pill.js';
12
16
  import { checkboxClassCatalog } from './css-checkbox.js';
13
17
  import { radioGroupClassCatalog } from './css-radio-group.js';
@@ -23,6 +27,7 @@ import { descriptionListClassCatalog } from './css-description-list.js';
23
27
  import { tabsClassCatalog } from './css-tabs.js';
24
28
  import { responsiveClassCatalog } from './css-responsive.js';
25
29
  import { filterChipsClassCatalog } from './css-filter-chips.js';
30
+ import { fontMonoClassCatalog } from './css-font-mono.js';
26
31
  import { gridClassCatalog } from './css-grid.js';
27
32
  import { gridSpanClassCatalog } from './css-grid-span.js';
28
33
  import { denominationGridClassCatalog } from './css-denomination-grid.js';
@@ -104,6 +109,10 @@ export function utilityClassCatalog() {
104
109
  ...calendarButtonClassCatalog(),
105
110
  ...dateRangeClassCatalog(),
106
111
  ...listClassCatalog(),
112
+ ...fileFieldClassCatalog(),
113
+ ...articleClassCatalog(),
114
+ ...documentViewerClassCatalog(),
115
+ ...markdownClassCatalog(),
107
116
  ...countPillClassCatalog(),
108
117
  ...checkboxClassCatalog(),
109
118
  ...radioGroupClassCatalog(),
@@ -118,6 +127,7 @@ export function utilityClassCatalog() {
118
127
  ...descriptionListClassCatalog(),
119
128
  ...tabsClassCatalog(),
120
129
  ...filterChipsClassCatalog(),
130
+ ...fontMonoClassCatalog(),
121
131
  ...gridClassCatalog(),
122
132
  ...gridSpanClassCatalog(),
123
133
  ...denominationGridClassCatalog(),
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The PDF.js worker for `DocumentViewer`, at the exact PDF.js version
3
+ * Scalewing pins and from the same legacy build: a module worker entry
4
+ * that starts PDF.js's worker on import. A consumer bundles it as a worker
5
+ * and passes its URL as `workerSrc`, such as Vite's
6
+ * `import workerSrc from '@scalewing/react/document-viewer-worker?worker&url'`,
7
+ * so the viewer and its worker are always the same version.
8
+ */
9
+ import 'pdfjs-dist/legacy/build/pdf.worker.min.mjs';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The PDF.js worker for `DocumentViewer`, at the exact PDF.js version
3
+ * Scalewing pins and from the same legacy build: a module worker entry
4
+ * that starts PDF.js's worker on import. A consumer bundles it as a worker
5
+ * and passes its URL as `workerSrc`, such as Vite's
6
+ * `import workerSrc from '@scalewing/react/document-viewer-worker?worker&url'`,
7
+ * so the viewer and its worker are always the same version.
8
+ */
9
+ import 'pdfjs-dist/legacy/build/pdf.worker.min.mjs';
package/dist/index.d.ts CHANGED
@@ -6,7 +6,11 @@ export { Switch, switchCheckedTones, switchLayouts, type SwitchCheckedTone, type
6
6
  export { DateField, dateFieldEntries, type DateFieldEntry, type DateFieldLabels, type DateFieldProps, type WeekStart, } from './components/DateField.js';
7
7
  export { CalendarButton, type CalendarButtonLabels, type CalendarButtonProps, type CalendarButtonRange, } from './components/CalendarButton.js';
8
8
  export { DateRangeButton, type DateRangeButtonLabels, type DateRangeButtonProps, type DateRangeButtonValue, type DateRangePreset, } from './components/DateRangeButton.js';
9
+ export { Article, articleTitleElements, type ArticleCover, type ArticleProps, type ArticleTitleElement, } from './components/Article.js';
10
+ export { FileField, type FileFieldProps, type FileFieldValue, } from './components/FileField.js';
11
+ export { DocumentViewer, type DocumentViewerLabels, type DocumentViewerProps, } from './components/DocumentViewer.js';
9
12
  export { ListGroup, type ListGroupProps } from './components/ListGroup.js';
13
+ export { inspectMarkdown, markdownOmissionKinds, MarkdownView, type MarkdownHeading, type MarkdownInspection, type MarkdownImage, type MarkdownImageResolver, type MarkdownOmission, type MarkdownOmissionCounts, type MarkdownOmissionKind, type MarkdownOptions, type MarkdownViewProps, } from './components/MarkdownView.js';
10
14
  export { ListRow, type ListRowProps } from './components/ListRow.js';
11
15
  export { listGroupVariants, listRowTitleAppearances, listRowTones, listRowValueTones, type ListGroupMaxHeight, type ListGroupVariant, type ListRowTitleAppearance, type ListRowTone, type ListRowValueTone, } from './list-options.js';
12
16
  export { Checkbox, type CheckboxProps } from './components/Checkbox.js';
@@ -45,7 +49,7 @@ export { Inline, type InlineProps } from './components/Inline.js';
45
49
  export { Split } from './components/Split.js';
46
50
  export type { SplitProps } from './components/Split.js';
47
51
  export { Nav, navAppearances, type NavAppearance, type NavProps, } from './components/Nav.js';
48
- export { NavCount, type NavCountProps } from './components/NavCount.js';
52
+ export { NavCount, navCountTones, type NavCountProps, type NavCountTone, } from './components/NavCount.js';
49
53
  export { SectionNav, sectionNavAppearances, type SectionNavAppearance, type SectionNavItem, type SectionNavProps, } from './components/SectionNav.js';
50
54
  export { SegmentedControl, type SegmentedControlProps, type SegmentedControlVariant, segmentedSizes, type SegmentedSize, type SegmentedItem, } from './components/SegmentedControl.js';
51
55
  export { Combobox, comboboxSizes, type ComboboxAction, type ComboboxBadge, type ComboboxGroup, type ComboboxOption, type ComboboxProps, type ComboboxSize, } from './components/Combobox.js';
@@ -63,13 +67,15 @@ export type { Breakpoint, BreakpointDirection, VisibilityBreakpoint, } from './c
63
67
  export { breakpointQuery } from './css/breakpoints.js';
64
68
  export { Separator } from './components/Separator.js';
65
69
  export type { SeparatorOrientation, SeparatorProps, } from './components/Separator.js';
66
- export { DescriptionItem, DescriptionList, } from './components/DescriptionList.js';
67
- export type { DescriptionItemProps, DescriptionListProps, } from './components/DescriptionList.js';
70
+ export { DescriptionItem, DescriptionList, descriptionListLayouts, } from './components/DescriptionList.js';
71
+ export type { DescriptionItemProps, DescriptionListLayout, DescriptionListProps, } from './components/DescriptionList.js';
68
72
  export { Grid } from './components/Grid.js';
69
73
  export type { GridColumns, GridProps } from './components/Grid.js';
70
74
  export type { GridColumnSpan } from './css/css-grid-span.js';
71
75
  export type { ColumnSpanProps } from './column-span-classes.js';
72
76
  export { DenominationGrid, denominationCellToneAppearances, denominationGridFrames, denominationLabelAppearances, denominationNegativeAppearances, denominationTotalEmphases, denominationTransposeBreakpoints, } from './components/DenominationGrid.js';
73
77
  export type { DenominationCellToneAppearance, DenominationGridColumn, DenominationGridEntry, DenominationGridFrame, DenominationGridLayout, DenominationGridNegativeAppearance, DenominationGridProps, DenominationGridRow, DenominationGridRowEmphasis, DenominationGridRowRole, DenominationGridTone, DenominationGridValueRow, DenominationLabelAppearance, DenominationLabelWidth, DenominationTotalEmphasis, DenominationTransposeBreakpoint, } from './components/DenominationGrid.js';
74
- export { FilterChips, filterChipCountAppearances, filterChipsOverflows, } from './components/FilterChips.js';
75
- export type { FilterChipCountAppearance, FilterChipOption, FilterChipsOverflow, FilterChipsProps, } from './components/FilterChips.js';
78
+ export { FilterChips, filterChipCountAppearances, filterChipsOverflows, filterChipTones, } from './components/FilterChips.js';
79
+ export { FilterChipsRow } from './components/FilterChipsRow.js';
80
+ export type { FilterChipsRowProps } from './components/FilterChipsRow.js';
81
+ export type { FilterChipCountAppearance, FilterChipOption, FilterChipsOverflow, FilterChipsProps, FilterChipTone, } from './components/FilterChips.js';
package/dist/index.js CHANGED
@@ -5,7 +5,11 @@ export { Switch, switchCheckedTones, switchLayouts, } from './components/Switch.
5
5
  export { DateField, dateFieldEntries, } from './components/DateField.js';
6
6
  export { CalendarButton, } from './components/CalendarButton.js';
7
7
  export { DateRangeButton, } from './components/DateRangeButton.js';
8
+ export { Article, articleTitleElements, } from './components/Article.js';
9
+ export { FileField, } from './components/FileField.js';
10
+ export { DocumentViewer, } from './components/DocumentViewer.js';
8
11
  export { ListGroup } from './components/ListGroup.js';
12
+ export { inspectMarkdown, markdownOmissionKinds, MarkdownView, } from './components/MarkdownView.js';
9
13
  export { ListRow } from './components/ListRow.js';
10
14
  export { listGroupVariants, listRowTitleAppearances, listRowTones, listRowValueTones, } from './list-options.js';
11
15
  export { Checkbox } from './components/Checkbox.js';
@@ -42,7 +46,7 @@ export { Stepper, stepperLimitAppearances, } from './components/Stepper.js';
42
46
  export { Inline } from './components/Inline.js';
43
47
  export { Split } from './components/Split.js';
44
48
  export { Nav, navAppearances, } from './components/Nav.js';
45
- export { NavCount } from './components/NavCount.js';
49
+ export { NavCount, navCountTones, } from './components/NavCount.js';
46
50
  export { SectionNav, sectionNavAppearances, } from './components/SectionNav.js';
47
51
  export { SegmentedControl, segmentedSizes, } from './components/SegmentedControl.js';
48
52
  export { Combobox, comboboxSizes, } from './components/Combobox.js';
@@ -56,7 +60,8 @@ export { themeCanvases } from './css/css-canvas-grouped.js';
56
60
  export { utilityClassCatalog } from './css/stylesheet.js';
57
61
  export { breakpointQuery } from './css/breakpoints.js';
58
62
  export { Separator } from './components/Separator.js';
59
- export { DescriptionItem, DescriptionList, } from './components/DescriptionList.js';
63
+ export { DescriptionItem, DescriptionList, descriptionListLayouts, } from './components/DescriptionList.js';
60
64
  export { Grid } from './components/Grid.js';
61
65
  export { DenominationGrid, denominationCellToneAppearances, denominationGridFrames, denominationLabelAppearances, denominationNegativeAppearances, denominationTotalEmphases, denominationTransposeBreakpoints, } from './components/DenominationGrid.js';
62
- export { FilterChips, filterChipCountAppearances, filterChipsOverflows, } from './components/FilterChips.js';
66
+ export { FilterChips, filterChipCountAppearances, filterChipsOverflows, filterChipTones, } from './components/FilterChips.js';
67
+ export { FilterChipsRow } from './components/FilterChipsRow.js';
@@ -50,13 +50,16 @@ export type ListRowInput = {
50
50
  valueBadge: BadgeTone | undefined;
51
51
  selected: boolean | undefined;
52
52
  pressable: boolean;
53
+ unread: boolean;
54
+ unreadLabel: string | undefined;
53
55
  };
54
56
  /**
55
57
  * Fails closed on a ListRow it cannot draw: an empty title or value, an
56
58
  * unknown tone, title appearance, value tone, badge tone or accessory, a
57
59
  * `valueDetail`, `valueTone` or `valueBadge` with no value, a value both
58
- * toned and a badge, or `selected` on a row that is not a button or link
59
- * (its check would be a state nothing can read).
60
+ * toned and a badge, `selected` on a row that is not a button or link
61
+ * (its check would be a state nothing can read), or an unread row with no
62
+ * words for its dot (a colour alone says nothing).
60
63
  */
61
64
  export declare function assertListRow(input: ListRowInput): void;
62
65
  /**
@@ -41,8 +41,9 @@ export function listMaxHeightStyle(maxHeight) {
41
41
  * Fails closed on a ListRow it cannot draw: an empty title or value, an
42
42
  * unknown tone, title appearance, value tone, badge tone or accessory, a
43
43
  * `valueDetail`, `valueTone` or `valueBadge` with no value, a value both
44
- * toned and a badge, or `selected` on a row that is not a button or link
45
- * (its check would be a state nothing can read).
44
+ * toned and a badge, `selected` on a row that is not a button or link
45
+ * (its check would be a state nothing can read), or an unread row with no
46
+ * words for its dot (a colour alone says nothing).
46
47
  */
47
48
  export function assertListRow(input) {
48
49
  if (isBlank(input.title))
@@ -62,6 +63,10 @@ export function assertListRow(input) {
62
63
  throw new RangeError('A ListRow value is a toned figure or a badge, not both');
63
64
  if (input.value !== undefined && isBlank(input.value))
64
65
  throw new RangeError('ListRow value must be non-empty text');
66
+ if (input.unreadLabel !== undefined && isBlank(input.unreadLabel))
67
+ throw new RangeError('ListRow unreadLabel must be non-empty text');
68
+ if (input.unread && input.unreadLabel === undefined)
69
+ throw new RangeError('An unread ListRow needs an unreadLabel to say so');
65
70
  if (input.selected !== undefined && !input.pressable)
66
71
  throw new RangeError('A ListRow choice (selected) needs onPress or href to say its state');
67
72
  if (input.value === undefined &&