@charmland/gem 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/LICENSE +177 -0
  2. package/NOTICE +13 -0
  3. package/README.md +24 -2
  4. package/assets/fonts/Hypography-Italic.woff2 +0 -0
  5. package/assets/fonts/Hypography-Regular.woff2 +0 -0
  6. package/assets/fonts/PPFraktionMono-Variable.ttf +0 -0
  7. package/assets/fonts/PPFraktionMonoItalic-Variable.ttf +0 -0
  8. package/assets/fonts/PPFraktionSans-Variable.ttf +0 -0
  9. package/assets/fonts/PPFraktionSansItalic-Variable.ttf +0 -0
  10. package/bin/gem-elm.js +3 -0
  11. package/dist/browser/boot.d.ts +10 -0
  12. package/dist/browser/boot.js +14 -0
  13. package/dist/browser/color-scheme.d.ts +9 -0
  14. package/dist/browser/color-scheme.js +76 -0
  15. package/dist/browser/ports.d.ts +37 -0
  16. package/dist/browser/ports.js +90 -0
  17. package/dist/browser/router.d.ts +5 -0
  18. package/dist/browser/router.js +35 -0
  19. package/dist/browser/runtime.d.ts +12 -0
  20. package/dist/browser/runtime.js +22 -0
  21. package/dist/browser/tabs.d.ts +9 -0
  22. package/dist/browser/tabs.js +69 -0
  23. package/dist/default/theme.css +4664 -0
  24. package/dist/default/theme.js +13815 -0
  25. package/dist/node/build.d.ts +16 -0
  26. package/dist/node/build.js +48 -0
  27. package/dist/node/cli.d.ts +2 -0
  28. package/dist/node/cli.js +21 -0
  29. package/elm.json +28 -0
  30. package/package.json +86 -4
  31. package/src/app/Gem/App.elm +1268 -0
  32. package/src/app/Gem/CharmSticker.elm +35 -0
  33. package/src/app/Gem/Components.elm +292 -0
  34. package/src/app/Gem/Main.elm +17 -0
  35. package/src/app/Gem/Ports.elm +32 -0
  36. package/src/app/Gem/Shell.elm +957 -0
  37. package/src/browser/theme.d.ts +1 -0
  38. package/src/core/Gem/Node.elm +219 -0
  39. package/src/core/Gem/Page.elm +560 -0
  40. package/src/core/Gem/Render.elm +510 -0
  41. package/src/core/Gem/Slots.elm +11 -0
  42. package/src/styles/docs.scss +1083 -0
  43. package/src/styles/fonts.scss +51 -0
  44. package/src/styles/gem.scss +362 -0
  45. package/src/styles/theme.scss +8 -0
  46. package/src/styles/ui/burger.scss +272 -0
  47. package/src/styles/ui/button.scss +350 -0
  48. package/src/styles/ui/charmtone.scss +70 -0
  49. package/src/styles/ui/controls-extra.scss +316 -0
  50. package/src/styles/ui/controls.scss +110 -0
  51. package/src/styles/ui/display.scss +359 -0
  52. package/src/styles/ui/dropdown.scss +341 -0
  53. package/src/styles/ui/form.scss +314 -0
  54. package/src/styles/ui/menu.scss +200 -0
  55. package/src/styles/ui/meter.scss +124 -0
  56. package/src/styles/ui/modal.scss +545 -0
  57. package/src/styles/ui/oauth.scss +50 -0
  58. package/src/styles/ui/page-nav.scss +63 -0
  59. package/src/styles/ui/reset.scss +111 -0
  60. package/src/styles/ui/scrollbar.scss +39 -0
  61. package/src/styles/ui/search.scss +164 -0
  62. package/src/styles/ui/sidebar.scss +229 -0
  63. package/src/styles/ui/squircle.scss +60 -0
  64. package/src/styles/ui/table.scss +97 -0
  65. package/src/styles/ui/theme.scss +132 -0
  66. package/src/styles/ui/toast.scss +587 -0
  67. package/src/styles/ui/toc.scss +128 -0
  68. package/src/styles/ui/typography.scss +21 -0
  69. package/src/styles/ui/ui.scss +33 -0
  70. package/src/ui/Ui/Badge.elm +51 -0
  71. package/src/ui/Ui/Banner.elm +97 -0
  72. package/src/ui/Ui/Burger.elm +259 -0
  73. package/src/ui/Ui/Button.elm +261 -0
  74. package/src/ui/Ui/Card.elm +32 -0
  75. package/src/ui/Ui/Cards.elm +15 -0
  76. package/src/ui/Ui/ChoiceGroup.elm +62 -0
  77. package/src/ui/Ui/CopyButton.elm +139 -0
  78. package/src/ui/Ui/Divider.elm +16 -0
  79. package/src/ui/Ui/Dropdown.elm +600 -0
  80. package/src/ui/Ui/Empty.elm +41 -0
  81. package/src/ui/Ui/ErrorBubble.elm +34 -0
  82. package/src/ui/Ui/Field.elm +45 -0
  83. package/src/ui/Ui/FormStatus.elm +32 -0
  84. package/src/ui/Ui/Icon.elm +381 -0
  85. package/src/ui/Ui/InlineForm.elm +51 -0
  86. package/src/ui/Ui/Input.elm +113 -0
  87. package/src/ui/Ui/KeyValue.elm +25 -0
  88. package/src/ui/Ui/ListRow.elm +67 -0
  89. package/src/ui/Ui/Loader.elm +32 -0
  90. package/src/ui/Ui/Logo/Charm.elm +21 -0
  91. package/src/ui/Ui/Logo/CharmMark.elm +32 -0
  92. package/src/ui/Ui/Logo/CharmSticker.elm +35 -0
  93. package/src/ui/Ui/Logo/Discord.elm +26 -0
  94. package/src/ui/Ui/Logo/GitHub.elm +21 -0
  95. package/src/ui/Ui/Logo/Google.elm +21 -0
  96. package/src/ui/Ui/Logo/Hexy.elm +29 -0
  97. package/src/ui/Ui/Logo/Hyper.elm +42 -0
  98. package/src/ui/Ui/Logo/Integration.elm +117 -0
  99. package/src/ui/Ui/Logo/Prism.elm +35 -0
  100. package/src/ui/Ui/Logos.elm +115 -0
  101. package/src/ui/Ui/Menu.elm +348 -0
  102. package/src/ui/Ui/Meter.elm +132 -0
  103. package/src/ui/Ui/Modal.elm +247 -0
  104. package/src/ui/Ui/Motion.elm +32 -0
  105. package/src/ui/Ui/NumberBox.elm +86 -0
  106. package/src/ui/Ui/OAuthButton.elm +39 -0
  107. package/src/ui/Ui/PageNav.elm +65 -0
  108. package/src/ui/Ui/Pager.elm +49 -0
  109. package/src/ui/Ui/Search.elm +396 -0
  110. package/src/ui/Ui/SearchBox.elm +78 -0
  111. package/src/ui/Ui/Section.elm +21 -0
  112. package/src/ui/Ui/Sidebar.elm +239 -0
  113. package/src/ui/Ui/Stat.elm +29 -0
  114. package/src/ui/Ui/Switch.elm +34 -0
  115. package/src/ui/Ui/Table.elm +89 -0
  116. package/src/ui/Ui/Tabs.elm +280 -0
  117. package/src/ui/Ui/ToC.elm +120 -0
  118. package/src/ui/Ui/Toast.elm +1145 -0
  119. package/src/ui/Ui/Toolbar.elm +31 -0
  120. package/src/ui/Ui/TwoStepConfirm.elm +159 -0
  121. package/src/ui/Ui/Typography.elm +33 -0
