nativecorejs 0.1.0

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 (145) hide show
  1. package/README.md +22 -0
  2. package/dist/components/builtinRegistry.d.ts +2 -0
  3. package/dist/components/builtinRegistry.js +72 -0
  4. package/dist/components/index.d.ts +59 -0
  5. package/dist/components/index.js +59 -0
  6. package/dist/components/loading-spinner.d.ts +5 -0
  7. package/dist/components/loading-spinner.js +48 -0
  8. package/dist/components/nc-a.d.ts +45 -0
  9. package/dist/components/nc-a.js +290 -0
  10. package/dist/components/nc-accordion.d.ts +36 -0
  11. package/dist/components/nc-accordion.js +186 -0
  12. package/dist/components/nc-alert.d.ts +11 -0
  13. package/dist/components/nc-alert.js +127 -0
  14. package/dist/components/nc-animation.d.ts +117 -0
  15. package/dist/components/nc-animation.js +1053 -0
  16. package/dist/components/nc-autocomplete.d.ts +41 -0
  17. package/dist/components/nc-autocomplete.js +275 -0
  18. package/dist/components/nc-avatar-group.d.ts +7 -0
  19. package/dist/components/nc-avatar-group.js +85 -0
  20. package/dist/components/nc-avatar.d.ts +9 -0
  21. package/dist/components/nc-avatar.js +127 -0
  22. package/dist/components/nc-badge.d.ts +7 -0
  23. package/dist/components/nc-badge.js +63 -0
  24. package/dist/components/nc-bottom-nav.d.ts +53 -0
  25. package/dist/components/nc-bottom-nav.js +198 -0
  26. package/dist/components/nc-breadcrumb.d.ts +10 -0
  27. package/dist/components/nc-breadcrumb.js +71 -0
  28. package/dist/components/nc-button.d.ts +38 -0
  29. package/dist/components/nc-button.js +293 -0
  30. package/dist/components/nc-card.d.ts +11 -0
  31. package/dist/components/nc-card.js +74 -0
  32. package/dist/components/nc-checkbox.d.ts +16 -0
  33. package/dist/components/nc-checkbox.js +194 -0
  34. package/dist/components/nc-chip.d.ts +8 -0
  35. package/dist/components/nc-chip.js +89 -0
  36. package/dist/components/nc-code.d.ts +37 -0
  37. package/dist/components/nc-code.js +315 -0
  38. package/dist/components/nc-collapsible.d.ts +33 -0
  39. package/dist/components/nc-collapsible.js +148 -0
  40. package/dist/components/nc-color-picker.d.ts +33 -0
  41. package/dist/components/nc-color-picker.js +265 -0
  42. package/dist/components/nc-copy-button.d.ts +10 -0
  43. package/dist/components/nc-copy-button.js +94 -0
  44. package/dist/components/nc-date-picker.d.ts +41 -0
  45. package/dist/components/nc-date-picker.js +443 -0
  46. package/dist/components/nc-div.d.ts +53 -0
  47. package/dist/components/nc-div.js +270 -0
  48. package/dist/components/nc-divider.d.ts +7 -0
  49. package/dist/components/nc-divider.js +57 -0
  50. package/dist/components/nc-drawer.d.ts +40 -0
  51. package/dist/components/nc-drawer.js +217 -0
  52. package/dist/components/nc-dropdown.d.ts +41 -0
  53. package/dist/components/nc-dropdown.js +170 -0
  54. package/dist/components/nc-empty-state.d.ts +5 -0
  55. package/dist/components/nc-empty-state.js +76 -0
  56. package/dist/components/nc-file-upload.d.ts +40 -0
  57. package/dist/components/nc-file-upload.js +336 -0
  58. package/dist/components/nc-form.d.ts +70 -0
  59. package/dist/components/nc-form.js +273 -0
  60. package/dist/components/nc-image.d.ts +10 -0
  61. package/dist/components/nc-image.js +139 -0
  62. package/dist/components/nc-input.d.ts +25 -0
  63. package/dist/components/nc-input.js +302 -0
  64. package/dist/components/nc-kbd.d.ts +5 -0
  65. package/dist/components/nc-kbd.js +34 -0
  66. package/dist/components/nc-menu-item.d.ts +43 -0
  67. package/dist/components/nc-menu-item.js +182 -0
  68. package/dist/components/nc-menu.d.ts +76 -0
  69. package/dist/components/nc-menu.js +360 -0
  70. package/dist/components/nc-modal.d.ts +51 -0
  71. package/dist/components/nc-modal.js +231 -0
  72. package/dist/components/nc-nav-item.d.ts +35 -0
  73. package/dist/components/nc-nav-item.js +142 -0
  74. package/dist/components/nc-number-input.d.ts +22 -0
  75. package/dist/components/nc-number-input.js +270 -0
  76. package/dist/components/nc-otp-input.d.ts +41 -0
  77. package/dist/components/nc-otp-input.js +227 -0
  78. package/dist/components/nc-pagination.d.ts +28 -0
  79. package/dist/components/nc-pagination.js +171 -0
  80. package/dist/components/nc-popover.d.ts +58 -0
  81. package/dist/components/nc-popover.js +301 -0
  82. package/dist/components/nc-progress-circular.d.ts +7 -0
  83. package/dist/components/nc-progress-circular.js +67 -0
  84. package/dist/components/nc-progress.d.ts +7 -0
  85. package/dist/components/nc-progress.js +109 -0
  86. package/dist/components/nc-radio.d.ts +13 -0
  87. package/dist/components/nc-radio.js +169 -0
  88. package/dist/components/nc-rating.d.ts +19 -0
  89. package/dist/components/nc-rating.js +187 -0
  90. package/dist/components/nc-rich-text.d.ts +43 -0
  91. package/dist/components/nc-rich-text.js +310 -0
  92. package/dist/components/nc-scroll-top.d.ts +28 -0
  93. package/dist/components/nc-scroll-top.js +103 -0
  94. package/dist/components/nc-select.d.ts +51 -0
  95. package/dist/components/nc-select.js +425 -0
  96. package/dist/components/nc-skeleton.d.ts +7 -0
  97. package/dist/components/nc-skeleton.js +90 -0
  98. package/dist/components/nc-slider.d.ts +41 -0
  99. package/dist/components/nc-slider.js +268 -0
  100. package/dist/components/nc-snackbar.d.ts +51 -0
  101. package/dist/components/nc-snackbar.js +200 -0
  102. package/dist/components/nc-splash.d.ts +25 -0
  103. package/dist/components/nc-splash.js +296 -0
  104. package/dist/components/nc-stepper.d.ts +50 -0
  105. package/dist/components/nc-stepper.js +236 -0
  106. package/dist/components/nc-switch.d.ts +14 -0
  107. package/dist/components/nc-switch.js +194 -0
  108. package/dist/components/nc-tab-item.d.ts +39 -0
  109. package/dist/components/nc-tab-item.js +127 -0
  110. package/dist/components/nc-table.d.ts +44 -0
  111. package/dist/components/nc-table.js +265 -0
  112. package/dist/components/nc-tabs.d.ts +79 -0
  113. package/dist/components/nc-tabs.js +519 -0
  114. package/dist/components/nc-tag-input.d.ts +49 -0
  115. package/dist/components/nc-tag-input.js +268 -0
  116. package/dist/components/nc-textarea.d.ts +15 -0
  117. package/dist/components/nc-textarea.js +164 -0
  118. package/dist/components/nc-time-picker.d.ts +51 -0
  119. package/dist/components/nc-time-picker.js +452 -0
  120. package/dist/components/nc-timeline.d.ts +53 -0
  121. package/dist/components/nc-timeline.js +171 -0
  122. package/dist/components/nc-tooltip.d.ts +27 -0
  123. package/dist/components/nc-tooltip.js +135 -0
  124. package/dist/core/component.d.ts +33 -0
  125. package/dist/core/component.js +208 -0
  126. package/dist/core/gpu-animation.d.ts +141 -0
  127. package/dist/core/gpu-animation.js +474 -0
  128. package/dist/core/lazyComponents.d.ts +13 -0
  129. package/dist/core/lazyComponents.js +73 -0
  130. package/dist/core/router.d.ts +55 -0
  131. package/dist/core/router.js +424 -0
  132. package/dist/core/state.d.ts +18 -0
  133. package/dist/core/state.js +153 -0
  134. package/dist/index.d.ts +14 -0
  135. package/dist/index.js +11 -0
  136. package/dist/utils/cacheBuster.d.ts +9 -0
  137. package/dist/utils/cacheBuster.js +12 -0
  138. package/dist/utils/dom.d.ts +16 -0
  139. package/dist/utils/dom.js +70 -0
  140. package/dist/utils/events.d.ts +20 -0
  141. package/dist/utils/events.js +80 -0
  142. package/dist/utils/templates.d.ts +2 -0
  143. package/dist/utils/templates.js +2 -0
  144. package/package.json +53 -0
  145. package/src/styles/base.css +40 -0
