@astl/astrolabe 0.1.2 → 0.1.4

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 (109) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cdn/astrolabe-editor.js +3 -3
  3. package/dist/cdn/astrolabe-player.js +1 -1
  4. package/dist/cdn/astrolabe.js +1 -1
  5. package/dist/cdn/astrolabe.standalone.js +1094 -1060
  6. package/dist/cdn/chunks/{audio-B0LSIn5N.js → audio-Biof5aA3.js} +2 -2
  7. package/dist/cdn/chunks/{audio-B0LSIn5N.js.map → audio-Biof5aA3.js.map} +1 -1
  8. package/dist/cdn/chunks/{block-styles-CKo9x7Vt.js → block-styles-CCtSFM4j.js} +2 -2
  9. package/dist/cdn/chunks/{block-styles-CKo9x7Vt.js.map → block-styles-CCtSFM4j.js.map} +1 -1
  10. package/dist/cdn/chunks/{book-CHzDDaim.js → book-IFipARhv.js} +2 -2
  11. package/dist/cdn/chunks/{book-CHzDDaim.js.map → book-IFipARhv.js.map} +1 -1
  12. package/dist/cdn/chunks/{callout-QFLFLPc5.js → callout-CuajbbYY.js} +2 -2
  13. package/dist/cdn/chunks/{callout-QFLFLPc5.js.map → callout-CuajbbYY.js.map} +1 -1
  14. package/dist/cdn/chunks/{categorise-BO2tNVJ3.js → categorise-Cm6kXLXw.js} +2 -2
  15. package/dist/cdn/chunks/{categorise-BO2tNVJ3.js.map → categorise-Cm6kXLXw.js.map} +1 -1
  16. package/dist/cdn/chunks/{chip-styles-Dme5daTO.js → chip-styles--gboWK2Z.js} +2 -2
  17. package/dist/cdn/chunks/{chip-styles-Dme5daTO.js.map → chip-styles--gboWK2Z.js.map} +1 -1
  18. package/dist/cdn/chunks/{choice-CExBvqKj.js → choice-BSpB6LHl.js} +2 -2
  19. package/dist/cdn/chunks/{choice-CExBvqKj.js.map → choice-BSpB6LHl.js.map} +1 -1
  20. package/dist/cdn/chunks/{color-control-Cl5cuMSO.js → color-control-1kkdM8ns.js} +2 -2
  21. package/dist/cdn/chunks/{color-control-Cl5cuMSO.js.map → color-control-1kkdM8ns.js.map} +1 -1
  22. package/dist/cdn/chunks/{crossword-Cb-a3Tjj.js → crossword-BdOAEPcL.js} +2 -2
  23. package/dist/cdn/chunks/{crossword-Cb-a3Tjj.js.map → crossword-BdOAEPcL.js.map} +1 -1
  24. package/dist/cdn/chunks/{definitions-CNX90WtL.js → definitions-BybSa1mq.js} +2 -2
  25. package/dist/cdn/chunks/{definitions-CNX90WtL.js.map → definitions-BybSa1mq.js.map} +1 -1
  26. package/dist/cdn/chunks/{directive-helpers-D7lOZKnB.js → directive-helpers-US6zRjJ1.js} +2 -2
  27. package/dist/cdn/chunks/{directive-helpers-D7lOZKnB.js.map → directive-helpers-US6zRjJ1.js.map} +1 -1
  28. package/dist/cdn/chunks/{drop-vRXndjHu.js → drop-D4NQ0WK_.js} +2 -2
  29. package/dist/cdn/chunks/{drop-vRXndjHu.js.map → drop-D4NQ0WK_.js.map} +1 -1
  30. package/dist/cdn/chunks/{flash-cards-0NrrKdrx.js → flash-cards-D4ebb5m6.js} +2 -2
  31. package/dist/cdn/chunks/{flash-cards-0NrrKdrx.js.map → flash-cards-D4ebb5m6.js.map} +1 -1
  32. package/dist/cdn/chunks/{gap-lor-khst.js → gap-D-Sipuyu.js} +2 -2
  33. package/dist/cdn/chunks/{gap-lor-khst.js.map → gap-D-Sipuyu.js.map} +1 -1
  34. package/dist/cdn/chunks/{help-C-woafz5.js → help-CmCFuNXk.js} +2 -2
  35. package/dist/cdn/chunks/{help-C-woafz5.js.map → help-CmCFuNXk.js.map} +1 -1
  36. package/dist/cdn/chunks/{help-form-CDg3TCwI.js → help-form-Di2NtKDp.js} +14 -10
  37. package/dist/cdn/chunks/help-form-Di2NtKDp.js.map +1 -0
  38. package/dist/cdn/chunks/{hotspot-oel1Eelo.js → hotspot-B3bvqVzf.js} +2 -2
  39. package/dist/cdn/chunks/{hotspot-oel1Eelo.js.map → hotspot-B3bvqVzf.js.map} +1 -1
  40. package/dist/cdn/chunks/{image-drop-Dkprw0Kn.js → image-drop-vLc2B7rF.js} +2 -2
  41. package/dist/cdn/chunks/{image-drop-Dkprw0Kn.js.map → image-drop-vLc2B7rF.js.map} +1 -1
  42. package/dist/cdn/chunks/{image-label-Dm5shQSh.js → image-label-DsKxQDTQ.js} +2 -2
  43. package/dist/cdn/chunks/{image-label-Dm5shQSh.js.map → image-label-DsKxQDTQ.js.map} +1 -1
  44. package/dist/cdn/chunks/{inline-styles-CTgXWnHb.js → inline-styles-CFNlb6f2.js} +2 -2
  45. package/dist/cdn/chunks/{inline-styles-CTgXWnHb.js.map → inline-styles-CFNlb6f2.js.map} +1 -1
  46. package/dist/cdn/chunks/{insert-menu-7vANVmTK.js → insert-menu-DAQglwtG.js} +2 -2
  47. package/dist/cdn/chunks/{insert-menu-7vANVmTK.js.map → insert-menu-DAQglwtG.js.map} +1 -1
  48. package/dist/cdn/chunks/{issue-list-BT9qvnZU.js → issue-list-CzSmohtT.js} +2 -2
  49. package/dist/cdn/chunks/{issue-list-BT9qvnZU.js.map → issue-list-CzSmohtT.js.map} +1 -1
  50. package/dist/cdn/chunks/{live-jdiyYln2.js → live-qnReIRtj.js} +2 -2
  51. package/dist/cdn/chunks/{live-jdiyYln2.js.map → live-qnReIRtj.js.map} +1 -1
  52. package/dist/cdn/chunks/{long-answer-CtzClLAx.js → long-answer-NSWJiK0z.js} +2 -2
  53. package/dist/cdn/chunks/{long-answer-CtzClLAx.js.map → long-answer-NSWJiK0z.js.map} +1 -1
  54. package/dist/cdn/chunks/{mark-words-CpH3gTcX.js → mark-words-BKu-_uIl.js} +2 -2
  55. package/dist/cdn/chunks/{mark-words-CpH3gTcX.js.map → mark-words-BKu-_uIl.js.map} +1 -1
  56. package/dist/cdn/chunks/{match-DKE_4o-x.js → match-BpnJGW_5.js} +21 -13
  57. package/dist/cdn/chunks/match-BpnJGW_5.js.map +1 -0
  58. package/dist/cdn/chunks/{memory-B6hSyHyz.js → memory-BgTHujsU.js} +2 -2
  59. package/dist/cdn/chunks/{memory-B6hSyHyz.js.map → memory-BgTHujsU.js.map} +1 -1
  60. package/dist/cdn/chunks/messages-Qzse5KMX.js +2 -0
  61. package/dist/cdn/chunks/messages-Qzse5KMX.js.map +1 -0
  62. package/dist/cdn/chunks/{option-styles-WKzjKmCH.js → option-styles-B2sBX5Oz.js} +2 -2
  63. package/dist/cdn/chunks/{option-styles-WKzjKmCH.js.map → option-styles-B2sBX5Oz.js.map} +1 -1
  64. package/dist/cdn/chunks/{order-BhG_6IC-.js → order-B9gqH5wm.js} +2 -2
  65. package/dist/cdn/chunks/{order-BhG_6IC-.js.map → order-B9gqH5wm.js.map} +1 -1
  66. package/dist/cdn/chunks/{picture-view-BKnAyScQ.js → picture-view-Deodu_mb.js} +2 -2
  67. package/dist/cdn/chunks/{picture-view-BKnAyScQ.js.map → picture-view-Deodu_mb.js.map} +1 -1
  68. package/dist/cdn/chunks/{repeat-CY2W2URZ.js → repeat-BDXokpxQ.js} +2 -2
  69. package/dist/cdn/chunks/{repeat-CY2W2URZ.js.map → repeat-BDXokpxQ.js.map} +1 -1
  70. package/dist/cdn/chunks/{runtime-DxAbpr3S.js → runtime-C25QK5B0.js} +3 -3
  71. package/dist/cdn/chunks/{runtime-DxAbpr3S.js.map → runtime-C25QK5B0.js.map} +1 -1
  72. package/dist/cdn/chunks/{scan-jWgPnVxA.js → scan-BVhxT2Hw.js} +2 -2
  73. package/dist/cdn/chunks/{scan-jWgPnVxA.js.map → scan-BVhxT2Hw.js.map} +1 -1
  74. package/dist/cdn/chunks/{select-DTA3dJzr.js → select-DPpKJwSg.js} +2 -2
  75. package/dist/cdn/chunks/{select-DTA3dJzr.js.map → select-DPpKJwSg.js.map} +1 -1
  76. package/dist/cdn/chunks/select-QZ35cyns.js +2 -0
  77. package/dist/cdn/chunks/select-QZ35cyns.js.map +1 -0
  78. package/dist/cdn/chunks/{source-view-CZVxgTNQ.js → source-view-gqFlZzwR.js} +2 -2
  79. package/dist/cdn/chunks/{source-view-CZVxgTNQ.js.map → source-view-gqFlZzwR.js.map} +1 -1
  80. package/dist/cdn/chunks/{style-form-DUGbG_kL.js → style-form-DuR0EEum.js} +2 -2
  81. package/dist/cdn/chunks/{style-form-DUGbG_kL.js.map → style-form-DuR0EEum.js.map} +1 -1
  82. package/dist/cdn/chunks/{style-messages-qdf3pZbT.js → style-messages-B136zSom.js} +2 -2
  83. package/dist/cdn/chunks/{style-messages-qdf3pZbT.js.map → style-messages-B136zSom.js.map} +1 -1
  84. package/dist/cdn/chunks/{style-popups-BobgX1WK.js → style-popups-Bcl5imdP.js} +2 -2
  85. package/dist/cdn/chunks/{style-popups-BobgX1WK.js.map → style-popups-Bcl5imdP.js.map} +1 -1
  86. package/dist/cdn/chunks/{style-rules-D17QGzXk.js → style-rules-ozpLz2ec.js} +2 -2
  87. package/dist/cdn/chunks/{style-rules-D17QGzXk.js.map → style-rules-ozpLz2ec.js.map} +1 -1
  88. package/dist/cdn/chunks/{styled-Dmx5Yjv7.js → styled-bQqnDxBf.js} +2 -2
  89. package/dist/cdn/chunks/{styled-Dmx5Yjv7.js.map → styled-bQqnDxBf.js.map} +1 -1
  90. package/dist/cdn/chunks/{styles-CdJT6Pp9.js → styles-DiY3VA_T.js} +5 -5
  91. package/dist/cdn/chunks/styles-DiY3VA_T.js.map +1 -0
  92. package/dist/cdn/chunks/surface-CIz1z2oY.js +1059 -0
  93. package/dist/cdn/chunks/surface-CIz1z2oY.js.map +1 -0
  94. package/dist/cdn/chunks/{true-false-DP3MO599.js → true-false-C-S6RmZY.js} +2 -2
  95. package/dist/cdn/chunks/{true-false-DP3MO599.js.map → true-false-C-S6RmZY.js.map} +1 -1
  96. package/dist/cdn/chunks/{video-j9MCH6Kw.js → video-Dae8Gguf.js} +2 -2
  97. package/dist/cdn/chunks/{video-j9MCH6Kw.js.map → video-Dae8Gguf.js.map} +1 -1
  98. package/dist/cdn/chunks/{word-bank-ARjwUKZf.js → word-bank-CsIle0Ro.js} +2 -2
  99. package/dist/cdn/chunks/{word-bank-ARjwUKZf.js.map → word-bank-CsIle0Ro.js.map} +1 -1
  100. package/dist/cdn/chunks/{word-search-AHvM7yCJ.js → word-search-IOCwqo3y.js} +2 -2
  101. package/dist/cdn/chunks/{word-search-AHvM7yCJ.js.map → word-search-IOCwqo3y.js.map} +1 -1
  102. package/package.json +9 -9
  103. package/dist/cdn/chunks/help-form-CDg3TCwI.js.map +0 -1
  104. package/dist/cdn/chunks/match-DKE_4o-x.js.map +0 -1
  105. package/dist/cdn/chunks/messages-D1aJfyS_.js +0 -2
  106. package/dist/cdn/chunks/messages-D1aJfyS_.js.map +0 -1
  107. package/dist/cdn/chunks/styles-CdJT6Pp9.js.map +0 -1
  108. package/dist/cdn/chunks/surface-C6wtQkTY.js +0 -1037
  109. package/dist/cdn/chunks/surface-C6wtQkTY.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"style-form-DUGbG_kL.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,cAAe,KAAM,GAAI,IAAK,GAAK,IAAK,EAAG,KAAM,GAAK,CACpF,EACMI,EAA+B,CACnC,CAAE,KAAM,QAAS,SAAU,kBAAmB,EAC9C,CAAE,KAAM,SAAU,SAAU,eAAgB,KAAM,KAAM,IAAK,EAAG,IAAK,EAAG,EACxE,CAAE,KAAM,SAAU,SAAU,eAAgB,QAAS,CAAC,OAAQ,QAAS,SAAU,SAAU,QAAQ,CAAE,EACrG,CAAE,KAAM,QAAS,SAAU,cAAe,EAC1C,CAAE,KAAM,SAAU,SAAU,gBAAiB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version":3,"file":"style-form-DuR0EEum.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,K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AOC,EAAI,aAAanE,EAAK;QAC/EqE,EAAS,KAAKC,GAAQ,EAAInG,EAAQ;QAClCiG,EAAS,KAEP,CAACG,EAASC,GACV,IACG,CAAI,kBAAkBhC,IAAO,GAAK,CAAC6B,EAAO,+BAA+BE,EAAQ;qBACzE,KAAK,EAAE,iBAAiBA,GAAS,EAAE;gCACxBC,EAAO,IAAK,GAAU,KAAKC,GAAOnC,EAAOK,EAAUxC,EAAOoE,CAAO,CAAC,EAAE;mBAE9F,EAAE;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"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./messages-D1aJfyS_.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-qdf3pZbT.js.map
