@vit-foundation/ui 0.1.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/LICENSE +201 -0
- package/README.md +129 -0
- package/dist/components/jobs/JobList.svelte +88 -0
- package/dist/components/jobs/JobList.svelte.d.ts +18 -0
- package/dist/components/jobs/index.d.ts +2 -0
- package/dist/components/jobs/index.js +1 -0
- package/dist/components/layout/Footer.svelte +79 -0
- package/dist/components/layout/Footer.svelte.d.ts +12 -0
- package/dist/components/layout/Nav.svelte +229 -0
- package/dist/components/layout/Nav.svelte.d.ts +18 -0
- package/dist/components/layout/PageShell.svelte +107 -0
- package/dist/components/layout/PageShell.svelte.d.ts +42 -0
- package/dist/components/layout/index.d.ts +3 -0
- package/dist/components/layout/index.js +3 -0
- package/dist/components/projects/ProjectCard.svelte +107 -0
- package/dist/components/projects/ProjectCard.svelte.d.ts +17 -0
- package/dist/components/projects/index.d.ts +2 -0
- package/dist/components/projects/index.js +1 -0
- package/dist/components/team/CollaboratorList.svelte +37 -0
- package/dist/components/team/CollaboratorList.svelte.d.ts +7 -0
- package/dist/components/team/TeamMemberCard.svelte +78 -0
- package/dist/components/team/TeamMemberCard.svelte.d.ts +21 -0
- package/dist/components/team/index.d.ts +3 -0
- package/dist/components/team/index.js +2 -0
- package/dist/components/timeline/Timeline.svelte +116 -0
- package/dist/components/timeline/Timeline.svelte.d.ts +12 -0
- package/dist/components/timeline/TimelineMilestone.svelte +127 -0
- package/dist/components/timeline/TimelineMilestone.svelte.d.ts +15 -0
- package/dist/components/timeline/index.d.ts +3 -0
- package/dist/components/timeline/index.js +2 -0
- package/dist/components/ui/Button.svelte +53 -0
- package/dist/components/ui/Button.svelte.d.ts +21 -0
- package/dist/components/ui/CardMedia.svelte +23 -0
- package/dist/components/ui/CardMedia.svelte.d.ts +11 -0
- package/dist/components/ui/CardTitle.svelte +28 -0
- package/dist/components/ui/CardTitle.svelte.d.ts +8 -0
- package/dist/components/ui/CopyIntro.svelte +40 -0
- package/dist/components/ui/CopyIntro.svelte.d.ts +24 -0
- package/dist/components/ui/DateText.svelte +43 -0
- package/dist/components/ui/DateText.svelte.d.ts +28 -0
- package/dist/components/ui/DecorShapes.svelte +36 -0
- package/dist/components/ui/DecorShapes.svelte.d.ts +7 -0
- package/dist/components/ui/Field.svelte +89 -0
- package/dist/components/ui/Field.svelte.d.ts +55 -0
- package/dist/components/ui/FilterChips.svelte +43 -0
- package/dist/components/ui/FilterChips.svelte.d.ts +15 -0
- package/dist/components/ui/FormErrorFeedback.svelte +55 -0
- package/dist/components/ui/FormErrorFeedback.svelte.d.ts +33 -0
- package/dist/components/ui/FormFeedback.svelte +65 -0
- package/dist/components/ui/FormFeedback.svelte.d.ts +30 -0
- package/dist/components/ui/FormResultSlot.svelte +33 -0
- package/dist/components/ui/FormResultSlot.svelte.d.ts +26 -0
- package/dist/components/ui/GhostButton.svelte +46 -0
- package/dist/components/ui/GhostButton.svelte.d.ts +10 -0
- package/dist/components/ui/Link.svelte +30 -0
- package/dist/components/ui/Link.svelte.d.ts +21 -0
- package/dist/components/ui/Pagination.svelte +77 -0
- package/dist/components/ui/Pagination.svelte.d.ts +18 -0
- package/dist/components/ui/RichText.svelte +160 -0
- package/dist/components/ui/RichText.svelte.d.ts +18 -0
- package/dist/components/ui/SearchInput.svelte +90 -0
- package/dist/components/ui/SearchInput.svelte.d.ts +13 -0
- package/dist/components/ui/ShareRow.svelte +95 -0
- package/dist/components/ui/ShareRow.svelte.d.ts +19 -0
- package/dist/components/ui/index.d.ts +17 -0
- package/dist/components/ui/index.js +17 -0
- package/dist/components/weeklies/SortSelect.svelte +42 -0
- package/dist/components/weeklies/SortSelect.svelte.d.ts +8 -0
- package/dist/components/weeklies/WeeklieCard.svelte +82 -0
- package/dist/components/weeklies/WeeklieCard.svelte.d.ts +15 -0
- package/dist/components/weeklies/index.d.ts +3 -0
- package/dist/components/weeklies/index.js +2 -0
- package/dist/config/UiProvider.svelte +21 -0
- package/dist/config/UiProvider.svelte.d.ts +14 -0
- package/dist/config/context.d.ts +17 -0
- package/dist/config/context.js +47 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.js +4 -0
- package/dist/config/messages.d.ts +7 -0
- package/dist/config/messages.js +38 -0
- package/dist/config/types.d.ts +99 -0
- package/dist/config/types.js +9 -0
- package/dist/content/index.d.ts +3 -0
- package/dist/content/index.js +1 -0
- package/dist/content/richtext.d.ts +10 -0
- package/dist/content/richtext.js +14 -0
- package/dist/content/types.d.ts +71 -0
- package/dist/content/types.js +6 -0
- package/dist/edit/Editable.svelte +197 -0
- package/dist/edit/Editable.svelte.d.ts +52 -0
- package/dist/edit/context.d.ts +10 -0
- package/dist/edit/context.js +15 -0
- package/dist/edit/helpers.d.ts +18 -0
- package/dist/edit/helpers.js +14 -0
- package/dist/edit/index.d.ts +5 -0
- package/dist/edit/index.js +4 -0
- package/dist/edit/types.d.ts +64 -0
- package/dist/edit/types.js +4 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +17 -0
- package/dist/styles/base.css +67 -0
- package/dist/styles/tokens.css +57 -0
- package/dist/utils/dates.d.ts +14 -0
- package/dist/utils/dates.js +34 -0
- package/dist/utils/milestones.d.ts +11 -0
- package/dist/utils/milestones.js +28 -0
- package/dist/utils/paths.d.ts +2 -0
- package/dist/utils/paths.js +4 -0
- package/package.json +139 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# @vit-foundation/ui
|
|
2
|
+
|
|
3
|
+
Fundació VIT's shared Svelte 5 component library: the components behind
|
|
4
|
+
[fundaciovit.org](https://fundaciovit.org), decoupled from any one app, with an
|
|
5
|
+
optional **edit mode** that lets a CMS-shaped consumer make the rendered
|
|
6
|
+
content editable in place.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @vit-foundation/ui
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Requires `svelte` ^5.0.0 as a peer.
|
|
13
|
+
|
|
14
|
+
## Quick start
|
|
15
|
+
|
|
16
|
+
```svelte
|
|
17
|
+
<script>
|
|
18
|
+
import { WeeklieCard, PageShell } from '@vit-foundation/ui';
|
|
19
|
+
import '@vit-foundation/ui/tokens.css'; // design tokens (CSS custom properties)
|
|
20
|
+
import '@vit-foundation/ui/base.css'; // utility classes + edit affordance
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<PageShell title="Weeklies">
|
|
24
|
+
<WeeklieCard weekly={data.weekly} />
|
|
25
|
+
</PageShell>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Every component renders standalone with Catalan copy and identity hrefs.
|
|
29
|
+
Subpath imports are available when you want a narrower graph:
|
|
30
|
+
`@vit-foundation/ui/ui`, `/layout`, `/weeklies`, `/projects`, `/team`,
|
|
31
|
+
`/timeline`, `/jobs`, `/edit`, `/config`.
|
|
32
|
+
|
|
33
|
+
## Wiring a host app: `UiProvider`
|
|
34
|
+
|
|
35
|
+
Strings, href resolution, the active locale, and the current URL come from a
|
|
36
|
+
`UiConfig` context. Mount it once, in the root layout. The foundation website
|
|
37
|
+
wires it to Paraglide and SvelteKit like this:
|
|
38
|
+
|
|
39
|
+
```svelte
|
|
40
|
+
<script>
|
|
41
|
+
import { UiProvider } from '@vit-foundation/ui';
|
|
42
|
+
import { page } from '$app/state';
|
|
43
|
+
import { m } from '$lib/paraglide/messages';
|
|
44
|
+
import { getLocale, locales, deLocalizeUrl } from '$lib/paraglide/runtime';
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<UiProvider
|
|
48
|
+
config={{
|
|
49
|
+
href: (path, options) => localizeHref(path, options),
|
|
50
|
+
locale: () => getLocale(),
|
|
51
|
+
locales,
|
|
52
|
+
url: () => page.url,
|
|
53
|
+
canonicalPathname: (url) => deLocalizeUrl(url).pathname,
|
|
54
|
+
siteName: 'ViT',
|
|
55
|
+
messages: m
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{@render children()}
|
|
59
|
+
</UiProvider>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`locale`, `url`, and `messages` reads are lazy, so reactive sources flow
|
|
63
|
+
through: a locale switch re-renders every consumer without a remount.
|
|
64
|
+
`messages` is a typed structural subset of a Paraglide `m` module — pass it
|
|
65
|
+
wholesale. Keys consumed only through this package still count as used;
|
|
66
|
+
don't prune them from your message catalogue.
|
|
67
|
+
|
|
68
|
+
## Edit mode
|
|
69
|
+
|
|
70
|
+
Components render plain, already-localized strings. To make one editable,
|
|
71
|
+
pass an _edit descriptor_ naming what the string is — and install an
|
|
72
|
+
`EditAdapter` that knows how to persist it. No adapter (or `isEditing`
|
|
73
|
+
off) means every descriptor is inert and the render is byte-identical to
|
|
74
|
+
the read-only one. **The package never talks to a database.**
|
|
75
|
+
|
|
76
|
+
```svelte
|
|
77
|
+
<script>
|
|
78
|
+
import { setEditAdapter, entityEdit, WeeklieCard } from '@vit-foundation/ui';
|
|
79
|
+
|
|
80
|
+
let editing = $state(false);
|
|
81
|
+
|
|
82
|
+
setEditAdapter({
|
|
83
|
+
get isEditing() {
|
|
84
|
+
return editing;
|
|
85
|
+
},
|
|
86
|
+
// Merge { [descriptor.locale]: value } into the localized column.
|
|
87
|
+
// Reject when persistence fails — the editor keeps the draft and
|
|
88
|
+
// shows the error state. Never let a save empty the canonical `ca`.
|
|
89
|
+
save: (descriptor, value) => saveContent(descriptor, value)
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const edit = entityEdit('weeklies', weekly.id, 'ca');
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<WeeklieCard {weekly} edit={{ title: edit('title'), excerpt: edit('excerpt') }} />
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Editing UX: click into an outlined text, type, and blur or press Enter to
|
|
99
|
+
save (Cmd/Ctrl+Enter for multiline fields, Escape reverts). `RichText`
|
|
100
|
+
opens a source editor over the block mini-format with a live preview.
|
|
101
|
+
Wrap your own render sites with the `Editable` primitive:
|
|
102
|
+
|
|
103
|
+
```svelte
|
|
104
|
+
<Editable edit={pageCopyEdit('home', 'hero_title', 'ca')} value={copy.hero_title}>
|
|
105
|
+
{#snippet children(text, attrs)}
|
|
106
|
+
<h1 {...attrs}>{text}</h1>
|
|
107
|
+
{/snippet}
|
|
108
|
+
</Editable>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
The `content` types (`LocalizedText`, `ContentRef`, …) mirror the
|
|
112
|
+
foundation's content model: localized text is a per-locale record whose
|
|
113
|
+
Catalan value is canonical and required.
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
npm install
|
|
119
|
+
npx playwright install chromium --only-shell # once, for component tests
|
|
120
|
+
npm run storybook # component workbench
|
|
121
|
+
npm run check && npm run lint && npm run test:unit -- --run
|
|
122
|
+
npm run build # svelte-package + publint
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Stories live in `src/lib/components/stories/<group>/`, component tests in
|
|
126
|
+
`src/lib/components/tests/<group>/`, mirroring the component tree.
|
|
127
|
+
|
|
128
|
+
Releases: bump with `npm version`, push the `v*` tag, and the release
|
|
129
|
+
workflow publishes to npm.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { EditDescriptor } from '../../edit/types.js';
|
|
3
|
+
|
|
4
|
+
/** Which of one opening's localized fields are editable at this render site. */
|
|
5
|
+
export interface JobEditMap {
|
|
6
|
+
title?: EditDescriptor;
|
|
7
|
+
description?: EditDescriptor;
|
|
8
|
+
}
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { getUiConfig } from '../../config/context.js';
|
|
13
|
+
import type { JobOpeningData } from '../../content/types.js';
|
|
14
|
+
import Editable from '../../edit/Editable.svelte';
|
|
15
|
+
import DateText from '../ui/DateText.svelte';
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
jobs: JobOpeningData[];
|
|
19
|
+
/**
|
|
20
|
+
* Edit descriptors per opening — a function because each row needs its
|
|
21
|
+
* own identity. Returning undefined leaves that row read-only.
|
|
22
|
+
*/
|
|
23
|
+
editFor?: (job: JobOpeningData) => JobEditMap | undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let { jobs, editFor }: Props = $props();
|
|
27
|
+
|
|
28
|
+
const config = getUiConfig();
|
|
29
|
+
const msg = $derived(config.messages);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
{#if jobs.length === 0}
|
|
33
|
+
<p class="empty">{msg.jobs_empty()}</p>
|
|
34
|
+
<p class="nudge">{msg.jobs_newsletterNudge()}</p>
|
|
35
|
+
{:else}
|
|
36
|
+
<ul>
|
|
37
|
+
{#each jobs as job (job.slug)}
|
|
38
|
+
{@const edit = editFor?.(job)}
|
|
39
|
+
<li>
|
|
40
|
+
<Editable edit={edit?.title} value={job.title}>
|
|
41
|
+
{#snippet children(text, attrs)}<h3 {...attrs}>{text}</h3>{/snippet}
|
|
42
|
+
</Editable>
|
|
43
|
+
<DateText value={job.postedOn} />
|
|
44
|
+
{#if job.description}
|
|
45
|
+
<Editable edit={edit?.description} value={job.description}>
|
|
46
|
+
{#snippet children(text, attrs)}<p {...attrs}>{text}</p>{/snippet}
|
|
47
|
+
</Editable>
|
|
48
|
+
{/if}
|
|
49
|
+
</li>
|
|
50
|
+
{/each}
|
|
51
|
+
</ul>
|
|
52
|
+
<p class="nudge">{msg.jobs_newsletterNudge()}</p>
|
|
53
|
+
{/if}
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
ul {
|
|
57
|
+
list-style: none;
|
|
58
|
+
margin: 0;
|
|
59
|
+
padding: 0;
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: var(--space-3);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
li {
|
|
66
|
+
background: var(--color-band-grey);
|
|
67
|
+
border-radius: var(--radius);
|
|
68
|
+
padding: var(--space-3) var(--space-4);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
h3 {
|
|
72
|
+
margin: 0;
|
|
73
|
+
font-size: var(--text-lg);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
li p {
|
|
77
|
+
margin: var(--space-2) 0 0;
|
|
78
|
+
color: var(--color-ink-secondary);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.empty {
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.nudge {
|
|
86
|
+
color: var(--color-ink-secondary);
|
|
87
|
+
}
|
|
88
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EditDescriptor } from '../../edit/types.js';
|
|
2
|
+
/** Which of one opening's localized fields are editable at this render site. */
|
|
3
|
+
export interface JobEditMap {
|
|
4
|
+
title?: EditDescriptor;
|
|
5
|
+
description?: EditDescriptor;
|
|
6
|
+
}
|
|
7
|
+
import type { JobOpeningData } from '../../content/types.js';
|
|
8
|
+
interface Props {
|
|
9
|
+
jobs: JobOpeningData[];
|
|
10
|
+
/**
|
|
11
|
+
* Edit descriptors per opening — a function because each row needs its
|
|
12
|
+
* own identity. Returning undefined leaves that row read-only.
|
|
13
|
+
*/
|
|
14
|
+
editFor?: (job: JobOpeningData) => JobEditMap | undefined;
|
|
15
|
+
}
|
|
16
|
+
declare const JobList: import("svelte").Component<Props, {}, "">;
|
|
17
|
+
type JobList = ReturnType<typeof JobList>;
|
|
18
|
+
export default JobList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as JobList } from './JobList.svelte';
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getUiConfig } from '../../config/context.js';
|
|
3
|
+
import type { SiteLink } from '../../config/types.js';
|
|
4
|
+
import Link from '../ui/Link.svelte';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The links are a prop rather than a package constant: the host app owns
|
|
8
|
+
* its routes, and Nav and Footer render the same list — the foundation
|
|
9
|
+
* site derives both from one `siteLinks()` so the two can never drift.
|
|
10
|
+
*/
|
|
11
|
+
interface Props {
|
|
12
|
+
links: SiteLink[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let { links }: Props = $props();
|
|
16
|
+
|
|
17
|
+
const config = getUiConfig();
|
|
18
|
+
|
|
19
|
+
const year = new Date().getFullYear();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<footer>
|
|
23
|
+
<div class="inner band">
|
|
24
|
+
<span class="logo">
|
|
25
|
+
<Link href="/" aria-label={config.messages.nav_home()}>{config.siteName}</Link>
|
|
26
|
+
</span>
|
|
27
|
+
<ul>
|
|
28
|
+
{#each links as link (link.href)}
|
|
29
|
+
<li><Link href={link.href}>{link.label}</Link></li>
|
|
30
|
+
{/each}
|
|
31
|
+
</ul>
|
|
32
|
+
<p class="rights">© {year} {config.messages.footer_rights()}</p>
|
|
33
|
+
</div>
|
|
34
|
+
</footer>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
footer {
|
|
38
|
+
background: var(--color-navy);
|
|
39
|
+
color: var(--color-surface);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.inner {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: var(--space-3);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.logo :global(a) {
|
|
49
|
+
font-size: var(--text-lg);
|
|
50
|
+
font-weight: 700;
|
|
51
|
+
letter-spacing: 0.04em;
|
|
52
|
+
text-decoration: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
ul {
|
|
56
|
+
list-style: none;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
gap: var(--space-3);
|
|
60
|
+
margin: 0;
|
|
61
|
+
padding: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
ul :global(a) {
|
|
65
|
+
text-decoration: none;
|
|
66
|
+
opacity: 0.85;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
ul :global(a:hover) {
|
|
70
|
+
opacity: 1;
|
|
71
|
+
text-decoration: underline;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.rights {
|
|
75
|
+
margin: 0;
|
|
76
|
+
font-size: var(--text-sm);
|
|
77
|
+
opacity: 0.7;
|
|
78
|
+
}
|
|
79
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SiteLink } from '../../config/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The links are a prop rather than a package constant: the host app owns
|
|
4
|
+
* its routes, and Nav and Footer render the same list — the foundation
|
|
5
|
+
* site derives both from one `siteLinks()` so the two can never drift.
|
|
6
|
+
*/
|
|
7
|
+
interface Props {
|
|
8
|
+
links: SiteLink[];
|
|
9
|
+
}
|
|
10
|
+
declare const Footer: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Footer = ReturnType<typeof Footer>;
|
|
12
|
+
export default Footer;
|