@astl/astrolabe 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/LICENSE +202 -0
  3. package/README.md +65 -0
  4. package/dist/cdn/astrolabe-editor.js +1441 -0
  5. package/dist/cdn/astrolabe-editor.js.map +1 -0
  6. package/dist/cdn/astrolabe-player.js +2 -0
  7. package/dist/cdn/astrolabe-player.js.map +1 -0
  8. package/dist/cdn/astrolabe.css +238 -0
  9. package/dist/cdn/astrolabe.js +3 -0
  10. package/dist/cdn/astrolabe.js.map +1 -0
  11. package/dist/cdn/astrolabe.standalone.js +8007 -0
  12. package/dist/cdn/chunks/audio-B0LSIn5N.js +48 -0
  13. package/dist/cdn/chunks/audio-B0LSIn5N.js.map +1 -0
  14. package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js +2 -0
  15. package/dist/cdn/chunks/audio-manifest-B9FWQzRy.js.map +1 -0
  16. package/dist/cdn/chunks/block-styles-CKo9x7Vt.js +68 -0
  17. package/dist/cdn/chunks/block-styles-CKo9x7Vt.js.map +1 -0
  18. package/dist/cdn/chunks/book-CHzDDaim.js +15 -0
  19. package/dist/cdn/chunks/book-CHzDDaim.js.map +1 -0
  20. package/dist/cdn/chunks/callout-QFLFLPc5.js +49 -0
  21. package/dist/cdn/chunks/callout-QFLFLPc5.js.map +1 -0
  22. package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js +2 -0
  23. package/dist/cdn/chunks/callout-manifest-Cb12O4jl.js.map +1 -0
  24. package/dist/cdn/chunks/categorise-BO2tNVJ3.js +203 -0
  25. package/dist/cdn/chunks/categorise-BO2tNVJ3.js.map +1 -0
  26. package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js +2 -0
  27. package/dist/cdn/chunks/categorise-manifest-C_hEDVYQ.js.map +1 -0
  28. package/dist/cdn/chunks/chip-styles-Dme5daTO.js +77 -0
  29. package/dist/cdn/chunks/chip-styles-Dme5daTO.js.map +1 -0
  30. package/dist/cdn/chunks/choice-CExBvqKj.js +136 -0
  31. package/dist/cdn/chunks/choice-CExBvqKj.js.map +1 -0
  32. package/dist/cdn/chunks/choice-manifest-C-XahD7m.js +2 -0
  33. package/dist/cdn/chunks/choice-manifest-C-XahD7m.js.map +1 -0
  34. package/dist/cdn/chunks/color-control-Cl5cuMSO.js +91 -0
  35. package/dist/cdn/chunks/color-control-Cl5cuMSO.js.map +1 -0
  36. package/dist/cdn/chunks/crossword-Cb-a3Tjj.js +270 -0
  37. package/dist/cdn/chunks/crossword-Cb-a3Tjj.js.map +1 -0
  38. package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js +2 -0
  39. package/dist/cdn/chunks/crossword-manifest-2qlu7AYd.js.map +1 -0
  40. package/dist/cdn/chunks/declarations-BhqOz1ap.js +2 -0
  41. package/dist/cdn/chunks/declarations-BhqOz1ap.js.map +1 -0
  42. package/dist/cdn/chunks/definitions-CNX90WtL.js +6 -0
  43. package/dist/cdn/chunks/definitions-CNX90WtL.js.map +1 -0
  44. package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js +14 -0
  45. package/dist/cdn/chunks/directive-helpers-D7lOZKnB.js.map +1 -0
  46. package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js +2 -0
  47. package/dist/cdn/chunks/drop-manifest-bzNOa5ks.js.map +1 -0
  48. package/dist/cdn/chunks/drop-vRXndjHu.js +86 -0
  49. package/dist/cdn/chunks/drop-vRXndjHu.js.map +1 -0
  50. package/dist/cdn/chunks/flash-cards-0NrrKdrx.js +87 -0
  51. package/dist/cdn/chunks/flash-cards-0NrrKdrx.js.map +1 -0
  52. package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js +2 -0
  53. package/dist/cdn/chunks/flash-cards-manifest-B8nWXbRy.js.map +1 -0
  54. package/dist/cdn/chunks/gap-lor-khst.js +78 -0
  55. package/dist/cdn/chunks/gap-lor-khst.js.map +1 -0
  56. package/dist/cdn/chunks/gap-manifest-RSydA41N.js +2 -0
  57. package/dist/cdn/chunks/gap-manifest-RSydA41N.js.map +1 -0
  58. package/dist/cdn/chunks/help-C-woafz5.js +138 -0
  59. package/dist/cdn/chunks/help-C-woafz5.js.map +1 -0
  60. package/dist/cdn/chunks/help-form-DaC6KaFG.js +160 -0
  61. package/dist/cdn/chunks/help-form-DaC6KaFG.js.map +1 -0
  62. package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js +2 -0
  63. package/dist/cdn/chunks/hotspot-manifest-CNs1oiZ_.js.map +1 -0
  64. package/dist/cdn/chunks/hotspot-oel1Eelo.js +154 -0
  65. package/dist/cdn/chunks/hotspot-oel1Eelo.js.map +1 -0
  66. package/dist/cdn/chunks/image-drop-Dkprw0Kn.js +295 -0
  67. package/dist/cdn/chunks/image-drop-Dkprw0Kn.js.map +1 -0
  68. package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js +2 -0
  69. package/dist/cdn/chunks/image-drop-manifest-BZ6hCoAd.js.map +1 -0
  70. package/dist/cdn/chunks/image-label-Dm5shQSh.js +177 -0
  71. package/dist/cdn/chunks/image-label-Dm5shQSh.js.map +1 -0
  72. package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js +2 -0
  73. package/dist/cdn/chunks/image-label-manifest--1CLRJzd.js.map +1 -0
  74. package/dist/cdn/chunks/inline-styles-CTgXWnHb.js +80 -0
  75. package/dist/cdn/chunks/inline-styles-CTgXWnHb.js.map +1 -0
  76. package/dist/cdn/chunks/insert-menu-LgrifBYT.js +80 -0
  77. package/dist/cdn/chunks/insert-menu-LgrifBYT.js.map +1 -0
  78. package/dist/cdn/chunks/issue-list-BgnXzXRM.js +51 -0
  79. package/dist/cdn/chunks/issue-list-BgnXzXRM.js.map +1 -0
  80. package/dist/cdn/chunks/keys-DU-Qknmz.js +2 -0
  81. package/dist/cdn/chunks/keys-DU-Qknmz.js.map +1 -0
  82. package/dist/cdn/chunks/live-jdiyYln2.js +7 -0
  83. package/dist/cdn/chunks/live-jdiyYln2.js.map +1 -0
  84. package/dist/cdn/chunks/long-answer-CtzClLAx.js +71 -0
  85. package/dist/cdn/chunks/long-answer-CtzClLAx.js.map +1 -0
  86. package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js +2 -0
  87. package/dist/cdn/chunks/long-answer-manifest-BYJpZRtB.js.map +1 -0
  88. package/dist/cdn/chunks/mark-words-CpH3gTcX.js +131 -0
  89. package/dist/cdn/chunks/mark-words-CpH3gTcX.js.map +1 -0
  90. package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js +2 -0
  91. package/dist/cdn/chunks/mark-words-manifest-Cs2pXCEx.js.map +1 -0
  92. package/dist/cdn/chunks/match-DKE_4o-x.js +352 -0
  93. package/dist/cdn/chunks/match-DKE_4o-x.js.map +1 -0
  94. package/dist/cdn/chunks/match-manifest-D0UfoajU.js +2 -0
  95. package/dist/cdn/chunks/match-manifest-D0UfoajU.js.map +1 -0
  96. package/dist/cdn/chunks/memory-B6hSyHyz.js +187 -0
  97. package/dist/cdn/chunks/memory-B6hSyHyz.js.map +1 -0
  98. package/dist/cdn/chunks/memory-manifest-D1589iR0.js +2 -0
  99. package/dist/cdn/chunks/memory-manifest-D1589iR0.js.map +1 -0
  100. package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js +2 -0
  101. package/dist/cdn/chunks/menu-messages-Dx3jYUEp.js.map +1 -0
  102. package/dist/cdn/chunks/messages-9xiYDvRT.js +2 -0
  103. package/dist/cdn/chunks/messages-9xiYDvRT.js.map +1 -0
  104. package/dist/cdn/chunks/option-styles-WKzjKmCH.js +50 -0
  105. package/dist/cdn/chunks/option-styles-WKzjKmCH.js.map +1 -0
  106. package/dist/cdn/chunks/order-BhG_6IC-.js +225 -0
  107. package/dist/cdn/chunks/order-BhG_6IC-.js.map +1 -0
  108. package/dist/cdn/chunks/order-manifest-J5IXN0he.js +2 -0
  109. package/dist/cdn/chunks/order-manifest-J5IXN0he.js.map +1 -0
  110. package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js +2 -0
  111. package/dist/cdn/chunks/pick-and-place-DVQIPYuL.js.map +1 -0
  112. package/dist/cdn/chunks/picture-D10YRMYH.js +2 -0
  113. package/dist/cdn/chunks/picture-D10YRMYH.js.map +1 -0
  114. package/dist/cdn/chunks/picture-view-BKnAyScQ.js +92 -0
  115. package/dist/cdn/chunks/picture-view-BKnAyScQ.js.map +1 -0
  116. package/dist/cdn/chunks/repeat-CY2W2URZ.js +8 -0
  117. package/dist/cdn/chunks/repeat-CY2W2URZ.js.map +1 -0
  118. package/dist/cdn/chunks/roving-focus-BxGgi2DD.js +2 -0
  119. package/dist/cdn/chunks/roving-focus-BxGgi2DD.js.map +1 -0
  120. package/dist/cdn/chunks/runtime-DxAbpr3S.js +526 -0
  121. package/dist/cdn/chunks/runtime-DxAbpr3S.js.map +1 -0
  122. package/dist/cdn/chunks/scan-jWgPnVxA.js +2 -0
  123. package/dist/cdn/chunks/scan-jWgPnVxA.js.map +1 -0
  124. package/dist/cdn/chunks/select-DTA3dJzr.js +345 -0
  125. package/dist/cdn/chunks/select-DTA3dJzr.js.map +1 -0
  126. package/dist/cdn/chunks/select-manifest-BBMbvdkH.js +2 -0
  127. package/dist/cdn/chunks/select-manifest-BBMbvdkH.js.map +1 -0
  128. package/dist/cdn/chunks/source-view-DXKPFCl9.js +29 -0
  129. package/dist/cdn/chunks/source-view-DXKPFCl9.js.map +1 -0
  130. package/dist/cdn/chunks/style-form-D5haJtWM.js +240 -0
  131. package/dist/cdn/chunks/style-form-D5haJtWM.js.map +1 -0
  132. package/dist/cdn/chunks/style-messages-BbZpeD2a.js +2 -0
  133. package/dist/cdn/chunks/style-messages-BbZpeD2a.js.map +1 -0
  134. package/dist/cdn/chunks/style-model-ZXNe_c8R.js +2 -0
  135. package/dist/cdn/chunks/style-model-ZXNe_c8R.js.map +1 -0
  136. package/dist/cdn/chunks/style-placing-DPw1zyrz.js +2 -0
  137. package/dist/cdn/chunks/style-placing-DPw1zyrz.js.map +1 -0
  138. package/dist/cdn/chunks/style-popups-BobgX1WK.js +74 -0
  139. package/dist/cdn/chunks/style-popups-BobgX1WK.js.map +1 -0
  140. package/dist/cdn/chunks/style-rules-D45PZLCv.js +136 -0
  141. package/dist/cdn/chunks/style-rules-D45PZLCv.js.map +1 -0
  142. package/dist/cdn/chunks/styled-Dmx5Yjv7.js +57 -0
  143. package/dist/cdn/chunks/styled-Dmx5Yjv7.js.map +1 -0
  144. package/dist/cdn/chunks/styles-DxJJxVNH.js +136 -0
  145. package/dist/cdn/chunks/styles-DxJJxVNH.js.map +1 -0
  146. package/dist/cdn/chunks/surface-CgxfAwCR.js +1019 -0
  147. package/dist/cdn/chunks/surface-CgxfAwCR.js.map +1 -0
  148. package/dist/cdn/chunks/true-false-DP3MO599.js +146 -0
  149. package/dist/cdn/chunks/true-false-DP3MO599.js.map +1 -0
  150. package/dist/cdn/chunks/true-false-manifest-B4exv60u.js +2 -0
  151. package/dist/cdn/chunks/true-false-manifest-B4exv60u.js.map +1 -0
  152. package/dist/cdn/chunks/video-j9MCH6Kw.js +98 -0
  153. package/dist/cdn/chunks/video-j9MCH6Kw.js.map +1 -0
  154. package/dist/cdn/chunks/video-manifest-8OwkhhAI.js +2 -0
  155. package/dist/cdn/chunks/video-manifest-8OwkhhAI.js.map +1 -0
  156. package/dist/cdn/chunks/word-bank-ARjwUKZf.js +80 -0
  157. package/dist/cdn/chunks/word-bank-ARjwUKZf.js.map +1 -0
  158. package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js +2 -0
  159. package/dist/cdn/chunks/word-bank-manifest-C1FSo1kH.js.map +1 -0
  160. package/dist/cdn/chunks/word-search-AHvM7yCJ.js +274 -0
  161. package/dist/cdn/chunks/word-search-AHvM7yCJ.js.map +1 -0
  162. package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js +2 -0
  163. package/dist/cdn/chunks/word-search-manifest-Fg1a59Z1.js.map +1 -0
  164. package/dist/editor.d.ts +32 -0
  165. package/dist/editor.d.ts.map +1 -0
  166. package/dist/editor.js +51 -0
  167. package/dist/editor.js.map +1 -0
  168. package/dist/engine.d.ts +33 -0
  169. package/dist/engine.d.ts.map +1 -0
  170. package/dist/engine.js +53 -0
  171. package/dist/engine.js.map +1 -0
  172. package/dist/player.d.ts +19 -0
  173. package/dist/player.d.ts.map +1 -0
  174. package/dist/player.js +22 -0
  175. package/dist/player.js.map +1 -0
  176. package/dist/server.d.ts +8 -0
  177. package/dist/server.d.ts.map +1 -0
  178. package/dist/server.js +8 -0
  179. package/dist/server.js.map +1 -0
  180. package/package.json +70 -4
  181. package/src/bundles/astrolabe-editor.ts +11 -0
  182. package/src/bundles/astrolabe-player.ts +10 -0
  183. package/src/bundles/astrolabe-standalone.ts +23 -0
  184. package/src/bundles/astrolabe.ts +12 -0
  185. package/src/editor.ts +98 -0
  186. package/src/engine.ts +59 -0
  187. package/src/player.ts +23 -0
  188. package/src/server.ts +7 -0
