anentrypoint-design 0.0.166 → 0.0.168

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/page-html.js CHANGED
@@ -93,9 +93,28 @@ ${cssLink}
93
93
  { "imports": { "anentrypoint-design": "https://unpkg.com/anentrypoint-design@latest/dist/247420.js" } }
94
94
  </script>
95
95
  <style>
96
- .app-stage { max-width: 1100px; margin: 0 auto; padding: 24px; display: grid; gap: 24px }
97
- .page-body h1 { margin-top: 0 } .page-body h2 { margin-top: 32px } .page-body h3 { margin-top: 24px }
98
- .page-body pre { margin: 12px 0; background: var(--panel-2); padding: 12px; border-radius: 8px; overflow-x: auto }
96
+ .app-stage { width: 100%; max-width: var(--measure-wide, 940px); margin-inline: auto; padding: var(--space-6, 48px) var(--space-4, 24px) var(--space-8, 96px); display: grid; gap: var(--space-6, 48px); box-sizing: border-box }
97
+ @media (max-width: 768px) { .app-stage { padding: var(--space-4, 24px) var(--space-3, 16px) var(--space-6, 48px); gap: var(--space-5, 32px) } }
98
+ .page-body > :first-child { margin-top: 0 }
99
+ .page-body h1 { margin-top: 0 } .page-body h2 { margin-top: var(--space-5, 32px) } .page-body h3 { margin-top: var(--space-4, 24px) }
100
+ .page-body > * + * { margin-top: var(--space-3, 16px) }
101
+ .page-body pre { margin: var(--space-3, 16px) 0; background: var(--panel-2); padding: var(--space-3, 16px); border-radius: var(--r-1, 10px); overflow-x: auto }
102
+ /* .app-stage owns inter-block rhythm via grid gap; sections/hero must not double it.
103
+ These selectors carry !important because this inline block loads before the
104
+ unpkg CSS bundle, which would otherwise win on load-order for equal specificity. */
105
+ .ds-247420 .app-stage > .ds-hero { margin: 0 !important; padding: var(--space-4, 24px) 0 0 !important; max-width: none !important; gap: var(--space-4, 24px) !important }
106
+ .ds-247420 .app-stage > .ds-section { margin: 0 !important }
107
+ .app-stage .row + .row { margin-top: var(--space-1, 4px) }
108
+ .app-stage .ds-section .row { margin-top: var(--space-2, 8px) }
109
+ .app-stage .ds-section > p.ds-lede { margin: 0 0 var(--space-3, 16px); max-width: var(--measure, 68ch); color: var(--fg-2) }
110
+ .row-benefit { font-style: italic; color: var(--fg-3); font-size: var(--fs-sm); margin-top: var(--space-1, 4px) }
111
+ .ds-row-arrow { margin-left: auto; opacity: .5; transition: opacity var(--dur-snap, 80ms) var(--ease) }
112
+ a.row:hover .ds-row-arrow { opacity: 1 }
113
+ /* hero stat strip — all badges as a wrapping inline rhythm, not one empty panel */
114
+ .ds-hero-stats { display: flex; flex-wrap: wrap; gap: var(--space-3, 16px) var(--space-5, 32px); margin-top: var(--space-2, 8px) }
115
+ .ds-hero-stat { display: flex; align-items: baseline; gap: var(--space-2, 8px) }
116
+ .ds-hero-stat-n { font-family: var(--ff-body); font-weight: 700; font-size: var(--fs-lg, 18px); color: var(--fg) }
117
+ .ds-hero-stat-l { font-size: var(--fs-sm, 15px); color: var(--fg-3) }
99
118
  </style>
100
119
  <script id="__site__" type="application/json">${JSON.stringify(pageData).replace(/</g, '\\u003c')}</script>
101
120
  ${headExtra}
