anentrypoint-design 0.0.30 → 0.0.32

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anentrypoint-design",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
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/highlight.js CHANGED
@@ -1,60 +1,18 @@
1
1
  import { register } from './debug.js';
2
2
 
3
- const PRISM_BASE = 'https://cdn.jsdelivr.net/npm/prismjs@1.30.0';
4
- const LANGS = ['markup', 'css', 'clike', 'javascript', 'jsx', 'tsx', 'typescript', 'json', 'bash', 'python'];
5
- let _prism = null;
6
- let _stats = { highlights: 0, errors: 0 };
3
+ let _stats = { highlights: 0 };
7
4
 
8
- function injectScript(src) {
9
- return new Promise((resolve, reject) => {
10
- const s = document.createElement('script');
11
- s.src = src; s.async = false;
12
- s.onload = () => resolve();
13
- s.onerror = () => reject(new Error('script failed: ' + src));
14
- document.head.appendChild(s);
15
- });
16
- }
17
-
18
- let _loadPromise = null;
19
5
  export function ensurePrism() {
20
- if (_prism) return Promise.resolve(_prism);
21
- if (_loadPromise) return _loadPromise;
22
- _loadPromise = (async () => {
23
- if (!window.Prism) {
24
- window.Prism = window.Prism || { manual: true, disableWorkerMessageHandler: true };
25
- await injectScript(PRISM_BASE + '/prism.min.js');
26
- }
27
- for (const lang of LANGS) {
28
- const has = window.Prism && window.Prism.languages && window.Prism.languages[lang];
29
- if (has) continue;
30
- try { await injectScript(`${PRISM_BASE}/components/prism-${lang}.min.js`); }
31
- catch { _stats.errors += 1; }
32
- }
33
- _prism = window.Prism;
34
- return _prism;
35
- })();
36
- return _loadPromise;
6
+ return Promise.resolve(null);
37
7
  }
38
8
 
39
9
  export async function highlightElement(el) {
40
- const prism = await ensurePrism();
41
- if (!el) return;
42
- prism.highlightElement(el);
43
10
  _stats.highlights += 1;
44
11
  }
45
12
 
46
13
  export async function highlightAllUnder(root) {
47
- const prism = await ensurePrism();
48
14
  const els = (root || document).querySelectorAll('pre code[class*="lang-"], pre code[class*="language-"]');
49
- els.forEach((el) => {
50
- const cls = el.className;
51
- if (/lang-(\w+)/.test(cls) && !/language-/.test(cls)) {
52
- const m = cls.match(/lang-(\w+)/);
53
- if (m) el.classList.add('language-' + m[1]);
54
- }
55
- prism.highlightElement(el);
56
- _stats.highlights += 1;
57
- });
15
+ _stats.highlights += els.length;
58
16
  }
59
17
 
60
- register('highlight', () => ({ loaded: !!_prism, langs: _prism ? Object.keys(_prism.languages || {}) : [], ...(_stats) }));
18
+ register('highlight', () => ({ loaded: false, ...(_stats) }));
package/src/motion.js CHANGED
@@ -1,122 +1,22 @@
1
- const ANIMATE_CSS_ID = 'animate-style-cdn';
2
- const ANIMATE_CSS_HREF = 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css';
3
- const MOTION_STYLE_ID = 'ds-247420-motion';
4
-
5
1
  function hasDom() {
6
2
  return typeof document !== 'undefined';
7
3
  }
8
4
 
9
5
  export function shouldReduceMotion() {
10
- if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return false;
11
- return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
6
+ return true;
12
7
  }
13
8
 
