@adia-ai/web-components 0.0.12 → 0.0.14

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 (46) hide show
  1. package/README.md +10 -10
  2. package/components/card/card.css +29 -0
  3. package/components/chart/chart.a2ui.json +43 -6
  4. package/components/chart/chart.css +224 -0
  5. package/components/chart/chart.js +1049 -27
  6. package/components/chart/chart.yaml +62 -6
  7. package/components/chart-legend/chart-legend.a2ui.json +139 -0
  8. package/components/chart-legend/chart-legend.css +124 -0
  9. package/components/chart-legend/chart-legend.js +185 -0
  10. package/components/chart-legend/chart-legend.yaml +133 -0
  11. package/components/code/code-editor.js +161 -0
  12. package/components/code/code.a2ui.json +59 -0
  13. package/components/code/code.css +78 -2
  14. package/components/code/code.js +147 -9
  15. package/components/code/code.yaml +42 -0
  16. package/components/heatmap/heatmap.js +62 -13
  17. package/components/index.js +1 -0
  18. package/components/select/select.css +1 -1
  19. package/components/slider/slider.js +8 -3
  20. package/components/stat/stat.a2ui.json +3 -0
  21. package/components/stat/stat.css +32 -0
  22. package/components/stat/stat.yaml +6 -0
  23. package/components/tooltip/tooltip.a2ui.json +29 -4
  24. package/components/tooltip/tooltip.css +111 -0
  25. package/components/tooltip/tooltip.js +200 -12
  26. package/components/tooltip/tooltip.yaml +38 -4
  27. package/core/icons.js +35 -1
  28. package/core/index.js +25 -0
  29. package/core/provider.js +1 -1
  30. package/index.css +26 -0
  31. package/index.js +18 -0
  32. package/package.json +14 -6
  33. package/patterns/adia-chat/adia-chat.js +1 -1
  34. package/styles/colors/semantics.css +6 -5
  35. package/styles/{styles.css → components.css} +9 -111
  36. package/styles/resets.css +116 -0
  37. package/styles/tokens.css +8 -2
  38. package/core/_cm-core.js +0 -38
  39. package/core/_cm-theme.js +0 -58
  40. package/core/_lang-css.js +0 -2
  41. package/core/_lang-html.js +0 -2
  42. package/core/_lang-javascript.js +0 -2
  43. package/core/_lang-json.js +0 -2
  44. package/core/_lang-markdown.js +0 -2
  45. package/core/_lang-yaml.js +0 -2
  46. package/core/code-editor-bundle.js +0 -63
@@ -6,14 +6,17 @@ tag: tooltip-ui
6
6
  component: Tooltip
7
7
  category: container
8
8
  version: 1
9
- description: Tooltip popup on hover/focus. Uses Popover API for top-layer rendering.
9
+ description: >-
10
+ Tooltip popup. Two modes — default `follows="trigger"` shows on hover/focus
11
+ anchored to wrapped children; `follows="pointer"` subscribes to chart-hover
12
+ events from [for] and renders a data-viz card that tracks the pointer.
10
13
  props:
11
14
  delay:
12
- description: Delay in milliseconds before showing the tooltip on hover.
15
+ description: Delay in milliseconds before showing the tooltip on hover (trigger mode only).
13
16
  type: number
14
17
  default: 400
15
18
  placement:
16
- description: Preferred position relative to the anchor element.
19
+ description: Preferred position relative to the anchor element (trigger mode only).
17
20
  type: string
18
21
  default: top
19
22
  enum:
@@ -26,9 +29,40 @@ props:
26
29
  - bottom-start
27
30
  - bottom-end
28
31
  text:
29
- description: Tooltip text content displayed in the overlay.
32
+ description: Tooltip text content displayed in the overlay (trigger mode only).
30
33
  type: string
31
34
  default: ""