@@ -109,14 +128,27 @@ const RAILS = ['rail-green', 'rail-purple', 'rail-mascot', 'rail-sun', 'rail-fla
109
128
 
110
129
  function heroNode(hero) {
111
130
  if (!hero) return null;
112
- return C.Hero({
113
- eyebrow: hero.eyebrow,
114
- title: hero.heading || hero.title || data.title,
115
- body: hero.body || hero.subheading || '',
116
- accent: hero.accent,
117
- badge: Array.isArray(hero.badges) && hero.badges[0] ? hero.badges[0].label : undefined,
118
- actions: Array.isArray(hero.ctas) ? hero.ctas.map((c, i) => h('a', { key: i, class: i === 0 ? 'btn btn-accent' : 'btn btn-ghost', href: c.href || '#' }, c.label || c.cta || 'go')) : null,
119
- });
131
+ const badges = Array.isArray(hero.badges) ? hero.badges.filter(Boolean) : [];
132
+ const badgeRow = badges.length
133
+ ? h('div', { class: 'ds-hero-stats' }, ...badges.map((b, i) =>
134
+ h('span', { key: i, class: 'ds-hero-stat' },
135
+ h('strong', { class: 'ds-hero-stat-n' }, String(b.label != null ? b.label : b)),
136
+ b.desc ? h('span', { class: 'ds-hero-stat-l' }, String(b.desc)) : null,
137
+ )))
138
+ : null;
139
+ return h('div', { class: 'ds-hero' },
140
+ hero.eyebrow ? h('span', { class: 'eyebrow' }, hero.eyebrow) : null,
141
+ h('h1', { class: 'ds-hero-title' }, hero.heading || hero.title || data.title),
142
+ (hero.body || hero.subheading) ? h('p', { class: 'ds-hero-body' },
143
+ hero.body || hero.subheading,
144
+ hero.accent ? h('span', { class: 'ds-hero-accent' }, ' ' + hero.accent) : null,
145
+ ) : null,
146
+ Array.isArray(hero.ctas) && hero.ctas.length
147
+ ? h('div', { class: 'ds-hero-actions' }, ...hero.ctas.map((c, i) =>
148
+ h('a', { key: i, class: i === 0 ? 'btn btn-accent' : 'btn btn-ghost', href: c.href || '#' }, c.label || c.cta || 'go')))
149
+ : null,
150
+ badgeRow,
151
+ );
120
152
  }
121
153
 
122
154
  function sectionNode(sec, idx) {
@@ -149,7 +181,7 @@ function examplesNode(examples) {
149
181
  h('span', { key: 't', class: 'title' }, String(e.label || e.name || e.href || '')),
150
182
  ];
151
183
  if (e.desc) kids.push(h('span', { key: 'm', class: 'meta dim' }, ' — ' + e.desc));
152
- kids.push(h('span', { key: 'a', class: 'ds-row-arrow' }, ''));
184
+ kids.push(h('span', { key: 'a', class: 'ds-row-arrow' }, '->'));
153
185
  return h('a', { key: i, class: 'row ' + rail, href: e.href || '#' }, ...kids);
154
186
  }),
155
187
  });
package/src/theme.js CHANGED
@@ -1,17 +1,26 @@
1
1
  // 247420 design system — theme controller.
2
2
  //
3
- // Three modes:
4
- // 'auto' — follow OS (prefers-color-scheme). Live-updates on OS change.
5
- // 'paper' — force light.
6
- // 'ink' — force dark.
3
+ // Theme modes (data-theme):
4
+ // 'auto' — follow OS (prefers-color-scheme). Live-updates on OS change.
5
+ // 'paper' — force light.
6
+ // 'ink' — force dark.
7
+ // 'thebird' — warm-paper brand preset (named theme).
8
+ // Accents (data-accent): 'green' | 'purple' | 'mascot'.
9
+ // Density (data-density): 'compact' | 'comfortable' | 'spacious'.
7
10
  //
8
- // Writes the chosen mode to <html data-theme="..."> so CSS rules in
9
- // system.css / colors_and_type.css resolve correctly. Persists to
10
- // localStorage under '247420:theme'. Auto-initializes on import in a
11
- // browser context; safe no-op on server.
11
+ // Each is one attribute on <html> the canonical theme (colors_and_type.css)
12
+ // reads. Adding a theme = one [data-theme="X"] block in colors_and_type.css
13
+ // plus its name in THEMES below. Persists to localStorage; auto-inits on
14
+ // browser import; safe no-op on server.
12
15
 