@@ -0,0 +1,186 @@
1
+ /**
2
+ * NcAccordion + NcAccordionItem Components
3
+ *
4
+ * nc-accordion:
5
+ * - multiple: boolean - allow multiple items open simultaneously
6
+ * - variant: 'default'|'bordered'|'flush' (default: 'default')
7
+ *
8
+ * nc-accordion-item:
9
+ * - header: string - header text (or use slot[name="header"])
10
+ * - open: boolean - expanded state
11
+ * - disabled: boolean
12
+ *
13
+ * Events (on nc-accordion-item):
14
+ * - toggle: CustomEvent<{ open: boolean }>
15
+ *
16
+ * Usage:
17
+ * <nc-accordion>
18
+ * <nc-accordion-item header="Section 1" open>Content here</nc-accordion-item>
19
+ * <nc-accordion-item header="Section 2">More content</nc-accordion-item>
20
+ * </nc-accordion>
21
+ */
22
+ import { Component, defineComponent } from '../core/component.js';
23
+ // ── NcAccordionItem ──────────────────────────────────────────────────────────
24
+ export class NcAccordionItem extends Component {
25
+ static useShadowDOM = true;
26
+ static get observedAttributes() { return ['header', 'open', 'disabled']; }
27
+ template() {
28
+ const header = this.getAttribute('header') || '';
29
+ const open = this.hasAttribute('open');
30
+ const disabled = this.hasAttribute('disabled');
31
+ return `
32
+ <style>
33
+ :host { display: block; }
34
+
35
+ .item {
36
+ border-bottom: 1px solid var(--nc-border);
37
+ }
38
+
39
+ .trigger {
40
+ width: 100%;
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: space-between;
44
+ gap: var(--nc-spacing-sm);
45
+ padding: var(--nc-spacing-md) var(--nc-spacing-lg);
46
+ background: none;
47
+ border: none;
48
+ cursor: ${disabled ? 'not-allowed' : 'pointer'};
49
+ color: ${disabled ? 'var(--nc-text-muted)' : 'var(--nc-text)'};
50
+ font-family: var(--nc-font-family);
51
+ font-size: var(--nc-font-size-base);
52
+ font-weight: var(--nc-font-weight-medium);
53
+ text-align: left;
54
+ transition: background var(--nc-transition-fast), color var(--nc-transition-fast);
55
+ opacity: ${disabled ? '0.6' : '1'};
56
+ }
57
+
58
+ .trigger:hover:not([disabled]) { background: var(--nc-bg-secondary); }
59
+ .trigger:focus-visible { outline: 2px solid var(--nc-primary); outline-offset: -2px; }
60
+
61
+ .chevron {
62
+ flex-shrink: 0;
63
+ transition: transform var(--nc-transition-base);
64
+ transform: rotate(${open ? '180deg' : '0deg'});
65
+ color: var(--nc-text-muted);
66
+ }
67
+
68
+ .body {
69
+ display: ${open ? 'block' : 'none'};
70
+ padding: 0 var(--nc-spacing-lg) var(--nc-spacing-md);
71
+ font-size: var(--nc-font-size-sm);
72
+ color: var(--nc-text-secondary, var(--nc-text-muted));
73
+ line-height: var(--nc-line-height-relaxed, 1.7);
74
+ }
75
+ </style>
76
+ <div class="item">
77
+ <button
78
+ class="trigger"
79
+ type="button"
80
+ aria-expanded="${open}"
81
+ ${disabled ? 'disabled' : ''}
82
+ >
83
+ <slot name="header">${header}</slot>
84
+ <svg class="chevron" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="none" width="16" height="16">
85
+ <path d="M3 6l5 5 5-5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
86
+ </svg>
87
+ </button>
88
+ <div class="body" role="region" aria-hidden="${!open}">
89
+ <slot></slot>
90
+ </div>
91
+ </div>
92
+ `;
93
+ }
94
+ onMount() {
95
+ this.$('.trigger').addEventListener('click', () => {
96
+ if (this.hasAttribute('disabled'))
97
+ return;
98
+ const nowOpen = !this.hasAttribute('open');
99
+ if (nowOpen) {
100
+ this.setAttribute('open', '');
101
+ }
102
+ else {
103
+ this.removeAttribute('open');
104
+ }
105
+ this.dispatchEvent(new CustomEvent('toggle', {
106
+ bubbles: true, composed: true,
107
+ detail: { open: nowOpen }
108
+ }));
109
+ });
110
+ }
111
+ attributeChangedCallback(name, oldValue, newValue) {
112
+ if (oldValue === newValue)
113
+ return;
114
+ if (name === 'open' && this._mounted) {
115
+ const open = this.hasAttribute('open');
116
+ const body = this.$('.body');
117
+ const chevron = this.$('.chevron');
118
+ const trigger = this.$('.trigger');
119
+ if (body) {
120
+ body.style.display = open ? 'block' : 'none';
121
+ body.setAttribute('aria-hidden', String(!open));
122
+ }
123
+ if (chevron)
124
+ chevron.style.transform = `rotate(${open ? 180 : 0}deg)`;
125
+ if (trigger)
126
+ trigger.setAttribute('aria-expanded', String(open));
127
+ return;
128
+ }
129
+ if (this._mounted) {
130
+ this.render();
131
+ this.onMount();
132
+ }
133
+ }
134
+ }
135
+ // ── NcAccordion ──────────────────────────────────────────────────────────────
136
+ export class NcAccordion extends Component {
137
+ static useShadowDOM = true;
138
+ static get observedAttributes() { return ['multiple', 'variant']; }
139
+ template() {
140
+ return `
141
+ <style>
142
+ :host { display: block; }
143
+
144
+ .accordion {
145
+ border-radius: var(--nc-radius-md, 8px);
146
+ overflow: hidden;
147
+ }
148
+
149
+ :host([variant="bordered"]) .accordion {
150
+ border: 1px solid var(--nc-border);
151
+ }
152
+
153
+ :host([variant="flush"]) .accordion {
154
+ border-radius: 0;
155
+ }
156
+
157
+ ::slotted(nc-accordion-item:last-child) {
158
+ border-bottom: none !important;
159
+ }
160
+ </style>
161
+ <div class="accordion">
162
+ <slot></slot>
163
+ </div>
164
+ `;
165
+ }
166
+ onMount() {
167
+ // Collapse siblings unless multiple is set
168
+ this.addEventListener('toggle', (e) => {
169
+ if (this.hasAttribute('multiple'))
170
+ return;
171
+ const opened = e.target;
172
+ if (!opened.hasAttribute('open'))
173
+ return;
174
+ this.querySelectorAll('nc-accordion-item').forEach(item => {
175
+ if (item !== opened)
176
+ item.removeAttribute('open');
177
+ });
178
+ });
179
+ }
180
+ attributeChangedCallback(name, oldValue, newValue) {
181
+ if (oldValue !== newValue && this._mounted)
182
+ this.render();
183
+ }
184
+ }
185
+ defineComponent('nc-accordion-item', NcAccordionItem);
186
+ defineComponent('nc-accordion', NcAccordion);
@@ -0,0 +1,11 @@
1
+ import { Component } from '../core/component.js';
2
+ export declare class NcAlert extends Component {
3
+ static useShadowDOM: boolean;
4
+ static get observedAttributes(): string[];
5
+ private dismissTimer;
6
+ template(): string;
7
+ onMount(): void;
8
+ onUnmount(): void;
9
+ private dismiss;
10
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
11
+ }
@@ -0,0 +1,127 @@
1
+ import { Component, defineComponent } from '../core/component.js';
2
+ const ICONS = {
3
+ info: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="18" height="18"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,
4
+ success: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="18" height="18"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,
5
+ warning: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="18" height="18"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,
6
+ danger: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="18" height="18"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`,
7
+ neutral: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="18" height="18"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`
8
+ };
9
+ export class NcAlert extends Component {
10
+ static useShadowDOM = true;
11
+ static get observedAttributes() {
12
+ return ['variant', 'title', 'dismissible', 'duration', 'icon', 'open'];
13
+ }
14
+ dismissTimer = null;
15
+ template() {
16
+ const variant = this.getAttribute('variant') || 'info';
17
+ const title = this.getAttribute('title') || '';
18
+ const dismissible = this.hasAttribute('dismissible');
19
+ const showIcon = this.getAttribute('icon') !== 'false';
20
+ const open = !this.hasAttribute('open') || this.getAttribute('open') !== 'false';
21
+ return `
22
+ <style>
23
+ :host { display: block; font-family: var(--nc-font-family); }
24
+
25
+ .alert {
26
+ display: ${open ? 'flex' : 'none'};
27
+ align-items: flex-start;
28
+ gap: var(--nc-spacing-sm, 0.5rem);
29
+ padding: var(--nc-spacing-md, 1rem) var(--nc-spacing-lg, 1.5rem);
30
+ border-radius: var(--nc-radius-md, 8px);
31
+ border: 1px solid transparent;
32
+ line-height: 1.5;
33
+ animation: nc-alert-in 0.2s ease;
34
+ }
35
+
36
+ @keyframes nc-alert-in {
37
+ from { opacity: 0; transform: translateY(-4px); }
38
+ to { opacity: 1; transform: translateY(0); }
39
+ }
40
+ .alert.out {
41
+ animation: nc-alert-out 0.18s ease forwards;
42
+ }
43
+ @keyframes nc-alert-out {
44
+ to { opacity: 0; transform: scale(0.97); }
45
+ }
46
+
47
+ .alert--info { background: #eff6ff; color: #1e40af; border-color: #93c5fd; }
48
+ .alert--success { background: #f0fdf4; color: #166534; border-color: #86efac; }
49
+ .alert--warning { background: #fffbeb; color: #92400e; border-color: #fcd34d; }
50
+ .alert--danger { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
51
+ .alert--neutral { background: var(--nc-bg-secondary, #f8fafc); color: var(--nc-text, #111827); border-color: var(--nc-border, #e5e7eb); }
52
+
53
+ .alert__icon { flex-shrink: 0; margin-top: 1px; }
54
+ .alert__body { flex: 1; font-size: var(--nc-font-size-sm, 0.875rem); }
55
+ .alert__title {
56
+ font-weight: var(--nc-font-weight-semibold, 600);
57
+ font-size: var(--nc-font-size-base, 1rem);
58
+ margin-bottom: 2px;
59
+ display: block;
60
+ }
61
+ .alert__close {
62
+ background: none;
63
+ border: none;
64
+ cursor: pointer;
65
+ flex-shrink: 0;
66
+ padding: 2px;
67
+ color: inherit;
68
+ opacity: 0.5;
69
+ transition: opacity var(--nc-transition-fast, 160ms ease);
70
+ display: flex;
71
+ line-height: 1;
72
+ border-radius: var(--nc-radius-sm, 4px);
73
+ }
74
+ .alert__close:hover { opacity: 1; }
75
+ </style>
76
+ <div class="alert alert--${variant}" role="alert" aria-live="polite">
77
+ ${showIcon ? `<span class="alert__icon">${ICONS[variant] ?? ICONS.info}</span>` : ''}
78
+ <div class="alert__body">
79
+ ${title ? `<strong class="alert__title">${title}</strong>` : ''}
80
+ <slot></slot>
81
+ </div>
82
+ ${dismissible ? `
83
+ <button class="alert__close" type="button" aria-label="Close alert">
84
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14" fill="none" width="14" height="14">
85
+ <path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
86
+ </svg>
87
+ </button>` : ''}
88
+ </div>
89
+ `;
90
+ }
91
+ onMount() {
92
+ const closeButton = this.$('.alert__close');
93
+ if (closeButton) {
94
+ closeButton.addEventListener('click', () => this.dismiss());
95
+ }
96
+ const duration = Number(this.getAttribute('duration') || 0);
97
+ if (duration > 0) {
98
+ this.dismissTimer = setTimeout(() => this.dismiss(), duration);
99
+ }
100
+ }
101
+ onUnmount() {
102
+ if (this.dismissTimer) {
103
+ clearTimeout(this.dismissTimer);
104
+ }
105
+ }
106
+ dismiss() {
107
+ if (this.dismissTimer) {
108
+ clearTimeout(this.dismissTimer);
109
+ this.dismissTimer = null;
110
+ }
111
+ const alertElement = this.$('.alert');
112
+ if (alertElement) {
113
+ alertElement.classList.add('out');
114
+ alertElement.addEventListener('animationend', () => {
115
+ alertElement.style.display = 'none';
116
+ this.dispatchEvent(new CustomEvent('dismiss', { bubbles: true, composed: true }));
117
+ }, { once: true });
118
+ }
119
+ }
120
+ attributeChangedCallback(name, oldValue, newValue) {
121
+ if (oldValue !== newValue && this._mounted) {
122
+ this.render();
123
+ this.onMount();
124
+ }
125
+ }
126
+ }
127
+ defineComponent('nc-alert', NcAlert);
@@ -0,0 +1,117 @@
1
+ /**
2
+ * NcAnimation Component
3
+ *
4
+ * A declarative animation wrapper that intelligently selects the most
5
+ * GPU-efficient execution path for each animation type:
6
+ *
7
+ * - Simple CSS keyframes → runs entirely on the compositor thread (no JS)
8
+ * - Enter / exit → Web Animations API via gpu-animation.ts
9
+ * - Scroll-reveal → IntersectionObserver + Web Animations API
10
+ * - Continuous / looping → CSS animation (compositor-only)
11
+ * - Particle effects → WebGL (vertex shader) with canvas2d fallback
12
+ *
13
+ * Attributes:
14
+ * name - Animation preset name (see list below). Required.
15
+ * trigger - When to run: 'mount'|'visible'|'hover'|'click'|'manual' (default: 'mount')
16
+ * duration - Ms integer (default: varies per preset)
17
+ * delay - Ms delay before animation starts (default: 0)
18
+ * easing - CSS easing / cubic-bezier string (default: preset-specific)
19
+ * iterations - Number or 'infinite' (default: 1)
20
+ * distance - Slide/offset distance in px (default: 40)
21
+ * threshold - IntersectionObserver threshold 0-1 (default: 0.15, trigger=visible only)
22
+ * fill - Web Animations fill mode: 'forwards'|'backwards'|'both'|'none' (default: 'forwards')
23
+ * reverse - boolean - play animation backwards
24
+ * no-gpu-hint - boolean - skip will-change + contain hints (use for very tiny elements)
25
+ *
26
+ * Particle-specific attributes (all optional):
27
+ * origin-x - Horizontal start position as 0-1 fraction of screen width (default: 0.5 = center)
28
+ * origin-y - Vertical start position as 0-1 fraction of screen height (default: 0.5)
29
+ * Special shortcuts: 'top'=0, 'bottom'=1, 'left'=0, 'right'=1, 'center'=0.5
30
+ * target-x - End-point X fraction (used by 'converge'/'ripple' presets)
31
+ * target-y - End-point Y fraction
32
+ * count - Override particle count (integer)
33
+ * spread - Override spread/speed scale 0-2 (default: 1)
34
+ *
35
+ * Animation preset names:
36
+ * Enter/exit: fade-in | fade-out | slide-up | slide-down | slide-left | slide-right
37
+ * scale-in | scale-out | zoom-in | zoom-out | flip-x | flip-y
38
+ * Attention: pulse | shake | bounce | rubber-band | swing | jello | tada | heartbeat
39
+ * Continuous: spin | ping | float | glow
40
+ * Particles: confetti | sparkles | bubbles | snow | firework |
41
+ * electricity | fire | explosion | ripple
42
+ *
43
+ * Events:
44
+ * start - CustomEvent - animation begins
45
+ * finish - CustomEvent - animation ends (not fired for infinite)
46
+ * cancel - CustomEvent - animation was cancelled
47
+ *
48
+ * Methods (call on the element):
49
+ * el.play() - play / replay
50
+ * el.pause() - pause (Web Animations API animations only)
51
+ * el.cancel() - cancel and reset
52
+ *
53
+ * Slots:
54
+ * default - the content to animate
55
+ *
56
+ * Usage:
57
+ * <nc-animation name="fade-in" trigger="visible">
58
+ * <nc-card>...</nc-card>
59
+ * </nc-animation>
60
+ *
61
+ * <nc-animation name="slide-up" trigger="visible" delay="150">
62
+ * <p>Staggered paragraph</p>
63
+ * </nc-animation>
64
+ *
65
+ * <nc-animation name="pulse" trigger="hover" iterations="infinite">
66
+ * <nc-button>Hover me</nc-button>
67
+ * </nc-animation>
68
+ *
69
+ * <nc-animation name="confetti" trigger="click">
70
+ * <nc-button variant="success">Celebrate</nc-button>
71
+ * </nc-animation>
72
+ */
73
+ import { Component } from '../core/component.js';
74
+ export declare class NcAnimation extends Component {
75
+ static useShadowDOM: boolean;
76
+ static get observedAttributes(): string[];
77
+ private _waAnimation;
78
+ private _particleLoop;
79
+ private _particleWebGL;
80
+ private _canvas;
81
+ private _io;
82
+ private _hoverOff;
83
+ private _clickOff;
84
+ private _cssAnimName;
85
+ private _visibleFired;
86
+ template(): string;
87
+ onMount(): void;
88
+ onUnmount(): void;
89
+ play(): void;
90
+ pause(): void;
91
+ cancel(): void;
92
+ private _setup;
93
+ private _teardown;
94
+ private _scheduleRun;
95
+ private _setupVisibleTrigger;
96
+ private _setupHoverTrigger;
97
+ private _setupClickTrigger;
98
+ private _run;
99
+ private _runWAAPI;
100
+ private _runCSS;
101
+ /** Resolve 'top'|'bottom'|'left'|'right'|'center'|number-string → 0-1 float */
102
+ private _resolvePos;
103
+ private _runParticles;
104
+ /**
105
+ * Full canvas2d particle engine.
106
+ * origin / target are 0-1 fractions of canvas dimensions.
107
+ * Each preset type gets its own spawn + update behaviour.
108
+ */
109
+ private _runCanvas2D;
110
+ private _stopParticles;
111
+ /** First painted element assigned to the default slot. */
112
+ private _target;
113
+ private _attr;
114
+ private _numAttr;
115
+ private _iterAttr;
116
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
117
+ }