14
9
  export function installMotion() {
15
- if (!hasDom()) return;
16
-
17
- if (!document.getElementById(ANIMATE_CSS_ID)) {
18
- const link = document.createElement('link');
19
- link.id = ANIMATE_CSS_ID;
20
- link.rel = 'stylesheet';
21
- link.href = ANIMATE_CSS_HREF;
22
- document.head.appendChild(link);
23
- }
24
-
25
- if (!document.getElementById(MOTION_STYLE_ID)) {
26
- const style = document.createElement('style');
27
- style.id = MOTION_STYLE_ID;
28
- style.textContent = `
29
- :root {
30
- --motion-fast: 220ms;
31
- --motion-base: 420ms;
32
- --motion-slow: 720ms;
33
- }
34
-
35
- @media (prefers-reduced-motion: reduce) {
36
- .animate__animated {
37
- animation-duration: 1ms !important;
38
- animation-iteration-count: 1 !important;
39
- transition-duration: 1ms !important;
40
- }
41
- }
42
- `.trim();
43
- document.head.appendChild(style);
44
- }
45
10
  }
46
11
 
47
- export function animateElement(el, name, {
48
- duration = null,
49
- delay = null,
50
- speedClass = '',
51
- repeat = null,
52
- cleanup = true
53
- } = {}) {
54
- if (!el || !name || shouldReduceMotion()) return Promise.resolve(false);
55
-
56
- const classes = ['animate__animated', `animate__${name}`];
57
- if (speedClass) classes.push(`animate__${speedClass}`);
58
-
59
- el.classList.remove(...classes);
60
- void el.offsetWidth;
61
- el.classList.add(...classes);
62
-
63
- if (duration) el.style.setProperty('--animate-duration', duration);
64
- if (delay) el.style.setProperty('--animate-delay', delay);
65
- if (repeat != null) el.style.setProperty('--animate-repeat', String(repeat));
66
-
67
- return new Promise((resolve) => {
68
- const onEnd = () => {
69
- if (cleanup) {
70
- el.classList.remove(...classes);
71
- }
72
- if (duration) el.style.removeProperty('--animate-duration');
73
- if (delay) el.style.removeProperty('--animate-delay');
74
- if (repeat != null) el.style.removeProperty('--animate-repeat');
75
- resolve(true);
76
- };
77
- el.addEventListener('animationend', onEnd, { once: true });
78
- });
12
+ export function animateElement(el, name, opts = {}) {
13
+ return Promise.resolve(false);
79
14
  }
80
15
 
81
16
  export function animateSelector(selector, name, opts = {}) {
82
- if (!hasDom()) return Promise.resolve(false);
83
- const el = document.querySelector(selector);
84
- return animateElement(el, name, opts);
85
- }
86
-
87
- function defaultEffectFor(el) {
88
- const tag = String(el.tagName || '').toLowerCase();
89
- if (tag === 'aside') return 'fadeInLeft';
90
- if (tag === 'header') return 'fadeInDown';
91
- if (tag === 'footer') return 'fadeInUp';
92
- if (tag === 'main' || tag === 'section' || tag === 'article') return 'fadeIn';
93
- if (tag === 'a' || tag === 'button' || tag === 'input' || tag === 'textarea' || tag === 'select') return 'fadeInUp';
94
- return 'fadeIn';
17
+ return Promise.resolve(false);
95
18
  }
96
19
 
97
- export function animateTree(root, {
98
- selector = '*',
99
- baseDelayMs = 14,
100
- duration = 'var(--motion-base)'
101
- } = {}) {
102
- if (!hasDom() || !root || shouldReduceMotion()) return 0;
103
-
104
- const nodes = Array.from(root.querySelectorAll(selector));
105
- let animated = 0;
106
-
107
- nodes.forEach((el) => {
108
- if (!el || !el.classList) return;
109
- if (el.matches('script,style,link,meta,title')) return;
110
- if (el.hasAttribute('data-no-motion')) return;
111
- if (el.dataset.motionApplied === '1') return;
112
-
113
- const effect = el.dataset.motionEffect || defaultEffectFor(el);
114
- el.classList.add('animate__animated', `animate__${effect}`);
115
- el.style.setProperty('--animate-duration', duration);
116
- el.style.setProperty('--animate-delay', `${animated * baseDelayMs}ms`);
117
- el.dataset.motionApplied = '1';
118
- animated += 1;
119
- });
120
-
121
- return animated;
20
+ export function animateTree(root, opts = {}) {
21
+ return 0;
122
22
  }