@spillway-cms/blocks 0.1.23 → 0.1.25
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/THIRD_PARTY_NOTICES.md +49 -0
- package/dist/breadcrumbs.d.ts +27 -0
- package/dist/breadcrumbs.js +44 -0
- package/dist/breadcrumbs.js.map +1 -0
- package/dist/collection.d.ts +32 -1
- package/dist/collection.js +40 -5
- package/dist/collection.js.map +1 -1
- package/dist/config.d.ts +64 -4
- package/dist/config.js +124 -24
- package/dist/config.js.map +1 -1
- package/dist/countdown.d.ts +34 -0
- package/dist/countdown.js +81 -0
- package/dist/countdown.js.map +1 -0
- package/dist/css.js +43 -0
- package/dist/css.js.map +1 -1
- package/dist/documents.d.ts +52 -0
- package/dist/documents.js +146 -0
- package/dist/documents.js.map +1 -0
- package/dist/examples.js +141 -1
- package/dist/examples.js.map +1 -1
- package/dist/form.d.ts +11 -3
- package/dist/form.js +27 -11
- package/dist/form.js.map +1 -1
- package/dist/glossary.d.ts +56 -0
- package/dist/glossary.js +117 -0
- package/dist/glossary.js.map +1 -0
- package/dist/hours.d.ts +44 -0
- package/dist/hours.js +163 -0
- package/dist/hours.js.map +1 -0
- package/dist/icons-data.d.ts +18 -0
- package/dist/icons-data.js +117 -0
- package/dist/icons-data.js.map +1 -0
- package/dist/icons.d.ts +31 -0
- package/dist/icons.js +49 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +27 -3
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/language-switcher.d.ts +38 -0
- package/dist/language-switcher.js +60 -0
- package/dist/language-switcher.js.map +1 -0
- package/dist/listing-script.d.ts +13 -0
- package/dist/listing-script.js +44 -0
- package/dist/listing-script.js.map +1 -0
- package/dist/location-map.d.ts +60 -0
- package/dist/location-map.js +215 -0
- package/dist/location-map.js.map +1 -0
- package/dist/marketing.d.ts +3 -0
- package/dist/marketing.js +5 -2
- package/dist/marketing.js.map +1 -1
- package/dist/meta.js +75 -15
- package/dist/meta.js.map +1 -1
- package/dist/motion.d.ts +1 -1
- package/dist/motion.js +3 -2
- package/dist/motion.js.map +1 -1
- package/dist/progress.d.ts +46 -0
- package/dist/progress.js +106 -0
- package/dist/progress.js.map +1 -0
- package/dist/registry-package.js +1 -1
- package/dist/registry-package.js.map +1 -1
- package/dist/registry-types.d.ts +5 -0
- package/dist/registry-types.js.map +1 -1
- package/dist/styles.css +376 -2
- package/dist/styles.js +95 -0
- package/dist/styles.js.map +1 -1
- package/dist/toc.d.ts +32 -0
- package/dist/toc.js +79 -0
- package/dist/toc.js.map +1 -0
- package/dist/utility-script.d.ts +20 -0
- package/dist/utility-script.js +90 -0
- package/dist/utility-script.js.map +1 -0
- package/dist/utility-shared.d.ts +18 -0
- package/dist/utility-shared.js +32 -0
- package/dist/utility-shared.js.map +1 -0
- package/dist/video.d.ts +36 -1
- package/dist/video.js +157 -4
- package/dist/video.js.map +1 -1
- package/dist/widgets.d.ts +95 -0
- package/dist/widgets.js +449 -0
- package/dist/widgets.js.map +1 -0
- package/package.json +4 -3
package/dist/meta.js
CHANGED
|
@@ -7,7 +7,7 @@ export const blockMeta = {
|
|
|
7
7
|
Heading: {
|
|
8
8
|
summary: 'A section heading.',
|
|
9
9
|
description: 'A standalone heading (h1 to h4) with alignment.',
|
|
10
|
-
aiHint: 'Use to start a section. Prefer h2 for sections and h3 for sub-sections; the Hero already provides the h1. Keep headings short and specific.',
|
|
10
|
+
aiHint: 'Use to start a section. Prefer h2 for sections and h3 for sub-sections; the Hero already provides the h1. Keep headings short and specific. anchor is an optional link name for #links (lowercase words joined by hyphens, unique on the page); On this page lists headings without one too.',
|
|
11
11
|
},
|
|
12
12
|
Text: {
|
|
13
13
|
summary: 'Paragraphs of body copy.',
|
|
@@ -26,8 +26,8 @@ export const blockMeta = {
|
|
|
26
26
|
},
|
|
27
27
|
Video: {
|
|
28
28
|
summary: 'A captioned video to play.',
|
|
29
|
-
description: 'A video (MP4 or WebM) from the media library, played with the browser\'s own controls (keyboard accessible, with a captions button), a poster image, captions files (.vtt) with a language and a label each, and an optional transcript in an expandable section under it. Nothing loads until the visitor presses play. The title names the player for screen readers and, with the description, goes into VideoObject structured data for video search results. A muted video can play on its own when in view, only when the brand\'s motion is on and the visitor has not asked for reduced motion.',
|
|
30
|
-
aiHint: 'Use for a how-to, a tour or an interview hosted in the media library; for YouTube or Vimeo
|
|
29
|
+
description: 'A video (MP4 or WebM) from the media library, played with the browser\'s own controls (keyboard accessible, with a captions button), a poster image, captions files (.vtt) with a language and a label each, and an optional transcript in an expandable section under it. Nothing loads until the visitor presses play. It also plays a YouTube or Vimeo address: the page shows a poster (the block\'s own, else the video\'s thumbnail, which the server caches) with a play button and loads the privacy-friendly player (youtube-nocookie.com, Vimeo with do-not-track) only when it is pressed, in place or in a lightbox; with the consent banner on, it says the video comes from YouTube or Vimeo, which may set cookies. The title names the player for screen readers and, with the description, goes into VideoObject structured data for video search results. A muted video can play on its own when in view, only when the brand\'s motion is on and the visitor has not asked for reduced motion.',
|
|
30
|
+
aiHint: 'Use for a how-to, a tour or an interview hosted in the media library; for a YouTube or Vimeo video put its address (https://www.youtube.com/watch?v=..., https://vimeo.com/...) in src, with display "inline" or "lightbox", leaving tracks empty (captions come from the host). Otherwise src must be a real /media/ URL of an .mp4 or .webm file, poster a real image from the library, and each tracks item a real .vtt file from the library with srclang (en, es, fr-CA) and label (English); mark one default. Always set title (what the video is) and a one-sentence description. Put the transcript in transcript when one is known; never invent captions, transcripts or file URLs. Leave autoplay off unless the video is silent decoration (it needs muted true).',
|
|
31
31
|
},
|
|
32
32
|
Columns: {
|
|
33
33
|
summary: 'Side-by-side columns of blocks.',
|
|
@@ -36,8 +36,28 @@ export const blockMeta = {
|
|
|
36
36
|
},
|
|
37
37
|
Section: {
|
|
38
38
|
summary: 'A band that holds other blocks.',
|
|
39
|
-
description: 'A full-width band with a background (page, surface, primary, secondary or dark) and a width (narrow, normal, wide), holding any blocks in its content slot; each block inside keeps its own alignment. Text and buttons turn light on the colored and dark backgrounds.',
|
|
40
|
-
aiHint: 'Use to group a heading, text, buttons or cards on one background, for example a dark band with a Heading, a Text and a Buttons block. Put the child blocks in "content". Prefer it to Spacer for separating sections.',
|
|
39
|
+
description: 'A full-width band with a background (page, surface, primary, secondary or dark) and a width (narrow, normal, wide), holding any blocks in its content slot; each block inside keeps its own alignment. Text and buttons turn light on the colored and dark backgrounds. It can have a background image from the media library (cropped around its focal point, under an overlay in a brand color at 20 to 80 percent, with light or dark text to match) and a muted background video that plays only when motion is allowed, with a pause button. A link name gives it an id for #links.',
|
|
40
|
+
aiHint: 'Use to group a heading, text, buttons or cards on one background, for example a dark band with a Heading, a Text and a Buttons block. Put the child blocks in "content". Prefer it to Spacer for separating sections. For a photo band, set backgroundImage to a real /media/ image (or "find: " and what it shows when photos are offered), overlay "dark" (or "primary") with overlayStrength 60 or more and textColor "auto"; keep the text inside short. backgroundVideo only with a real .mp4 or .webm and a backgroundImage as its poster. anchor is an optional link name (lowercase words joined by hyphens, unique on the page).',
|
|
41
|
+
},
|
|
42
|
+
OnThisPage: {
|
|
43
|
+
summary: 'Links to the page\'s headings.',
|
|
44
|
+
description: 'A list of links to the page\'s headings (H2, H2 and H3, or H2 to H4), filled in when the page is shown, as a nested list under a title ("On this page"). It can stay in view while the page scrolls, in a sidebar column or a sidebar placement. Jumps scroll smoothly unless the visitor asked for reduced motion.',
|
|
45
|
+
aiHint: 'Use on long pages with four or more H2 sections (a program page, a policy, a guide), near the top or in the first column of a two-column layout with sticky true. It lists Heading blocks on its own: give the headings short, distinct text; nothing else to fill in.',
|
|
46
|
+
},
|
|
47
|
+
Tabs: {
|
|
48
|
+
summary: 'Panels of blocks behind tabs.',
|
|
49
|
+
description: 'Two to twelve tabs, each a panel that holds any blocks, with the tabs above the panel or beside it. Arrow keys move between the tabs, a link to #link-name opens a tab, and on narrow screens the tabs scroll sideways. Without JavaScript, and in the page builder, every panel shows under its heading after a list of links to them.',
|
|
50
|
+
aiHint: 'Use for parallel content people choose between, such as program levels (Undergraduate, Graduate, Online), audiences or the steps of a process, three to six tabs with short labels (one or two words). Each tab has a label and a "content" array of child blocks (Heading, Text, Image, Buttons, Columns). Not for content everyone must read: use Sections for that. orientation "vertical" suits five or more tabs with longer labels.',
|
|
51
|
+
},
|
|
52
|
+
Accordion: {
|
|
53
|
+
summary: 'Items that open to any blocks.',
|
|
54
|
+
description: 'A list of items whose titles open in place to show any blocks (text, images, buttons, columns), one at a time or several, with a heading level for the titles, the first item optionally open, links to an item by its link name (#visiting-campus) and, marked as FAQ, the titles and answers in the page\'s FAQPage structured data. Without JavaScript, and in the page builder, every item is open.',
|
|
55
|
+
aiHint: 'Use for many short sections people scan for one answer: policies, requirements, office hours, questions with rich answers. Each item has a title (a heading people scan) and a "content" array of child blocks, usually one Text block. Set headingLevel to the level after the heading above it (h3 under an h2). Set faq true only when the titles are real questions. For plain questions and answers the Faq block is enough.',
|
|
56
|
+
},
|
|
57
|
+
Carousel: {
|
|
58
|
+
summary: 'Slides of blocks to browse.',
|
|
59
|
+
description: 'Slides that each hold any blocks, in four variants: hero (full width, optionally full screen), cards (several visible, the next peeking in), testimonial (a thumbnail switcher) and stats (big numbers). Previous and Next, dots or thumbnails, swiping, arrow keys and screen reader labels ("1 of 3"); autoplay is off by default, has a pause button and never runs when the brand\'s motion is off or the visitor reduces motion. Without JavaScript the slides are a row that scrolls sideways.',
|
|
60
|
+
aiHint: 'Use sparingly: only when people browse the slides by choice (stories, featured programs, testimonials, key figures), never for information everyone must see, which belongs in Cards or Sections. Three to six slides. Each slide has a short label and a "content" array of child blocks: a Hero for the hero variant (titleLevel h2 on every Hero after the first, so the page keeps one H1), a Heading, Text and Button for cards, a Text quote with the person\'s name for testimonial, a Heading with the figure and a Text saying what it counts for stats. Always give title (it names the carousel). Leave autoplay false.',
|
|
41
61
|
},
|
|
42
62
|
CallToAction: {
|
|
43
63
|
summary: 'A short pitch with one button.',
|
|
@@ -46,8 +66,8 @@ export const blockMeta = {
|
|
|
46
66
|
},
|
|
47
67
|
Cards: {
|
|
48
68
|
summary: 'A grid of cards with links.',
|
|
49
|
-
description: 'A grid of cards with title, text, optional link and
|
|
50
|
-
aiHint: 'Use for features, benefits, services or a list of related pages. Three cards with parallel phrasing read best. Leave href empty when there is no target page.',
|
|
69
|
+
description: 'A grid of cards with title, text, optional link, image and icon, in 2 to 4 columns. An icon is decorative unless it has a label.',
|
|
70
|
+
aiHint: 'Use for features, benefits, services or a list of related pages. Three cards with parallel phrasing read best. Leave href empty when there is no target page. Give each card an icon that fits its title when the cards have no images (the same style of icon on every card), and leave iconLabel empty: the title says what it is. Icon names are the bundled set (graduation-cap, book-open, users, map-pin, calendar, heart, globe, award, briefcase, flask-conical, lightbulb, phone, mail, arrow-right and more; the field lists them all); leave icon empty when no icon fits.',
|
|
51
71
|
},
|
|
52
72
|
Faq: {
|
|
53
73
|
summary: 'Questions that open to answers.',
|
|
@@ -61,8 +81,8 @@ export const blockMeta = {
|
|
|
61
81
|
},
|
|
62
82
|
Stats: {
|
|
63
83
|
summary: 'Big numbers with labels.',
|
|
64
|
-
description: 'Up to six large figures (98%, 40, 14:1), each with what it counts.',
|
|
65
|
-
aiHint: 'Use for three or four true, specific figures the site states elsewhere. The label says what is counted, in a few words. Do not invent numbers.',
|
|
84
|
+
description: 'Up to six large figures (98%, 40, 14:1), each with what it counts and an optional icon above it.',
|
|
85
|
+
aiHint: 'Use for three or four true, specific figures the site states elsewhere. The label says what is counted, in a few words. Do not invent numbers. An icon per figure is optional (decorative; iconLabel empty). Icon names are the bundled set (graduation-cap, book-open, users, map-pin, calendar, heart, globe, award, briefcase, flask-conical, lightbulb, phone, mail, arrow-right and more; the field lists them all); leave icon empty when no icon fits.',
|
|
66
86
|
},
|
|
67
87
|
LogoStrip: {
|
|
68
88
|
summary: 'A row of partner logos.',
|
|
@@ -87,7 +107,7 @@ export const blockMeta = {
|
|
|
87
107
|
Spacer: {
|
|
88
108
|
summary: 'Space between sections.',
|
|
89
109
|
description: 'Vertical space (s, m, l, xl).',
|
|
90
|
-
aiHint: 'Use sparingly. Blocks already have padding, and every block has spaceAbove and spaceBelow (auto, none, s, m, l, xl) to adjust it, and a motion object ({ entrance: none|fade|rise|scale|slide-left|slide-right, delay: none|short|medium, stagger, hover: none|lift|zoom|tilt, scroll: none|fade-out|pin|parallax (Hero with a background image only) }); a Hero can take backgroundVideo (.mp4 or .webm, needs backgroundImage as its poster) Stats countUp, and LogoStrip and Testimonials marquee (true scrolls the row with a pause button), all capped by the brand\'s motion level; use entrances sparingly and never on the first block of a page.',
|
|
110
|
+
aiHint: 'Use sparingly. Blocks already have padding, and every block has spaceAbove and spaceBelow (auto, none, s, m, l, xl) to adjust it, and a motion object ({ entrance: none|fade|rise|scale|slide-left|slide-right, delay: none|short|medium, stagger, hover: none|lift|zoom|tilt, scroll: none|fade-out|pin|parallax (a Hero or a Section with a background image only) }); a Hero or a Section can take backgroundVideo (.mp4 or .webm, needs backgroundImage as its poster) Stats countUp, and LogoStrip and Testimonials marquee (true scrolls the row with a pause button), all capped by the brand\'s motion level; use entrances sparingly and never on the first block of a page.',
|
|
91
111
|
},
|
|
92
112
|
Search: {
|
|
93
113
|
summary: 'A search box for this site.',
|
|
@@ -104,6 +124,16 @@ export const blockMeta = {
|
|
|
104
124
|
description: "One of the site's menus as a list of links: the whole menu, or only the branch that holds the page being viewed (its sub-items, like a department's navigation), one or two levels deep, stacked for a sidebar or in a row. It can follow the menu of the department section the page is in instead of naming one. The current page is marked; nothing shows when there are no links for the page.",
|
|
105
125
|
aiHint: 'Use for in-page or sidebar navigation of a section of the site. Set menuKey to an existing menu key (main is the header menu); use show "branch" to list the pages around the current one. Do not repeat the header navigation on a page.',
|
|
106
126
|
},
|
|
127
|
+
Breadcrumbs: {
|
|
128
|
+
summary: 'The trail to this page.',
|
|
129
|
+
description: "The links from the home page to the page being viewed (Home, then each level above it, then the page), from the page's address (the titles of the pages at each level, as in the structured data) or from its place in the main menu. A navigation landmark named Breadcrumb with the page marked as current; nothing shows on the home page. Usually placed above the content of every page of a type with Structure → Placements, or with Site settings → Breadcrumbs.",
|
|
130
|
+
aiHint: 'Use at the top of deep content pages (programs, departments, news, events), not on the home page or a landing page. Prefer a placement or the site setting over adding it to each page by hand. source "path" follows the address; "menu" follows the main menu.',
|
|
131
|
+
},
|
|
132
|
+
LanguageSwitcher: {
|
|
133
|
+
summary: 'This page in other languages.',
|
|
134
|
+
description: "Links to the page being viewed in each of the site's languages, each named in its own language (no flags). A language the page is not translated into links to that language's home page with a short note. A navigation landmark with the current language marked; Links shows them in a row, Menu behind a button. Works without JavaScript. Nothing shows on a site with one language. Site settings → Languages can show the same switcher in the header of every page.",
|
|
135
|
+
aiHint: 'Use only on multilingual sites, near the top of a page or in a sidebar; prefer the header switcher in Site settings → Languages over adding it to each page. Do not add flags or a second switcher.',
|
|
136
|
+
},
|
|
107
137
|
Divider: {
|
|
108
138
|
summary: 'A line between sections.',
|
|
109
139
|
description: 'A horizontal rule.',
|
|
@@ -117,12 +147,12 @@ export const blockMeta = {
|
|
|
117
147
|
Buttons: {
|
|
118
148
|
summary: 'A row of one to four buttons.',
|
|
119
149
|
description: 'One to four buttons in a row that wraps on small screens, each with its own label, link, emphasis (primary, secondary or text link) and an option to open in a new tab; aligned left, center or right.',
|
|
120
|
-
aiHint: 'Use when a section needs more than one action, for example "Book a demo" (primary) and "Read the docs" (secondary). One primary button per row; the rest secondary or text links.',
|
|
150
|
+
aiHint: 'Use when a section needs more than one action, for example "Book a demo" (primary) and "Read the docs" (secondary). One primary button per row; the rest secondary or text links. An icon is optional (decorative, iconPosition before or after the label), for example arrow-right after or download before.',
|
|
121
151
|
},
|
|
122
152
|
Button: {
|
|
123
153
|
summary: 'A single button or text link.',
|
|
124
|
-
description: 'A single button with alignment; its emphasis (primary, secondary or a text link) comes from its style.',
|
|
125
|
-
aiHint: 'Use for a standalone link styled as a button. Label is a verb phrase; href is a site path or full URL.',
|
|
154
|
+
description: 'A single button with alignment and an optional icon before or after the label; its emphasis (primary, secondary or a text link) comes from its style.',
|
|
155
|
+
aiHint: 'Use for a standalone link styled as a button. Label is a verb phrase; href is a site path or full URL. icon is optional and decorative (arrow-right, download, external-link).',
|
|
126
156
|
},
|
|
127
157
|
Form: {
|
|
128
158
|
summary: 'A contact or signup form.',
|
|
@@ -134,6 +164,31 @@ export const blockMeta = {
|
|
|
134
164
|
description: 'A month grid, a week, a day or a date list of the event occurrences in a collection, with a link to its iCal feed and, optionally, links for visitors to switch views; filled in by the server at render time.',
|
|
135
165
|
aiHint: 'Use on an events page. Set collectionId to the key of an existing collection of a type with a daterange field (ask or leave empty if unknown); view "month" for a grid, "week" for seven days, "day" for one day\'s agenda, "list" for upcoming dates. Set switcher to true on the main events page.',
|
|
136
166
|
},
|
|
167
|
+
Countdown: {
|
|
168
|
+
summary: 'Time left to a date.',
|
|
169
|
+
description: 'Days, hours and minutes (optionally seconds, with a pause button) to a date and time in the site\'s time zone or the block\'s, with a label above the numbers. The server renders the time left, so it is right without JavaScript, and a small script ticks it. When the time is reached it shows a message or hides. Screen readers get the time left as a sentence; announcements are off, at the end, or at most once a minute.',
|
|
170
|
+
aiHint: 'Use for one deadline or start time people act on: applications closing, an event starting, early registration ending. Set date as YYYY-MM-DD and time as HH:MM on a 24-hour clock (ask if unknown; never invent one), label as what happens ("Applications close in"), endedMessage as what is true afterwards. Leave timeZone empty (the site\'s), showSeconds false and announce "none" unless asked. Never more than one per page.',
|
|
171
|
+
},
|
|
172
|
+
Hours: {
|
|
173
|
+
summary: 'Opening hours and holidays.',
|
|
174
|
+
description: 'Hours of operation for one or more locations: weekly hours (a day, or Monday to Friday, weekends or every day, with an opening and a closing time; split days and hours past midnight), dated exceptions and holidays (closed or special hours, for every location or one), an "Open now, closes at 5:00 PM" status computed in the site\'s time zone and refreshed every minute, today marked in the weekly table, holiday hours for the next 60 days, and OpeningHoursSpecification structured data per location.',
|
|
175
|
+
aiHint: 'Use on contact, visit and office pages. One location per office with its real name; hours rows use day MO, TU, WE, TH, FR, SA, SU, weekdays, weekend or daily, and opens/closes as HH:MM on a 24-hour clock. A day with no row is closed. Holidays go in exceptions with date YYYY-MM-DD (endDate for a range), a label and closed true, or closed false with opens and closes; set location only when it applies to one location. Never invent hours: ask, or leave the defaults for the editor. schemaType GovernmentOffice for a city or county office, Library for a library.',
|
|
176
|
+
},
|
|
177
|
+
DocumentLibrary: {
|
|
178
|
+
summary: 'Files from a folder or tag.',
|
|
179
|
+
description: 'A list of media library documents (PDF, Word, Excel, PowerPoint and the like) from a folder (with its subfolders) or with a tag: a type badge, the title as the download link, the size, the date added and an optional description; sorted by title or date, optionally grouped by folder, tag or type, with an optional search box and type filter. Members-only files show only to members who may see them.',
|
|
180
|
+
aiHint: 'Use for forms, policies, reports, agendas and minutes kept in the media library. Set folder to the name of an existing media folder or tag to an existing media tag (ask if unknown; never invent one). groupBy "folder" when the folder has subfolders by year or topic. search true when it lists more than about fifteen files.',
|
|
181
|
+
},
|
|
182
|
+
Glossary: {
|
|
183
|
+
summary: 'Terms and definitions, A to Z.',
|
|
184
|
+
description: 'Terms and definitions under letter headings, with an A to Z navigation that greys out letters without terms, a link to each letter and each term, an optional search box, and DefinedTermSet structured data. The terms are typed in the block, or come from a content type (a field for the term and one for the definition, each linked to its page) or a vocabulary (term labels and descriptions).',
|
|
185
|
+
aiHint: 'Use for a page of jargon explained: academic terms, legal or program vocabulary. Keep source "inline" and put each term in terms with a one or two sentence definition in plain language. Use source "type" with typeKey and definitionField, or "vocabulary" with vocabulary, only when that content already exists. search true for more than about thirty terms. Use one Glossary per page.',
|
|
186
|
+
},
|
|
187
|
+
CampaignProgress: {
|
|
188
|
+
summary: 'Raised so far against a goal.',
|
|
189
|
+
description: 'A fundraising or participation goal as a bar with the amount raised, the goal, the percentage and optionally the number of gifts: typed numbers, the paid gifts of a payment form, or a source a module registers. Money in a currency or plain numbers with a unit. The bar is a progress bar with its value as text for screen readers; the numbers can count up as it comes into view, following the motion settings.',
|
|
190
|
+
aiHint: 'Use near a donation form or on a campaign page. With typed numbers set raised and goal (numbers, no symbols) and currency (usd); never invent figures: ask, or leave the defaults for the editor. When the site takes donations through a form with a payment, use source "form" with formKey. Plain numbers ("meals", "volunteers"): format "number" with unit. Leave countUp false unless asked.',
|
|
191
|
+
},
|
|
137
192
|
MiniCalendar: {
|
|
138
193
|
summary: 'A small month of events.',
|
|
139
194
|
description: 'One month of a collection\'s events as a compact grid for a sidebar or a home page: days with events link to that day on the events page, or to the event.',
|
|
@@ -159,10 +214,15 @@ export const blockMeta = {
|
|
|
159
214
|
description: 'An A/B test: slots a (control), b and optional c; visitors of a running experiment (Experiments in the admin) are assigned a variant by weight and the results screen reports conversions per variant.',
|
|
160
215
|
aiHint: 'Use only when the user names an existing experiment key. Put the current content in "a" and the challenger in "b"; leave "c" empty unless asked. Never invent experiment keys.',
|
|
161
216
|
},
|
|
217
|
+
LocationMap: {
|
|
218
|
+
summary: 'Places on a map, with a list.',
|
|
219
|
+
description: "The places of a collection (buildings, offices, facilities) as a list beside an interactive map: each place's details, a marker per place with its coordinates, category and keyword filters and a pager from the collection. Without JavaScript it is the list alone, each place with a link to it on OpenStreetMap. Tiles come from Site settings → Integrations → Map tiles (OpenStreetMap by default) and wait for consent when the provider sets cookies.",
|
|
220
|
+
aiHint: 'Use for a page that shows many places (a campus map, facilities, offices). Set collectionId to a collection of a type with latitude and longitude number fields; add a taxonomy filter for the category and a search filter. For one place use the Maps module\'s Map block or an Embed.',
|
|
221
|
+
},
|
|
162
222
|
Collection: {
|
|
163
223
|
summary: 'A list that updates itself.',
|
|
164
|
-
description: 'A saved query (collection) of entities rendered as cards, a list or a
|
|
165
|
-
aiHint: 'Use for "latest posts", "case studies" or any list that should update itself. Set collectionId to the key of an existing collection (ask or leave empty if unknown); never invent items, the server supplies them.',
|
|
224
|
+
description: 'A saved query (collection) of entities rendered as cards, a list, a grid or a table, optionally with visitor filters (keyword, taxonomy, select, checkboxes for several values, an A to Z letter bar, date range), a Results per page choice (pageSizes) and a pager; items are filled in by the server at render time.',
|
|
225
|
+
aiHint: 'Use for "latest posts", "case studies", a directory or a finder: any list that should update itself. Set collectionId to the key of an existing collection (ask or leave empty if unknown); never invent items, the server supplies them. For a directory, add a { kind: "letter" } filter on the name field; for facets such as delivery mode, { kind: "checkboxes" }; pageSizes "12, 24, 48" lets visitors pick how many show.',
|
|
166
226
|
},
|
|
167
227
|
RegistryBrowse: {
|
|
168
228
|
summary: 'Search the package registry.',
|
package/dist/meta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,SAAS,GAA8B;IAClD,IAAI,EAAE;QACJ,OAAO,EAAE,+BAA+B;QACxC,WAAW,EAAE,iPAAiP;QAC9P,MAAM,EACJ,+kBAA+kB;KACllB;IACD,OAAO,EAAE;QACP,OAAO,EAAE,oBAAoB;QAC7B,WAAW,EAAE,iDAAiD;QAC9D,MAAM,EACJ,
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../src/meta.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,SAAS,GAA8B;IAClD,IAAI,EAAE;QACJ,OAAO,EAAE,+BAA+B;QACxC,WAAW,EAAE,iPAAiP;QAC9P,MAAM,EACJ,+kBAA+kB;KACllB;IACD,OAAO,EAAE;QACP,OAAO,EAAE,oBAAoB;QAC7B,WAAW,EAAE,iDAAiD;QAC9D,MAAM,EACJ,8RAA8R;KACjS;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,0BAA0B;QACnC,WAAW,EAAE,6GAA6G;QAC1H,MAAM,EACJ,oMAAoM;KACvM;IACD,KAAK,EAAE;QACL,OAAO,EAAE,0BAA0B;QACnC,WAAW,EAAE,yFAAyF;QACtG,MAAM,EACJ,4JAA4J;KAC/J;IACD,OAAO,EAAE;QACP,OAAO,EAAE,6BAA6B;QACtC,WAAW,EAAE,kMAAkM;QAC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gC;QACzC,WAAW,EAAE,yRAAyR;QACtS,MAAM,EAAE,wKAAwK;KACjL;IACD,WAAW,EAAE;QACX,OAAO,EAAE,wBAAwB;QACjC,WAAW,EAAE,2LAA2L;QACxM,MAAM,EAAE,4IAA4I;KACrJ;CACF,CAAC"}
|
package/dist/motion.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* root as `data-sw-motion`: `subtle` plays scale and slides as a short rise and turns tilt off. Reduced motion, from the operating
|
|
9
9
|
* system or the visitor's switch (`sw-reduce-motion` on the root), turns every rule off.
|
|
10
10
|
*/
|
|
11
|
-
export declare const MOTION_CSS = "\n/* Motion: entrances (armed by the page's motion script), stagger and hover. */\n[data-motion] { --sw-motion-from: none; --sw-motion-wait: 0ms; }\n[data-motion=\"rise\"] { --sw-motion-from: translateY(var(--sw-motion-distance, 24px)); }\n[data-motion=\"scale\"] { --sw-motion-from: scale(0.94); }\n[data-motion=\"slide-left\"] { --sw-motion-from: translateX(calc(-1 * var(--sw-motion-distance, 24px))); }\n[data-motion=\"slide-right\"] { --sw-motion-from: translateX(var(--sw-motion-distance, 24px)); }\n[data-sw-motion=\"subtle\"] :is([data-motion=\"scale\"], [data-motion=\"slide-left\"], [data-motion=\"slide-right\"]) { --sw-motion-from: translateY(calc(var(--sw-motion-distance, 24px) / 2)); }\n[data-sw-motion=\"subtle\"] [data-motion=\"rise\"] { --sw-motion-from: translateY(calc(var(--sw-motion-distance, 24px) / 2)); }\n[data-motion-delay=\"short\"] { --sw-motion-wait: 150ms; }\n[data-motion-delay=\"medium\"] { --sw-motion-wait: 300ms; }\n/* The transition runs only as a block arrives (sw-in), so hiding the blocks below the fold is instant. */\n.sw-motion-ready [data-motion].sw-in:not([data-motion-stagger]),\n.sw-motion-ready [data-motion].sw-in[data-motion-stagger] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > * {\n transition: opacity var(--sw-motion-duration, 600ms) var(--sw-motion-easing, cubic-bezier(0.2, 0.7, 0.2, 1)), transform var(--sw-motion-duration, 600ms) var(--sw-motion-easing, cubic-bezier(0.2, 0.7, 0.2, 1));\n transition-delay: calc(var(--sw-motion-wait) + var(--sw-motion-index, 0) * 80ms);\n}\n.sw-motion-ready [data-motion]:not([data-motion-stagger]):not(.sw-in),\n.sw-motion-ready [data-motion][data-motion-stagger]:not(.sw-in) :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > * { opacity: 0; transform: var(--sw-motion-from); }\n[data-motion-hover] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *, [data-motion-hover].sw-image, [data-motion-hover] img { transition: transform 200ms ease, box-shadow 200ms ease; }\n[data-sw-motion] [data-motion-hover=\"lift\"] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *:hover, [data-sw-motion] [data-motion-hover=\"lift\"].sw-image:hover { transform: translateY(-4px); box-shadow: var(--sw-shadow, 0 8px 24px rgba(0, 0, 0, 0.12)); }\n[data-motion-hover=\"zoom\"] :is(:is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *, .sw-image) { overflow: hidden; }\n[data-sw-motion] [data-motion-hover=\"zoom\"] :is(:is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *, .sw-image):hover img, [data-sw-motion] [data-motion-hover=\"zoom\"].sw-image:hover img { transform: scale(1.05); }\n[data-sw-motion=\"expressive\"] [data-motion-hover=\"tilt\"] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *:hover { transform: perspective(800px) rotateX(2deg) rotateY(-3deg) translateY(-2px); }\n/* On scroll: the page script writes --sw-scroll (0 as the block enters at the bottom, 1 as it leaves at the top); unset, every\n effect sits at rest. Parallax moves a Hero's background slower than the page (half as far at the subtle level). */\n[data-motion-scroll=\"parallax\"] { --sw-parallax: 16%; }\n[data-sw-motion=\"subtle\"] [data-motion-scroll=\"parallax\"] { --sw-parallax: 8%; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"].sw-hero--image { overflow: hidden; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"] .sw-hero__bg { transform: translateY(calc((var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax))) scale(1.18); will-change: transform; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"].sw-hero--image:not(:has(.sw-hero__bg)) { background-position: center calc(50% + (var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax) * 4); }\n[data-sw-motion] [data-motion-scroll=\"fade-out\"] { opacity: clamp(0, calc((1 - var(--sw-scroll, 0)) / 0.35), 1); }\n[data-sw-motion] [data-motion-scroll=\"pin\"] { position: sticky; top: 0; z-index: 0; }\n[data-sw-motion] [data-motion-scroll=\"pin\"] ~ * { position: relative; z-index: 1; }\n.sw-visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n.sw-hero { position: relative; }\n.sw-video-toggle { position: absolute; right: var(--sw-space-3, 1rem); bottom: var(--sw-space-3, 1rem); z-index: 1; font: inherit; font-size: 0.8125rem; color: #ffffff; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 999px; padding: 0.3rem 0.85rem; cursor: pointer; }\n.sw-video-toggle:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }\n/* Marquee (Logo strip, Testimonials): the page script adds sw-marquee-on and copies the items (the copies are hidden from\n assistive technology) so the row loops; items carry their spacing as a margin so moving by half is seamless. */\n[data-motion-marquee]:not(.sw-marquee-on) [data-sw-marquee-clone] { display: none; }\n.sw-marquee-on .sw-container { overflow: hidden; }\n.sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) { display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: 0; width: max-content; animation: sw-marquee var(--sw-marquee-duration, 40s) linear infinite; }\n.sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) > * { flex: none; margin-inline-end: var(--sw-marquee-gap, var(--sw-space-4, 2rem)); }\n.sw-testimonials.sw-marquee-on .sw-testimonials__grid > * { width: min(22rem, 80vw); --sw-marquee-gap: var(--sw-space-3, 1.5rem); }\n.sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid):hover, .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid):focus-within, .sw-marquee-paused :is(.sw-logos__list, .sw-testimonials__grid) { animation-play-state: paused; }\n@keyframes sw-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }\n.sw-lottie-toggle { display: block; margin: var(--sw-space-1, 0.5rem) auto 0; font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-lottie-toggle[hidden] { display: none; }\n.sw-marquee-toggle { display: block; margin: 0 auto var(--sw-space-3, 1rem); font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-marquee-toggle[hidden] { display: none; }\n.sw-motion-switch { font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-motion-switch[aria-pressed=\"true\"] { background: var(--sw-color-text); color: var(--sw-color-bg); opacity: 1; }\n.sw-reduce-motion *, .sw-reduce-motion *::before, .sw-reduce-motion *::after { transition: none !important; animation: none !important; }\n.sw-reduce-motion [data-motion], .sw-reduce-motion [data-motion] *, .sw-reduce-motion [data-motion-scroll], .sw-reduce-motion [data-motion-scroll] * { opacity: 1 !important; transform: none !important; }\n@media (prefers-reduced-motion: reduce) {\n html:not(.sw-motion-allowed) :is([data-motion], [data-motion-scroll]), html:not(.sw-motion-allowed) :is([data-motion], [data-motion-scroll]) * { opacity: 1 !important; transform: none !important; transition: none !important; }\n html:not(.sw-motion-allowed) .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) { animation: none !important; }\n}\n";
|
|
11
|
+
export declare const MOTION_CSS = "\n/* Motion: entrances (armed by the page's motion script), stagger and hover. */\n[data-motion] { --sw-motion-from: none; --sw-motion-wait: 0ms; }\n[data-motion=\"rise\"] { --sw-motion-from: translateY(var(--sw-motion-distance, 24px)); }\n[data-motion=\"scale\"] { --sw-motion-from: scale(0.94); }\n[data-motion=\"slide-left\"] { --sw-motion-from: translateX(calc(-1 * var(--sw-motion-distance, 24px))); }\n[data-motion=\"slide-right\"] { --sw-motion-from: translateX(var(--sw-motion-distance, 24px)); }\n[data-sw-motion=\"subtle\"] :is([data-motion=\"scale\"], [data-motion=\"slide-left\"], [data-motion=\"slide-right\"]) { --sw-motion-from: translateY(calc(var(--sw-motion-distance, 24px) / 2)); }\n[data-sw-motion=\"subtle\"] [data-motion=\"rise\"] { --sw-motion-from: translateY(calc(var(--sw-motion-distance, 24px) / 2)); }\n[data-motion-delay=\"short\"] { --sw-motion-wait: 150ms; }\n[data-motion-delay=\"medium\"] { --sw-motion-wait: 300ms; }\n/* The transition runs only as a block arrives (sw-in), so hiding the blocks below the fold is instant. */\n.sw-motion-ready [data-motion].sw-in:not([data-motion-stagger]),\n.sw-motion-ready [data-motion].sw-in[data-motion-stagger] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > * {\n transition: opacity var(--sw-motion-duration, 600ms) var(--sw-motion-easing, cubic-bezier(0.2, 0.7, 0.2, 1)), transform var(--sw-motion-duration, 600ms) var(--sw-motion-easing, cubic-bezier(0.2, 0.7, 0.2, 1));\n transition-delay: calc(var(--sw-motion-wait) + var(--sw-motion-index, 0) * 80ms);\n}\n.sw-motion-ready [data-motion]:not([data-motion-stagger]):not(.sw-in),\n.sw-motion-ready [data-motion][data-motion-stagger]:not(.sw-in) :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > * { opacity: 0; transform: var(--sw-motion-from); }\n[data-motion-hover] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *, [data-motion-hover].sw-image, [data-motion-hover] img { transition: transform 200ms ease, box-shadow 200ms ease; }\n[data-sw-motion] [data-motion-hover=\"lift\"] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *:hover, [data-sw-motion] [data-motion-hover=\"lift\"].sw-image:hover { transform: translateY(-4px); box-shadow: var(--sw-shadow, 0 8px 24px rgba(0, 0, 0, 0.12)); }\n[data-motion-hover=\"zoom\"] :is(:is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *, .sw-image) { overflow: hidden; }\n[data-sw-motion] [data-motion-hover=\"zoom\"] :is(:is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *, .sw-image):hover img, [data-sw-motion] [data-motion-hover=\"zoom\"].sw-image:hover img { transform: scale(1.05); }\n[data-sw-motion=\"expressive\"] [data-motion-hover=\"tilt\"] :is(.sw-cards__grid, .sw-collection__list, .sw-gallery__grid, .sw-faq__list, .sw-logos__list, .sw-stats__grid, .sw-testimonials__grid, .sw-buttons) > *:hover { transform: perspective(800px) rotateX(2deg) rotateY(-3deg) translateY(-2px); }\n/* On scroll: the page script writes --sw-scroll (0 as the block enters at the bottom, 1 as it leaves at the top); unset, every\n effect sits at rest. Parallax moves a Hero's background slower than the page (half as far at the subtle level). */\n[data-motion-scroll=\"parallax\"] { --sw-parallax: 16%; }\n[data-sw-motion=\"subtle\"] [data-motion-scroll=\"parallax\"] { --sw-parallax: 8%; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"].sw-hero--image { overflow: hidden; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"] .sw-hero__bg { transform: translateY(calc((var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax))) scale(1.18); will-change: transform; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"].sw-section--media > :is(.sw-section__bg, picture > .sw-section__bg) { transform: translateY(calc((var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax))) scale(1.18); will-change: transform; }\n[data-sw-motion] [data-motion-scroll=\"parallax\"].sw-hero--image:not(:has(.sw-hero__bg)) { background-position: center calc(50% + (var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax) * 4); }\n[data-sw-motion] [data-motion-scroll=\"fade-out\"] { opacity: clamp(0, calc((1 - var(--sw-scroll, 0)) / 0.35), 1); }\n[data-sw-motion] [data-motion-scroll=\"pin\"] { position: sticky; top: 0; z-index: 0; }\n[data-sw-motion] [data-motion-scroll=\"pin\"] ~ * { position: relative; z-index: 1; }\n.sw-visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }\n.sw-hero, .sw-section--media { position: relative; }\n.sw-video-toggle { position: absolute; right: var(--sw-space-3, 1rem); bottom: var(--sw-space-3, 1rem); z-index: 1; font: inherit; font-size: 0.8125rem; color: #ffffff; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 999px; padding: 0.3rem 0.85rem; cursor: pointer; }\n.sw-video-toggle:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }\n/* Marquee (Logo strip, Testimonials): the page script adds sw-marquee-on and copies the items (the copies are hidden from\n assistive technology) so the row loops; items carry their spacing as a margin so moving by half is seamless. */\n[data-motion-marquee]:not(.sw-marquee-on) [data-sw-marquee-clone] { display: none; }\n.sw-marquee-on .sw-container { overflow: hidden; }\n.sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) { display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: 0; width: max-content; animation: sw-marquee var(--sw-marquee-duration, 40s) linear infinite; }\n.sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) > * { flex: none; margin-inline-end: var(--sw-marquee-gap, var(--sw-space-4, 2rem)); }\n.sw-testimonials.sw-marquee-on .sw-testimonials__grid > * { width: min(22rem, 80vw); --sw-marquee-gap: var(--sw-space-3, 1.5rem); }\n.sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid):hover, .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid):focus-within, .sw-marquee-paused :is(.sw-logos__list, .sw-testimonials__grid) { animation-play-state: paused; }\n@keyframes sw-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }\n.sw-lottie-toggle { display: block; margin: var(--sw-space-1, 0.5rem) auto 0; font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-lottie-toggle[hidden] { display: none; }\n.sw-marquee-toggle { display: block; margin: 0 auto var(--sw-space-3, 1rem); font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-marquee-toggle[hidden] { display: none; }\n.sw-motion-switch { font: inherit; font-size: 0.8125rem; color: inherit; background: none; border: 1px solid currentColor; border-radius: 999px; padding: 0.2rem 0.75rem; cursor: pointer; opacity: 0.85; }\n.sw-motion-switch[aria-pressed=\"true\"] { background: var(--sw-color-text); color: var(--sw-color-bg); opacity: 1; }\n.sw-reduce-motion *, .sw-reduce-motion *::before, .sw-reduce-motion *::after { transition: none !important; animation: none !important; }\n.sw-reduce-motion [data-motion], .sw-reduce-motion [data-motion] *, .sw-reduce-motion [data-motion-scroll], .sw-reduce-motion [data-motion-scroll] * { opacity: 1 !important; transform: none !important; }\n@media (prefers-reduced-motion: reduce) {\n html:not(.sw-motion-allowed) :is([data-motion], [data-motion-scroll]), html:not(.sw-motion-allowed) :is([data-motion], [data-motion-scroll]) * { opacity: 1 !important; transform: none !important; transition: none !important; }\n html:not(.sw-motion-allowed) .sw-marquee-on :is(.sw-logos__list, .sw-testimonials__grid) { animation: none !important; }\n}\n";
|
|
12
12
|
/** The visitor's choice in local storage: "1" reduce, "0" allow; absent follows the operating system. */
|
|
13
13
|
export declare const MOTION_STORAGE_KEY = "sw-reduce-motion";
|
|
14
14
|
/**
|
package/dist/motion.js
CHANGED
|
@@ -40,12 +40,13 @@ export const MOTION_CSS = `
|
|
|
40
40
|
[data-sw-motion="subtle"] [data-motion-scroll="parallax"] { --sw-parallax: 8%; }
|
|
41
41
|
[data-sw-motion] [data-motion-scroll="parallax"].sw-hero--image { overflow: hidden; }
|
|
42
42
|
[data-sw-motion] [data-motion-scroll="parallax"] .sw-hero__bg { transform: translateY(calc((var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax))) scale(1.18); will-change: transform; }
|
|
43
|
+
[data-sw-motion] [data-motion-scroll="parallax"].sw-section--media > :is(.sw-section__bg, picture > .sw-section__bg) { transform: translateY(calc((var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax))) scale(1.18); will-change: transform; }
|
|
43
44
|
[data-sw-motion] [data-motion-scroll="parallax"].sw-hero--image:not(:has(.sw-hero__bg)) { background-position: center calc(50% + (var(--sw-scroll, 0.5) - 0.5) * var(--sw-parallax) * 4); }
|
|
44
45
|
[data-sw-motion] [data-motion-scroll="fade-out"] { opacity: clamp(0, calc((1 - var(--sw-scroll, 0)) / 0.35), 1); }
|
|
45
46
|
[data-sw-motion] [data-motion-scroll="pin"] { position: sticky; top: 0; z-index: 0; }
|
|
46
47
|
[data-sw-motion] [data-motion-scroll="pin"] ~ * { position: relative; z-index: 1; }
|
|
47
48
|
.sw-visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
|
|
48
|
-
.sw-hero { position: relative; }
|
|
49
|
+
.sw-hero, .sw-section--media { position: relative; }
|
|
49
50
|
.sw-video-toggle { position: absolute; right: var(--sw-space-3, 1rem); bottom: var(--sw-space-3, 1rem); z-index: 1; font: inherit; font-size: 0.8125rem; color: #ffffff; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.6); border-radius: 999px; padding: 0.3rem 0.85rem; cursor: pointer; }
|
|
50
51
|
.sw-video-toggle:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
|
|
51
52
|
/* Marquee (Logo strip, Testimonials): the page script adds sw-marquee-on and copies the items (the copies are hidden from
|
|
@@ -158,7 +159,7 @@ blocks.forEach(function(b){if(b.hasAttribute('data-motion-stagger'))[].slice.cal
|
|
|
158
159
|
setVideos();setPlays();setMarquees();setStories();setModels();watchModels();watchLotties();watchScenes();
|
|
159
160
|
if(sync()||!h.hasAttribute('data-sw-motion')||!('IntersectionObserver' in window)){blocks.forEach(arrive);return}
|
|
160
161
|
var counters=[].slice.call(d.querySelectorAll('[data-motion-count]'));
|
|
161
|
-
var cio=new IntersectionObserver(function(es){es.forEach(function(en){if(en.isIntersecting){cio.unobserve(en.target);count(en.target)}})},{threshold:0.4});
|
|
162
|
+
var cio=new IntersectionObserver(function(es){es.forEach(function(en){if(en.isIntersecting){cio.unobserve(en.target);en.target.setAttribute('data-motion-counted','');count(en.target)}})},{threshold:0.4});
|
|
162
163
|
counters.forEach(function(c){cio.observe(c)});
|
|
163
164
|
var vh=window.innerHeight||d.documentElement.clientHeight;
|
|
164
165
|
var io=new IntersectionObserver(function(es){es.forEach(function(en){if(en.isIntersecting){arrive(en.target);io.unobserve(en.target)}})},{rootMargin:'0px 0px -8% 0px'});
|
package/dist/motion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"motion.js","sourceRoot":"","sources":["../src/motion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,8GAA8G;AAC9G,MAAM,KAAK,GAAG,qJAAqJ,CAAC;AAEpK,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;4DAakC,KAAK;;;;;kEAKC,KAAK;sBACjD,KAAK;8CACmB,KAAK;iCAClB,KAAK;kDACY,KAAK;2DACI,KAAK
|
|
1
|
+
{"version":3,"file":"motion.js","sourceRoot":"","sources":["../src/motion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,8GAA8G;AAC9G,MAAM,KAAK,GAAG,qJAAqJ,CAAC;AAEpK,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;4DAakC,KAAK;;;;;kEAKC,KAAK;sBACjD,KAAK;8CACmB,KAAK;iCAClB,KAAK;kDACY,KAAK;2DACI,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC/D,CAAC;AAEF,yGAAyG;AACzG,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,oDAAoD,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uGA2EZ,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,MAAM,CAAC;;;;;;;;;;MAU/H,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Campaign progress (docs/dev/utility-blocks.md): the amount raised against a goal as a bar, from numbers typed in the block or,
|
|
3
|
+
* through the server's resolver (`resolved`), from a payment form's paid gifts or a module's progress source. The bar is a
|
|
4
|
+
* `role="progressbar"` with its value as text, and the same sentence is visible. The optional count-up is the motion script's
|
|
5
|
+
* (`data-motion-count`), so it follows the brand's motion level, reduced motion and the Reduce motion switch. Server-safe and pure.
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentConfig } from '@puckeditor/core';
|
|
8
|
+
export interface CampaignProgressProps {
|
|
9
|
+
title: string;
|
|
10
|
+
text: string;
|
|
11
|
+
/** Where the numbers come from: typed here, a payment form's paid gifts, or a module's progress source. */
|
|
12
|
+
source: 'manual' | 'form' | 'module';
|
|
13
|
+
raised: number;
|
|
14
|
+
goal: number;
|
|
15
|
+
/** The number of gifts (typed numbers only; a source answers its own). */
|
|
16
|
+
count: number;
|
|
17
|
+
/** source form: the form's key. */
|
|
18
|
+
formKey: string;
|
|
19
|
+
/** source module: the key a module registered with registerProgressSource. */
|
|
20
|
+
sourceKey: string;
|
|
21
|
+
format: 'currency' | 'number';
|
|
22
|
+
/** ISO 4217 (usd); a source's own currency wins. */
|
|
23
|
+
currency: string;
|
|
24
|
+
/** For plain numbers: what is counted ("meals", "volunteers"). */
|
|
25
|
+
unit: string;
|
|
26
|
+
showCount: boolean;
|
|
27
|
+
/** What a gift is called in the count ("gifts", "donors"). */
|
|
28
|
+
countLabel: string;
|
|
29
|
+
/** Numbers count up and the bar fills as the block comes into view (motion rules apply). */
|
|
30
|
+
countUp: boolean;
|
|
31
|
+
/** Added by the server's resolver, never stored. */
|
|
32
|
+
resolved?: {
|
|
33
|
+
raised: number;
|
|
34
|
+
goal: number;
|
|
35
|
+
currency: string | null;
|
|
36
|
+
count: number | null;
|
|
37
|
+
source: string;
|
|
38
|
+
missing?: boolean;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** 12500 usd → "$12,500"; 12.5 → "$12.50"; plain numbers with grouping; an unknown currency falls back to plain. */
|
|
42
|
+
export declare function formatAmount(n: number, currency: string | null | undefined): string;
|
|
43
|
+
/** The percentage of the goal reached, whole, floored (99.6 percent is not yet 100); 0 without a goal. */
|
|
44
|
+
export declare function percentOf(raised: number, goal: number): number;
|
|
45
|
+
export declare const campaignProgressComponent: ComponentConfig<CampaignProgressProps>;
|
|
46
|
+
export declare const PROGRESS_CSS = "\n/* ---------- Campaign progress ---------- */\n.sw-progress__title { margin: 0 0 var(--sw-space-1); }\n.sw-progress__text { margin: 0 0 var(--sw-space-2); color: var(--sw-color-muted); max-width: 70ch; }\n.sw-progress__figures { margin: 0 0 var(--sw-space-1); font-size: 1.125rem; }\n.sw-progress__raised { font-family: var(--sw-font-heading); font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 700; color: var(--sw-color-primary); font-variant-numeric: tabular-nums; }\n.sw-progress__bar { position: relative; height: 1rem; overflow: hidden; border-radius: 999px; background: var(--sw-color-surface); border: 1px solid var(--sw-color-border); }\n.sw-progress__fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(var(--sw-progress, 0)); background: var(--sw-color-primary); border-radius: inherit; }\n[dir=\"rtl\"] .sw-progress__fill { transform-origin: right center; }\n.sw-progress__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sw-space-1); margin: var(--sw-space-1) 0 0; color: var(--sw-color-muted); font-variant-numeric: tabular-nums; }\n.sw-progress__pct { font-weight: 700; color: var(--sw-color-text); }\n@media (prefers-reduced-motion: no-preference) {\n html.sw-motion-ready:not(.sw-reduce-motion) .sw-progress[data-motion-count] .sw-progress__fill { transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1); }\n html.sw-motion-ready:not(.sw-reduce-motion) .sw-progress[data-motion-count]:not([data-motion-counted]) .sw-progress__fill { transform: scaleX(0); }\n}\n";
|
package/dist/progress.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { countableValue } from './marketing.js';
|
|
3
|
+
import { cx, keyFor, textOf } from './utility-shared.js';
|
|
4
|
+
let currencies = null;
|
|
5
|
+
/** Whether Intl knows the currency (it formats any three letters, "ZZZ 1,200", otherwise). */
|
|
6
|
+
function knownCurrency(code) {
|
|
7
|
+
const list = Intl.supportedValuesOf;
|
|
8
|
+
if (!list)
|
|
9
|
+
return true;
|
|
10
|
+
currencies ??= new Set(list('currency'));
|
|
11
|
+
return currencies.has(code.toUpperCase());
|
|
12
|
+
}
|
|
13
|
+
/** 12500 usd → "$12,500"; 12.5 → "$12.50"; plain numbers with grouping; an unknown currency falls back to plain. */
|
|
14
|
+
export function formatAmount(n, currency) {
|
|
15
|
+
const v = Number.isFinite(n) ? n : 0;
|
|
16
|
+
const whole = Math.abs(v - Math.round(v)) < 0.005;
|
|
17
|
+
if (currency && /^[a-z]{3}$/i.test(currency) && knownCurrency(currency)) {
|
|
18
|
+
try {
|
|
19
|
+
return new Intl.NumberFormat('en-US', { style: 'currency', currency: currency.toUpperCase(), minimumFractionDigits: whole ? 0 : 2, maximumFractionDigits: whole ? 0 : 2 }).format(v);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
/* not a currency Intl knows: plain number */
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return new Intl.NumberFormat('en-US', { maximumFractionDigits: whole ? 0 : 2 }).format(v);
|
|
26
|
+
}
|
|
27
|
+
/** The percentage of the goal reached, whole, floored (99.6 percent is not yet 100); 0 without a goal. */
|
|
28
|
+
export function percentOf(raised, goal) {
|
|
29
|
+
return goal > 0 && raised > 0 ? Math.floor((raised / goal) * 100) : 0;
|
|
30
|
+
}
|
|
31
|
+
/** A figure that counts up when the motion script runs: the digits for the eye, the final value once for screen readers. */
|
|
32
|
+
function Figure({ value, countUp, className }) {
|
|
33
|
+
const n = countUp ? countableValue(value) : null;
|
|
34
|
+
if (!n)
|
|
35
|
+
return _jsx("span", { className: className, children: value });
|
|
36
|
+
return (_jsxs("span", { className: className, children: [_jsx("span", { "aria-hidden": "true", "data-count-to": n.to, "data-count-prefix": n.prefix, "data-count-suffix": n.suffix, "data-count-decimals": n.decimals, "data-count-group": n.group ? '' : undefined, children: value }), _jsx("span", { className: "sw-visually-hidden", children: value })] }));
|
|
37
|
+
}
|
|
38
|
+
export const campaignProgressComponent = {
|
|
39
|
+
label: 'Campaign progress',
|
|
40
|
+
fields: {
|
|
41
|
+
title: { type: 'text', label: 'Title', contentEditable: true },
|
|
42
|
+
text: { type: 'textarea', label: 'Text' },
|
|
43
|
+
source: { type: 'radio', label: 'Numbers from', options: [{ label: 'Typed here', value: 'manual' }, { label: 'A payment form', value: 'form' }, { label: 'A module', value: 'module' }] },
|
|
44
|
+
raised: { type: 'number', label: 'Raised', min: 0 },
|
|
45
|
+
goal: { type: 'number', label: 'Goal', min: 0 },
|
|
46
|
+
count: { type: 'number', label: 'Number of gifts (typed numbers)', min: 0 },
|
|
47
|
+
formKey: { type: 'text', label: 'Payment form key (numbers from a payment form)' },
|
|
48
|
+
sourceKey: { type: 'text', label: 'Module source key (numbers from a module)' },
|
|
49
|
+
format: { type: 'radio', label: 'Show as', options: [{ label: 'Money', value: 'currency' }, { label: 'Plain numbers', value: 'number' }] },
|
|
50
|
+
currency: { type: 'text', label: 'Currency (ISO code, such as usd)', placeholder: 'usd' },
|
|
51
|
+
unit: { type: 'text', label: 'Unit for plain numbers', placeholder: 'meals' },
|
|
52
|
+
showCount: { type: 'radio', label: 'Number of gifts', options: [{ label: 'Show', value: true }, { label: 'Hide', value: false }] },
|
|
53
|
+
countLabel: { type: 'text', label: 'What a gift is called', placeholder: 'gifts' },
|
|
54
|
+
countUp: { type: 'radio', label: 'Count up as it comes into view', options: [{ label: 'Off', value: false }, { label: 'On', value: true }] },
|
|
55
|
+
},
|
|
56
|
+
defaultProps: {
|
|
57
|
+
title: 'Help us reach our goal',
|
|
58
|
+
text: '',
|
|
59
|
+
source: 'manual',
|
|
60
|
+
raised: 12500,
|
|
61
|
+
goal: 50000,
|
|
62
|
+
count: 0,
|
|
63
|
+
formKey: '',
|
|
64
|
+
sourceKey: '',
|
|
65
|
+
format: 'currency',
|
|
66
|
+
currency: 'usd',
|
|
67
|
+
unit: '',
|
|
68
|
+
showCount: false,
|
|
69
|
+
countLabel: 'gifts',
|
|
70
|
+
countUp: false,
|
|
71
|
+
},
|
|
72
|
+
render: (props) => {
|
|
73
|
+
const { title, text, format, currency, unit, showCount, countLabel, countUp, resolved } = props;
|
|
74
|
+
const raised = Math.max(0, Number(resolved?.raised ?? props.raised) || 0);
|
|
75
|
+
const goal = Math.max(0, Number(resolved?.goal ?? props.goal) || 0);
|
|
76
|
+
const count = resolved ? resolved.count : Number.isFinite(Number(props.count)) && Number(props.count) > 0 ? Math.floor(Number(props.count)) : null;
|
|
77
|
+
const cur = format === 'number' ? null : (resolved?.currency ?? (textOf(currency).trim().toLowerCase() || 'usd'));
|
|
78
|
+
const unitText = format === 'number' ? textOf(unit).trim() : '';
|
|
79
|
+
const pct = percentOf(raised, goal);
|
|
80
|
+
const raisedText = formatAmount(raised, cur);
|
|
81
|
+
const goalText = formatAmount(goal, cur);
|
|
82
|
+
const key = keyFor('progress', props.id, `${raised}/${goal}`);
|
|
83
|
+
const titleText = textOf(title);
|
|
84
|
+
const u = unitText ? ` ${unitText}` : '';
|
|
85
|
+
const valueText = goal > 0 ? `${raisedText}${u} raised of ${goalText}${u}, ${pct} percent` : `${raisedText}${u} raised`;
|
|
86
|
+
const animate = countUp === true;
|
|
87
|
+
return (_jsx("section", { className: "sw-block sw-progress", "data-motion-count": animate ? '' : undefined, "aria-labelledby": titleText ? `${key}-title` : undefined, children: _jsxs("div", { className: "sw-container", children: [titleText ? (_jsx("h2", { className: "sw-progress__title", id: `${key}-title`, children: title })) : null, textOf(text).trim() ? _jsx("p", { className: "sw-progress__text", children: text }) : null, _jsxs("p", { className: "sw-progress__figures", children: [_jsx(Figure, { className: "sw-progress__raised", value: raisedText, countUp: animate }), u ? _jsx("span", { className: "sw-progress__unit", children: u }) : null, _jsx("span", { className: "sw-progress__of", children: goal > 0 ? ` raised of ${goalText}${u}` : ' raised' })] }), _jsx("div", { className: cx('sw-progress__bar', pct >= 100 && 'sw-progress__bar--met'), role: "progressbar", "aria-labelledby": titleText ? `${key}-title` : undefined, "aria-label": titleText ? undefined : 'Campaign progress', "aria-valuemin": 0, "aria-valuemax": goal > 0 ? goal : 100, "aria-valuenow": goal > 0 ? Math.min(raised, goal) : 0, "aria-valuetext": valueText, children: _jsx("span", { className: "sw-progress__fill", style: { ['--sw-progress']: String(Math.min(1, goal > 0 ? raised / goal : 0).toFixed(4)) } }) }), _jsxs("p", { className: "sw-progress__meta", children: [goal > 0 ? (_jsxs("span", { children: [_jsx(Figure, { className: "sw-progress__pct", value: `${pct}%`, countUp: animate }), " of the goal"] })) : null, showCount && count !== null ? (_jsx("span", { children: `${formatAmount(count, null)} ${textOf(countLabel).trim() || 'gifts'}` })) : null] })] }) }));
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
export const PROGRESS_CSS = `
|
|
91
|
+
/* ---------- Campaign progress ---------- */
|
|
92
|
+
.sw-progress__title { margin: 0 0 var(--sw-space-1); }
|
|
93
|
+
.sw-progress__text { margin: 0 0 var(--sw-space-2); color: var(--sw-color-muted); max-width: 70ch; }
|
|
94
|
+
.sw-progress__figures { margin: 0 0 var(--sw-space-1); font-size: 1.125rem; }
|
|
95
|
+
.sw-progress__raised { font-family: var(--sw-font-heading); font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 700; color: var(--sw-color-primary); font-variant-numeric: tabular-nums; }
|
|
96
|
+
.sw-progress__bar { position: relative; height: 1rem; overflow: hidden; border-radius: 999px; background: var(--sw-color-surface); border: 1px solid var(--sw-color-border); }
|
|
97
|
+
.sw-progress__fill { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(var(--sw-progress, 0)); background: var(--sw-color-primary); border-radius: inherit; }
|
|
98
|
+
[dir="rtl"] .sw-progress__fill { transform-origin: right center; }
|
|
99
|
+
.sw-progress__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sw-space-1); margin: var(--sw-space-1) 0 0; color: var(--sw-color-muted); font-variant-numeric: tabular-nums; }
|
|
100
|
+
.sw-progress__pct { font-weight: 700; color: var(--sw-color-text); }
|
|
101
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
102
|
+
html.sw-motion-ready:not(.sw-reduce-motion) .sw-progress[data-motion-count] .sw-progress__fill { transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1); }
|
|
103
|
+
html.sw-motion-ready:not(.sw-reduce-motion) .sw-progress[data-motion-count]:not([data-motion-counted]) .sw-progress__fill { transform: scaleX(0); }
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../src/progress.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA6BzD,IAAI,UAAU,GAAuB,IAAI,CAAC;AAC1C,8FAA8F;AAC9F,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,IAAI,GAAI,IAAwD,CAAC,iBAAiB,CAAC;IACzF,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACvB,UAAU,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACzC,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,oHAAoH;AACpH,MAAM,UAAU,YAAY,CAAC,CAAS,EAAE,QAAmC;IACzE,MAA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AC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAI,GACxI,EACN,aAAG,SAAS,EAAC,mBAAmB,aAC7B,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CACV,2BACE,KAAC,MAAM,IAAC,SAAS,EAAC,kBAAkB,EAAC,KAAK,EAAE,GAAG,GAAG,GAAG,EAAE,OAAO,EAAE,OAAO,GAAI,oBACtE,CACR,CAAC,CAAC,CAAC,IAAI,EACP,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,CAC7B,yBAAO,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,OAAO,EAAE,GAAQ,CACtF,CAAC,CAAC,CAAC,IAAI,IACN,IACA,GACE,CACX,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;CAe3B,CAAC"}
|
package/dist/registry-package.js
CHANGED
|
@@ -56,7 +56,7 @@ export const registryPackageComponent = {
|
|
|
56
56
|
return (_jsx("section", { className: "sw-block sw-reg-package", children: _jsx("div", { className: "sw-container", children: _jsx(Placeholder, { label: "Registry package: resolved from the page path (/registry/<name>)" }) }) }));
|
|
57
57
|
}
|
|
58
58
|
const isModule = data.kind === 'module';
|
|
59
|
-
return (_jsx("article", { className: "sw-block sw-reg-package", "data-package": data.name, "data-kind": data.kind, children: _jsxs("div", { className: "sw-container", children: [_jsxs("header", { className: "sw-reg-package__head", children: [_jsxs("div", { className: "sw-reg-package__title-row", children: [_jsx("h1", { className: "sw-reg-package__name", children: data.name }), data.latest ? _jsxs("code", { className: "sw-reg-package__version", children: ["v", data.latest] }) : null] }), _jsxs("div", { className: "sw-reg-badges", children: [_jsx(KindBadge, { kind: data.kind }), isModule ? _jsx(TierBadge, { tier: data.tier }) : null, _jsx(StatusBadges, { reviewed: data.reviewed, checked: data.checked, verified: Boolean(data.org ? data.org.verified : data.publisher?.verified), deprecated: Boolean(data.deprecated) })] }), data.description ? _jsx("p", { className: "sw-reg-package__desc", children: data.description }) : null, _jsxs("dl", { className: "sw-reg-package__facts", children: [data.org ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "By" }), _jsxs("dd", { children: [_jsx("a", { href: data.org.href, rel: "author", className: "sw-reg-package__org", children: data.org.name || data.org.handle }), data.org.verified ? _jsx("span", { className: "sw-reg-package__verified", children: " (verified organization)" }) : null] })] })) : null, data.publisher ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Publisher" }), _jsxs("dd", { children: [_jsx("a", { href: data.publisher.href, rel: "author", children: data.publisher.name || data.publisher.handle }), data.publisher.verified ? _jsx("span", { className: "sw-reg-package__verified", children: " (verified)" }) : null] })] })) : null, _jsx("dt", { children: "Downloads" }), _jsx("dd", { children: formatCount(data.downloads) }), data.license ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "License" }), _jsx("dd", { children: data.license })] })) : null, data.compatibility ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Spillway" }), _jsx("dd", { children: _jsx("code", { children: data.compatibility }) })] })) : null, data.updatedAt ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Updated" }), _jsx("dd", { children: _jsx("time", { dateTime: data.updatedAt, children: formatDate(data.updatedAt) }) })] })) : null] }), _jsxs("ul", { className: "sw-reg-package__links", children: [data.homepage ? (_jsx("li", { children: _jsx("a", { href: data.homepage, rel: "noopener", children: "Homepage" }) })) : null, data.repository ? (_jsx("li", { children: _jsx("a", { href: data.repository, rel: "noopener", children: "Repository" }) })) : null, data.previewHref ? (_jsx("li", { children: _jsx("a", { href: data.previewHref, children: "Preview" }) })) : null, _jsx("li", { children: _jsx("a", { href: data.manifestUrl, children: "manifest.json" }) })] })] }), data.deprecated ? (_jsxs("div", { className: "sw-reg-banner sw-reg-banner--deprecated", role: "status", children: [_jsx("strong", { className: "sw-reg-banner__title", children: "Deprecated" }), " ", data.deprecated.reason || 'The publisher no longer maintains this package.', data.deprecated.since ? _jsxs("span", { className: "sw-reg-banner__meta", children: [" \u00B7 since ", formatDate(data.deprecated.since)] }) : null] })) : null, data.pendingReview ? (_jsxs("div", { className: "sw-reg-banner sw-reg-banner--pending", role: "status", children: [_jsx("strong", { className: "sw-reg-banner__title", children: "Awaiting review." }), " This trusted module runs in the server process. It is listed here by direct link only until a maintainer has read the code; install it only if you trust the publisher."] })) : null, _jsx(Advisories, { items: data.advisories }), _jsxs("div", { className: "sw-reg-package__grid", children: [_jsxs("div", { className: "sw-reg-package__main", children: [_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-install`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-install`, children: "Install" }), _jsx(InstallBox, { id: bid, command: data.installCommand, nonce: nonce }), data.kind === 'module' ? (_jsxs("p", { className: "sw-reg-section__hint", children: ["Or in the admin: ", _jsx("strong", { children: "Modules \u2192 Install from registry" }), ", search for ", _jsx("code", { children: data.name }), "."] })) : (_jsxs("p", { className: "sw-reg-section__hint", children: ["Or in the admin: ", _jsx("strong", { children: "Kits \u2192 Install from registry" }), ", search for ", _jsx("code", { children: data.name }), "."] }))] }), data.pack ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-pack`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-pack`, children: "What the pack adds" }), _jsxs("p", { className: "sw-reg-section__hint", children: ["Patterns land in the site\u2019s pattern library. Styles land in the brand draft for review and follow the site\u2019s colors and fonts.", data.pack.components?.length ? _jsx(_Fragment, { children: " Site components arrive as drafts in the component studio, where someone publishes them." }) : null] }), data.pack.patterns.length ? (_jsxs(_Fragment, { children: [_jsx("h3", { className: "sw-reg-pack__title", children: "Patterns" }), _jsx("ul", { className: "sw-reg-pack__list", children: data.pack.patterns.map((p, i) => (_jsxs("li", { children: [_jsx("strong", { children: p.label }), " ", _jsx("span", { className: "sw-reg-pack__meta", children: p.category }), p.description ? _jsx("span", { className: "sw-reg-pack__desc", children: p.description }) : null] }, i))) })] })) : null, data.pack.components?.length ? (_jsxs(_Fragment, { children: [_jsx("h3", { className: "sw-reg-pack__title", children: "Site components" }), _jsx("ul", { className: "sw-reg-pack__list", children: data.pack.components.map((c, i) => (_jsxs("li", { children: [_jsx("strong", { children: c.label }), c.fields.length ? _jsxs("span", { className: "sw-reg-pack__meta", children: ["Fields: ", c.fields.join(', ')] }) : null, c.variants.length ? _jsxs("span", { className: "sw-reg-pack__meta", children: ["Variants: ", c.variants.join(', ')] }) : null, c.description ? _jsx("span", { className: "sw-reg-pack__desc", children: c.description }) : null] }, i))) })] })) : null, data.pack.styles.length ? (_jsxs(_Fragment, { children: [_jsx("h3", { className: "sw-reg-pack__title", children: "Block styles" }), _jsx("ul", { className: "sw-reg-pack__list", children: data.pack.styles.map((s) => (_jsxs("li", { children: [_jsx("strong", { children: s.label }), " ", _jsx("span", { className: "sw-reg-pack__meta", children: s.block }), s.description ? _jsx("span", { className: "sw-reg-pack__desc", children: s.description }) : null] }, `${s.block}:${s.key}`))) })] })) : null] })) : null, showReadme !== false && data.readmeHtml ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-readme`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-readme`, children: "README" }), _jsx("div", { className: "sw-prose sw-reg-readme", dangerouslySetInnerHTML: { __html: keyboardScrollable(data.readmeHtml) } })] })) : null, showVersions !== false ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-versions`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-versions`, children: "Versions" }), _jsx(Versions, { items: data.versions })] })) : null, showChangelog !== false && data.changelogHtml ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-changelog`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-changelog`, children: "Changelog" }), _jsx("div", { className: "sw-prose sw-reg-readme", dangerouslySetInnerHTML: { __html: keyboardScrollable(data.changelogHtml) } })] })) : null] }), _jsxs("div", { className: "sw-reg-package__side", children: [isModule ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-caps`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-caps`, children: "Capabilities" }), data.capabilities.length === 0 ? (_jsx("p", { className: "sw-reg-empty", children: "This module declares no capabilities: it cannot read content, call out or hook into events." })) : (_jsx("ul", { className: "sw-reg-caps", children: data.capabilities.map((c) => (_jsxs("li", { className: cx('sw-reg-cap', c.sensitive && 'sw-reg-cap--sensitive'), children: [_jsx("code", { className: "sw-reg-cap__key", children: c.key }), _jsx("span", { className: "sw-reg-cap__text", children: c.explanation })] }, c.key))) })), _jsx("p", { className: "sw-reg-section__hint", children: data.tier === 'trusted'
|
|
59
|
+
return (_jsx("article", { className: "sw-block sw-reg-package", "data-package": data.name, "data-kind": data.kind, children: _jsxs("div", { className: "sw-container", children: [_jsxs("header", { className: "sw-reg-package__head", children: [_jsxs("div", { className: "sw-reg-package__title-row", children: [_jsx("h1", { className: "sw-reg-package__name", children: data.name }), data.latest ? _jsxs("code", { className: "sw-reg-package__version", children: ["v", data.latest] }) : null] }), _jsxs("div", { className: "sw-reg-badges", children: [_jsx(KindBadge, { kind: data.kind }), isModule ? _jsx(TierBadge, { tier: data.tier }) : null, _jsx(StatusBadges, { reviewed: data.reviewed, checked: data.checked, verified: Boolean(data.org ? data.org.verified : data.publisher?.verified), deprecated: Boolean(data.deprecated) })] }), data.description ? _jsx("p", { className: "sw-reg-package__desc", children: data.description }) : null, data.notices?.length ? (_jsxs("p", { className: "sw-reg-package__notices", children: [data.notices.map((n) => (_jsx("span", { className: "sw-reg-badge sw-reg-badge--notice", children: n }, n))), ' ', _jsx("span", { children: "Its scripts run in visitors' browsers on your site; mention it in your privacy policy." })] })) : null, _jsxs("dl", { className: "sw-reg-package__facts", children: [data.org ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "By" }), _jsxs("dd", { children: [_jsx("a", { href: data.org.href, rel: "author", className: "sw-reg-package__org", children: data.org.name || data.org.handle }), data.org.verified ? _jsx("span", { className: "sw-reg-package__verified", children: " (verified organization)" }) : null] })] })) : null, data.publisher ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Publisher" }), _jsxs("dd", { children: [_jsx("a", { href: data.publisher.href, rel: "author", children: data.publisher.name || data.publisher.handle }), data.publisher.verified ? _jsx("span", { className: "sw-reg-package__verified", children: " (verified)" }) : null] })] })) : null, _jsx("dt", { children: "Downloads" }), _jsx("dd", { children: formatCount(data.downloads) }), data.license ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "License" }), _jsx("dd", { children: data.license })] })) : null, data.compatibility ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Spillway" }), _jsx("dd", { children: _jsx("code", { children: data.compatibility }) })] })) : null, data.updatedAt ? (_jsxs(_Fragment, { children: [_jsx("dt", { children: "Updated" }), _jsx("dd", { children: _jsx("time", { dateTime: data.updatedAt, children: formatDate(data.updatedAt) }) })] })) : null] }), _jsxs("ul", { className: "sw-reg-package__links", children: [data.homepage ? (_jsx("li", { children: _jsx("a", { href: data.homepage, rel: "noopener", children: "Homepage" }) })) : null, data.repository ? (_jsx("li", { children: _jsx("a", { href: data.repository, rel: "noopener", children: "Repository" }) })) : null, data.previewHref ? (_jsx("li", { children: _jsx("a", { href: data.previewHref, children: "Preview" }) })) : null, _jsx("li", { children: _jsx("a", { href: data.manifestUrl, children: "manifest.json" }) })] })] }), data.deprecated ? (_jsxs("div", { className: "sw-reg-banner sw-reg-banner--deprecated", role: "status", children: [_jsx("strong", { className: "sw-reg-banner__title", children: "Deprecated" }), " ", data.deprecated.reason || 'The publisher no longer maintains this package.', data.deprecated.since ? _jsxs("span", { className: "sw-reg-banner__meta", children: [" \u00B7 since ", formatDate(data.deprecated.since)] }) : null] })) : null, data.pendingReview ? (_jsxs("div", { className: "sw-reg-banner sw-reg-banner--pending", role: "status", children: [_jsx("strong", { className: "sw-reg-banner__title", children: "Awaiting review." }), " This trusted module runs in the server process. It is listed here by direct link only until a maintainer has read the code; install it only if you trust the publisher."] })) : null, _jsx(Advisories, { items: data.advisories }), _jsxs("div", { className: "sw-reg-package__grid", children: [_jsxs("div", { className: "sw-reg-package__main", children: [_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-install`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-install`, children: "Install" }), _jsx(InstallBox, { id: bid, command: data.installCommand, nonce: nonce }), data.kind === 'module' ? (_jsxs("p", { className: "sw-reg-section__hint", children: ["Or in the admin: ", _jsx("strong", { children: "Modules \u2192 Install from registry" }), ", search for ", _jsx("code", { children: data.name }), "."] })) : (_jsxs("p", { className: "sw-reg-section__hint", children: ["Or in the admin: ", _jsx("strong", { children: "Kits \u2192 Install from registry" }), ", search for ", _jsx("code", { children: data.name }), "."] }))] }), data.pack ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-pack`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-pack`, children: "What the pack adds" }), _jsxs("p", { className: "sw-reg-section__hint", children: ["Patterns land in the site\u2019s pattern library. Styles land in the brand draft for review and follow the site\u2019s colors and fonts.", data.pack.components?.length ? _jsx(_Fragment, { children: " Site components arrive as drafts in the component studio, where someone publishes them." }) : null] }), data.pack.patterns.length ? (_jsxs(_Fragment, { children: [_jsx("h3", { className: "sw-reg-pack__title", children: "Patterns" }), _jsx("ul", { className: "sw-reg-pack__list", children: data.pack.patterns.map((p, i) => (_jsxs("li", { children: [_jsx("strong", { children: p.label }), " ", _jsx("span", { className: "sw-reg-pack__meta", children: p.category }), p.description ? _jsx("span", { className: "sw-reg-pack__desc", children: p.description }) : null] }, i))) })] })) : null, data.pack.components?.length ? (_jsxs(_Fragment, { children: [_jsx("h3", { className: "sw-reg-pack__title", children: "Site components" }), _jsx("ul", { className: "sw-reg-pack__list", children: data.pack.components.map((c, i) => (_jsxs("li", { children: [_jsx("strong", { children: c.label }), c.fields.length ? _jsxs("span", { className: "sw-reg-pack__meta", children: ["Fields: ", c.fields.join(', ')] }) : null, c.variants.length ? _jsxs("span", { className: "sw-reg-pack__meta", children: ["Variants: ", c.variants.join(', ')] }) : null, c.description ? _jsx("span", { className: "sw-reg-pack__desc", children: c.description }) : null] }, i))) })] })) : null, data.pack.styles.length ? (_jsxs(_Fragment, { children: [_jsx("h3", { className: "sw-reg-pack__title", children: "Block styles" }), _jsx("ul", { className: "sw-reg-pack__list", children: data.pack.styles.map((s) => (_jsxs("li", { children: [_jsx("strong", { children: s.label }), " ", _jsx("span", { className: "sw-reg-pack__meta", children: s.block }), s.description ? _jsx("span", { className: "sw-reg-pack__desc", children: s.description }) : null] }, `${s.block}:${s.key}`))) })] })) : null] })) : null, showReadme !== false && data.readmeHtml ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-readme`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-readme`, children: "README" }), _jsx("div", { className: "sw-prose sw-reg-readme", dangerouslySetInnerHTML: { __html: keyboardScrollable(data.readmeHtml) } })] })) : null, showVersions !== false ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-versions`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-versions`, children: "Versions" }), _jsx(Versions, { items: data.versions })] })) : null, showChangelog !== false && data.changelogHtml ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-changelog`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-changelog`, children: "Changelog" }), _jsx("div", { className: "sw-prose sw-reg-readme", dangerouslySetInnerHTML: { __html: keyboardScrollable(data.changelogHtml) } })] })) : null] }), _jsxs("div", { className: "sw-reg-package__side", children: [isModule ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-caps`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-caps`, children: "Capabilities" }), data.capabilities.length === 0 ? (_jsx("p", { className: "sw-reg-empty", children: "This module declares no capabilities: it cannot read content, call out or hook into events." })) : (_jsx("ul", { className: "sw-reg-caps", children: data.capabilities.map((c) => (_jsxs("li", { className: cx('sw-reg-cap', c.sensitive && 'sw-reg-cap--sensitive'), children: [_jsx("code", { className: "sw-reg-cap__key", children: c.key }), _jsx("span", { className: "sw-reg-cap__text", children: c.explanation })] }, c.key))) })), _jsx("p", { className: "sw-reg-section__hint", children: data.tier === 'trusted'
|
|
60
60
|
? 'Trusted modules run in the server process; the capabilities are a declaration enforced by review, not a sandbox.'
|
|
61
61
|
: 'Sandboxed extensions run in WebAssembly; the host refuses anything the manifest does not declare.' })] })) : null, data.screenshots && data.screenshots.length ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-shots`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-shots`, children: "Screenshots" }), _jsx("ul", { className: "sw-reg-shots", children: data.screenshots.map((s, i) => (_jsx("li", { children: _jsx("img", { src: s.url, alt: s.alt, loading: "lazy" }) }, i))) })] })) : null, data.keywords && data.keywords.length ? (_jsxs("section", { className: "sw-reg-section", "aria-labelledby": `${bid}-kw`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-kw`, children: "Keywords" }), _jsx("ul", { className: "sw-reg-keywords", children: data.keywords.map((k) => (_jsx("li", { children: _jsx("a", { href: `/registry?q=${encodeURIComponent(k)}`, children: k }) }, k))) })] })) : null, showAgents !== false ? (_jsxs("section", { className: "sw-reg-section sw-reg-agents", "aria-labelledby": `${bid}-agents`, children: [_jsx("h2", { className: "sw-reg-section__title", id: `${bid}-agents`, children: "For agents" }), _jsxs("p", { children: ["An AI agent with an API token can install and configure this package from a conversation. The machine-readable description (kind, versions, checksums, capabilities, settings schema and the install call) is at", ' ', _jsx("a", { href: data.manifestUrl, children: _jsx("code", { children: data.manifestUrl }) }), "."] }), data.indexUrl ? (_jsxs("p", { className: "sw-reg-section__hint", children: ["Signed index entry: ", _jsx("a", { href: data.indexUrl, children: data.indexUrl })] })) : null] })) : null] })] })] }) }));
|
|
62
62
|
},
|