@@ -0,0 +1,240 @@
1
+ import{C as e,E as t,b as n}from"./runtime-DxAbpr3S.js";import{c as r,i,n as a,o,p as s}from"./declarations-BhqOz1ap.js";import{a as c}from"./style-model-ZXNe_c8R.js";import{n as l,r as u}from"./styles-DxJJxVNH.js";import{t as d}from"./live-jdiyYln2.js";import{n as f,o as p,r as m,t as h}from"./style-placing-DPw1zyrz.js";import{t as g}from"./style-messages-BbZpeD2a.js";import{n as _,t as v}from"./color-control-Cl5cuMSO.js";var y={kind:`font`,property:`font-family`},b={kind:`number`,property:`width`,unit:`%`,min:1,max:100},x={kind:`position`,property:`position`},S=[y,{kind:`number`,property:`font-size`,unit:`px`,min:10,max:96},{kind:`select`,property:`font-weight`,options:[`normal`,`bold`]},{kind:`select`,property:`font-style`,options:[`normal`,`italic`]},{kind:`color`,property:`color`},{kind:`select`,property:`text-align`,options:[`start`,`center`,`end`,`justify`]},{kind:`number`,property:`line-height`,unit:``,min:.8,max:4,step:.05}],C=[{kind:`color`,property:`background-color`},{kind:`number`,property:`border-width`,unit:`px`,min:0,max:16},{kind:`select`,property:`border-style`,options:[`none`,`solid`,`dashed`,`dotted`,`double`]},{kind:`color`,property:`border-color`},{kind:`number`,property:`border-radius`,unit:`px`,min:0,max:128}],w=[{kind:`number`,property:`padding`,unit:`px`,min:0,max:64},{kind:`number`,property:`margin-block-start`,unit:`px`,min:0,max:128},{kind:`number`,property:`margin-block-end`,unit:`px`,min:0,max:128}],T=(e,t)=>{let n=[`text`,S],r=[`box`,C],i=[`spacing`,w],a=[`size`,[x,b]];switch(e){case`picture`:return t?[r]:[a,r];case`figure`:return[a,r,i,n];case`layout`:return[[`size`,[{kind:`number`,property:`gap`,unit:`px`,min:0,max:64},{kind:`select`,property:`align-items`,options:[`stretch`,`start`,`center`,`end`]}]],r,i,n];case`column`:return[[`size`,[{kind:`number`,property:`flex-grow`,unit:``,min:0,max:12}]],r,i,n];case`component`:return[n,r,i,a];case`named`:case`block`:return[n,r,i,[`size`,[b]]];default:return[n,r,i]}};function E(e,t){return e.length>2e3?[{name:`style`,reason:`length`}]:t.map(e=>({name:e,reason:i.includes(e)?`value`:/^-{0,2}[a-z][a-z-]*$/.test(e)?`property`:`text`}))}var D=(e,t)=>{let n=/^(\d*\.?\d+)([a-z%]*)$/.exec(e??``);if(n===null)return null;let[,r,i]=n;return i===t||r===`0`||t===``&&i===``?r:null},O=class extends u{static properties={...u.properties,target:{},rule:{attribute:!1}};static styles=[l,_,t`
2
+ .form {
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: var(--astl-space-2);
6
+ }
7
+ details {
8
+ border: var(--astl-outline-width) solid var(--astl-line);
9
+ border-radius: var(--astl-radius-m);
10
+ }
11
+ summary {
12
+ box-sizing: border-box;
13
+ min-block-size: var(--astl-target-min);
14
+ padding-block: calc((var(--astl-target-min) - 1lh) / 2);
15
+ padding-inline: var(--astl-space-3);
16
+ font-weight: 600;
17
+ cursor: pointer;
18
+ }
19
+ .fields {
20
+ display: grid;
21
+ grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
22
+ gap: var(--astl-space-3);
23
+ padding: var(--astl-space-3);
24
+ padding-block-start: var(--astl-space-1);
25
+ }
26
+ .field {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: var(--astl-space-1);
30
+ min-inline-size: 0;
31
+ }
32
+ .field.wide,
33
+ .fields > fieldset {
34
+ grid-column: 1 / -1;
35
+ }
36
+ fieldset {
37
+ margin: 0;
38
+ padding: 0;
39
+ border: 0;
40
+ min-inline-size: 0;
41
+ }
42
+ legend,
43
+ label {
44
+ padding: 0;
45
+ font-weight: 600;
46
+ }
47
+ legend {
48
+ margin-block-end: var(--astl-space-1);
49
+ }
50
+ .unit {
51
+ display: flex;
52
+ align-items: center;
53
+ gap: var(--astl-space-1);
54
+ }
55
+ .unit span {
56
+ flex: none;
57
+ color: var(--astl-ink-muted);
58
+ }
59
+ textarea {
60
+ font-family: var(--astl-font-mono, monospace);
61
+ font-size: var(--astl-size-small);
62
+ }
63
+ .refused {
64
+ margin: 0;
65
+ padding: var(--astl-space-2);
66
+ border-inline-start: var(--astl-space-1) solid var(--astl-danger);
67
+ background: var(--astl-danger-soft);
68
+ }
69
+ .refused ul {
70
+ gap: var(--astl-space-1);
71
+ }
72
+ .save {
73
+ display: grid;
74
+ grid-template-columns: minmax(0, 1fr) auto;
75
+ gap: var(--astl-space-2);
76
+ align-items: end;
77
+ }
78
+ .save label {
79
+ grid-column: 1 / -1;
80
+ }
81
+ .layout {
82
+ flex-direction: row;
83
+ flex-wrap: wrap;
84
+ align-items: center;
85
+ gap: var(--astl-space-2);
86
+ }
87
+ .layout [role='alert'] {
88
+ flex-basis: 100%;
89
+ }
90
+ `];#e=[];#t=!1;#n=new Set;#r=null;#i=``;#a=``;#o=!1;constructor(){super(),this.target=null,this.rule=null}cursorChanged(){this.requestUpdate()}willUpdate(e){super.willUpdate(e),e.has(`authoring`)&&this.authoring?.addMessages(g);let t=this.rule===null?this.#c()?.kind??``:`rule ${this.rule.name??this.rule.for}`;t!==this.#a&&(this.#o=!1,this.#e=[],this.#r=null,this.#n.clear()),this.#a=t}updated(e){if(super.updated(e),!this.#t)return;this.#t=!1;let t=this.renderRoot.querySelector(`#own-refused`);t?.closest(`details`)?.setAttribute(`open`,``),t?.scrollIntoView({block:`nearest`})}#s(){return this.adapter?.style??null}#c(){let e=this.#s()?.state().targets??[];return(this.target===null?e[0]:e.find(e=>e.kind===this.target))??null}#l(){let e=this.rule;return e===null?null:this.#s()?.rules().find(t=>e.name===void 0?t.for===e.for:t.name===e.name)??{...e.name===void 0?{}:{name:e.name},...e.for===void 0?{}:{for:e.for},style:``}}#u(e){let t=this.#s();if(t===null)return;let n=this.#l();if(n!==null){let i=new Set(Object.keys(e)),a=o(Object.entries(e).flatMap(([e,t])=>t===null?[]:[`${e}: ${t}`]).join(`; `)).declarations,c=s(r(o(n.style).declarations.filter(([e])=>!i.has(e)),a));t.setRule({...n,style:c})}else{let n=this.#c();n!==null&&t.setTarget(n.kind,e)}this.#e=[],this.#r=null,this.requestUpdate()}#d(e,t){if(t!==null){let{removed:n}=o(`${e}: ${t}`);if(n.length>0){this.#e=E(``,n),this.#t=!0,this.requestUpdate();return}}this.#u({[e]:t})}#f(e){let t=this.#s();if(t===null)return;let n=o(e),r=this.#l();if(r!==null)t.setRule({...r,style:n.style});else{let e=this.#c();e!==null&&t.replaceTarget(e.kind,n.style)}this.#e=E(e,n.removed),this.#t=this.#e.length>0,this.#r=null,this.requestUpdate()}#p(e){return this.t(`style.field.${e.property}`)}#m(t,r,i,a){let s=`${a}-${t.property}`,c=this.#p(t),l=r.get(t.property);switch(t.kind){case`number`:{let r=D(l,t.unit);return e`<div class="field" part="field">
91
+ <label for=${s} part="label">${c}</label>
92
+ <div class="unit">
93
+ <input
94
+ id=${s}
95
+ type="number"
96
+ inputmode="decimal"
97
+ data-property=${t.property}
98
+ min=${t.min}
99
+ max=${t.max}
100
+ step=${t.step??1}
101
+ placeholder=${r===null?l??``:``}
102
+ .value=${d(r??``)}
103
+ @change=${e=>{let n=e.target.value.trim();t.property===`width`&&n!==``&&o(`width: ${n}%`).removed.length===0?this.#u(p(i,Number(n))):this.#d(t.property,n===``?null:`${n}${t.unit}`)}}
104
+ />
105
+ ${t.unit===``?n:e`<span aria-hidden="true">${t.unit}</span>`}
106
+ </div>
107
+ </div>`}case`select`:return e`<div class="field" part="field">
108
+ <label for=${s} part="label">${c}</label>
109
+ <select
110
+ id=${s}
111
+ data-property=${t.property}
112
+ .value=${d(l??``)}
113
+ @change=${e=>{let n=e.target.value;this.#d(t.property,n===``?null:n)}}
114
+ >
115
+ <option value="">${this.t(`toolbar.default`)}</option>
116
+ ${t.options.map(t=>e`<option value=${t} ?selected=${t===l}>${this.t(`style.value.${t}`)}</option>`)}
117
+ </select>
118
+ </div>`;case`font`:{let r=this.authoring?.fonts??[],i=l!==void 0&&!r.some(e=>e.stack===l);return e`<div class="field wide" part="field">
119
+ <label for=${s} part="label">${c}</label>
120
+ <select
121
+ id=${s}
122
+ data-property=${t.property}
123
+ .value=${d(l??``)}
124
+ @change=${e=>{let n=e.target.value;this.#d(t.property,n===``?null:n)}}
125
+ >
126
+ <option value="">${this.t(`toolbar.default`)}</option>
127
+ ${r.map(t=>e`<option value=${t.stack} ?selected=${t.stack===l}>${t.name}</option>`)}
128
+ ${i?e`<option value=${l} selected>${l}</option>`:n}
129
+ </select>
130
+ </div>`}case`position`:{let t=m(i);return e`<div class="field wide" part="field">
131
+ <label for=${s} part="label">${c}</label>
132
+ <select
133
+ id=${s}
134
+ data-property="position"
135
+ .value=${d(t)}
136
+ @change=${e=>{let t=e.target.value;this.#u(f(t,i,this.#c()?.kind===`figure`))}}
137
+ >
138
+ ${h.map(n=>e`<option value=${n} ?selected=${n===t}>${this.t(`style.position.${n}`)}</option>`)}
139
+ </select>
140
+ </div>`}case`color`:return e`<fieldset part="field" data-property=${t.property}>
141
+ <legend part="label">${c}</legend>
142
+ ${v({id:s,value:l??null,t:(e,t)=>this.t(e,t),invalid:this.#n.has(t.property),ground:t.property===`background-color`,pick:e=>{this.#n.delete(t.property),this.#d(t.property,e)},refuse:()=>{this.#n.add(t.property),this.requestUpdate()}})}
143
+ </fieldset>`}}#h(){return this.#e.length===0?n:e`<div class="refused" id="own-refused">
144
+ <ul>
145
+ ${this.#e.map(({name:t,reason:n})=>e`<li data-refused=${t}>${this.t(`style.refused.${n}`,{name:t,max:a})}</li>`)}
146
+ </ul>
147
+ </div>`}#g(t){let r=(this.#s()?.rules()??[]).filter(e=>e.name!==void 0),i=new Set(r.map(e=>e.name)),a=(this.authoring?.styles??[]).filter(e=>!i.has(e.name));return e`<details part="section" data-section="named">
148
+ <summary>${this.t(`style.section.named`)}</summary>
149
+ <div class="fields">
150
+ <div class="field wide" part="field">
151
+ <label for="named" part="label">${this.t(`style.field.named`)}</label>
152
+ <select
153
+ id="named"
154
+ .value=${d(t.className??``)}
155
+ @change=${e=>{let n=e.target.value,r=a.find(e=>e.name===n);r===void 0?this.#s()?.setClass(t.kind,n===``?null:n):this.#s()?.setClass(t.kind,n,{name:n,label:r.label,style:r.style}),this.requestUpdate()}}
156
+ >
157
+ <option value="">${this.t(`style.named.none`)}</option>
158
+ ${r.map(n=>e`<option value=${n.name??``} ?selected=${n.name===t.className}>${n.label??n.name}</option>`)}
159
+ ${a.length===0?n:e`<optgroup label=${this.t(`toolbar.readyStyles`)}>
160
+ ${a.map(n=>e`<option value=${n.name} ?selected=${n.name===t.className}>${n.label}</option>`)}
161
+ </optgroup>`}
162
+ </select>
163
+ </div>
164
+ <div class="save field wide">
165
+ <label for="save-label" part="label">${this.t(`style.save.label`)}</label>
166
+ <input
167
+ id="save-label"
168
+ type="text"
169
+ autocomplete="off"
170
+ .value=${this.#i}
171
+ @input=${e=>{this.#i=e.target.value}}
172
+ @keydown=${e=>{e.key===`Enter`&&(e.preventDefault(),this.#_(t))}}
173
+ />
174
+ <button type="button" data-save @click=${()=>this.#_(t)}>${this.t(`style.save`)}</button>
175
+ </div>
176
+ </div>
177
+ </details>`}#_(e){let t=this.#i.trim();t===``?this.renderRoot.querySelector(`#save-label`)?.focus():(this.#s()?.saveRule(e.kind,t)!==null&&(this.#i=``),this.requestUpdate())}#v(e){this.#o=!1,this.#s()?.editLayout?.(e),this.requestUpdate()}#y(){let t=this.#s(),r=t?.layout?.()??null;if(t?.editLayout===void 0||r===null)return n;let i=this.#o;return e`<details open part="section" data-section="layout">
178
+ <summary>${this.t(`layout.section`)}</summary>
179
+ <div class="fields">
180
+ <div class="field wide" part="field">
181
+ <label for="layout-shape" part="label">${this.t(`layout.change`)}</label>
182
+ <select
183
+ id="layout-shape"
184
+ @change=${e=>{let t=e.target.value;t!==``&&this.#v(t)}}
185
+ >
186
+ ${r.shape===null?e`<option value="" selected>${this.t(`layout.other`)}</option>`:n}
187
+ ${c.map(t=>e`<option value=${t} ?selected=${t===r.shape}>
188
+ ${this.t(`insert.layout.${t}`)}
189
+ </option>`)}
190
+ </select>
191
+ </div>
192
+ <div class="layout wide field" role="group" aria-label=${this.t(`layout.section`)}>
193
+ ${i?e`<span role="alert">${this.t(`layout.confirm`)}</span>
194
+ <button type="button" @click=${()=>this.#v(`delete`)}>
195
+ ${this.t(`layout.confirmDelete`)}
196
+ </button>
197
+ <button
198
+ type="button"
199
+ data-cancel
200
+ @click=${()=>{this.#o=!1,this.requestUpdate()}}
201
+ >
202
+ ${this.t(`layout.cancel`)}
203
+ </button>`:e`<button type="button" @click=${()=>this.#v(`unwrap`)}>
204
+ ${this.t(`layout.unwrap`)}
205
+ </button>
206
+ <button
207
+ type="button"
208
+ @click=${()=>{r.empty?this.#v(`delete`):(this.#o=!0,this.requestUpdate(),this.updateComplete.then(()=>this.renderRoot.querySelector(`[data-cancel]`)?.focus()))}}
209
+ >
210
+ ${this.t(`layout.delete`)}
211
+ </button>`}
212
+ </div>
213
+ </div>
214
+ </details>`}render(){let t=this.#s();if(this.authoring===null)return n;let{lang:r,dir:i}=this.ui,a=this.#l(),s=a===null?this.#c():null;if(t===null||a===null&&s===null)return e`<p class="note" lang=${r} dir=${i}>${this.t(`style.form.none`)}</p>`;let c=a?.style??s?.style??``,l=new Map(o(c).declarations),u=s?.kind===`picture`&&t.state().targets.some(e=>e.kind===`figure`),f=a===null?s?.kind:a.name===void 0?a.for===`img`?`picture`:`tag`:`named`,p=T(f,u),m=this.#r??c,h=s?.kind===`layout`;return e`<div class="form" part="root" lang=${r} dir=${i} data-kind=${f}>
215
+ ${h?this.#y():n}
216
+ ${p.map(([t,n],r)=>e`<details ?open=${r===0&&!h} part="section" data-section=${t}>
217
+ <summary>${this.t(`style.section.${t}`)}</summary>
218
+ <div class="fields">${n.map(e=>this.#m(e,l,c,t))}</div>
219
+ </details>`)}
220
+ ${s===null?n:this.#g(s)}
221
+ <details ?open=${!h} part="section" data-section="own">
222
+ <summary>${this.t(`style.section.own`)}</summary>
223
+ <div class="fields">
224
+ <div class="field wide" part="field">
225
+ <label for="own" part="label">${this.t(`style.field.own`)}</label>
226
+ <textarea
227
+ id="own"
228
+ rows="3"
229
+ spellcheck="false"
230
+ placeholder="background-color: #fff3cd; padding: 12px"
231
+ aria-describedby=${this.#e.length>0?`own-refused`:n}
232
+ .value=${d(m)}
233
+ @change=${e=>this.#f(e.target.value)}
234
+ ></textarea>
235
+ <div role="alert">${this.#h()}</div>
236
+ </div>
237
+ </div>
238
+ </details>
239
+ </div>`}};export{O as AstlStyleForm};
240
+ //# sourceMappingURL=style-form-D5haJtWM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-form-D5haJtWM.js","names":["live","nothing","b","i","A","mergeStyles","MAX_STYLE_LENGTH","styleText","LAYOUT_SHAPES","kitStyles","AuthoringElement","l","positionChanges","widthChanges","positionOf","PLACEMENTS","styleMessages","colorStyles","colorControl","FONT","WIDTH","POSITION","TEXT_FIELDS","BOX_FIELDS","SPACING_FIELDS","sectionsOf","text","box","spacing","place","kind","inFigure","refusals","style","removed","STYLE_PROPERTIES","name","numberIn","match","value","number","written","unit","AstlStyleForm","changed","key","#element","#shown","#askDelete","#refused","#draft","#badColors","#revealRefused","note","targets","#styles","one","rule","styles","#currentRule","gone","changes","adding","cleanStyle","element","property","#write","clean","field","id","at","label","#fieldLabel","declared","shown","event","#commit","next","option","fonts","other","font","position","params","reason","named","own","ready","preset","#saveLabel","#save","edit","state","ask","#editLayout","shape","lang","dir","sections","layout","#layout","section","fields","#field","#named","#applyOwn","#refusedList"],"sources":["../../../../editor/src/elements/style-form.ts"],"sourcesContent":["import type {\n EditorLayoutEdit,\n EditorLayoutShape,\n EditorStyleChanges,\n EditorStyleRule,\n EditorStyleTarget,\n EditorStyleTargetKind,\n} from '@astl/core';\nimport {\n cleanStyle,\n MAX_STYLE_LENGTH,\n mergeStyles,\n STYLE_PROPERTIES,\n styleText,\n} from '@astl/core/declarations';\nimport {\n type CSSResultGroup,\n css,\n html,\n nothing,\n type PropertyDeclarations,\n type PropertyValues,\n type TemplateResult,\n} from 'lit';\nimport { live } from 'lit/directives/live.js';\nimport { styleMessages } from '../style-messages.js';\nimport { LAYOUT_SHAPES } from '../style-model.js';\nimport { PLACEMENTS, type Placement, positionChanges, positionOf, widthChanges } from '../style-placing.js';\nimport { AuthoringElement } from './base.js';\nimport { colorControl, colorStyles } from './color-control.js';\nimport { kitStyles } from './styles.js';\n\n/** A field of the form, table-driven: one property, with the control its values ask for. */\ntype Field =\n | {\n readonly kind: 'number';\n readonly property: string;\n readonly unit: 'px' | '%' | '';\n readonly min: number;\n readonly max: number;\n readonly step?: number;\n }\n | { readonly kind: 'select'; readonly property: string; readonly options: readonly string[] }\n | { readonly kind: 'font'; readonly property: 'font-family' }\n | { readonly kind: 'color'; readonly property: string }\n | { readonly kind: 'position'; readonly property: 'position' };\n\ntype Section = 'text' | 'box' | 'spacing' | 'size';\n\nconst FONT: Field = { kind: 'font', property: 'font-family' };\nconst WIDTH: Field = { kind: 'number', property: 'width', unit: '%', min: 1, max: 100 };\nconst POSITION: Field = { kind: 'position', property: 'position' };\n\nconst TEXT_FIELDS: readonly Field[] = [\n FONT,\n { kind: 'number', property: 'font-size', unit: 'px', min: 10, max: 96 },\n { kind: 'select', property: 'font-weight', options: ['normal', 'bold'] },\n { kind: 'select', property: 'font-style', options: ['normal', 'italic'] },\n { kind: 'color', property: 'color' },\n { kind: 'select', property: 'text-align', options: ['start', 'center', 'end', 'justify'] },\n { kind: 'number', property: 'line-height', unit: '', min: 0.8, max: 4, step: 0.05 },\n];\nconst BOX_FIELDS: readonly Field[] = [\n { kind: 'color', property: 'background-color' },\n { kind: 'number', property: 'border-width', unit: 'px', min: 0, max: 16 },\n { kind: 'select', property: 'border-style', options: ['none', 'solid', 'dashed', 'dotted', 'double'] },\n { kind: 'color', property: 'border-color' },\n { kind: 'number', property: 'border-radius', unit: 'px', min: 0, max: 128 },\n];\nconst SPACING_FIELDS: readonly Field[] = [\n { kind: 'number', property: 'padding', unit: 'px', min: 0, max: 64 },\n { kind: 'number', property: 'margin-block-start', unit: 'px', min: 0, max: 128 },\n { kind: 'number', property: 'margin-block-end', unit: 'px', min: 0, max: 128 },\n];\n\n/** What each kind of element can sensibly change, in the order it comes to mind; the first section starts open. */\nconst sectionsOf = (\n kind: EditorStyleTargetKind | 'tag' | 'named',\n inFigure: boolean,\n): readonly (readonly [Section, readonly Field[]])[] => {\n const text: [Section, readonly Field[]] = ['text', TEXT_FIELDS];\n const box: [Section, readonly Field[]] = ['box', BOX_FIELDS];\n const spacing: [Section, readonly Field[]] = ['spacing', SPACING_FIELDS];\n const place: [Section, readonly Field[]] = ['size', [POSITION, WIDTH]];\n switch (kind) {\n case 'picture':\n // A figure's picture fills the figure, which is what sits on the page.\n return inFigure ? [box] : [place, box];\n case 'figure':\n return [place, box, spacing, text];\n case 'layout':\n return [\n [\n 'size',\n [\n { kind: 'number', property: 'gap', unit: 'px', min: 0, max: 64 },\n {\n kind: 'select',\n property: 'align-items',\n options: ['stretch', 'start', 'center', 'end'],\n },\n ],\n ],\n box,\n spacing,\n text,\n ];\n case 'column':\n return [\n ['size', [{ kind: 'number', property: 'flex-grow', unit: '', min: 0, max: 12 }]],\n box,\n spacing,\n text,\n ];\n case 'component':\n // Placed as a picture is: an exercise can float with text beside it.\n return [text, box, spacing, place];\n case 'named':\n case 'block':\n return [text, box, spacing, ['size', [WIDTH]]];\n default:\n return [text, box, spacing];\n }\n};\n\n/** A refused declaration, with the reason a message says. */\ninterface Refusal {\n readonly name: string;\n readonly reason: 'property' | 'value' | 'text' | 'length';\n}\n\n/** Why the allow-list refused a declaration, from the name `cleanStyle` reports. */\nfunction refusals(style: string, removed: readonly string[]): readonly Refusal[] {\n if (style.length > MAX_STYLE_LENGTH) return [{ name: 'style', reason: 'length' }];\n return removed.map((name) => ({\n name,\n reason: STYLE_PROPERTIES.includes(name)\n ? 'value'\n : /^-{0,2}[a-z][a-z-]*$/.test(name)\n ? 'property'\n : 'text',\n }));\n}\n\n/** A number in the field's unit, or null for what the field cannot show (it says it as a placeholder). */\nconst numberIn = (value: string | undefined, unit: string): string | null => {\n const match = /^(\\d*\\.?\\d+)([a-z%]*)$/.exec(value ?? '');\n if (match === null) return null;\n const [, number, written] = match;\n return written === unit || number === '0' || (unit === '' && written === '') ? (number as string) : null;\n};\n\n/**\n * `<astl-style-form>`: the style of an element at the cursor (`target`, or what the cursor is innermost in), or of a\n * rule of the document (`rule`): text, background and border, spacing, size and position, the named style, and \"Own\n * CSS\", which says what the allow-list refused and why. \"Save as a style\" makes the element's own style a named one.\n * Each commit of a field (a `change`) is one undo step, and the focus stays in the form. The adapter's `style`\n * (`EditorStyles`) does the work; without it the form says so. Comes with `loadStyleElements`, on first use.\n */\nexport class AstlStyleForm extends AuthoringElement {\n static override properties: PropertyDeclarations = {\n ...AuthoringElement.properties,\n target: {},\n rule: { attribute: false },\n };\n\n static override styles: CSSResultGroup = [\n kitStyles,\n colorStyles,\n // A summary stays a list item, which keeps the marker that says it opens; its padding makes the line a target. The\n // layout's commands go in a row from the start, wrapping when narrow; its question has a line of its own.\n css`\n .form {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n }\n details {\n border: var(--astl-outline-width) solid var(--astl-line);\n border-radius: var(--astl-radius-m);\n }\n summary {\n box-sizing: border-box;\n min-block-size: var(--astl-target-min);\n padding-block: calc((var(--astl-target-min) - 1lh) / 2);\n padding-inline: var(--astl-space-3);\n font-weight: 600;\n cursor: pointer;\n }\n .fields {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));\n gap: var(--astl-space-3);\n padding: var(--astl-space-3);\n padding-block-start: var(--astl-space-1);\n }\n .field {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-1);\n min-inline-size: 0;\n }\n .field.wide,\n .fields > fieldset {\n grid-column: 1 / -1;\n }\n fieldset {\n margin: 0;\n padding: 0;\n border: 0;\n min-inline-size: 0;\n }\n legend,\n label {\n padding: 0;\n font-weight: 600;\n }\n legend {\n margin-block-end: var(--astl-space-1);\n }\n .unit {\n display: flex;\n align-items: center;\n gap: var(--astl-space-1);\n }\n .unit span {\n flex: none;\n color: var(--astl-ink-muted);\n }\n textarea {\n font-family: var(--astl-font-mono, monospace);\n font-size: var(--astl-size-small);\n }\n .refused {\n margin: 0;\n padding: var(--astl-space-2);\n border-inline-start: var(--astl-space-1) solid var(--astl-danger);\n background: var(--astl-danger-soft);\n }\n .refused ul {\n gap: var(--astl-space-1);\n }\n .save {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n gap: var(--astl-space-2);\n align-items: end;\n }\n .save label {\n grid-column: 1 / -1;\n }\n .layout {\n flex-direction: row;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--astl-space-2);\n }\n .layout [role='alert'] {\n flex-basis: 100%;\n }\n `,\n ];\n\n /** What the form styles, of what the cursor is in; null: the innermost. */\n declare target: EditorStyleTargetKind | null;\n /** A rule to edit in place of an element: by its `name`, or `for` a tag. */\n declare rule: Pick<EditorStyleRule, 'name' | 'for'> | null;\n\n /** The refused declarations of the last edit: shown until the next one. */\n #refused: readonly Refusal[] = [];\n /** New refusals to bring into view: in a host's card or sheet the form is taller than its box. */\n #revealRefused = false;\n /** Colour fields whose typed colour was refused. */\n #badColors = new Set<string>();\n /** The field's text when it was refused, kept so the author can correct it. */\n #draft: string | null = null;\n #saveLabel = '';\n /** What the form was last showing: moving to another element forgets the last refusals. */\n #shown = '';\n /** \"Delete with content\" was pressed on a layout that holds some: the form asks first. */\n #askDelete = false;\n\n constructor() {\n super();\n this.target = null;\n this.rule = null;\n }\n\n protected override cursorChanged(): void {\n this.requestUpdate();\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n super.willUpdate(changed);\n if (changed.has('authoring')) this.authoring?.addMessages(styleMessages);\n const key =\n this.rule === null ? (this.#element()?.kind ?? '') : `rule ${this.rule.name ?? this.rule.for}`;\n if (key !== this.#shown) {\n this.#askDelete = false;\n this.#refused = [];\n this.#draft = null;\n this.#badColors.clear();\n }\n this.#shown = key;\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n if (!this.#revealRefused) return;\n this.#revealRefused = false;\n const note = this.renderRoot.querySelector('#own-refused');\n note?.closest('details')?.setAttribute('open', '');\n note?.scrollIntoView({ block: 'nearest' });\n }\n\n #styles() {\n return this.adapter?.style ?? null;\n }\n\n #element(): EditorStyleTarget | null {\n const targets = this.#styles()?.state().targets ?? [];\n return (this.target === null ? targets[0] : targets.find((one) => one.kind === this.target)) ?? null;\n }\n\n #currentRule(): EditorStyleRule | null {\n const rule = this.rule;\n if (rule === null) return null;\n return (\n this.#styles()\n ?.rules()\n .find((one) => (rule.name !== undefined ? one.name === rule.name : one.for === rule.for)) ?? {\n ...(rule.name === undefined ? {} : { name: rule.name }),\n ...(rule.for === undefined ? {} : { for: rule.for }),\n style: '',\n }\n );\n }\n\n #write(changes: EditorStyleChanges): void {\n const styles = this.#styles();\n if (styles === null) return;\n const rule = this.#currentRule();\n if (rule !== null) {\n const gone = new Set(Object.keys(changes));\n const adding = cleanStyle(\n Object.entries(changes)\n .flatMap(([name, value]) => (value === null ? [] : [`${name}: ${value}`]))\n .join('; '),\n ).declarations;\n const style = styleText(\n mergeStyles(\n cleanStyle(rule.style).declarations.filter(([name]) => !gone.has(name)),\n adding,\n ),\n );\n styles.setRule({ ...rule, style });\n } else {\n const element = this.#element();\n if (element !== null) styles.setTarget(element.kind, changes);\n }\n this.#refused = [];\n this.#draft = null;\n this.requestUpdate();\n }\n\n /** One field's value: what the allow-list refuses is said, not written. */\n #commit(property: string, value: string | null): void {\n if (value !== null) {\n const { removed } = cleanStyle(`${property}: ${value}`);\n if (removed.length > 0) {\n this.#refused = refusals('', removed);\n this.#revealRefused = true;\n this.requestUpdate();\n return;\n }\n }\n this.#write({ [property]: value });\n }\n\n /** The \"Own CSS\" field: what the allow-list keeps is the new style, what it refuses is said and never written. */\n #applyOwn(text: string): void {\n const styles = this.#styles();\n if (styles === null) return;\n const clean = cleanStyle(text);\n const rule = this.#currentRule();\n if (rule !== null) styles.setRule({ ...rule, style: clean.style });\n else {\n const element = this.#element();\n if (element !== null) styles.replaceTarget(element.kind, clean.style);\n }\n this.#refused = refusals(text, clean.removed);\n this.#revealRefused = this.#refused.length > 0;\n // The field then shows what stays; the refusals say what went.\n this.#draft = null;\n this.requestUpdate();\n }\n\n #fieldLabel(field: Field): string {\n return this.t(`style.field.${field.property}`);\n }\n\n #field(field: Field, declared: ReadonlyMap<string, string>, style: string, at: string): TemplateResult {\n const id = `${at}-${field.property}`;\n const label = this.#fieldLabel(field);\n const value = declared.get(field.property);\n switch (field.kind) {\n case 'number': {\n const shown = numberIn(value, field.unit);\n return html`<div class=\"field\" part=\"field\">\n <label for=${id} part=\"label\">${label}</label>\n <div class=\"unit\">\n <input\n id=${id}\n type=\"number\"\n inputmode=\"decimal\"\n data-property=${field.property}\n min=${field.min}\n max=${field.max}\n step=${field.step ?? 1}\n placeholder=${shown === null ? (value ?? '') : ''}\n .value=${live(shown ?? '')}\n @change=${(event: Event) => {\n const text = (event.target as HTMLInputElement).value.trim();\n // The field writes what the corner handle writes.\n if (\n field.property === 'width' &&\n text !== '' &&\n cleanStyle(`width: ${text}%`).removed.length === 0\n )\n this.#write(widthChanges(style, Number(text)));\n else this.#commit(field.property, text === '' ? null : `${text}${field.unit}`);\n }}\n />\n ${field.unit === '' ? nothing : html`<span aria-hidden=\"true\">${field.unit}</span>`}\n </div>\n </div>`;\n }\n case 'select':\n return html`<div class=\"field\" part=\"field\">\n <label for=${id} part=\"label\">${label}</label>\n <select\n id=${id}\n data-property=${field.property}\n .value=${live(value ?? '')}\n @change=${(event: Event) => {\n const next = (event.target as HTMLSelectElement).value;\n this.#commit(field.property, next === '' ? null : next);\n }}\n >\n <option value=\"\">${this.t('toolbar.default')}</option>\n ${field.options.map(\n (option) =>\n html`<option value=${option} ?selected=${option === value}>${this.t(`style.value.${option}`)}</option>`,\n )}\n </select>\n </div>`;\n case 'font': {\n const fonts = this.authoring?.fonts ?? [];\n const other = value !== undefined && !fonts.some((font) => font.stack === value);\n return html`<div class=\"field wide\" part=\"field\">\n <label for=${id} part=\"label\">${label}</label>\n <select\n id=${id}\n data-property=${field.property}\n .value=${live(value ?? '')}\n @change=${(event: Event) => {\n const next = (event.target as HTMLSelectElement).value;\n this.#commit(field.property, next === '' ? null : next);\n }}\n >\n <option value=\"\">${this.t('toolbar.default')}</option>\n ${fonts.map(\n (font) =>\n html`<option value=${font.stack} ?selected=${font.stack === value}>${font.name}</option>`,\n )}\n ${other ? html`<option value=${value} selected>${value}</option>` : nothing}\n </select>\n </div>`;\n }\n case 'position': {\n const position = positionOf(style);\n return html`<div class=\"field wide\" part=\"field\">\n <label for=${id} part=\"label\">${label}</label>\n <select\n id=${id}\n data-property=\"position\"\n .value=${live(position)}\n @change=${(event: Event) => {\n const next = (event.target as HTMLSelectElement).value as Placement;\n this.#write(positionChanges(next, style, this.#element()?.kind === 'figure'));\n }}\n >\n ${PLACEMENTS.map(\n (one) =>\n html`<option value=${one} ?selected=${one === position}>${this.t(`style.position.${one}`)}</option>`,\n )}\n </select>\n </div>`;\n }\n case 'color':\n return html`<fieldset part=\"field\" data-property=${field.property}>\n <legend part=\"label\">${label}</legend>\n ${colorControl({\n id,\n value: value ?? null,\n t: (key, params) => this.t(key, params),\n invalid: this.#badColors.has(field.property),\n ground: field.property === 'background-color',\n pick: (next) => {\n this.#badColors.delete(field.property);\n this.#commit(field.property, next);\n },\n refuse: () => {\n this.#badColors.add(field.property);\n this.requestUpdate();\n },\n })}\n </fieldset>`;\n }\n }\n\n #refusedList(): TemplateResult | typeof nothing {\n if (this.#refused.length === 0) return nothing;\n return html`<div class=\"refused\" id=\"own-refused\">\n <ul>\n ${this.#refused.map(\n ({ name, reason }) =>\n html`<li data-refused=${name}>${this.t(`style.refused.${reason}`, { name, max: MAX_STYLE_LENGTH })}</li>`,\n )}\n </ul>\n </div>`;\n }\n\n /** The named style of the element, the ready styles the document does not have yet, and saving its own style as one. */\n #named(element: EditorStyleTarget): TemplateResult {\n const named = (this.#styles()?.rules() ?? []).filter((rule) => rule.name !== undefined);\n const own = new Set(named.map((rule) => rule.name));\n const ready = (this.authoring?.styles ?? []).filter((preset) => !own.has(preset.name));\n return html`<details part=\"section\" data-section=\"named\">\n <summary>${this.t('style.section.named')}</summary>\n <div class=\"fields\">\n <div class=\"field wide\" part=\"field\">\n <label for=\"named\" part=\"label\">${this.t('style.field.named')}</label>\n <select\n id=\"named\"\n .value=${live(element.className ?? '')}\n @change=${(event: Event) => {\n const next = (event.target as HTMLSelectElement).value;\n const preset = ready.find((one) => one.name === next);\n // A ready style brings its rule, labelled as the author reads it now, in the same undo step.\n if (preset !== undefined)\n this.#styles()?.setClass(element.kind, next, {\n name: next,\n label: preset.label,\n style: preset.style,\n });\n else this.#styles()?.setClass(element.kind, next === '' ? null : next);\n this.requestUpdate();\n }}\n >\n <option value=\"\">${this.t('style.named.none')}</option>\n ${named.map(\n (rule) =>\n html`<option value=${rule.name ?? ''} ?selected=${rule.name === element.className}>${rule.label ?? rule.name}</option>`,\n )}\n ${\n ready.length === 0\n ? nothing\n : html`<optgroup label=${this.t('toolbar.readyStyles')}>\n ${ready.map(\n (preset) =>\n html`<option value=${preset.name} ?selected=${preset.name === element.className}>${preset.label}</option>`,\n )}\n </optgroup>`\n }\n </select>\n </div>\n <div class=\"save field wide\">\n <label for=\"save-label\" part=\"label\">${this.t('style.save.label')}</label>\n <input\n id=\"save-label\"\n type=\"text\"\n autocomplete=\"off\"\n .value=${this.#saveLabel}\n @input=${(event: Event) => {\n this.#saveLabel = (event.target as HTMLInputElement).value;\n }}\n @keydown=${(event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.#save(element);\n }\n }}\n />\n <button type=\"button\" data-save @click=${() => this.#save(element)}>${this.t('style.save')}</button>\n </div>\n </div>\n </details>`;\n }\n\n #save(element: EditorStyleTarget): void {\n const label = this.#saveLabel.trim();\n if (label === '') {\n this.renderRoot.querySelector<HTMLInputElement>('#save-label')?.focus();\n return;\n }\n if (this.#styles()?.saveRule(element.kind, label) !== null) this.#saveLabel = '';\n this.requestUpdate();\n }\n\n #editLayout(edit: EditorLayoutEdit): void {\n this.#askDelete = false;\n this.#styles()?.editLayout?.(edit);\n this.requestUpdate();\n }\n\n /**\n * The layout's own commands, first in its form and open: another shape, its columns removed with their content kept,\n * or deleted with it, which asks first when there is content to lose. Its style sections follow, closed.\n */\n #layout(): TemplateResult | typeof nothing {\n const styles = this.#styles();\n const state = styles?.layout?.() ?? null;\n if (styles?.editLayout === undefined || state === null) return nothing;\n const ask = this.#askDelete;\n return html`<details open part=\"section\" data-section=\"layout\">\n <summary>${this.t('layout.section')}</summary>\n <div class=\"fields\">\n <div class=\"field wide\" part=\"field\">\n <label for=\"layout-shape\" part=\"label\">${this.t('layout.change')}</label>\n <select\n id=\"layout-shape\"\n @change=${(event: Event) => {\n const value = (event.target as HTMLSelectElement).value;\n if (value !== '') this.#editLayout(value as EditorLayoutShape);\n }}\n >\n ${state.shape === null ? html`<option value=\"\" selected>${this.t('layout.other')}</option>` : nothing}\n ${LAYOUT_SHAPES.map(\n (shape) =>\n html`<option value=${shape} ?selected=${shape === state.shape}>\n ${this.t(`insert.layout.${shape}`)}\n </option>`,\n )}\n </select>\n </div>\n <div class=\"layout wide field\" role=\"group\" aria-label=${this.t('layout.section')}>\n ${\n ask\n ? html`<span role=\"alert\">${this.t('layout.confirm')}</span>\n <button type=\"button\" @click=${() => this.#editLayout('delete')}>\n ${this.t('layout.confirmDelete')}\n </button>\n <button\n type=\"button\"\n data-cancel\n @click=${() => {\n this.#askDelete = false;\n this.requestUpdate();\n }}\n >\n ${this.t('layout.cancel')}\n </button>`\n : html`<button type=\"button\" @click=${() => this.#editLayout('unwrap')}>\n ${this.t('layout.unwrap')}\n </button>\n <button\n type=\"button\"\n @click=${() => {\n if (state.empty) this.#editLayout('delete');\n else {\n this.#askDelete = true;\n this.requestUpdate();\n void this.updateComplete.then(() =>\n this.renderRoot.querySelector<HTMLElement>('[data-cancel]')?.focus(),\n );\n }\n }}\n >\n ${this.t('layout.delete')}\n </button>`\n }\n </div>\n </div>\n </details>`;\n }\n\n protected override render(): TemplateResult | typeof nothing {\n const styles = this.#styles();\n if (this.authoring === null) return nothing;\n const { lang, dir } = this.ui;\n const rule = this.#currentRule();\n const element = rule === null ? this.#element() : null;\n if (styles === null || (rule === null && element === null)) {\n return html`<p class=\"note\" lang=${lang} dir=${dir}>${this.t('style.form.none')}</p>`;\n }\n const style = rule?.style ?? element?.style ?? '';\n const declared = new Map(cleanStyle(style).declarations);\n const inFigure =\n element?.kind === 'picture' && styles.state().targets.some((one) => one.kind === 'figure');\n const kind =\n rule === null\n ? (element?.kind as EditorStyleTargetKind)\n : rule.name !== undefined\n ? 'named'\n : rule.for === 'img'\n ? 'picture'\n : 'tag';\n const sections = sectionsOf(kind, inFigure);\n const own = this.#draft ?? style;\n // A layout's form starts with its commands; then its style, closed.\n const layout = element?.kind === 'layout';\n return html`<div class=\"form\" part=\"root\" lang=${lang} dir=${dir} data-kind=${kind}>\n ${layout ? this.#layout() : nothing}\n ${sections.map(\n (\n [section, fields],\n at,\n ) => html`<details ?open=${at === 0 && !layout} part=\"section\" data-section=${section}>\n <summary>${this.t(`style.section.${section}`)}</summary>\n <div class=\"fields\">${fields.map((field) => this.#field(field, declared, style, section))}</div>\n </details>`,\n )}\n ${element === null ? nothing : this.#named(element)}\n <details ?open=${!layout} part=\"section\" data-section=\"own\">\n <summary>${this.t('style.section.own')}</summary>\n <div class=\"fields\">\n <div class=\"field wide\" part=\"field\">\n <label for=\"own\" part=\"label\">${this.t('style.field.own')}</label>\n <textarea\n id=\"own\"\n rows=\"3\"\n spellcheck=\"false\"\n placeholder=\"background-color: #fff3cd; padding: 12px\"\n aria-describedby=${this.#refused.length > 0 ? 'own-refused' : nothing}\n .value=${live(own)}\n @change=${(event: Event) => this.#applyOwn((event.target as HTMLTextAreaElement).value)}\n ></textarea>\n <div role=\"alert\">${this.#refusedList()}</div>\n </div>\n </div>\n </details>\n </div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'astl-style-form': AstlStyleForm;\n }\n}\n"],"mappings":"A,2aAiDA,IAAMmB,EAAc,CAAE,KAAM,OAAQ,SAAU,aAAc,EACtDC,EAAe,CAAE,KAAM,SAAU,SAAU,QAAS,KAAM,IAAK,IAAK,EAAG,IAAK,GAAI,EAChFC,EAAkB,CAAE,KAAM,WAAY,SAAU,UAAW,EAE3DC,EAAgC,CACpCH,EACA,CAAE,KAAM,SAAU,SAAU,YAAa,KAAM,KAAM,IAAK,GAAI,IAAK,EAAG,EACtE,CAAE,KAAM,SAAU,SAAU,cAAe,QAAS,CAAC,SAAU,MAAM,CAAE,EACvE,CAAE,KAAM,SAAU,SAAU,aAAc,QAAS,CAAC,SAAU,QAAQ,CAAE,EACxE,CAAE,KAAM,QAAS,SAAU,OAAQ,EACnC,CAAE,KAAM,SAAU,SAAU,aAAc,QAAS,CAAC,QAAS,SAAU,MAAO,SAAS,CAAE,EACzF,CAAE,KAAM,SAAU,SAAU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AE;QACArC,IAAY,KAAO/D,EAAU,KAAKuG,GAAOxC,CAAO,EAAE;uBACnC,CAACmC,EAAO;mBACZ,KAAK,EAAE,mBAAmB,EAAE;;;4CAGH,KAAK,EAAE,iBAAiB,EAAE;;;;;;iCAMrC,KAAKlD,GAAS,OAAS,EAAI,cAAgBhD,EAAQ;uBAC7DD,EAAKsF,CAAG,EAAE;wBACR,GAAiB,KAAKmB,GAAW9B,EAAM,OAA+B,KAAK,EAAE;;gCAEtE,KAAK+B,GAAa,EAAE;;;;WAKlD,CACF,E"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./messages-9xiYDvRT.js";var t=[{namespace:e,locale:`en`,messages:{"style.section.text":`Text`,"style.section.box":`Background and border`,"style.section.spacing":`Spacing`,"style.section.size":`Size and position`,"style.section.named":`Named style`,"style.section.own":`Own CSS`,"style.field.font-family":`Font`,"style.field.font-size":`Font size`,"style.field.font-weight":`Weight`,"style.field.font-style":`Slant`,"style.field.color":`Text colour`,"style.field.text-align":`Alignment`,"style.field.line-height":`Line height`,"style.field.background-color":`Background`,"style.field.border-width":`Border width`,"style.field.border-style":`Border style`,"style.field.border-color":`Border colour`,"style.field.border-radius":`Corners`,"style.field.padding":`Padding`,"style.field.margin-block-start":`Space before`,"style.field.margin-block-end":`Space after`,"style.field.width":`Width`,"style.field.position":`Position`,"style.field.gap":`Space between columns`,"style.field.align-items":`Align columns`,"style.field.flex-grow":`Share of the width`,"style.field.named":`Style`,"style.field.own":`CSS declarations`,"style.value.normal":`Normal`,"style.value.bold":`Bold`,"style.value.italic":`Italic`,"style.value.start":`Left`,"style.value.center":`Centre`,"style.value.end":`Right`,"style.value.justify":`Justified`,"style.value.none":`None`,"style.value.solid":`Solid`,"style.value.dashed":`Dashed`,"style.value.dotted":`Dotted`,"style.value.double":`Double`,"style.value.stretch":`Same height`,"style.named.none":`No style`,"style.save.label":`Name of the new style`,"style.save":`Save as a style`,"style.refused.property":`"{name}" is not allowed: an exercise's style cannot move it out of its place, cover other content or load anything.`,"style.refused.value":`This value of "{name}" is not allowed: check its unit and its limits.`,"style.refused.text":`"{name}" is not a declaration: write it as property: value.`,"style.refused.length":`This style is too long: at most {max} characters.`,"style.rules.tags":`Text styles`,"style.rules.empty":`No styles of your own yet. Add one here, or save an element's style.`,"style.rules.edit":`Edit style: {label}`,"style.rules.rename":`Rename style: {label}`,"style.rules.renameShort":`Rename`,"style.rules.renameField":`New name of style: {label}`,"style.rules.delete":`Delete style: {label}`,"style.rules.deleteShort":`Delete`,"style.rules.newLabel":`Name of a new style`,"style.rules.add":`Add style`,"style.tag.paragraph":`Paragraph`,"style.tag.heading":`Heading`,"style.tag.subheading":`Subheading`,"style.tag.quote":`Quote`,"style.tag.list":`List`,"style.tag.caption":`Caption`,"style.tag.picture":`Picture`}},{namespace:e,locale:`pl`,messages:{"style.section.text":`Tekst`,"style.section.box":`Tło i obramowanie`,"style.section.spacing":`Odstępy`,"style.section.size":`Rozmiar i położenie`,"style.section.named":`Styl nazwany`,"style.section.own":`Własny CSS`,"style.field.font-family":`Czcionka`,"style.field.font-size":`Rozmiar czcionki`,"style.field.font-weight":`Grubość`,"style.field.font-style":`Pochylenie`,"style.field.color":`Kolor tekstu`,"style.field.text-align":`Wyrównanie`,"style.field.line-height":`Interlinia`,"style.field.background-color":`Tło`,"style.field.border-width":`Grubość obramowania`,"style.field.border-style":`Rodzaj obramowania`,"style.field.border-color":`Kolor obramowania`,"style.field.border-radius":`Narożniki`,"style.field.padding":`Wypełnienie`,"style.field.margin-block-start":`Odstęp przed`,"style.field.margin-block-end":`Odstęp po`,"style.field.width":`Szerokość`,"style.field.position":`Położenie`,"style.field.gap":`Odstęp między kolumnami`,"style.field.align-items":`Wyrównanie kolumn`,"style.field.flex-grow":`Udział w szerokości`,"style.field.named":`Styl`,"style.field.own":`Deklaracje CSS`,"style.value.normal":`Normalna`,"style.value.bold":`Pogrubiona`,"style.value.italic":`Pochylona`,"style.value.start":`Do lewej`,"style.value.center":`Do środka`,"style.value.end":`Do prawej`,"style.value.justify":`Wyjustowane`,"style.value.none":`Brak`,"style.value.solid":`Ciągłe`,"style.value.dashed":`Kreskowane`,"style.value.dotted":`Kropkowane`,"style.value.double":`Podwójne`,"style.value.stretch":`Równa wysokość`,"style.named.none":`Bez stylu`,"style.save.label":`Nazwa nowego stylu`,"style.save":`Zapisz jako styl`,"style.refused.property":`„{name}” jest niedozwolone: styl ćwiczenia nie może przenosić go poza jego miejsce, zasłaniać innych treści ani niczego wczytywać.`,"style.refused.value":`Ta wartość „{name}” jest niedozwolona: sprawdź jednostkę i dopuszczalny zakres.`,"style.refused.text":`„{name}” to nie jest deklaracja: wpisz ją jako właściwość: wartość.`,"style.refused.length":`Ten styl jest za długi: najwyżej {max} znaków.`,"style.rules.tags":`Style tekstu`,"style.rules.empty":`Nie masz jeszcze własnych stylów. Dodaj styl tutaj albo zapisz styl elementu.`,"style.rules.edit":`Edytuj styl: {label}`,"style.rules.rename":`Zmień nazwę stylu: {label}`,"style.rules.renameShort":`Zmień nazwę`,"style.rules.renameField":`Nowa nazwa stylu: {label}`,"style.rules.delete":`Usuń styl: {label}`,"style.rules.deleteShort":`Usuń`,"style.rules.newLabel":`Nazwa nowego stylu`,"style.rules.add":`Dodaj styl`,"style.tag.paragraph":`Akapit`,"style.tag.heading":`Nagłówek`,"style.tag.subheading":`Podtytuł`,"style.tag.quote":`Cytat`,"style.tag.list":`Lista`,"style.tag.caption":`Podpis`,"style.tag.picture":`Obrazek`}}];export{t};
2
+ //# sourceMappingURL=style-messages-BbZpeD2a.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-messages-BbZpeD2a.js","names":["en","pl","EDITOR_NAMESPACE","styleMessages"],"sources":["../../../../editor/src/messages/style/en.json","../../../../editor/src/messages/style/pl.json","../../../../editor/src/style-messages.ts"],"sourcesContent":["{\n \"style.section.text\": \"Text\",\n \"style.section.box\": \"Background and border\",\n \"style.section.spacing\": \"Spacing\",\n \"style.section.size\": \"Size and position\",\n \"style.section.named\": \"Named style\",\n \"style.section.own\": \"Own CSS\",\n \"style.field.font-family\": \"Font\",\n \"style.field.font-size\": \"Font size\",\n \"style.field.font-weight\": \"Weight\",\n \"style.field.font-style\": \"Slant\",\n \"style.field.color\": \"Text colour\",\n \"style.field.text-align\": \"Alignment\",\n \"style.field.line-height\": \"Line height\",\n \"style.field.background-color\": \"Background\",\n \"style.field.border-width\": \"Border width\",\n \"style.field.border-style\": \"Border style\",\n \"style.field.border-color\": \"Border colour\",\n \"style.field.border-radius\": \"Corners\",\n \"style.field.padding\": \"Padding\",\n \"style.field.margin-block-start\": \"Space before\",\n \"style.field.margin-block-end\": \"Space after\",\n \"style.field.width\": \"Width\",\n \"style.field.position\": \"Position\",\n \"style.field.gap\": \"Space between columns\",\n \"style.field.align-items\": \"Align columns\",\n \"style.field.flex-grow\": \"Share of the width\",\n \"style.field.named\": \"Style\",\n \"style.field.own\": \"CSS declarations\",\n \"style.value.normal\": \"Normal\",\n \"style.value.bold\": \"Bold\",\n \"style.value.italic\": \"Italic\",\n \"style.value.start\": \"Left\",\n \"style.value.center\": \"Centre\",\n \"style.value.end\": \"Right\",\n \"style.value.justify\": \"Justified\",\n \"style.value.none\": \"None\",\n \"style.value.solid\": \"Solid\",\n \"style.value.dashed\": \"Dashed\",\n \"style.value.dotted\": \"Dotted\",\n \"style.value.double\": \"Double\",\n \"style.value.stretch\": \"Same height\",\n \"style.named.none\": \"No style\",\n \"style.save.label\": \"Name of the new style\",\n \"style.save\": \"Save as a style\",\n \"style.refused.property\": \"\\\"{name}\\\" is not allowed: an exercise's style cannot move it out of its place, cover other content or load anything.\",\n \"style.refused.value\": \"This value of \\\"{name}\\\" is not allowed: check its unit and its limits.\",\n \"style.refused.text\": \"\\\"{name}\\\" is not a declaration: write it as property: value.\",\n \"style.refused.length\": \"This style is too long: at most {max} characters.\",\n \"style.rules.tags\": \"Text styles\",\n \"style.rules.empty\": \"No styles of your own yet. Add one here, or save an element's style.\",\n \"style.rules.edit\": \"Edit style: {label}\",\n \"style.rules.rename\": \"Rename style: {label}\",\n \"style.rules.renameShort\": \"Rename\",\n \"style.rules.renameField\": \"New name of style: {label}\",\n \"style.rules.delete\": \"Delete style: {label}\",\n \"style.rules.deleteShort\": \"Delete\",\n \"style.rules.newLabel\": \"Name of a new style\",\n \"style.rules.add\": \"Add style\",\n \"style.tag.paragraph\": \"Paragraph\",\n \"style.tag.heading\": \"Heading\",\n \"style.tag.subheading\": \"Subheading\",\n \"style.tag.quote\": \"Quote\",\n \"style.tag.list\": \"List\",\n \"style.tag.caption\": \"Caption\",\n \"style.tag.picture\": \"Picture\"\n}\n","{\n \"style.section.text\": \"Tekst\",\n \"style.section.box\": \"Tło i obramowanie\",\n \"style.section.spacing\": \"Odstępy\",\n \"style.section.size\": \"Rozmiar i położenie\",\n \"style.section.named\": \"Styl nazwany\",\n \"style.section.own\": \"Własny CSS\",\n \"style.field.font-family\": \"Czcionka\",\n \"style.field.font-size\": \"Rozmiar czcionki\",\n \"style.field.font-weight\": \"Grubość\",\n \"style.field.font-style\": \"Pochylenie\",\n \"style.field.color\": \"Kolor tekstu\",\n \"style.field.text-align\": \"Wyrównanie\",\n \"style.field.line-height\": \"Interlinia\",\n \"style.field.background-color\": \"Tło\",\n \"style.field.border-width\": \"Grubość obramowania\",\n \"style.field.border-style\": \"Rodzaj obramowania\",\n \"style.field.border-color\": \"Kolor obramowania\",\n \"style.field.border-radius\": \"Narożniki\",\n \"style.field.padding\": \"Wypełnienie\",\n \"style.field.margin-block-start\": \"Odstęp przed\",\n \"style.field.margin-block-end\": \"Odstęp po\",\n \"style.field.width\": \"Szerokość\",\n \"style.field.position\": \"Położenie\",\n \"style.field.gap\": \"Odstęp między kolumnami\",\n \"style.field.align-items\": \"Wyrównanie kolumn\",\n \"style.field.flex-grow\": \"Udział w szerokości\",\n \"style.field.named\": \"Styl\",\n \"style.field.own\": \"Deklaracje CSS\",\n \"style.value.normal\": \"Normalna\",\n \"style.value.bold\": \"Pogrubiona\",\n \"style.value.italic\": \"Pochylona\",\n \"style.value.start\": \"Do lewej\",\n \"style.value.center\": \"Do środka\",\n \"style.value.end\": \"Do prawej\",\n \"style.value.justify\": \"Wyjustowane\",\n \"style.value.none\": \"Brak\",\n \"style.value.solid\": \"Ciągłe\",\n \"style.value.dashed\": \"Kreskowane\",\n \"style.value.dotted\": \"Kropkowane\",\n \"style.value.double\": \"Podwójne\",\n \"style.value.stretch\": \"Równa wysokość\",\n \"style.named.none\": \"Bez stylu\",\n \"style.save.label\": \"Nazwa nowego stylu\",\n \"style.save\": \"Zapisz jako styl\",\n \"style.refused.property\": \"„{name}” jest niedozwolone: styl ćwiczenia nie może przenosić go poza jego miejsce, zasłaniać innych treści ani niczego wczytywać.\",\n \"style.refused.value\": \"Ta wartość „{name}” jest niedozwolona: sprawdź jednostkę i dopuszczalny zakres.\",\n \"style.refused.text\": \"„{name}” to nie jest deklaracja: wpisz ją jako właściwość: wartość.\",\n \"style.refused.length\": \"Ten styl jest za długi: najwyżej {max} znaków.\",\n \"style.rules.tags\": \"Style tekstu\",\n \"style.rules.empty\": \"Nie masz jeszcze własnych stylów. Dodaj styl tutaj albo zapisz styl elementu.\",\n \"style.rules.edit\": \"Edytuj styl: {label}\",\n \"style.rules.rename\": \"Zmień nazwę stylu: {label}\",\n \"style.rules.renameShort\": \"Zmień nazwę\",\n \"style.rules.renameField\": \"Nowa nazwa stylu: {label}\",\n \"style.rules.delete\": \"Usuń styl: {label}\",\n \"style.rules.deleteShort\": \"Usuń\",\n \"style.rules.newLabel\": \"Nazwa nowego stylu\",\n \"style.rules.add\": \"Dodaj styl\",\n \"style.tag.paragraph\": \"Akapit\",\n \"style.tag.heading\": \"Nagłówek\",\n \"style.tag.subheading\": \"Podtytuł\",\n \"style.tag.quote\": \"Cytat\",\n \"style.tag.list\": \"Lista\",\n \"style.tag.caption\": \"Podpis\",\n \"style.tag.picture\": \"Obrazek\"\n}\n","import type { MessageCatalog } from '@astl/core';\nimport en from './messages/style/en.json' with { type: 'json' };\nimport pl from './messages/style/pl.json' with { type: 'json' };\nimport { EDITOR_NAMESPACE } from './messages.js';\n\n/**\n * What only `<astl-style-form>` and `<astl-style-rules>` say. They bring it with them, outside the editor's first load,\n * and add it to the authoring they are given.\n */\nexport const styleMessages: readonly MessageCatalog[] = [\n { namespace: EDITOR_NAMESPACE, locale: 'en', messages: en },\n { namespace: EDITOR_NAMESPACE, locale: 'pl', messages: pl },\n];\n"],"mappings":"A,2CESA,IAAaG,EAA2C,CACtD,CAAE,UAAWD,EAAkB,OAAQ,KAAM,SAAUF,C,qiFAAAA,CAAG,EAC1D,CAAE,UAAWE,EAAkB,OAAQ,KAAM,SAAUD,C,+pFAAAA,CAAG,CAC5D,E"}
@@ -0,0 +1,2 @@
1
+ var e=e=>new Map(e.split(`;`).flatMap(e=>{let t=e.indexOf(`:`);return t<0?[]:[[e.slice(0,t).trim().toLowerCase(),e.slice(t+1).trim().toLowerCase()]]})),t=[{name:`Arial`,stack:`Arial, Helvetica, sans-serif`},{name:`Verdana`,stack:`Verdana, Geneva, sans-serif`},{name:`Georgia`,stack:`Georgia, serif`},{name:`Times New Roman`,stack:`"Times New Roman", Times, serif`},{name:`Courier New`,stack:`"Courier New", Courier, monospace`}],n=[{name:`note`,style:`background-color: #fff4d6; border-inline-start: 4px solid #b7791f; padding: 12px 16px; border-radius: 6px`},{name:`tip`,style:`background-color: #e7f6ec; border-inline-start: 4px solid #2f855a; padding: 12px 16px; border-radius: 6px`},{name:`important`,style:`background-color: #fdecec; border-inline-start: 4px solid #c53030; padding: 12px 16px; border-radius: 6px`},{name:`definition`,style:`background-color: #eef1fe; border: 1px solid #5a67d8; padding: 12px 16px; border-radius: 6px`},{name:`example`,style:`border: 2px dashed #718096; padding: 12px 16px; border-radius: 6px`},{name:`quote`,style:`border-inline-start: 3px solid #a0aec0; padding-inline-start: 16px; font-style: italic; color: #4a5568`},{name:`highlight`,style:`background-color: #fff3a3`,text:!0},{name:`small-print`,style:`font-size: 14px; color: #4a5568`,text:!0}],r=[`two`,`three`,`wide-narrow`,`narrow-wide`,`picture-text`],i=[`two`,`three`,`wide-narrow`,`narrow-wide`],a={two:[null,null],three:[null,null,null],"wide-narrow":[2,null],"narrow-wide":[null,2]},o=(e=`<p></p>`,t=null)=>`<astl-column${t===null?``:` style="flex-grow: ${t}"`}>${e}</astl-column>`;function s(e,t=``){let n=e===`picture-text`?o(t.startsWith(`<figure`)?t:`<p>${t}</p>`)+o():a[e].map(e=>o(`<p></p>`,e)).join(``);return`<astl-columns${e===`picture-text`?` style="align-items: start"`:``}>${n}</astl-columns>`}export{i as a,a as i,n,s as o,r,e as s,t};
2
+ //# sourceMappingURL=style-model-ZXNe_c8R.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-model-ZXNe_c8R.js","names":["styleMapOf","style","at","part","DEFAULT_FONTS","DEFAULT_STYLES","LAYOUTS","LAYOUT_SHAPES","LAYOUT_COLUMNS","column","grow","content","layoutHtml","columns","name","picture"],"sources":["../../../../editor/src/style-model.ts"],"sourcesContent":["/**\n * What the first load of the kit reads: the declarations of a style as a map, the host's fonts, the ready styles and\n * the layouts. A layout's source goes through the format's rules like any other.\n */\nimport type { EditorLayoutShape } from '@astl/core';\n\n/** The declarations of a `style` value as a map, read as they are written (they come from the allow-list). */\nexport const styleMapOf = (style: string): ReadonlyMap<string, string> =>\n new Map(\n style.split(';').flatMap((part): [string, string][] => {\n const at = part.indexOf(':');\n return at < 0\n ? []\n : [\n [\n part.slice(0, at).trim().toLowerCase(),\n part\n .slice(at + 1)\n .trim()\n .toLowerCase(),\n ],\n ];\n }),\n );\n\n/** A font a host offers (`defineEditor({ fonts })`): its name in the menus, and its CSS stack. */\nexport interface EditorFont {\n readonly name: string;\n readonly stack: string;\n}\n\n/** The default list: stacks every system has, nothing to download or license. */\nexport const DEFAULT_FONTS: readonly EditorFont[] = [\n { name: 'Arial', stack: 'Arial, Helvetica, sans-serif' },\n { name: 'Verdana', stack: 'Verdana, Geneva, sans-serif' },\n { name: 'Georgia', stack: 'Georgia, serif' },\n { name: 'Times New Roman', stack: '\"Times New Roman\", Times, serif' },\n { name: 'Courier New', stack: '\"Courier New\", Courier, monospace' },\n];\n\n/**\n * A ready style a host offers (`defineEditor({ styles })`), as a word processor has its built-in ones. Picked, it is\n * written into the document as a named style (`<astl-style>`), which the exercise then owns like any other.\n */\nexport interface EditorStylePreset {\n /** The name it is applied by (`class`): what `isStyleName` takes. */\n readonly name: string;\n /** Its declarations, every one of which the style allow-list must keep. */\n readonly style: string;\n /** Its name in the menus and in the rule. Default: the kit's message `style.preset.<name>`, else the name. */\n readonly label?: string;\n /**\n * A style of words: it goes on the selected text, and with only a cursor on what the cursor is in. Without it, a\n * style of boxes: on what the cursor is in (a block, a component), words selected or not.\n */\n readonly text?: true;\n}\n\n/**\n * The default ready styles: boxes for a note, a tip, a warning, a definition, an example and a quote, then two for\n * words. Their text reads at 4.5:1 on what is behind it, in the light theme and as the player paints them in the dark\n * one (`styled.browser.test.ts`). A style of words holds no padding and no margin: on a phone the player gives\n * whatever has a padding its own (`styled.ts`), which would pad a word inside its sentence.\n */\nexport const DEFAULT_STYLES: readonly EditorStylePreset[] = [\n {\n name: 'note',\n style:\n 'background-color: #fff4d6; border-inline-start: 4px solid #b7791f; padding: 12px 16px; border-radius: 6px',\n },\n {\n name: 'tip',\n style:\n 'background-color: #e7f6ec; border-inline-start: 4px solid #2f855a; padding: 12px 16px; border-radius: 6px',\n },\n {\n name: 'important',\n style:\n 'background-color: #fdecec; border-inline-start: 4px solid #c53030; padding: 12px 16px; border-radius: 6px',\n },\n {\n name: 'definition',\n style: 'background-color: #eef1fe; border: 1px solid #5a67d8; padding: 12px 16px; border-radius: 6px',\n },\n { name: 'example', style: 'border: 2px dashed #718096; padding: 12px 16px; border-radius: 6px' },\n {\n name: 'quote',\n style:\n 'border-inline-start: 3px solid #a0aec0; padding-inline-start: 16px; font-style: italic; color: #4a5568',\n },\n { name: 'highlight', style: 'background-color: #fff3a3', text: true },\n { name: 'small-print', style: 'font-size: 14px; color: #4a5568', text: true },\n];\n\n/** The theme's colours an author can pick, by number: `var(--astl-palette-<n>)`. */\nexport const PALETTE_SIZE = 8;\n\n/** The layouts of the insert menu's \"Layout\" group. */\nexport type LayoutName = EditorLayoutShape | 'picture-text';\n\nexport const LAYOUTS: readonly LayoutName[] = ['two', 'three', 'wide-narrow', 'narrow-wide', 'picture-text'];\n\n/** The shapes a layout can be changed to (`EditorStyles.editLayout`), in the menu's order. */\nexport const LAYOUT_SHAPES: readonly EditorLayoutShape[] = ['two', 'three', 'wide-narrow', 'narrow-wide'];\n\n/** Each shape's columns by their `flex-grow`: null for an equal share. */\nexport const LAYOUT_COLUMNS: Readonly<Record<EditorLayoutShape, readonly (number | null)[]>> = {\n two: [null, null],\n three: [null, null, null],\n 'wide-narrow': [2, null],\n 'narrow-wide': [null, 2],\n};\n\nconst column = (content = '<p></p>', grow: number | null = null) =>\n `<astl-column${grow === null ? '' : ` style=\"flex-grow: ${grow}\"`}>${content}</astl-column>`;\n\n/** The source of a layout; `picture-text` takes the source of its picture. */\nexport function layoutHtml(name: LayoutName, picture = ''): string {\n const columns =\n name === 'picture-text'\n ? column(picture.startsWith('<figure') ? picture : `<p>${picture}</p>`) + column()\n : LAYOUT_COLUMNS[name].map((grow) => column('<p></p>', grow)).join('');\n const shape = name === 'picture-text' ? ' style=\"align-items: start\"' : '';\n return `<astl-columns${shape}>${columns}</astl-columns>`;\n}\n"],"mappings":"AAOA,IAAaA,EAAc,GACzB,IAAI,IACFC,EAAM,MAAM,GAAG,CAAC,CAAC,QAAS,GAA6B,CACrD,IAAMC,EAAKC,EAAK,QAAQ,GAAG,EAC3B,OAAOD,EAAK,EACR,CAAC,EACD,CACE,CACEC,EAAK,MAAM,EAAGD,CAAE,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,EACrCC,EACG,MAAMD,EAAK,CAAC,CAAC,CACb,KAAK,CAAC,CACN,YAAY,CACjB,CACF,CACN,CAAC,CACH,EASWE,EA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BhqOz1ap.js";import{s as t}from"./style-model-ZXNe_c8R.js";var n=[`inline`,`start`,`end`,`center`,`full`],r=[`float`,`display`,`margin`,...[`left`,`right`,`bottom`].map(e=>`margin-${e}`),`margin-inline`,`margin-inline-start`,`margin-inline-end`,`margin-block-end`],i={inline:{},start:{float:`inline-start`,"margin-inline-end":`16px`,"margin-block-end":`8px`},end:{float:`inline-end`,"margin-inline-start":`16px`,"margin-block-end":`8px`},center:{display:`block`,"margin-inline":`auto`},full:{display:`block`,width:`100%`}};function a(e){let n=t(e),r=n.get(`float`);if(r===`inline-start`||r===`left`)return`start`;if(r===`inline-end`||r===`right`)return`end`;if(n.get(`width`)===`100%`&&(n.get(`display`)===`block`||!n.has(`display`)))return`full`;let i=n.get(`margin`)?.split(/\s+/);return n.get(`margin-inline`)===`auto`||[`left`,`right`].every(e=>n.get(`margin-${e}`)===`auto`)||i!==void 0&&i.length===2&&i[1]===`auto`?`center`:`inline`}function o(e,n,o=!1){let s={};for(let e of r)s[e]=null;return a(n)===`full`&&(s.width=null),o&&e===`center`&&(a(n)===`full`||!t(n).has(`width`))&&(s.width=`50%`),{...s,...i[e]}}function s(e,t){return{width:`${t}%`,...a(e)===`full`&&t<100?{display:null}:{}}}var c=new Set([...r,`width`]);function l(e){let n=[],r=[];for(let[i,a]of t(e))(c.has(i)?n:r).push(`${i}: ${a}`);return{placed:n.join(`; `),rest:r.join(`; `)}}function u(e){let n=/^(\d+(?:\.\d+)?)%$/.exec(t(e).get(`width`)??``);return n===null?null:Number(n[1])}function d(t,n){let r=t.normalize(`NFD`).replace(/\p{M}/gu,``).replace(/[łŁ]/g,`l`).toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^[^a-z]+|-+$/g,``).slice(0,56),i=e(r)?r:`style`;if(i!==`style`&&!n.has(i))return i;let a=1;for(;n.has(`${i}-${a}`);)a++;return`${i}-${a}`}export{d as a,l as i,o as n,s as o,a as r,u as s,n as t};
2
+ //# sourceMappingURL=style-placing-DPw1zyrz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-placing-DPw1zyrz.js","names":["isStyleName","styleMapOf","PLACEMENTS","POSITION_PROPERTIES","side","POSITION_STYLES","positionOf","map","style","float","margin","positionChanges","changes","name","figure","position","widthChanges","percent","PLACING","splitPlacement","placed","rest","value","widthPercent","match","styleNameFrom","plain","label","base","taken","n"],"sources":["../../../../editor/src/style-placing.ts"],"sourcesContent":["/**\n * How a placement of a picture, a figure or a component is written, and a new style's name: what the style form and a surface read, outside the\n * kit's first load. Everything a position writes has its logical form in the allow-list, so a page in any direction\n * reads the same; the player's narrow rule keeps `auto` margins and lets the others go.\n */\nimport type { EditorStyleChanges } from '@astl/core';\nimport { isStyleName } from '@astl/core/declarations';\nimport { styleMapOf } from './style-model.js';\n\n/**\n * Where a picture, a figure or a component sits: in the line, floating at either side with text beside it, centred,\n * or filling.\n */\nexport type Placement = 'inline' | 'start' | 'end' | 'center' | 'full';\n\nexport const PLACEMENTS: readonly Placement[] = ['inline', 'start', 'end', 'center', 'full'];\n\n/** @deprecated Use `Placement`: components are placed the same way. */\nexport type PicturePosition = Placement;\n\n/** @deprecated Use `PLACEMENTS`. */\nexport const PICTURE_POSITIONS: readonly Placement[] = PLACEMENTS;\n\n/** What a position may have written, also by hand: all of it goes before a new position is written. */\nconst POSITION_PROPERTIES = [\n 'float',\n 'display',\n 'margin',\n ...['left', 'right', 'bottom'].map((side) => `margin-${side}`),\n 'margin-inline',\n 'margin-inline-start',\n 'margin-inline-end',\n 'margin-block-end',\n];\n\n/** The declarations of each position. */\nconst POSITION_STYLES: Readonly<Record<Placement, Readonly<Record<string, string>>>> = {\n inline: {},\n start: { float: 'inline-start', 'margin-inline-end': '16px', 'margin-block-end': '8px' },\n end: { float: 'inline-end', 'margin-inline-start': '16px', 'margin-block-end': '8px' },\n center: { display: 'block', 'margin-inline': 'auto' },\n full: { display: 'block', width: '100%' },\n};\n\n/** The position a `style` value says, also written by hand, with physical sides or `margin: 0 auto`. */\nexport function positionOf(style: string): Placement {\n const map = styleMapOf(style);\n const float = map.get('float');\n if (float === 'inline-start' || float === 'left') return 'start';\n if (float === 'inline-end' || float === 'right') return 'end';\n if (map.get('width') === '100%' && (map.get('display') === 'block' || !map.has('display'))) return 'full';\n const margin = map.get('margin')?.split(/\\s+/);\n const centred =\n map.get('margin-inline') === 'auto' ||\n ['left', 'right'].every((side) => map.get(`margin-${side}`) === 'auto') ||\n (margin !== undefined && margin.length === 2 && margin[1] === 'auto');\n return centred ? 'center' : 'inline';\n}\n\n/**\n * The changes that put an element whose style is `style` at `position`; leaving \"full width\" lets go of its width. A\n * figure fills the line unless it has a width, so \"centred\" would not show on one without it (`figure`).\n */\nexport function positionChanges(position: Placement, style: string, figure = false): EditorStyleChanges {\n const changes: Record<string, string | null> = {};\n for (const name of POSITION_PROPERTIES) changes[name] = null;\n if (positionOf(style) === 'full') changes.width = null;\n if (figure && position === 'center' && (positionOf(style) === 'full' || !styleMapOf(style).has('width')))\n changes.width = '50%';\n return { ...changes, ...POSITION_STYLES[position] };\n}\n\n/** The changes that make an element whose style is `style` this wide: a handle and a field write the same. */\nexport function widthChanges(style: string, percent: number): EditorStyleChanges {\n return {\n width: `${percent}%`,\n // Narrower than the line, it is no longer \"full width\": what said so goes with it.\n ...(positionOf(style) === 'full' && percent < 100 ? { display: null } : {}),\n };\n}\n\nconst PLACING: ReadonlySet<string> = new Set([...POSITION_PROPERTIES, 'width']);\n\n/**\n * A `style` value in two: what places the element (its position and width) and the rest. A surface that frames an\n * element draws the first on the frame and the rest inside it.\n */\nexport function splitPlacement(style: string): { readonly placed: string; readonly rest: string } {\n const placed: string[] = [];\n const rest: string[] = [];\n for (const [name, value] of styleMapOf(style))\n (PLACING.has(name) ? placed : rest).push(`${name}: ${value}`);\n return { placed: placed.join('; '), rest: rest.join('; ') };\n}\n\n/** The width a `style` value gives in percent, or null: none, or another unit. */\nexport function widthPercent(style: string): number | null {\n const match = /^(\\d+(?:\\.\\d+)?)%$/.exec(styleMapOf(style).get('width') ?? '');\n return match === null ? null : Number(match[1]);\n}\n\n/** A name for a new style from its label: lowercase letters, digits and dashes, the format's grammar, not taken. */\nexport function styleNameFrom(label: string, taken: ReadonlySet<string>): string {\n const plain = label\n .normalize('NFD')\n .replace(/\\p{M}/gu, '')\n .replace(/[łŁ]/g, 'l')\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^[^a-z]+|-+$/g, '')\n .slice(0, 56);\n const base = isStyleName(plain) ? plain : 'style';\n if (base !== 'style' && !taken.has(base)) return base;\n let n = 1;\n while (taken.has(`${base}-${n}`)) n++;\n return `${base}-${n}`;\n}\n"],"mappings":"A,6FAeA,IAAaE,EAAmC,CAAC,SAAU,QAAS,MAAO,SAAU,MAAM,EASrFC,EAAsB,CAC1B,QACA,UACA,SACA,GAAG,CAAC,OAAQ,QAAS,QAAQ,CAAC,CAAC,IAAK,GAAS,UAAUC,GAAM,EAC7D,gBACA,sBACA,oBACA,kBACF,EAGMC,EAAiF,CACrF,OAAQ,CAAC,EACT,MAAO,CAAE,MAAO,eAAgB,oBAAqB,OAAQ,mBAAoB,KAAM,EACvF,IAAK,CAAE,MAAO,aAAc,sBAAuB,OAAQ,mBAAoB,KAAM,EACrF,OAAQ,CAAE,QAAS,QAAS,gBAAiB,MAAO,EACpD,KAAM,CAAE,QAAS,QAAS,MAAO,MAAO,CAC1C,EAGA,SAAgBC,EAAW,EAA0B,CACnD,IAAMC,EAAMN,EAAWO,CAAK,EACtBC,EAAQF,EAAI,IAAI,OAAO,EAC7B,GAAIE,IAAU,gBAAkBA,IAAU,OAAQ,MAAO,QACzD,GAAIA,IAAU,cAAgBA,IAAU,QAAS,MAAO,MACxD,GAAIF,EAAI,IAAI,OAAO,IAAM,SAAWA,EAAI,IAAI,SAAS,IAAM,SAAW,CAACA,EAAI,IAAI,SAAS,GAAI,MAAO,OACnG,IAAMG,EAASH,EAAI,IAAI,QAAQ,CAAC,EAAE,MAAM,KAAK,EAK7C,OAHEA,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M,EAAE,CAChD,CAGA,SAAgBC,EAAc,EAAe,EAAoC,CAC/E,IAAMC,EAAQC,EACX,UAAU,KAAK,CAAC,CAChB,QAAQ,UAAW,EAAE,CAAC,CACtB,QAAQ,QAAS,GAAG,CAAC,CACrB,YAAY,CAAC,CACb,QAAQ,cAAe,GAAG,CAAC,CAC3B,QAAQ,gBAAiB,EAAE,CAAC,CAC5B,MAAM,EAAG,EAAE,EACRC,EAAO5B,EAAY0B,CAAK,EAAIA,EAAQ,QAC1C,GAAIE,IAAS,SAAW,CAACC,EAAM,IAAID,CAAI,EAAG,OAAOA,EACjD,IAAIE,EAAI,EACR,KAAOD,EAAM,IAAI,GAAGD,EAAK,GAAGE,GAAG,GAAG,IAClC,MAAO,GAAGF,EAAK,GAAGE,GACpB,C"}
@@ -0,0 +1,74 @@
1
+ import{C as e,E as t,b as n}from"./runtime-DxAbpr3S.js";import{s as r}from"./style-model-ZXNe_c8R.js";import{n as i,t as a}from"./color-control-Cl5cuMSO.js";var o=[10,11,12,14,16,18,20,24,28,32,36,48,72],s=[`start`,`center`,`end`,`justify`],c=[`1`,`1.15`,`1.5`,`2`],l=[[`0px`,`none`],[`8px`,`small`],[`16px`,`medium`],[`24px`,`large`]],u=t`
2
+ ${i}
3
+ .colors {
4
+ inline-size: min(16rem, calc(100vw - 2 * var(--astl-space-4)));
5
+ }
6
+ .panel {
7
+ inline-size: min(26rem, calc(100vw - 2 * var(--astl-space-4)));
8
+ max-block-size: min(40rem, calc(100vh - 2 * var(--astl-space-4)));
9
+ }
10
+ .panel astl-style-rules::part(root) {
11
+ padding: 0;
12
+ border: 0;
13
+ }
14
+ .panel astl-style-rules::part(title) {
15
+ display: none;
16
+ }
17
+ .panel-head {
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: space-between;
21
+ gap: var(--astl-space-2);
22
+ margin-block-end: var(--astl-space-2);
23
+ font-weight: 600;
24
+ }
25
+ `;function d(t,r,i,a,o){return e`<div
26
+ id=${r}
27
+ class="menu"
28
+ popover="manual"
29
+ role="menu"
30
+ aria-label=${o}
31
+ part="style-menu"
32
+ @keydown=${t.menuKeydown}
33
+ >
34
+ ${i.map((t,r)=>e`<div class="menu-section" role="group" aria-label=${t.title??n}>
35
+ ${t.title===void 0?n:e`<div class="menu-group" aria-hidden="true">${t.title}</div>`}
36
+ ${t.choices.map(i=>e`<button
37
+ type="button"
38
+ role="menuitemradio"
39
+ tabindex="-1"
40
+ data-value=${i.value??``}
41
+ aria-checked=${String(i.value===t.now)}
42
+ data-font=${i.font??n}
43
+ @click=${()=>a(i,r)}
44
+ >
45
+ ${i.label}
46
+ </button>`)}
47
+ </div>`)}
48
+ </div>`}function f(t,n){let r=n===`color`?`color`:`background-color`;return e`<div
49
+ id=${n}
50
+ class="colors"
51
+ popover="manual"
52
+ role="dialog"
53
+ aria-label=${t.t(`toolbar.${n}`)}
54
+ part="style-colors"
55
+ @keydown=${e=>{e.key===`Escape`&&(e.preventDefault(),t.close(!0))}}
56
+ @focusout=${e=>{let n=e.relatedTarget;n!==null&&!e.currentTarget.contains(n)&&t.close(!1)}}
57
+ >
58
+ ${a({id:n,value:t.styles.text[r]??null,t:t.t,invalid:t.colorError,ground:n===`highlight`,pick:e=>t.setText({[r]:e}),refuse:t.refuseColor})}
59
+ </div>`}function p(t,n){let{t:r,authoring:i,adapter:a}=t,o=r(n===`rules`?`style.rules.title`:`style.target.${n}`);return e`<div
60
+ id="panel"
61
+ class="panel"
62
+ popover="manual"
63
+ role="dialog"
64
+ tabindex="-1"
65
+ aria-label=${o}
66
+ part="style-panel"
67
+ >
68
+ <div class="panel-head">
69
+ <span>${o}</span>
70
+ <button type="button" data-close @click=${()=>t.close(!0)}>${r(`style.close`)}</button>
71
+ </div>
72
+ ${n===`rules`?e`<astl-style-rules .authoring=${i} .adapter=${a}></astl-style-rules>`:e`<astl-style-form .authoring=${i} .adapter=${a} .target=${n}></astl-style-form>`}
73
+ </div>`}function m(e){let{popup:t,styles:n,t:i,fonts:a,setText:u,setBlock:m}=e;if(typeof t==`object`)return p(e,t.panel);if(t===`color`||t===`highlight`)return f(e,t);let{text:h}=n,g={value:null,label:i(`toolbar.default`)},_=r(n.targets.find(e=>e.kind===`block`)?.style??``),v=e=>e===void 0?null:String(Number.parseFloat(e));if(t===`font`)return d(e,`font`,[{choices:[g,...a.map(e=>({value:e.stack,label:e.name,font:e.stack}))],now:h[`font-family`]??null}],e=>u({"font-family":e.value}),i(`toolbar.font.name`));if(t===`size`)return d(e,`size`,[{choices:[g,...o.map(e=>({value:`${e}px`,label:String(e)}))],now:h[`font-size`]??null}],e=>u({"font-size":e.value}),i(`toolbar.size.name`));if(t===`align`){let t=_.get(`text-align`);return d(e,`align`,[{choices:s.map(e=>({value:e,label:i(`toolbar.align.${e}`)})),now:t===`left`?`start`:t===`right`?`end`:t??`start`}],e=>m({"text-align":e.value===`start`?null:e.value}),i(`toolbar.align`))}return d(e,`spacing`,[{title:i(`toolbar.spacing.line`),choices:[g,...c.map(e=>({value:e,label:e}))],now:v(_.get(`line-height`))},{title:i(`toolbar.spacing.after`),choices:[g,...l.map(([e,t])=>({value:e,label:i(`toolbar.spacing.${t}`)}))],now:_.has(`margin-block-end`)?`${v(_.get(`margin-block-end`))}px`:null}],(e,t)=>m({[t===0?`line-height`:`margin-block-end`]:e.value}),i(`toolbar.spacing`))}export{m as stylePopup,u as stylePopupStyles};
74
+ //# sourceMappingURL=style-popups-BobgX1WK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-popups-BobgX1WK.js","names":["nothing","b","i","A","styleMapOf","colorStyles","colorControl","FONT_SIZES","ALIGNS","LINE_HEIGHTS","BLOCK_SPACES","stylePopupStyles","choiceMenu","popup","label","context","groups","group","choice","choose","at","colors","property","event","next","value","panel","title","t","target","authoring","adapter","stylePopup","styles","none","block","number","fonts","font","text","setText","n","now","setBlock","name"],"sources":["../../../../editor/src/elements/style-popups.ts"],"sourcesContent":["/**\n * The toolbar's popups of the style controls: the menus of values, the colours, and the panel with the form or the\n * rules. Outside the editor's first load: the toolbar loads this module when one of them first opens, and draws them\n * in its own root, as its other popups.\n */\nimport type { EditorAdapter, EditorStyleChanges, EditorStyleState } from '@astl/core';\nimport { type CSSResult, css, html, nothing, type TemplateResult } from 'lit';\nimport type { Authoring } from '../authoring.js';\nimport { type EditorFont, styleMapOf } from '../style-model.js';\nimport { colorControl, colorStyles } from './color-control.js';\nimport type { StyleOpen } from './style-load.js';\n\n/** The popups of the style controls: menus of values, and the colours. */\nexport type StylePopup = 'font' | 'size' | 'color' | 'highlight' | 'align' | 'spacing';\n\n/** The font sizes of the menu, in px. */\nconst FONT_SIZES: readonly number[] = [10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36, 48, 72];\nconst ALIGNS = ['start', 'center', 'end', 'justify'] as const;\nconst LINE_HEIGHTS: readonly string[] = ['1', '1.15', '1.5', '2'];\nconst BLOCK_SPACES: readonly (readonly [string, string])[] = [\n ['0px', 'none'],\n ['8px', 'small'],\n ['16px', 'medium'],\n ['24px', 'large'],\n];\n\n/** One value of a menu of values: what it writes, and its label. */\ninterface Choice {\n readonly value: string | null;\n readonly label: string;\n /** A stack to show the label in, in a font menu. */\n readonly font?: string;\n}\n\nexport const stylePopupStyles: CSSResult = css`\n ${colorStyles}\n .colors {\n inline-size: min(16rem, calc(100vw - 2 * var(--astl-space-4)));\n }\n .panel {\n inline-size: min(26rem, calc(100vw - 2 * var(--astl-space-4)));\n max-block-size: min(40rem, calc(100vh - 2 * var(--astl-space-4)));\n }\n .panel astl-style-rules::part(root) {\n padding: 0;\n border: 0;\n }\n .panel astl-style-rules::part(title) {\n display: none;\n }\n .panel-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--astl-space-2);\n margin-block-end: var(--astl-space-2);\n font-weight: 600;\n }\n`;\n\n/** What a popup needs from its toolbar. */\nexport interface StylePopupContext {\n /** Which one is open: `panel` shows the form of a target, or the rules. */\n readonly popup: StylePopup | { readonly panel: StyleOpen['target'] };\n readonly styles: EditorStyleState;\n readonly fonts: readonly EditorFont[];\n /** A typed colour was refused. */\n readonly colorError: boolean;\n readonly authoring: Authoring | null;\n readonly adapter: EditorAdapter | null;\n readonly t: (key: string, params?: Record<string, string | number>) => string;\n /** On the selected text, then closes the popup. */\n readonly setText: (changes: EditorStyleChanges) => void;\n /** On each text block of the selection, then closes the popup. */\n readonly setBlock: (changes: EditorStyleChanges) => void;\n readonly refuseColor: () => void;\n /** Closes the popup; the focus goes back to its button with `back`. */\n readonly close: (back: boolean) => void;\n /** The arrows, Home and End along a menu's buttons, as the toolbar's other menus. */\n readonly menuKeydown: (event: KeyboardEvent) => void;\n}\n\n/** A menu of values: one checked at a time, each writing what it says. */\nfunction choiceMenu(\n context: StylePopupContext,\n popup: StylePopup,\n groups: readonly {\n readonly title?: string;\n readonly choices: readonly Choice[];\n readonly now: string | null;\n }[],\n choose: (choice: Choice, group: number) => void,\n label: string,\n): TemplateResult {\n return html`<div\n id=${popup}\n class=\"menu\"\n popover=\"manual\"\n role=\"menu\"\n aria-label=${label}\n part=\"style-menu\"\n @keydown=${context.menuKeydown}\n >\n ${groups.map(\n (group, at) => html`<div class=\"menu-section\" role=\"group\" aria-label=${group.title ?? nothing}>\n ${group.title === undefined ? nothing : html`<div class=\"menu-group\" aria-hidden=\"true\">${group.title}</div>`}\n ${group.choices.map(\n (choice) => html`<button\n type=\"button\"\n role=\"menuitemradio\"\n tabindex=\"-1\"\n data-value=${choice.value ?? ''}\n aria-checked=${String(choice.value === group.now)}\n data-font=${choice.font ?? nothing}\n @click=${() => choose(choice, at)}\n >\n ${choice.label}\n </button>`,\n )}\n </div>`,\n )}\n </div>`;\n}\n\nfunction colors(context: StylePopupContext, popup: 'color' | 'highlight'): TemplateResult {\n const property = popup === 'color' ? 'color' : 'background-color';\n return html`<div\n id=${popup}\n class=\"colors\"\n popover=\"manual\"\n role=\"dialog\"\n aria-label=${context.t(`toolbar.${popup}`)}\n part=\"style-colors\"\n @keydown=${(event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n context.close(true);\n }\n }}\n @focusout=${(event: FocusEvent) => {\n const next = event.relatedTarget as Node | null;\n if (next !== null && !(event.currentTarget as HTMLElement).contains(next)) context.close(false);\n }}\n >\n ${colorControl({\n id: popup,\n value: context.styles.text[property] ?? null,\n t: context.t,\n invalid: context.colorError,\n ground: popup === 'highlight',\n pick: (value) => context.setText({ [property]: value }),\n refuse: context.refuseColor,\n })}\n </div>`;\n}\n\n/** The default of `astl-style-open`: the form or the rules in a popup. */\nfunction panel(context: StylePopupContext, target: StyleOpen['target']): TemplateResult {\n const { t, authoring, adapter } = context;\n const title = t(target === 'rules' ? 'style.rules.title' : `style.target.${target}`);\n return html`<div\n id=\"panel\"\n class=\"panel\"\n popover=\"manual\"\n role=\"dialog\"\n tabindex=\"-1\"\n aria-label=${title}\n part=\"style-panel\"\n >\n <div class=\"panel-head\">\n <span>${title}</span>\n <button type=\"button\" data-close @click=${() => context.close(true)}>${t('style.close')}</button>\n </div>\n ${\n target === 'rules'\n ? html`<astl-style-rules .authoring=${authoring} .adapter=${adapter}></astl-style-rules>`\n : html`<astl-style-form .authoring=${authoring} .adapter=${adapter} .target=${target}></astl-style-form>`\n }\n </div>`;\n}\n\n/** The popup that is open. */\nexport function stylePopup(context: StylePopupContext): TemplateResult {\n const { popup, styles, t, fonts, setText, setBlock } = context;\n if (typeof popup === 'object') return panel(context, popup.panel);\n if (popup === 'color' || popup === 'highlight') return colors(context, popup);\n const { text } = styles;\n const none = { value: null, label: t('toolbar.default') };\n const block = styleMapOf(styles.targets.find((target) => target.kind === 'block')?.style ?? '');\n const number = (value: string | undefined) =>\n value === undefined ? null : String(Number.parseFloat(value));\n if (popup === 'font')\n return choiceMenu(\n context,\n 'font',\n [\n {\n choices: [\n none,\n ...fonts.map((font) => ({ value: font.stack, label: font.name, font: font.stack })),\n ],\n now: text['font-family'] ?? null,\n },\n ],\n (choice) => setText({ 'font-family': choice.value }),\n t('toolbar.font.name'),\n );\n if (popup === 'size')\n return choiceMenu(\n context,\n 'size',\n [\n {\n choices: [none, ...FONT_SIZES.map((n) => ({ value: `${n}px`, label: String(n) }))],\n now: text['font-size'] ?? null,\n },\n ],\n (choice) => setText({ 'font-size': choice.value }),\n t('toolbar.size.name'),\n );\n if (popup === 'align') {\n const now = block.get('text-align');\n return choiceMenu(\n context,\n 'align',\n [\n {\n choices: ALIGNS.map((value) => ({ value, label: t(`toolbar.align.${value}`) })),\n now: now === 'left' ? 'start' : now === 'right' ? 'end' : (now ?? 'start'),\n },\n ],\n (choice) => setBlock({ 'text-align': choice.value === 'start' ? null : choice.value }),\n t('toolbar.align'),\n );\n }\n return choiceMenu(\n context,\n 'spacing',\n [\n {\n title: t('toolbar.spacing.line'),\n choices: [none, ...LINE_HEIGHTS.map((value) => ({ value, label: value }))],\n now: number(block.get('line-height')),\n },\n {\n title: t('toolbar.spacing.after'),\n choices: [\n none,\n ...BLOCK_SPACES.map(([value, name]) => ({ value, label: t(`toolbar.spacing.${name}`) })),\n ],\n now: block.has('margin-block-end') ? `${number(block.get('margin-block-end'))}px` : null,\n },\n ],\n (choice, group) => setBlock({ [group === 0 ? 'line-height' : 'margin-block-end']: choice.value }),\n t('toolbar.spacing'),\n );\n}\n"],"mappings":"A,6JAgBA,IAAMO,EAAgC,CAAC,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,EAAE,EACnFC,EAAS,CAAC,QAAS,SAAU,MAAO,SAAS,EAC7CC,EAAkC,CAAC,IAAK,OAAQ,MAAO,GAAG,EAC1DC,EAAuD,CAC3D,CAAC,MAAO,MAAM,EACd,CAAC,MAAO,OAAO,EACf,CAAC,OAAQ,QAAQ,EACjB,CAAC,OAAQ,OAAO,CAClB,EAUaC,EAA8B,CAAG;IAC1CN,EAAY;;;;;;;;;;;;;;;;;;;;;;;EAgDhB,SAASO,EACP,EACA,EACA,EAKA,EACA,EACgB,CAChB,MAAO,EAAI;SACJC,EAAM;;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