@@ -0,0 +1,316 @@
1
+ @use "charmtone";
2
+ @use "controls" as *;
3
+
4
+ // The search box, the segmented tabs, and the loader — extracted from
5
+ // the section shell so the library carries them standalone.
6
+
7
+ // The search input and its clear button. The box is a recessed
8
+ // channel — same fill, same height, same radius as the fields — with
9
+ // the border held transparent so the charple focus ring doesn't shift
10
+ // the layout.
11
+ .search-box {
12
+ position: relative;
13
+ flex: 1;
14
+ min-width: 0;
15
+ display: flex;
16
+
17
+ .search {
18
+ flex: 1;
19
+ width: 100%;
20
+ height: $control-height;
21
+ padding: 0.6rem 3rem 0.6rem 0.75rem;
22
+ border: $control-border solid transparent;
23
+ border-radius: calc(0.75rem * var(--squircle-scale, 1));
24
+ background: var(--well);
25
+ color: var(--fg);
26
+ font-family: inherit;
27
+ font-size: 1rem;
28
+ transition: border-color 125ms ease;
29
+
30
+ &::placeholder {
31
+ color: var(--tertiary);
32
+ }
33
+
34
+ // Hide the browser's native clear button; we bring our own.
35
+ &::-webkit-search-cancel-button,
36
+ &::-webkit-search-decoration {
37
+ appearance: none;
38
+ }
39
+
40
+ &:focus-visible {
41
+ @include control-focus;
42
+ }
43
+ }
44
+
45
+ .clear {
46
+ position: absolute;
47
+ top: 50%;
48
+ right: 0.45rem;
49
+ translate: 0 -50%;
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: center;
53
+ width: 2.25rem;
54
+ height: 2.25rem;
55
+ padding: 0;
56
+ border: none;
57
+ border-radius: 50%;
58
+ background: transparent;
59
+ color: var(--tertiary);
60
+ opacity: 0;
61
+ pointer-events: none;
62
+ transition:
63
+ color 125ms ease,
64
+ opacity 150ms ease;
65
+
66
+ svg {
67
+ width: 1.1rem;
68
+ height: 1.1rem;
69
+ }
70
+
71
+ &.visible {
72
+ opacity: 1;
73
+ pointer-events: auto;
74
+ }
75
+
76
+ &:hover {
77
+ color: charmtone.$coral;
78
+ }
79
+ }
80
+
81
+ // The dense box used beside compact controls and table actions.
82
+ &.compact {
83
+ .search {
84
+ height: $control-height-sm;
85
+ font-size: 0.875rem;
86
+ }
87
+
88
+ .clear {
89
+ right: 0.35rem;
90
+ width: 1.75rem;
91
+ height: 1.75rem;
92
+
93
+ svg {
94
+ width: 0.95rem;
95
+ height: 0.95rem;
96
+ }
97
+ }
98
+ }
99
+ }
100
+
101
+ // Segmented tab switcher. The track is a recessed channel; the
102
+ // selected tab is a raised, rounded thumb — absolutely positioned and
103
+ // translated by the measured x the Elm component computes — that
104
+ // slides between tabs. Until the first measurement lands, the active
105
+ // button paints its own background instead.
106
+ .tabs {
107
+ --tabs-pad: 0.25rem;
108
+ position: relative;
109
+ display: inline-flex;
110
+ align-self: flex-start;
111
+ gap: 0.25rem;
112
+ height: $control-height;
113
+ padding: var(--tabs-pad);
114
+ border-radius: calc(0.75rem * var(--squircle-scale, 1));
115
+ background: var(--well);
116
+
117
+ .thumb {
118
+ position: absolute;
119
+ top: var(--tabs-pad);
120
+ bottom: var(--tabs-pad);
121
+ left: 0;
122
+ z-index: 0;
123
+ border-radius: calc(0.5rem * var(--squircle-scale, 1));
124
+ background: charmtone.$charple;
125
+ transition:
126
+ transform 220ms cubic-bezier(0.2, 0.9, 0.3, 1),
127
+ width 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
128
+ }
129
+
130
+ button {
131
+ position: relative;
132
+ z-index: 1;
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ height: 100%;
137
+ padding: 0.35rem 1.25rem;
138
+ border: $control-border solid transparent;
139
+ border-radius: calc(0.5rem * var(--squircle-scale, 1));
140
+ background: transparent;
141
+ color: var(--muted);
142
+ font-size: 0.875rem;
143
+ transition:
144
+ background 125ms ease,
145
+ border-color 125ms ease,
146
+ color 125ms ease;
147
+
148
+ // Icon tabs (the models layout switcher): the glyph follows the
149
+ // button's color states via currentColor.
150
+ svg {
151
+ display: block;
152
+ width: 1.125rem;
153
+ height: 1.125rem;
154
+ }
155
+
156
+ &:hover:not(.active) {
157
+ color: var(--fg);
158
+ }
159
+
160
+ &.active {
161
+ border-color: transparent;
162
+ color: charmtone.$salt;
163
+ font-weight: 620;
164
+ }
165
+
166
+ // A segmented control is a filled control when active, so
167
+ // keyboard focus rings it without warming a border.
168
+ &:focus-visible {
169
+ @include control-focus-flat;
170
+ }
171
+ }
172
+
173
+ // Before the first measurement lands there is no thumb; the active
174
+ // button paints its own fill so the selection is visible
175
+ // immediately. Once the thumb exists it takes over. The underline
176
+ // variant never paints a pill — its selection is the slide alone.
177
+ &:not(.measured):not(.underline) button.active {
178
+ background: charmtone.$charple;
179
+ }
180
+
181
+ // The dense switcher used next to compact controls and tables.
182
+ &.compact {
183
+ height: $control-height-sm;
184
+ --tabs-pad: 0.2rem;
185
+
186
+ button {
187
+ padding-inline: 1rem;
188
+ font-size: 0.8125rem;
189
+ }
190
+ }
191
+
192
+ // The underline variant: bare text tabs sitting on a hairline, the
193
+ // selection a sliding two-pixel charple bar. Same geometry as the
194
+ // reference site's section navs: the buttons hang 1px past the row so
195
+ // the bar paints over the hairline instead of stacking on it, and the
196
+ // active label keeps the body weight — the bar is the only signal.
197
+ &.underline {
198
+ height: auto;
199
+ padding: 0;
200
+ gap: 1.5rem;
201
+ border-radius: 0;
202
+ background: none;
203
+ border-bottom: 1px solid var(--frame);
204
+
205
+ // The Elm component measures a thumb; the structural tab behavior
206
+ // mounts a slide. Both become the same bar, one pixel below the
207
+ // padding box so its two pixels sit over the hairline and one above
208
+ // it, hiding the gray line under the active tab. The override of the
209
+ // shared negative z-index is what lets the bar paint over the border.
210
+ .thumb {
211
+ top: auto;
212
+ bottom: -1px;
213
+ z-index: 1;
214
+ height: 2px;
215
+ border-radius: 0;
216
+ background: charmtone.$charple;
217
+ }
218
+
219
+ .tab-slide {
220
+ top: auto;
221
+ bottom: -1px;
222
+ z-index: 1;
223
+ translate: var(--tab-x) 0;
224
+ width: var(--tab-w);
225
+ height: 2px;
226
+ border-radius: 0;
227
+ background: charmtone.$charple;
228
+ }
229
+
230
+ button {
231
+ z-index: 2;
232
+ height: auto;
233
+ padding: 0 0 0.5rem;
234
+ border: none;
235
+ border-radius: 0;
236
+ background: none;
237
+ box-shadow: none;
238
+ color: var(--muted);
239
+ font-size: 1rem;
240
+ font-weight: 400;
241
+ transition: color 125ms ease;
242
+
243
+ &:hover:not(.active) {
244
+ color: var(--fg);
245
+ }
246
+
247
+ &.active {
248
+ color: var(--fg);
249
+ }
250
+ }
251
+
252
+ // Before the paint is measured, the active tab underlines itself.
253
+ &:not(:has(.thumb)):not(:has(.tab-slide)) button.active {
254
+ box-shadow: inset 0 -2px 0 charmtone.$charple;
255
+ }
256
+ }
257
+ }
258
+
259
+ // The sliding paint the tab behavior mounts first in every
260
+ // [data-tabs] control, fed the active button's box as --tab-*
261
+ // custom properties. z-index: -1 keeps it under the buttons' text.
262
+ .tab-slide {
263
+ position: absolute;
264
+ left: 0;
265
+ top: 0;
266
+ translate: var(--tab-x) var(--tab-y);
267
+ width: var(--tab-w);
268
+ height: var(--tab-h);
269
+ z-index: -1;
270
+ pointer-events: none;
271
+ transition:
272
+ translate 200ms cubic-bezier(0.2, 0.9, 0.3, 1),
273
+ width 200ms cubic-bezier(0.2, 0.9, 0.3, 1);
274
+
275
+ @media (prefers-reduced-motion: reduce) {
276
+ transition: none;
277
+ }
278
+ }
279
+
280
+ // The global loading dial: a charple disc with a spinning crossbar,
281
+ // fading in and out as content loads.
282
+ .loader {
283
+ position: fixed;
284
+ top: 1.625rem;
285
+ right: 1.75rem;
286
+ z-index: 300;
287
+ width: 3.125rem;
288
+ height: 3.125rem;
289
+ background: charmtone.$charple;
290
+ border-radius: 50%;
291
+ opacity: 0;
292
+ pointer-events: none;
293
+ transition: opacity 150ms ease;
294
+ animation: loader-spin 0.9s linear infinite;
295
+
296
+ &.visible {
297
+ opacity: 1;
298
+ }
299
+
300
+ &::before {
301
+ content: "";
302
+ position: absolute;
303
+ top: 50%;
304
+ left: 50%;
305
+ width: 65%;
306
+ height: 3px;
307
+ transform: translate(-50%, -50%);
308
+ background: charmtone.$salt;
309
+ }
310
+ }
311
+
312
+ @keyframes loader-spin {
313
+ to {
314
+ transform: rotate(360deg);
315
+ }
316
+ }
@@ -0,0 +1,110 @@
1
+ $control-border: 2px;
2
+ // Shared height for toolbar controls so inputs and tab switchers
3
+ // line up when they sit side by side.
4
+ $control-height: 2.75rem;
5
+ // The dense size used in tables, pagers, and in-row editors.
6
+ $control-height-sm: 2.25rem;
7
+ // The extra-small size for in-row controls that sit beside text, like
8
+ // the profile's Edit button.
9
+ $control-height-xs: 1.75rem;
10
+ // The radius every toolbar control matches.
11
+ $control-radius: 0.75rem;
12
+ // One-line fields and dropdown triggers read as surfaces: the recessed
13
+ // step below the page color, the same channel the tab switcher's track
14
+ // and the search box use.
15
+ $control-fill: var(--well);
16
+ // JetBrains Mono is the house mono; hosts that don't load it fall
17
+ // back to the system mono.
18
+ $mono: "JetBrains Mono Variable", ui-monospace, monospace;
19
+
20
+ // The app face: Charmform, the Charm house typeface. Hosts that don't
21
+ // load it fall back to the system sans.
22
+ $sans:
23
+ "Charmform Web",
24
+ system-ui,
25
+ -apple-system,
26
+ sans-serif;
27
+
28
+ /// How far a Charmform heading of a given size draws in, as an OPTK
29
+ /// value: the bigger the type, the tighter it sets. The steps follow
30
+ /// the homepage's ladder (5.25rem -75, 3.125rem -55, 2.25rem -50,
31
+ /// 1.72rem -35), bucketed so every heading in the app lands on one of
32
+ /// a few shared values. Body copy stays at 0.
33
+ @function optk($size) {
34
+ @if $size >= 3rem {
35
+ @return -60;
36
+ } @else if $size >= 2.5rem {
37
+ @return -55;
38
+ } @else if $size >= 2rem {
39
+ @return -50;
40
+ } @else if $size >= 1.5rem {
41
+ @return -35;
42
+ } @else if $size >= 1.25rem {
43
+ @return -20;
44
+ } @else {
45
+ @return -10;
46
+ }
47
+ }
48
+
49
+ /// A Charmform heading or display figure: its size and its tracking set
50
+ /// together, so a size change can't leave the tracking behind. OPTK is
51
+ /// a custom axis with no CSS property of its own, so it rides
52
+ /// font-variation-settings — which replaces an inherited value
53
+ /// wholesale, so a child at body size resets it with
54
+ /// `font-variation-settings: "OPTK" 0`.
55
+ @mixin display-type($size) {
56
+ font-size: $size;
57
+ font-variation-settings: "OPTK" optk($size);
58
+ }
59
+
60
+ /// Numerals that matter — balances, prices, counts, table figures — in
61
+ /// the forms that can't misread: ss04 is Charmform's unambiguous 1 (the
62
+ /// default reads close to a 7), ss05 its 6 and 9. Never set either on
63
+ /// the page root: the setting inherits into every key and code sample.
64
+ @mixin figures {
65
+ font-feature-settings:
66
+ "ss04" on,
67
+ "ss05" on;
68
+ }
69
+
70
+ /// Keyboard focus, two flavours, following shadcn. A control with a
71
+ /// border of its own warms it to the ring token under a 3px glow, so
72
+ /// focus reads as one hue; a filled control carries no border — none of
73
+ /// shadcn's filled variants do — and takes the glow alone, because a
74
+ /// warm border there would read as a second color inside the glow. The
75
+ /// glow hugs the border either way, so the control never shifts the
76
+ /// layout. Attach only to `:focus-visible`: a pointer press should not
77
+ /// ring a control.
78
+ @mixin control-focus {
79
+ outline: none;
80
+ border-color: var(--ring);
81
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 20%, transparent);
82
+ }
83
+
84
+ /// `control-focus` for a control with no border to warm.
85
+ @mixin control-focus-flat {
86
+ outline: none;
87
+ border-color: transparent;
88
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 20%, transparent);
89
+ }
90
+
91
+ /// The destructive twin, glow alone in the danger token.
92
+ @mixin control-focus-danger {
93
+ outline: none;
94
+ border-color: transparent;
95
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent);
96
+ }
97
+
98
+ /// Selection: the chosen control wears the primary token on its border
99
+ /// and in a matching glow. Deliberately not the focus ring — the two
100
+ /// states are different facts and may both be true.
101
+ @mixin control-selected {
102
+ border-color: var(--primary);
103
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
104
+ }
105
+
106
+ /// Pins a control to one of the two shared heights.
107
+ @mixin control-size($height) {
108
+ height: $height;
109
+ padding-block: 0;
110
+ }