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,74 @@
1
+ import { Component, defineComponent } from '../core/component.js';
2
+ export class NcCard extends Component {
3
+ static useShadowDOM = true;
4
+ static attributeOptions = {
5
+ variant: ['primary', 'secondary', 'success', 'danger'],
6
+ size: ['sm', 'md', 'lg']
7
+ };
8
+ static get observedAttributes() {
9
+ return ['variant', 'size', 'disabled'];
10
+ }
11
+ template() {
12
+ return `
13
+ <style>
14
+ :host {
15
+ display: block;
16
+ font-family: var(--nc-font-family);
17
+ padding: var(--nc-spacing-md, 1rem);
18
+ border-radius: var(--nc-radius-md, 0.75rem);
19
+ transition: all var(--nc-transition-fast, 160ms ease);
20
+ width: 100%;
21
+ box-sizing: border-box;
22
+ }
23
+
24
+ :host([variant="primary"]) {
25
+ background: var(--nc-gradient-primary, linear-gradient(135deg, #10b981, #059669));
26
+ color: var(--nc-white, #ffffff);
27
+ }
28
+
29
+ :host([variant="secondary"]) {
30
+ background: var(--nc-bg-secondary, #f8fafc);
31
+ color: var(--nc-text, #111827);
32
+ border: 1px solid var(--nc-border, #e5e7eb);
33
+ }
34
+
35
+ :host([variant="success"]) {
36
+ background: var(--nc-gradient-success, linear-gradient(135deg, #22c55e, #16a34a));
37
+ color: var(--nc-white, #ffffff);
38
+ }
39
+
40
+ :host([variant="danger"]) {
41
+ background: var(--nc-gradient-danger, linear-gradient(135deg, #ef4444, #dc2626));
42
+ color: var(--nc-white, #ffffff);
43
+ }
44
+
45
+ :host([size="sm"]) {
46
+ padding: var(--nc-spacing-sm, 0.75rem);
47
+ font-size: var(--nc-font-size-sm, 0.875rem);
48
+ }
49
+
50
+ :host([size="md"]) {
51
+ padding: var(--nc-spacing-md, 1rem);
52
+ font-size: var(--nc-font-size-base, 1rem);
53
+ }
54
+
55
+ :host([size="lg"]) {
56
+ padding: var(--nc-spacing-lg, 1.5rem);
57
+ font-size: var(--nc-font-size-lg, 1.125rem);
58
+ }
59
+
60
+ :host([disabled]) {
61
+ opacity: 0.5;
62
+ pointer-events: none;
63
+ }
64
+ </style>
65
+ <slot></slot>
66
+ `;
67
+ }
68
+ attributeChangedCallback(name, oldValue, newValue) {
69
+ if (oldValue !== newValue && this._mounted) {
70
+ this.render();
71
+ }
72
+ }
73
+ }
74
+ defineComponent('nc-card', NcCard);
@@ -0,0 +1,16 @@
1
+ import { Component } from '../core/component.js';
2
+ export declare class NcCheckbox extends Component {
3
+ static useShadowDOM: boolean;
4
+ private readonly handleInputChange;
5
+ private readonly handleKeyDown;
6
+ static attributeOptions: {
7
+ variant: string[];
8
+ size: string[];
9
+ };
10
+ static get observedAttributes(): string[];
11
+ template(): string;
12
+ onMount(): void;
13
+ onUnmount(): void;
14
+ private setCheckedState;
15
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
16
+ }
@@ -0,0 +1,194 @@
1
+ import { Component, defineComponent } from '../core/component.js';
2
+ export class NcCheckbox extends Component {
3
+ static useShadowDOM = true;
4
+ handleInputChange = (event) => {
5
+ const target = event.target;
6
+ if (!target || target.type !== 'checkbox')
7
+ return;
8
+ this.setCheckedState(target.checked);
9
+ };
10
+ handleKeyDown = (event) => {
11
+ if (event.key === ' ' || event.key === 'Enter') {
12
+ event.preventDefault();
13
+ if (!this.hasAttribute('disabled')) {
14
+ this.setCheckedState(!this.hasAttribute('checked'));
15
+ }
16
+ }
17
+ };
18
+ static attributeOptions = {
19
+ variant: ['primary', 'success', 'danger'],
20
+ size: ['sm', 'md', 'lg']
21
+ };
22
+ static get observedAttributes() {
23
+ return ['label', 'name', 'value', 'checked', 'disabled', 'size', 'variant', 'indeterminate'];
24
+ }
25
+ template() {
26
+ const label = this.getAttribute('label') || '';
27
+ const size = this.getAttribute('size') || 'md';
28
+ const checked = this.hasAttribute('checked');
29
+ const disabled = this.hasAttribute('disabled');
30
+ return `
31
+ <style>
32
+ :host {
33
+ display: inline-flex;
34
+ align-items: center;
35
+ gap: var(--nc-spacing-sm, 0.5rem);
36
+ cursor: ${disabled ? 'not-allowed' : 'pointer'};
37
+ user-select: none;
38
+ font-family: var(--nc-font-family);
39
+ opacity: ${disabled ? '0.5' : '1'};
40
+ }
41
+ .checkbox-wrapper {
42
+ display: inline-flex;
43
+ align-items: center;
44
+ gap: var(--nc-spacing-sm, 0.5rem);
45
+ }
46
+ input[type="checkbox"] {
47
+ position: absolute;
48
+ opacity: 0;
49
+ width: 0;
50
+ height: 0;
51
+ pointer-events: none;
52
+ }
53
+ .box {
54
+ display: inline-flex;
55
+ align-items: center;
56
+ justify-content: center;
57
+ flex-shrink: 0;
58
+ border-radius: var(--nc-radius-sm, 4px);
59
+ border: 2px solid var(--nc-border-dark, #9ca3af);
60
+ background: var(--nc-bg, #ffffff);
61
+ transition: all var(--nc-transition-fast, 160ms ease);
62
+ position: relative;
63
+ box-sizing: border-box;
64
+ }
65
+ :host([size="sm"]) .box,
66
+ :host(:not([size])) .box {
67
+ width: 16px;
68
+ height: 16px;
69
+ }
70
+ :host([size="md"]) .box {
71
+ width: 20px;
72
+ height: 20px;
73
+ }
74
+ :host([size="lg"]) .box {
75
+ width: 24px;
76
+ height: 24px;
77
+ }
78
+ .box {
79
+ width: 20px;
80
+ height: 20px;
81
+ }
82
+ :host([checked]) .box,
83
+ :host([indeterminate]) .box {
84
+ border-color: var(--nc-primary, #10b981);
85
+ background: var(--nc-primary, #10b981);
86
+ }
87
+ :host([variant="success"][checked]) .box,
88
+ :host([variant="success"][indeterminate]) .box {
89
+ border-color: var(--nc-success, #10b981);
90
+ background: var(--nc-success, #10b981);
91
+ }
92
+ :host([variant="danger"][checked]) .box,
93
+ :host([variant="danger"][indeterminate]) .box {
94
+ border-color: var(--nc-danger, #ef4444);
95
+ background: var(--nc-danger, #ef4444);
96
+ }
97
+ .check-icon {
98
+ display: none;
99
+ pointer-events: none;
100
+ }
101
+ :host([checked]) .check-icon {
102
+ display: block;
103
+ }
104
+ .indeterminate-icon {
105
+ display: none;
106
+ pointer-events: none;
107
+ }
108
+ :host([indeterminate]:not([checked])) .indeterminate-icon {
109
+ display: block;
110
+ }
111
+ :host([indeterminate]:not([checked])) .check-icon {
112
+ display: none;
113
+ }
114
+ :host(:not([disabled])) .box:hover {
115
+ border-color: var(--nc-primary, #10b981);
116
+ box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
117
+ }
118
+ :host([variant="success"]:not([disabled])) .box:hover {
119
+ border-color: var(--nc-success, #10b981);
120
+ box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
121
+ }
122
+ :host([variant="danger"]:not([disabled])) .box:hover {
123
+ border-color: var(--nc-danger, #ef4444);
124
+ box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
125
+ }
126
+ :host(:focus-visible) .box {
127
+ outline: 2px solid var(--nc-primary, #10b981);
128
+ outline-offset: 2px;
129
+ }
130
+ .label {
131
+ font-size: var(--nc-font-size-base, 1rem);
132
+ color: var(--nc-text, #111827);
133
+ line-height: var(--nc-line-height-normal, 1.5);
134
+ }
135
+ :host([size="sm"]) .label {
136
+ font-size: var(--nc-font-size-sm, 0.875rem);
137
+ }
138
+ :host([size="lg"]) .label {
139
+ font-size: var(--nc-font-size-lg, 1.125rem);
140
+ }
141
+ </style>
142
+
143
+ <label class="checkbox-wrapper">
144
+ <input type="checkbox" ${checked ? 'checked' : ''} ${disabled ? 'disabled' : ''} name="${this.getAttribute('name') || ''}" value="${this.getAttribute('value') || 'on'}" />
145
+ <span class="box">
146
+ <svg class="check-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="none" width="${size === 'sm' ? '8' : size === 'lg' ? '14' : '11'}" height="${size === 'sm' ? '8' : size === 'lg' ? '14' : '11'}"><path d="M2 6l3 3 5-5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>
147
+ <svg class="indeterminate-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="none" width="${size === 'sm' ? '8' : size === 'lg' ? '14' : '11'}" height="${size === 'sm' ? '8' : size === 'lg' ? '14' : '11'}"><path d="M2 6h8" stroke="white" stroke-width="2" stroke-linecap="round"/></svg>
148
+ </span>
149
+ ${label ? `<span class="label">${label}</span>` : '<slot></slot>'}
150
+ </label>
151
+ `;
152
+ }
153
+ onMount() {
154
+ if (!this.hasAttribute('tabindex')) {
155
+ this.setAttribute('tabindex', '0');
156
+ }
157
+ this.setAttribute('role', 'checkbox');
158
+ this.setAttribute('aria-checked', String(this.hasAttribute('checked')));
159
+ this.shadowRoot?.addEventListener('change', this.handleInputChange);
160
+ this.addEventListener('keydown', this.handleKeyDown);
161
+ }
162
+ onUnmount() {
163
+ this.shadowRoot?.removeEventListener('change', this.handleInputChange);
164
+ this.removeEventListener('keydown', this.handleKeyDown);
165
+ }
166
+ setCheckedState(isChecked) {
167
+ if (isChecked) {
168
+ this.setAttribute('checked', '');
169
+ this.removeAttribute('indeterminate');
170
+ }
171
+ else {
172
+ this.removeAttribute('checked');
173
+ }
174
+ this.setAttribute('aria-checked', String(this.hasAttribute('checked')));
175
+ this.dispatchEvent(new CustomEvent('change', {
176
+ bubbles: true,
177
+ composed: true,
178
+ detail: {
179
+ checked: this.hasAttribute('checked'),
180
+ value: this.getAttribute('value') || 'on',
181
+ name: this.getAttribute('name') || ''
182
+ }
183
+ }));
184
+ }
185
+ attributeChangedCallback(name, oldValue, newValue) {
186
+ if (oldValue !== newValue && this._mounted) {
187
+ this.render();
188
+ if (name === 'checked') {
189
+ this.setAttribute('aria-checked', String(this.hasAttribute('checked')));
190
+ }
191
+ }
192
+ }
193
+ }
194
+ defineComponent('nc-checkbox', NcCheckbox);
@@ -0,0 +1,8 @@
1
+ import { Component } from '../core/component.js';
2
+ export declare class NcChip extends Component {
3
+ static useShadowDOM: boolean;
4
+ static get observedAttributes(): string[];
5
+ template(): string;
6
+ onMount(): void;
7
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
8
+ }
@@ -0,0 +1,89 @@
1
+ import { Component, defineComponent } from '../core/component.js';
2
+ export class NcChip extends Component {
3
+ static useShadowDOM = true;
4
+ static get observedAttributes() {
5
+ return ['variant', 'size', 'dismissible', 'disabled', 'icon'];
6
+ }
7
+ template() {
8
+ const variant = this.getAttribute('variant') || 'default';
9
+ const dismissible = this.hasAttribute('dismissible');
10
+ const disabled = this.hasAttribute('disabled');
11
+ const icon = this.getAttribute('icon');
12
+ return `
13
+ <style>
14
+ :host { display: inline-flex; }
15
+
16
+ .chip {
17
+ display: inline-flex;
18
+ align-items: center;
19
+ gap: var(--nc-spacing-xs, 0.25rem);
20
+ border-radius: 999px;
21
+ font-family: var(--nc-font-family);
22
+ font-weight: var(--nc-font-weight-medium, 500);
23
+ white-space: nowrap;
24
+ border: 1px solid transparent;
25
+ transition: opacity var(--nc-transition-fast, 160ms ease);
26
+ opacity: ${disabled ? '0.5' : '1'};
27
+ pointer-events: ${disabled ? 'none' : 'auto'};
28
+ }
29
+
30
+ :host([size="sm"]) .chip { font-size: var(--nc-font-size-xs, 0.75rem); padding: 2px 8px; }
31
+ :host([size="lg"]) .chip { font-size: var(--nc-font-size-base, 1rem); padding: 6px 14px; }
32
+ .chip { font-size: var(--nc-font-size-sm, 0.875rem); padding: 3px 10px; }
33
+
34
+ .chip--default { background: var(--nc-bg-secondary, #f8fafc); color: var(--nc-text, #111827); border-color: var(--nc-border, #e5e7eb); }
35
+ .chip--primary { background: rgba(16,185,129,.12); color: var(--nc-primary, #10b981); border-color: var(--nc-primary, #10b981); }
36
+ .chip--success { background: rgba(16,185,129,.12); color: var(--nc-success, #10b981); border-color: var(--nc-success, #10b981); }
37
+ .chip--warning { background: rgba(245,158,11,.12); color: var(--nc-warning, #f59e0b); border-color: var(--nc-warning, #f59e0b); }
38
+ .chip--danger { background: rgba(239,68,68,.10); color: var(--nc-danger, #ef4444); border-color: var(--nc-danger, #ef4444); }
39
+ .chip--neutral { background: var(--nc-bg-tertiary, #f3f4f6); color: var(--nc-text-muted, #6b7280); border-color: var(--nc-border-dark, #d1d5db); }
40
+
41
+ .chip__icon { width: 14px; height: 14px; border-radius: 50%; object-fit: cover; }
42
+
43
+ .chip__dismiss {
44
+ display: inline-flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ background: none;
48
+ border: none;
49
+ cursor: pointer;
50
+ padding: 0;
51
+ margin-left: 2px;
52
+ color: inherit;
53
+ opacity: 0.6;
54
+ transition: opacity var(--nc-transition-fast, 160ms ease);
55
+ line-height: 1;
56
+ }
57
+ .chip__dismiss:hover { opacity: 1; }
58
+
59
+ ::slotted(*) { pointer-events: none; }
60
+ </style>
61
+ <span class="chip chip--${variant}">
62
+ ${icon ? `<img class="chip__icon" src="${icon}" alt="" aria-hidden="true" />` : ''}
63
+ <slot></slot>
64
+ ${dismissible ? `
65
+ <button class="chip__dismiss" type="button" aria-label="Remove">
66
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" fill="none" width="10" height="10">
67
+ <path d="M2 2l8 8M10 2l-8 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
68
+ </svg>
69
+ </button>` : ''}
70
+ </span>
71
+ `;
72
+ }
73
+ onMount() {
74
+ const button = this.$('.chip__dismiss');
75
+ if (button) {
76
+ button.addEventListener('click', event => {
77
+ event.stopPropagation();
78
+ this.dispatchEvent(new CustomEvent('dismiss', { bubbles: true, composed: true }));
79
+ });
80
+ }
81
+ }
82
+ attributeChangedCallback(name, oldValue, newValue) {
83
+ if (oldValue !== newValue && this._mounted) {
84
+ this.render();
85
+ this.onMount();
86
+ }
87
+ }
88
+ }
89
+ defineComponent('nc-chip', NcChip);
@@ -0,0 +1,37 @@
1
+ /**
2
+ * NcCode Component - syntax-highlighted code block with copy button
3
+ *
4
+ * Performs simple tokenization for common languages so it works
5
+ * without a runtime dependency (zero JS syntax libraries).
6
+ *
7
+ * Attributes:
8
+ * language - 'typescript'|'javascript'|'html'|'css'|'json'|'bash'|'text' (default: 'text')
9
+ * label - optional filename / caption shown in header bar
10
+ * no-copy - boolean - hide the copy button
11
+ * no-lines - boolean - hide line numbers
12
+ * max-height - CSS value e.g. '400px' - sets overflow-y: auto
13
+ * highlight - comma-separated 1-based line numbers to highlight (e.g. "2,4,6")
14
+ * wrap - boolean - enable word wrap
15
+ *
16
+ * Slots:
17
+ * (default) - code content (plain text; HTML will be escaped automatically)
18
+ * OR use the `code` attribute for programmatic use.
19
+ *
20
+ * code property:
21
+ * el.code = '...' - set code programmatically (overrides slot content)
22
+ *
23
+ * Usage:
24
+ * <nc-code language="typescript" label="app.ts">
25
+ * const x = useState(0);
26
+ * </nc-code>
27
+ */
28
+ import { Component } from '../core/component.js';
29
+ export declare class NcCode extends Component {
30
+ static useShadowDOM: boolean;
31
+ private _code;
32
+ get code(): string;
33
+ set code(v: string);
34
+ template(): string;
35
+ onMount(): void;
36
+ private _copy;
37
+ }