@astl/astrolabe 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/dist/cdn/astrolabe-editor.js +55 -19
- package/dist/cdn/astrolabe-editor.js.map +1 -1
- package/dist/cdn/astrolabe.standalone.js +138 -59
- package/dist/cdn/chunks/{help-form-DaC6KaFG.js → help-form-DhIyMziw.js} +14 -10
- package/dist/cdn/chunks/help-form-DhIyMziw.js.map +1 -0
- package/dist/cdn/chunks/{insert-menu-LgrifBYT.js → insert-menu-Cn2E54V9.js} +2 -2
- package/dist/cdn/chunks/{insert-menu-LgrifBYT.js.map → insert-menu-Cn2E54V9.js.map} +1 -1
- package/dist/cdn/chunks/{issue-list-BgnXzXRM.js → issue-list-CQKAW39i.js} +2 -2
- package/dist/cdn/chunks/{issue-list-BgnXzXRM.js.map → issue-list-CQKAW39i.js.map} +1 -1
- package/dist/cdn/chunks/messages-Qzse5KMX.js +2 -0
- package/dist/cdn/chunks/messages-Qzse5KMX.js.map +1 -0
- package/dist/cdn/chunks/{source-view-DXKPFCl9.js → source-view-BlJ2mRns.js} +2 -2
- package/dist/cdn/chunks/{source-view-DXKPFCl9.js.map → source-view-BlJ2mRns.js.map} +1 -1
- package/dist/cdn/chunks/{style-form-D5haJtWM.js → style-form-D1C2sHzg.js} +2 -2
- package/dist/cdn/chunks/{style-form-D5haJtWM.js.map → style-form-D1C2sHzg.js.map} +1 -1
- package/dist/cdn/chunks/{style-messages-BbZpeD2a.js → style-messages-B136zSom.js} +2 -2
- package/dist/cdn/chunks/{style-messages-BbZpeD2a.js.map → style-messages-B136zSom.js.map} +1 -1
- package/dist/cdn/chunks/{style-rules-D45PZLCv.js → style-rules-ChqPVgZn.js} +2 -2
- package/dist/cdn/chunks/{style-rules-D45PZLCv.js.map → style-rules-ChqPVgZn.js.map} +1 -1
- package/dist/cdn/chunks/{styles-DxJJxVNH.js → styles-CXkkL_Qi.js} +2 -2
- package/dist/cdn/chunks/{styles-DxJJxVNH.js.map → styles-CXkkL_Qi.js.map} +1 -1
- package/dist/cdn/chunks/surface-BhmSAte0.js +1058 -0
- package/dist/cdn/chunks/surface-BhmSAte0.js.map +1 -0
- package/package.json +9 -9
- package/dist/cdn/chunks/help-form-DaC6KaFG.js.map +0 -1
- package/dist/cdn/chunks/messages-9xiYDvRT.js +0 -2
- package/dist/cdn/chunks/messages-9xiYDvRT.js.map +0 -1
- package/dist/cdn/chunks/surface-CgxfAwCR.js +0 -1019
- package/dist/cdn/chunks/surface-CgxfAwCR.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-messages-
|
|
1
|
+
{"version":3,"file":"style-messages-B136zSom.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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,E as t,b as n}from"./runtime-DxAbpr3S.js";import"./declarations-BhqOz1ap.js";import{n as r,r as i,t as a}from"./styles-
|
|
1
|
+
import{C as e,E as t,b as n}from"./runtime-DxAbpr3S.js";import"./declarations-BhqOz1ap.js";import{n as r,r as i,t as a}from"./styles-CXkkL_Qi.js";import{a as o}from"./style-placing-DPw1zyrz.js";import{t as s}from"./style-messages-B136zSom.js";var c=[[`paragraph`,`p`],[`heading`,`h3`],[`subheading`,`h4`],[`quote`,`blockquote`],[`list`,`li`],[`caption`,`figcaption`],[`picture`,`img`]],l=class extends i{static styles=[r,a(`astl-style-form`),t`
|
|
2
2
|
h3 {
|
|
3
3
|
margin: 0;
|
|
4
4
|
font-size: 1rem;
|
|
@@ -133,4 +133,4 @@ font-size: var(--astl-size-small);
|
|
|
133
133
|
${this.t(`toolbar.undo`)}
|
|
134
134
|
</button>`}
|
|
135
135
|
</section>`}};export{l as AstlStyleRules};
|
|
136
|
-
//# sourceMappingURL=style-rules-
|
|
136
|
+
//# sourceMappingURL=style-rules-ChqPVgZn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-rules-D45PZLCv.js","names":["nothing","b","i","A","kitStyles","AuthoringElement","inheritTokens","styleNameFrom","styleMessages","TAGS","AstlStyleRules","changed","#open","key","rule","styles","#styles","label","#newLabel","taken","name","#renaming","text","open","#rename","event","#toggle","#delete","#form","lang","dir","rules","named","full","tag","id","own","#namedRow","#add","button"],"sources":["../../../../editor/src/elements/style-rules.ts"],"sourcesContent":["import type { EditorStyleRule } from '@astl/core';\nimport { MAX_STYLE_RULES } from '@astl/core/declarations';\nimport { type CSSResultGroup, css, html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { styleMessages } from '../style-messages.js';\nimport { styleNameFrom } from '../style-placing.js';\nimport { AuthoringElement } from './base.js';\nimport { inheritTokens, kitStyles } from './styles.js';\n\n/** The tags of \"Text styles\": what authors call them, and the element each rule reaches. */\nconst TAGS: readonly (readonly [key: string, tag: string])[] = [\n ['paragraph', 'p'],\n ['heading', 'h3'],\n ['subheading', 'h4'],\n ['quote', 'blockquote'],\n ['list', 'li'],\n ['caption', 'figcaption'],\n ['picture', 'img'],\n];\n\n/**\n * `<astl-style-rules>`: the document's rules, each opening the form that edits it. \"Text styles\" holds a rule per tag\n * (every paragraph, every heading of the exercise), \"My styles\" the named ones: add, rename, edit, delete. A deleted\n * style leaves no class behind. Everything is one undo step, undone here or in the editor. A host places it (a view of\n * its own, a card), with `authoring` and `adapter`, after `loadStyleElements`; the toolbar's style menu opens it in a\n * popup otherwise.\n */\nexport class AstlStyleRules extends AuthoringElement {\n static override styles: CSSResultGroup = [\n kitStyles,\n inheritTokens('astl-style-form'),\n css`\n h3 {\n margin: 0;\n font-size: 1rem;\n }\n li.row {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n }\n .line {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--astl-space-1);\n }\n .line > .name {\n flex: 1 1 8rem;\n justify-content: flex-start;\n }\n .line > .name::after {\n content: '';\n margin-inline-start: auto;\n border-block: 0.3em solid transparent;\n border-inline-start: 0.45em solid currentColor;\n }\n .line > .name[aria-expanded='true']::after {\n rotate: 90deg;\n }\n .line > input {\n flex: 1 1 8rem;\n inline-size: auto;\n }\n form {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n gap: var(--astl-space-2);\n align-items: end;\n }\n form label {\n grid-column: 1 / -1;\n font-weight: 600;\n }\n .undo {\n align-self: flex-start;\n }\n .summary {\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-small);\n }\n `,\n ];\n\n /** The rule whose form is open: `for:<tag>` or `name:<name>`. */\n #open: string | null = null;\n /** The named style being renamed. */\n #renaming: string | null = null;\n #newLabel = '';\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n super.willUpdate(changed);\n if (changed.has('authoring')) this.authoring?.addMessages(styleMessages);\n }\n\n #styles() {\n return this.adapter?.style ?? null;\n }\n\n #toggle(key: string): void {\n this.#open = this.#open === key ? null : key;\n this.requestUpdate();\n }\n\n #form(rule: Pick<EditorStyleRule, 'name' | 'for'>): TemplateResult {\n return html`<astl-style-form\n .authoring=${this.authoring}\n .adapter=${this.adapter}\n .rule=${rule}\n ></astl-style-form>`;\n }\n\n #add(): void {\n const styles = this.#styles();\n const label = this.#newLabel.trim();\n if (styles === null || label === '') {\n this.renderRoot.querySelector<HTMLInputElement>('#new-style')?.focus();\n return;\n }\n const taken = new Set(styles.rules().flatMap((rule) => rule.name ?? []));\n const name = styleNameFrom(label, taken);\n if (styles.setRule({ name, label, style: '' })) {\n this.#newLabel = '';\n this.#open = `name:${name}`;\n }\n this.requestUpdate();\n }\n\n #rename(rule: EditorStyleRule, text: string): void {\n // Removing the field after Enter or Escape fires its change: that one is not a rename.\n if (this.#renaming !== rule.name) return;\n const label = text.trim();\n if (label !== '') this.#styles()?.setRule({ ...rule, label });\n this.#renaming = null;\n this.requestUpdate();\n }\n\n #delete(rule: EditorStyleRule): void {\n this.#styles()?.removeRule({ ...(rule.name === undefined ? {} : { name: rule.name }) });\n if (this.#open === `name:${rule.name}`) this.#open = null;\n // The row and its button are gone: the focus goes to what is next to it for sure.\n this.requestUpdate();\n void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>('#new-style')?.focus());\n }\n\n #namedRow(rule: EditorStyleRule): TemplateResult {\n const key = `name:${rule.name}`;\n const label = rule.label ?? rule.name ?? '';\n const open = this.#open === key;\n return html`<li class=\"row\" data-style=${rule.name ?? ''}>\n <div class=\"line\">\n ${\n this.#renaming === rule.name\n ? html`<input\n type=\"text\"\n aria-label=${this.t('style.rules.renameField', { label })}\n .value=${label}\n @change=${(event: Event) => this.#rename(rule, (event.target as HTMLInputElement).value)}\n @keydown=${(event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.#rename(rule, (event.target as HTMLInputElement).value);\n } else if (event.key === 'Escape') {\n event.preventDefault();\n this.#renaming = null;\n this.requestUpdate();\n }\n }}\n />`\n : html`<button\n type=\"button\"\n class=\"name\"\n data-edit\n aria-expanded=${String(open)}\n aria-label=${this.t('style.rules.edit', { label })}\n @click=${() => this.#toggle(key)}\n >\n ${label}\n </button>`\n }\n <button\n type=\"button\"\n data-rename\n aria-label=${this.t('style.rules.rename', { label })}\n @click=${() => {\n this.#renaming = rule.name ?? null;\n this.requestUpdate();\n void this.updateComplete.then(() =>\n this.renderRoot.querySelector<HTMLInputElement>(`[data-style=\"${rule.name}\"] input`)?.select(),\n );\n }}\n >\n ${this.t('style.rules.renameShort')}\n </button>\n <button\n type=\"button\"\n data-delete\n aria-label=${this.t('style.rules.delete', { label })}\n @click=${() => this.#delete(rule)}\n >\n ${this.t('style.rules.deleteShort')}\n </button>\n </div>\n ${open ? this.#form({ ...(rule.name === undefined ? {} : { name: rule.name }) }) : nothing}\n </li>`;\n }\n\n protected override render(): TemplateResult | typeof nothing {\n if (this.authoring === null) return nothing;\n const { lang, dir } = this.ui;\n const styles = this.#styles();\n if (styles === null)\n return html`<p class=\"note\" lang=${lang} dir=${dir}>${this.t('style.form.none')}</p>`;\n const rules = styles.rules();\n const named = rules.filter((rule) => rule.name !== undefined);\n const full = rules.length >= MAX_STYLE_RULES;\n return html`<section class=\"kit\" part=\"root\" lang=${lang} dir=${dir} aria-labelledby=\"rules-title\">\n <h2 class=\"title\" id=\"rules-title\" part=\"title\">${this.t('style.rules.title')}</h2>\n <h3 id=\"tags-title\">${this.t('style.rules.tags')}</h3>\n <ul role=\"list\" aria-labelledby=\"tags-title\">\n ${TAGS.map(([key, tag]) => {\n const id = `for:${tag}`;\n const open = this.#open === id;\n const label = this.t(`style.tag.${key}`);\n const own = rules.find((rule) => rule.for === tag)?.style;\n return html`<li class=\"row\" data-for=${tag}>\n <div class=\"line\">\n <button\n type=\"button\"\n class=\"name\"\n data-edit\n aria-expanded=${String(open)}\n aria-label=${this.t('style.rules.edit', { label })}\n @click=${() => this.#toggle(id)}\n >\n ${label}\n </button>\n </div>\n ${own === undefined ? nothing : html`<span class=\"summary\">${own}</span>`}\n ${open ? this.#form({ for: tag }) : nothing}\n </li>`;\n })}\n </ul>\n <h3 id=\"named-title\">${this.t('toolbar.myStyles')}</h3>\n ${\n named.length === 0\n ? html`<p class=\"note\">${this.t('style.rules.empty')}</p>`\n : html`<ul role=\"list\" aria-labelledby=\"named-title\">${named.map((rule) => this.#namedRow(rule))}</ul>`\n }\n <form\n @submit=${(event: Event) => {\n event.preventDefault();\n this.#add();\n }}\n >\n <label for=\"new-style\">${this.t('style.rules.newLabel')}</label>\n <input\n id=\"new-style\"\n type=\"text\"\n autocomplete=\"off\"\n .value=${this.#newLabel}\n @input=${(event: Event) => {\n this.#newLabel = (event.target as HTMLInputElement).value;\n }}\n />\n <button type=\"submit\" data-add ?disabled=${full}>${this.t('style.rules.add')}</button>\n </form>\n ${\n this.adapter?.undo === undefined\n ? nothing\n : html`<button\n type=\"button\"\n class=\"undo\"\n data-undo\n @click=${(event: Event) => {\n const button = event.currentTarget as HTMLElement;\n this.adapter?.undo?.();\n // Undoing focuses the text a frame later; the author is still here, and in a host's view the text is\n // not on show.\n requestAnimationFrame(() => button.focus());\n this.requestUpdate();\n }}\n >\n ${this.t('toolbar.undo')}\n </button>`\n }\n </section>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'astl-style-rules': AstlStyleRules;\n }\n}\n"],"mappings":"A,mPASA,IAAMS,EAAyD,CAC7D,CAAC,YAAa,GAAG,EACjB,CAAC,UAAW,IAAI,EAChB,CAAC,aAAc,IAAI,EACnB,CAAC,QAAS,YAAY,EACtB,CAAC,OAAQ,IAAI,EACb,CAAC,UAAW,YAAY,EACxB,CAAC,UAAW,KAAK,CACnB,EASaC,EAAb,cAAoCL,CAAiB,CACnD,OAAgB,OAAyB,CACvCD,EACAE,EAAc,iBAAiB,EAC/B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDL,EAGA,GAAuB,KAEvB,GAA2B,KAC3B,GAAY,GAEZ,WAA8B,EAAqC,CACj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,EACrB,KAAKa,GAAK,CACZ,EAAE;;iCAEuB,KAAK,EAAE,sBAAsB,EAAE;;;;;mBAK7C,KAAKpB,GAAU;mBACd,GAAiB,CACzB,KAAKA,GAAaO,EAAM,OAA4B,KACtD,EAAE;;mDAEuCQ,EAAK,GAAG,KAAK,EAAE,iBAAiB,EAAE;;QAG7E,KAAK,SAAS,OAAS,IAAA,GACnBjC,EACA,CAAI;;;;uBAIQ,GAAiB,CACzB,IAAMuC,EAASd,EAAM,cACrB,KAAK,SAAS,OAAO,EAGrB,0BAA4Bc,EAAO,MAAM,CAAC,EAC1C,KAAK,cAAc,CACrB,EAAE;;gBAEA,KAAK,EAAE,cAAc,EAAE;uBAEhC;eAEL,CACF,E"}
|
|
1
|
+
{"version":3,"file":"style-rules-ChqPVgZn.js","names":["nothing","b","i","A","kitStyles","AuthoringElement","inheritTokens","styleNameFrom","styleMessages","TAGS","AstlStyleRules","changed","#open","key","rule","styles","#styles","label","#newLabel","taken","name","#renaming","text","open","#rename","event","#toggle","#delete","#form","lang","dir","rules","named","full","tag","id","own","#namedRow","#add","button"],"sources":["../../../../editor/src/elements/style-rules.ts"],"sourcesContent":["import type { EditorStyleRule } from '@astl/core';\nimport { MAX_STYLE_RULES } from '@astl/core/declarations';\nimport { type CSSResultGroup, css, html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { styleMessages } from '../style-messages.js';\nimport { styleNameFrom } from '../style-placing.js';\nimport { AuthoringElement } from './base.js';\nimport { inheritTokens, kitStyles } from './styles.js';\n\n/** The tags of \"Text styles\": what authors call them, and the element each rule reaches. */\nconst TAGS: readonly (readonly [key: string, tag: string])[] = [\n ['paragraph', 'p'],\n ['heading', 'h3'],\n ['subheading', 'h4'],\n ['quote', 'blockquote'],\n ['list', 'li'],\n ['caption', 'figcaption'],\n ['picture', 'img'],\n];\n\n/**\n * `<astl-style-rules>`: the document's rules, each opening the form that edits it. \"Text styles\" holds a rule per tag\n * (every paragraph, every heading of the exercise), \"My styles\" the named ones: add, rename, edit, delete. A deleted\n * style leaves no class behind. Everything is one undo step, undone here or in the editor. A host places it (a view of\n * its own, a card), with `authoring` and `adapter`, after `loadStyleElements`; the toolbar's style menu opens it in a\n * popup otherwise.\n */\nexport class AstlStyleRules extends AuthoringElement {\n static override styles: CSSResultGroup = [\n kitStyles,\n inheritTokens('astl-style-form'),\n css`\n h3 {\n margin: 0;\n font-size: 1rem;\n }\n li.row {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n }\n .line {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--astl-space-1);\n }\n .line > .name {\n flex: 1 1 8rem;\n justify-content: flex-start;\n }\n .line > .name::after {\n content: '';\n margin-inline-start: auto;\n border-block: 0.3em solid transparent;\n border-inline-start: 0.45em solid currentColor;\n }\n .line > .name[aria-expanded='true']::after {\n rotate: 90deg;\n }\n .line > input {\n flex: 1 1 8rem;\n inline-size: auto;\n }\n form {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n gap: var(--astl-space-2);\n align-items: end;\n }\n form label {\n grid-column: 1 / -1;\n font-weight: 600;\n }\n .undo {\n align-self: flex-start;\n }\n .summary {\n color: var(--astl-ink-muted);\n font-size: var(--astl-size-small);\n }\n `,\n ];\n\n /** The rule whose form is open: `for:<tag>` or `name:<name>`. */\n #open: string | null = null;\n /** The named style being renamed. */\n #renaming: string | null = null;\n #newLabel = '';\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n super.willUpdate(changed);\n if (changed.has('authoring')) this.authoring?.addMessages(styleMessages);\n }\n\n #styles() {\n return this.adapter?.style ?? null;\n }\n\n #toggle(key: string): void {\n this.#open = this.#open === key ? null : key;\n this.requestUpdate();\n }\n\n #form(rule: Pick<EditorStyleRule, 'name' | 'for'>): TemplateResult {\n return html`<astl-style-form\n .authoring=${this.authoring}\n .adapter=${this.adapter}\n .rule=${rule}\n ></astl-style-form>`;\n }\n\n #add(): void {\n const styles = this.#styles();\n const label = this.#newLabel.trim();\n if (styles === null || label === '') {\n this.renderRoot.querySelector<HTMLInputElement>('#new-style')?.focus();\n return;\n }\n const taken = new Set(styles.rules().flatMap((rule) => rule.name ?? []));\n const name = styleNameFrom(label, taken);\n if (styles.setRule({ name, label, style: '' })) {\n this.#newLabel = '';\n this.#open = `name:${name}`;\n }\n this.requestUpdate();\n }\n\n #rename(rule: EditorStyleRule, text: string): void {\n // Removing the field after Enter or Escape fires its change: that one is not a rename.\n if (this.#renaming !== rule.name) return;\n const label = text.trim();\n if (label !== '') this.#styles()?.setRule({ ...rule, label });\n this.#renaming = null;\n this.requestUpdate();\n }\n\n #delete(rule: EditorStyleRule): void {\n this.#styles()?.removeRule({ ...(rule.name === undefined ? {} : { name: rule.name }) });\n if (this.#open === `name:${rule.name}`) this.#open = null;\n // The row and its button are gone: the focus goes to what is next to it for sure.\n this.requestUpdate();\n void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>('#new-style')?.focus());\n }\n\n #namedRow(rule: EditorStyleRule): TemplateResult {\n const key = `name:${rule.name}`;\n const label = rule.label ?? rule.name ?? '';\n const open = this.#open === key;\n return html`<li class=\"row\" data-style=${rule.name ?? ''}>\n <div class=\"line\">\n ${\n this.#renaming === rule.name\n ? html`<input\n type=\"text\"\n aria-label=${this.t('style.rules.renameField', { label })}\n .value=${label}\n @change=${(event: Event) => this.#rename(rule, (event.target as HTMLInputElement).value)}\n @keydown=${(event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.#rename(rule, (event.target as HTMLInputElement).value);\n } else if (event.key === 'Escape') {\n event.preventDefault();\n this.#renaming = null;\n this.requestUpdate();\n }\n }}\n />`\n : html`<button\n type=\"button\"\n class=\"name\"\n data-edit\n aria-expanded=${String(open)}\n aria-label=${this.t('style.rules.edit', { label })}\n @click=${() => this.#toggle(key)}\n >\n ${label}\n </button>`\n }\n <button\n type=\"button\"\n data-rename\n aria-label=${this.t('style.rules.rename', { label })}\n @click=${() => {\n this.#renaming = rule.name ?? null;\n this.requestUpdate();\n void this.updateComplete.then(() =>\n this.renderRoot.querySelector<HTMLInputElement>(`[data-style=\"${rule.name}\"] input`)?.select(),\n );\n }}\n >\n ${this.t('style.rules.renameShort')}\n </button>\n <button\n type=\"button\"\n data-delete\n aria-label=${this.t('style.rules.delete', { label })}\n @click=${() => this.#delete(rule)}\n >\n ${this.t('style.rules.deleteShort')}\n </button>\n </div>\n ${open ? this.#form({ ...(rule.name === undefined ? {} : { name: rule.name }) }) : nothing}\n </li>`;\n }\n\n protected override render(): TemplateResult | typeof nothing {\n if (this.authoring === null) return nothing;\n const { lang, dir } = this.ui;\n const styles = this.#styles();\n if (styles === null)\n return html`<p class=\"note\" lang=${lang} dir=${dir}>${this.t('style.form.none')}</p>`;\n const rules = styles.rules();\n const named = rules.filter((rule) => rule.name !== undefined);\n const full = rules.length >= MAX_STYLE_RULES;\n return html`<section class=\"kit\" part=\"root\" lang=${lang} dir=${dir} aria-labelledby=\"rules-title\">\n <h2 class=\"title\" id=\"rules-title\" part=\"title\">${this.t('style.rules.title')}</h2>\n <h3 id=\"tags-title\">${this.t('style.rules.tags')}</h3>\n <ul role=\"list\" aria-labelledby=\"tags-title\">\n ${TAGS.map(([key, tag]) => {\n const id = `for:${tag}`;\n const open = this.#open === id;\n const label = this.t(`style.tag.${key}`);\n const own = rules.find((rule) => rule.for === tag)?.style;\n return html`<li class=\"row\" data-for=${tag}>\n <div class=\"line\">\n <button\n type=\"button\"\n class=\"name\"\n data-edit\n aria-expanded=${String(open)}\n aria-label=${this.t('style.rules.edit', { label })}\n @click=${() => this.#toggle(id)}\n >\n ${label}\n </button>\n </div>\n ${own === undefined ? nothing : html`<span class=\"summary\">${own}</span>`}\n ${open ? this.#form({ for: tag }) : nothing}\n </li>`;\n })}\n </ul>\n <h3 id=\"named-title\">${this.t('toolbar.myStyles')}</h3>\n ${\n named.length === 0\n ? html`<p class=\"note\">${this.t('style.rules.empty')}</p>`\n : html`<ul role=\"list\" aria-labelledby=\"named-title\">${named.map((rule) => this.#namedRow(rule))}</ul>`\n }\n <form\n @submit=${(event: Event) => {\n event.preventDefault();\n this.#add();\n }}\n >\n <label for=\"new-style\">${this.t('style.rules.newLabel')}</label>\n <input\n id=\"new-style\"\n type=\"text\"\n autocomplete=\"off\"\n .value=${this.#newLabel}\n @input=${(event: Event) => {\n this.#newLabel = (event.target as HTMLInputElement).value;\n }}\n />\n <button type=\"submit\" data-add ?disabled=${full}>${this.t('style.rules.add')}</button>\n </form>\n ${\n this.adapter?.undo === undefined\n ? nothing\n : html`<button\n type=\"button\"\n class=\"undo\"\n data-undo\n @click=${(event: Event) => {\n const button = event.currentTarget as HTMLElement;\n this.adapter?.undo?.();\n // Undoing focuses the text a frame later; the author is still here, and in a host's view the text is\n // not on show.\n requestAnimationFrame(() => button.focus());\n this.requestUpdate();\n }}\n >\n ${this.t('toolbar.undo')}\n </button>`\n }\n </section>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'astl-style-rules': AstlStyleRules;\n }\n}\n"],"mappings":"A,mPASA,IAAMS,EAAyD,CAC7D,CAAC,YAAa,GAAG,EACjB,CAAC,UAAW,IAAI,EAChB,CAAC,aAAc,IAAI,EACnB,CAAC,QAAS,YAAY,EACtB,CAAC,OAAQ,IAAI,EACb,CAAC,UAAW,YAAY,EACxB,CAAC,UAAW,KAAK,CACnB,EASaC,EAAb,cAAoCL,CAAiB,CACnD,OAAgB,OAAyB,CACvCD,EACAE,EAAc,iBAAiB,EAC/B,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDL,EAGA,GAAuB,KAEvB,GAA2B,KAC3B,GAAY,GAEZ,WAA8B,EAAqC,CACjE,MAAM,WAAWK,CAAO,EACpBA,EAAQ,IAAI,WAAW,GAAG,KAAK,WAAW,YAAYH,CAAa,CACzE,CAEA,IAAU,CACR,OAAO,KAAK,SAAS,OAAS,IAChC,CAEA,GAAQ,EAAmB,CACzB,KAAKI,GAAQ,KAA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G,KAAK,EAAE,iBAAiB,EAAE;;QAG7E,KAAK,SAAS,OAAS,IAAA,GACnBjC,EACA,CAAI;;;;uBAIQ,GAAiB,CACzB,IAAMuC,EAASd,EAAM,cACrB,KAAK,SAAS,OAAO,EAGrB,0BAA4Bc,EAAO,MAAM,CAAC,EAC1C,KAAK,cAAc,CACrB,EAAE;;gBAEA,KAAK,EAAE,cAAc,EAAE;uBAEhC;eAEL,CACF,E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as e,E as t,M as n,Pt as r,_ as i,k as a,y as o}from"./runtime-DxAbpr3S.js";import"./messages-
|
|
1
|
+
import{D as e,E as t,M as n,Pt as r,_ as i,k as a,y as o}from"./runtime-DxAbpr3S.js";import"./messages-Qzse5KMX.js";var s=class extends o{static properties={authoring:{attribute:!1},adapter:{attribute:!1}};#e=null;constructor(){super(),this.authoring=null,this.adapter=null}connectedCallback(){super.connectedCallback(),this.#t()}disconnectedCallback(){super.disconnectedCallback(),this.#n()}willUpdate(e){e.has(`adapter`)&&this.#t()}#t(){let e=this.isConnected?this.adapter:null;if((this.#e?.adapter??null)===e||(this.#n(),e===null))return;let t=[e.onChange(()=>this.sourceChanged()),e.onSelectionChange(e=>this.selectionChanged(e)),e.onCursorChange?.(()=>this.cursorChanged())??(()=>{})];this.#e={adapter:e,off:()=>{for(let e of t)e()}}}#n(){this.#e?.off(),this.#e=null}sourceChanged(){this.requestUpdate()}selectionChanged(e){this.requestUpdate()}cursorChanged(){}t(e,t){return this.authoring?.t(`astl.editor`,e,t)??e}get ui(){let e=this.authoring?.locale??`en`;return{lang:e,dir:r(e)}}};function c(t){let r=[`color-scheme: inherit;`,...[n.scale,n.themes.light,n.themeScale.light].flatMap(Object.keys).map(e=>`--astl-${e}: inherit;`)];return e(`${t} {\n${r.join(`
|
|
2
2
|
`)}\n}`)}var l=[e(a(`:host`)),i,t`
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
@@ -133,4 +133,4 @@ forced-color-adjust: none;
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
`];export{l as n,s as r,c as t};
|
|
136
|
-
//# sourceMappingURL=styles-
|
|
136
|
+
//# sourceMappingURL=styles-CXkkL_Qi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles-DxJJxVNH.js","names":["LitElement","unsafeCSS","r","i$1","tokens","directionOf","visuallyHidden","tokensCss","i","AuthoringElement","#subscribe","#unsubscribe","changed","adapter","#subscription","offs","selection","off","key","params","lang","inheritTokens","lines","name","selector","kitStyles"],"sources":["../../../../editor/src/elements/base.ts","../../../../editor/src/elements/styles.ts"],"sourcesContent":["import {\n type Direction,\n directionOf,\n type EditorAdapter,\n type EditorSelection,\n type MessageParams,\n} from '@astl/core';\nimport { LitElement, type PropertyDeclarations, type PropertyValues } from 'lit';\nimport type { Authoring } from '../authoring.js';\nimport { EDITOR_NAMESPACE } from '../messages.js';\n\n/**\n * Base of the kit elements: `authoring` and `adapter` properties, a subscription to the adapter's events while\n * connected (re-rendering by default) and UI strings in the authoring locale.\n */\nexport class AuthoringElement extends LitElement {\n static override properties: PropertyDeclarations = {\n authoring: { attribute: false },\n adapter: { attribute: false },\n };\n\n declare authoring: Authoring | null;\n declare adapter: EditorAdapter | null;\n\n #subscription: { readonly adapter: EditorAdapter; readonly off: () => void } | null = null;\n\n constructor() {\n super();\n this.authoring = null;\n this.adapter = null;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.#subscribe();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#unsubscribe();\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has('adapter')) this.#subscribe();\n }\n\n #subscribe(): void {\n const adapter = this.isConnected ? this.adapter : null;\n if ((this.#subscription?.adapter ?? null) === adapter) return;\n this.#unsubscribe();\n if (adapter === null) return;\n const offs = [\n adapter.onChange(() => this.sourceChanged()),\n adapter.onSelectionChange((selection) => this.selectionChanged(selection)),\n adapter.onCursorChange?.(() => this.cursorChanged()) ?? (() => {}),\n ];\n this.#subscription = {\n adapter,\n off: () => {\n for (const off of offs) off();\n },\n };\n }\n\n #unsubscribe(): void {\n this.#subscription?.off();\n this.#subscription = null;\n }\n\n /** The document changed. */\n protected sourceChanged(): void {\n this.requestUpdate();\n }\n\n /** The cursor entered or left a component. */\n protected selectionChanged(_selection: EditorSelection | null): void {\n this.requestUpdate();\n }\n\n /** The cursor moved, or the document or its history changed. Most elements have nothing to do. */\n protected cursorChanged(): void {}\n\n /** A kit message (`astl.editor`) in the authoring locale. */\n protected t(key: string, params?: MessageParams): string {\n return this.authoring?.t(EDITOR_NAMESPACE, key, params) ?? key;\n }\n\n /** Language and direction of the UI strings. */\n protected get ui(): { readonly lang: string; readonly dir: Direction } {\n const lang = this.authoring?.locale ?? 'en';\n return { lang, dir: directionOf(lang) };\n }\n}\n","import { visuallyHidden } from '@astl/player';\nimport { tokens, tokensCss } from '@astl/tokens';\nimport { type CSSResult, type CSSResultGroup, css, unsafeCSS } from 'lit';\n\n/**\n * Every token as `inherit` on `selector`, for elements that redeclare the tokens on their own `:host` (the player): a\n * rule from the outer tree wins over `:host`, so tokens set on the kit element reach them.\n */\nexport function inheritTokens(selector: string): CSSResult {\n const names = [tokens.scale, tokens.themes.light, tokens.themeScale.light].flatMap(Object.keys);\n const lines = ['color-scheme: inherit;', ...names.map((name) => `--astl-${name}: inherit;`)];\n return unsafeCSS(`${selector} {\\n${lines.join('\\n')}\\n}`);\n}\n\n/** Shared look of the kit elements: a card, native controls with 44px targets, visible focus. Tokens only. */\nexport const kitStyles: CSSResultGroup = [\n // Tokens sit on :host so host pages can override any --astl-* property on the element itself.\n unsafeCSS(tokensCss(':host')),\n visuallyHidden,\n css`\n :host {\n display: block;\n color: var(--astl-ink);\n font-family: var(--astl-font-body);\n font-size: var(--astl-size-ui);\n line-height: 1.4;\n }\n :host([hidden]) {\n display: none;\n }\n .kit {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-3);\n min-inline-size: 0;\n padding: var(--astl-space-4);\n border: var(--astl-outline-width) solid var(--astl-line);\n border-radius: var(--astl-radius-l);\n background: var(--astl-surface);\n color: var(--astl-ink);\n overflow-wrap: anywhere;\n }\n .title {\n margin: 0;\n font-family: var(--astl-font-display);\n font-size: 1.125rem;\n line-height: 1.3;\n }\n .note {\n margin: 0;\n color: var(--astl-ink-muted);\n }\n ul {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n button {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n gap: var(--astl-space-2);\n min-block-size: var(--astl-target-min);\n min-inline-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n color: var(--astl-ink);\n font: inherit;\n text-align: start;\n cursor: pointer;\n }\n button:hover:not(:disabled) {\n background: var(--astl-accent-soft);\n }\n `,\n // Disabled shows without colour too: a dashed border and no fill. In the high contrast theme the line and muted\n // colours are as dark as the enabled ones. Disabled (no editor yet), the primary button must not look pressable.\n css`\n button:is(:disabled, [aria-disabled='true']) {\n border-color: var(--astl-line);\n border-style: dashed;\n background: transparent;\n color: var(--astl-ink-muted);\n cursor: not-allowed;\n }\n button.primary {\n border-color: var(--astl-accent);\n background: var(--astl-accent);\n color: var(--astl-on-accent);\n font-weight: 600;\n }\n button.primary:hover:not(:disabled) {\n background: var(--astl-accent);\n text-decoration: underline;\n }\n button.primary:disabled {\n border-color: var(--astl-line);\n background: transparent;\n color: var(--astl-ink-muted);\n }\n input:not([type='checkbox'], [type='radio']),\n select,\n textarea {\n box-sizing: border-box;\n inline-size: 100%;\n min-inline-size: 0;\n min-block-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-1);\n padding-inline: var(--astl-space-2);\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-s);\n background: var(--astl-surface);\n color: var(--astl-ink);\n font: inherit;\n }\n input[type='checkbox'],\n input[type='radio'] {\n flex: none;\n inline-size: 1.25rem;\n block-size: 1.25rem;\n margin: 0;\n accent-color: var(--astl-accent);\n }\n :focus-visible {\n outline: var(--astl-focus-width) solid var(--astl-focus);\n outline-offset: var(--astl-focus-offset);\n }\n .icon {\n flex: none;\n inline-size: 1.25rem;\n block-size: 1.25rem;\n }\n `,\n // Forced colours: disabled as the system draws disabled controls (the dashed border stays). The Canvas backplate\n // forced colours draw behind text would hide the HighlightText label on the Highlight fill, so the primary button\n // uses only system colours here and keeps its own. Disabled, it stays forced: its muted label would not read on the\n // fill.\n css`\n @media (forced-colors: active) {\n button.primary {\n border-color: ButtonText;\n }\n button:disabled,\n button.primary:disabled {\n border-color: GrayText;\n color: GrayText;\n }\n button.primary:not(:disabled) {\n forced-color-adjust: none;\n }\n }\n `,\n];\n"],"mappings":"A,oHAeA,IAAaS,EAAb,cAAsCT,CAAW,CAC/C,OAAgB,WAAmC,CACjD,UAAW,CAAE,UAAW,EAAM,EAC9B,QAAS,CAAE,UAAW,EAAM,CAC9B,EAKA,GAAsF,KAEtF,aAAc,CACZ,MAAM,EACN,KAAK,UAAY,KACjB,KAAK,QAAU,IACjB,CAEA,mBAAmC,CACjC,MAAM,kBAAkB,EACxB,KAAKU,GAAW,CAClB,CAEA,sBAAsC,CACpC,MAAM,qBAAqB,EAC3B,KAAKC,GAAa,CACpB,CAEA,WAA8B,EAAqC,CAC7DC,EAAQ,IAAI,SAAS,GAAG,KAAKF,GAAW,CAC9C,CAEA,IAAmB,CACjB,IAAMG,EAAU,KAAK,YAAc,KAAK,QAAU,KAGlD,IAFK,KAAKC,IAAe,SAAW,QAAUD,IAC9C,KAAKF,GAAa,EACdE,IAAY,MAAM,OACtB,IAAME,EAAO,CACXF,EAAQ,aAAe,KAAK,cAAc,CAAC,EAC3CA,EAAQ,kBAAmB,GAAc,KAAK,iBAAiBG,CAAS,CAAC,EACzEH,EAAQ,qBAAuB,KAAK,cAAc,CAAC,QAAY,CAAC,EAClE,EACA,KAAKC,GAAgB,CACnB,UACA,QAAW,CACT,IAAK,IAAMG,KAAOF,EAAME,EAAI,CAC9B,CACF,CACF,CAEA,IAAqB,CACnB,KAAKH,IAAe,IAAI,EACxB,KAAKA,GAAgB,IACvB,CAGA,eAAgC,CAC9B,KAAK,cAAc,CACrB,CAGA,iBAA2B,EAA0C,CACnE,KAAK,cAAc,CACrB,CAGA,eAAgC,CAAC,CAGjC,EAAY,EAAa,EAAgC,CACvD,OAAO,KAAK,WAAW,EAAA,cAAoBI,EAAKC,CAAM,GAAKD,CAC7D,CAGA,IAAc,IAAyD,CACrE,IAAME,EAAO,KAAK,WAAW,QAAU,KACvC,MAAO,CAAE,OAAM,IAAKf,EAAYe,CAAI,CAAE,CACxC,CACF,ECpFA,SAAgBC,EAAc,EAA6B,CAEzD,IAAMC,EAAQ,CAAC,yBAA0B,GAD3B,CAAClB,EAAO,MAAOA,EAAO,OAAO,MAAOA,EAAO,WAAW,KAAK,CAAC,CAAC,QAAQ,OAAO,IAC9C,CAAA,CAAM,IAAK,GAAS,UAAUmB,EAAK,WAAW,CAAC,EAC3F,OAAOtB,EAAU,GAAGuB,EAAS,MAAMF,EAAM,KAAK;CAAI,EAAE,IAAI,CAC1D,CAGA,IAAaG,EAA4B,CAEvCxB,EAAUM,EAAU,OAAO,CAAC,EAC5BD,EACA,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEH,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DH,CAAG;;;;;;;;;;;;;;CAeL,E"}
|
|
1
|
+
{"version":3,"file":"styles-CXkkL_Qi.js","names":["LitElement","unsafeCSS","r","i$1","tokens","directionOf","visuallyHidden","tokensCss","i","AuthoringElement","#subscribe","#unsubscribe","changed","adapter","#subscription","offs","selection","off","key","params","lang","inheritTokens","lines","name","selector","kitStyles"],"sources":["../../../../editor/src/elements/base.ts","../../../../editor/src/elements/styles.ts"],"sourcesContent":["import {\n type Direction,\n directionOf,\n type EditorAdapter,\n type EditorSelection,\n type MessageParams,\n} from '@astl/core';\nimport { LitElement, type PropertyDeclarations, type PropertyValues } from 'lit';\nimport type { Authoring } from '../authoring.js';\nimport { EDITOR_NAMESPACE } from '../messages.js';\n\n/**\n * Base of the kit elements: `authoring` and `adapter` properties, a subscription to the adapter's events while\n * connected (re-rendering by default) and UI strings in the authoring locale.\n */\nexport class AuthoringElement extends LitElement {\n static override properties: PropertyDeclarations = {\n authoring: { attribute: false },\n adapter: { attribute: false },\n };\n\n declare authoring: Authoring | null;\n declare adapter: EditorAdapter | null;\n\n #subscription: { readonly adapter: EditorAdapter; readonly off: () => void } | null = null;\n\n constructor() {\n super();\n this.authoring = null;\n this.adapter = null;\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.#subscribe();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#unsubscribe();\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has('adapter')) this.#subscribe();\n }\n\n #subscribe(): void {\n const adapter = this.isConnected ? this.adapter : null;\n if ((this.#subscription?.adapter ?? null) === adapter) return;\n this.#unsubscribe();\n if (adapter === null) return;\n const offs = [\n adapter.onChange(() => this.sourceChanged()),\n adapter.onSelectionChange((selection) => this.selectionChanged(selection)),\n adapter.onCursorChange?.(() => this.cursorChanged()) ?? (() => {}),\n ];\n this.#subscription = {\n adapter,\n off: () => {\n for (const off of offs) off();\n },\n };\n }\n\n #unsubscribe(): void {\n this.#subscription?.off();\n this.#subscription = null;\n }\n\n /** The document changed. */\n protected sourceChanged(): void {\n this.requestUpdate();\n }\n\n /** The cursor entered or left a component. */\n protected selectionChanged(_selection: EditorSelection | null): void {\n this.requestUpdate();\n }\n\n /** The cursor moved, or the document or its history changed. Most elements have nothing to do. */\n protected cursorChanged(): void {}\n\n /** A kit message (`astl.editor`) in the authoring locale. */\n protected t(key: string, params?: MessageParams): string {\n return this.authoring?.t(EDITOR_NAMESPACE, key, params) ?? key;\n }\n\n /** Language and direction of the UI strings. */\n protected get ui(): { readonly lang: string; readonly dir: Direction } {\n const lang = this.authoring?.locale ?? 'en';\n return { lang, dir: directionOf(lang) };\n }\n}\n","import { visuallyHidden } from '@astl/player';\nimport { tokens, tokensCss } from '@astl/tokens';\nimport { type CSSResult, type CSSResultGroup, css, unsafeCSS } from 'lit';\n\n/**\n * Every token as `inherit` on `selector`, for elements that redeclare the tokens on their own `:host` (the player): a\n * rule from the outer tree wins over `:host`, so tokens set on the kit element reach them.\n */\nexport function inheritTokens(selector: string): CSSResult {\n const names = [tokens.scale, tokens.themes.light, tokens.themeScale.light].flatMap(Object.keys);\n const lines = ['color-scheme: inherit;', ...names.map((name) => `--astl-${name}: inherit;`)];\n return unsafeCSS(`${selector} {\\n${lines.join('\\n')}\\n}`);\n}\n\n/** Shared look of the kit elements: a card, native controls with 44px targets, visible focus. Tokens only. */\nexport const kitStyles: CSSResultGroup = [\n // Tokens sit on :host so host pages can override any --astl-* property on the element itself.\n unsafeCSS(tokensCss(':host')),\n visuallyHidden,\n css`\n :host {\n display: block;\n color: var(--astl-ink);\n font-family: var(--astl-font-body);\n font-size: var(--astl-size-ui);\n line-height: 1.4;\n }\n :host([hidden]) {\n display: none;\n }\n .kit {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-3);\n min-inline-size: 0;\n padding: var(--astl-space-4);\n border: var(--astl-outline-width) solid var(--astl-line);\n border-radius: var(--astl-radius-l);\n background: var(--astl-surface);\n color: var(--astl-ink);\n overflow-wrap: anywhere;\n }\n .title {\n margin: 0;\n font-family: var(--astl-font-display);\n font-size: 1.125rem;\n line-height: 1.3;\n }\n .note {\n margin: 0;\n color: var(--astl-ink-muted);\n }\n ul {\n display: flex;\n flex-direction: column;\n gap: var(--astl-space-2);\n margin: 0;\n padding: 0;\n list-style: none;\n }\n button {\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n gap: var(--astl-space-2);\n min-block-size: var(--astl-target-min);\n min-inline-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-2);\n padding-inline: var(--astl-space-3);\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-m);\n background: var(--astl-surface);\n color: var(--astl-ink);\n font: inherit;\n text-align: start;\n cursor: pointer;\n }\n button:hover:not(:disabled) {\n background: var(--astl-accent-soft);\n }\n `,\n // Disabled shows without colour too: a dashed border and no fill. In the high contrast theme the line and muted\n // colours are as dark as the enabled ones. Disabled (no editor yet), the primary button must not look pressable.\n css`\n button:is(:disabled, [aria-disabled='true']) {\n border-color: var(--astl-line);\n border-style: dashed;\n background: transparent;\n color: var(--astl-ink-muted);\n cursor: not-allowed;\n }\n button.primary {\n border-color: var(--astl-accent);\n background: var(--astl-accent);\n color: var(--astl-on-accent);\n font-weight: 600;\n }\n button.primary:hover:not(:disabled) {\n background: var(--astl-accent);\n text-decoration: underline;\n }\n button.primary:disabled {\n border-color: var(--astl-line);\n background: transparent;\n color: var(--astl-ink-muted);\n }\n input:not([type='checkbox'], [type='radio']),\n select,\n textarea {\n box-sizing: border-box;\n inline-size: 100%;\n min-inline-size: 0;\n min-block-size: var(--astl-target-min);\n margin: 0;\n padding-block: var(--astl-space-1);\n padding-inline: var(--astl-space-2);\n border: var(--astl-outline-width) solid var(--astl-outline);\n border-radius: var(--astl-radius-s);\n background: var(--astl-surface);\n color: var(--astl-ink);\n font: inherit;\n }\n input[type='checkbox'],\n input[type='radio'] {\n flex: none;\n inline-size: 1.25rem;\n block-size: 1.25rem;\n margin: 0;\n accent-color: var(--astl-accent);\n }\n :focus-visible {\n outline: var(--astl-focus-width) solid var(--astl-focus);\n outline-offset: var(--astl-focus-offset);\n }\n .icon {\n flex: none;\n inline-size: 1.25rem;\n block-size: 1.25rem;\n }\n `,\n // Forced colours: disabled as the system draws disabled controls (the dashed border stays). The Canvas backplate\n // forced colours draw behind text would hide the HighlightText label on the Highlight fill, so the primary button\n // uses only system colours here and keeps its own. Disabled, it stays forced: its muted label would not read on the\n // fill.\n css`\n @media (forced-colors: active) {\n button.primary {\n border-color: ButtonText;\n }\n button:disabled,\n button.primary:disabled {\n border-color: GrayText;\n color: GrayText;\n }\n button.primary:not(:disabled) {\n forced-color-adjust: none;\n }\n }\n `,\n];\n"],"mappings":"A,oHAeA,IAAaS,EAAb,cAAsCT,CAAW,CAC/C,OAAgB,WAAmC,CACjD,UAAW,CAAE,UAAW,EAAM,EAC9B,QAAS,CAAE,UAAW,EAAM,CAC9B,EAKA,GAAsF,KAEtF,aAAc,CACZ,MAAM,EACN,KAAK,UAAY,KACjB,KAAK,QAAU,IACjB,CAEA,mBAAmC,CACjC,MAAM,kBAAkB,EACxB,KAAKU,GAAW,CAClB,CAEA,sBAAsC,CACpC,MAAM,qBAAqB,EAC3B,KAAKC,GAAa,CACpB,CAEA,WAA8B,EAAqC,CAC7DC,EAAQ,IAAI,SAAS,GAAG,KAAKF,GAAW,CAC9C,CAEA,IAAmB,CACjB,IAAMG,EAAU,KAAK,YAAc,KAAK,QAAU,KAGlD,IAFK,KAAKC,IAAe,SAAW,QAAUD,IAC9C,KAAKF,GAAa,EACdE,IAAY,MAAM,OACtB,IAAME,EAAO,CACXF,EAAQ,aAAe,KAAK,cAAc,CAAC,EAC3CA,EAAQ,kBAAmB,GAAc,KAAK,iBAAiBG,CAAS,CAAC,EACzEH,EAAQ,qBAAuB,KAAK,cAAc,CAAC,QAAY,CAAC,EAClE,EACA,KAAKC,GAAgB,CACnB,UACA,QAAW,CACT,IAAK,IAAMG,KAAOF,EAAME,EAAI,CAC9B,CACF,CACF,CAEA,IAAqB,CACnB,KAAKH,IAAe,IAAI,EACxB,KAAKA,GAAgB,IACvB,CAGA,eAAgC,CAC9B,KAAK,cAAc,CACrB,CAGA,iBAA2B,EAA0C,CACnE,KAAK,c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