tobogganSe connecter

library

Prebuilt pebble components: drop-in custom elements, no compiler needed

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Dernier runAucun
0Étoiles
0Forks
2Issues
133 lignes · 4185 octetsBrut · Historique
1/* <pebble-tablet> — light-DOM component: define() wraps this sheet in
2 @scope (pebble-tablet) { … }; :scope is the host. State reaches CSS through
3 custom properties and attributes, never as generated CSS text; the page
4 themes the editor by setting the --tablet-* properties on the host.
5 Part hooks: part="editor field" — one element, two roles: the textarea is
6 the editing surface AND the form field of record, before and after the
7 upgrade, so enhancement never reflows.
8
9 With a decorating dialect ([data-decorated]) the field's glyphs turn
10 transparent and part="backdrop" paints the same text over it, laid over
11 the field's box (absolute, so only the field sizes the host) with the same
12 font, padding, border width, wrap and scrollbar gutter, so every glyph
13 lands where the field's would. Anything a page adds to the backdrop must
14 keep glyph widths (docs/tablet.md). */
15
16:scope {
17 display: block;
18 position: relative;
19 font-family: var(--tablet-font, inherit);
20}
21
22:scope > textarea,
23:scope > [part~="backdrop"] {
24 box-sizing: border-box;
25 margin: 0;
26 white-space: pre-wrap;
27 overflow-wrap: break-word;
28 scrollbar-gutter: stable;
29}
30
31:scope > textarea {
32 display: block;
33 width: 100%;
34 min-height: var(--tablet-min-height, 4lh);
35 max-height: var(--tablet-max-height, none);
36 padding: var(--tablet-padding, 0.5rem 0.75rem);
37 font: inherit;
38 color: var(--tablet-color, inherit);
39 background: var(--tablet-background, transparent);
40 border: var(--tablet-border, 1px solid color-mix(in srgb, currentColor 25%, transparent));
41 border-radius: var(--tablet-radius, 6px);
42 caret-color: var(--tablet-caret, currentColor);
43 /* The field fits its text, from min- to max-height (then it scrolls, and
44 the backdrop follows). A browser without field-sizing keeps the rows and
45 the resize handle. */
46 field-sizing: var(--tablet-sizing, content);
47}
48
49@supports (field-sizing: content) {
50 :scope > textarea {
51 resize: var(--tablet-resize, none);
52 }
53}
54
55:scope > textarea:focus {
56 outline: var(--tablet-focus-outline, 2px solid var(--accent, currentColor));
57 outline-offset: -1px;
58}
59
60/* Only the glyphs' fill goes transparent: `color` stays the text's, so the
61 caret (currentColor) and spellcheck marks stay visible. */
62:scope[data-decorated] > textarea {
63 -webkit-text-fill-color: transparent;
64}
65
66:scope[data-decorated] > textarea::selection {
67 color: transparent;
68 -webkit-text-fill-color: transparent;
69 background: var(--tablet-selection, color-mix(in srgb, var(--accent, Highlight) 30%, transparent));
70}
71
72:scope[data-decorated] > textarea::placeholder {
73 color: var(--tablet-placeholder, GrayText);
74 -webkit-text-fill-color: var(--tablet-placeholder, GrayText);
75}
76
77:scope > [part~="backdrop"] {
78 position: absolute;
79 inset: 0;
80 overflow: hidden;
81 padding: var(--tablet-padding, 0.5rem 0.75rem);
82 font: inherit;
83 color: var(--tablet-color, inherit);
84 border: var(--tablet-border, 1px solid color-mix(in srgb, currentColor 25%, transparent));
85 border-color: transparent;
86 pointer-events: none;
87}
88
89:scope > [part~="backdrop"] > .line {
90 min-height: 1lh;
91}
92
93:scope [part~="box"] {
94 /* inline-block: a line's text-decoration (a struck-through done task)
95 does not paint across an atomic inline; its width is still its text's.
96 text-fill-color: the "[ ]" glyphs stay hidden whatever colour a page's
97 classes give the segment. */
98 display: inline-block;
99 position: relative;
100 color: transparent;
101 -webkit-text-fill-color: transparent;
102 pointer-events: auto;
103 cursor: pointer;
104}
105
106:scope [part~="box"]::before {
107 content: "";
108 position: absolute;
109 inset: 0;
110 width: 1em;
111 height: 1em;
112 margin: auto;
113 box-sizing: border-box;
114 border: 1.5px solid var(--tablet-box, var(--accent, CanvasText));
115 border-radius: 3px;
116}
117
118:scope [part~="box"][data-checked]::before {
119 background: var(--tablet-box, var(--accent, CanvasText));
120}
121
122:scope [part~="box"][data-checked]::after {
123 content: "";
124 position: absolute;
125 inset: 0;
126 width: 0.3em;
127 height: 0.55em;
128 margin: auto;
129 translate: 0 -0.08em;
130 border: solid var(--tablet-box-mark, Canvas);
131 border-width: 0 2px 2px 0;
132 rotate: 45deg;
133}