35
+ follows:
36
+ description: >-
37
+ `trigger` (default) pins to wrapped children via hover/focus. `pointer`
38
+ subscribes to chart-hover/chart-leave events from [for] and positions at
39
+ the pointer coordinates — used by chart-ui / heatmap-ui.
40
+ type: string
41
+ default: trigger
42
+ enum:
43
+ - trigger
44
+ - pointer
45
+ reflect: true
46
+ for:
47
+ description: >-
48
+ id-ref of a chart-ui / heatmap-ui to follow. Required when follows=pointer.
49
+ The target must dispatch `chart-hover` and `chart-leave` events.
50
+ type: string
51
+ default: ""
52
+ reflect: true
53
+ indicator:
54
+ description: >-
55
+ Color swatch shown beside each value row in pointer mode. `none` omits
56
+ the swatch. Swatch color reads `--tooltip-indicator-color` which the
57
+ host injects per-row from `--color-{seriesKey}`.
58
+ type: string
59
+ default: none
60
+ enum:
61
+ - none
62
+ - dot
63
+ - line
64
+ - dashed
65
+ reflect: true
32
66
  events: {}
33
67
  slots: {}
34
68
  states:
package/core/icons.js CHANGED
@@ -84,6 +84,14 @@ try {
84
84
  weightModules = EMPTY_WEIGHTS;
85
85
  }
86
86
 
87
+ /* Flag guarding the missing-icon warn below. In Vite dev, `weightModules`
88
+ is populated synchronously by the glob rewrite, so the registry is ready
89
+ before any icon-ui element connects. In non-Vite static deploys, the
90
+ manifest load is async and arrives some time after first paint — warning
91
+ during that window would false-positive for every icon on the page.
92
+ Flipped to `true` in the manifest `.then()` handler below. */
93
+ let registryReady = hasViteGlob;
94
+
87
95
  // Non-Vite environments (plain static serving): fetch the build-time
88
96
  // manifest in the background and rebuild `weightModules` with lazy
89
97
  // fetch-based loaders. No top-level await — the module finishes loading
@@ -102,6 +110,7 @@ if (!hasViteGlob) {
102
110
  });
103
111
  return [weight, Object.fromEntries(entries)];
104
112
  }));
113
+ registryReady = true;
105
114
  // icon-ui elements that asked for an icon before the manifest loaded
106
115
  // gave up silently (resolveLoader returned null on EMPTY_WEIGHTS).
107
116
  // Re-request every <icon-ui name> now that a real loader map is in
@@ -114,7 +123,25 @@ if (!hasViteGlob) {
114
123
  if (name) loadIcon(name, weight);
115
124
  }
116
125
  }
117
- }).catch(() => { /* keep EMPTY_WEIGHTS */ });
126
+ }).catch(() => { /* keep EMPTY_WEIGHTS — registryReady stays false */ });
127
+ }
128
+
129
+ /* Track which (name, weight) pairs we've already warned about so the
130
+ console stays readable even when a missing icon is used many times on
131
+ a page (e.g. a broken Phosphor name in a list row repeated 50×). */
132
+ const warnedMissingIcons = new Set();
133
+ function warnMissingIcon(name, weight) {
134
+ const key = cacheKey(name, weight);
135
+ if (warnedMissingIcons.has(key)) return;
136
+ warnedMissingIcons.add(key);
137
+ const weightNote = weight !== DEFAULT_WEIGHT ? ` at weight="${weight}"` : '';
138
+ const alias = ICON_ALIASES[name];
139
+ const aliasNote = alias ? ` (alias "${name}" → "${alias}" — also not found)` : '';
140
+ console.warn(
141
+ `[icon-ui] Icon "${name}"${weightNote} not found in the registry${aliasNote}. ` +
142
+ `Check the name against @phosphor-icons/core, use an alias in ICON_ALIASES, ` +
143
+ `or register a custom SVG via registerIcon().`
144
+ );
118
145
  }
119
146
 
