anentrypoint-design 0.0.217 → 0.0.218
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/dist/247420.js +9 -9
- package/package.json +1 -1
- package/src/components/shell.js +25 -14
- package/src/markdown.js +3 -1
- package/src/page-html.js +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anentrypoint-design",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.218",
|
|
4
4
|
"description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/247420.js",
|
package/src/components/shell.js
CHANGED
|
@@ -164,27 +164,38 @@ const ICON_PATHS = {
|
|
|
164
164
|
// rather than an h() vnode. Same path table, same viewBox/stroke contract as
|
|
165
165
|
// Icon(); use innerHTML = iconMarkup(name). Keeps the icon paths upstream so
|
|
166
166
|
// raw-DOM call sites never reintroduce decorative glyph literals.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
// The single SVG attribute contract (viewBox/stroke/linecap…) shared by both
|
|
168
|
+
// the markup-string and the vnode renderers below, so the icon shape is defined
|
|
169
|
+
// once. Insertion order is the serialized attribute order iconMarkup emits.
|
|
170
|
+
function iconAttrs(name, size) {
|
|
171
|
+
return {
|
|
172
|
+
class: 'ds-icon ds-icon-' + name,
|
|
173
|
+
width: String(size), height: String(size), viewBox: '0 0 24 24',
|
|
174
|
+
fill: 'none', stroke: 'currentColor', 'stroke-width': 'var(--ds-icon-stroke, 1.6)',
|
|
175
|
+
'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'aria-hidden': 'true',
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
// Normalize the (name) | ({name,size}) call shapes both renderers accept.
|
|
179
|
+
function iconArgs(name, size) {
|
|
170
180
|
if (name && typeof name === 'object') ({ name, size = 16 } = name);
|
|
181
|
+
return { name, size };
|
|
182
|
+
}
|
|
183
|
+
// Raw-DOM consumers (no webjsx render in scope) need the SVG as a markup string
|
|
184
|
+
// rather than an h() vnode. Same path table + attr contract as Icon(); use
|
|
185
|
+
// innerHTML = iconMarkup(name). Keeps the icon paths upstream so raw-DOM call
|
|
186
|
+
// sites never reintroduce decorative glyph literals.
|
|
187
|
+
export function iconMarkup(name, { size = 16 } = {}) {
|
|
188
|
+
({ name, size } = iconArgs(name, size));
|
|
171
189
|
const inner = ICON_PATHS[name];
|
|
172
190
|
if (!inner) return '';
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
' stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">' + inner + '</svg>';
|
|
191
|
+
const attrs = Object.entries(iconAttrs(name, size)).map(([k, v]) => `${k}="${v}"`).join(' ');
|
|
192
|
+
return `<svg ${attrs}>${inner}</svg>`;
|
|
176
193
|
}
|
|
177
194
|
export function Icon(name, { size = 16 } = {}) {
|
|
178
|
-
|
|
195
|
+
({ name, size } = iconArgs(name, size));
|
|
179
196
|
const inner = ICON_PATHS[name];
|
|
180
197
|
if (!inner) return h('span', { class: 'glyph', 'aria-hidden': 'true' }, '');
|
|
181
|
-
return h('svg', {
|
|
182
|
-
class: 'ds-icon ds-icon-' + name,
|
|
183
|
-
width: String(size), height: String(size), viewBox: '0 0 24 24',
|
|
184
|
-
fill: 'none', stroke: 'currentColor', 'stroke-width': 'var(--ds-icon-stroke, 1.6)',
|
|
185
|
-
'stroke-linecap': 'round', 'stroke-linejoin': 'round', 'aria-hidden': 'true',
|
|
186
|
-
dangerouslySetInnerHTML: { __html: inner }
|
|
187
|
-
});
|
|
198
|
+
return h('svg', { ...iconAttrs(name, size), dangerouslySetInnerHTML: { __html: inner } });
|
|
188
199
|
}
|
|
189
200
|
|
|
190
201
|
export function Topbar({ brand = '247420', leaf = '', items = [], active = '', onNav, search } = {}) {
|
package/src/markdown.js
CHANGED
|
@@ -44,7 +44,9 @@ export async function ensureReady() {
|
|
|
44
44
|
return _ready;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
// The single HTML-entity escape for the whole SDK (full set incl. quotes, so it
|
|
48
|
+
// is safe in attribute contexts too). page-html.js re-exports this as `escape`.
|
|
49
|
+
export function escapeHtml(s) {
|
|
48
50
|
return String(s).replace(/[&<>"']/g, (c) => ({
|
|
49
51
|
'&': '&', '<': '<', '>': '>', '"': '"', "'": ''',
|
|
50
52
|
})[c]);
|
package/src/page-html.js
CHANGED
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
// cssHref, headExtra,
|
|
17
17
|
// })
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
// Single source of HTML escaping lives in markdown.js (full entity set). Kept
|
|
20
|
+
// the `escape` export name for backward compatibility with any consumer.
|
|
21
|
+
import { escapeHtml } from './markdown.js';
|
|
22
|
+
export const escape = escapeHtml;
|
|
22
23
|
|
|
23
24
|
export function inlineMd(s) {
|
|
24
25
|
return s
|