13
16
  const KEY = '247420:theme';
14
- const VALID = new Set(['auto', 'paper', 'ink']);
17
+ const ACCENT_KEY = '247420:accent';
18
+ const DENSITY_KEY = '247420:density';
19
+ // 'auto' is a mode, not a [data-theme] preset block — it stays in VALID for the
20
+ // controller but is the OS-follow path. The named presets are the rest.
21
+ const VALID = new Set(['auto', 'paper', 'ink', 'thebird']);
22
+ const VALID_ACCENT = new Set(['green', 'purple', 'mascot']);
23
+ const VALID_DENSITY = new Set(['compact', 'comfortable', 'spacious']);
15
24
  const listeners = new Set();
16
25
  let _mq = null;
17
26
  let _current = 'auto';
@@ -82,6 +91,44 @@ export function onThemeChange(cb) {
82
91
  return () => listeners.delete(cb);
83
92
  }
84
93
 
94
+ // ---- Accent + density: independent attribute controllers ----
95
+
96
+ function readStoredKey(key, valid) {
97
+ try { const v = window.localStorage.getItem(key); return valid.has(v) ? v : null; } catch { return null; }
98
+ }
99
+
100
+ export function applyAccent(accent) {
101
+ if (!isBrowser()) return accent;
102
+ if (VALID_ACCENT.has(accent)) {
103
+ document.documentElement.setAttribute('data-accent', accent);
104
+ try { window.localStorage.setItem(ACCENT_KEY, accent); } catch {}
105
+ } else {
106
+ // No accent attribute = the theme's default accent (green).
107
+ document.documentElement.removeAttribute('data-accent');
108
+ try { window.localStorage.removeItem(ACCENT_KEY); } catch {}
109
+ }
110
+ return accent;
111
+ }
112
+
113
+ export function getAccent() {
114
+ if (!isBrowser()) return null;
115
+ return document.documentElement.getAttribute('data-accent');
116
+ }
117
+
118
+ export function applyDensity(density) {
119
+ if (!isBrowser()) return density;
120
+ if (VALID_DENSITY.has(density)) {
121
+ document.documentElement.setAttribute('data-density', density);
122
+ try { window.localStorage.setItem(DENSITY_KEY, density); } catch {}
123
+ }
124
+ return density;
125
+ }
126
+
127
+ export function getDensity() {
128
+ if (!isBrowser()) return null;
129
+ return document.documentElement.getAttribute('data-density');
130
+ }
131
+
85
132
  // Auto-init on browser import. Picks stored value, else falls back to
86
133
  // whatever data-theme is already on <html> (set by page-html.js), else 'auto'.
87
134
  export function initTheme() {
@@ -90,6 +137,12 @@ export function initTheme() {
90
137
  const fromAttr = document.documentElement.getAttribute('data-theme');
91
138
  const initial = stored || (VALID.has(fromAttr) ? fromAttr : 'auto');
92
139
  applyTheme(initial);
140
+ // Restore persisted accent/density (no-op if none stored — keeps the
141
+ // theme's default accent and the page's authored density).
142
+ const accent = readStoredKey(ACCENT_KEY, VALID_ACCENT);
143
+ if (accent) applyAccent(accent);
144
+ const density = readStoredKey(DENSITY_KEY, VALID_DENSITY);
145
+ if (density) applyDensity(density);
93
146
  return initial;
94
147
  }
95
148
 
@@ -12,7 +12,7 @@ class DsChat extends HTMLElement {
12
12
  constructor() {
13
13
  super();
14
14
  this._messages = [];
15
- this._placeholder = 'type, then ';
15
+ this._placeholder = 'type, then enter';
16
16
  this._title = 'chat';
17
17
  this._sub = '';
18
18
  this._composerValue = '';