120
147
  /**
@@ -213,6 +240,13 @@ async function loadIcon(name, weight = DEFAULT_WEIGHT) {
213
240
 
214
241
  if (!loader) {
215
242
  pending.delete(key);
243
+ // Warn once per (name, weight) — but only if the registry is
244
+ // known-complete. In non-Vite pre-manifest mode, `weightModules` is
245
+ // empty and every lookup fails legitimately until the manifest
246
+ // resolves; warning there would be noise. The manifest `.then()`
247
+ // handler above re-triggers loadIcon for every element, so misses
248
+ // that survive the re-query are the ones worth warning about.
249
+ if (registryReady) warnMissingIcon(name, weight);
216
250
  return;
217
251
  }
218
252
 
package/core/index.js ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * core barrel — re-exports every public core module.
3
+ *
4
+ * Consumers who want to build on AdiaElement or use the reactive
5
+ * signal system directly do:
6
+ *
7
+ * import { AdiaElement } from '@adia-ai/web-components/core';
8
+ * import { signal, effect } from '@adia-ai/web-components/core';
9
+ *
10
+ * Exports are flat — every symbol from the re-exported files is
11
+ * available at this level. Symbol collisions between files are not
12
+ * allowed (there are none currently; keep it that way).
13
+ */
14
+
15
+ export * from './element.js';
16
+ export * from './form.js';
17
+ export * from './signals.js';
18
+ export * from './template.js';
19
+ export * from './controller.js';
20
+ export * from './provider.js';
21
+ export * from './anchor.js';
22
+ export * from './icons.js';
23
+ export * from './markdown.js';
24
+ export * from './transport.js';
25
+ export * from './polyfills.js';
package/core/provider.js CHANGED
@@ -26,7 +26,7 @@ import { AdiaElement } from './element.js';
26
26
  import { BaseController } from './controller.js';
27
27
 
28
28
  // ═══════════════════════════════════════════════════════════════
29
- // NANO PROVIDER (inline — tiny base class)
29
+ // ADIA PROVIDER (inline — tiny base class)
30
30
  // ═══════════════════════════════════════════════════════════════
31
31
 