1
+ import{t as e}from"./messages-Qzse5KMX.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-B136zSom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"style-messages-qdf3pZbT.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
+ {"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{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`
1
+ import{C as e,E as t,b as n}from"./runtime-C25QK5B0.js";import{s as r}from"./style-model-ZXNe_c8R.js";import{n as i,t as a}from"./color-control-1kkdM8ns.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
2
  ${i}
3
3
  .colors {
4
4
  inline-size: min(16rem, calc(100vw - 2 * var(--astl-space-4)));
@@ -71,4 +71,4 @@ import{C as e,E as t,b as n}from"./runtime-DxAbpr3S.js";import{s as r}from"./sty
71
71
  </div>
72
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
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
74
+ //# sourceMappingURL=style-popups-Bcl5imdP.js.map
@@ -1 +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,6JAg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AM,IACtF,CACF,GACC,EAAQ,IAAUQ,EAAS,EAAG1B,IAAU,EAAI,cAAgB,oBAAqBC,EAAO,KAAM,CAAC,EAChGU,EAAE,iBAAiB,CACrB,CACF,C"}
1
+ {"version":3,"file":"style-popups-Bcl5imdP.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"],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CAAC,EAAE,IAAM,IACtF,CACF,GACC,EAAQ,IAAUQ,EAAS,EAAG1B,IAAU,EAAI,cAAgB,oBAAqBC,EAAO,KAAM,CAAC,EAChGU,EAAE,iBAAiB,CACrB,CACF,C"}
@@ -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-CdJT6Pp9.js";import{a as o}from"./style-placing-DPw1zyrz.js";import{t as s}from"./style-messages-qdf3pZbT.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`
1
+ import{C as e,E as t,b as n}from"./runtime-C25QK5B0.js";import"./declarations-BhqOz1ap.js";import{n as r,r as i,t as a}from"./styles-DiY3VA_T.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-D17QGzXk.js.map
136
+ //# sourceMappingURL=style-rules-ozpLz2ec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"style-rules-D17QGzXk.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,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mB,IAAQ,IAAA,GAAYpC,EAAU,CAAI,yBAAyBoC,EAAI,SAAS;cACxEb,EAAO,KAAKK,GAAM,CAAE,IAAKM,CAAI,CAAC,EAAIlC,EAAQ;gBAEhD,CAAC,EAAE;;6BAEkB,KAAK,EAAE,kBAAkB,EAAE;QAEhDgC,EAAM,SAAW,EACb,CAAI,mBAAmB,KAAK,EAAE,mBAAmB,EAAE,MACnD,CAAI,iDAAiDA,EAAM,IAAK,GAAS,KAAKK,GAAUvB,CAAI,CAAC,EAAE,OACpG;;kBAEY,GAAiB,CAC1BW,EAAM,eAAe,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-ozpLz2ec.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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QAEhDgC,EAAM,SAAW,EACb,CAAI,mBAAmB,KAAK,EAAE,mBAAmB,EAAE,MACnD,CAAI,iDAAiDA,EAAM,IAAK,GAAS,KAAKK,GAAUvB,CAAI,CAAC,EAAE,OACpG;;kBAEY,GAAiB,CAC1BW,EAAM,eAAe,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,4 +1,4 @@
1
- import{E as e,M as t,qt as n}from"./runtime-DxAbpr3S.js";import{d as r,l as i,o as a,u as o}from"./declarations-BhqOz1ap.js";var s=4.6,c=/#[0-9a-f]+|rgba?\([^()]*\)/g,l=/^[\d.]/,u=new Set([`width`,`max-width`,`inline-size`,`max-inline-size`]),d=e=>e===`background-color`||e===`box-shadow`?`--astl-author-ground`:`--astl-author-ink`,f=e=>o(e),p=f(t.themes.dark[`surface-raised`]),m=f(t.themes.dark.ink);function h([e,t,n]){let[r,i,a]=[e/255,t/255,n/255],o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2,l=o-s;return l===0?[0,0,c]:[o===r?((i-a)/l+6)%6:o===i?(a-r)/l+2:(r-i)/l+4,l/(1-Math.abs(2*c-1)),c]}function g([e,t,n],r){let i=t*Math.min(n,1-n),a=t=>{let r=(t+e*2)%12;return Math.round((n-i*Math.max(-1,Math.min(r-3,9-r,1)))*255)};return[a(0),a(8),a(4),r]}function _(e){let[t,n,r]=h(e);return g([t,n,1-r],e[3])}var v=(e,t)=>r(i(e,t),t);function y(e,t){if(v(e,t)>=s)return e;let[n,r,i]=h(e),a=t=>g([n,r,t],e[3]),o=+(v(a(1),t)>=v(a(0),t)),c=i;for(let e=0;e<8;e++){let e=(o+c)/2;v(a(e),t)>=s?o=e:c=e}return a(o)}var b=([e,t,n,r])=>{let i=[e,t,n].map(Math.round).join(`, `);return r===1?`rgb(${i})`:`rgba(${i}, ${r})`},x=(e,t)=>{let n=e.find(([e])=>e===t)?.[1];return n===void 0?null:o(n)};function S(e,t){let n=t.inked||x(e,`color`)!==null,r=x(e,`background-color`);if(r===null)return{ground:t.ground,inked:n};let a=i(_(r),t.ground);return{ground:n?a:y(a,m),inked:n}}function C(e,t,n){return e===`font-family`?t:e===`font-size`?l.test(t)?`clamp(0.625rem, ${t}, 6rem)`:t:u.has(e)?l.test(t)&&!t.endsWith(`%`)?`min(${t}, 100%)`:t:t.replace(c,t=>{let r=f(t),i=e===`color`?y(_(r),n.ground):e===`background-color`?n.ground:_(r);return`var(${d(e)}, light-dark(${t}, ${b(i)}))`})}function w(e){let t=new Map,r=new Map,i={ground:p,inked:!1};for(let o of Array.from(e.querySelectorAll(`[${n}]`))){let{declarations:e}=a(o.getAttribute(`data-astl-style`)??``);o.removeAttribute(n);let s=i;for(let e=o.parentElement;e!==null;e=e.parentElement){let t=r.get(e);if(t!==void 0){s=t;break}}let c=S(e,s);r.set(o,c),t.set(o,e.map(([e,t])=>[e,C(e,t,c)]))}return t}function T(e,t,n){let r=n.querySelectorAll(`*`);t.querySelectorAll(`*`).forEach((t,n)=>{for(let[i,a]of e.get(t)??[])r[n]?.style.setProperty(i,a)})}var E=e`
1
+ import{E as e,M as t,qt as n}from"./runtime-C25QK5B0.js";import{d as r,l as i,o as a,u as o}from"./declarations-BhqOz1ap.js";var s=4.6,c=/#[0-9a-f]+|rgba?\([^()]*\)/g,l=/^[\d.]/,u=new Set([`width`,`max-width`,`inline-size`,`max-inline-size`]),d=e=>e===`background-color`||e===`box-shadow`?`--astl-author-ground`:`--astl-author-ink`,f=e=>o(e),p=f(t.themes.dark[`surface-raised`]),m=f(t.themes.dark.ink);function h([e,t,n]){let[r,i,a]=[e/255,t/255,n/255],o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2,l=o-s;return l===0?[0,0,c]:[o===r?((i-a)/l+6)%6:o===i?(a-r)/l+2:(r-i)/l+4,l/(1-Math.abs(2*c-1)),c]}function g([e,t,n],r){let i=t*Math.min(n,1-n),a=t=>{let r=(t+e*2)%12;return Math.round((n-i*Math.max(-1,Math.min(r-3,9-r,1)))*255)};return[a(0),a(8),a(4),r]}function _(e){let[t,n,r]=h(e);return g([t,n,1-r],e[3])}var v=(e,t)=>r(i(e,t),t);function y(e,t){if(v(e,t)>=s)return e;let[n,r,i]=h(e),a=t=>g([n,r,t],e[3]),o=+(v(a(1),t)>=v(a(0),t)),c=i;for(let e=0;e<8;e++){let e=(o+c)/2;v(a(e),t)>=s?o=e:c=e}return a(o)}var b=([e,t,n,r])=>{let i=[e,t,n].map(Math.round).join(`, `);return r===1?`rgb(${i})`:`rgba(${i}, ${r})`},x=(e,t)=>{let n=e.find(([e])=>e===t)?.[1];return n===void 0?null:o(n)};function S(e,t){let n=t.inked||x(e,`color`)!==null,r=x(e,`background-color`);if(r===null)return{ground:t.ground,inked:n};let a=i(_(r),t.ground);return{ground:n?a:y(a,m),inked:n}}function C(e,t,n){return e===`font-family`?t:e===`font-size`?l.test(t)?`clamp(0.625rem, ${t}, 6rem)`:t:u.has(e)?l.test(t)&&!t.endsWith(`%`)?`min(${t}, 100%)`:t:t.replace(c,t=>{let r=f(t),i=e===`color`?y(_(r),n.ground):e===`background-color`?n.ground:_(r);return`var(${d(e)}, light-dark(${t}, ${b(i)}))`})}function w(e){let t=new Map,r=new Map,i={ground:p,inked:!1};for(let o of Array.from(e.querySelectorAll(`[${n}]`))){let{declarations:e}=a(o.getAttribute(`data-astl-style`)??``);o.removeAttribute(n);let s=i;for(let e=o.parentElement;e!==null;e=e.parentElement){let t=r.get(e);if(t!==void 0){s=t;break}}let c=S(e,s);r.set(o,c),t.set(o,e.map(([e,t])=>[e,C(e,t,c)]))}return t}function T(e,t,n){let r=n.querySelectorAll(`*`);t.querySelectorAll(`*`).forEach((t,n)=>{for(let[i,a]of e.get(t)??[])r[n]?.style.setProperty(i,a)})}var E=e`
2
2
  .canvas {
3
3
  container-type: inline-size;
4
4
  }
@@ -54,4 +54,4 @@ display: block;
54
54
  }
55
55
  }
56
56
  `.styleSheet;function D(e){E!==void 0&&e instanceof ShadowRoot&&!e.adoptedStyleSheets.includes(E)&&(e.adoptedStyleSheets=[...e.adoptedStyleSheets,E])}export{D as adoptStyledSheet,T as applyStyles,w as takeStyles};
57
- //# sourceMappingURL=styled-Dmx5Yjv7.js.map
57
+ //# sourceMappingURL=styled-bQqnDxBf.js.map