@vit-foundation/ui 0.23.0 → 0.24.1
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/dist/components/admin/Sidebar.svelte +11 -21
- package/dist/components/layout/PageShell.svelte +5 -4
- package/dist/components/layout/PageShell.svelte.d.ts +3 -3
- package/dist/contract.d.ts +5 -0
- package/dist/contract.js +5 -0
- package/dist/utils/document-title.d.ts +22 -0
- package/dist/utils/document-title.js +27 -0
- package/package.json +3 -2
|
@@ -95,7 +95,15 @@
|
|
|
95
95
|
box-shadow: var(--shadow-1);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
/*
|
|
99
|
+
* The rail's footprint, and the host's footer control with it — "should sit
|
|
100
|
+
* like an item" was the comment on a second, identical copy of these eleven
|
|
101
|
+
* declarations, and vit-brain had a third on its own logout button. One
|
|
102
|
+
* selector list is the whole rule: a host's footer submit is an item that
|
|
103
|
+
* happens to come from outside.
|
|
104
|
+
*/
|
|
105
|
+
.item,
|
|
106
|
+
.footer :global(button) {
|
|
99
107
|
display: inline-flex;
|
|
100
108
|
align-items: center;
|
|
101
109
|
justify-content: center;
|
|
@@ -109,7 +117,8 @@
|
|
|
109
117
|
transition: background var(--transition-fast);
|
|
110
118
|
}
|
|
111
119
|
|
|
112
|
-
.item:hover
|
|
120
|
+
.item:hover,
|
|
121
|
+
.footer :global(button:hover) {
|
|
113
122
|
background: color-mix(in srgb, var(--color-navy) 10%, transparent);
|
|
114
123
|
}
|
|
115
124
|
|
|
@@ -122,25 +131,6 @@
|
|
|
122
131
|
margin-top: auto;
|
|
123
132
|
}
|
|
124
133
|
|
|
125
|
-
/* The host's footer control (a logout submit) should sit like an item. */
|
|
126
|
-
.footer :global(button) {
|
|
127
|
-
display: inline-flex;
|
|
128
|
-
align-items: center;
|
|
129
|
-
justify-content: center;
|
|
130
|
-
width: 2.4rem;
|
|
131
|
-
height: 2.4rem;
|
|
132
|
-
border-radius: 999px;
|
|
133
|
-
color: var(--color-navy);
|
|
134
|
-
border: none;
|
|
135
|
-
background: transparent;
|
|
136
|
-
cursor: pointer;
|
|
137
|
-
transition: background var(--transition-fast);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.footer :global(button:hover) {
|
|
141
|
-
background: color-mix(in srgb, var(--color-navy) 10%, transparent);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
134
|
@media print {
|
|
145
135
|
.sidebar {
|
|
146
136
|
display: none;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import { getUiConfig } from '../../config/context.js';
|
|
4
|
+
import { documentTitle } from '../../utils/document-title.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The chrome every page shares: the content column, the vertical rhythm,
|
|
7
|
-
* and the browser title
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* and the browser title. The title FORMAT is `documentTitle`'s — the
|
|
9
|
+
* foundation site's error page cannot render through this component and
|
|
10
|
+
* needs the same format, and the two used to spell it separately.
|
|
10
11
|
*
|
|
11
12
|
* The shape is one named variant rather than four presentation flags.
|
|
12
13
|
* Width, spacing, stacking and the wrapper element were independent props,
|
|
@@ -45,7 +46,7 @@
|
|
|
45
46
|
let { title, description, variant = 'content', children }: Props = $props();
|
|
46
47
|
|
|
47
48
|
const config = getUiConfig();
|
|
48
|
-
const pageTitle = $derived(title
|
|
49
|
+
const pageTitle = $derived(documentTitle(title, config.siteName));
|
|
49
50
|
/**
|
|
50
51
|
* The editorial variants render an <article>, and say so to crawlers too.
|
|
51
52
|
* og:type was hardcoded to 'website' while the element already switched,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
/**
|
|
3
3
|
* The chrome every page shares: the content column, the vertical rhythm,
|
|
4
|
-
* and the browser title
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* and the browser title. The title FORMAT is `documentTitle`'s — the
|
|
5
|
+
* foundation site's error page cannot render through this component and
|
|
6
|
+
* needs the same format, and the two used to spell it separately.
|
|
7
7
|
*
|
|
8
8
|
* The shape is one named variant rather than four presentation flags.
|
|
9
9
|
* Width, spacing, stacking and the wrapper element were independent props,
|
package/dist/contract.d.ts
CHANGED
|
@@ -54,6 +54,11 @@ export { COMMENT_BODY, CONTACT_MESSAGE, CONTACT_NAME, DISPLAY_NAME, EMAIL, LOGIN
|
|
|
54
54
|
export { hasNewsletterIntent, HONEYPOT_FIELD, isNewsletterIntent, NEWSLETTER_INTENT_PARAM, NEWSLETTER_INTENT_VALUE, withNewsletterIntent } from './forms/transport.js';
|
|
55
55
|
export type { FormFail, FormFieldIssue, FormResultLike, FormResultOf, KeyedRemoteForms, RemoteField, RemoteFormAttributes, RemoteFormInstance } from './forms/types.js';
|
|
56
56
|
export { buildQueryString, isExternalUrl, isInternalPath } from './utils/paths.js';
|
|
57
|
+
/**
|
|
58
|
+
* The browser-title format. On `./contract` because its second reader is a
|
|
59
|
+
* host's error page, which composes a title without rendering `PageShell`.
|
|
60
|
+
*/
|
|
61
|
+
export { documentTitle } from './utils/document-title.js';
|
|
57
62
|
/**
|
|
58
63
|
* The descriptor factories. `edit/helpers.ts` imports nothing but types from
|
|
59
64
|
* two modules this subpath already anchors, so it needed a door rather than a
|
package/dist/contract.js
CHANGED
|
@@ -57,6 +57,11 @@ export { hasNewsletterIntent, HONEYPOT_FIELD, isNewsletterIntent, NEWSLETTER_INT
|
|
|
57
57
|
// import and no host has ever imported it, so exporting it pinned a prefix rule
|
|
58
58
|
// into semver for nobody. See utils/paths.ts.
|
|
59
59
|
export { buildQueryString, isExternalUrl, isInternalPath } from './utils/paths.js';
|
|
60
|
+
/**
|
|
61
|
+
* The browser-title format. On `./contract` because its second reader is a
|
|
62
|
+
* host's error page, which composes a title without rendering `PageShell`.
|
|
63
|
+
*/
|
|
64
|
+
export { documentTitle } from './utils/document-title.js';
|
|
60
65
|
/**
|
|
61
66
|
* The descriptor factories. `edit/helpers.ts` imports nothing but types from
|
|
62
67
|
* two modules this subpath already anchors, so it needed a door rather than a
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a page names itself to the browser: `title — siteName`, or the site name
|
|
3
|
+
* alone.
|
|
4
|
+
*
|
|
5
|
+
* The format had two owners. `PageShell` composed it from `UiConfig.siteName`,
|
|
6
|
+
* and fndvit-website's `$lib/site` composed it again for the one page that
|
|
7
|
+
* cannot render through `PageShell` — its error page, whose centred layout is
|
|
8
|
+
* not one of the six variants. Both spelled the same expression, both
|
|
9
|
+
* comments noted that the other existed, and `site.test.ts` pinned the result
|
|
10
|
+
* as the literal `'Transparència — ViT'`: change the separator in the package
|
|
11
|
+
* and the error page drifts with nothing failing.
|
|
12
|
+
*
|
|
13
|
+
* It lives on `./contract` rather than in `UiConfig` because a config field
|
|
14
|
+
* would need a package DEFAULT, and that default is the expression — the
|
|
15
|
+
* duplication would survive the move. No host wants a separator of its own;
|
|
16
|
+
* one is a hypothetical seam.
|
|
17
|
+
*
|
|
18
|
+
* `siteName` is a parameter rather than a read, so this stays component-free
|
|
19
|
+
* and a server module can call it (fndvit-website's `$lib/site` supplies
|
|
20
|
+
* `SITE_NAME`, `PageShell` supplies `config.siteName`).
|
|
21
|
+
*/
|
|
22
|
+
export declare function documentTitle(title: string, siteName: string): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a page names itself to the browser: `title — siteName`, or the site name
|
|
3
|
+
* alone.
|
|
4
|
+
*
|
|
5
|
+
* The format had two owners. `PageShell` composed it from `UiConfig.siteName`,
|
|
6
|
+
* and fndvit-website's `$lib/site` composed it again for the one page that
|
|
7
|
+
* cannot render through `PageShell` — its error page, whose centred layout is
|
|
8
|
+
* not one of the six variants. Both spelled the same expression, both
|
|
9
|
+
* comments noted that the other existed, and `site.test.ts` pinned the result
|
|
10
|
+
* as the literal `'Transparència — ViT'`: change the separator in the package
|
|
11
|
+
* and the error page drifts with nothing failing.
|
|
12
|
+
*
|
|
13
|
+
* It lives on `./contract` rather than in `UiConfig` because a config field
|
|
14
|
+
* would need a package DEFAULT, and that default is the expression — the
|
|
15
|
+
* duplication would survive the move. No host wants a separator of its own;
|
|
16
|
+
* one is a hypothetical seam.
|
|
17
|
+
*
|
|
18
|
+
* `siteName` is a parameter rather than a read, so this stays component-free
|
|
19
|
+
* and a server module can call it (fndvit-website's `$lib/site` supplies
|
|
20
|
+
* `SITE_NAME`, `PageShell` supplies `config.siteName`).
|
|
21
|
+
*/
|
|
22
|
+
export function documentTitle(title, siteName) {
|
|
23
|
+
// An empty title is a REAL state, not a guard: pages title themselves from
|
|
24
|
+
// page copy and `content.getPage` returns '' for a missing row, so the site
|
|
25
|
+
// name alone must ship rather than a dangling separator.
|
|
26
|
+
return title ? `${title} — ${siteName}` : siteName;
|
|
27
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vit-foundation/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run prepack",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"!dist/**/*.spec.*",
|
|
26
26
|
"!dist/fixtures.*",
|
|
27
27
|
"!dist/**/stories/**",
|
|
28
|
-
"!dist/**/tests/**"
|
|
28
|
+
"!dist/**/tests/**",
|
|
29
|
+
"!dist/testing/imports.*"
|
|
29
30
|
],
|
|
30
31
|
"sideEffects": [
|
|
31
32
|
"**/*.css"
|