32
32
  class AdiaProvider extends AdiaElement {
package/index.css ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @adia-ai/web-components — the opinionated all-in-one stylesheet.
3
+ *
4
+ * <link rel="stylesheet" href="@adia-ai/web-components/css" />
5
+ *
6
+ * Imports, in cascade order: design tokens (primitives + semantics
7
+ * + typography — via the colors tree) → component styles → global
8
+ * resets.
9
+ *
10
+ * Pattern CSS (adia-chat, adia-editor, app-shell, etc.) is NOT
11
+ * bundled here — each page links its own patterns explicitly.
12
+ * Opinionated theme overrides live in `./styles/themes.css`; link
13
+ * them separately when you want the 8 named themes.
14
+ *
15
+ * If you need a subset, skip this file and link the layers directly:
16
+ * @adia-ai/web-components/styles/tokens.css
17
+ * @adia-ai/web-components/styles/components.css
18
+ * @adia-ai/web-components/styles/resets.css
19
+ * @adia-ai/web-components/styles/themes.css (optional)
20
+ * @adia-ai/web-components/styles/prose.css (optional)
21
+ * @adia-ai/web-components/styles/typography.css (standalone)
22
+ */
23
+
24
+ @import "./styles/tokens.css";
25
+ @import "./styles/components.css";
26
+ @import "./styles/resets.css";
package/index.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @adia-ai/web-components — main entry.
3
+ *
4
+ * import '@adia-ai/web-components';
5
+ * import { AdiaButton, AdiaAppShell } from '@adia-ai/web-components';
6
+ *
7
+ * Loading this file registers every component + pattern custom
8
+ * element (side effect of each module's `customElements.define(...)`
9
+ * call). Pair with `@adia-ai/web-components/css` (the all-in-one
10
+ * stylesheet) or link tokens/components/resets individually.
11
+ *
12
+ * If you only want a subset, use the subpath imports:
13
+ * import '@adia-ai/web-components/components/button';
14
+ * import { AdiaAppShell } from '@adia-ai/web-components/patterns';
15
+ */
16
+
17
+ export * from './components/index.js';
18
+ export * from './patterns/index.js';
package/package.json CHANGED
@@ -1,14 +1,22 @@
1
1
  {
2
2
  "name": "@adia-ai/web-components",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "AdiaUI web components — vanilla custom elements. A2UI runtime (renderer, registry, streams, wiring) lives in @adia-ai/a2ui-utils.",
5
5
  "type": "module",
6
6
  "exports": {
7
- ".": "./index.js",
8
- "./css": "./index.css",
9
- "./a2ui": "./a2ui/index.js",
10
- "./core": "./core/index.js",
11
- "./patterns": "./patterns/index.js"
7
+ ".": "./index.js",
8
+ "./css": "./index.css",
9
+ "./a2ui": "./a2ui/index.js",
10
+ "./core": "./core/index.js",
11
+ "./core/*": "./core/*.js",
12
+ "./components": "./components/index.js",
13
+ "./components/*": "./components/*/*.js",
14
+ "./patterns": "./patterns/index.js",
15
+ "./patterns/*": "./patterns/*/*.js",
16
+ "./styles/*": "./styles/*",
17
+ "./traits": "./traits/index.js",
18
+ "./traits/*": "./traits/*.js",
19
+ "./package.json": "./package.json"
12
20
  },
13
21
  "files": [
14
22
  "core/",
@@ -1,6 +1,6 @@
1
1
  import { AdiaElement } from '../../core/element.js';
2
2
  import { renderMarkdown } from '../../core/markdown.js';
3
- import { streamChat } from '../../../gen-ui/llm/adapters/index.js';
3
+ import { streamChat } from '../../../a2ui/compose/llm/adapters/index.js';
4
4
 
5
5
  function escapeHTML(s) {
6
6
  return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
@@ -97,8 +97,9 @@
97
97
 
98
98
  /* L3 — short-alias matrix (the consumable API for neutral surfaces) */
99
99
  --a-bg: var(--a-canvas-0);
100
- --a-bg-subtle: var(--a-canvas-2);
101
- --a-bg-muted: var(--a-canvas-1);
100
+ --a-bg-scrim: var(--a-canvas-1-scrim);
101
+ --a-bg-subtle: var(--a-canvas-1);
102
+ --a-bg-muted: var(--a-canvas-2);
102
103
  --a-bg-strong: var(--a-canvas-4);
103
104
  --a-bg-hover: var(--a-canvas-3);
104
105
  --a-bg-active: var(--a-canvas-pressed);
@@ -464,10 +465,10 @@
464
465
  UI (FIELD) — Form input surfaces
465
466
  ══════════════════════════════════════════════════════════════ */
466
467
 
467
- --a-ui-bg: var(--a-neutral-0-scrim);
468
- --a-ui-bg-hover: var(--a-neutral-2-scrim);
468
+ --a-ui-bg: var(--a-canvas-0-scrim);
469
+ --a-ui-bg-hover: var(--a-canvas-0-scrim);
469
470
  --a-ui-bg-active: var(--a-canvas-0);
470
- --a-ui-bg-selected: var(--a-canvas-0-scrim);
471
+ --a-ui-bg-selected: var(--a-canvas-bright);
471
472
  --a-ui-bg-disabled: var(--a-canvas-1);
472
473
  --a-ui-bg-invalid: var(--a-danger-muted);
473
474
 
@@ -1,5 +1,12 @@
1
1
  /**
2
- * Styles barrel — imports all component CSS + global reset.
2
+ * Components barrel — imports every component's CSS, in stamp order.
3
+ *
4
+ * This file is *only* the `packages/web-components/components/**`
5
+ * stylesheet set. Patterns (adia-chat, adia-editor, app-shell,
6
+ * app-nav, section-nav, gen-ui, etc.) are NOT imported here — each
7
+ * page links its own patterns explicitly. Global resets live in
8
+ * `resets.css` and must be linked separately.
9
+ *
3
10
  * All components use Light DOM — styles target tag names directly.
4
11
  */
5
12
 
@@ -46,6 +53,7 @@
46
53
  @import "../components/grid/grid.css";
47
54
  @import "../components/stack/stack.css";
48
55
  @import "../components/chart/chart.css";
56
+ @import "../components/chart-legend/chart-legend.css";
49
57
  @import "../components/popover/popover.css";
50
58
  @import "../components/accordion/accordion.css";
51
59
  @import "../components/divider/divider.css";
@@ -82,113 +90,3 @@
82
90
  @import "../components/agent-suggestions/agent-suggestions.css";
83
91
  @import "../components/agent-questions/agent-questions.css";
84
92
  @import "../components/agent-artifact/agent-artifact.css";
85
- @import "../patterns/gen-ui/gen-ui.css";
86
-
87
- /* ── Reset ── */
88
- *,
89
- *::before,
90
- *::after {
91
- box-sizing: border-box;
92
- scrollbar-width: none;
93
- }
94
-
95
- *::-webkit-scrollbar {
96
- display: none;
97
- }
98
-
99
- /* Kill default focus outline — components manage their own via --a-focus-ring */
100
- *:focus {
101
- outline: none;
102
- }
103
-
104
- /* Prevent text selection on all interactive components */
105
- :is(button-ui, kbd-ui, tag-ui, input-ui, textarea-ui, select-ui, check-ui, radio-ui, switch-ui,
106
- slider-ui, range-ui, segmented-ui, segment-ui) {
107
- user-select: none;
108
- }
109
-
110
- html {
111
- -webkit-text-size-adjust: 100%;
112
- text-size-adjust: 100%;
113
- hanging-punctuation: first last;
114
- color-scheme: light dark;
115
- }
116
-
117
- body {
118
- text-rendering: optimizeLegibility;
119
- -webkit-font-smoothing: antialiased;
120
-
121
- margin: 0;
122
- font-family: var(--a-font-family);
123
- font-size: var(--a-body-size);
124
- font-style: normal;
125
- font-variation-settings: 'slnt' 0, 'ital' 0;
126
- line-height: 1.5;
127
- color: var(--a-fg);
128
- background: var(--a-bg);
129
- min-block-size: 100dvb;
130
- }
131
-
132
- img,
133
- picture,
134
- svg,
135
- video,
136
- canvas {
137
- display: block;
138
- max-inline-size: 100%;
139
- block-size: auto;
140
- }
141
-
142
- ul[role='list'],
143
- ol[role='list'] {
144
- list-style: none;
145
- padding: 0;
146
- }
147
-
148
- /* ── Size-query provider utility ──────────────────────────────────
149
- Opt any element into being a container-query size provider for
150
- its descendants, without the nesting fragility of applying
151
- container-type to every instance of a primitive. Use sparingly —
152
- on panels, split-panes, cards that actually need responsive
153
- children — and descendants query via bare `@container (width < Xrem)`
154
- (matches nearest) or `@container container (...)` for clarity.
155
-
156
- Why inline-size: block-direction height stays content-driven.
157
- Why an attribute: explicit opt-in; avoids accidental containment
158
- collapse when a primitive is composed inside another flex chain. */
159
- [provide-container-inline-size] {
160
- container-type: inline-size;
161
- container-name: container;
162
- }
163
-
164
-
165
- :focus-visible {
166
- outline: var(--ui-focus-width, 2px) solid var(--ui-focus, Highlight);
167
- outline-offset: 2px;
168
- }
169
-
170
- ::selection {
171
- background: var(--a-selection-bg);
172
- color: var(--a-selection-text);
173
- border-radius: var(--a-selection-radius);
174
- }
175
-
176
- h1,
177
- h2,
178
- h3,
179
- h4,
180
- h5,
181
- h6 {
182
- text-wrap: balance;
183
- line-height: 1.1;
184
- }
185
-
186
- p,
187
- li,
188
- figcaption {
189
- text-wrap: pretty;
190
- }
191
-
192
- a:not([class]) {
193
- text-underline-offset: 0.12em;
194
- }
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Global resets — box-sizing, scrollbar hiding, focus management,
3
+ * element defaults, and the size-query provider utility.
4
+ *
5
+ * Imported from styles.css (the barrel). Targets document-level
6
+ * defaults and universal selectors; component-scoped rules live in
7
+ * each component's own CSS under `@scope (component-n)`.
8
+ */
9
+
10
+ *,
11
+ *::before,
12
+ *::after {
13
+ box-sizing: border-box;
14
+ scrollbar-width: none;
15
+ }
16
+
17
+ *::-webkit-scrollbar {
18
+ display: none;
19
+ }
20
+
21
+ /* Kill default focus outline — components manage their own via --a-focus-ring */
22
+ *:focus {
23
+ outline: none;
24
+ }
25
+
26
+ /* Prevent text selection on all interactive components */
27
+ :is(button-ui, kbd-ui, tag-ui, input-ui, textarea-ui, select-ui, check-ui, radio-ui, switch-ui,
28
+ slider-ui, range-ui, segmented-ui, segment-ui) {
29
+ user-select: none;
30
+ }
31
+
32
+ html {
33
+ -webkit-text-size-adjust: 100%;
34
+ text-size-adjust: 100%;
35
+ hanging-punctuation: first last;
36
+ color-scheme: light dark;
37
+ }
38
+
39
+ body {
40
+ text-rendering: optimizeLegibility;
41
+ -webkit-font-smoothing: antialiased;
42
+
43
+ margin: 0;
44
+ font-family: var(--a-font-family);
45
+ font-size: var(--a-body-size);
46
+ font-style: normal;
47
+ font-variation-settings: 'slnt' 0, 'ital' 0;
48
+ line-height: 1.5;
49
+ color: var(--a-fg);
50
+ background: var(--a-bg);
51
+ min-block-size: 100dvb;
52
+ }
53
+
54
+ img,
55
+ picture,
56
+ svg,
57
+ video,
58
+ canvas {
59
+ display: block;
60
+ max-inline-size: 100%;
61
+ block-size: auto;
62
+ }
63
+
64
+ ul[role='list'],
65
+ ol[role='list'] {
66
+ list-style: none;
67
+ padding: 0;
68
+ }
69
+
70
+ /* ── Size-query provider utility ──────────────────────────────────
71
+ Opt any element into being a container-query size provider for
72
+ its descendants, without the nesting fragility of applying
73
+ container-type to every instance of a primitive. Use sparingly —
74
+ on panels, split-panes, cards that actually need responsive
75
+ children — and descendants query via bare `@container (width < Xrem)`
76
+ (matches nearest) or `@container container (...)` for clarity.
77
+
78
+ Why inline-size: block-direction height stays content-driven.
79
+ Why an attribute: explicit opt-in; avoids accidental containment
80
+ collapse when a primitive is composed inside another flex chain. */
81
+ [provide-container-inline-size] {
82
+ container-type: inline-size;
83
+ container-name: container;
84
+ }
85
+
86
+
87
+ :focus-visible {
88
+ outline: var(--ui-focus-width, 2px) solid var(--ui-focus, Highlight);
89
+ outline-offset: 2px;
90
+ }
91
+
92
+ ::selection {
93
+ background: var(--a-selection-bg);
94
+ color: var(--a-selection-text);
95
+ border-radius: var(--a-selection-radius);
96
+ }
97
+
98
+ h1,
99
+ h2,
100
+ h3,
101
+ h4,
102
+ h5,
103
+ h6 {
104
+ text-wrap: balance;
105
+ line-height: 1.1;
106
+ }
107
+
108
+ p,
109
+ li,
110
+ figcaption {
111
+ text-wrap: pretty;
112
+ }
113
+
114
+ a:not([class]) {
115
+ text-underline-offset: 0.12em;
116
+ }
package/styles/tokens.css CHANGED
@@ -16,10 +16,16 @@
16
16
  · Monospace font is the default — data-confident, technical character
17
17
  ═══════════════════════════════════════════════════════════════ */
18
18
 
19
+ /* Color ramps + semantic role aliases + typography scale are
20
+ primitive-layer — every component consumes `--a-fg`, `--a-bg-*`,
21
+ `--a-font-family`, `--a-body-size`, etc. Kept bundled. */
19
22
  @import "./colors/index.css";
20
23
  @import "./typography.css";
21
- @import "./prose.css";
22
- @import "./themes.css";
24
+
25
+ /* NOT imported here:
26
+ - styles/prose.css — opt-in per-page; [prose] attribute only
27
+ - styles/themes.css — opt-in per-page; 8 named themes + schemes
28
+ Link separately from HTML when needed. */
23
29
 
24
30
  /* ═══════════════════════════════════════════════════════════════
25
31
  PARAMETRIC MULTIPLIERS — @property declarations
package/core/_cm-core.js DELETED
@@ -1,38 +0,0 @@
1
- /**
2
- * CodeMirror 6 core re-exports.
3
- *
4
- * Thin shim so the rest of the AdiaUI codebase imports CM symbols from
5
- * `@core/_cm-core.js` and the production build can split them into a
6
- * single minified chunk (see scripts/build-site.mjs:bundleCodeEditor).
7
- */
8
-
9
- export {
10
- EditorState,
11
- EditorSelection,
12
- Compartment,
13
- StateEffect,
14
- } from '@codemirror/state';
15
-
16
- export {
17
- EditorView,
18
- lineNumbers,
19
- highlightActiveLine,
20
- highlightActiveLineGutter,
21
- placeholder,
22
- drawSelection,
23
- keymap,
24
- } from '@codemirror/view';
25
-
26
- export {
27
- defaultKeymap,
28
- history,
29
- historyKeymap,
30
- indentWithTab,
31
- } from '@codemirror/commands';
32
-
33
- export {
34
- HighlightStyle,
35
- syntaxHighlighting,
36
- LanguageSupport,
37
- defaultHighlightStyle,
38
- } from '@codemirror/language';
package/core/_cm-theme.js DELETED
@@ -1,58 +0,0 @@
1
- /**
2
- * AdiaUI base theme + highlight style for CodeMirror 6.
3
- *
4
- * The base theme is deliberately near-empty — it only sets the handful
5
- * of structural rules that MUST live inside `EditorView.theme()`. All
6
- * colors, spacing, font size, radius, and token-span styling live in
7
- * `components/code/code.css` inside `@scope (code-ui)` and consume
8
- * AdiaUI semantic tokens.
9
- *
10
- * CodeMirror injects its CSS-in-JS stylesheets at module load; AdiaUI's
11
- * authored stylesheet loads after that, so `@scope (code-ui) .cm-*`
12
- * overrides win on natural specificity — no `!important` needed.
13
- *
14
- * The highlight style uses `class:` rather than `color:` so CodeMirror
15
- * emits `<span class="tok-keyword">` instead of inline styles — exactly
16
- * what our CSS needs. See spec SPEC-CODE-EDITOR-001 §6.3 for the full
17
- * Lezer tag → class → token mapping.
18
- */
19
-
20
- import { EditorView } from '@codemirror/view';
21
- import { HighlightStyle } from '@codemirror/language';
22
- import { tags as t } from '@lezer/highlight';
23
-
24
- export const adiaBaseTheme = EditorView.theme({
25
- '&': {
26
- fontFamily: 'inherit',
27
- fontSize: 'inherit',
28
- color: 'inherit',
29
- backgroundColor: 'transparent',
30
- },
31
- '.cm-content': {
32
- padding: '0',
33
- caretColor: 'inherit',
34
- },
35
- '.cm-focused': {
36
- outline: 'none',
37
- },
38
- });
39
-
40
- export const adiaHighlightStyle = HighlightStyle.define([
41
- { tag: [t.comment, t.lineComment, t.blockComment, t.docComment], class: 'tok-comment' },
42
- { tag: [t.keyword, t.controlKeyword, t.modifier, t.operatorKeyword], class: 'tok-keyword' },
43
- { tag: [t.string, t.character, t.regexp, t.escape, t.special(t.string)], class: 'tok-string' },
44
- { tag: [t.number, t.integer, t.float], class: 'tok-number' },
45
- { tag: [t.bool, t.null, t.atom], class: 'tok-boolean' },
46
- { tag: [t.operator, t.logicOperator, t.arithmeticOperator, t.compareOperator,
47
- t.updateOperator, t.definitionOperator], class: 'tok-operator' },
48
- { tag: [t.punctuation, t.bracket, t.paren, t.brace, t.squareBracket,
49
- t.angleBracket, t.separator], class: 'tok-punctuation' },
50
- { tag: [t.function(t.variableName), t.function(t.propertyName), t.macroName], class: 'tok-function' },
51
- { tag: [t.variableName, t.local(t.variableName), t.self], class: 'tok-variable' },
52
- { tag: [t.typeName, t.className, t.namespace], class: 'tok-type' },
53
- { tag: [t.propertyName, t.labelName, t.definition(t.variableName)], class: 'tok-property' },
54
- { tag: [t.tagName, t.heading, t.contentSeparator], class: 'tok-tag' },
55
- { tag: [t.attributeName, t.attributeValue], class: 'tok-attribute' },
56
- { tag: [t.url, t.link], class: 'tok-url' },
57
- { tag: [t.invalid, t.deleted], class: 'tok-invalid' },
58
- ]);
package/core/_lang-css.js DELETED
@@ -1,2 +0,0 @@
1
- import { css } from '@codemirror/lang-css';
2
- export const extension = css();
@@ -1,2 +0,0 @@
1
- import { html } from '@codemirror/lang-html';
2
- export const extension = html();
@@ -1,2 +0,0 @@
1
- import { javascript } from '@codemirror/lang-javascript';
2
- export const extension = javascript({ jsx: false, typescript: false });
@@ -1,2 +0,0 @@
1
- import { json } from '@codemirror/lang-json';
2
- export const extension = json();
@@ -1,2 +0,0 @@
1
- import { markdown } from '@codemirror/lang-markdown';
2
- export const extension = markdown();
@@ -1,2 +0,0 @@
1
- import { yaml } from '@codemirror/lang-yaml';
2
- export const extension = yaml();