@astl/astrolabe 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +134 -0
- package/LICENSE +202 -0
- package/README.md +65 -0
- package/dist/cdn/astrolabe-editor.js +1441 -0
- package/dist/cdn/astrolabe-editor.js.map +1 -0
- package/dist/cdn/astrolabe-player.js +2 -0
- package/dist/cdn/astrolabe-player.js.map +1 -0
- package/dist/cdn/astrolabe.css +238 -0
- package/dist/cdn/astrolabe.js +3 -0
- package/dist/cdn/astrolabe.js.map +1 -0
- package/dist/cdn/astrolabe.standalone.js +8007 -0
- package/dist/cdn/chunks/audio-B0LSIn5N.js +48 -0
- package/dist/cdn/chunks/audio-B0LSIn5N.js.map +1 -0
- package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js +2 -0
- package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js.map +1 -0
- package/dist/cdn/chunks/block-styles-CKo9x7Vt.js +68 -0
- package/dist/cdn/chunks/block-styles-CKo9x7Vt.js.map +1 -0
- package/dist/cdn/chunks/book-CHzDDaim.js +15 -0
- package/dist/cdn/chunks/book-CHzDDaim.js.map +1 -0
- package/dist/cdn/chunks/callout-QFLFLPc5.js +49 -0
- package/dist/cdn/chunks/callout-QFLFLPc5.js.map +1 -0
- package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js +2 -0
- package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js.map +1 -0
- package/dist/cdn/chunks/categorise-BO2tNVJ3.js +203 -0
- package/dist/cdn/chunks/categorise-BO2tNVJ3.js.map +1 -0
- package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js +2 -0
- package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js.map +1 -0
- package/dist/cdn/chunks/chip-styles-Dme5daTO.js +77 -0
- package/dist/cdn/chunks/chip-styles-Dme5daTO.js.map +1 -0
- package/dist/cdn/chunks/choice-CExBvqKj.js +136 -0
- package/dist/cdn/chunks/choice-CExBvqKj.js.map +1 -0
- package/dist/cdn/chunks/choice-manifest-C-XahD7m.js +2 -0
- package/dist/cdn/chunks/choice-manifest-C-XahD7m.js.map +1 -0
- package/dist/cdn/chunks/color-control-Cl5cuMSO.js +91 -0
- package/dist/cdn/chunks/color-control-Cl5cuMSO.js.map +1 -0
- package/dist/cdn/chunks/crossword-Cb-a3Tjj.js +270 -0
- package/dist/cdn/chunks/crossword-Cb-a3Tjj.js.map +1 -0
- package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js +2 -0
- package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js.map +1 -0
- package/dist/cdn/chunks/declarations-BhqOz1ap.js +2 -0
- package/dist/cdn/chunks/declarations-BhqOz1ap.js.map +1 -0
- package/dist/cdn/chunks/definitions-CNX90WtL.js +6 -0
- package/dist/cdn/chunks/definitions-CNX90WtL.js.map +1 -0
- package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js +14 -0
- package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js.map +1 -0
- package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js +2 -0
- package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js.map +1 -0
- package/dist/cdn/chunks/drop-vRXndjHu.js +86 -0
- package/dist/cdn/chunks/drop-vRXndjHu.js.map +1 -0
- package/dist/cdn/chunks/flash-cards-0NrrKdrx.js +87 -0
- package/dist/cdn/chunks/flash-cards-0NrrKdrx.js.map +1 -0
- package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js +2 -0
- package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js.map +1 -0
- package/dist/cdn/chunks/gap-lor-khst.js +78 -0
- package/dist/cdn/chunks/gap-lor-khst.js.map +1 -0
- package/dist/cdn/chunks/gap-manifest-RSydA41N.js +2 -0
- package/dist/cdn/chunks/gap-manifest-RSydA41N.js.map +1 -0
- package/dist/cdn/chunks/help-C-woafz5.js +138 -0
- package/dist/cdn/chunks/help-C-woafz5.js.map +1 -0
- package/dist/cdn/chunks/help-form-DaC6KaFG.js +160 -0
- package/dist/cdn/chunks/help-form-DaC6KaFG.js.map +1 -0
- package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js +2 -0
- package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js.map +1 -0
- package/dist/cdn/chunks/hotspot-oel1Eelo.js +154 -0
- package/dist/cdn/chunks/hotspot-oel1Eelo.js.map +1 -0
- package/dist/cdn/chunks/image-drop-Dkprw0Kn.js +295 -0
- package/dist/cdn/chunks/image-drop-Dkprw0Kn.js.map +1 -0
- package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js +2 -0
- package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js.map +1 -0
- package/dist/cdn/chunks/image-label-Dm5shQSh.js +177 -0
- package/dist/cdn/chunks/image-label-Dm5shQSh.js.map +1 -0
- package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js +2 -0
- package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js.map +1 -0
- package/dist/cdn/chunks/inline-styles-CTgXWnHb.js +80 -0
- package/dist/cdn/chunks/inline-styles-CTgXWnHb.js.map +1 -0
- package/dist/cdn/chunks/insert-menu-LgrifBYT.js +80 -0
- package/dist/cdn/chunks/insert-menu-LgrifBYT.js.map +1 -0
- package/dist/cdn/chunks/issue-list-BgnXzXRM.js +51 -0
- package/dist/cdn/chunks/issue-list-BgnXzXRM.js.map +1 -0
- package/dist/cdn/chunks/keys-DU-Qknmz.js +2 -0
- package/dist/cdn/chunks/keys-DU-Qknmz.js.map +1 -0
- package/dist/cdn/chunks/live-jdiyYln2.js +7 -0
- package/dist/cdn/chunks/live-jdiyYln2.js.map +1 -0
- package/dist/cdn/chunks/long-answer-CtzClLAx.js +71 -0
- package/dist/cdn/chunks/long-answer-CtzClLAx.js.map +1 -0
- package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js +2 -0
- package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js.map +1 -0
- package/dist/cdn/chunks/mark-words-CpH3gTcX.js +131 -0
- package/dist/cdn/chunks/mark-words-CpH3gTcX.js.map +1 -0
- package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js +2 -0
- package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js.map +1 -0
- package/dist/cdn/chunks/match-DKE_4o-x.js +352 -0
- package/dist/cdn/chunks/match-DKE_4o-x.js.map +1 -0
- package/dist/cdn/chunks/match-manifest-D0UfoajU.js +2 -0
- package/dist/cdn/chunks/match-manifest-D0UfoajU.js.map +1 -0
- package/dist/cdn/chunks/memory-B6hSyHyz.js +187 -0
- package/dist/cdn/chunks/memory-B6hSyHyz.js.map +1 -0
- package/dist/cdn/chunks/memory-manifest-D1589iR0.js +2 -0
- package/dist/cdn/chunks/memory-manifest-D1589iR0.js.map +1 -0
- package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js +2 -0
- package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js.map +1 -0
- package/dist/cdn/chunks/messages-9xiYDvRT.js +2 -0
- package/dist/cdn/chunks/messages-9xiYDvRT.js.map +1 -0
- package/dist/cdn/chunks/option-styles-WKzjKmCH.js +50 -0
- package/dist/cdn/chunks/option-styles-WKzjKmCH.js.map +1 -0
- package/dist/cdn/chunks/order-BhG_6IC-.js +225 -0
- package/dist/cdn/chunks/order-BhG_6IC-.js.map +1 -0
- package/dist/cdn/chunks/order-manifest-J5IXN0he.js +2 -0
- package/dist/cdn/chunks/order-manifest-J5IXN0he.js.map +1 -0
- package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js +2 -0
- package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js.map +1 -0
- package/dist/cdn/chunks/picture-D10YRMYH.js +2 -0
- package/dist/cdn/chunks/picture-D10YRMYH.js.map +1 -0
- package/dist/cdn/chunks/picture-view-BKnAyScQ.js +92 -0
- package/dist/cdn/chunks/picture-view-BKnAyScQ.js.map +1 -0
- package/dist/cdn/chunks/repeat-CY2W2URZ.js +8 -0
- package/dist/cdn/chunks/repeat-CY2W2URZ.js.map +1 -0
- package/dist/cdn/chunks/roving-focus-BxGgi2DD.js +2 -0
- package/dist/cdn/chunks/roving-focus-BxGgi2DD.js.map +1 -0
- package/dist/cdn/chunks/runtime-DxAbpr3S.js +526 -0
- package/dist/cdn/chunks/runtime-DxAbpr3S.js.map +1 -0
- package/dist/cdn/chunks/scan-jWgPnVxA.js +2 -0
- package/dist/cdn/chunks/scan-jWgPnVxA.js.map +1 -0
- package/dist/cdn/chunks/select-DTA3dJzr.js +345 -0
- package/dist/cdn/chunks/select-DTA3dJzr.js.map +1 -0
- package/dist/cdn/chunks/select-manifest-BBMbvdkH.js +2 -0
- package/dist/cdn/chunks/select-manifest-BBMbvdkH.js.map +1 -0
- package/dist/cdn/chunks/source-view-DXKPFCl9.js +29 -0
- package/dist/cdn/chunks/source-view-DXKPFCl9.js.map +1 -0
- package/dist/cdn/chunks/style-form-D5haJtWM.js +240 -0
- package/dist/cdn/chunks/style-form-D5haJtWM.js.map +1 -0
- package/dist/cdn/chunks/style-messages-BbZpeD2a.js +2 -0
- package/dist/cdn/chunks/style-messages-BbZpeD2a.js.map +1 -0
- package/dist/cdn/chunks/style-model-ZXNe_c8R.js +2 -0
- package/dist/cdn/chunks/style-model-ZXNe_c8R.js.map +1 -0
- package/dist/cdn/chunks/style-placing-DPw1zyrz.js +2 -0
- package/dist/cdn/chunks/style-placing-DPw1zyrz.js.map +1 -0
- package/dist/cdn/chunks/style-popups-BobgX1WK.js +74 -0
- package/dist/cdn/chunks/style-popups-BobgX1WK.js.map +1 -0
- package/dist/cdn/chunks/style-rules-D45PZLCv.js +136 -0
- package/dist/cdn/chunks/style-rules-D45PZLCv.js.map +1 -0
- package/dist/cdn/chunks/styled-Dmx5Yjv7.js +57 -0
- package/dist/cdn/chunks/styled-Dmx5Yjv7.js.map +1 -0
- package/dist/cdn/chunks/styles-DxJJxVNH.js +136 -0
- package/dist/cdn/chunks/styles-DxJJxVNH.js.map +1 -0
- package/dist/cdn/chunks/surface-CgxfAwCR.js +1019 -0
- package/dist/cdn/chunks/surface-CgxfAwCR.js.map +1 -0
- package/dist/cdn/chunks/true-false-DP3MO599.js +146 -0
- package/dist/cdn/chunks/true-false-DP3MO599.js.map +1 -0
- package/dist/cdn/chunks/true-false-manifest-B4exv60u.js +2 -0
- package/dist/cdn/chunks/true-false-manifest-B4exv60u.js.map +1 -0
- package/dist/cdn/chunks/video-j9MCH6Kw.js +98 -0
- package/dist/cdn/chunks/video-j9MCH6Kw.js.map +1 -0
- package/dist/cdn/chunks/video-manifest-8OwkhhAI.js +2 -0
- package/dist/cdn/chunks/video-manifest-8OwkhhAI.js.map +1 -0
- package/dist/cdn/chunks/word-bank-ARjwUKZf.js +80 -0
- package/dist/cdn/chunks/word-bank-ARjwUKZf.js.map +1 -0
- package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js +2 -0
- package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js.map +1 -0
- package/dist/cdn/chunks/word-search-AHvM7yCJ.js +274 -0
- package/dist/cdn/chunks/word-search-AHvM7yCJ.js.map +1 -0
- package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js +2 -0
- package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js.map +1 -0
- package/dist/editor.d.ts +32 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.js +51 -0
- package/dist/editor.js.map +1 -0
- package/dist/engine.d.ts +33 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +53 -0
- package/dist/engine.js.map +1 -0
- package/dist/player.d.ts +19 -0
- package/dist/player.d.ts.map +1 -0
- package/dist/player.js +22 -0
- package/dist/player.js.map +1 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +8 -0
- package/dist/server.js.map +1 -0
- package/package.json +82 -4
- package/src/bundles/astrolabe-editor.ts +11 -0
- package/src/bundles/astrolabe-player.ts +10 -0
- package/src/bundles/astrolabe-standalone.ts +23 -0
- package/src/bundles/astrolabe.ts +12 -0
- package/src/editor.ts +98 -0
- package/src/engine.ts +59 -0
- package/src/player.ts +23 -0
- package/src/server.ts +7 -0
|
@@ -0,0 +1,1441 @@
|
|
|
1
|
+
import{S as e,_ as t,a as n,b as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as ee,s as te,t as h,u as ne,v as re,w as ie,x as ae,y as oe}from"./chunks/definitions-CNX90WtL.js";import{$ as se,$t as ce,A as le,At as ue,B as de,Bt as fe,C as g,Ct as pe,D as me,Dt as he,E as _,Et as ge,F as _e,Ft as ve,G as ye,Gt as be,H as xe,Ht as Se,I as Ce,It as we,J as Te,Jt as Ee,K as v,Kt as De,L as Oe,Lt as ke,M as y,Mt as Ae,N as je,Nt as Me,O as Ne,Ot as Pe,P as Fe,Pt as b,Q as Ie,Qt as Le,R as Re,Rt as ze,Sn as Be,St as Ve,T as x,Tt as He,U as Ue,Ut as We,V as Ge,Vt as Ke,W as qe,Wt as Je,X as Ye,Xt as Xe,Y as Ze,Yt as Qe,Z as $e,Zt as et,_n as tt,_t as nt,a as rt,an as it,at,b as S,bn as ot,bt as st,cn as ct,ct as lt,dn as ut,dt,en as ft,et as pt,fn as mt,ft as ht,gn as gt,gt as _t,hn as vt,ht as yt,in as bt,it as xt,j as St,jt as C,k as Ct,kt as wt,ln as Tt,lt as Et,mn as Dt,mt as Ot,nn as kt,nt as At,on as jt,ot as Mt,pn as Nt,pt as Pt,q as Ft,qt as It,rn as Lt,rt as Rt,sn as zt,st as Bt,tn as Vt,tt as Ht,un as Ut,ut as Wt,v as w,vn as Gt,vt as Kt,wt as qt,xn as Jt,xt as Yt,y as Xt,yn as Zt,yt as Qt,z as $t,zt as en}from"./chunks/runtime-DxAbpr3S.js";import{r as tn}from"./chunks/audio-manifest-B9FWQzRy.js";import{r as nn}from"./chunks/callout-manifest-Cb12O4jl.js";import{r as rn}from"./chunks/categorise-manifest-C_hEDVYQ.js";import{r as an}from"./chunks/choice-manifest-C-XahD7m.js";import{r as on}from"./chunks/crossword-manifest-2qlu7AYd.js";import{r as sn}from"./chunks/drop-manifest-bzNOa5ks.js";import{r as cn}from"./chunks/flash-cards-manifest-B8nWXbRy.js";import{r as ln}from"./chunks/gap-manifest-RSydA41N.js";import{r as un}from"./chunks/hotspot-manifest-CNs1oiZ_.js";import{r as dn}from"./chunks/image-drop-manifest-BZ6hCoAd.js";import{r as fn}from"./chunks/image-label-manifest--1CLRJzd.js";import{r as pn}from"./chunks/long-answer-manifest-BYJpZRtB.js";import{r as mn}from"./chunks/mark-words-manifest-Cs2pXCEx.js";import{r as hn}from"./chunks/match-manifest-D0UfoajU.js";import{r as gn}from"./chunks/memory-manifest-D1589iR0.js";import{r as _n}from"./chunks/order-manifest-J5IXN0he.js";import{r as vn}from"./chunks/select-manifest-BBMbvdkH.js";import{r as yn}from"./chunks/true-false-manifest-B4exv60u.js";import{r as bn}from"./chunks/video-manifest-8OwkhhAI.js";import{r as xn}from"./chunks/word-bank-manifest-C1FSo1kH.js";import{o as Sn}from"./chunks/word-search-manifest-Fg1a59Z1.js";import{d as Cn,n as wn,r as Tn,s as En,u as Dn}from"./chunks/scan-jWgPnVxA.js";import{a as On,c as kn,d as An,f as T,i as E,l as jn,n as D,o as O,r as Mn,s as Nn,t as Pn}from"./chunks/insert-menu-LgrifBYT.js";import{n as Fn,t as k}from"./chunks/messages-9xiYDvRT.js";import{n as In,s as Ln,t as Rn}from"./chunks/style-model-ZXNe_c8R.js";import{n as A,r as j,t as M}from"./chunks/styles-DxJJxVNH.js";import{c as zn,r as Bn,s as Vn}from"./chunks/directive-helpers-D7lOZKnB.js";import{t as N}from"./chunks/live-jdiyYln2.js";import{i as Hn,n as Un,r as Wn,t as Gn}from"./chunks/issue-list-BgnXzXRM.js";import{t as Kn}from"./chunks/roving-focus-BxGgi2DD.js";var qn={manifest:tn,messages:e,label:`editor.label`,description:`editor.description`,icon:`speaker-high`,idPrefix:`audio`,template:`<astl-audio id="{{id}}" label="{{t:template.label}}"><astl-transcript>{{t:template.transcript}}</astl-transcript></astl-audio>`,fields:[{kind:`attribute`,name:`label`,label:`editor.title`,help:`editor.titleHelp`},{kind:`attribute`,name:`src`,label:`editor.src`,help:`editor.srcHelp`,accept:`audio/*`},{kind:`text-list`,tag:`astl-transcript`,label:`editor.transcript`,help:`editor.transcriptHelp`,multiline:!0}]},Jn={manifest:nn,messages:ae,label:`editor.label`,description:`editor.description`,icon:`info`,idPrefix:`callout`,template:`<astl-callout id="{{id}}" kind="tip"><p>{{t:template.text}}</p></astl-callout>`,fields:[{kind:`attribute`,name:`kind`,label:`editor.kind`}]},Yn={manifest:rn,messages:r,label:`editor.label`,description:`editor.description`,icon:`kanban`,idPrefix:`cat`,template:`<astl-categorise id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt><astl-category id="a">{{t:template.categoryA}}</astl-category><astl-category id="b">{{t:template.categoryB}}</astl-category><astl-card id="a1" category="a">{{t:template.cardA1}}</astl-card><astl-card id="a2" category="a">{{t:template.cardA2}}</astl-card><astl-card id="b1" category="b">{{t:template.cardB1}}</astl-card><astl-card id="b2" category="b">{{t:template.cardB2}}</astl-card></astl-categorise>`,templates:[{id:`sort-into-groups`,label:`template.sort.label`,description:`template.sort.description`,template:`<h3>{{t:template.sort.heading}}</h3><p>{{t:template.sort.instruction}}</p><astl-categorise id="{{id}}"><astl-prompt>{{t:template.sort.prompt}}</astl-prompt><astl-category id="a">{{t:template.sort.groupA}}</astl-category><astl-category id="b">{{t:template.sort.groupB}}</astl-category><astl-card id="a1" category="a">{{t:template.sort.card1}}</astl-card><astl-card id="b1" category="b">{{t:template.sort.card2}}</astl-card><astl-card id="a2" category="a">{{t:template.sort.card3}}</astl-card><astl-card id="b2" category="b">{{t:template.sort.card4}}</astl-card></astl-categorise>`}],fields:[{kind:`child-choice`,tag:`astl-card`,attribute:`category`,options:`astl-category`,label:`editor.cardCategories`,help:`editor.cardCategoriesHelp`},{kind:`child-table`,tag:`astl-category`,columns:[{attribute:`palette`,label:`editor.palette`}],label:`editor.groups`,help:`editor.groupsHelp`},{kind:`attribute`,name:`scoring`,label:`editor.scoring`,help:`editor.scoringHelp`},{kind:`attribute`,name:`points`,label:`editor.points`}]},Xn={manifest:an,messages:oe,label:`editor.label`,description:`editor.description`,icon:`list-checks`,idPrefix:`choice`,template:`<astl-choice id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt><astl-option id="a" correct>{{t:template.option1}}</astl-option><astl-option id="b">{{t:template.option2}}</astl-option><astl-option id="c">{{t:template.option3}}</astl-option></astl-choice>`,templates:[{id:`multiple-choice`,label:`template.choice.label`,description:`template.choice.description`,template:`<h3>{{t:template.choice.heading}}</h3><p>{{t:template.choice.instruction}}</p><astl-choice id="{{id}}"><astl-prompt>{{t:template.choice.prompt}}</astl-prompt><astl-option id="a">{{t:template.choice.option1}}</astl-option><astl-option id="b" correct>{{t:template.choice.option2}}</astl-option><astl-option id="c">{{t:template.choice.option3}}</astl-option></astl-choice>`}],fields:[{kind:`child-flag`,tag:`astl-option`,attribute:`correct`,label:`editor.correctOptions`},{kind:`attribute`,name:`multiple`,label:`editor.multiple`},{kind:`attribute`,name:`shuffle`,label:`editor.shuffle`},{kind:`attribute`,name:`scoring`,label:`editor.scoring`,help:`editor.scoringHelp`},{kind:`attribute`,name:`points`,label:`editor.points`}]},Zn=e=>`<astl-crossword id="{{id}}" rows="5" columns="5">${e}<astl-crossword-word id="w1" answer="{{t:template.crossword.across}}" row="0" column="0" direction="across">{{t:template.crossword.acrossClue}}</astl-crossword-word><astl-crossword-word id="w2" answer="{{t:template.crossword.down}}" row="0" column="0" direction="down">{{t:template.crossword.downClue}}</astl-crossword-word></astl-crossword>`,Qn={manifest:on,messages:re,label:`editor.label`,description:`editor.description`,icon:`grid-four`,idPrefix:`crossword`,template:Zn(`<astl-prompt>{{t:template.crossword.prompt}}</astl-prompt>`),templates:[{id:`crossword`,label:`template.crossword`,description:`template.crossword.description`,template:`<h3>{{t:template.crossword.heading}}</h3><p>{{t:template.crossword.prompt}}</p>${Zn(``)}`}],fields:[{kind:`attribute`,name:`rows`,label:`editor.rows`},{kind:`attribute`,name:`columns`,label:`editor.columns`},{kind:`child-table`,tag:`astl-crossword-word`,label:`editor.words`,help:`editor.wordsHelp`,columns:[{attribute:`answer`,label:`editor.answer`},{attribute:`row`,label:`editor.row`},{attribute:`column`,label:`editor.column`},{attribute:`direction`,label:`editor.direction`}]},{kind:`attribute`,name:`scoring`,label:`editor.scoring`},{kind:`attribute`,name:`points`,label:`editor.points`}]},$n={manifest:sn,messages:t,label:`editor.label`,description:`editor.description`,icon:`arrow-square-in`,idPrefix:`drop`,template:`<astl-drop id="{{id}}" answer="a" bank=""></astl-drop>`,companion:{tag:`astl-word-bank`,attribute:`bank`},fields:[{kind:`attribute`,name:`answer`,label:`editor.answer`,help:`editor.answerHelp`,options:{from:`bank`,tag:`astl-word`}},{kind:`attribute`,name:`bank`,label:`editor.bank`,help:`editor.bankHelp`},{kind:`attribute`,name:`points`,label:`editor.points`}]},er=`https://assets.example.org/flash-cards/`,P=(e,t)=>`<astl-front>${e}</astl-front><astl-back>{{t:template.cards.${t}}}</astl-back>`,tr=e=>`<img src="${er}${e}.svg" alt="{{t:template.cards.${e}}}" width="96" height="96">`,nr={manifest:cn,messages:s,label:`editor.label`,description:`editor.description`,icon:`cards`,idPrefix:`cards`,template:`<astl-flash-cards id="{{id}}"><astl-front>{{t:template.front}}</astl-front><astl-back>{{t:template.back}}</astl-back></astl-flash-cards>`,templates:[{id:`flash-cards`,label:`editor.template.cards`,description:`editor.template.cards.description`,template:`<h3>{{t:template.cards.title}}</h3><p>{{t:template.cards.instruction}}</p><astl-flash-cards id="{{id}}">`+P(tr(`sun`),`sunBack`)+P(tr(`moon`),`moonBack`)+P(`{{t:template.cards.mars}}`,`marsBack`)+P(`{{t:template.cards.saturn}}`,`saturnBack`)+`</astl-flash-cards>`}],fields:[{kind:`text-list`,tag:`astl-back`,label:`editor.backs`,help:`editor.backsHelp`}]},rr={manifest:ln,messages:c,label:`editor.label`,description:`editor.description`,icon:`text-t`,idPrefix:`gap`,template:`<astl-gap id="{{id}}" answer="{{selection}}"></astl-gap>`,templates:[{id:`fill-the-gaps`,label:`template.fill.label`,description:`template.fill.description`,template:`<h3>{{t:template.fill.heading}}</h3><p>{{t:template.fill.instruction}}</p><p>{{t:template.fill.start}} <astl-gap id="{{id}}" answer="{{t:template.fill.answer1}}"></astl-gap> {{t:template.fill.middle}} <astl-gap answer="{{t:template.fill.answer2}}"></astl-gap>{{t:template.fill.end}}</p>`}],fields:[{kind:`attribute`,name:`answer`,label:`editor.answer`},{kind:`text-list`,tag:`astl-alt`,label:`editor.alternatives`,help:`editor.alternativesHelp`},{kind:`attribute`,name:`type`,label:`editor.type`},{kind:`attribute`,name:`case`,label:`editor.case`},{kind:`attribute`,name:`marks`,label:`editor.marks`,help:`editor.marksHelp`},{kind:`attribute`,name:`tolerance`,label:`editor.tolerance`},{kind:`attribute`,name:`width`,label:`editor.width`},{kind:`attribute`,name:`points`,label:`editor.points`}]},ir={manifest:un,messages:d,label:`editor.label`,description:`editor.description`,icon:`crosshair`,idPrefix:`hotspot`,template:`<astl-hotspot id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt><astl-hotspot-region id="r1" x="5" y="10" width="40" height="80" label="{{t:template.place1}}" correct></astl-hotspot-region><astl-hotspot-region id="r2" x="55" y="10" width="40" height="80" label="{{t:template.place2}}"></astl-hotspot-region></astl-hotspot>`,templates:[{id:`find-it-in-the-picture`,label:`template.find.label`,description:`template.find.description`,template:`<h3>{{t:template.find.heading}}</h3><p>{{t:template.find.instruction}}</p><astl-hotspot id="{{id}}" multiple><astl-prompt>{{t:template.find.prompt}}</astl-prompt><astl-hotspot-region id="r1" x="4" y="6" width="22" height="26" label="{{t:template.find.topLeft}}" correct></astl-hotspot-region><astl-hotspot-region id="r2" shape="circle" x="85" y="18" r="10" label="{{t:template.find.topRight}}"></astl-hotspot-region><astl-hotspot-region id="r3" shape="circle" x="50" y="50" r="12" label="{{t:template.find.centre}}" correct></astl-hotspot-region><astl-hotspot-region id="r4" shape="circle" x="15" y="82" r="10" label="{{t:template.find.bottomLeft}}"></astl-hotspot-region><astl-hotspot-region id="r5" x="74" y="68" width="22" height="26" label="{{t:template.find.bottomRight}}" correct></astl-hotspot-region></astl-hotspot>`}],fields:[{kind:`picture-regions`,tag:`astl-hotspot-region`,src:`src`,label:`editor.regions`,help:`editor.regionsHelp`},{kind:`attribute`,name:`alt`,label:`editor.alt`,help:`editor.altHelp`},{kind:`child-flag`,tag:`astl-hotspot-region`,attribute:`correct`,label:`editor.correct`,help:`editor.correctHelp`},{kind:`attribute`,name:`multiple`,label:`editor.multiple`},{kind:`attribute`,name:`outline`,label:`editor.outline`},{kind:`attribute`,name:`scoring`,label:`editor.scoring`,help:`editor.scoringHelp`},{kind:`attribute`,name:`points`,label:`editor.points`}]},ar={manifest:dn,messages:m,label:`editor.label`,description:`editor.description`,icon:`tag`,idPrefix:`image-drop`,template:`<astl-image-drop id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt><astl-image-drop-zone id="z1" x="10" y="35" width="30" height="30" answer="l1"></astl-image-drop-zone><astl-image-drop-zone id="z2" x="60" y="35" width="30" height="30" answer="l2"></astl-image-drop-zone><astl-image-drop-label id="l1">{{t:template.label1}}</astl-image-drop-label><astl-image-drop-label id="l2">{{t:template.label2}}</astl-image-drop-label></astl-image-drop>`,templates:[{id:`drag-labels-onto-the-picture`,label:`template.drag.label`,description:`template.drag.description`,template:`<h3>{{t:template.drag.heading}}</h3><p>{{t:template.drag.instruction}}</p><astl-image-drop id="{{id}}"><astl-prompt>{{t:template.drag.prompt}}</astl-prompt><astl-image-drop-zone id="z1" x="20" y="5" width="60" height="25" answer="l1"></astl-image-drop-zone><astl-image-drop-zone id="z2" x="20" y="37.5" width="60" height="25" answer="l2"></astl-image-drop-zone><astl-image-drop-zone id="z3" x="20" y="70" width="60" height="25" answer="l3"></astl-image-drop-zone><astl-image-drop-label id="l1">{{t:template.drag.label1}}</astl-image-drop-label><astl-image-drop-label id="l2">{{t:template.drag.label2}}</astl-image-drop-label><astl-image-drop-label id="l3">{{t:template.drag.label3}}</astl-image-drop-label><astl-image-drop-label id="l4">{{t:template.drag.label4}}</astl-image-drop-label></astl-image-drop>`}],fields:[{kind:`picture-regions`,tag:`astl-image-drop-zone`,src:`src`,label:`editor.zones`,help:`editor.zonesHelp`},{kind:`attribute`,name:`alt`,label:`editor.alt`,help:`editor.altHelp`},{kind:`child-choice`,tag:`astl-image-drop-zone`,attribute:`answer`,options:`astl-image-drop-label`,label:`editor.answers`,help:`editor.answersHelp`},{kind:`attribute`,name:`scoring`,label:`editor.scoring`,help:`editor.scoringHelp`},{kind:`attribute`,name:`points`,label:`editor.points`}]},or={manifest:fn,messages:o,label:`editor.label`,description:`editor.description`,icon:`map-pin`,idPrefix:`image-label`,template:`<astl-image-label id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt><astl-image-label-pin id="p1" x="30" y="50" label="{{t:template.answer1}}"></astl-image-label-pin><astl-image-label-pin id="p2" x="70" y="50" label="{{t:template.answer2}}"></astl-image-label-pin></astl-image-label>`,templates:[{id:`label-the-picture`,label:`template.label.label`,description:`template.label.description`,template:`<h3>{{t:template.label.heading}}</h3><p>{{t:template.label.instruction}}</p><astl-image-label id="{{id}}"><astl-prompt>{{t:template.label.prompt}}</astl-prompt><astl-image-label-pin id="p1" x="50" y="15" label="{{t:template.label.top}}"></astl-image-label-pin><astl-image-label-pin id="p2" x="50" y="50" label="{{t:template.label.centre}}" alternatives="{{t:template.label.centreAlternative}}"></astl-image-label-pin><astl-image-label-pin id="p3" x="50" y="85" label="{{t:template.label.bottom}}"></astl-image-label-pin></astl-image-label>`}],fields:[{kind:`picture-points`,tag:`astl-image-label-pin`,src:`src`,label:`editor.pins`,help:`editor.pinsHelp`},{kind:`attribute`,name:`alt`,label:`editor.alt`,help:`editor.altHelp`},{kind:`child-text`,tag:`astl-image-label-pin`,attribute:`alternatives`,label:`editor.alternatives`,help:`editor.alternativesHelp`},{kind:`attribute`,name:`case`,label:`editor.case`},{kind:`attribute`,name:`scoring`,label:`editor.scoring`,help:`editor.scoringHelp`},{kind:`attribute`,name:`points`,label:`editor.points`}]},sr={manifest:pn,messages:a,label:`editor.label`,description:`editor.description`,icon:`note-pencil`,idPrefix:`answer`,template:`<astl-long-answer id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt></astl-long-answer>`,templates:[{id:`write-your-answer`,label:`editor.template.write`,description:`editor.template.write.description`,template:`<h3>{{t:template.write.title}}</h3><p>{{t:template.write.instruction}}</p><astl-long-answer id="{{id}}" rows="6" minlength="100" maxlength="800" placeholder="{{t:template.write.placeholder}}"><astl-prompt>{{t:template.write.question}}</astl-prompt></astl-long-answer>`}],fields:[{kind:`attribute`,name:`rows`,label:`editor.rows`,help:`editor.rowsHelp`},{kind:`attribute`,name:`minlength`,label:`editor.minlength`,help:`editor.minlengthHelp`},{kind:`attribute`,name:`maxlength`,label:`editor.maxlength`,help:`editor.maxlengthHelp`},{kind:`attribute`,name:`placeholder`,label:`editor.placeholder`}]},F=(e,t,n=!1)=>`<astl-mark-word id="${e}"${n?` correct`:``}>{{t:template.${t}}}</astl-mark-word>`,I=(e,t)=>`<p>${[1,2,3,4].map(n=>F(`${e}${n}`,`odd.${e}${n}`,n===t)).join(` `)}</p>`,cr={manifest:mn,messages:ne,label:`editor.label`,description:`editor.description`,icon:`highlighter`,idPrefix:`mark-words`,template:`<astl-mark-words id="{{id}}"><p>{{t:template.before}} ${F(`w1`,`word`,!0)} {{t:template.after}}</p></astl-mark-words>`,templates:[{id:`select-words`,label:`template.select.label`,description:`template.select.description`,template:`<h3>{{t:template.select.heading}}</h3><p>{{t:template.select.instruction}}</p><astl-mark-words id="{{id}}"><astl-prompt>{{t:template.select.prompt}}</astl-prompt><p>{{t:template.select.before}} ${F(`w1`,`select.word1`,!0)} {{t:template.select.middle}} ${F(`w2`,`select.word2`)} {{t:template.select.and}} ${F(`w3`,`select.word3`,!0)} {{t:template.select.after}}</p></astl-mark-words>`},{id:`odd-word`,label:`template.odd.label`,description:`template.odd.description`,icon:`strikethrough`,template:`<h3>{{t:template.odd.heading}}</h3><p>{{t:template.odd.instruction}}</p><astl-mark-words id="{{id}}" variant="strike"><astl-prompt>{{t:template.odd.prompt}}</astl-prompt>${I(`a`,3)}${I(`b`,4)}${I(`c`,2)}</astl-mark-words>`}],fields:[{kind:`attribute`,name:`variant`,label:`editor.variant`},{kind:`child-flag`,tag:`astl-mark-word`,attribute:`correct`,label:`editor.correct`,help:`editor.correctHelp`},{kind:`attribute`,name:`scoring`,label:`editor.scoring`},{kind:`attribute`,name:`points`,label:`editor.points`}],wrap:{label:`editor.wrap`,child:`astl-mark-word`,attributes:{correct:``}}},lr=(e,t,n)=>`<astl-match id="{{id}}"${t}>${n}`+[`1`,`2`,`3`].map((t,n)=>`<astl-row id="r${t}" column="${`abc`[n]}">{{t:template.${e}.row${t}}}</astl-row>`).join(``)+[`A`,`B`,`C`].map(t=>`<astl-column id="${t.toLowerCase()}">{{t:template.${e}.column${t}}}</astl-column>`).join(``)+`</astl-match>`,ur=(e,t=``)=>`<h3>{{t:template.${e}.heading}}</h3><p>{{t:template.${e}.prompt}}</p>${lr(e,t,``)}`,dr={manifest:hn,messages:u,label:`editor.label`,description:`editor.description`,icon:`arrows-left-right`,idPrefix:`match`,template:lr(`matching`,``,`<astl-prompt>{{t:template.matching.prompt}}</astl-prompt>`),templates:[{id:`matching`,label:`template.matching`,description:`template.matching.description`,template:ur(`matching`)},{id:`join-the-lines`,label:`template.lines`,description:`template.lines.description`,template:ur(`lines`,` variant="lines"`)}],fields:[{kind:`child-choice`,tag:`astl-row`,attribute:`column`,options:`astl-column`,label:`editor.answers`,help:`editor.answersHelp`},{kind:`attribute`,name:`variant`,label:`editor.layout`},{kind:`attribute`,name:`scoring`,label:`editor.scoring`},{kind:`attribute`,name:`points`,label:`editor.points`}]},fr=e=>`<astl-memory id="{{id}}">${e}`+[`1`,`2`,`3`].map(e=>`<astl-card-a id="a${e}">{{t:template.memory.a${e}}}</astl-card-a><astl-card-b id="b${e}" pair="a${e}">{{t:template.memory.b${e}}}</astl-card-b>`).join(``)+`</astl-memory>`,pr={manifest:gn,messages:i,label:`editor.label`,description:`editor.description`,icon:`cards`,idPrefix:`memory`,template:fr(`<astl-prompt>{{t:template.memory.prompt}}</astl-prompt>`),templates:[{id:`memory`,label:`template.memory`,description:`template.memory.description`,template:`<h3>{{t:template.memory.heading}}</h3><p>{{t:template.memory.prompt}}</p>${fr(``)}`}],fields:[{kind:`child-choice`,tag:`astl-card-b`,attribute:`pair`,options:`astl-card-a`,label:`editor.pairs`,help:`editor.pairsHelp`},{kind:`attribute`,name:`scoring`,label:`editor.scoring`},{kind:`attribute`,name:`points`,label:`editor.points`}]},mr={manifest:_n,messages:te,label:`editor.label`,description:`editor.description`,icon:`list-numbers`,idPrefix:`order`,template:`<astl-order id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt><astl-item id="a">{{t:template.item1}}</astl-item><astl-item id="b">{{t:template.item2}}</astl-item><astl-item id="c">{{t:template.item3}}</astl-item></astl-order>`,templates:[{id:`ordering`,label:`template.cycle.label`,description:`template.cycle.description`,template:`<h3>{{t:template.cycle.heading}}</h3><p>{{t:template.cycle.instruction}}</p><astl-order id="{{id}}"><astl-prompt>{{t:template.cycle.prompt}}</astl-prompt><astl-item id="a">{{t:template.cycle.item1}}</astl-item><astl-item id="b">{{t:template.cycle.item2}}</astl-item><astl-item id="c">{{t:template.cycle.item3}}</astl-item><astl-item id="d">{{t:template.cycle.item4}}</astl-item></astl-order>`}],fields:[{kind:`attribute`,name:`scoring`,label:`editor.scoring`,help:`editor.scoringHelp`},{kind:`attribute`,name:`variant`,label:`editor.variant`,help:`editor.variantHelp`},{kind:`attribute`,name:`points`,label:`editor.points`}]},hr={manifest:vn,messages:p,label:`editor.label`,description:`editor.description`,icon:`caret-circle-down`,idPrefix:`select`,template:`<astl-select id="{{id}}"><astl-option id="a" correct>{{t:template.option1}}</astl-option><astl-option id="b">{{t:template.option2}}</astl-option><astl-option id="c">{{t:template.option3}}</astl-option></astl-select>`,templates:[{id:`choose-from-a-list`,label:`template.list.label`,description:`template.list.description`,template:`<h3>{{t:template.list.heading}}</h3><p>{{t:template.list.instruction}}</p><p>{{t:template.list.start}} <astl-select id="{{id}}"><astl-option id="a">{{t:template.list.option1}}</astl-option><astl-option id="b" correct>{{t:template.list.option2}}</astl-option><astl-option id="c">{{t:template.list.option3}}</astl-option></astl-select>{{t:template.list.end}}</p>`},{id:`click-the-right-word`,label:`template.click.label`,description:`template.click.description`,template:`<h3>{{t:template.click.heading}}</h3><p>{{t:template.click.instruction}}</p><p>{{t:template.click.start1}} <astl-select id="{{id}}" variant="buttons"><astl-option id="a">{{t:template.click.option1a}}</astl-option><astl-option id="b" correct>{{t:template.click.option1b}}</astl-option><astl-option id="c">{{t:template.click.option1c}}</astl-option></astl-select>{{t:template.click.end}}</p><p>{{t:template.click.start2}} <astl-select variant="buttons"><astl-option id="a">{{t:template.click.option2a}}</astl-option><astl-option id="b" correct>{{t:template.click.option2b}}</astl-option></astl-select>{{t:template.click.end}}</p>`}],fields:[{kind:`child-flag`,tag:`astl-option`,attribute:`correct`,label:`editor.correctOption`,help:`editor.correctOptionHelp`},{kind:`attribute`,name:`shuffle`,label:`editor.shuffle`},{kind:`attribute`,name:`points`,label:`editor.points`},{kind:`attribute`,name:`variant`,label:`editor.variant`},{kind:`attribute`,name:`native`,label:`editor.native`,help:`editor.nativeHelp`,variants:[`dropdown`]}]},gr={manifest:yn,messages:n,label:`editor.label`,description:`editor.description`,icon:`toggle-left`,idPrefix:`tf`,template:`<astl-true-false id="{{id}}"><astl-prompt>{{t:template.prompt}}</astl-prompt><astl-statement id="s1" answer="true">{{t:template.statement1}}</astl-statement><astl-statement id="s2" answer="false">{{t:template.statement2}}</astl-statement></astl-true-false>`,templates:[{id:`true-or-false`,label:`template.tf.label`,description:`template.tf.description`,template:`<h3>{{t:template.tf.heading}}</h3><p>{{t:template.tf.instruction}}</p><astl-true-false id="{{id}}"><astl-statement id="s1" answer="true">{{t:template.tf.statement1}}</astl-statement><astl-statement id="s2" answer="false">{{t:template.tf.statement2}}</astl-statement><astl-statement id="s3" answer="true">{{t:template.tf.statement3}}</astl-statement></astl-true-false>`}],fields:[{kind:`child-choice`,tag:`astl-statement`,attribute:`answer`,label:`editor.answers`},{kind:`attribute`,name:`true-label`,label:`editor.trueLabel`,help:`editor.labelsHelp`},{kind:`attribute`,name:`false-label`,label:`editor.falseLabel`},{kind:`attribute`,name:`scoring`,label:`editor.scoring`},{kind:`attribute`,name:`points`,label:`editor.points`}]},_r={manifest:bn,messages:l,label:`editor.label`,description:`editor.description`,icon:`film-strip`,idPrefix:`video`,template:`<astl-video id="{{id}}" label="{{t:template.label}}"></astl-video>`,templates:[{id:`watch-then-answer`,label:`editor.template.watch`,description:`editor.template.watch.description`,template:`<h3>{{t:template.watch.title}}</h3><p>{{t:template.watch.instruction}}</p><astl-callout kind="tip"><p>{{t:template.watch.tip}}</p></astl-callout><astl-video id="{{id}}" label="{{t:template.watch.label}}" youtube="https://youtu.be/Bq7mT2kWx4E"></astl-video><p>{{t:template.watch.sentence}} <astl-gap answer="{{t:template.watch.gap}}"></astl-gap>.</p>`}],fields:[{kind:`attribute`,name:`label`,label:`editor.title`,help:`editor.titleHelp`},{kind:`attribute`,name:`youtube`,label:`editor.youtube`,help:`editor.youtubeHelp`},{kind:`attribute`,name:`vimeo`,label:`editor.vimeo`,help:`editor.vimeoHelp`},{kind:`attribute`,name:`src`,label:`editor.src`,help:`editor.srcHelp`,accept:`video/mp4,video/webm`},{kind:`attribute`,name:`poster`,label:`editor.poster`,help:`editor.posterHelp`,accept:`image/*`},{kind:`attribute`,name:`captions`,label:`editor.captions`,help:`editor.captionsHelp`,accept:`.vtt,text/vtt`},{kind:`attribute`,name:`captions-lang`,label:`editor.captionsLang`,help:`editor.captionsLangHelp`}]},vr={manifest:xn,messages:ee,label:`editor.label`,description:`editor.description`,icon:`cards`,idPrefix:`bank`,template:`<astl-word-bank id="{{id}}"><astl-word id="a">{{t:template.word1}}</astl-word><astl-word id="b">{{t:template.word2}}</astl-word><astl-word id="c" distractor>{{t:template.word3}}</astl-word></astl-word-bank>`,templates:[{id:`drag-words`,label:`editor.template.dragWords`,description:`editor.template.dragWords.description`,template:`<h3>{{t:template.dragWords.heading}}</h3><p>{{t:template.dragWords.instruction}}</p><astl-word-bank id="{{id}}"><astl-word id="a">{{t:template.dragWords.answer1}}</astl-word><astl-word id="b">{{t:template.dragWords.answer2}}</astl-word><astl-word id="c" distractor>{{t:template.dragWords.distractor}}</astl-word></astl-word-bank><p>{{t:template.dragWords.start}} <astl-drop answer="a"></astl-drop>{{t:template.dragWords.middle}} <astl-drop answer="b"></astl-drop>{{t:template.dragWords.end}}</p>`}],fields:[{kind:`child-flag`,tag:`astl-word`,attribute:`distractor`,label:`editor.distractors`,help:`editor.distractorsHelp`},{kind:`attribute`,name:`reuse`,label:`editor.reuse`,help:`editor.reuseHelp`}]},yr=[`right`,`down`,`down-right`,`left`,`up`,`up-left`,`down-left`,`up-right`],br=`<astl-word-search id="{{id}}" right down down-right>`,xr=[1,2,3].map(e=>`<astl-search-word id="w${e}">{{t:template.word${e}}}</astl-search-word>`).join(``),Sr=[rr,Xn,hr,gr,mr,Yn,dr,vr,$n,{manifest:Sn,messages:f,label:`editor.label`,description:`editor.description`,icon:`magnifying-glass`,idPrefix:`word-search`,template:`${br}<astl-prompt>{{t:template.instruction}}</astl-prompt>${xr}</astl-word-search>`,templates:[{id:`word-search`,label:`editor.template.wordSearch`,description:`editor.template.wordSearch.description`,template:`<h3>{{t:template.title}}</h3><p>{{t:template.instruction}}</p>${br}${xr}</astl-word-search>`}],fields:[{kind:`child-text`,tag:`astl-search-word`,attribute:`word`,label:`editor.words`,help:`editor.wordsHelp`},{kind:`attribute`,name:`size`,label:`editor.size`,help:`editor.sizeHelp`},...yr.map(e=>({kind:`attribute`,name:e,label:`editor.${e}`,...e===`right`?{help:`editor.rightHelp`}:{}})),{kind:`attribute`,name:`scoring`,label:`editor.scoring`},{kind:`attribute`,name:`points`,label:`editor.points`}]},pr,Qn,nr,sr,cr,Jn,ir,ar,or,_r,qn],Cr={moveUp:x`<path d="M10 16V4M5 9l5-5 5 5"/>`,moveDown:x`<path d="M10 4v12M5 11l5 5 5-5"/>`,delete:x`<path d="M4 6h12M8 6V4h4v2M6 6l.8 10h6.4L14 6M9 9v4M11 9v4"/>`},wr=e=>e.kind===`attribute`&&e.control!==`checkbox`&&(e.control!==`text`||e.accept===null),L=e=>e.target.value,Tr=e=>e.target.checked,Er=class extends j{static styles=[A,M(`astl-picture-field, astl-style-form, astl-help-form`),_`
|
|
2
|
+
.style {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--astl-space-2);
|
|
6
|
+
padding-block-start: var(--astl-space-3);
|
|
7
|
+
border-block-start: var(--astl-outline-width) solid var(--astl-line);
|
|
8
|
+
}
|
|
9
|
+
.style-title {
|
|
10
|
+
margin: 0;
|
|
11
|
+
font-size: 1rem;
|
|
12
|
+
}
|
|
13
|
+
.style-targets {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-wrap: wrap;
|
|
16
|
+
gap: var(--astl-space-1);
|
|
17
|
+
}
|
|
18
|
+
.fields {
|
|
19
|
+
display: grid;
|
|
20
|
+
grid-template-columns: repeat(var(--astl-inspector-columns, 1), minmax(0, 1fr));
|
|
21
|
+
gap: var(--astl-space-3);
|
|
22
|
+
}
|
|
23
|
+
.fields > * {
|
|
24
|
+
grid-column: 1 / -1;
|
|
25
|
+
}
|
|
26
|
+
.fields > .short {
|
|
27
|
+
grid-column: auto;
|
|
28
|
+
}
|
|
29
|
+
.field,
|
|
30
|
+
fieldset {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: var(--astl-space-1);
|
|
34
|
+
min-inline-size: 0;
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
border: 0;
|
|
38
|
+
}
|
|
39
|
+
label:not(.check),
|
|
40
|
+
legend {
|
|
41
|
+
padding: 0;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
}
|
|
44
|
+
fieldset > ul,
|
|
45
|
+
fieldset > .check:first-of-type {
|
|
46
|
+
margin-block-start: var(--astl-space-1);
|
|
47
|
+
}
|
|
48
|
+
.check {
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: var(--astl-space-2);
|
|
53
|
+
min-block-size: var(--astl-target-min);
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
}
|
|
56
|
+
`,_`
|
|
57
|
+
.pick {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
gap: var(--astl-space-1);
|
|
61
|
+
margin-block-start: var(--astl-space-1);
|
|
62
|
+
}
|
|
63
|
+
.pick label {
|
|
64
|
+
font-weight: 400;
|
|
65
|
+
}
|
|
66
|
+
.item {
|
|
67
|
+
display: flex;
|
|
68
|
+
gap: var(--astl-space-2);
|
|
69
|
+
align-items: center;
|
|
70
|
+
}
|
|
71
|
+
.item :is(input, textarea) {
|
|
72
|
+
flex: 1 1 auto;
|
|
73
|
+
}
|
|
74
|
+
.item:has(textarea) {
|
|
75
|
+
align-items: flex-start;
|
|
76
|
+
}
|
|
77
|
+
.item button {
|
|
78
|
+
flex: none;
|
|
79
|
+
}
|
|
80
|
+
fieldset > button {
|
|
81
|
+
align-self: flex-start;
|
|
82
|
+
}
|
|
83
|
+
`,_`
|
|
84
|
+
.choice > legend {
|
|
85
|
+
font-weight: 400;
|
|
86
|
+
}
|
|
87
|
+
.choice > .values {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-wrap: wrap;
|
|
90
|
+
column-gap: var(--astl-space-4);
|
|
91
|
+
}
|
|
92
|
+
.help {
|
|
93
|
+
margin: 0;
|
|
94
|
+
color: var(--astl-ink-muted);
|
|
95
|
+
font-size: var(--astl-size-small);
|
|
96
|
+
}
|
|
97
|
+
`,_`
|
|
98
|
+
.row {
|
|
99
|
+
margin-block-start: var(--astl-space-2);
|
|
100
|
+
padding: var(--astl-space-2) var(--astl-space-3) var(--astl-space-3);
|
|
101
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
102
|
+
border-radius: var(--astl-radius-m);
|
|
103
|
+
}
|
|
104
|
+
.row > legend {
|
|
105
|
+
padding-inline: var(--astl-space-1);
|
|
106
|
+
font-weight: 400;
|
|
107
|
+
}
|
|
108
|
+
.cells {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-wrap: wrap;
|
|
111
|
+
align-items: flex-end;
|
|
112
|
+
gap: var(--astl-space-2);
|
|
113
|
+
}
|
|
114
|
+
.cell {
|
|
115
|
+
flex: 1 1 5rem;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: var(--astl-space-1);
|
|
119
|
+
min-inline-size: 0;
|
|
120
|
+
font-weight: 400;
|
|
121
|
+
}
|
|
122
|
+
.cell > input,
|
|
123
|
+
.cell > select {
|
|
124
|
+
inline-size: 100%;
|
|
125
|
+
}
|
|
126
|
+
`,_`
|
|
127
|
+
.head,
|
|
128
|
+
.actions {
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-wrap: wrap;
|
|
131
|
+
align-items: center;
|
|
132
|
+
gap: var(--astl-space-1) var(--astl-space-2);
|
|
133
|
+
}
|
|
134
|
+
.title {
|
|
135
|
+
flex: 0 1 auto;
|
|
136
|
+
min-inline-size: 0;
|
|
137
|
+
}
|
|
138
|
+
.actions {
|
|
139
|
+
margin-inline-start: auto;
|
|
140
|
+
}
|
|
141
|
+
.glyph {
|
|
142
|
+
fill: none;
|
|
143
|
+
stroke: currentColor;
|
|
144
|
+
stroke-width: 1.8;
|
|
145
|
+
stroke-linecap: round;
|
|
146
|
+
stroke-linejoin: round;
|
|
147
|
+
}
|
|
148
|
+
.glyph circle {
|
|
149
|
+
fill: currentColor;
|
|
150
|
+
stroke: none;
|
|
151
|
+
}
|
|
152
|
+
.id {
|
|
153
|
+
padding-inline: var(--astl-space-2);
|
|
154
|
+
border-radius: var(--astl-radius-s);
|
|
155
|
+
background: var(--astl-accent-soft);
|
|
156
|
+
color: var(--astl-ink);
|
|
157
|
+
font-family: var(--astl-font-mono);
|
|
158
|
+
font-size: var(--astl-size-small);
|
|
159
|
+
}
|
|
160
|
+
.delete {
|
|
161
|
+
color: var(--astl-danger);
|
|
162
|
+
}
|
|
163
|
+
.issue {
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: flex-start;
|
|
166
|
+
gap: var(--astl-space-2);
|
|
167
|
+
padding-block: var(--astl-space-2);
|
|
168
|
+
padding-inline: var(--astl-space-3);
|
|
169
|
+
border-radius: var(--astl-radius-s);
|
|
170
|
+
background: var(--astl-danger-soft);
|
|
171
|
+
color: var(--astl-ink);
|
|
172
|
+
}
|
|
173
|
+
.issue .icon {
|
|
174
|
+
color: var(--astl-danger);
|
|
175
|
+
}
|
|
176
|
+
.issue[data-severity='warning'] {
|
|
177
|
+
background: var(--astl-warning-soft);
|
|
178
|
+
}
|
|
179
|
+
.issue[data-severity='warning'] .icon {
|
|
180
|
+
color: var(--astl-warning);
|
|
181
|
+
}
|
|
182
|
+
@media (forced-colors: active) {
|
|
183
|
+
.issue {
|
|
184
|
+
border: var(--astl-outline-width) solid CanvasText;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
`,_`
|
|
188
|
+
textarea {
|
|
189
|
+
field-sizing: content;
|
|
190
|
+
min-block-size: 5lh;
|
|
191
|
+
resize: vertical;
|
|
192
|
+
}
|
|
193
|
+
.upload {
|
|
194
|
+
display: flex;
|
|
195
|
+
flex-direction: column;
|
|
196
|
+
align-items: flex-start;
|
|
197
|
+
}
|
|
198
|
+
.upload p {
|
|
199
|
+
margin-block: var(--astl-space-1) 0;
|
|
200
|
+
}
|
|
201
|
+
.error {
|
|
202
|
+
margin: 0;
|
|
203
|
+
padding: var(--astl-space-2);
|
|
204
|
+
border-inline-start: var(--astl-space-1) solid var(--astl-danger);
|
|
205
|
+
background: var(--astl-danger-soft);
|
|
206
|
+
}
|
|
207
|
+
`];#e=null;#t=!1;#n=null;#r=null;#i=null;#a=null;get model(){return this.#n}#o(e,t){let{authoring:n,adapter:r}=this;if(n===null||r===null)return;if(t===void 0&&this.#t){let t=r.getSource(),i=n.update(t,e);i!==t&&r.setSource(i);return}let i=t===void 0?this.#e:t;if(i===null)return;let a=r.getElement(i);if(a===null)return;let o=n.update(a,e);o!==a&&r.replaceElement(i,o)}updated(){let e=this.#r;if(e===null)return;this.#r=null;let t=e.item===`add`?`[data-add]`:`[data-item="${e.item}"]`;this.renderRoot.querySelector(`[data-field="${e.field}"]${t}`)?.focus()}#s(e){return wr(e)?`field short`:`field`}#c(e,t){return e.help===null?S:g`<p class="help" id="help-${t}">${e.help}</p>`}#l(e,t){return e.help===null?void 0:`help-${t}`}#u(e,t){return g`<div class=${this.#s(e)} part="field">
|
|
208
|
+
<label for="field-${t}" part="label">${e.label}</label>
|
|
209
|
+
<input
|
|
210
|
+
id="field-${t}"
|
|
211
|
+
type="text"
|
|
212
|
+
dir="auto"
|
|
213
|
+
autocomplete="off"
|
|
214
|
+
data-name=${e.name}
|
|
215
|
+
.value=${N(e.value)}
|
|
216
|
+
?required=${e.required}
|
|
217
|
+
aria-describedby=${w(this.#l(e,t))}
|
|
218
|
+
@input=${t=>{let n=L(t);this.#o({kind:`attribute`,name:e.name,value:n===``&&!e.required?null:n})}}
|
|
219
|
+
/>
|
|
220
|
+
${this.#c(e,t)}
|
|
221
|
+
${e.accept===null||this.authoring?.uploadAsset==null?S:this.#d(e,e.accept)}
|
|
222
|
+
</div>`}#d(e,t){let n=this.#i,r=n?.element===this.#e&&n.name===e.name?n:null,i=r===null?``:r.text??this.t(r.key);return g`<div class="upload">
|
|
223
|
+
<button
|
|
224
|
+
type="button"
|
|
225
|
+
aria-label=${this.t(`inspector.uploadItem`,{label:e.label})}
|
|
226
|
+
@click=${e=>e.currentTarget.nextElementSibling.click()}
|
|
227
|
+
>
|
|
228
|
+
${this.t(`inspector.upload`)}
|
|
229
|
+
</button>
|
|
230
|
+
<input type="file" accept=${t} hidden data-name=${e.name} @change=${t=>{let n=t.target,r=n.files?.[0];n.value=``,r!==void 0&&this.#f(e,r)}} />
|
|
231
|
+
<div role="status">${r!==null&&!r.error?g`<p class="help">${i}</p>`:S}</div>
|
|
232
|
+
<div role="alert">${r?.error?g`<p class="error">${i}</p>`:S}</div>
|
|
233
|
+
</div>`}async#f(e,t){let n=this.authoring,r=n?.uploadAsset??null;if(n===null||r===null)return;let i=this.#e,a=this.#n?.tag??``;this.#a?.abort();let o=new AbortController;this.#a=o;let s=(t,n=!1,r)=>{this.#i={element:i,name:e.name,key:t,error:n,text:r},this.requestUpdate()};s(`inspector.uploading`);try{let c=await r(t,{signal:o.signal});if(o.signal.aborted)return;let l=typeof c?.src==`string`?c.src.trim():``;if(l===``||!n.urlPolicy(l,{tag:a,attribute:e.name})){s(`inspector.uploadBlocked`,!0);return}this.#o({kind:`attribute`,name:e.name,value:l},i),s(`inspector.uploaded`)}catch(e){o.signal.aborted||s(`inspector.uploadFailed`,!0,T(e))}}#p(e,t){return g`<div class=${this.#s(e)} part="field">
|
|
234
|
+
<label for="field-${t}" part="label">${e.label}</label>
|
|
235
|
+
<input
|
|
236
|
+
id="field-${t}"
|
|
237
|
+
type="number"
|
|
238
|
+
data-name=${e.name}
|
|
239
|
+
min=${w(e.min??void 0)}
|
|
240
|
+
max=${w(e.max??void 0)}
|
|
241
|
+
step=${e.step}
|
|
242
|
+
.value=${N(e.value)}
|
|
243
|
+
?required=${e.required}
|
|
244
|
+
aria-describedby=${w(this.#l(e,t))}
|
|
245
|
+
@change=${t=>{let n=L(t);this.#o({kind:`attribute`,name:e.name,value:n===``?null:n})}}
|
|
246
|
+
/>
|
|
247
|
+
${this.#c(e,t)}
|
|
248
|
+
</div>`}#m(e,t){return g`<div class="field" part="field">
|
|
249
|
+
<label class="check" part="label">
|
|
250
|
+
<input
|
|
251
|
+
type="checkbox"
|
|
252
|
+
data-name=${e.name}
|
|
253
|
+
.checked=${N(e.checked)}
|
|
254
|
+
aria-describedby=${w(this.#l(e,t))}
|
|
255
|
+
@change=${t=>this.#o({kind:`attribute`,name:e.name,value:Tr(t)})}
|
|
256
|
+
/>
|
|
257
|
+
<span>${e.label}</span>
|
|
258
|
+
</label>
|
|
259
|
+
${this.#c(e,t)}
|
|
260
|
+
</div>`}#h(e,t){return g`<div class=${this.#s(e)} part="field">
|
|
261
|
+
<label for="field-${t}" part="label">${e.label}</label>
|
|
262
|
+
<select
|
|
263
|
+
id="field-${t}"
|
|
264
|
+
data-name=${e.name}
|
|
265
|
+
aria-describedby=${w(this.#l(e,t))}
|
|
266
|
+
@change=${t=>{let n=L(t);this.#o({kind:`attribute`,name:e.name,value:n===``?null:n})}}
|
|
267
|
+
>
|
|
268
|
+
${e.options.map(t=>g`<option value=${t.value} .selected=${N(t.value===e.value)}>${t.label}</option>`)}
|
|
269
|
+
</select>
|
|
270
|
+
${this.#c(e,t)}
|
|
271
|
+
</div>`}#g(e,t){let n=e.values,r=t=>this.#o({kind:`text-list`,tag:e.tag,values:t}),i=()=>{this.#r={field:t,item:n.length},r([...n,``])},a=e=>{let i=n.filter((t,n)=>n!==e);this.#r={field:t,item:i.length===0?`add`:Math.min(e,i.length-1)},r(i)},o=e.max!==null&&n.length>=e.max;return g`<fieldset data-tag=${e.tag} part="field">
|
|
272
|
+
<legend part="label">${e.label}</legend>
|
|
273
|
+
${this.#c(e,t)}
|
|
274
|
+
${n.length===0?S:g`<ul role="list">
|
|
275
|
+
${n.map((i,o)=>{let s=this.t(`inspector.item`,{label:e.label,n:o+1}),c=w(this.#l(e,t)),l=e=>r(n.map((t,n)=>n===o?L(e):t));return g`<li class="item">
|
|
276
|
+
${e.multiline?g`<textarea dir="auto" data-field=${t} data-item=${o} aria-label=${s}
|
|
277
|
+
aria-describedby=${c} .value=${N(i)} @input=${l}></textarea>`:g`<input type="text" dir="auto" autocomplete="off" data-field=${t} data-item=${o}
|
|
278
|
+
aria-label=${s} aria-describedby=${c} .value=${N(i)} @input=${l} />`}
|
|
279
|
+
<button
|
|
280
|
+
type="button"
|
|
281
|
+
aria-label=${this.t(`inspector.removeItem`,{label:e.label,n:o+1})}
|
|
282
|
+
@click=${()=>a(o)}
|
|
283
|
+
>
|
|
284
|
+
${this.t(`inspector.remove`)}
|
|
285
|
+
</button>
|
|
286
|
+
</li>`})}
|
|
287
|
+
</ul>`}
|
|
288
|
+
<button type="button" data-field=${t} data-add ?disabled=${o} @click=${i}>${this.t(`inspector.add`)}</button>
|
|
289
|
+
</fieldset>`}#_(e,t){return g`<fieldset data-tag=${e.tag} part="field" aria-describedby=${w(this.#l(e,t))}>
|
|
290
|
+
<legend part="label">${e.label}</legend>
|
|
291
|
+
${this.#c(e,t)}
|
|
292
|
+
${e.children.map(t=>g`<label class="check">
|
|
293
|
+
<input
|
|
294
|
+
type="checkbox"
|
|
295
|
+
data-index=${t.index}
|
|
296
|
+
.checked=${N(t.checked)}
|
|
297
|
+
@change=${n=>this.#o({kind:`child-flag`,tag:e.tag,attribute:e.attribute,index:t.index,value:Tr(n)})}
|
|
298
|
+
/>
|
|
299
|
+
<span dir="auto">${t.label}</span>
|
|
300
|
+
</label>`)}
|
|
301
|
+
</fieldset>`}#v(e,t){return g`<fieldset data-tag=${e.tag} part="field" aria-describedby=${w(this.#l(e,t))}>
|
|
302
|
+
<legend part="label">${e.label}</legend>
|
|
303
|
+
${this.#c(e,t)}
|
|
304
|
+
${e.children.map(n=>g`<div class="pick">
|
|
305
|
+
<label for="field-${t}-${n.index}" dir="auto">${n.label}</label>
|
|
306
|
+
<input
|
|
307
|
+
id="field-${t}-${n.index}"
|
|
308
|
+
type="text"
|
|
309
|
+
dir="auto"
|
|
310
|
+
autocomplete="off"
|
|
311
|
+
data-index=${n.index}
|
|
312
|
+
.value=${N(n.value)}
|
|
313
|
+
@input=${t=>this.#o({kind:`child-attributes`,tag:e.tag,index:n.index,attributes:{[e.attribute]:L(t)||null}})}
|
|
314
|
+
/>
|
|
315
|
+
</div>`)}
|
|
316
|
+
</fieldset>`}#y(e,t){let n=(t,n)=>this.#o({kind:`child-choice`,tag:e.tag,attribute:e.attribute,index:t,value:n});return g`<fieldset data-tag=${e.tag} part="field" aria-describedby=${w(this.#l(e,t))}>
|
|
317
|
+
<legend part="label">${e.label}</legend>
|
|
318
|
+
${this.#c(e,t)}
|
|
319
|
+
${e.children.map(r=>e.control===`radios`?g`<fieldset class="choice" data-index=${r.index}>
|
|
320
|
+
<legend dir="auto">${r.label}</legend>
|
|
321
|
+
<div class="values">
|
|
322
|
+
${r.options.map(e=>g`<label class="check">
|
|
323
|
+
<input
|
|
324
|
+
type="radio"
|
|
325
|
+
name="choice-${t}-${r.index}"
|
|
326
|
+
value=${e.value}
|
|
327
|
+
.checked=${N(r.value===e.value)}
|
|
328
|
+
@change=${()=>n(r.index,e.value)}
|
|
329
|
+
/>
|
|
330
|
+
<span>${e.label}</span>
|
|
331
|
+
</label>`)}
|
|
332
|
+
</div>
|
|
333
|
+
</fieldset>`:g`<div class="pick">
|
|
334
|
+
<label for="field-${t}-${r.index}" dir="auto">${r.label}</label>
|
|
335
|
+
<select
|
|
336
|
+
id="field-${t}-${r.index}"
|
|
337
|
+
data-index=${r.index}
|
|
338
|
+
@change=${e=>n(r.index,L(e)||null)}
|
|
339
|
+
>
|
|
340
|
+
${r.options.map(e=>g`<option value=${e.value} .selected=${N(e.value===r.value)}>${e.label}</option>`)}
|
|
341
|
+
</select>
|
|
342
|
+
</div>`)}
|
|
343
|
+
</fieldset>`}#b(e,t){let{tag:n,rows:r,columns:i}=e,a=(e,t,r,i)=>this.#o({kind:`child-attributes`,tag:n,index:e,attributes:{[t]:r||(i?``:null)}}),o=()=>{this.#r={field:t,item:r.length},this.#o({kind:`child-add`,tag:n,attributes:e.added})},s=e=>{this.#r={field:t,item:r.length>1?Math.min(e,r.length-2):`add`},this.#o({kind:`child-remove`,tag:n,index:e})},c=(e,n,r)=>{let i=n.values[r]??``,o=t=>a(n.index,e.attribute,L(t),e.required),s=r===0?{field:t,item:n.index}:null;if(e.control===`select`){let t=e.options.some(e=>e.value===i)?e.options:[...e.options,{value:i,label:i||this.t(`inspector.unset`)}];return g`<select data-field=${w(s?.field)} data-item=${w(s?.item)} data-name=${e.attribute} @change=${o}>
|
|
344
|
+
${t.map(e=>g`<option value=${e.value} .selected=${N(e.value===i)}>${e.label}</option>`)}
|
|
345
|
+
</select>`}return g`<input
|
|
346
|
+
type=${e.control}
|
|
347
|
+
dir=${e.control===`text`?`auto`:S}
|
|
348
|
+
autocomplete="off"
|
|
349
|
+
data-field=${w(s?.field)}
|
|
350
|
+
data-item=${w(s?.item)}
|
|
351
|
+
data-name=${e.attribute}
|
|
352
|
+
min=${w(e.min??void 0)}
|
|
353
|
+
max=${w(e.max??void 0)}
|
|
354
|
+
step=${w(e.control===`number`?e.step:void 0)}
|
|
355
|
+
.value=${N(i)}
|
|
356
|
+
@input=${e.control===`text`?o:S}
|
|
357
|
+
@change=${e.control===`number`?o:S}
|
|
358
|
+
/>`};return g`<fieldset data-tag=${n} part="field" aria-describedby=${w(this.#l(e,t))}>
|
|
359
|
+
<legend part="label">${e.label}</legend>
|
|
360
|
+
${this.#c(e,t)}
|
|
361
|
+
${r.map(t=>g`<fieldset class="row" data-index=${t.index}>
|
|
362
|
+
<legend dir="auto">${t.label}</legend>
|
|
363
|
+
<div class="cells">
|
|
364
|
+
${i.map((e,n)=>g`<label class="cell"><span>${e.label}</span>${c(e,t,n)}</label>`)}
|
|
365
|
+
<button
|
|
366
|
+
type="button"
|
|
367
|
+
aria-label=${this.t(`inspector.removeItem`,{label:e.label,n:t.index+1})}
|
|
368
|
+
?disabled=${r.length<=e.min}
|
|
369
|
+
@click=${()=>s(t.index)}
|
|
370
|
+
>
|
|
371
|
+
${this.t(`inspector.remove`)}
|
|
372
|
+
</button>
|
|
373
|
+
</div>
|
|
374
|
+
</fieldset>`)}
|
|
375
|
+
<button type="button" data-field=${t} data-add ?disabled=${e.max!==null&&r.length>=e.max} @click=${o}>
|
|
376
|
+
${this.t(`inspector.add`)}
|
|
377
|
+
</button>
|
|
378
|
+
</fieldset>`}#x(e,t){switch(e.kind){case`picture-regions`:case`picture-points`:return g`<astl-picture-field
|
|
379
|
+
.field=${e}
|
|
380
|
+
.authoring=${this.authoring}
|
|
381
|
+
.element=${this.#e}
|
|
382
|
+
@astl-field-change=${e=>this.#o(e.detail.change,e.detail.element)}
|
|
383
|
+
></astl-picture-field>`;case`text-list`:return this.#g(e,t);case`child-flag`:return this.#_(e,t);case`child-text`:return this.#v(e,t);case`child-choice`:return this.#y(e,t);case`child-table`:return this.#b(e,t);case`attribute`:switch(e.control){case`text`:return this.#u(e,t);case`number`:return this.#p(e,t);case`checkbox`:return this.#m(e,t);case`select`:return this.#h(e,t)}}}#S(e){let{authoring:t,adapter:n}=this,r=n?.getCursor?.()??null;if(t===null||n===null||r===null||t.descriptor(e)?.manifest.display!==`block`)return S;let i=t.outline(n.getSource()).pages.find(e=>e.id===r.page),a=(e,t,n)=>g`<button type="button" class=${e} data-action=${e} aria-label=${this.t(`inspector.${e}`)}
|
|
384
|
+
title=${this.t(`inspector.${e}`)} aria-disabled=${t?`true`:S}
|
|
385
|
+
@click=${()=>{t||n()}}><svg class="icon glyph" viewBox="0 0 20 20" aria-hidden="true" focusable="false">${Cr[e]}</svg></button>`,o=e=>()=>n.moveBlock?.(r,e);return g`<div class="actions" part="actions">
|
|
386
|
+
${n.moveBlock===void 0?S:a(`moveUp`,r.index===0,o(`up`))}
|
|
387
|
+
${n.moveBlock===void 0?S:a(`moveDown`,r.index>=(i?.blocks.length??0)-1,o(`down`))}
|
|
388
|
+
${n.removeBlock===void 0?S:a(`delete`,!1,()=>{n.removeBlock?.(r),n.focus?.()})}
|
|
389
|
+
</div>`}#C(e){let{authoring:t,adapter:n}=this;if(t===null||n===null||e.id===null)return S;let r=n.getSource(),i=Hn(t.validate(r).issues.filter(t=>t.at.element===e.id));return i.length===0?S:g`<ul class="issues" role="list">
|
|
390
|
+
${i.map(e=>g`<li class="issue" part="issue" data-code=${e.code} data-severity=${e.severity}>
|
|
391
|
+
<svg class="icon" viewBox="0 0 20 20" aria-hidden="true" focusable="false">${Gn[e.severity]}</svg>
|
|
392
|
+
<span class="astl-vh">${this.t(`severity.${e.severity}`)}: </span>
|
|
393
|
+
<span>${t.describe(e,r,{page:!1})}</span>
|
|
394
|
+
</li>`)}
|
|
395
|
+
</ul>`}#w(e){let t=this.authoring?.descriptor(e.tag)?.manifest.display,n=Mn.get(e.icon??``)??D[t===`inline`?`inline`:`block`];return g`<div class="head" part="head header">
|
|
396
|
+
<svg class="icon glyph" viewBox="0 0 20 20" aria-hidden="true" focusable="false">${n}</svg>
|
|
397
|
+
<h2 class="title" id="title" part="title" data-id=${e.id??S}>${e.label}</h2>
|
|
398
|
+
${e.id===null?S:g`<code class="id" part="id">${e.id}</code>`}
|
|
399
|
+
${this.#S(e.tag)}
|
|
400
|
+
</div>`}#T=``;#E=null;cursorChanged(){let e=this.adapter?.style?.state().targets??[],t=e.map(e=>e.kind).join(` `);if(t===this.#T)return;this.#T=t;let n=e[0]?.kind;this.#E=n===`picture`?n:null,this.#E!==null&&this.#D(this.#E),this.requestUpdate()}async#D(e){await O(),this.#E=e,this.requestUpdate()}#O(e){if(this.#E===e){this.#E=null,this.requestUpdate();return}let t=new CustomEvent(E,{detail:{target:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t)&&this.#D(e)}#k(){let e=this.adapter?.style?.state().targets??[];if(e.length===0)return S;let t=e.some(e=>e.kind===this.#E)?this.#E:null;return g`<div class="style" part="style">
|
|
401
|
+
<h3 class="style-title">${this.t(`inspector.style`)}</h3>
|
|
402
|
+
<div class="style-targets">
|
|
403
|
+
${e.map(e=>g`<button
|
|
404
|
+
type="button"
|
|
405
|
+
data-style-target=${e.kind}
|
|
406
|
+
aria-expanded=${String(t===e.kind)}
|
|
407
|
+
@click=${()=>this.#O(e.kind)}
|
|
408
|
+
>
|
|
409
|
+
${this.t(`style.target.${e.kind}`)}
|
|
410
|
+
</button>`)}
|
|
411
|
+
</div>
|
|
412
|
+
${t===null?S:g`<astl-style-form .authoring=${this.authoring} .adapter=${this.adapter} .target=${t}></astl-style-form>`}
|
|
413
|
+
</div>`}render(){let{authoring:e,adapter:t}=this;if(e===null)return S;let n=t?.getSelection()??null,r=n===null||t===null?null:t.getElement(n.id),i=r===null?null:e.inspect(r,t?.getSource()),a=n===null&&t!==null?e.inspectDocument(t.getSource()):null;this.#e=i===null?null:n?.id??null,this.#t=i===null&&a!==null,this.#n=i??a;let{lang:o,dir:s}=this.ui,c;if(i===null){let e=r!==null&&n!==null?this.t(`inspector.unsupported`,{tag:n.tag}):this.t(`inspector.empty`);c=g`<h2 class="title" id="title" part="title">${this.t(`inspector.title`)}</h2>
|
|
414
|
+
<p class="note">${e}</p>
|
|
415
|
+
${a===null?S:g`<div class="fields" data-tag=${a.tag}>${a.fields.map((e,t)=>this.#x(e,t))}</div>`}`}else{let n=e.descriptor(i.tag)?.manifest;n?.graded===!0&&On().catch(()=>{}),c=g`${this.#w(i)}${this.#C(i)}
|
|
416
|
+
<div class="fields" data-tag=${i.tag}>${i.fields.map((e,t)=>this.#x(e,t))}</div>
|
|
417
|
+
${n?.graded===!0?g`<astl-help-form .authoring=${e} .adapter=${t} .element=${this.#e}
|
|
418
|
+
?inline=${n.display===`inline`}></astl-help-form>`:S}`}return g`<section class="kit" part="root" lang=${o} dir=${s} aria-labelledby="title">${c}${this.#k()}</section>`}},Dr=class extends j{static styles=[A,Un];#e=null;#t=``;#n;get issues(){return this.#e}validate(){clearTimeout(this.#n),this.#n=void 0,this.#r(),this.requestUpdate()}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.validate()}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.#n),this.#n=void 0}willUpdate(e){super.willUpdate(e),(e.has(`authoring`)||e.has(`adapter`))&&this.#r()}#r(){let{authoring:e,adapter:t}=this;this.#t=t?.getSource()??``,this.#e=e===null||t===null?null:e.validate(this.#t).issues}sourceChanged(){clearTimeout(this.#n),this.#n=setTimeout(()=>this.validate(),300)}selectionChanged(){}render(){let{authoring:e,adapter:t}=this;if(e===null)return S;let n=t===null?null:this.#e,{lang:r,dir:i}=this.ui,a=``;if(n!==null&&n.length===0)a=this.t(`issues.none`);else if(n!==null){let e=n.filter(e=>e.severity===`error`).length;a=this.t(`issues.summary`,{errors:this.t(`issues.errors`,{count:e}),warnings:this.t(`issues.warnings`,{count:n.length-e})})}return g`<section class="kit" part="root" lang=${r} dir=${i} aria-labelledby="title">
|
|
419
|
+
<h2 class="title" id="title" part="title">${this.t(`issues.title`)}</h2>
|
|
420
|
+
<p class="note summary" role="status" ?hidden=${n===null}>${a}</p>
|
|
421
|
+
${n===null?S:Wn(n,e,t,this.#t)}
|
|
422
|
+
</section>`}},Or=class extends j{static styles=[A,_`
|
|
423
|
+
dialog {
|
|
424
|
+
box-sizing: border-box;
|
|
425
|
+
inline-size: min(32rem, calc(100vw - 2 * var(--astl-space-4)));
|
|
426
|
+
max-block-size: calc(100dvh - 2 * var(--astl-space-4));
|
|
427
|
+
padding: var(--astl-space-4);
|
|
428
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
429
|
+
border-radius: var(--astl-radius-l);
|
|
430
|
+
background: var(--astl-surface);
|
|
431
|
+
color: var(--astl-ink);
|
|
432
|
+
}
|
|
433
|
+
dialog::backdrop {
|
|
434
|
+
background: color-mix(in srgb, var(--astl-ink) 40%, transparent);
|
|
435
|
+
}
|
|
436
|
+
form {
|
|
437
|
+
display: flex;
|
|
438
|
+
flex-direction: column;
|
|
439
|
+
gap: var(--astl-space-3);
|
|
440
|
+
}
|
|
441
|
+
label {
|
|
442
|
+
display: flex;
|
|
443
|
+
flex-direction: column;
|
|
444
|
+
gap: var(--astl-space-1);
|
|
445
|
+
font-weight: 600;
|
|
446
|
+
}
|
|
447
|
+
label input {
|
|
448
|
+
font-weight: 400;
|
|
449
|
+
}
|
|
450
|
+
label.check {
|
|
451
|
+
flex-direction: row;
|
|
452
|
+
align-items: center;
|
|
453
|
+
min-block-size: var(--astl-target-min);
|
|
454
|
+
font-weight: 400;
|
|
455
|
+
}
|
|
456
|
+
.upload {
|
|
457
|
+
display: flex;
|
|
458
|
+
flex-direction: column;
|
|
459
|
+
align-items: flex-start;
|
|
460
|
+
}
|
|
461
|
+
.sources {
|
|
462
|
+
display: flex;
|
|
463
|
+
flex-wrap: wrap;
|
|
464
|
+
gap: var(--astl-space-2);
|
|
465
|
+
}
|
|
466
|
+
.upload :is(.note, .error),
|
|
467
|
+
.messages :is(.note, .error) {
|
|
468
|
+
margin-block-start: var(--astl-space-2);
|
|
469
|
+
}
|
|
470
|
+
.preview {
|
|
471
|
+
display: block;
|
|
472
|
+
max-inline-size: 100%;
|
|
473
|
+
max-block-size: 10rem;
|
|
474
|
+
object-fit: contain;
|
|
475
|
+
align-self: flex-start;
|
|
476
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
477
|
+
}
|
|
478
|
+
.error {
|
|
479
|
+
margin: 0;
|
|
480
|
+
padding: var(--astl-space-2);
|
|
481
|
+
border-inline-start: var(--astl-space-1) solid var(--astl-danger);
|
|
482
|
+
background: var(--astl-danger-soft);
|
|
483
|
+
}
|
|
484
|
+
.actions {
|
|
485
|
+
display: flex;
|
|
486
|
+
flex-wrap: wrap;
|
|
487
|
+
justify-content: flex-end;
|
|
488
|
+
gap: var(--astl-space-2);
|
|
489
|
+
}
|
|
490
|
+
`];#e=null;#t=!1;#n=!0;#r=!1;#i={tag:`img`,attribute:`src`};#a=``;#o=``;#s=!1;#c=``;#l;#u;#d=null;#f=null;#p=!1;#m=!1;#h=0;#g=null;#_=``;#v;async ask(e={}){this.#b(null);let t=e.current;this.#t=t!==void 0,this.#n=e.caption??!this.#t,this.#r=e.altRequired??!1,this.#i=e.target??{tag:`img`,attribute:`src`},this.#a=t?.src??``,this.#o=t?.alt??``,this.#s=!this.#r&&(e.decorative??t?.alt===``),this.#c=t?.caption??``,this.#l=t?.width,this.#u=t?.height,this.#_=this.#a,this.#d=null,this.#f=null,this.#x(),this.requestUpdate(),await this.updateComplete;let n=new Promise(e=>{this.#e=e});return this.#y()?.showModal(),e.file!==void 0&&this.#w(e.file),n}disconnectedCallback(){super.disconnectedCallback(),this.#b(null)}#y(){return this.renderRoot.querySelector(`dialog`)}#b(e){let t=this.#e;this.#e=null,clearTimeout(this.#v),this.#x();let n=this.#y();n?.open&&n.close(),t?.(e)}#x(){this.#g?.abort(),this.#g=null,this.#h++,this.#p=!1,this.#m=!1}#S(e){let t=this.authoring?.urlPolicy;return e.trim()!==``&&t!==void 0&&t(e,this.#i)}#C(e){let t=typeof e?.src==`string`?e.src.trim():``;return this.#S(t)?(this.#a=t,this.#_=t,this.#l=An(e.width),this.#u=An(e.height),!0):!1}async#w(e){let t=this.authoring?.uploadAsset??null;if(t===null)return;this.#x();let n=this.#h,r=new AbortController;this.#g=r,this.#p=!0,this.#f={key:`picture.uploading`,error:!1},this.requestUpdate();let i;try{let a=await t(e,{signal:r.signal});if(n!==this.#h)return;i=this.#C(a)?{key:`picture.uploaded`,error:!1}:{key:`picture.uploadBlocked`,error:!0}}catch(e){if(n!==this.#h)return;i={key:`picture.uploadFailed`,error:!0,text:T(e)}}this.#g=null,this.#p=!1,this.#f=i,this.requestUpdate()}async#T(){let e=this.authoring?.pickPicture??null,t=this.#y();if(e===null||t===null||!t.open)return;this.#x();let n=this.#h,r=new AbortController;this.#g=r,this.#m=!0,this.#f=null,t.close();let i=null,a=!1;try{let t=await e({signal:r.signal});if(n!==this.#h)return;t!=null&&(a=this.#C(t),i=a?{key:`picture.picked`,error:!1}:{key:`picture.pickBlocked`,error:!0})}catch(e){if(n!==this.#h)return;i={key:`picture.pickFailed`,error:!0,text:T(e)}}if(this.#g=null,this.requestUpdate(),await this.updateComplete,n!==this.#h)return;let o=this.#y();if(o===null){this.#b(null);return}this.#m=!1,o.showModal();let s=a?this.#s?`button[type="submit"]`:`#alt`:`[data-library]`;this.renderRoot.querySelector(s)?.focus(),this.#f=i,this.requestUpdate()}#E(e){let t=e===null?``:e.text??this.t(e.key);return g`<div role="status">${e!==null&&!e.error?g`<p class="note">${t}</p>`:S}</div>
|
|
491
|
+
<div role="alert">${e?.error?g`<p class="error">${t}</p>`:S}</div>`}#D(e){if(e.preventDefault(),this.#p)return;let t=this.#a.trim(),n=this.#o.trim();if(t===``)this.#d={key:`picture.srcMissing`,error:!0};else if(!this.#S(t))this.#d={key:`picture.srcBlocked`,error:!0};else if(!this.#s&&n===``)this.#d={key:this.#r?`picture.altRequired`:`picture.altMissing`,error:!0};else{let e=this.#n?this.#c.trim():``;this.#b({src:t,alt:this.#s?``:n,...this.#l===void 0?{}:{width:this.#l},...this.#u===void 0?{}:{height:this.#u},...e===``?{}:{caption:e}});return}this.requestUpdate()}render(){if(this.authoring===null)return S;let{lang:e,dir:t}=this.ui,n=this.authoring.uploadAsset!==null,r=this.authoring.pickPicture!==null,i=this.#d;return g`<dialog
|
|
492
|
+
part="dialog"
|
|
493
|
+
lang=${e}
|
|
494
|
+
dir=${t}
|
|
495
|
+
aria-labelledby="picture-title"
|
|
496
|
+
@close=${()=>{!this.#m&&!this.#y()?.open&&this.#b(null)}}
|
|
497
|
+
>
|
|
498
|
+
<form @submit=${e=>this.#D(e)} novalidate>
|
|
499
|
+
<h2 class="title" id="picture-title">${this.t(this.#t?`picture.editTitle`:`picture.title`)}</h2>
|
|
500
|
+
${n||r?g`<div class="upload">
|
|
501
|
+
<div class="sources">
|
|
502
|
+
${n?g`<button
|
|
503
|
+
type="button"
|
|
504
|
+
part="button"
|
|
505
|
+
?disabled=${this.#p}
|
|
506
|
+
@click=${()=>this.renderRoot.querySelector(`input[type="file"]`)?.click()}
|
|
507
|
+
>
|
|
508
|
+
${this.t(`picture.file`)}
|
|
509
|
+
</button>`:S}
|
|
510
|
+
${r?g`<button type="button" part="button" data-library @click=${()=>void this.#T()}>
|
|
511
|
+
${this.t(`picture.library`)}
|
|
512
|
+
</button>`:S}
|
|
513
|
+
</div>
|
|
514
|
+
${n?g`<input
|
|
515
|
+
type="file"
|
|
516
|
+
accept="image/*"
|
|
517
|
+
hidden
|
|
518
|
+
@change=${e=>{let t=e.target,n=t.files?.[0];t.value=``,n!==void 0&&this.#w(n)}}
|
|
519
|
+
/>`:S}
|
|
520
|
+
${this.#E(this.#f)}
|
|
521
|
+
</div>`:g`<p class="note">${this.t(`picture.urlOnly`)}</p>`}
|
|
522
|
+
<label>
|
|
523
|
+
${this.t(`picture.src`)}
|
|
524
|
+
<input
|
|
525
|
+
type="url"
|
|
526
|
+
inputmode="url"
|
|
527
|
+
autocomplete="off"
|
|
528
|
+
.value=${N(this.#a)}
|
|
529
|
+
@input=${e=>{this.#a=e.target.value,this.#l=void 0,this.#u=void 0,clearTimeout(this.#v),this.#v=setTimeout(()=>{this.#_=this.#a.trim(),this.requestUpdate()},600)}}
|
|
530
|
+
/>
|
|
531
|
+
</label>
|
|
532
|
+
${this.#S(this.#_)?g`<img class="preview" src=${this.#_} alt="" referrerpolicy="no-referrer" />`:S}
|
|
533
|
+
<label>
|
|
534
|
+
${this.t(`picture.alt`)}
|
|
535
|
+
<input
|
|
536
|
+
type="text"
|
|
537
|
+
id="alt"
|
|
538
|
+
aria-describedby="alt-help"
|
|
539
|
+
.value=${N(this.#o)}
|
|
540
|
+
?disabled=${this.#s}
|
|
541
|
+
@input=${e=>{this.#o=e.target.value}}
|
|
542
|
+
/>
|
|
543
|
+
</label>
|
|
544
|
+
<p class="note" id="alt-help">${this.t(`picture.altHelp`)}</p>
|
|
545
|
+
${this.#r?S:g`<label class="check">
|
|
546
|
+
<input
|
|
547
|
+
type="checkbox"
|
|
548
|
+
.checked=${this.#s}
|
|
549
|
+
@change=${e=>{this.#s=e.target.checked,this.requestUpdate()}}
|
|
550
|
+
/>
|
|
551
|
+
${this.t(`picture.decorative`)}
|
|
552
|
+
</label>`}
|
|
553
|
+
${this.#n?g`<label>
|
|
554
|
+
${this.t(`picture.caption`)}
|
|
555
|
+
<input
|
|
556
|
+
type="text"
|
|
557
|
+
.value=${N(this.#c)}
|
|
558
|
+
@input=${e=>{this.#c=e.target.value}}
|
|
559
|
+
/>
|
|
560
|
+
</label>`:S}
|
|
561
|
+
<div class="messages">${this.#E(i)}</div>
|
|
562
|
+
<div class="actions">
|
|
563
|
+
<button type="button" part="button" @click=${()=>this.#b(null)}>${this.t(`picture.cancel`)}</button>
|
|
564
|
+
<button type="submit" class="primary" part="button" ?disabled=${this.#p}>
|
|
565
|
+
${this.t(this.#t?`picture.save`:`picture.insert`)}
|
|
566
|
+
</button>
|
|
567
|
+
</div>
|
|
568
|
+
</form>
|
|
569
|
+
</dialog>`}},kr=`astl-field-change`,R=e=>Math.round(Math.min(100,Math.max(0,e))*10)/10,z=e=>String(R(e)),B=64,V=e=>`c${e%St.length+1}`;function Ar(e,t){let n=jr(e),r=(n.left+n.right)/2,i=(n.top+n.bottom)/2,a=Math.max(1,n.right-n.left),o=Math.max(1,n.bottom-n.top),s={x:null,y:null,width:null,height:null,r:null,points:null};if(t===`circle`)return{...s,shape:t,x:z(r),y:z(i),r:z(a/2)};if(t===`polygon`){let e=[[n.left,n.top],[n.right,n.top],[n.right,n.bottom],[n.left,n.bottom]];return{...s,shape:t,points:e.map(([e=0,t=0])=>`${z(e)},${z(t)}`).join(` `)}}return{...s,shape:t,x:z(r-a/2),y:z(i-o/2),width:z(a),height:z(o)}}function jr(e){if(e.shape===`circle`)return{left:e.x-e.r,top:e.y-e.r,right:e.x+e.r,bottom:e.y+e.r};if(e.shape===`polygon`&&e.points.length>0){let t={left:100,top:100,right:0,bottom:0};for(let[n,r]of e.points)t.left=Math.min(t.left,n),t.top=Math.min(t.top,r),t.right=Math.max(t.right,n),t.bottom=Math.max(t.bottom,r);return t}return{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height}}function Mr(e){let t=jr(e);return[(t.left+t.right)/2,(t.top+t.bottom)/2]}var Nr=class extends Xt{static properties={field:{attribute:!1},authoring:{attribute:!1},element:{attribute:!1}};static styles=[A,_`
|
|
570
|
+
fieldset {
|
|
571
|
+
display: flex;
|
|
572
|
+
flex-direction: column;
|
|
573
|
+
gap: var(--astl-space-3);
|
|
574
|
+
min-inline-size: 0;
|
|
575
|
+
margin: 0;
|
|
576
|
+
padding: var(--astl-space-3);
|
|
577
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
578
|
+
border-radius: var(--astl-radius-m);
|
|
579
|
+
}
|
|
580
|
+
legend {
|
|
581
|
+
padding-inline: var(--astl-space-1);
|
|
582
|
+
font-weight: 600;
|
|
583
|
+
}
|
|
584
|
+
label {
|
|
585
|
+
display: flex;
|
|
586
|
+
flex-direction: column;
|
|
587
|
+
gap: var(--astl-space-1);
|
|
588
|
+
}
|
|
589
|
+
.canvas {
|
|
590
|
+
position: relative;
|
|
591
|
+
inline-size: 100%;
|
|
592
|
+
touch-action: none;
|
|
593
|
+
cursor: crosshair;
|
|
594
|
+
user-select: none;
|
|
595
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
596
|
+
background: var(--astl-surface-raised);
|
|
597
|
+
}
|
|
598
|
+
.canvas img {
|
|
599
|
+
display: block;
|
|
600
|
+
inline-size: 100%;
|
|
601
|
+
block-size: auto;
|
|
602
|
+
}
|
|
603
|
+
.canvas .blank {
|
|
604
|
+
aspect-ratio: 4 / 3;
|
|
605
|
+
}
|
|
606
|
+
.canvas svg {
|
|
607
|
+
position: absolute;
|
|
608
|
+
inset: 0;
|
|
609
|
+
inline-size: 100%;
|
|
610
|
+
block-size: 100%;
|
|
611
|
+
overflow: visible;
|
|
612
|
+
}
|
|
613
|
+
.shape {
|
|
614
|
+
fill: var(--soft);
|
|
615
|
+
fill-opacity: 0.4;
|
|
616
|
+
stroke: var(--line);
|
|
617
|
+
stroke-width: 2;
|
|
618
|
+
vector-effect: non-scaling-stroke;
|
|
619
|
+
}
|
|
620
|
+
.shape.unflagged {
|
|
621
|
+
fill-opacity: 0.15;
|
|
622
|
+
stroke-dasharray: 6 4;
|
|
623
|
+
}
|
|
624
|
+
.draft {
|
|
625
|
+
fill: none;
|
|
626
|
+
stroke: var(--astl-ink);
|
|
627
|
+
stroke-width: 2;
|
|
628
|
+
stroke-dasharray: 4 3;
|
|
629
|
+
vector-effect: non-scaling-stroke;
|
|
630
|
+
}
|
|
631
|
+
.badge {
|
|
632
|
+
position: absolute;
|
|
633
|
+
inset-inline-start: var(--x);
|
|
634
|
+
inset-block-start: var(--y);
|
|
635
|
+
transform: translate(-50%, -50%);
|
|
636
|
+
display: inline-flex;
|
|
637
|
+
align-items: center;
|
|
638
|
+
justify-content: center;
|
|
639
|
+
box-sizing: border-box;
|
|
640
|
+
min-inline-size: 1.5rem;
|
|
641
|
+
block-size: 1.5rem;
|
|
642
|
+
padding-inline: var(--astl-space-1);
|
|
643
|
+
border: var(--astl-outline-width) solid var(--line);
|
|
644
|
+
border-radius: 999px;
|
|
645
|
+
background: var(--astl-surface);
|
|
646
|
+
color: var(--astl-ink);
|
|
647
|
+
font-size: var(--astl-size-small);
|
|
648
|
+
font-weight: 700;
|
|
649
|
+
pointer-events: none;
|
|
650
|
+
}
|
|
651
|
+
.pin {
|
|
652
|
+
border-width: calc(2 * var(--astl-outline-width));
|
|
653
|
+
}
|
|
654
|
+
.swatch {
|
|
655
|
+
display: inline-flex;
|
|
656
|
+
align-items: center;
|
|
657
|
+
justify-content: center;
|
|
658
|
+
min-inline-size: 1.5rem;
|
|
659
|
+
block-size: 1.5rem;
|
|
660
|
+
margin-inline-end: var(--astl-space-2);
|
|
661
|
+
border: calc(2 * var(--astl-outline-width)) solid var(--line);
|
|
662
|
+
border-radius: 999px;
|
|
663
|
+
background: var(--soft);
|
|
664
|
+
font-weight: 700;
|
|
665
|
+
}
|
|
666
|
+
.items {
|
|
667
|
+
display: flex;
|
|
668
|
+
flex-direction: column;
|
|
669
|
+
gap: var(--astl-space-3);
|
|
670
|
+
margin: 0;
|
|
671
|
+
padding: 0;
|
|
672
|
+
list-style: none;
|
|
673
|
+
}
|
|
674
|
+
.numbers {
|
|
675
|
+
display: grid;
|
|
676
|
+
grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
|
|
677
|
+
gap: var(--astl-space-2);
|
|
678
|
+
}
|
|
679
|
+
.numbers label {
|
|
680
|
+
justify-content: flex-end;
|
|
681
|
+
}
|
|
682
|
+
.upload {
|
|
683
|
+
display: flex;
|
|
684
|
+
flex-direction: column;
|
|
685
|
+
align-items: flex-start;
|
|
686
|
+
}
|
|
687
|
+
.upload :is(.note, .error) {
|
|
688
|
+
margin-block-start: var(--astl-space-2);
|
|
689
|
+
}
|
|
690
|
+
.sources {
|
|
691
|
+
display: flex;
|
|
692
|
+
flex-wrap: wrap;
|
|
693
|
+
gap: var(--astl-space-2);
|
|
694
|
+
}
|
|
695
|
+
.error {
|
|
696
|
+
padding: var(--astl-space-2);
|
|
697
|
+
border-inline-start: var(--astl-space-1) solid var(--astl-danger);
|
|
698
|
+
background: var(--astl-danger-soft);
|
|
699
|
+
}
|
|
700
|
+
.vertex {
|
|
701
|
+
display: flex;
|
|
702
|
+
flex-wrap: wrap;
|
|
703
|
+
align-items: flex-end;
|
|
704
|
+
gap: var(--astl-space-2);
|
|
705
|
+
}
|
|
706
|
+
.vertex label {
|
|
707
|
+
flex: 1 1 6rem;
|
|
708
|
+
}
|
|
709
|
+
.c1 { --line: var(--astl-palette-1); --soft: var(--astl-palette-1-soft); }
|
|
710
|
+
.c2 { --line: var(--astl-palette-2); --soft: var(--astl-palette-2-soft); }
|
|
711
|
+
.c3 { --line: var(--astl-palette-3); --soft: var(--astl-palette-3-soft); }
|
|
712
|
+
.c4 { --line: var(--astl-palette-4); --soft: var(--astl-palette-4-soft); }
|
|
713
|
+
.c5 { --line: var(--astl-palette-5); --soft: var(--astl-palette-5-soft); }
|
|
714
|
+
.c6 { --line: var(--astl-palette-6); --soft: var(--astl-palette-6-soft); }
|
|
715
|
+
.c7 { --line: var(--astl-palette-7); --soft: var(--astl-palette-7-soft); }
|
|
716
|
+
.c8 { --line: var(--astl-palette-8); --soft: var(--astl-palette-8-soft); }
|
|
717
|
+
@media (forced-colors: active) {
|
|
718
|
+
.shape {
|
|
719
|
+
fill: none;
|
|
720
|
+
stroke: CanvasText;
|
|
721
|
+
}
|
|
722
|
+
.badge,
|
|
723
|
+
.swatch {
|
|
724
|
+
border-color: CanvasText;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
`];#e=null;#t=1;#n=null;#r=null;constructor(){super(),this.field=null,this.authoring=null,this.element=null}willUpdate(e){e.has(`element`)&&e.get(`element`)!==void 0&&(this.#n=null)}#i(e,t){return this.authoring?.t(`astl.editor`,e,t)??e}#a(e,t=this.element){this.dispatchEvent(new CustomEvent(kr,{detail:{change:e,element:t}}))}#o(e,t){let n={tag:e.elementTag,attribute:e.srcAttribute};return t.trim()!==``&&(this.authoring?.urlPolicy(t,n)??!1)}#s(e){let t=new Set(e.kind===`picture-points`?e.points.map(e=>e.id):e.regions.map(e=>e.id)),n=e.tag.replace(/^astl-/,``),r=1;for(;t.has(`${n}-${r}`);)r++;return`${n}-${r}`}#c(e,t){let n=this.#s(e);if(e.kind===`picture-points`){let r=this.#i(`field.point`,{n:e.points.length+1});this.#a({kind:`child-add`,tag:e.tag,attributes:{id:n,x:z(t?.x??50),y:z(t?.y??50),label:r}});return}let r=t?.width??20,i=t?.height??20,a=t===void 0?10:t.x,o=t===void 0?10:t.y,s=e.shapes.length>1?{shape:`rect`}:{};this.#a({kind:`child-add`,tag:e.tag,attributes:{id:n,...s,x:z(a),y:z(o),width:z(r),height:z(i)}})}#l(e,t,n){let r=typeof t?.src==`string`?t.src.trim():``;return this.#o(e,r)?(this.#a({kind:`attribute`,name:e.srcAttribute,value:r},n),!0):!1}async#u(e,t){let n=this.authoring?.uploadAsset??null;if(n===null)return;let r=this.element;this.#r?.abort();let i=new AbortController;this.#r=i,this.#n={key:`picture.uploading`,error:!1},this.requestUpdate();let a;try{let o=await n(t,{signal:i.signal});if(i.signal.aborted)return;a=this.#l(e,o,r)?{key:`picture.uploaded`,error:!1}:{key:`picture.uploadBlocked`,error:!0}}catch(e){if(i.signal.aborted)return;a={key:`picture.uploadFailed`,error:!0,text:T(e)}}this.#r=null,this.#n=this.element===r?a:null,this.requestUpdate()}async#d(e){let t=this.authoring?.pickPicture??null;if(t===null)return;let n=this.element;this.#r?.abort();let r=new AbortController;this.#r=r,this.#n=null,this.requestUpdate();let i=null;try{let a=await t({signal:r.signal});if(r.signal.aborted)return;a!=null&&(i=this.#l(e,a,n)?{key:`picture.picked`,error:!1}:{key:`picture.pickBlocked`,error:!0})}catch(e){if(r.signal.aborted)return;i={key:`picture.pickFailed`,error:!0,text:T(e)}}this.#r=null,this.#n=this.element===n?i:null,this.requestUpdate(),await this.updateComplete,this.isConnected&&this.renderRoot.querySelector(`[data-library]`)?.focus()}#f(e){let t=e.currentTarget,n=t.getBoundingClientRect();return{x:R((e.clientX-n.left-t.clientLeft)/Math.max(1,t.clientWidth)*100),y:R((e.clientY-n.top-t.clientTop)/Math.max(1,t.clientHeight)*100)}}#p(e){if(e.button!==0)return;let{x:t,y:n}=this.#f(e);e.currentTarget.setPointerCapture?.(e.pointerId),this.#e={x0:t,y0:n,x1:t,y1:n}}#m(e){if(this.#e===null)return;let{x:t,y:n}=this.#f(e);this.#e.x1=t,this.#e.y1=n,this.requestUpdate()}#h(e,t){let n=this.#e;if(this.#e=null,n===null)return;let{x:r,y:i}=this.#f(t);if(e.kind===`picture-points`){this.#c(e,{x:r,y:i});return}let a=Math.abs(r-n.x0),o=Math.abs(i-n.y0);a<2&&o<2?this.#c(e,{x:n.x0-5,y:n.y0-5,width:10,height:10}):this.#c(e,{x:Math.min(r,n.x0),y:Math.min(i,n.y0),width:a,height:o}),this.requestUpdate()}#g(e,t){let n=e.flag!==null&&!t.flagged,r=`shape ${V(t.index)}${n?` unflagged`:``}`;return t.shape===`circle`?x`<ellipse class=${r} cx=${t.x} cy=${t.y} rx=${t.r} ry=${t.r*this.#t}></ellipse>`:t.shape===`polygon`?x`<polygon class=${r} points=${t.points.map(([e,t])=>`${e},${t}`).join(` `)}></polygon>`:x`<rect class=${r} x=${t.x} y=${t.y} width=${t.width} height=${t.height}></rect>`}#_(e,[t,n],r){return g`<span
|
|
728
|
+
class="badge ${r?`pin `:``}${V(e)}"
|
|
729
|
+
aria-hidden="true"
|
|
730
|
+
data-x=${t}
|
|
731
|
+
data-y=${n}
|
|
732
|
+
>${e+1}</span
|
|
733
|
+
>`}updated(e){super.updated(e);for(let e of this.renderRoot.querySelectorAll(`.badge`))e.style.setProperty(`--x`,`${e.dataset.x}%`),e.style.setProperty(`--y`,`${e.dataset.y}%`)}#v(e){let t=this.#e,n=this.#o(e,e.src),r=e.kind===`picture-regions`?e.regions.map(t=>this.#g(e,t)):[],i=e.kind===`picture-regions`?e.regions.map(e=>this.#_(e.index,Mr(e),!1)):e.points.map(e=>this.#_(e.index,[e.x,e.y],!0));return g`<div
|
|
734
|
+
class="canvas"
|
|
735
|
+
dir="ltr"
|
|
736
|
+
@pointerdown=${e=>this.#p(e)}
|
|
737
|
+
@pointermove=${e=>this.#m(e)}
|
|
738
|
+
@pointerup=${t=>this.#h(e,t)}
|
|
739
|
+
@pointercancel=${()=>{this.#e=null,this.requestUpdate()}}
|
|
740
|
+
>
|
|
741
|
+
${n?g`<img
|
|
742
|
+
src=${e.src}
|
|
743
|
+
alt=""
|
|
744
|
+
referrerpolicy="no-referrer"
|
|
745
|
+
draggable="false"
|
|
746
|
+
@load=${e=>{let t=e.target;t.naturalHeight>0&&(this.#t=t.naturalWidth/t.naturalHeight),this.requestUpdate()}}
|
|
747
|
+
/>`:g`<div class="blank"></div>`}
|
|
748
|
+
<svg viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true" focusable="false">
|
|
749
|
+
${r}
|
|
750
|
+
${t===null||e.kind===`picture-points`?S:x`<rect class="draft" x=${Math.min(t.x0,t.x1)} y=${Math.min(t.y0,t.y1)}
|
|
751
|
+
width=${Math.abs(t.x1-t.x0)} height=${Math.abs(t.y1-t.y0)}></rect>`}
|
|
752
|
+
</svg>
|
|
753
|
+
${i}
|
|
754
|
+
</div>`}#y(e){return e>B?g`<p class="note">${this.#i(`field.more`,{shown:B,count:e})}</p>`:S}#b(e,t,n){return g`<label>
|
|
755
|
+
${e}
|
|
756
|
+
<input
|
|
757
|
+
type="number"
|
|
758
|
+
min="0"
|
|
759
|
+
max="100"
|
|
760
|
+
step="0.1"
|
|
761
|
+
.value=${z(t)}
|
|
762
|
+
@change=${e=>{let t=e.target.value;t!==``&&Number.isFinite(Number(t))&&n(z(Number(t)))}}
|
|
763
|
+
/>
|
|
764
|
+
</label>`}#x(e,t,n){let r=e.kind===`picture-regions`;return g`<label>
|
|
765
|
+
${this.#i(r?`field.label.optional`:`field.label`)}
|
|
766
|
+
<input
|
|
767
|
+
type="text"
|
|
768
|
+
dir="auto"
|
|
769
|
+
.value=${n}
|
|
770
|
+
@change=${n=>{let i=n.target.value.trim();this.#a({kind:`child-attributes`,tag:e.tag,index:t,attributes:{label:i===``&&r?null:i}})}}
|
|
771
|
+
/>
|
|
772
|
+
</label>`}#S(e,t){let n=t.index+1,r=n=>this.#a({kind:`child-attributes`,tag:e.tag,index:t.index,attributes:n}),i=t.points,a=e=>r({points:e.map(([e,t])=>`${z(e)},${z(t)}`).join(` `)}),o=t.shape===`circle`?[this.#b(this.#i(`field.cx`),t.x,e=>r({x:e})),this.#b(this.#i(`field.cy`),t.y,e=>r({y:e})),this.#b(this.#i(`field.r`),t.r,e=>r({r:e}))]:t.shape===`rect`?[this.#b(this.#i(`field.x`),t.x,e=>r({x:e})),this.#b(this.#i(`field.y`),t.y,e=>r({y:e})),this.#b(this.#i(`field.width`),t.width,e=>r({width:e})),this.#b(this.#i(`field.height`),t.height,e=>r({height:e}))]:[];return g`<li data-index=${t.index}>
|
|
773
|
+
<fieldset>
|
|
774
|
+
<legend><span class="swatch ${V(t.index)}" aria-hidden="true">${n}</span>${this.#i(`field.region`,{n})}</legend>
|
|
775
|
+
${e.shapes.length>1?g`<label>
|
|
776
|
+
${this.#i(`field.shape`)}
|
|
777
|
+
<select
|
|
778
|
+
@change=${e=>r(Ar(t,e.target.value))}
|
|
779
|
+
>
|
|
780
|
+
${e.shapes.map(e=>g`<option value=${e} ?selected=${e===t.shape}>${this.#i(`field.shape.${e}`)}</option>`)}
|
|
781
|
+
</select>
|
|
782
|
+
</label>`:S}
|
|
783
|
+
${o.length>0?g`<div class="numbers">${o}</div>`:S}
|
|
784
|
+
${t.shape===`polygon`?g`<ol class="items">
|
|
785
|
+
${i.slice(0,B).map(([e,t],n)=>g`<li class="vertex">
|
|
786
|
+
${this.#b(this.#i(`field.vertex.x`,{n:n+1}),e,e=>a(i.map((t,r)=>r===n?[Number(e),t[1]]:t)))}
|
|
787
|
+
${this.#b(this.#i(`field.vertex.y`,{n:n+1}),t,e=>a(i.map((t,r)=>r===n?[t[0],Number(e)]:t)))}
|
|
788
|
+
<button
|
|
789
|
+
type="button"
|
|
790
|
+
?disabled=${i.length<=3}
|
|
791
|
+
@click=${()=>a(i.filter((e,t)=>t!==n))}
|
|
792
|
+
>
|
|
793
|
+
${this.#i(`field.vertex.remove`,{n:n+1})}
|
|
794
|
+
</button>
|
|
795
|
+
</li>`)}
|
|
796
|
+
</ol>
|
|
797
|
+
${this.#y(i.length)}
|
|
798
|
+
<button
|
|
799
|
+
type="button"
|
|
800
|
+
?disabled=${i.length>=B}
|
|
801
|
+
@click=${()=>{let[e,t]=i[i.length-1]??[50,50];a([...i,[R(e+5),R(t+5)]])}}
|
|
802
|
+
>
|
|
803
|
+
${this.#i(`field.vertex.add`)}
|
|
804
|
+
</button>`:S}
|
|
805
|
+
${this.#x(e,t.index,t.label)}
|
|
806
|
+
<button type="button" @click=${()=>this.#a({kind:`child-remove`,tag:e.tag,index:t.index})}>
|
|
807
|
+
${this.#i(`field.region.remove`,{n})}
|
|
808
|
+
</button>
|
|
809
|
+
</fieldset>
|
|
810
|
+
</li>`}#C(e,t){let n=t.index+1,r=n=>this.#a({kind:`child-attributes`,tag:e.tag,index:t.index,attributes:n});return g`<li data-index=${t.index}>
|
|
811
|
+
<fieldset>
|
|
812
|
+
<legend><span class="swatch ${V(t.index)}" aria-hidden="true">${n}</span>${this.#i(`field.point`,{n})}</legend>
|
|
813
|
+
<div class="numbers">
|
|
814
|
+
${this.#b(this.#i(`field.x`),t.x,e=>r({x:e}))}
|
|
815
|
+
${this.#b(this.#i(`field.y`),t.y,e=>r({y:e}))}
|
|
816
|
+
</div>
|
|
817
|
+
${this.#x(e,t.index,t.label)}
|
|
818
|
+
<button type="button" @click=${()=>this.#a({kind:`child-remove`,tag:e.tag,index:t.index})}>
|
|
819
|
+
${this.#i(`field.point.remove`,{n})}
|
|
820
|
+
</button>
|
|
821
|
+
</fieldset>
|
|
822
|
+
</li>`}render(){let e=this.field;if(e===null||this.authoring===null)return S;let t=e.kind===`picture-regions`,n=this.authoring.uploadAsset!==null,r=this.authoring.pickPicture!==null,i=this.#n,a=i===null?``:i.text??this.#i(i.key);return g`<fieldset data-tag=${e.tag}>
|
|
823
|
+
<legend>${e.label}</legend>
|
|
824
|
+
${e.help===null?S:g`<p class="note">${e.help}</p>`}
|
|
825
|
+
<label>
|
|
826
|
+
${this.#i(`field.picture.src`)}
|
|
827
|
+
<input
|
|
828
|
+
type="url"
|
|
829
|
+
autocomplete="off"
|
|
830
|
+
.value=${e.src}
|
|
831
|
+
@change=${t=>{let n=t.target.value.trim();this.#a({kind:`attribute`,name:e.srcAttribute,value:n===``?null:n})}}
|
|
832
|
+
/>
|
|
833
|
+
</label>
|
|
834
|
+
${n||r?g`<div class="upload">
|
|
835
|
+
<div class="sources">
|
|
836
|
+
${n?g`<button
|
|
837
|
+
type="button"
|
|
838
|
+
@click=${()=>this.renderRoot.querySelector(`input[type="file"]`)?.click()}
|
|
839
|
+
>
|
|
840
|
+
${this.#i(`picture.file`)}
|
|
841
|
+
</button>`:S}
|
|
842
|
+
${r?g`<button type="button" data-library @click=${()=>void this.#d(e)}>
|
|
843
|
+
${this.#i(`picture.library`)}
|
|
844
|
+
</button>`:S}
|
|
845
|
+
</div>
|
|
846
|
+
${n?g`<input
|
|
847
|
+
type="file"
|
|
848
|
+
accept="image/*"
|
|
849
|
+
hidden
|
|
850
|
+
@change=${t=>{let n=t.target,r=n.files?.[0];n.value=``,r!==void 0&&this.#u(e,r)}}
|
|
851
|
+
/>`:S}
|
|
852
|
+
<div role="status">${i!==null&&!i.error?g`<p class="note">${a}</p>`:S}</div>
|
|
853
|
+
<div role="alert">${i?.error?g`<p class="error">${a}</p>`:S}</div>
|
|
854
|
+
</div>`:g`<p class="note">${this.#i(`picture.urlOnly`)}</p>`}
|
|
855
|
+
${this.#v(e)}
|
|
856
|
+
<p class="note">${this.#i(t?`field.regions.draw`:`field.points.place`)}</p>
|
|
857
|
+
<ol class="items">
|
|
858
|
+
${t?e.regions.slice(0,B).map(t=>this.#S(e,t)):e.points.slice(0,B).map(t=>this.#C(e,t))}
|
|
859
|
+
</ol>
|
|
860
|
+
${this.#y(t?e.regions.length:e.points.length)}
|
|
861
|
+
<button type="button" data-add @click=${()=>this.#c(e)}>
|
|
862
|
+
${this.#i(t?`field.region.add`:`field.point.add`)}
|
|
863
|
+
</button>
|
|
864
|
+
</fieldset>`}},Pr=new WeakSet,Fr=class extends j{static properties={...j.properties,policy:{attribute:!1}};static styles=[A,Un,M(`astl-player`),_`
|
|
865
|
+
.bar {
|
|
866
|
+
display: flex;
|
|
867
|
+
flex-wrap: wrap;
|
|
868
|
+
align-items: center;
|
|
869
|
+
justify-content: space-between;
|
|
870
|
+
gap: var(--astl-space-2) var(--astl-space-3);
|
|
871
|
+
}
|
|
872
|
+
astl-player {
|
|
873
|
+
border-radius: var(--astl-radius-m);
|
|
874
|
+
overflow: hidden;
|
|
875
|
+
}
|
|
876
|
+
astl-player[hidden] {
|
|
877
|
+
display: none;
|
|
878
|
+
}
|
|
879
|
+
`];#e=`idle`;#t=[];#n=``;#r=!1;#i=0;constructor(){super(),this.policy=v}createRenderRoot(){let e=super.createRenderRoot();for(let t of Object.values(Ye))e.addEventListener(t,e=>e.stopPropagation());return e}get state(){return this.#e}get player(){return this.renderRoot?.querySelector(`astl-player`)??null}async refresh(){let{authoring:e,adapter:t}=this;if(e===null||t===null)return;let n=++this.#i;this.#r=!1;try{Pr.has(e)||(rt({elements:e.elements,styleTemplates:e.styleTemplates,...e.urlPolicy===it?{}:{urlPolicy:e.urlPolicy}}),Pr.add(e)),this.#a(`loading`);let r=t.getSource(),{policy:i}=this,a=await e.preview(r,{policy:i});if(n!==this.#i)return;if(!a.ok){this.#t=a.issues.filter(e=>e.severity===`error`),this.#n=r,this.#a(`invalid`),await this.updateComplete;return}await this.updateComplete;let o=this.player;if(o===null)throw Error(`astl-player is not rendered`);await o.load({view:a.view,checker:a.checker,policy:i,snapshot:null}),n===this.#i&&this.#a(`ready`)}catch{n===this.#i&&this.#a(`failed`)}await this.updateComplete}#a(e){this.#e=e,this.requestUpdate()}updated(e){super.updated(e),e.has(`policy`)&&e.get(`policy`)!==void 0&&this.#e!==`idle`&&this.refresh()}sourceChanged(){this.#e===`idle`||this.#r||(this.#r=!0,this.requestUpdate())}selectionChanged(){}render(){let{authoring:e,adapter:t}=this;if(e===null)return S;let n=this.#e,{lang:r,dir:i}=this.ui,a=S;n===`idle`?a=g`<p class="note">${this.t(`preview.hint`)}</p>`:n===`loading`?a=g`<p class="note">${this.t(`preview.loading`)}</p>`:n===`failed`?a=g`<p class="note">${this.t(`preview.failed`)}</p>`:n===`invalid`&&(a=g`<p class="note">${this.t(`preview.invalid`,{count:this.#t.length})}</p>
|
|
880
|
+
${Wn(this.#t,e,t,this.#n)}`);let o=this.getAttribute(`data-theme`)??`light`;return g`<section class="kit" part="root" lang=${r} dir=${i} aria-labelledby="title">
|
|
881
|
+
<div class="bar">
|
|
882
|
+
<h2 class="title" id="title" part="title">${this.t(`preview.title`)}</h2>
|
|
883
|
+
<button type="button" class="primary" part="button" ?disabled=${t===null} @click=${()=>this.refresh()}>
|
|
884
|
+
${this.t(n===`idle`?`preview.show`:`preview.refresh`)}
|
|
885
|
+
</button>
|
|
886
|
+
</div>
|
|
887
|
+
<div role="status">${this.#r?g`<p class="note">${this.t(`preview.stale`)}</p>`:S}</div>
|
|
888
|
+
${a}
|
|
889
|
+
${n===`idle`?S:g`<astl-player part="player" locale=${e.locale} theme=${o} ?hidden=${n!==`ready`}></astl-player>`}
|
|
890
|
+
</section>`}},H={bold:x`<path d="M6 4h5a3 3 0 0 1 0 6H6zm0 6h6a3 3 0 0 1 0 6H6z" stroke-width="2"/>`,italic:x`<path d="M9 4h7M4 16h7M12.5 4l-5 12"/>`,underline:x`<path d="M6 3v6a4 4 0 0 0 8 0V3M5 17h10"/>`,link:x`<path d="M8.5 11.5l3-3M7.5 9.5l-2 2a2.8 2.8 0 0 0 4 4l2-2M12.5 10.5l2-2a2.8 2.8 0 0 0-4-4l-2 2"/>`,bulleted:x`<path d="M8 5h9M8 10h9M8 15h9"/><circle cx="4" cy="5" r="1.3"/><circle cx="4" cy="10" r="1.3"/><circle cx="4" cy="15" r="1.3"/>`,numbered:x`<path d="M9 5h8M9 10h8M9 15h8M3 3.5h1.5V8M2.5 12.2c.4-.8 2.5-.9 2.5.4 0 1-2.5 2-2.5 3.4H5" stroke-width="1.5"/>`,undo:x`<path d="M7.5 5L4 8.5 7.5 12M4 8.5h8a4 4 0 0 1 0 8H9"/>`,redo:x`<path d="M12.5 5L16 8.5 12.5 12M16 8.5H8a4 4 0 0 0 0 8h3"/>`,text:x`<path d="M4 5V4h12v1M10 4v12M7.5 16h5"/>`,add:x`<path d="M10 4v12M4 10h12"/>`,layouts:D.columns,templates:x`<rect x="3" y="3" width="14" height="14" rx="1.5"/><path d="M3 8h14M8 8v9"/>`,wrap:x`<path d="M3 6h14M3 10h6M11 10h6M3 14h14" stroke-width="1.6"/><rect x="8" y="8" width="4" height="4" rx="1" stroke-width="1.4"/>`,chevron:x`<path d="M6 8l4 4 4-4"/>`,color:x`<path d="M5.5 13L10 3l4.5 10M7 10h6" stroke-width="1.8"/>`,highlight:x`<path d="M12.5 3.5l4 4-7.5 7.5H5v-4zM3.5 16.5h6" stroke-width="1.6"/>`,"align-start":x`<path d="M3.5 5h13M3.5 9h8M3.5 13h13M3.5 17h8"/>`,"align-center":x`<path d="M3.5 5h13M6 9h8M3.5 13h13M6 17h8"/>`,"align-end":x`<path d="M3.5 5h13M8.5 9h8M3.5 13h13M8.5 17h8"/>`,"align-justify":x`<path d="M3.5 5h13M3.5 9h13M3.5 13h13M3.5 17h13"/>`,spacing:x`<path d="M9 5h8M9 10h8M9 15h8M4.5 4v12M2.5 6l2-2 2 2M2.5 14l2 2 2-2"/>`,clear:x`<path d="M5 5V4h10v1M10 4l-1.5 7M4 16h7M13 11.5l4 4M17 11.5l-4 4"/>`},U=[`paragraph`,`heading`,`subheading`],Ir={elements:[`components`,`content`],templates:[`exercises`],layouts:[`layouts`]},Lr=new Set(Object.keys(Ir)),Rr=[`bold`,`italic`,`underline`],zr=[`bulleted`,`numbered`],W=new Set([`font`,`size`,`color`,`highlight`,`align`,`spacing`]),Br=e=>Lr.has(e),G=e=>Br(e)?`insert`:e,K=e=>e===`panel`?`style`:e,Vr=`astl-toolbar-view`,Hr={active:[],enabled:[],href:null,undo:!1,redo:!1},Ur=_`
|
|
891
|
+
:host {
|
|
892
|
+
display: block;
|
|
893
|
+
container-type: inline-size;
|
|
894
|
+
}
|
|
895
|
+
.bar {
|
|
896
|
+
box-sizing: border-box;
|
|
897
|
+
display: flex;
|
|
898
|
+
flex-wrap: wrap;
|
|
899
|
+
align-items: center;
|
|
900
|
+
gap: var(--astl-space-1) calc(2 * var(--astl-space-2) + var(--astl-outline-width));
|
|
901
|
+
padding: var(--astl-space-2);
|
|
902
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
903
|
+
border-radius: var(--astl-radius-l);
|
|
904
|
+
background: var(--astl-surface);
|
|
905
|
+
}
|
|
906
|
+
.group {
|
|
907
|
+
display: flex;
|
|
908
|
+
flex-wrap: wrap;
|
|
909
|
+
align-items: center;
|
|
910
|
+
gap: var(--astl-space-1);
|
|
911
|
+
}
|
|
912
|
+
.group + .group {
|
|
913
|
+
position: relative;
|
|
914
|
+
margin-inline-start: calc(-1 * var(--astl-space-2) - var(--astl-outline-width));
|
|
915
|
+
padding-inline-start: calc(var(--astl-space-2) + var(--astl-outline-width));
|
|
916
|
+
}
|
|
917
|
+
.separator {
|
|
918
|
+
position: absolute;
|
|
919
|
+
inset-block: 0;
|
|
920
|
+
inset-inline-start: 0;
|
|
921
|
+
border-inline-start: var(--astl-outline-width) solid var(--astl-line);
|
|
922
|
+
}
|
|
923
|
+
.group.history {
|
|
924
|
+
margin-inline-start: auto;
|
|
925
|
+
}
|
|
926
|
+
@container (inline-size < 30rem) {
|
|
927
|
+
.bar {
|
|
928
|
+
flex-wrap: nowrap;
|
|
929
|
+
overflow-x: auto;
|
|
930
|
+
scrollbar-width: thin;
|
|
931
|
+
background:
|
|
932
|
+
linear-gradient(90deg, var(--astl-surface) 50%, #0000) left / 1.5rem no-repeat local,
|
|
933
|
+
linear-gradient(-90deg, var(--astl-surface) 50%, #0000) right / 1.5rem no-repeat local,
|
|
934
|
+
radial-gradient(farthest-side at 0, var(--astl-outline), #0000) left / 0.5rem no-repeat,
|
|
935
|
+
radial-gradient(farthest-side at 100%, var(--astl-outline), #0000) right / 0.5rem no-repeat,
|
|
936
|
+
var(--astl-surface);
|
|
937
|
+
}
|
|
938
|
+
.group {
|
|
939
|
+
flex: none;
|
|
940
|
+
flex-wrap: nowrap;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
`,Wr=_`
|
|
944
|
+
.bar button {
|
|
945
|
+
justify-content: center;
|
|
946
|
+
padding-inline: var(--astl-space-2);
|
|
947
|
+
border-color: transparent;
|
|
948
|
+
background: transparent;
|
|
949
|
+
white-space: nowrap;
|
|
950
|
+
}
|
|
951
|
+
.bar button.labelled {
|
|
952
|
+
padding-inline: var(--astl-space-2) var(--astl-space-3);
|
|
953
|
+
}
|
|
954
|
+
.bar button:hover {
|
|
955
|
+
border-color: var(--astl-line);
|
|
956
|
+
background: var(--astl-accent-soft);
|
|
957
|
+
}
|
|
958
|
+
.bar button[aria-pressed='true'] {
|
|
959
|
+
border-color: var(--astl-accent);
|
|
960
|
+
background: var(--astl-accent-soft);
|
|
961
|
+
color: var(--astl-ink);
|
|
962
|
+
}
|
|
963
|
+
.group.views {
|
|
964
|
+
gap: 0;
|
|
965
|
+
padding: calc(2 * var(--astl-outline-width));
|
|
966
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
967
|
+
border-radius: var(--astl-radius-m);
|
|
968
|
+
}
|
|
969
|
+
.bar .views [aria-checked='true'] {
|
|
970
|
+
background: var(--astl-accent);
|
|
971
|
+
color: var(--astl-on-accent);
|
|
972
|
+
font-weight: 600;
|
|
973
|
+
}
|
|
974
|
+
`,Gr=_`
|
|
975
|
+
.bar button[aria-disabled='true'] {
|
|
976
|
+
border-color: var(--astl-line);
|
|
977
|
+
border-style: dashed;
|
|
978
|
+
background: transparent;
|
|
979
|
+
color: var(--astl-ink-muted);
|
|
980
|
+
cursor: not-allowed;
|
|
981
|
+
}
|
|
982
|
+
.bar button[aria-expanded='true'] {
|
|
983
|
+
border-color: var(--astl-outline);
|
|
984
|
+
}
|
|
985
|
+
.icon {
|
|
986
|
+
fill: none;
|
|
987
|
+
stroke: currentColor;
|
|
988
|
+
stroke-width: 1.8;
|
|
989
|
+
stroke-linecap: round;
|
|
990
|
+
stroke-linejoin: round;
|
|
991
|
+
}
|
|
992
|
+
.icon circle {
|
|
993
|
+
fill: currentColor;
|
|
994
|
+
stroke: none;
|
|
995
|
+
}
|
|
996
|
+
.chevron {
|
|
997
|
+
inline-size: 1rem;
|
|
998
|
+
block-size: 1rem;
|
|
999
|
+
}
|
|
1000
|
+
[popover] {
|
|
1001
|
+
box-sizing: border-box;
|
|
1002
|
+
position: fixed;
|
|
1003
|
+
inset: auto;
|
|
1004
|
+
margin: 0;
|
|
1005
|
+
padding: var(--astl-space-2);
|
|
1006
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
1007
|
+
border-radius: var(--astl-radius-m);
|
|
1008
|
+
background: var(--astl-surface);
|
|
1009
|
+
color: var(--astl-ink);
|
|
1010
|
+
box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.2);
|
|
1011
|
+
overflow: auto;
|
|
1012
|
+
}
|
|
1013
|
+
[popover]:not(:popover-open) {
|
|
1014
|
+
display: none;
|
|
1015
|
+
}
|
|
1016
|
+
.menu {
|
|
1017
|
+
display: flex;
|
|
1018
|
+
flex-direction: column;
|
|
1019
|
+
gap: 2px;
|
|
1020
|
+
min-inline-size: 12rem;
|
|
1021
|
+
max-block-size: calc(100dvh - 2 * var(--astl-space-4));
|
|
1022
|
+
}
|
|
1023
|
+
.menu button {
|
|
1024
|
+
justify-content: flex-start;
|
|
1025
|
+
padding: var(--astl-space-1) var(--astl-space-2);
|
|
1026
|
+
border-color: transparent;
|
|
1027
|
+
}
|
|
1028
|
+
.menu button[aria-checked='true'] {
|
|
1029
|
+
border-color: var(--astl-accent);
|
|
1030
|
+
background: var(--astl-accent-soft);
|
|
1031
|
+
font-weight: 600;
|
|
1032
|
+
}
|
|
1033
|
+
.insert {
|
|
1034
|
+
inline-size: min(26rem, calc(100vw - 2 * var(--astl-space-4)));
|
|
1035
|
+
max-block-size: min(32rem, calc(100vh - 2 * var(--astl-space-4)));
|
|
1036
|
+
padding: 0;
|
|
1037
|
+
}
|
|
1038
|
+
.insert .search {
|
|
1039
|
+
position: sticky;
|
|
1040
|
+
inset-block-start: 0;
|
|
1041
|
+
z-index: 1;
|
|
1042
|
+
padding: var(--astl-space-2);
|
|
1043
|
+
border-block-end: var(--astl-outline-width) solid var(--astl-line);
|
|
1044
|
+
background: var(--astl-surface);
|
|
1045
|
+
}
|
|
1046
|
+
.insert astl-insert-menu::part(root) {
|
|
1047
|
+
padding: var(--astl-space-2);
|
|
1048
|
+
border: 0;
|
|
1049
|
+
border-radius: 0;
|
|
1050
|
+
}
|
|
1051
|
+
.insert astl-insert-menu::part(title) {
|
|
1052
|
+
display: none;
|
|
1053
|
+
}
|
|
1054
|
+
.insert astl-insert-menu::part(button) {
|
|
1055
|
+
padding-inline: var(--astl-space-2);
|
|
1056
|
+
}
|
|
1057
|
+
.insert astl-insert-menu::part(button):enabled {
|
|
1058
|
+
border-color: transparent;
|
|
1059
|
+
}
|
|
1060
|
+
.link {
|
|
1061
|
+
display: flex;
|
|
1062
|
+
flex-direction: column;
|
|
1063
|
+
inline-size: min(22rem, calc(100vw - 2 * var(--astl-space-4)));
|
|
1064
|
+
}
|
|
1065
|
+
.menu .menu-section {
|
|
1066
|
+
display: contents;
|
|
1067
|
+
}
|
|
1068
|
+
.menu .menu-group {
|
|
1069
|
+
margin-block: var(--astl-space-2) 0;
|
|
1070
|
+
padding-inline: var(--astl-space-2);
|
|
1071
|
+
color: var(--astl-ink-muted);
|
|
1072
|
+
font-size: var(--astl-size-small);
|
|
1073
|
+
font-weight: 600;
|
|
1074
|
+
}
|
|
1075
|
+
.menu hr {
|
|
1076
|
+
inline-size: 100%;
|
|
1077
|
+
margin-block: var(--astl-space-1);
|
|
1078
|
+
border: 0;
|
|
1079
|
+
border-block-start: var(--astl-outline-width) solid var(--astl-line);
|
|
1080
|
+
}
|
|
1081
|
+
.bar button .value {
|
|
1082
|
+
max-inline-size: 8rem;
|
|
1083
|
+
overflow: hidden;
|
|
1084
|
+
text-overflow: ellipsis;
|
|
1085
|
+
}
|
|
1086
|
+
.color-mark {
|
|
1087
|
+
position: absolute;
|
|
1088
|
+
inset-inline: 25%;
|
|
1089
|
+
inset-block-end: var(--astl-space-1);
|
|
1090
|
+
block-size: 0.2rem;
|
|
1091
|
+
border: var(--astl-outline-width) solid var(--astl-outline);
|
|
1092
|
+
forced-color-adjust: none;
|
|
1093
|
+
}
|
|
1094
|
+
.bar button[data-popup='color'],
|
|
1095
|
+
.bar button[data-popup='highlight'] {
|
|
1096
|
+
position: relative;
|
|
1097
|
+
}
|
|
1098
|
+
.link > * + * {
|
|
1099
|
+
margin-block-start: var(--astl-space-2);
|
|
1100
|
+
}
|
|
1101
|
+
.link > [role='alert']:empty {
|
|
1102
|
+
margin-block-start: 0;
|
|
1103
|
+
}
|
|
1104
|
+
.link label {
|
|
1105
|
+
font-weight: 600;
|
|
1106
|
+
}
|
|
1107
|
+
.link .buttons {
|
|
1108
|
+
display: flex;
|
|
1109
|
+
flex-wrap: wrap;
|
|
1110
|
+
gap: var(--astl-space-2);
|
|
1111
|
+
}
|
|
1112
|
+
.link .error {
|
|
1113
|
+
margin: 0;
|
|
1114
|
+
padding: var(--astl-space-2);
|
|
1115
|
+
border-inline-start: var(--astl-space-1) solid var(--astl-danger);
|
|
1116
|
+
background: var(--astl-danger-soft);
|
|
1117
|
+
}
|
|
1118
|
+
@media (forced-colors: active) {
|
|
1119
|
+
.bar button:is([aria-pressed='true'], [aria-checked='true']) {
|
|
1120
|
+
border-color: Highlight;
|
|
1121
|
+
}
|
|
1122
|
+
.bar button[aria-disabled='true'] {
|
|
1123
|
+
color: GrayText;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
`,Kr=class extends j{static properties={...j.properties,featured:{attribute:!1},views:{attribute:!1},view:{}};static styles=[A,M(`astl-insert-menu, astl-picture-dialog, astl-style-form, astl-style-rules`),Ur,Wr,Gr];#e=Hr;#t=null;#n=null;#r=null;#i=`block`;#a=!1;#o=`elements`;#s=``;#c=!1;#l=null;#u=[];#d=new Kn(this,{count:()=>this.#u.length,item:e=>this.renderRoot.querySelector(`.bar [data-item="${e}"]`),axis:`inline`});constructor(){super(),this.featured=[],this.views=[],this.view=``}get menu(){return this.renderRoot.querySelector(`astl-insert-menu`)}async openMenu(e){await this.#g(e)}async openStyle(e){let t={target:e};this.#_(!1);let n=new CustomEvent(E,{detail:t,bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(n)&&(await O(),this.#i=e,await this.#g(`panel`))}async#f(){if(this.#r!==null)return!0;try{let e=await import(`./chunks/style-popups-BobgX1WK.js`),t=this.renderRoot,n=e.stylePopupStyles.styleSheet;return this.#r===null&&n!==void 0&&(t.adoptedStyleSheets=[...t.adoptedStyleSheets,n]),this.#r=e,!0}catch(e){return console.error(e),!1}}connectedCallback(){super.connectedCallback(),this.#p(),document.addEventListener(`pointerdown`,this.#m,!0),document.addEventListener(`keydown`,this.#h)}disconnectedCallback(){super.disconnectedCallback(),this.#p(),document.removeEventListener(`pointerdown`,this.#m,!0),document.removeEventListener(`keydown`,this.#h)}willUpdate(e){super.willUpdate(e),e.has(`adapter`)&&this.#p(),this.#e=this.adapter?.formatState?.()??Hr,this.#t=this.adapter?.style?.state()??null}#p(){let e=this.isConnected?this.adapter:null;if((this.#l?.adapter??null)===e)return;this.#l?.off(),this.#l=null;let t=e?.onCursorChange;e!==null&&t!==void 0&&(this.#l={adapter:e,off:t.call(e,()=>this.requestUpdate())})}#m=e=>{if(this.#n===null)return;let t=e.composedPath(),n=this.renderRoot.querySelector(`#${G(this.#n)}`),r=this.renderRoot.querySelector(`[data-popup="${K(this.#n)}"]`);n!==null&&t.includes(n)||r!==null&&t.includes(r)||t.some(e=>e instanceof Element&&e.localName===`astl-picture-dialog`)||this.#_(!1)};#h=e=>{if(this.#n!==`panel`||e.key!==`Escape`)return;let t=this.renderRoot.querySelector(`#panel`),n=t!==null&&e.composedPath().includes(t);n&&e.defaultPrevented||(e.preventDefault(),this.#_(n))};async#g(e){if((e===`panel`||W.has(e))&&!await this.#f())return;this.#n!==null&&this.#n!==e&&this.#_(!1),this.#n=e,this.#c=!1,this.#a=!1,Br(e)&&(this.#s=``,this.#o=e),this.requestUpdate(),await this.updateComplete;let t=this.renderRoot.querySelector(`#${G(e)}`),n=this.renderRoot.querySelector(`[data-popup="${K(e)}"]`);t!==null&&n!==null&&(t.matches(`:popover-open`)||t.showPopover(),this.menu?.requestUpdate(),this.#v(t,n),(e===`style`||W.has(e)?t.querySelector(`[aria-checked="true"], [aria-pressed="true"]`)??t.querySelector(`button`):e===`panel`?t:t.querySelector(`input`))?.focus())}#_(e){let t=this.#n;if(t===null)return;this.#n=null;let n=this.renderRoot.querySelector(`#${G(t)}`);n?.matches(`:popover-open`)===!0&&n.hidePopover(),e&&this.renderRoot.querySelector(`[data-popup="${K(t)}"]`)?.focus(),this.requestUpdate()}#v(e,t){let n=t.getBoundingClientRect(),r=getComputedStyle(t).direction===`rtl`,i=e.offsetWidth,a=document.documentElement.clientWidth,o=r?a-n.right:n.left,s=Math.max(8,Math.min(o,a-i-8));e.style.setProperty(`inset-inline-start`,`${s}px`);let c=document.documentElement.clientHeight-e.offsetHeight-8;e.style.setProperty(`inset-block-start`,`${Math.max(8,Math.min(n.bottom+4,c))}px`)}#y(){this.adapter?.focus?.()}#b(e,t){this.#e.enabled.includes(e)&&(this.adapter?.format?.(e,t),this.#y(),this.requestUpdate())}#x(e){this.adapter?.style?.setText(e),this.#_(!1),this.#y(),this.requestUpdate()}#S(e){this.adapter?.style?.setTarget(`block`,e),this.#_(!1),this.#y(),this.requestUpdate()}#C(e=!1){let t=this.#t;return t===null?null:t.hasSelection&&!e?`text`:t.targets[0]?.kind??null}#w(e=!1){let t=this.#C(e);return t===`text`?this.#t?.textClass??null:this.#t?.targets.find(e=>e.kind===t)?.className??null}#T(e){return this.authoring?.styles.some(t=>t.name===e&&t.text!==!0)??!1}#E(e,t){let n=this.#T(e),r=this.#C(n);r!==null&&(t===void 0?this.adapter?.style?.setClass(r,this.#w(n)===e?null:e):this.adapter?.style?.setClass(r,e,t)),this.#_(!1),this.#y(),this.requestUpdate()}#D(){let e=this.#t?.text[`font-family`];return e===void 0?``:this.authoring?.fonts.find(t=>t.stack===e)?.name??(e.split(`,`)[0]??``).replace(/"/g,``).trim()}#O(){let e=this.#t;if(e===null)return{fonts:[],colors:[],blocks:[],clear:[]};let{text:t,textEnabled:n,targets:r}=e,i=r.some(e=>e.kind===`block`),a=(e,t,n,r,i)=>({id:e,label:t,text:null,icon:r,iconName:i,disabled:!n,popup:e,press:()=>{this.#n===e?this.#_(!0):this.#g(e)}}),o=this.#D(),s=/^(\d+(?:\.\d+)?)px$/.exec(t[`font-size`]??``)?.[1]??t[`font-size`]??``,c=(e,t,r)=>({...a(e,this.t(t,{value:r===``?this.t(`toolbar.default`):r}),n,H.chevron,`chevron`),text:r===``?this.t(`toolbar.${e}.name`):r,menu:!0}),l=r.find(e=>e.kind===`block`)?.style??``,u=Ln(l).get(`text-align`),d=u===`right`||u===`end`?`align-end`:u===`center`?`align-center`:u===`justify`?`align-justify`:`align-start`;return{fonts:[c(`font`,`toolbar.font`,o),c(`size`,`toolbar.size`,s)],colors:[{...a(`color`,this.t(`toolbar.color`),n,H.color,`color`),bar:t.color??null},{...a(`highlight`,this.t(`toolbar.highlight`),n,H.highlight,`highlight`),bar:t[`background-color`]??null}],blocks:[a(`align`,this.t(`toolbar.align`),i,H[d],d),a(`spacing`,this.t(`toolbar.spacing`),i,H.spacing,`spacing`)],clear:[{id:`clear`,label:this.t(`toolbar.clear`),text:null,icon:H.clear,iconName:`clear`,disabled:!n&&!i,press:()=>{this.adapter?.style?.clear(),this.#y(),this.requestUpdate()}}]}}async#k(e){let t=this.menu,n=this.adapter;if(t!==null&&n!==null){if(e===`text`)n.insert(`<p></p>`),this.#y();else{if(e===`picture`)await t.insertPicture();else if(e===`page-break`)t.insertPageBreak();else{let[n=``,r]=e.split(`:`);await t.add(n,r)}this.#y()}}}#A(){let e=this.authoring;if(e===null)return[];let t=this.adapter===null,n=[];for(let r of this.featured){if(r===`text`||r===`picture`){let e=this.t(r===`text`?`insert.text`:`insert.picture`);n.push({id:`insert-${r}`,label:e,text:e,icon:r===`text`?H.text:D.picture,iconName:r===`text`?`text`:`image`,disabled:t,data:{content:r},press:()=>void this.#k(r)});continue}if(r===`page-break`){if(this.adapter?.splitPage===void 0)continue;let e=this.t(`insert.pageBreak`);n.push({id:`insert-page-break`,label:e,text:e,icon:D.page,iconName:`files`,data:{content:r},press:()=>void this.#k(r)});continue}let[i=``,a]=r.split(`:`),o=e.descriptor(i);if(o===null)continue;let s=a===void 0?null:e.templates(i).find(e=>e.id===a);if(s===void 0)continue;let c=e.t(o.manifest.messages,s?.label??o.label),l=s?.icon??o.icon;n.push({id:`insert-${r}`,label:c,text:c,icon:Mn.get(l)??D[o.manifest.display],iconName:l,disabled:t,data:a===void 0?{tag:i}:{tag:i,template:a},press:()=>void this.#k(r)})}return n}#j(){let e=this.adapter,t=this.authoring,n=this.#e,r=[],i=(e,t)=>({id:e,label:this.t(`toolbar.${e}`),text:null,icon:H[e],iconName:e,pressed:n.active.includes(e),disabled:!n.enabled.includes(e),...t===void 0?{}:{popup:t},press:()=>{t===void 0?this.#b(e):this.#g(t)}});if(e?.format!==void 0&&e.formatState!==void 0){let t=U.find(e=>n.active.includes(e)),a=this.#w(),o=a===null?void 0:e.style?.rules().find(e=>e.name===a),s=o?.label??o?.name??this.t(`toolbar.${t??`paragraph`}`),c=this.#O();r.push([`group`,[{id:`style`,label:this.t(`toolbar.style`,{style:s}),text:s,icon:H.chevron,iconName:`chevron`,menu:!0,disabled:!U.some(e=>n.enabled.includes(e))&&(this.#t?.targets.length??0)===0,popup:`style`,press:()=>void this.#g(`style`)}]]),c.fonts.length>0&&r.push([`group`,c.fonts]),r.push([`group`,[...Rr.map(e=>i(e)),i(`link`,`link`)]]),c.colors.length>0&&r.push([`group`,c.colors]),c.blocks.length>0&&r.push([`group`,c.blocks]),r.push([`group`,[...zr.map(e=>i(e)),...c.clear]])}let a=(t,n)=>({id:t,label:this.t(`toolbar.${t}`),text:this.t(`toolbar.${t}`),icon:H[n],iconName:n,disabled:e===null,popup:t,press:()=>{this.#n===t?this.#_(!0):this.#g(t)}}),o=t?.descriptors.some(e=>(e.templates??[]).length>0)===!0;if(r.push([`group inserts`,[...this.#A(),a(`elements`,`add`),...o?[a(`templates`,`templates`)]:[],...e?.style===void 0?[]:[a(`layouts`,`layouts`)]]]),e?.wrap!==void 0&&t!==null){let e=t.descriptors.filter(e=>e.wrap!==void 0);e.length>0&&r.push([`group`,e.map(e=>{let n=t.t(e.manifest.messages,e.wrap?.label??``);return{id:`wrap-${e.manifest.tag}`,label:n,text:n,icon:H.wrap,iconName:`wrap`,data:{wrap:e.manifest.tag},press:()=>{this.adapter?.wrap?.(e.manifest.tag),this.#y()}}})])}if(this.views.length>0&&r.push([`group views`,this.views.map(e=>({id:`view-${e.name}`,label:e.label,text:e.label,icon:null,iconName:``,checked:e.name===this.view,press:()=>{if(e.name===this.view)return;let t={view:e.name};this.dispatchEvent(new CustomEvent(Vr,{detail:t,bubbles:!0,composed:!0}))}}))]),e?.undo!==void 0&&e.redo!==void 0){let t=t=>({id:t,label:this.t(`toolbar.${t}`),text:null,icon:H[t],iconName:t,disabled:!n[t],press:()=>{n[t]&&(e[t]?.(),this.#y())}});r.push([`group history`,[t(`undo`),t(`redo`)]])}return r}#M(e){let t=e.target.closest(`[data-item]`);if(t===null)return;let n=Number(t.dataset.item),r=this.#u[n];(r?.popup===`style`||W.has(r?.popup??``))&&(e.key===`ArrowDown`||e.key===`ArrowUp`)?(e.preventDefault(),r?.disabled!==!0&&r?.popup!==void 0&&this.#g(r.popup)):this.#d.keydown(e,n)}#N(e,t){let n=e.disabled===!0,r=e.checked===void 0?e.text===null?`button icon-button`:`button`:`button view`;return g`<button
|
|
1127
|
+
type="button"
|
|
1128
|
+
part=${r}
|
|
1129
|
+
class=${e.text===null?`icon-only`:`labelled`}
|
|
1130
|
+
data-item=${t}
|
|
1131
|
+
data-id=${e.id}
|
|
1132
|
+
data-tag=${e.data?.tag??S}
|
|
1133
|
+
data-template=${e.data?.template??S}
|
|
1134
|
+
data-content=${e.data?.content??S}
|
|
1135
|
+
data-popup=${e.popup??S}
|
|
1136
|
+
tabindex=${this.#d.tabIndex(t)}
|
|
1137
|
+
aria-label=${e.text===null||e.menu===!0?e.label:S}
|
|
1138
|
+
title=${e.text===null?e.label:S}
|
|
1139
|
+
aria-pressed=${e.pressed===void 0?S:String(e.pressed)}
|
|
1140
|
+
role=${e.checked===void 0?S:`radio`}
|
|
1141
|
+
aria-checked=${e.checked===void 0?S:String(e.checked)}
|
|
1142
|
+
aria-disabled=${n?`true`:S}
|
|
1143
|
+
aria-haspopup=${e.popup===void 0?S:e.popup===`style`||e.menu===!0||e.popup===`align`||e.popup===`spacing`?`menu`:`dialog`}
|
|
1144
|
+
aria-expanded=${e.popup===void 0?S:String(this.#n===e.popup)}
|
|
1145
|
+
aria-controls=${e.popup===void 0?S:G(e.popup)}
|
|
1146
|
+
@click=${()=>{this.#d.focus(t),n||e.press()}}
|
|
1147
|
+
>
|
|
1148
|
+
${e.menu===!0?g`<span class="value">${e.text}</span>
|
|
1149
|
+
<svg class="icon chevron" part="icon icon-chevron" viewBox="0 0 20 20" aria-hidden="true" focusable="false">${e.icon}</svg>`:g`${e.icon===null?S:g`<svg class="icon" part="icon icon-${e.iconName}" data-icon=${e.iconName} viewBox="0 0 20 20" aria-hidden="true" focusable="false">${e.icon}</svg>`}
|
|
1150
|
+
${e.text===null?S:g`<span>${e.text}</span>`}${e.bar===void 0||e.bar===null?S:g`<span class="color-mark" data-color=${e.bar}></span>`}`}
|
|
1151
|
+
</button>`}#P=e=>{let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.indexOf(e.target),r=e.key===`ArrowDown`?1:e.key===`ArrowUp`?-1:0;r===0?e.key===`Home`||e.key===`End`?(e.preventDefault(),t[e.key===`Home`?0:t.length-1]?.focus()):e.key===`Escape`?(e.preventDefault(),this.#_(!0)):e.key===`Tab`&&this.#_(!1):(e.preventDefault(),t[(n+r+t.length)%t.length]?.focus())};#F(){let e=this.#t;if(e===null)return S;let t=this.adapter?.style?.rules().filter(e=>e.name!==void 0)??[],n=new Set(t.map(e=>e.name)),r=(this.authoring?.styles??[]).filter(e=>!n.has(e.name)),i=e.targets,a=(e,t)=>g`<hr />
|
|
1152
|
+
<div class="menu-section" role="group" aria-label=${e}>
|
|
1153
|
+
<div class="menu-group" aria-hidden="true">${e}</div>
|
|
1154
|
+
${t}
|
|
1155
|
+
</div>`;return g`${t.length===0?S:a(this.t(`toolbar.myStyles`),t.map(e=>{let t=e.name??``,n=this.#T(t),r=this.#C(n)===null;return g`<button
|
|
1156
|
+
type="button"
|
|
1157
|
+
role="menuitemradio"
|
|
1158
|
+
tabindex="-1"
|
|
1159
|
+
data-named=${t}
|
|
1160
|
+
aria-checked=${String(this.#w(n)===t)}
|
|
1161
|
+
aria-disabled=${r?`true`:S}
|
|
1162
|
+
@click=${()=>{r||this.#E(t)}}
|
|
1163
|
+
>
|
|
1164
|
+
${e.label??t}
|
|
1165
|
+
</button>`}))}
|
|
1166
|
+
${r.length===0?S:a(this.t(`toolbar.readyStyles`),r.map(({name:e,label:t,style:n,text:r})=>{let i=this.#C(r!==!0)===null;return g`<button
|
|
1167
|
+
type="button"
|
|
1168
|
+
role="menuitem"
|
|
1169
|
+
tabindex="-1"
|
|
1170
|
+
data-ready=${e}
|
|
1171
|
+
aria-disabled=${i?`true`:S}
|
|
1172
|
+
@click=${()=>{i||this.#E(e,{name:e,label:t,style:n})}}
|
|
1173
|
+
>
|
|
1174
|
+
${t}
|
|
1175
|
+
</button>`}))}
|
|
1176
|
+
<hr />
|
|
1177
|
+
${i.map(e=>g`<button
|
|
1178
|
+
type="button"
|
|
1179
|
+
role="menuitem"
|
|
1180
|
+
tabindex="-1"
|
|
1181
|
+
data-style-target=${e.kind}
|
|
1182
|
+
@click=${()=>void this.openStyle(e.kind)}
|
|
1183
|
+
>
|
|
1184
|
+
${this.t(`style.target.more`,{target:this.t(`style.target.${e.kind}`)})}
|
|
1185
|
+
</button>`)}
|
|
1186
|
+
<button
|
|
1187
|
+
type="button"
|
|
1188
|
+
role="menuitem"
|
|
1189
|
+
tabindex="-1"
|
|
1190
|
+
data-style-target="rules"
|
|
1191
|
+
@click=${()=>void this.openStyle(`rules`)}
|
|
1192
|
+
>
|
|
1193
|
+
${this.t(`style.rules.open`)}
|
|
1194
|
+
</button>`}#I(){let e=this.#r,t=this.#n,n=this.#t;return e===null||n===null||t!==`panel`&&!W.has(t??``)?S:e.stylePopup({popup:t===`panel`?{panel:this.#i}:t,styles:n,fonts:this.authoring?.fonts??[],colorError:this.#a,authoring:this.authoring,adapter:this.adapter,t:(e,t)=>this.t(e,t),setText:e=>this.#x(e),setBlock:e=>this.#S(e),refuseColor:()=>{this.#a=!0,this.requestUpdate()},close:e=>this.#_(e),menuKeydown:this.#P})}#L(){let e=this.#e,t=t=>{this.#_(!1),!e.active.includes(t)||t===`paragraph`?this.#b(t):this.#y()};return g`<div
|
|
1195
|
+
id="style"
|
|
1196
|
+
class="menu"
|
|
1197
|
+
popover="manual"
|
|
1198
|
+
role="menu"
|
|
1199
|
+
aria-label=${this.t(`toolbar.style`,{style:this.t(`toolbar.${U.find(t=>e.active.includes(t))??`paragraph`}`)})}
|
|
1200
|
+
part="style-menu"
|
|
1201
|
+
@keydown=${this.#P}
|
|
1202
|
+
>
|
|
1203
|
+
${U.map(n=>g`<button
|
|
1204
|
+
type="button"
|
|
1205
|
+
role="menuitemradio"
|
|
1206
|
+
tabindex="-1"
|
|
1207
|
+
data-format=${n}
|
|
1208
|
+
aria-checked=${String(e.active.includes(n))}
|
|
1209
|
+
aria-disabled=${e.enabled.includes(n)?S:`true`}
|
|
1210
|
+
@click=${()=>t(n)}
|
|
1211
|
+
>
|
|
1212
|
+
${this.t(`toolbar.${n}`)}
|
|
1213
|
+
</button>`)}
|
|
1214
|
+
${this.#F()}
|
|
1215
|
+
</div>`}#R(){let e=this.#e,t=()=>{let e=this.renderRoot.querySelector(`#link-address`),t=e?.value.trim()??``;t===``?(this.#_(!1),this.#b(`link`)):this.authoring?.urlPolicy(t,{tag:`a`,attribute:`href`})===!0?(this.#_(!1),this.#b(`link`,t)):(this.#c=!0,this.requestUpdate(),e?.focus())};return g`<div
|
|
1216
|
+
id="link"
|
|
1217
|
+
class="link"
|
|
1218
|
+
popover="manual"
|
|
1219
|
+
role="dialog"
|
|
1220
|
+
aria-label=${this.t(`toolbar.link`)}
|
|
1221
|
+
part="link"
|
|
1222
|
+
@keydown=${e=>{e.key===`Escape`?(e.preventDefault(),this.#_(!0)):e.key===`Enter`&&e.target.localName===`input`&&(e.preventDefault(),t())}}
|
|
1223
|
+
>
|
|
1224
|
+
<label for="link-address">${this.t(`toolbar.link.address`)}</label>
|
|
1225
|
+
<input
|
|
1226
|
+
id="link-address"
|
|
1227
|
+
type="url"
|
|
1228
|
+
inputmode="url"
|
|
1229
|
+
.value=${this.#n===`link`?e.href??``:``}
|
|
1230
|
+
aria-invalid=${this.#c?`true`:S}
|
|
1231
|
+
aria-describedby=${this.#c?`link-error`:S}
|
|
1232
|
+
/>
|
|
1233
|
+
<div role="alert">${this.#c?g`<p class="error" id="link-error">${this.t(`toolbar.link.blocked`)}</p>`:S}</div>
|
|
1234
|
+
<div class="buttons">
|
|
1235
|
+
<button type="button" class="primary" @click=${t}>${this.t(`toolbar.link.apply`)}</button>
|
|
1236
|
+
${e.href===null?S:g`<button
|
|
1237
|
+
type="button"
|
|
1238
|
+
@click=${()=>{this.#_(!1),this.#b(`link`)}}
|
|
1239
|
+
>
|
|
1240
|
+
${this.t(`toolbar.link.remove`)}
|
|
1241
|
+
</button>`}
|
|
1242
|
+
</div>
|
|
1243
|
+
</div>`}#z(){let e=this.authoring;return g`<div
|
|
1244
|
+
id="insert"
|
|
1245
|
+
class="insert"
|
|
1246
|
+
popover="manual"
|
|
1247
|
+
role="dialog"
|
|
1248
|
+
aria-label=${this.t(`toolbar.${this.#o}`)}
|
|
1249
|
+
part="insert"
|
|
1250
|
+
@keydown=${e=>{e.key===`Escape`&&(e.preventDefault(),this.#_(!0))}}
|
|
1251
|
+
@focusout=${e=>{let t=e.relatedTarget;t!==null&&!e.currentTarget.contains(t)&&this.#_(!1)}}
|
|
1252
|
+
@astl-inserted=${()=>{this.#_(!1),this.#y()}}
|
|
1253
|
+
>
|
|
1254
|
+
<div class="search">
|
|
1255
|
+
<input
|
|
1256
|
+
type="search"
|
|
1257
|
+
aria-label=${this.t(`toolbar.search`)}
|
|
1258
|
+
placeholder=${this.t(`toolbar.search`)}
|
|
1259
|
+
.value=${this.#s}
|
|
1260
|
+
@input=${e=>{this.#s=e.target.value,this.requestUpdate()}}
|
|
1261
|
+
@keydown=${e=>{e.key===`Enter`&&(e.preventDefault(),(this.menu?.renderRoot.querySelector(`button.insert:not(:disabled)`))?.click())}}
|
|
1262
|
+
/>
|
|
1263
|
+
</div>
|
|
1264
|
+
<astl-insert-menu
|
|
1265
|
+
part="menu"
|
|
1266
|
+
.authoring=${e}
|
|
1267
|
+
.adapter=${this.adapter}
|
|
1268
|
+
.filter=${this.#s}
|
|
1269
|
+
.groups=${Ir[this.#o]}
|
|
1270
|
+
></astl-insert-menu>
|
|
1271
|
+
</div>`}render(){if(this.authoring===null)return S;let{lang:e,dir:t}=this.ui,n=this.views.length>0&&this.view!==this.views[0]?.name,r=this.#j().map(([e,t])=>[e,n?t.map(e=>e.checked===void 0?{...e,disabled:!0}:e):t]);this.#u=r.flatMap(([,e])=>e);let i=0;return g`<div
|
|
1272
|
+
class="bar"
|
|
1273
|
+
part="toolbar"
|
|
1274
|
+
role="toolbar"
|
|
1275
|
+
aria-label=${this.t(`toolbar.label`)}
|
|
1276
|
+
lang=${e}
|
|
1277
|
+
dir=${t}
|
|
1278
|
+
@mousedown=${e=>{e.target.closest(`button`)!==null&&e.preventDefault()}}
|
|
1279
|
+
@keydown=${e=>this.#M(e)}
|
|
1280
|
+
>
|
|
1281
|
+
${r.map(([e,t],n)=>g`<div class=${e} role=${e===`group views`?`radiogroup`:`presentation`}
|
|
1282
|
+
part=${e===`group views`?`views`:S}
|
|
1283
|
+
aria-label=${e===`group views`?this.t(`toolbar.view`):S}>
|
|
1284
|
+
${n===0||e===`group views`?S:g`<span class="separator" part="separator" aria-hidden="true"></span>`}
|
|
1285
|
+
${t.map(e=>this.#N(e,i++))}
|
|
1286
|
+
</div>`)}
|
|
1287
|
+
</div>
|
|
1288
|
+
<div lang=${e} dir=${t}>
|
|
1289
|
+
${this.#L()} ${this.#R()} ${this.#z()} ${this.#I()}
|
|
1290
|
+
</div>
|
|
1291
|
+
<astl-picture-dialog .authoring=${this.authoring}></astl-picture-dialog>`}updated(e){super.updated(e);let t=this.menu;t!==null&&(t.dialog=this.renderRoot.querySelector(`astl-picture-dialog`));for(let e of this.renderRoot.querySelectorAll(`.color-mark`))e.style.background=e.dataset.color??``;for(let e of this.renderRoot.querySelectorAll(`[data-font]`))e.style.fontFamily=e.dataset.font??``;if(this.#n===null)return;let n=this.renderRoot.querySelector(`#${G(this.#n)}`),r=this.renderRoot.querySelector(`[data-popup="${K(this.#n)}"]`);n!==null&&r!==null&&n.matches(`:popover-open`)&&this.#v(n,r)}},qr=[[`astl-insert-menu`,Pn],[`astl-inspector`,Er],[`astl-issues`,Dr],[`astl-preview`,Fr],[`astl-toolbar`,Kr],[`astl-picture-dialog`,Or],[`astl-picture-field`,Nr]];function Jr(e=customElements){Nn(e);for(let[t,n]of qr){let r=e.get(t);if(r!==n){if(r!==void 0)throw Error(`<${t}> is already defined by another class`);e.define(t,n)}}}var Yr=new Set([`p`,`h2`,`h3`,`h4`]),q=e=>e.endTag?.start??e.end;function Xr(e){let t=Tn(e),n=t.find(e=>e.name===He),r=n?.children??t,i=r.findIndex(e=>e.name!==Vt),a=i<0?[]:r.slice(i);return{start:(i<0?r.at(-1):r[i-1])?.end??n?.startTag.end??0,end:n===void 0?e.length:q(n),blocks:a,pages:a.filter(e=>e.name===C)}}function J(e){let t=1;for(;e.has(`page-${t}`);)t++;return e.add(`page-${t}`),`page-${t}`}function Zr(e){let t=0;for(let n of Dn(e)){if(e.slice(t,n.start).trim()!==``||n.type===`start`&&(n.name===`br`||n.name===`img`||n.name.includes(`-`)))return!1;t=n.end}return e.slice(t).trim()===``}function Qr(e,t){let n=[e];for(let r=e;;){if(t<r.startTag.end||t>q(r))return null;let e=r.children.find(e=>e.start<t&&t<e.end);if(e===void 0)return n;if(e.name.includes(`-`))return null;n.push(e),r=e}}function $r(e,t){let n=Xr(e),r=n.pages.find(e=>e.startTag.end<=t&&t<=q(e));if(n.pages.length>0?r===void 0:t<n.start||t>n.end)return null;let[i,a]=r===void 0?[n.start,n.end]:[r.startTag.end,q(r)],o=r?.children??n.blocks,s=t,c=``,l=``,u=o.find(e=>e.start<t&&t<e.end);if(u!==void 0){let n=Yr.has(u.name)?Qr(u,t):null;n===null?s=u.end:Zr(e.slice(u.startTag.end,t))?s=u.start:Zr(e.slice(t,q(u)))?s=u.end:(c=n.map(e=>`</${e.name}>`).reverse().join(``),l=n.map(t=>e.slice(t.startTag.start,t.startTag.end)).join(``))}let d=Cn(e),f=r===void 0?`<astl-page id="${J(d)}">`:``,p=J(d),m=(r?.startTag.attributes??[]).filter(e=>Se.has(e.name)||e.name===`class`).map(t=>` ${e.slice(t.start,t.end)}`).join(``),ee=l!==``||o.some(e=>e.end<=s)?``:`<p></p>`,te=l===``&&!o.some(e=>e.start>=s),h=`${e.slice(0,i)}${f}${e.slice(i,s)}${c}${ee}</astl-page><astl-page id="${p}"${m}>${te?`<p>`:l}`;return{source:h+`${te?`</p>`:``}${e.slice(s,a)}${f===``?``:`</astl-page>`}${e.slice(a)}`,caret:h.length,id:p}}function ei(e,t){let n=Xr(e),r=Cn(e),i=n.pages.find(e=>wn(e.startTag,`id`)===t)??n.pages.at(-1),a=i===void 0?`${e.slice(0,n.start)}<astl-page id="${J(r)}">${e.slice(n.start,n.end)}</astl-page>`:e.slice(0,i.end),o=J(r),s=`${a}<astl-page id="${o}"><p>`;return{source:`${s}</p></astl-page>${e.slice(i?.end??n.end)}`,caret:s.length,id:o}}function ti(e,t){let{pages:n}=Xr(e),r=n.findIndex(e=>wn(e.startTag,`id`)===t),i=n[r-1]?.endTag,a=n[r]?.startTag;if(r<1||i==null||a===void 0)return null;let o=e.slice(0,i.start)+e.slice(i.end,a.start);return{source:o+e.slice(a.end),caret:o.length}}var ni=[`select`,`keyup`,`click`,`focus`];function ri(e,t){return e?.id===t?.id&&e?.tag===t?.tag}var ii=e=>e.tag!==C;function ai(e,t,n){let r=En(e),i=r.filter(e=>ii(e)&&(t===n?e.start<t:e.start<n)&&t<e.end),a=i[i.length-1];if(a!==void 0)return[a.end,a.end];let o=Dn(e),s=e=>o.find(t=>t.start<e&&e<t.end),c=s(t);if(c!==void 0)return[c.end,c.end];if(s(n)!==void 0)return[t,t];let l=o.find(e=>e.type===`start`&&e.name===`astl-doc`),u=o.findLast(e=>e.type===`end`&&e.name===`astl-doc`);if(l===void 0||t>=l.end&&(u===void 0||n<=u.start))return[t,n];let d=r.filter(e=>e.tag===C),f=d[d.length-1],p=(f&&o.find(e=>e.type===`end`&&e.name===`astl-page`&&e.end===f.end))?.start??u?.start??e.length;return[p,p]}function oi(e,t){let n=e.value.slice(0,t).split(`
|
|
1292
|
+
`).length-1,r=Number.parseFloat(getComputedStyle(e).lineHeight)||20;e.scrollTop=Math.max(0,n*r-e.clientHeight/3),e.setSelectionRange(t,t)}function si(e){let t=new Set,n=new Set,r=null,i=()=>{let t=e.value;return r?.value!==t&&(r={value:t,elements:En(t)}),r.elements},a=e=>i().find(t=>ii(t)&&t.id===e)??null,o=()=>{let t=e.selectionStart,n=i().find(e=>ii(e)&&e.start<=t&&t<e.end);return n?.id?{id:n.id,tag:n.tag}:null},s=o(),c=()=>{let e=o();if(!ri(e,s)){s=e;for(let t of[...n])t(e)}},l=()=>{for(let e of[...t])e();c()};e.addEventListener(`input`,l);for(let t of ni)e.addEventListener(t,c);let u=t=>{let n=e.value,r=Math.min(n.length,t.length),i=0;for(;i<r&&n[i]===t[i];)i++;let a=0;for(;a<r-i&&n[n.length-1-a]===t[t.length-1-a];)a++;e.setRangeText(t.slice(i,t.length-a),i,n.length-a,`preserve`),l()},d=t=>{u(t.source),oi(e,t.caret),c()};return{getSource:()=>e.value,setSource:u,insert(t){let[n,r]=ai(e.value,e.selectionStart,e.selectionEnd);e.setRangeText(t,n,r,`select`),l()},getElement(t){let n=a(t);return n===null?null:e.value.slice(n.start,n.end)},replaceElement(t,n){let r=a(t);if(r===null)return;let{selectionStart:i,selectionEnd:o,selectionDirection:s}=e,c=n.length-(r.end-r.start),u=e=>e<r.start?e:e>=r.end?e+c:Math.min(e,r.start+Math.max(0,n.length-1));e.setRangeText(n,r.start,r.end,`preserve`),e.setSelectionRange(u(i),u(o),s),l()},getSelection:o,select(t){let n=i().find(e=>e.id===t);n!==void 0&&(oi(e,n.start),e.focus(),c())},splitPage(){let t=$r(e.value,e.selectionStart);return t!==null&&d(t),t?.id??null},addPage(t){let n=ei(e.value,t);return d(n),n.id},mergePage(t){let n=ti(e.value,t);return n!==null&&d(n),n!==null},onChange(e){return t.add(e),()=>t.delete(e)},onSelectionChange(e){return n.add(e),()=>n.delete(e)},destroy(){e.removeEventListener(`input`,l);for(let t of ni)e.removeEventListener(t,c);t.clear(),n.clear()}}}
|
|
1293
|
+
/**
|
|
1294
|
+
* @license
|
|
1295
|
+
* Copyright 2021 Google LLC
|
|
1296
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1297
|
+
*/var ci=Vn(class extends zn{constructor(){super(...arguments),this.key=S}render(e,t){return this.key=e,t}update(e,[t,n]){return t!==this.key&&(Bn(e),this.key=t),n}});function li(e){let t=[`color-scheme: inherit;`,...[y.scale,y.themes.light,y.themeScale.light].flatMap(Object.keys).map(e=>`--astl-${e}: inherit;`)];return me(`${e} {\n${t.join(`
|
|
1298
|
+
`)}\n}`)}var ui=[me(Ct(`:host`)),li(`astl-toolbar, astl-inspector, astl-issues, astl-preview, astl-picture-dialog`),_`
|
|
1299
|
+
:host {
|
|
1300
|
+
display: block;
|
|
1301
|
+
container-type: inline-size;
|
|
1302
|
+
color: var(--astl-ink);
|
|
1303
|
+
font-family: var(--astl-font-body);
|
|
1304
|
+
font-size: var(--astl-size-ui);
|
|
1305
|
+
line-height: 1.4;
|
|
1306
|
+
}
|
|
1307
|
+
:host([hidden]) {
|
|
1308
|
+
display: none;
|
|
1309
|
+
}
|
|
1310
|
+
`,_`
|
|
1311
|
+
.layout {
|
|
1312
|
+
display: flex;
|
|
1313
|
+
flex-direction: column;
|
|
1314
|
+
gap: var(--astl-editor-layout-gap, var(--astl-space-4));
|
|
1315
|
+
}
|
|
1316
|
+
.work {
|
|
1317
|
+
display: grid;
|
|
1318
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1319
|
+
align-items: start;
|
|
1320
|
+
gap: var(--astl-space-4);
|
|
1321
|
+
}
|
|
1322
|
+
.surface,
|
|
1323
|
+
.side,
|
|
1324
|
+
.start,
|
|
1325
|
+
.end {
|
|
1326
|
+
display: flex;
|
|
1327
|
+
flex-direction: column;
|
|
1328
|
+
gap: var(--astl-space-4);
|
|
1329
|
+
min-inline-size: 0;
|
|
1330
|
+
}
|
|
1331
|
+
.surface {
|
|
1332
|
+
position: relative;
|
|
1333
|
+
}
|
|
1334
|
+
::slotted(*) {
|
|
1335
|
+
box-sizing: border-box;
|
|
1336
|
+
inline-size: 100%;
|
|
1337
|
+
max-inline-size: 100%;
|
|
1338
|
+
}
|
|
1339
|
+
.status {
|
|
1340
|
+
margin: 0;
|
|
1341
|
+
padding: var(--astl-space-4);
|
|
1342
|
+
border: var(--astl-outline-width) solid var(--astl-line);
|
|
1343
|
+
border-radius: var(--astl-radius-l);
|
|
1344
|
+
background: var(--astl-surface);
|
|
1345
|
+
color: var(--astl-ink-muted);
|
|
1346
|
+
}
|
|
1347
|
+
`,_`
|
|
1348
|
+
.side[hidden],
|
|
1349
|
+
.start[hidden],
|
|
1350
|
+
.end[hidden] {
|
|
1351
|
+
display: none;
|
|
1352
|
+
}
|
|
1353
|
+
.status.idle {
|
|
1354
|
+
position: absolute;
|
|
1355
|
+
inline-size: 1px;
|
|
1356
|
+
block-size: 1px;
|
|
1357
|
+
padding: 0;
|
|
1358
|
+
border: 0;
|
|
1359
|
+
overflow: hidden;
|
|
1360
|
+
clip-path: inset(50%);
|
|
1361
|
+
white-space: nowrap;
|
|
1362
|
+
}
|
|
1363
|
+
`,_`
|
|
1364
|
+
.status-line {
|
|
1365
|
+
display: flex;
|
|
1366
|
+
flex-wrap: wrap;
|
|
1367
|
+
justify-content: space-between;
|
|
1368
|
+
gap: 0 var(--astl-space-3);
|
|
1369
|
+
margin: 0;
|
|
1370
|
+
color: var(--astl-ink-muted);
|
|
1371
|
+
font-size: var(--astl-size-small);
|
|
1372
|
+
}
|
|
1373
|
+
.counts {
|
|
1374
|
+
font-family: var(--astl-font-mono);
|
|
1375
|
+
}
|
|
1376
|
+
.counts span + span::before {
|
|
1377
|
+
content: '\\00b7' / '';
|
|
1378
|
+
margin-inline: var(--astl-space-1);
|
|
1379
|
+
}
|
|
1380
|
+
.ready {
|
|
1381
|
+
color: var(--astl-success);
|
|
1382
|
+
font-weight: 600;
|
|
1383
|
+
}
|
|
1384
|
+
.error {
|
|
1385
|
+
color: var(--astl-danger);
|
|
1386
|
+
}
|
|
1387
|
+
`,_`
|
|
1388
|
+
@container (min-inline-size: 48rem) {
|
|
1389
|
+
.work {
|
|
1390
|
+
display: flex;
|
|
1391
|
+
}
|
|
1392
|
+
.surface {
|
|
1393
|
+
flex: 3 1 0;
|
|
1394
|
+
}
|
|
1395
|
+
.side {
|
|
1396
|
+
flex: 2 1 0;
|
|
1397
|
+
min-inline-size: 18rem;
|
|
1398
|
+
}
|
|
1399
|
+
.start,
|
|
1400
|
+
.end {
|
|
1401
|
+
flex: none;
|
|
1402
|
+
}
|
|
1403
|
+
.side,
|
|
1404
|
+
.start,
|
|
1405
|
+
.end {
|
|
1406
|
+
position: sticky;
|
|
1407
|
+
inset-block-start: var(--astl-editor-sticky-top, var(--astl-space-4));
|
|
1408
|
+
max-block-size: calc(100dvh - var(--astl-editor-sticky-top, var(--astl-space-4)) - var(--astl-space-4));
|
|
1409
|
+
overflow-y: auto;
|
|
1410
|
+
padding: var(--astl-focus-width);
|
|
1411
|
+
margin: calc(-1 * var(--astl-focus-width));
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
`],di=e=>`load`in e?e.tag:e.manifest.tag,fi=null;function pi(){return fi??=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``),fi}function mi(e,t){return ie({components:t,secret:pi(),slotKinds:[...e.slotKinds.values()],profile:e.profile,catalogs:e.catalogs,styleTemplates:[...e.styleTemplates.values()],...e.urlPolicy===null?{}:{urlPolicy:e.urlPolicy},...e.groundColors===null?{}:{groundColors:e.groundColors}})}var hi={components:new Map,editors:new Map,elements:new Map,styleTemplates:new Map,slotKinds:new Map,catalogs:[],profile:{},urlPolicy:null,groundColors:null,uploadAsset:null,pickPicture:null,fonts:Rn,styles:In,featured:[],views:[],menuMessages:null},Y=null;function X(){return Y??={...hi,engine:mi(hi,[]),version:0},Y}var gi=new Set;function Z(e,t,n,r){let i=new Map(e);for(let e of t??[]){let t=n(e),a=i.get(t);if(a!==void 0&&a!==e)throw Error(`${r} ${t} is already registered`);i.set(t,e)}return i}function _i(e){let t=Y??{...hi,version:0},n=e=>e.manifest.tag,r={components:Z(t.components,e.components,n,`Component`),editors:Z(t.editors,e.editors,n,`Editor descriptor`),elements:Z(t.elements,e.elements,di,`Preview element`),styleTemplates:Z(t.styleTemplates,e.styleTemplates,e=>e.name,`Style template`),slotKinds:Z(t.slotKinds,e.slotKinds,e=>e.kind,`Slot kind`),catalogs:[...new Set([...t.catalogs,...e.catalogs??[]])],profile:{...t.profile,...e.profile},urlPolicy:e.urlPolicy??t.urlPolicy,groundColors:e.groundColors??t.groundColors,uploadAsset:e.uploadAsset??t.uploadAsset,pickPicture:e.pickPicture??t.pickPicture,fonts:e.fonts??t.fonts,styles:e.styles??t.styles,featured:e.featured??t.featured,views:e.views??t.views,menuMessages:e.menuMessages??t.menuMessages},i=[`components`,`editors`,`elements`,`styleTemplates`,`slotKinds`],a=e=>JSON.stringify(Object.entries(e).sort());if(Y!==null&&i.every(e=>r[e].size===t[e].size)&&r.catalogs.length===t.catalogs.length&&r.urlPolicy===t.urlPolicy&&JSON.stringify(r.groundColors)===JSON.stringify(t.groundColors)&&r.uploadAsset===t.uploadAsset&&r.pickPicture===t.pickPicture&&r.menuMessages===t.menuMessages&&JSON.stringify(r.fonts)===JSON.stringify(t.fonts)&&JSON.stringify(r.styles)===JSON.stringify(t.styles)&&r.featured.join(` `)===t.featured.join(` `)&&JSON.stringify(r.views)===JSON.stringify(t.views)&&a(r.profile)===a(t.profile))return;let o=mi(r,[...r.components.values()]);jn({engine:o,descriptors:[...r.editors.values()],locale:`en`,fonts:r.fonts,styles:r.styles}),Y={...r,engine:o,version:t.version+1};for(let e of gi)e.requestUpdate()}function vi(e,t,n){let r=e=>[...e.entries()].filter(([e])=>n===null||n.includes(e)).map(([,e])=>e);return jn({engine:n===null?e.engine:mi(e,r(e.components)),descriptors:r(e.editors),elements:r(e.elements),locale:t,catalogs:e.catalogs,styleTemplates:[...e.styleTemplates.values()],fonts:e.fonts,styles:e.styles,...e.urlPolicy===null?{}:{urlPolicy:e.urlPolicy},...e.uploadAsset===null?{}:{uploadAsset:e.uploadAsset},...e.pickPicture===null?{}:{pickPicture:e.pickPicture},...e.menuMessages===null?{}:{menuMessages:e.menuMessages}})}var yi=[`light`,`dark`,`hc`,`auto`],bi=`astl-editor-change`,xi=`astl-editor-ready`,Si=`astl-editor-view`,Ci=[`visual`,`source`],wi=300,Ti=[`issues`,`inspector`],Ei={fromAttribute:e=>e===null?null:e.split(/\s+/).filter(e=>e!==``)},Di={fromAttribute:e=>{try{return e===null?null:JSON.parse(e)}catch{return null}}},Oi=[`chevron`,`bold`,`italic`,`underline`,`link`,`bulleted`,`numbered`,`undo`,`redo`,`wrap`,`text`,`image`,`files`,`add`,`templates`],ki=`header: inspector-header, id: inspector-id, actions: inspector-actions, issue: inspector-issue, field: inspector-field, label: inspector-label, style: inspector-style`,Q=null,$=null,Ai=class extends Xt{static properties={locale:{},components:{converter:Ei},featured:{converter:Ei},panels:{converter:Ei},view:{},views:{converter:Di},theme:{},previewPolicy:{attribute:!1},adapter:{attribute:!1}};static styles=ui;#e=null;#t=null;#n=null;#r=!1;#i=!1;#a=null;#o=null;#s=0;#c=null;#l=()=>{};#u=new Promise(e=>{this.#l=e});#d={ask:e=>this.renderRoot.querySelector(`astl-picture-dialog`)?.ask(e)??Promise.resolve(null),refuse:()=>{this.#a={key:`picture.pasteRefused`},this.requestUpdate()},style:e=>{this.renderRoot.querySelector(`astl-toolbar`)?.openStyle(e)}};#f=e=>{this.#o=e};#p={start:!1,end:!1};#m=e=>{let t=e.target,n=t.name===`end`?`end`:`start`,r=t.assignedElements().length>0;this.#p[n]!==r&&(this.#p[n]=r,this.requestUpdate())};#h=null;#g=null;#_=[];#v=null;#y;#b=null;#x=null;constructor(){if(super(),this.locale=null,this.components=null,this.featured=null,this.panels=null,this.view=`visual`,this.views=null,this.theme=`auto`,this.previewPolicy=null,this.adapter=null,Object.hasOwn(this,`value`)){let e=this.value;delete this.value,typeof e==`string`&&(this.value=e)}}get value(){return this.adapter?.getSource()??this.#e??`<astl-doc lang="${this.authoring.locale}"></astl-doc>`}set value(e){this.adapter===null?this.#e=e:this.adapter.setSource(e)}get ready(){return this.#u}async preview(){await this.updateComplete,await this.renderRoot.querySelector(`astl-preview`)?.refresh()}get authoring(){let e=X(),t=this.#k(e),n=this.components,r=typeof n==`string`?n.split(/\s+/).filter(e=>e!==``):n,i=`${e.version}\n${t}\n${r===null?`*`:r.join(` `)}`;return this.#b?.key!==i&&(this.#b={key:i,authoring:vi(e,t,r)}),this.#b.authoring}connectedCallback(){super.connectedCallback(),gi.add(this),this.#t===!0&&this.#D(),this.#O()}disconnectedCallback(){super.disconnectedCallback(),gi.delete(this),clearTimeout(this.#y),this.#c=null,this.#O();let e=this.#n;e!==null&&(this.#e=e.adapter.getSource(),e.destroy(),this.#n=null,this.adapter=null)}#S(){let e=this.views??X().views;return Array.isArray(e)?e:[]}#C(){return[...Ci,...this.#S().map(e=>e.name)].includes(this.view)?this.view:`visual`}#w(){let e=this.#g??this.#h??this.value,t=this.authoring.validate(e).issues.filter(e=>e.severity===`error`);return this.#_=t,t.length>0?(this.#a={key:`view.sourceErrors`,params:{n:t.length}},this.#s++,!1):(this.#g!==null&&$?.formatHtml(this.#g)!==this.#h&&(this.value=this.#g),this.#g=null,!0)}#T(e){clearTimeout(this.#y),this.#y=setTimeout(()=>{let e=this.adapter;this.#v=e===null?null:this.authoring.outline(e.getSource()),this.requestUpdate()},e)}willUpdate(e){if(e.has(`theme`)&&(this.dataset.theme=this.#A()),e.has(`view`)){let t=e.get(`view`);t===`source`&&this.view!==`source`&&!this.#w()?this.view=`source`:this.view===`source`&&t!==`source`&&(this.#h=this.#g=null,this.#_=[],$===null&&import(`./chunks/source-view-DXKPFCl9.js`).then(e=>{$=e,this.requestUpdate()},e=>console.error(e)))}let t=this.#n;if(t!==null&&this.adapter!==t.adapter&&(this.adapter===null&&(this.#e=t.adapter.getSource()),t.destroy(),this.#n=null),this.adapter!==null&&this.#n===null)this.#t=!1,this.#e!==null&&this.adapter.setSource(this.#e),this.#e=null;else if(this.adapter===null&&this.#n===null)this.isConnected&&(this.#t===null||e.has(`adapter`))&&this.#E();else if(this.#n!==null&&Q!==null&&this.#n.authoring!==this.authoring){let e=this.#n.adapter.getSource();this.#n.destroy(),this.#n=Q.createSurface(this,this.authoring,X().engine.manifests,e,this.#d,this.#f),this.adapter=this.#n.adapter}this.#O()}updated(e){e.has(`theme`)&&this.renderRoot.querySelector(`astl-preview`)?.requestUpdate();let t=this.adapter;t!==null&&t!==this.#c&&this.isConnected&&(this.#c=t,this.#T(0),this.#l(),this.dispatchEvent(new Event(xi,{bubbles:!0,composed:!0})));let n=e.get(`view`);e.has(`view`)&&n!==void 0&&n!==this.view&&this.dispatchEvent(new CustomEvent(Si,{detail:{view:this.view},bubbles:!0,composed:!0}))}#E(){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,()=>this.requestUpdate(`adapter`),{once:!0}):(this.#t=this.querySelector(`:scope > [slot="surface"]`)===null,this.#t&&this.#D())}async#D(){if(!(this.#r||this.#n!==null)){this.#r=!0,this.#i=!1;try{if(Q??=await import(`./chunks/surface-CgxfAwCR.js`),!this.isConnected||!this.#t||this.adapter!==null||this.#n!==null)return;this.#n=Q.createSurface(this,this.authoring,X().engine.manifests,this.value,this.#d,this.#f),this.#e=null,this.adapter=this.#n.adapter}catch(e){this.#i=!0,console.error(e)}finally{this.#r=!1,this.requestUpdate()}}}#O(){let e=this.isConnected?this.adapter:null;(this.#x?.adapter??null)!==e&&(this.#x?.off(),this.#x=e===null?null:{adapter:e,off:e.onChange(()=>{let e=this.#o;this.#o=null,(this.#a!==null||e!==null)&&(this.#a=e,e!==null&&this.#s++,this.requestUpdate()),this.#T(wi),this.dispatchEvent(new Event(bi,{bubbles:!0,composed:!0}))})})}#k(e){let t=this.locale?[this.locale]:this.lang?[this.lang]:[...navigator.languages??[],navigator.language].filter(e=>!!e),n=[...Fn,...e.catalogs].filter(e=>e.namespace===k).map(e=>e.locale);return Wt(t,[...new Set(n)],`en`)}#A(){let e=this.theme;return e!==null&&yi.includes(e)?e:`auto`}render(){let{authoring:e,adapter:t}=this,n=this.#A(),r=this.#i?{key:`surface.failed`}:this.#t&&t===null?{key:`surface.loading`}:this.#a,i=e.locale,a=e=>typeof e==`string`?e.split(/\s+/).filter(e=>e!==``):e,o=a(this.featured)??X().featured,s=(a(this.panels)??Ti).filter(e=>Ti.includes(e)),c=new Set([...Oi,...e.descriptors.flatMap(e=>[e.icon,...(e.templates??[]).map(t=>t.icon??e.icon)])]),l=[`toolbar: toolbar-bar`,`button: toolbar-button`,`icon-button: toolbar-icon-button`,`views: toolbar-views`,`view: toolbar-view`,`separator: toolbar-separator`,`icon: toolbar-icon`,`insert`,`menu: insert-menu`,`style-menu`,`style-colors`,`style-panel`].concat([...c].map(e=>`icon-${e}`)).join(`, `),u=r=>r===`issues`?g`<astl-issues part="issues" data-theme=${n} .authoring=${e} .adapter=${t}></astl-issues>`:g`<astl-inspector part="inspector" exportparts=${ki} data-theme=${n} .authoring=${e} .adapter=${t}></astl-inspector>`,d=(t,n)=>e.t(k,t,n),f=this.#C(),p=[...Ci.map(e=>({name:e,label:d(`view.${e}`)})),...this.#S()],m=f!==`visual`;return g`<div class=${s.length===0||m?`layout solo`:`layout`}>
|
|
1415
|
+
<astl-toolbar part="toolbar" exportparts=${l} data-theme=${n} .authoring=${e}
|
|
1416
|
+
.adapter=${t} .featured=${o} .views=${p} .view=${f}
|
|
1417
|
+
@astl-toolbar-view=${e=>{this.view=e.detail.view}}></astl-toolbar>
|
|
1418
|
+
${this.#j()}
|
|
1419
|
+
<div class="work" part="work">
|
|
1420
|
+
<div class="start" part="start" ?hidden=${m||!this.#p.start}>
|
|
1421
|
+
<slot name="start" @slotchange=${this.#m}></slot>
|
|
1422
|
+
</div>
|
|
1423
|
+
<div class="surface" part="surface">
|
|
1424
|
+
${m?S:g`<slot name="surface"></slot>`}
|
|
1425
|
+
${f===`source`?this.#M():m?g`<slot name="view-${f}"></slot>`:S}
|
|
1426
|
+
<p class=${r===null?`status idle`:`status`} role="status" lang=${i} dir=${b(i)}
|
|
1427
|
+
>${ci(this.#s,r===null?``:e.t(k,r.key,r.params))}</p>
|
|
1428
|
+
<astl-picture-dialog data-theme=${n} .authoring=${e}></astl-picture-dialog>
|
|
1429
|
+
</div>
|
|
1430
|
+
${s.length===0?S:g`<div class="side" part="side" ?hidden=${m}>${s.map(u)}</div>`}
|
|
1431
|
+
<div class="end" part="end" ?hidden=${m||!this.#p.end}>
|
|
1432
|
+
<slot name="end" @slotchange=${this.#m}></slot>
|
|
1433
|
+
</div>
|
|
1434
|
+
</div>
|
|
1435
|
+
<astl-preview part="preview" data-theme=${n} .authoring=${e} .adapter=${t}
|
|
1436
|
+
.policy=${this.previewPolicy??v}></astl-preview>
|
|
1437
|
+
</div>`}#j(){let e=this.#v;if(e===null)return S;let{authoring:t}=this,n=(e,n)=>t.t(k,e,n),r=e.pages.reduce((e,t)=>e+t.components.length,0),i=e.errors===0,a=t.locale;return g`<p class="status-line" part="status-line" lang=${a} dir=${b(a)}>
|
|
1438
|
+
<span class="counts"><span>${n(`status.elements`,{n:r})}</span>${e.points===null?S:g`<span>${n(`surface.points`,{points:e.points})}</span>`}</span>
|
|
1439
|
+
<span class=${i?`ready`:`counts error`}>${i?n(`status.ready`):g`<span>${n(`status.errors`,{n:e.errors})}</span><span>${n(`status.warnings`,{n:e.warnings})}</span>`}</span>
|
|
1440
|
+
</p>`}#M(){let e=$;return e===null?S:(this.#h??=e.formatHtml(this.value),e.renderSource(this.renderRoot,this.authoring,this.#g??this.#h,this.#_,e=>{this.#g=e}))}},ji=`astl-editor`;function Mi(e){let t=e.registry??customElements,n=t.get(ji);if(n!==void 0&&n!==Ai)throw Error(`<${ji}> is already defined by another class`);Jr(t),_i(e),n===void 0&&t.define(ji,Ai)}var Ni=[],Pi=async()=>(await import(`./chunks/menu-messages-Dx3jYUEp.js`)).builtInMenuMessages;function Fi(e={}){let t=e.components??h,n=new Set(t.map(e=>e.manifest.tag)),{surface:r,ink:i}=y.themes.light;Mi({styleTemplates:le,groundColors:{surface:r,ink:i},featured:Ni,menuMessages:Pi,...e,components:t,editors:e.editors??Sr.filter(e=>n.has(e.manifest.tag)),elements:e.elements??Ne.filter(e=>n.has(e.tag))})}Fi();export{Ai as AstlEditor,ke as BLOCK_TAGS,qt as BUILT_IN_PREFIX,ze as CAPTION_TAG,en as CLASS_ATTRIBUTE,fe as COLUMNS_TAG,Ke as COLUMN_TAG,$e as COMMON_ATTRIBUTES,Se as CONTENT_ATTRIBUTES,Tt as CheckerError,We as DEFAULT_DOC_KIND,Ni as DEFAULT_FEATURED,Rn as DEFAULT_FONTS,_e as DEFAULT_PROFILE,In as DEFAULT_STYLES,Je as DOC_ATTRIBUTES,be as DOC_KINDS,He as DOC_TAG,ge as ELEMENT_TAG_PATTERN,Mt as ENGINE_NAMESPACE,Kt as EXPLANATION_TAG,Bt as EngineIssue,Qt as FEEDBACK_TAG,st as FEEDBACK_VARIANTS,De as FIGURE_TAG,vt as FLAG_SELECTED,he as FORMAT_VERSION,Yt as HELP_ATTRIBUTES,Ve as HELP_TAGS,pe as HINT_TAG,It as INERT_STYLE,Ee as INLINE_TAGS,$t as JSON_MEDIA_TYPE,zt as KEY_FORMAT_VERSION,Pe as LANGUAGE_TAG_PATTERN,gt as MAX_ANSWER_COUNT,tt as MAX_ANSWER_LENGTH,Qe as MAX_ATTRIBUTES_PER_ELEMENT,Xe as MAX_COLUMNS,et as MAX_NESTING_DEPTH,Gt as MAX_OPEN_ANSWER_LENGTH,de as MAX_REQUEST_BYTES,wt as MAX_SOURCE_LENGTH,Le as MIN_COLUMNS,Pt as MessageSyntaxError,ue as OPAQUE_ID_PATTERN,Zt as OPEN_SLOT_KIND,ce as PAGE_ATTRIBUTES,C as PAGE_TAG,v as PRACTICE_POLICY,Ge as PROBLEM_MEDIA_TYPE,xe as PROTOCOL_VERSION,Ye as PlayerEvent,Ue as ProblemCode,qe as ProtocolPath,ft as REMOVED_WITH_CONTENT,Ie as SCORING_ATTRIBUTES,Ce as SCORING_RULES,je as SNAPSHOT_FORMAT,Ae as SOURCE_ID_PATTERN,E as STYLE_OPEN,Vt as STYLE_TAG,Rt as STYLE_TEMPLATE_ATTRIBUTE,xt as STYLE_TEMPLATE_NAME,Me as SUPPORTED_FORMATS,kt as TAG_ATTRIBUTES,Ft as TEST_POLICY,Lt as URL_ATTRIBUTES,kn as UploadRefused,se as allAttributes,h as builtInDefinitions,Sr as builtInEditors,Ne as builtInElements,le as builtInStyleTemplates,dt as checkCatalog,Ut as childElements,pt as childTagConflict,ht as compareCatalogs,jn as createAuthoring,Et as createI18n,si as createTextareaAdapter,Fi as defineEditor,b as directionOf,ut as element,ot as fitsAnswer,Oe as groupMax,lt as hasErrors,Te as helpPolicy,Ot as icuFormatter,bt as inertStyles,ct as isAnswerKey,Jt as isAnswers,Ze as isAttemptPolicy,mt as isElement,ve as isOpaqueId,ye as isProblemDetails,it as isSafeUrl,Fe as isSnapshot,we as isSourceId,at as isStyleTemplate,O as loadStyleElements,Be as maxAnswerLength,yt as messageParams,Wt as negotiateLocale,_t as parseMessage,nt as pluralCategories,Re as roundScore,Ht as sameChildSpec,jt as strictUrlPolicy,Nt as text,Dt as textContent,Ct as tokensCss,At as variantAttribute};
|
|
1441
|
+
//# sourceMappingURL=astrolabe-editor.js.map
|