@spillway-cms/blocks 0.1.22 → 0.1.24
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/ask.d.ts +8 -5
- package/dist/ask.js +46 -16
- package/dist/ask.js.map +1 -1
- package/dist/breadcrumbs.d.ts +27 -0
- package/dist/breadcrumbs.js +44 -0
- package/dist/breadcrumbs.js.map +1 -0
- package/dist/calendar.d.ts +34 -6
- package/dist/calendar.js +61 -5
- package/dist/calendar.js.map +1 -1
- package/dist/config.d.ts +52 -4
- package/dist/config.js +108 -25
- package/dist/config.js.map +1 -1
- package/dist/css.js +28 -0
- package/dist/css.js.map +1 -1
- package/dist/examples.js +67 -1
- package/dist/examples.js.map +1 -1
- package/dist/form.d.ts +11 -0
- package/dist/form.js +7 -3
- package/dist/form.js.map +1 -1
- 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 +13 -4
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/marketing.d.ts +3 -0
- package/dist/marketing.js +5 -2
- package/dist/marketing.js.map +1 -1
- package/dist/meta.js +46 -16
- package/dist/meta.js.map +1 -1
- package/dist/mini-calendar.d.ts +20 -0
- package/dist/mini-calendar.js +85 -0
- package/dist/mini-calendar.js.map +1 -0
- package/dist/motion.d.ts +1 -1
- package/dist/motion.js +2 -1
- package/dist/motion.js.map +1 -1
- package/dist/registry-package.js +1 -1
- package/dist/registry-package.js.map +1 -1
- package/dist/registry-types.d.ts +7 -0
- package/dist/registry-types.js.map +1 -1
- package/dist/styles.css +231 -1
- 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/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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
`@spillway-cms/blocks` bundles a selection of [Lucide](https://lucide.dev) icons (`src/icons-data.ts`, from `lucide-static` 1.76.0). Lucide is licensed under the ISC License; the icons derived from Feather are licensed under the MIT License:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
ISC License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
9
|
+
|
|
10
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
12
|
+
copyright notice and this permission notice appear in all copies.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
15
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
17
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
18
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
19
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
20
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
The following Lucide icons are derived from the Feather project:
|
|
25
|
+
|
|
26
|
+
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
|
27
|
+
|
|
28
|
+
The MIT License (MIT) (for the icons listed above)
|
|
29
|
+
|
|
30
|
+
Copyright (c) 2013-present Cole Bemis
|
|
31
|
+
|
|
32
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
34
|
+
in the Software without restriction, including without limitation the rights
|
|
35
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
37
|
+
furnished to do so, subject to the following conditions:
|
|
38
|
+
|
|
39
|
+
The above copyright notice and this permission notice shall be included in all
|
|
40
|
+
copies or substantial portions of the Software.
|
|
41
|
+
|
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
+
SOFTWARE.
|
|
49
|
+
```
|
package/dist/ask.d.ts
CHANGED
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
* page locale's results page), `locale`, `answers` (the site has them on) and the CSP `nonce`.
|
|
8
8
|
*
|
|
9
9
|
* ANSWER_SCRIPT serves both places an answer appears: the results page's Answer box (`[data-sw-answer]`, asked once the page
|
|
10
|
-
* shows) and the Ask block (`form[data-sw-ask]`, asked on submit or a suggestion). It
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* shows) and the Ask block (`form[data-sw-ask]`, asked on submit or a suggestion). It asks for server-sent events and shows the
|
|
11
|
+
* answer as it is written (a JSON answer, or a browser that cannot read a stream, gets it whole), then renders the final answer
|
|
12
|
+
* from the `done` event. It builds the answer from text nodes only (no HTML from the server is ever inserted): `- ` lines become
|
|
13
|
+
* a list, `**x**` bold, `[n]` a link to the cited page. After an answer, a follow-up field and the related questions continue
|
|
14
|
+
* the conversation in the box (the earlier questions go with each one, up to the server's limit of follow-ups). On the results
|
|
15
|
+
* page an unavailable first answer removes the box, so the results stand alone; elsewhere it links to the results.
|
|
13
16
|
*/
|
|
14
17
|
import type { ComponentConfig } from '@puckeditor/core';
|
|
15
18
|
export interface AskProps {
|
|
@@ -34,6 +37,6 @@ export interface AskProps {
|
|
|
34
37
|
}
|
|
35
38
|
/** A field id unique per block on a page, from the block's id. */
|
|
36
39
|
export declare function askFieldId(blockId: unknown): string;
|
|
37
|
-
export declare const ANSWER_SCRIPT = "(function(){var d=document,R=d.documentElement;if(R.hasAttribute('data-sw-answers')||!window.fetch)return;R.setAttribute('data-sw-answers','');\nfunction el(t,c,x){var e=d.createElement(t);if(c)e.className=c;if(x!=null)e.textContent=x;return e}\nfunction link(t,h,c){var a=el('a',c||'',t);a.href=h;return a}\nfunction inline(p,txt,src){var re=/(\\*\\*[^*]+\\*\\*|\\[\\d{1,2}\\])/g,last=0,m;while((m=re.exec(txt))){if(m.index>last)p.appendChild(d.createTextNode(txt.slice(last,m.index)));var t=m[0];\nif(t.charAt(0)==='*'){p.appendChild(el('strong','',t.slice(2,-2)))}else{var n=+t.slice(1,-1),s=null;for(var i=0;i<src.length;i++)if(src[i].n===n)s=src[i];\nif(s){var a=link('['+n+']',s.path,'sw-answer__cite');a.title=s.title;p.appendChild(a)}}last=re.lastIndex}if(last<txt.length)p.appendChild(d.createTextNode(txt.slice(last)))}\nfunction results(act,q){return act+'?q='+encodeURIComponent(q)}\nfunction
|
|
40
|
+
export declare const ANSWER_SCRIPT = "(function(){var d=document,R=d.documentElement;if(R.hasAttribute('data-sw-answers')||!window.fetch)return;R.setAttribute('data-sw-answers','');\nvar tz='',uid=0;try{tz=Intl.DateTimeFormat().resolvedOptions().timeZone||''}catch(e){}\nfunction el(t,c,x){var e=d.createElement(t);if(c)e.className=c;if(x!=null)e.textContent=x;return e}\nfunction link(t,h,c){var a=el('a',c||'',t);a.href=h;return a}\nfunction inline(p,txt,src){var re=/(\\*\\*[^*]+\\*\\*|\\[\\d{1,2}\\])/g,last=0,m;while((m=re.exec(txt))){if(m.index>last)p.appendChild(d.createTextNode(txt.slice(last,m.index)));var t=m[0];\nif(t.charAt(0)==='*'){p.appendChild(el('strong','',t.slice(2,-2)))}else{var n=+t.slice(1,-1),s=null;for(var i=0;i<src.length;i++)if(src[i].n===n)s=src[i];\nif(s){var a=link('['+n+']',s.path,'sw-answer__cite');a.title=s.title;p.appendChild(a)}}last=re.lastIndex}if(last<txt.length)p.appendChild(d.createTextNode(txt.slice(last)))}\nfunction prose(box,txt,src){var ul=null;txt.split('\\n').forEach(function(ln){ln=ln.trim();if(!ln){ul=null;return}\nif(ln.indexOf('- ')===0){if(!ul){ul=el('ul');box.appendChild(ul)}var li=el('li');inline(li,ln.slice(2),src);ul.appendChild(li)}else{ul=null;var p=el('p');inline(p,ln,src);box.appendChild(p)}})}\nfunction results(act,q){return act+'?q='+encodeURIComponent(q)}\nfunction api(q,l,h){var u='/api/search/answer?q='+encodeURIComponent(q)+(l?'&locale='+encodeURIComponent(l):'')+(tz?'&tz='+encodeURIComponent(tz):'');h.forEach(function(x){u+='&h='+encodeURIComponent(x)});return u}\nfunction stream(u,on){return fetch(u,{headers:{accept:'text/event-stream, application/json'}}).then(function(r){if(!r.ok){on('done',{status:'unavailable'});return}\nif((r.headers.get('content-type')||'').indexOf('text/event-stream')<0)return r.json().then(function(j){on('done',j)});\nvar buf='';function feed(t){buf+=t;var m;while((m=/\\r?\\n\\r?\\n/.exec(buf))){var blk=buf.slice(0,m.index),ev='message',data=[];buf=buf.slice(m.index+m[0].length);\nblk.split(/\\r?\\n/).forEach(function(x){if(x.indexOf('event:')===0)ev=x.slice(6).trim();else if(x.indexOf('data:')===0)data.push(x.slice(5).replace(/^ /,''))});if(data.length){try{on(ev,JSON.parse(data.join('\\n')))}catch(e){}}}}\nif(!r.body||!r.body.getReader||!window.TextDecoder)return r.text().then(function(t){feed(t+'\\n\\n')});\nvar rd=r.body.getReader(),dec=new TextDecoder();function pump(){return rd.read().then(function(x){if(x.done){feed(dec.decode()+'\\n\\n');return}feed(dec.decode(x.value,{stream:true}));return pump()})}return pump()})}\nfunction convo(box,l,act,inPage){var body=box.querySelector('.sw-answer__body'),hist=[],busy=false,more=null,input=null,left=0;\nfunction form(){if(more)return more;var id='sw-answer-more-'+(++uid);more=el('form','sw-answer__more');var lab=el('label','sw-answer__more-label','Ask a follow-up');lab.htmlFor=id;\nvar row=el('div','sw-search-box__row');input=el('input','sw-search-box__input');input.id=id;input.type='text';input.name='q';input.maxLength=300;input.autocomplete='off';input.setAttribute('enterkeyhint','send');\nvar b=el('button','sw-button sw-button--primary','Ask');b.type='submit';row.appendChild(input);row.appendChild(b);more.appendChild(lab);more.appendChild(row);more.appendChild(el('p','sw-answer__left'));\nmore.addEventListener('submit',function(e){e.preventDefault();var v=input.value.trim();if(v.length<3){input.focus();return}input.value='';ask(v,true,true)});return more}\nfunction ask(q,follow,typed){q=(q||'').trim();if(q.length<3||busy)return false;busy=true;if(!follow||!hist.length){hist=[];body.textContent=''}\nif(more&&more.parentNode)more.parentNode.removeChild(more);box.hidden=false;box.setAttribute('aria-busy','true');\nvar turn=el('div','sw-answer__turn');if(follow&&hist.length)turn.appendChild(el('p','sw-answer__asked',q));var out=el('div','sw-answer__text');out.appendChild(el('p','sw-answer__loading',\"Looking for the answer in this site's pages\u2026\"));turn.appendChild(out);body.appendChild(turn);\nvar src=[],acc='',done=false,h=hist.slice();\nfunction finish(r){if(done)return;done=true;busy=false;box.removeAttribute('aria-busy');out.className='sw-answer__text';out.textContent='';\nif(r.status==='answered'){prose(out,r.answer,r.sources);if(!r.list){out.appendChild(el('p','sw-answer__heading','Sources'));var ol=el('ol','sw-answer__sources');r.sources.forEach(function(s){var li=el('li');li.value=s.n;li.appendChild(link(s.title,s.path));ol.appendChild(li)});out.appendChild(ol)}\nif(r.followUps&&r.followUps.length){out.appendChild(el('p','sw-answer__heading','Related questions'));var fu=el('ul','sw-answer__follow');r.followUps.forEach(function(x){var li=el('li'),a=link(x,results(act,x));\na.addEventListener('click',function(e){if(left>0&&!busy){e.preventDefault();ask(x,true)}});li.appendChild(a);fu.appendChild(li)});out.appendChild(fu)}\nout.appendChild(el('p','sw-answer__note',r.list?\"Listed from this site's pages. Check the linked pages for details.\":\"Written by AI from this site's pages. Check the linked pages before relying on it.\"));\nvar fb=el('div','sw-answer__feedback');fb.appendChild(el('span','','Was this helpful?'));[['Yes',true],['No',false]].forEach(function(o){var btn=el('button','sw-button sw-button--secondary',o[0]);btn.type='button';\nbtn.addEventListener('click',function(){try{navigator.sendBeacon('/_beacon',JSON.stringify({e:'afb',q:q,l:l,h:o[1]}))}catch(e){}fb.textContent='Thanks for the feedback.'});fb.appendChild(btn)});out.appendChild(fb)}\nelse if(r.status==='not_found'){out.appendChild(el('p','',\"I couldn't find that on this site.\"+(inPage||h.length?'':' The closest pages are below.')));if(r.contactUrl){var c=el('p');c.appendChild(link('Contact us',r.contactUrl));out.appendChild(c)}\nif(inPage||h.length){var sr=el('p');sr.appendChild(link('See the search results',results(act,q)));out.appendChild(sr)}}\nelse if(inPage||h.length){var u=el('p');u.appendChild(link('See the search results for this question',results(act,q)));out.appendChild(u)}else{box.parentNode&&box.parentNode.removeChild(box);return}\nif(r.status==='unavailable'){if(h.length&&left>0)body.appendChild(form());return}hist.push(q);left=typeof r.followUpsLeft==='number'?r.followUpsLeft:0;\nif(left>0){var f=form();f.querySelector('.sw-answer__left').textContent=left===1?'One more follow-up question in this conversation.':left+' more follow-up questions in this conversation.';body.appendChild(f);if(typed)input.focus()}\nelse if(h.length)body.appendChild(el('p','sw-answer__left',\"That's the last follow-up for this conversation. Start a new search to ask more.\"))}\nstream(api(q,l,h),function(ev,data){if(done)return;if(ev==='sources')src=data.sources||[];else if(ev==='delta'){acc+=data.text||'';out.className='sw-answer__text sw-answer__text--streaming';out.textContent='';prose(out,acc,src)}else if(ev==='done')finish(data)})\n.then(function(){finish({status:'unavailable'})},function(){finish({status:'unavailable'})});return true}\nreturn ask}\nvar page=d.querySelector('[data-sw-answer]');if(page)convo(page,page.getAttribute('data-locale')||'',page.getAttribute('data-action')||'/search',false)(page.getAttribute('data-q'),false);\nArray.prototype.forEach.call(d.querySelectorAll('form[data-sw-ask]'),function(f){var sec=f.closest('.sw-ask')||f.parentNode,box=sec.querySelector('.sw-answer'),inp=f.querySelector('input[name=q]');if(!box||!inp)return;\nvar ask=convo(box,f.getAttribute('data-sw-locale')||'',f.getAttribute('action')||'/search',true);\nf.addEventListener('submit',function(e){if(ask(inp.value,false))e.preventDefault()});\nArray.prototype.forEach.call(sec.querySelectorAll('a[data-sw-ask-q]'),function(a){a.addEventListener('click',function(e){var q=a.getAttribute('data-sw-ask-q');inp.value=q;if(ask(q,false))e.preventDefault()})})});})();";
|
|
38
41
|
export declare const askComponent: ComponentConfig<AskProps>;
|
|
39
|
-
export declare const askCss = "/* ---------- Ask and answers ---------- */\n.sw-ask__heading { margin: 0 0 0.75rem; }\n.sw-ask__form { max-width: 40rem; }\n.sw-ask--center .sw-ask__form, .sw-ask--center .sw-ask__questions, .sw-ask--center .sw-ask__answer { margin-inline: auto; }\n.sw-ask--center .sw-ask__heading, .sw-ask--center .sw-ask__label { text-align: center; }\n.sw-ask__label { display: block; font-weight: 600; margin-bottom: 0.5rem; }\n.sw-ask__questions { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; max-width: 40rem; margin: 0.75rem 0 0; padding: 0; }\n.sw-ask--center .sw-ask__questions { justify-content: center; }\n.sw-ask__question { display: inline-block; padding: 0.35rem 0.8rem; font-size: 0.9rem; text-decoration: none; color: inherit; border: 1px solid color-mix(in srgb, currentColor 25%, transparent); border-radius: 999px; }\n.sw-ask__question:hover { border-color: var(--sw-color-primary, #1d4ed8); color: var(--sw-color-primary, #1d4ed8); }\n.sw-ask__question:focus-visible { outline: 2px solid var(--sw-color-primary, #1d4ed8); outline-offset: 2px; }\n.sw-answer{max-width:40rem;margin:1.5rem 0 0;padding:1rem 1.25rem;border:1px solid color-mix(in srgb,var(--sw-color-primary,#1d4ed8) 30%,transparent);border-radius:var(--sw-radius,8px);background:color-mix(in srgb,var(--sw-color-primary,#1d4ed8) 5%,var(--sw-color-bg,#fff))}\n.sw-answer[hidden]{display:none}\n.sw-answer__title{margin:0 0 .5rem;font-weight:700}\n.sw-answer__body p{margin:0 0 .6rem}\n.sw-answer__body ul{margin:0 0 .6rem;padding-left:1.25rem}\n.sw-answer__loading{opacity:.75}\n.sw-answer__cite{font-size:.8em;vertical-align:super;text-decoration:none;margin-left:.1em}\n.sw-answer__heading{margin:.75rem 0 .25rem!important;font-size:.85rem;font-weight:600}\n.sw-answer__sources,.sw-answer__follow{margin:0 0 .5rem;padding-left:1.25rem;font-size:.9rem}\n.sw-answer__note{font-size:.8rem;opacity:.75}\n.sw-answer__feedback{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;font-size:.85rem}\n.sw-answer__feedback .sw-button{min-height:2rem;padding:.2em .8em;font-size:.85rem}\n";
|
|
42
|
+
export declare const askCss = "/* ---------- Ask and answers ---------- */\n.sw-ask__heading { margin: 0 0 0.75rem; }\n.sw-ask__form { max-width: 40rem; }\n.sw-ask--center .sw-ask__form, .sw-ask--center .sw-ask__questions, .sw-ask--center .sw-ask__answer { margin-inline: auto; }\n.sw-ask--center .sw-ask__heading, .sw-ask--center .sw-ask__label { text-align: center; }\n.sw-ask__label { display: block; font-weight: 600; margin-bottom: 0.5rem; }\n.sw-ask__questions { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; max-width: 40rem; margin: 0.75rem 0 0; padding: 0; }\n.sw-ask--center .sw-ask__questions { justify-content: center; }\n.sw-ask__question { display: inline-block; padding: 0.35rem 0.8rem; font-size: 0.9rem; text-decoration: none; color: inherit; border: 1px solid color-mix(in srgb, currentColor 25%, transparent); border-radius: 999px; }\n.sw-ask__question:hover { border-color: var(--sw-color-primary, #1d4ed8); color: var(--sw-color-primary, #1d4ed8); }\n.sw-ask__question:focus-visible { outline: 2px solid var(--sw-color-primary, #1d4ed8); outline-offset: 2px; }\n.sw-answer{max-width:40rem;margin:1.5rem 0 0;padding:1rem 1.25rem;border:1px solid color-mix(in srgb,var(--sw-color-primary,#1d4ed8) 30%,transparent);border-radius:var(--sw-radius,8px);background:color-mix(in srgb,var(--sw-color-primary,#1d4ed8) 5%,var(--sw-color-bg,#fff))}\n.sw-answer[hidden]{display:none}\n.sw-answer__title{margin:0 0 .5rem;font-weight:700}\n.sw-answer__body p{margin:0 0 .6rem}\n.sw-answer__body ul{margin:0 0 .6rem;padding-left:1.25rem}\n.sw-answer__loading{opacity:.75}\n.sw-answer__cite{font-size:.8em;vertical-align:super;text-decoration:none;margin-left:.1em}\n.sw-answer__heading{margin:.75rem 0 .25rem!important;font-size:.85rem;font-weight:600}\n.sw-answer__sources,.sw-answer__follow{margin:0 0 .5rem;padding-left:1.25rem;font-size:.9rem}\n.sw-answer__note{font-size:.8rem;opacity:.75}\n.sw-answer__feedback{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;font-size:.85rem}\n.sw-answer__feedback .sw-button{min-height:2rem;padding:.2em .8em;font-size:.85rem}\n.sw-answer__turn+.sw-answer__turn{margin-top:1rem;padding-top:1rem;border-top:1px solid color-mix(in srgb,currentColor 12%,transparent)}\n.sw-answer__asked{font-weight:600}\n.sw-answer__text--streaming>:last-child::after{content:\"\";display:inline-block;width:.5em;height:1em;margin-left:.15em;vertical-align:-.15em;background:currentColor;opacity:.35}\n@media (prefers-reduced-motion:no-preference){.sw-answer__text--streaming>:last-child::after{animation:sw-answer-caret 1s steps(2) infinite}}\n@keyframes sw-answer-caret{50%{opacity:0}}\n.sw-answer__more{margin-top:1rem}\n.sw-answer__more-label{display:block;font-weight:600;font-size:.9rem;margin-bottom:.35rem}\n.sw-answer__left{font-size:.8rem;opacity:.75;margin:.35rem 0 0!important}\n";
|
package/dist/ask.js
CHANGED
|
@@ -6,30 +6,52 @@ export function askFieldId(blockId) {
|
|
|
6
6
|
return `sw-ask-${base || 'block'}`;
|
|
7
7
|
}
|
|
8
8
|
export const ANSWER_SCRIPT = `(function(){var d=document,R=d.documentElement;if(R.hasAttribute('data-sw-answers')||!window.fetch)return;R.setAttribute('data-sw-answers','');
|
|
9
|
+
var tz='',uid=0;try{tz=Intl.DateTimeFormat().resolvedOptions().timeZone||''}catch(e){}
|
|
9
10
|
function el(t,c,x){var e=d.createElement(t);if(c)e.className=c;if(x!=null)e.textContent=x;return e}
|
|
10
11
|
function link(t,h,c){var a=el('a',c||'',t);a.href=h;return a}
|
|
11
12
|
function inline(p,txt,src){var re=/(\\*\\*[^*]+\\*\\*|\\[\\d{1,2}\\])/g,last=0,m;while((m=re.exec(txt))){if(m.index>last)p.appendChild(d.createTextNode(txt.slice(last,m.index)));var t=m[0];
|
|
12
13
|
if(t.charAt(0)==='*'){p.appendChild(el('strong','',t.slice(2,-2)))}else{var n=+t.slice(1,-1),s=null;for(var i=0;i<src.length;i++)if(src[i].n===n)s=src[i];
|
|
13
14
|
if(s){var a=link('['+n+']',s.path,'sw-answer__cite');a.title=s.title;p.appendChild(a)}}last=re.lastIndex}if(last<txt.length)p.appendChild(d.createTextNode(txt.slice(last)))}
|
|
15
|
+
function prose(box,txt,src){var ul=null;txt.split('\\n').forEach(function(ln){ln=ln.trim();if(!ln){ul=null;return}
|
|
16
|
+
if(ln.indexOf('- ')===0){if(!ul){ul=el('ul');box.appendChild(ul)}var li=el('li');inline(li,ln.slice(2),src);ul.appendChild(li)}else{ul=null;var p=el('p');inline(p,ln,src);box.appendChild(p)}})}
|
|
14
17
|
function results(act,q){return act+'?q='+encodeURIComponent(q)}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
if(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
body.
|
|
18
|
+
function api(q,l,h){var u='/api/search/answer?q='+encodeURIComponent(q)+(l?'&locale='+encodeURIComponent(l):'')+(tz?'&tz='+encodeURIComponent(tz):'');h.forEach(function(x){u+='&h='+encodeURIComponent(x)});return u}
|
|
19
|
+
function stream(u,on){return fetch(u,{headers:{accept:'text/event-stream, application/json'}}).then(function(r){if(!r.ok){on('done',{status:'unavailable'});return}
|
|
20
|
+
if((r.headers.get('content-type')||'').indexOf('text/event-stream')<0)return r.json().then(function(j){on('done',j)});
|
|
21
|
+
var buf='';function feed(t){buf+=t;var m;while((m=/\\r?\\n\\r?\\n/.exec(buf))){var blk=buf.slice(0,m.index),ev='message',data=[];buf=buf.slice(m.index+m[0].length);
|
|
22
|
+
blk.split(/\\r?\\n/).forEach(function(x){if(x.indexOf('event:')===0)ev=x.slice(6).trim();else if(x.indexOf('data:')===0)data.push(x.slice(5).replace(/^ /,''))});if(data.length){try{on(ev,JSON.parse(data.join('\\n')))}catch(e){}}}}
|
|
23
|
+
if(!r.body||!r.body.getReader||!window.TextDecoder)return r.text().then(function(t){feed(t+'\\n\\n')});
|
|
24
|
+
var rd=r.body.getReader(),dec=new TextDecoder();function pump(){return rd.read().then(function(x){if(x.done){feed(dec.decode()+'\\n\\n');return}feed(dec.decode(x.value,{stream:true}));return pump()})}return pump()})}
|
|
25
|
+
function convo(box,l,act,inPage){var body=box.querySelector('.sw-answer__body'),hist=[],busy=false,more=null,input=null,left=0;
|
|
26
|
+
function form(){if(more)return more;var id='sw-answer-more-'+(++uid);more=el('form','sw-answer__more');var lab=el('label','sw-answer__more-label','Ask a follow-up');lab.htmlFor=id;
|
|
27
|
+
var row=el('div','sw-search-box__row');input=el('input','sw-search-box__input');input.id=id;input.type='text';input.name='q';input.maxLength=300;input.autocomplete='off';input.setAttribute('enterkeyhint','send');
|
|
28
|
+
var b=el('button','sw-button sw-button--primary','Ask');b.type='submit';row.appendChild(input);row.appendChild(b);more.appendChild(lab);more.appendChild(row);more.appendChild(el('p','sw-answer__left'));
|
|
29
|
+
more.addEventListener('submit',function(e){e.preventDefault();var v=input.value.trim();if(v.length<3){input.focus();return}input.value='';ask(v,true,true)});return more}
|
|
30
|
+
function ask(q,follow,typed){q=(q||'').trim();if(q.length<3||busy)return false;busy=true;if(!follow||!hist.length){hist=[];body.textContent=''}
|
|
31
|
+
if(more&&more.parentNode)more.parentNode.removeChild(more);box.hidden=false;box.setAttribute('aria-busy','true');
|
|
32
|
+
var turn=el('div','sw-answer__turn');if(follow&&hist.length)turn.appendChild(el('p','sw-answer__asked',q));var out=el('div','sw-answer__text');out.appendChild(el('p','sw-answer__loading',"Looking for the answer in this site's pages…"));turn.appendChild(out);body.appendChild(turn);
|
|
33
|
+
var src=[],acc='',done=false,h=hist.slice();
|
|
34
|
+
function finish(r){if(done)return;done=true;busy=false;box.removeAttribute('aria-busy');out.className='sw-answer__text';out.textContent='';
|
|
35
|
+
if(r.status==='answered'){prose(out,r.answer,r.sources);if(!r.list){out.appendChild(el('p','sw-answer__heading','Sources'));var ol=el('ol','sw-answer__sources');r.sources.forEach(function(s){var li=el('li');li.value=s.n;li.appendChild(link(s.title,s.path));ol.appendChild(li)});out.appendChild(ol)}
|
|
36
|
+
if(r.followUps&&r.followUps.length){out.appendChild(el('p','sw-answer__heading','Related questions'));var fu=el('ul','sw-answer__follow');r.followUps.forEach(function(x){var li=el('li'),a=link(x,results(act,x));
|
|
37
|
+
a.addEventListener('click',function(e){if(left>0&&!busy){e.preventDefault();ask(x,true)}});li.appendChild(a);fu.appendChild(li)});out.appendChild(fu)}
|
|
38
|
+
out.appendChild(el('p','sw-answer__note',r.list?"Listed from this site's pages. Check the linked pages for details.":"Written by AI from this site's pages. Check the linked pages before relying on it."));
|
|
21
39
|
var fb=el('div','sw-answer__feedback');fb.appendChild(el('span','','Was this helpful?'));[['Yes',true],['No',false]].forEach(function(o){var btn=el('button','sw-button sw-button--secondary',o[0]);btn.type='button';
|
|
22
|
-
btn.addEventListener('click',function(){try{navigator.sendBeacon('/_beacon',JSON.stringify({e:'afb',q:q,l:l,h:o[1]}))}catch(e){}fb.textContent='Thanks for the feedback.'});fb.appendChild(btn)});
|
|
23
|
-
|
|
24
|
-
if(inPage){var sr=el('p');sr.appendChild(link('See the search results',results(act,q)));
|
|
25
|
-
else if(inPage){var u=el('p');u.appendChild(link('See the search results for this question',results(act,q)));
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
btn.addEventListener('click',function(){try{navigator.sendBeacon('/_beacon',JSON.stringify({e:'afb',q:q,l:l,h:o[1]}))}catch(e){}fb.textContent='Thanks for the feedback.'});fb.appendChild(btn)});out.appendChild(fb)}
|
|
41
|
+
else if(r.status==='not_found'){out.appendChild(el('p','',"I couldn't find that on this site."+(inPage||h.length?'':' The closest pages are below.')));if(r.contactUrl){var c=el('p');c.appendChild(link('Contact us',r.contactUrl));out.appendChild(c)}
|
|
42
|
+
if(inPage||h.length){var sr=el('p');sr.appendChild(link('See the search results',results(act,q)));out.appendChild(sr)}}
|
|
43
|
+
else if(inPage||h.length){var u=el('p');u.appendChild(link('See the search results for this question',results(act,q)));out.appendChild(u)}else{box.parentNode&&box.parentNode.removeChild(box);return}
|
|
44
|
+
if(r.status==='unavailable'){if(h.length&&left>0)body.appendChild(form());return}hist.push(q);left=typeof r.followUpsLeft==='number'?r.followUpsLeft:0;
|
|
45
|
+
if(left>0){var f=form();f.querySelector('.sw-answer__left').textContent=left===1?'One more follow-up question in this conversation.':left+' more follow-up questions in this conversation.';body.appendChild(f);if(typed)input.focus()}
|
|
46
|
+
else if(h.length)body.appendChild(el('p','sw-answer__left',"That's the last follow-up for this conversation. Start a new search to ask more."))}
|
|
47
|
+
stream(api(q,l,h),function(ev,data){if(done)return;if(ev==='sources')src=data.sources||[];else if(ev==='delta'){acc+=data.text||'';out.className='sw-answer__text sw-answer__text--streaming';out.textContent='';prose(out,acc,src)}else if(ev==='done')finish(data)})
|
|
48
|
+
.then(function(){finish({status:'unavailable'})},function(){finish({status:'unavailable'})});return true}
|
|
49
|
+
return ask}
|
|
50
|
+
var page=d.querySelector('[data-sw-answer]');if(page)convo(page,page.getAttribute('data-locale')||'',page.getAttribute('data-action')||'/search',false)(page.getAttribute('data-q'),false);
|
|
29
51
|
Array.prototype.forEach.call(d.querySelectorAll('form[data-sw-ask]'),function(f){var sec=f.closest('.sw-ask')||f.parentNode,box=sec.querySelector('.sw-answer'),inp=f.querySelector('input[name=q]');if(!box||!inp)return;
|
|
30
|
-
var
|
|
31
|
-
f.addEventListener('submit',function(e){if(
|
|
32
|
-
Array.prototype.forEach.call(sec.querySelectorAll('a[data-sw-ask-q]'),function(a){a.addEventListener('click',function(e){var q=a.getAttribute('data-sw-ask-q');inp.value=q;if(
|
|
52
|
+
var ask=convo(box,f.getAttribute('data-sw-locale')||'',f.getAttribute('action')||'/search',true);
|
|
53
|
+
f.addEventListener('submit',function(e){if(ask(inp.value,false))e.preventDefault()});
|
|
54
|
+
Array.prototype.forEach.call(sec.querySelectorAll('a[data-sw-ask-q]'),function(a){a.addEventListener('click',function(e){var q=a.getAttribute('data-sw-ask-q');inp.value=q;if(ask(q,false))e.preventDefault()})})});})();`;
|
|
33
55
|
export const askComponent = {
|
|
34
56
|
label: 'Ask',
|
|
35
57
|
fields: {
|
|
@@ -92,5 +114,13 @@ export const askCss = `/* ---------- Ask and answers ---------- */
|
|
|
92
114
|
.sw-answer__note{font-size:.8rem;opacity:.75}
|
|
93
115
|
.sw-answer__feedback{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;font-size:.85rem}
|
|
94
116
|
.sw-answer__feedback .sw-button{min-height:2rem;padding:.2em .8em;font-size:.85rem}
|
|
117
|
+
.sw-answer__turn+.sw-answer__turn{margin-top:1rem;padding-top:1rem;border-top:1px solid color-mix(in srgb,currentColor 12%,transparent)}
|
|
118
|
+
.sw-answer__asked{font-weight:600}
|
|
119
|
+
.sw-answer__text--streaming>:last-child::after{content:"";display:inline-block;width:.5em;height:1em;margin-left:.15em;vertical-align:-.15em;background:currentColor;opacity:.35}
|
|
120
|
+
@media (prefers-reduced-motion:no-preference){.sw-answer__text--streaming>:last-child::after{animation:sw-answer-caret 1s steps(2) infinite}}
|
|
121
|
+
@keyframes sw-answer-caret{50%{opacity:0}}
|
|
122
|
+
.sw-answer__more{margin-top:1rem}
|
|
123
|
+
.sw-answer__more-label{display:block;font-weight:600;font-size:.9rem;margin-bottom:.35rem}
|
|
124
|
+
.sw-answer__left{font-size:.8rem;opacity:.75;margin:.35rem 0 0!important}
|
|
95
125
|
`;
|
|
96
126
|
//# sourceMappingURL=ask.js.map
|
package/dist/ask.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask.js","sourceRoot":"","sources":["../src/ask.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ask.js","sourceRoot":"","sources":["../src/ask.tsx"],"names":[],"mappings":";AAqCA,MAAM,EAAE,GAAG,CAAC,GAAG,C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E,GAAI,CAAC,CAAC,CAAC,IAAI,IACtF,CACX,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BrB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Breadcrumbs block: the trail from the home page to the page being viewed, as a navigation landmark with an ordered list
|
|
3
|
+
* (the WAI-ARIA breadcrumb pattern: `aria-label="Breadcrumb"`, `aria-current="page"` on the last link).
|
|
4
|
+
*
|
|
5
|
+
* The server resolves the trail (`items`) before render, from the page's path (the titles of the published pages at each
|
|
6
|
+
* ancestor path, the same trail as the BreadcrumbList structured data) or from the page's position in the main menu. It is
|
|
7
|
+
* placed above the content by Structure → Placements or by Site settings → Breadcrumbs. Server-safe; nothing renders when there
|
|
8
|
+
* is no trail (the home page), except a placeholder in the page builder.
|
|
9
|
+
*/
|
|
10
|
+
import type { ComponentConfig } from '@puckeditor/core';
|
|
11
|
+
export interface BreadcrumbItem {
|
|
12
|
+
label: string;
|
|
13
|
+
/** Absent for a menu heading without a link. */
|
|
14
|
+
href?: string;
|
|
15
|
+
/** The page being viewed (the last item). */
|
|
16
|
+
current?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface BreadcrumbsBlockProps {
|
|
19
|
+
/** 'path': the page's path, as the structured data does; 'menu': its position in the main menu (the path when it is not in it). */
|
|
20
|
+
source: 'path' | 'menu';
|
|
21
|
+
/** Whether the trail ends with the page itself. */
|
|
22
|
+
showCurrent: boolean;
|
|
23
|
+
/** Resolved by the server; never stored. */
|
|
24
|
+
items?: BreadcrumbItem[];
|
|
25
|
+
}
|
|
26
|
+
export declare const breadcrumbsBlockComponent: ComponentConfig<BreadcrumbsBlockProps>;
|
|
27
|
+
export declare const breadcrumbsBlockCss = "/* ---------- Breadcrumbs ---------- */\n.sw-breadcrumbs { padding-top: 1rem; padding-bottom: 0; font-size: 0.875rem; }\n.sw-breadcrumbs__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }\n.sw-breadcrumbs__item { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }\n.sw-breadcrumbs__item + .sw-breadcrumbs__item::before { content: \"\"; flex: none; width: 0.4em; height: 0.4em; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); opacity: 0.55; }\n.sw-breadcrumbs__item a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.2em; }\n.sw-breadcrumbs__item a:hover { text-decoration-color: currentColor; }\n.sw-breadcrumbs__item a:focus-visible { outline: 2px solid var(--sw-color-primary, #1d4ed8); outline-offset: 2px; border-radius: 2px; }\n.sw-breadcrumbs__item [aria-current=\"page\"] { font-weight: 600; text-decoration: none; }\n.sw-breadcrumbs__placeholder { padding: 0.75rem 1rem; border: 1px dashed color-mix(in srgb, currentColor 35%, transparent); border-radius: var(--sw-radius, 8px); font-size: 0.9rem; opacity: 0.8; }\n";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const breadcrumbsBlockComponent = {
|
|
3
|
+
label: 'Breadcrumbs',
|
|
4
|
+
fields: {
|
|
5
|
+
source: {
|
|
6
|
+
type: 'radio',
|
|
7
|
+
label: 'Trail from',
|
|
8
|
+
options: [
|
|
9
|
+
{ label: "The page's address", value: 'path' },
|
|
10
|
+
{ label: 'The main menu', value: 'menu' },
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
showCurrent: {
|
|
14
|
+
type: 'radio',
|
|
15
|
+
label: 'End with this page',
|
|
16
|
+
options: [
|
|
17
|
+
{ label: 'Yes', value: true },
|
|
18
|
+
{ label: 'No', value: false },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultProps: { source: 'path', showCurrent: true },
|
|
23
|
+
render: ({ items, source, puck }) => {
|
|
24
|
+
const list = Array.isArray(items) ? items.filter((i) => i && typeof i.label === 'string' && i.label) : [];
|
|
25
|
+
if (!list.length) {
|
|
26
|
+
if (!puck?.isEditing)
|
|
27
|
+
return _jsx(_Fragment, {});
|
|
28
|
+
return (_jsx("section", { className: "sw-block sw-breadcrumbs sw-breadcrumbs--placeholder", children: _jsx("div", { className: "sw-container", children: _jsxs("div", { className: "sw-breadcrumbs__placeholder", role: "note", children: ["Breadcrumbs: the trail to this page from ", source === 'menu' ? 'the main menu' : 'its address', ", shown on the published page."] }) }) }));
|
|
29
|
+
}
|
|
30
|
+
return (_jsx("nav", { className: "sw-block sw-breadcrumbs", "aria-label": "Breadcrumb", children: _jsx("div", { className: "sw-container", children: _jsx("ol", { className: "sw-breadcrumbs__list", children: list.map((item, i) => (_jsx("li", { className: "sw-breadcrumbs__item", children: item.href ? (_jsx("a", { href: item.href, "aria-current": item.current ? 'page' : undefined, children: item.label })) : (_jsx("span", { "aria-current": item.current ? 'page' : undefined, children: item.label })) }, `${item.href ?? ''}-${i}`))) }) }) }));
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const breadcrumbsBlockCss = `/* ---------- Breadcrumbs ---------- */
|
|
34
|
+
.sw-breadcrumbs { padding-top: 1rem; padding-bottom: 0; font-size: 0.875rem; }
|
|
35
|
+
.sw-breadcrumbs__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
|
|
36
|
+
.sw-breadcrumbs__item { display: inline-flex; align-items: center; gap: 0.5rem; min-width: 0; }
|
|
37
|
+
.sw-breadcrumbs__item + .sw-breadcrumbs__item::before { content: ""; flex: none; width: 0.4em; height: 0.4em; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); opacity: 0.55; }
|
|
38
|
+
.sw-breadcrumbs__item a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.2em; }
|
|
39
|
+
.sw-breadcrumbs__item a:hover { text-decoration-color: currentColor; }
|
|
40
|
+
.sw-breadcrumbs__item a:focus-visible { outline: 2px solid var(--sw-color-primary, #1d4ed8); outline-offset: 2px; border-radius: 2px; }
|
|
41
|
+
.sw-breadcrumbs__item [aria-current="page"] { font-weight: 600; text-decoration: none; }
|
|
42
|
+
.sw-breadcrumbs__placeholder { padding: 0.75rem 1rem; border: 1px dashed color-mix(in srgb, currentColor 35%, transparent); border-radius: var(--sw-radius, 8px); font-size: 0.9rem; opacity: 0.8; }
|
|
43
|
+
`;
|
|
44
|
+
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../src/breadcrumbs.tsx"],"names":[],"mappings":";AA4BA,MAAM,CAAC,MAAM,yBAAyB,GAA2C;IAC/E,KAAK,EAAE,aAAa;IACpB,MAAM,EAAE;QACN,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,YAAY;YACnB,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,EAAE;gBAC9C,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE;aAC1C;SACF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,oBAAoB;YAC3B,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;gBAC7B,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;aAC9B;SACF;KACF;IACD,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE;IACnD,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;QAClC,MAAM,IAA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ACP,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;CAUlC,CAAC"}
|
package/dist/calendar.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Calendar block: the occurrences of a collection's events as a month grid (one grid per month)
|
|
3
|
-
* or a date-grouped list, with a link to the collection's .ics feed. The server resolves
|
|
4
|
-
* `months` (and `feedHref`) before render; the editor shows a placeholder.
|
|
5
|
-
* Server-safe: no hooks, no DOM, no Date.now() (the
|
|
2
|
+
* Calendar block: the occurrences of a collection's events as a month grid (one grid per month), a week (seven days side by
|
|
3
|
+
* side), a day (its events by time) or a date-grouped list, with a link to the collection's .ics feed. The server resolves
|
|
4
|
+
* `months`, or `days` and `range` for a week or a day (and `feedHref`), before render; the editor shows a placeholder.
|
|
5
|
+
* With `switcher`, links above it move between the views (?view=). Server-safe: no hooks, no DOM, no Date.now() (the
|
|
6
|
+
* server picks the first month, week or day).
|
|
6
7
|
*/
|
|
7
8
|
import type { ComponentConfig } from '@puckeditor/core';
|
|
8
|
-
export type CalendarView = 'month' | 'list';
|
|
9
|
+
export type CalendarView = 'month' | 'week' | 'day' | 'list';
|
|
9
10
|
export interface CalendarEvent {
|
|
10
11
|
id: string;
|
|
11
12
|
title: string;
|
|
@@ -29,14 +30,41 @@ export interface CalendarMonth {
|
|
|
29
30
|
prevHref?: string;
|
|
30
31
|
nextHref?: string;
|
|
31
32
|
}
|
|
33
|
+
/** One day of a week or day view: its local date, a label and its events in time order (all-day events first). */
|
|
34
|
+
export interface CalendarDay {
|
|
35
|
+
/** YYYY-MM-DD */
|
|
36
|
+
date: string;
|
|
37
|
+
/** "Monday, March 1" */
|
|
38
|
+
label: string;
|
|
39
|
+
events: CalendarEvent[];
|
|
40
|
+
}
|
|
41
|
+
/** What a week or day view shows and where its arrows lead. */
|
|
42
|
+
export interface CalendarRange {
|
|
43
|
+
/** "March 1 to 7, 2027" or "Monday, March 1, 2027" */
|
|
44
|
+
label: string;
|
|
45
|
+
prevHref?: string;
|
|
46
|
+
nextHref?: string;
|
|
47
|
+
todayHref?: string;
|
|
48
|
+
}
|
|
32
49
|
export interface CalendarProps {
|
|
33
50
|
collectionId: string;
|
|
34
51
|
view: CalendarView;
|
|
35
52
|
monthsAhead: number;
|
|
53
|
+
/** Links to switch between month, week, day and list (?view=). */
|
|
54
|
+
switcher?: boolean;
|
|
36
55
|
/** Resolved by the server. */
|
|
37
56
|
months?: CalendarMonth[];
|
|
57
|
+
days?: CalendarDay[];
|
|
58
|
+
range?: CalendarRange;
|
|
59
|
+
/** The view the server resolved (a ?view= the switcher chose, else `view`), and the switcher's links. */
|
|
60
|
+
shown?: CalendarView;
|
|
61
|
+
views?: {
|
|
62
|
+
view: CalendarView;
|
|
63
|
+
label: string;
|
|
64
|
+
href: string;
|
|
65
|
+
}[];
|
|
38
66
|
feedHref?: string;
|
|
39
67
|
today?: string;
|
|
40
68
|
}
|
|
41
69
|
export declare const calendarComponent: ComponentConfig<CalendarProps>;
|
|
42
|
-
export declare const calendarCss = "/* ---------- Calendar ---------- */\n\n.sw-calendar__month + .sw-calendar__month { margin-top: var(--sw-space-4); }\n.sw-calendar__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sw-space-2); margin-bottom: var(--sw-space-2); }\n.sw-calendar__title { margin: 0; font-size: 1.25rem; }\n.sw-calendar__nav { text-decoration: none; font-size: 1.25rem; padding: 0 var(--sw-space-1); }\n.sw-calendar__grid { width: 100%; border-collapse: collapse; table-layout: fixed; }\n.sw-calendar__grid th { font-size: 0.8rem; font-weight: 600; text-align: left; padding: var(--sw-space-1); color: var(--sw-color-muted); border-bottom: 1px solid var(--sw-color-border); }\n.sw-calendar__cell { vertical-align: top; min-height: 5rem; height: 5rem; padding: var(--sw-space-1); border: 1px solid var(--sw-color-border); font-size: 0.85rem; }\n.sw-calendar__cell--empty { background: var(--sw-color-surface); }\n.sw-calendar__cell--today .sw-calendar__day { color: var(--sw-color-primary, #1d4ed8); font-weight: 700; }\n.sw-calendar__day { display: block; margin-bottom: 2px; }\n.sw-calendar__events { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }\n.sw-calendar__event { display: block; padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--sw-color-primary, #1d4ed8) 12%, transparent); color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.sw-calendar__event:hover, .sw-calendar__event:focus { background: color-mix(in srgb, var(--sw-color-primary, #1d4ed8) 24%, transparent); }\n.sw-calendar__day-group + .sw-calendar__day-group { margin-top: var(--sw-space-3); }\n.sw-calendar__day-title { margin: 0 0 var(--sw-space-1); font-size: 1rem; }\n.sw-calendar--list .sw-calendar__event { white-space: normal; padding: var(--sw-space-1) var(--sw-space-2); }\n.sw-calendar__feed { margin: var(--sw-space-3) 0 0; font-size: 0.9rem; }\n.sw-calendar__empty { color: var(--sw-color-muted); }\n.sw-calendar__placeholder { padding: var(--sw-space-3); border: 1px dashed var(--sw-color-border); border-radius: var(--sw-radius, 8px); background: var(--sw-color-surface); color: var(--sw-color-muted); font-size: 0.9rem; text-align: center; }\n@media (max-width: 640px) {\n .sw-calendar__grid th { font-size: 0.7rem; }\n .sw-calendar__cell { height: auto; min-height: 3rem; padding: 2px; }\n .sw-calendar__event { font-size: 0.7rem; }\n}\n";
|
|
70
|
+
export declare const calendarCss = "/* ---------- Calendar ---------- */\n\n.sw-calendar__month + .sw-calendar__month { margin-top: var(--sw-space-4); }\n.sw-calendar__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sw-space-2); margin-bottom: var(--sw-space-2); }\n.sw-calendar__title { margin: 0; font-size: 1.25rem; }\n.sw-calendar__nav { text-decoration: none; font-size: 1.25rem; padding: 0 var(--sw-space-1); }\n.sw-calendar__grid { width: 100%; border-collapse: collapse; table-layout: fixed; }\n.sw-calendar__grid th { font-size: 0.8rem; font-weight: 600; text-align: left; padding: var(--sw-space-1); color: var(--sw-color-muted); border-bottom: 1px solid var(--sw-color-border); }\n.sw-calendar__cell { vertical-align: top; min-height: 5rem; height: 5rem; padding: var(--sw-space-1); border: 1px solid var(--sw-color-border); font-size: 0.85rem; }\n.sw-calendar__cell--empty { background: var(--sw-color-surface); }\n.sw-calendar__cell--today .sw-calendar__day { color: var(--sw-color-primary, #1d4ed8); font-weight: 700; }\n.sw-calendar__day { display: block; margin-bottom: 2px; }\n.sw-calendar__events { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }\n.sw-calendar__event { display: block; padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--sw-color-primary, #1d4ed8) 12%, transparent); color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n.sw-calendar__event:hover, .sw-calendar__event:focus { background: color-mix(in srgb, var(--sw-color-primary, #1d4ed8) 24%, transparent); }\n.sw-calendar__day-group + .sw-calendar__day-group { margin-top: var(--sw-space-3); }\n.sw-calendar__day-title { margin: 0 0 var(--sw-space-1); font-size: 1rem; }\n.sw-calendar--list .sw-calendar__event { white-space: normal; padding: var(--sw-space-1) var(--sw-space-2); }\n.sw-calendar__feed { margin: var(--sw-space-3) 0 0; font-size: 0.9rem; }\n.sw-calendar__empty { color: var(--sw-color-muted); }\n.sw-calendar__placeholder { padding: var(--sw-space-3); border: 1px dashed var(--sw-color-border); border-radius: var(--sw-radius, 8px); background: var(--sw-color-surface); color: var(--sw-color-muted); font-size: 0.9rem; text-align: center; }\n.sw-calendar__views ul { display: flex; flex-wrap: wrap; gap: var(--sw-space-1); list-style: none; margin: 0 0 var(--sw-space-3); padding: 0; }\n.sw-calendar__views a { display: inline-block; padding: 0.35rem 0.85rem; border: 1px solid var(--sw-color-border); border-radius: 999px; color: inherit; text-decoration: none; font-size: 0.9rem; }\n.sw-calendar__views a[aria-current=\"page\"] { background: var(--sw-color-primary, #1d4ed8); border-color: var(--sw-color-primary, #1d4ed8); color: var(--sw-color-primary-contrast, #fff); }\n.sw-calendar__week { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sw-space-1); }\n.sw-calendar__weekday { border: 1px solid var(--sw-color-border); border-radius: var(--sw-radius, 8px); padding: var(--sw-space-2); min-width: 0; }\n.sw-calendar__weekday--today { border-color: var(--sw-color-primary, #1d4ed8); box-shadow: inset 0 3px 0 var(--sw-color-primary, #1d4ed8); }\n.sw-calendar__weekday-title { margin: 0 0 var(--sw-space-1); font-size: 0.95rem; }\n.sw-calendar__item { display: flex; gap: var(--sw-space-1); align-items: baseline; flex-wrap: wrap; }\n.sw-calendar__time { font-variant-numeric: tabular-nums; color: var(--sw-color-muted); font-size: 0.85rem; min-width: 3.5rem; }\n.sw-calendar__event-title { overflow-wrap: anywhere; }\n.sw-calendar__none { margin: 0; color: var(--sw-color-muted); font-size: 0.85rem; }\n.sw-calendar__agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sw-space-1); }\n.sw-calendar__agenda .sw-calendar__item { padding: var(--sw-space-1) 0; border-bottom: 1px solid var(--sw-color-border); }\n.sw-calendar__agenda .sw-calendar__time { min-width: 4.5rem; font-size: 0.95rem; }\n.sw-calendar__today-link { margin: var(--sw-space-2) 0 0; font-size: 0.9rem; }\n@media (min-width: 900px) {\n .sw-calendar__week { grid-template-columns: repeat(7, minmax(0, 1fr)); }\n .sw-calendar__weekday { min-height: 8rem; }\n .sw-calendar__week .sw-calendar__item { display: block; }\n .sw-calendar__week .sw-calendar__time { display: block; min-width: 0; }\n}\n@media (max-width: 899px) {\n .sw-calendar__weekday--empty .sw-calendar__none { display: inline; }\n}\n@media (max-width: 640px) {\n .sw-calendar__grid th { font-size: 0.7rem; }\n .sw-calendar__cell { height: auto; min-height: 3rem; padding: 2px; }\n .sw-calendar__event { font-size: 0.7rem; }\n}\n";
|
package/dist/calendar.js
CHANGED
|
@@ -42,6 +42,26 @@ function ListView({ months }) {
|
|
|
42
42
|
byDate.set(e.date, [...(byDate.get(e.date) ?? []), e]);
|
|
43
43
|
return (_jsx("div", { className: "sw-calendar__list", children: [...byDate.entries()].map(([date, events]) => (_jsxs("section", { className: "sw-calendar__day-group", children: [_jsx("h3", { className: "sw-calendar__day-title", children: _jsx("time", { dateTime: date, children: formatDate(date) }) }), _jsx("ul", { className: "sw-calendar__events", children: events.map((e, i) => (_jsx("li", { children: _jsx(EventLink, { e: e }) }, `${e.id}-${e.start}-${i}`))) })] }, date))) }));
|
|
44
44
|
}
|
|
45
|
+
function RangeHead({ range, unit }) {
|
|
46
|
+
return (_jsxs("header", { className: "sw-calendar__head", children: [range.prevHref ? (_jsx("a", { className: "sw-calendar__nav", href: range.prevHref, rel: "prev", "aria-label": unit === 'week' ? 'Previous week' : 'Previous day', children: "\u2190" })) : (_jsx("span", {})), _jsx("h2", { className: "sw-calendar__title", children: range.label }), range.nextHref ? (_jsx("a", { className: "sw-calendar__nav", href: range.nextHref, rel: "next", "aria-label": unit === 'week' ? 'Next week' : 'Next day', children: "\u2192" })) : (_jsx("span", {}))] }));
|
|
47
|
+
}
|
|
48
|
+
function EventTime({ e }) {
|
|
49
|
+
return _jsx("span", { className: "sw-calendar__time", children: e.allDay || !e.time ? 'All day' : e.time });
|
|
50
|
+
}
|
|
51
|
+
/** Seven days side by side from 900 px, stacked as a list below; each day lists its events by time. */
|
|
52
|
+
function WeekView({ days, range, today }) {
|
|
53
|
+
return (_jsxs("section", { className: "sw-calendar__week-view", "aria-label": range?.label ?? 'Week', children: [range ? _jsx(RangeHead, { range: range, unit: "week" }) : null, _jsx("ol", { className: "sw-calendar__week", children: days.map((d) => (_jsxs("li", { className: cx('sw-calendar__weekday', d.date === today && 'sw-calendar__weekday--today', d.events.length === 0 && 'sw-calendar__weekday--empty'), children: [_jsx("h3", { className: "sw-calendar__weekday-title", children: _jsx("time", { dateTime: d.date, children: d.label }) }), d.events.length ? (_jsx("ul", { className: "sw-calendar__events", children: d.events.map((e, i) => (_jsxs("li", { className: "sw-calendar__item", children: [_jsx(EventTime, { e: e }), " ", _jsx(EventTitle, { e: e })] }, `${e.id}-${e.start}-${i}`))) })) : (_jsx("p", { className: "sw-calendar__none", children: "No events" }))] }, d.date))) })] }));
|
|
54
|
+
}
|
|
55
|
+
/** One day's events as an agenda: time, then the event. */
|
|
56
|
+
function DayView({ day, range }) {
|
|
57
|
+
return (_jsxs("section", { className: "sw-calendar__day-view", "aria-label": range?.label ?? day?.label ?? 'Day', children: [range ? _jsx(RangeHead, { range: range, unit: "day" }) : null, day && day.events.length ? (_jsx("ol", { className: "sw-calendar__agenda", children: day.events.map((e, i) => (_jsxs("li", { className: "sw-calendar__item", children: [_jsx(EventTime, { e: e }), " ", _jsx(EventTitle, { e: e })] }, `${e.id}-${e.start}-${i}`))) })) : (_jsx("p", { className: "sw-calendar__empty", children: "No events on this day." })), range?.todayHref ? (_jsx("p", { className: "sw-calendar__today-link", children: _jsx("a", { href: range.todayHref, children: "Today" }) })) : null] }));
|
|
58
|
+
}
|
|
59
|
+
function EventTitle({ e }) {
|
|
60
|
+
return e.path ? (_jsx("a", { className: "sw-calendar__event-title", href: e.path, children: e.title })) : (_jsx("span", { className: "sw-calendar__event-title", children: e.title }));
|
|
61
|
+
}
|
|
62
|
+
function Switcher({ views, shown }) {
|
|
63
|
+
return (_jsx("nav", { className: "sw-calendar__views", "aria-label": "Calendar view", children: _jsx("ul", { children: views.map((v) => (_jsx("li", { children: _jsx("a", { href: v.href, "aria-current": v.view === shown ? 'page' : undefined, children: v.label }) }, v.view))) }) }));
|
|
64
|
+
}
|
|
45
65
|
function formatDate(iso) {
|
|
46
66
|
const d = new Date(`${iso}T00:00:00Z`);
|
|
47
67
|
return Number.isNaN(d.getTime()) ? iso : d.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' });
|
|
@@ -55,15 +75,27 @@ export const calendarComponent = {
|
|
|
55
75
|
label: 'View',
|
|
56
76
|
options: [
|
|
57
77
|
{ label: 'Month grid', value: 'month' },
|
|
78
|
+
{ label: 'Week', value: 'week' },
|
|
79
|
+
{ label: 'Day', value: 'day' },
|
|
58
80
|
{ label: 'List', value: 'list' },
|
|
59
81
|
],
|
|
60
82
|
},
|
|
61
|
-
monthsAhead: { type: 'number', label: 'Months shown', min: 1, max: 12 },
|
|
83
|
+
monthsAhead: { type: 'number', label: 'Months shown (month and list)', min: 1, max: 12 },
|
|
84
|
+
switcher: {
|
|
85
|
+
type: 'radio',
|
|
86
|
+
label: 'Let visitors switch views',
|
|
87
|
+
options: [
|
|
88
|
+
{ label: 'No', value: false },
|
|
89
|
+
{ label: 'Yes', value: true },
|
|
90
|
+
],
|
|
91
|
+
},
|
|
62
92
|
},
|
|
63
|
-
defaultProps: { collectionId: '', view: 'month', monthsAhead: 1 },
|
|
64
|
-
render: ({ collectionId, view, months, feedHref, today }) => {
|
|
65
|
-
const
|
|
66
|
-
|
|
93
|
+
defaultProps: { collectionId: '', view: 'month', monthsAhead: 1, switcher: false },
|
|
94
|
+
render: ({ collectionId, view, months, days, range, shown, views, feedHref, today }) => {
|
|
95
|
+
const chosen = shown ?? view;
|
|
96
|
+
const mode = chosen === 'list' || chosen === 'week' || chosen === 'day' ? chosen : 'month';
|
|
97
|
+
const resolved = mode === 'week' || mode === 'day' ? Array.isArray(days) : Array.isArray(months);
|
|
98
|
+
return (_jsx("section", { className: cx('sw-block', 'sw-calendar', `sw-calendar--${mode}`), "data-collection": collectionId || undefined, children: _jsxs("div", { className: "sw-container", children: [views?.length ? _jsx(Switcher, { views: views, shown: mode }) : null, !resolved ? (_jsxs("div", { className: "sw-calendar__placeholder", role: "note", children: ["Calendar: ", collectionId || '(none selected)', " (resolved when published)"] })) : mode === 'week' ? (_jsx(WeekView, { days: days, range: range, today: today })) : mode === 'day' ? (_jsx(DayView, { day: days[0], range: range })) : mode === 'list' ? (_jsx(ListView, { months: months })) : (months.map((m) => _jsx(MonthGrid, { month: m, today: today }, m.key))), feedHref ? (_jsx("p", { className: "sw-calendar__feed", children: _jsx("a", { href: feedHref, children: "Subscribe (iCal)" }) })) : null] }) }));
|
|
67
99
|
},
|
|
68
100
|
};
|
|
69
101
|
export const calendarCss = `/* ---------- Calendar ---------- */
|
|
@@ -87,6 +119,30 @@ export const calendarCss = `/* ---------- Calendar ---------- */
|
|
|
87
119
|
.sw-calendar__feed { margin: var(--sw-space-3) 0 0; font-size: 0.9rem; }
|
|
88
120
|
.sw-calendar__empty { color: var(--sw-color-muted); }
|
|
89
121
|
.sw-calendar__placeholder { padding: var(--sw-space-3); border: 1px dashed var(--sw-color-border); border-radius: var(--sw-radius, 8px); background: var(--sw-color-surface); color: var(--sw-color-muted); font-size: 0.9rem; text-align: center; }
|
|
122
|
+
.sw-calendar__views ul { display: flex; flex-wrap: wrap; gap: var(--sw-space-1); list-style: none; margin: 0 0 var(--sw-space-3); padding: 0; }
|
|
123
|
+
.sw-calendar__views a { display: inline-block; padding: 0.35rem 0.85rem; border: 1px solid var(--sw-color-border); border-radius: 999px; color: inherit; text-decoration: none; font-size: 0.9rem; }
|
|
124
|
+
.sw-calendar__views a[aria-current="page"] { background: var(--sw-color-primary, #1d4ed8); border-color: var(--sw-color-primary, #1d4ed8); color: var(--sw-color-primary-contrast, #fff); }
|
|
125
|
+
.sw-calendar__week { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sw-space-1); }
|
|
126
|
+
.sw-calendar__weekday { border: 1px solid var(--sw-color-border); border-radius: var(--sw-radius, 8px); padding: var(--sw-space-2); min-width: 0; }
|
|
127
|
+
.sw-calendar__weekday--today { border-color: var(--sw-color-primary, #1d4ed8); box-shadow: inset 0 3px 0 var(--sw-color-primary, #1d4ed8); }
|
|
128
|
+
.sw-calendar__weekday-title { margin: 0 0 var(--sw-space-1); font-size: 0.95rem; }
|
|
129
|
+
.sw-calendar__item { display: flex; gap: var(--sw-space-1); align-items: baseline; flex-wrap: wrap; }
|
|
130
|
+
.sw-calendar__time { font-variant-numeric: tabular-nums; color: var(--sw-color-muted); font-size: 0.85rem; min-width: 3.5rem; }
|
|
131
|
+
.sw-calendar__event-title { overflow-wrap: anywhere; }
|
|
132
|
+
.sw-calendar__none { margin: 0; color: var(--sw-color-muted); font-size: 0.85rem; }
|
|
133
|
+
.sw-calendar__agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sw-space-1); }
|
|
134
|
+
.sw-calendar__agenda .sw-calendar__item { padding: var(--sw-space-1) 0; border-bottom: 1px solid var(--sw-color-border); }
|
|
135
|
+
.sw-calendar__agenda .sw-calendar__time { min-width: 4.5rem; font-size: 0.95rem; }
|
|
136
|
+
.sw-calendar__today-link { margin: var(--sw-space-2) 0 0; font-size: 0.9rem; }
|
|
137
|
+
@media (min-width: 900px) {
|
|
138
|
+
.sw-calendar__week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
|
|
139
|
+
.sw-calendar__weekday { min-height: 8rem; }
|
|
140
|
+
.sw-calendar__week .sw-calendar__item { display: block; }
|
|
141
|
+
.sw-calendar__week .sw-calendar__time { display: block; min-width: 0; }
|
|
142
|
+
}
|
|
143
|
+
@media (max-width: 899px) {
|
|
144
|
+
.sw-calendar__weekday--empty .sw-calendar__none { display: inline; }
|
|
145
|
+
}
|
|
90
146
|
@media (max-width: 640px) {
|
|
91
147
|
.sw-calendar__grid th { font-size: 0.7rem; }
|
|
92
148
|
.sw-calendar__cell { height: auto; min-height: 3rem; padding: 2px; }
|
package/dist/calendar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../src/calendar.tsx"],"names":[],"mappings":";AA6CA,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAEzE,SAAS,EAAE,CAAC,GAAG,KAA+C;IAC5D,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,SAAS,CAAC,EAAE,CAAC,EAAwB;IA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