elementdrawing 1.0.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 (78) hide show
  1. package/LICENSE +21 -0
  2. package/dist/elementdrawing.min.js +3 -0
  3. package/dist/elementdrawing.min.js.LICENSE.txt +8 -0
  4. package/dist/elementdrawing.min.js.map +1 -0
  5. package/dist/index.html +1 -0
  6. package/package.json +127 -0
  7. package/src/core/bridge.h +855 -0
  8. package/src/core/diff.c +900 -0
  9. package/src/core/element.c +1078 -0
  10. package/src/core/event.c +813 -0
  11. package/src/core/fiber.c +1027 -0
  12. package/src/core/hooks.c +919 -0
  13. package/src/core/renderer.c +963 -0
  14. package/src/core/scheduler.c +702 -0
  15. package/src/core/state.c +803 -0
  16. package/src/css/animations.css +779 -0
  17. package/src/css/base.css +615 -0
  18. package/src/css/components.css +1311 -0
  19. package/src/css/tailwind.css +370 -0
  20. package/src/css/themes.css +517 -0
  21. package/src/css/utilities.css +475 -0
  22. package/src/index.js +746 -0
  23. package/src/js/animation.js +655 -0
  24. package/src/js/dom.js +665 -0
  25. package/src/js/events.js +585 -0
  26. package/src/js/http.js +446 -0
  27. package/src/js/index.js +26 -0
  28. package/src/js/router.js +483 -0
  29. package/src/js/store.js +539 -0
  30. package/src/js/utils.js +593 -0
  31. package/src/js/validator.js +529 -0
  32. package/src/jsx/components/Accordion.jsx +210 -0
  33. package/src/jsx/components/Alert.jsx +169 -0
  34. package/src/jsx/components/Avatar.jsx +214 -0
  35. package/src/jsx/components/Badge.jsx +136 -0
  36. package/src/jsx/components/Breadcrumb.jsx +200 -0
  37. package/src/jsx/components/Button.jsx +188 -0
  38. package/src/jsx/components/Card.jsx +192 -0
  39. package/src/jsx/components/Carousel.jsx +278 -0
  40. package/src/jsx/components/Checkbox.jsx +215 -0
  41. package/src/jsx/components/Dialog.jsx +242 -0
  42. package/src/jsx/components/Drawer.jsx +190 -0
  43. package/src/jsx/components/Dropdown.jsx +268 -0
  44. package/src/jsx/components/Form.jsx +274 -0
  45. package/src/jsx/components/Input.jsx +285 -0
  46. package/src/jsx/components/Menu.jsx +276 -0
  47. package/src/jsx/components/Modal.jsx +274 -0
  48. package/src/jsx/components/Navbar.jsx +292 -0
  49. package/src/jsx/components/Pagination.jsx +268 -0
  50. package/src/jsx/components/Progress.jsx +252 -0
  51. package/src/jsx/components/Radio.jsx +208 -0
  52. package/src/jsx/components/Select.jsx +397 -0
  53. package/src/jsx/components/Sidebar.jsx +250 -0
  54. package/src/jsx/components/Slider.jsx +310 -0
  55. package/src/jsx/components/Spinner.jsx +198 -0
  56. package/src/jsx/components/Switch.jsx +201 -0
  57. package/src/jsx/components/Table.jsx +332 -0
  58. package/src/jsx/components/Tabs.jsx +227 -0
  59. package/src/jsx/components/Textarea.jsx +212 -0
  60. package/src/jsx/components/Toast.jsx +270 -0
  61. package/src/jsx/components/Tooltip.jsx +178 -0
  62. package/src/jsx/components/Typography.jsx +299 -0
  63. package/src/jsx/components/index.jsx +70 -0
  64. package/src/jsx/core/element.js +3 -0
  65. package/src/jsx/hooks/index.js +356 -0
  66. package/src/jsx/hooks/useCallback.js +472 -0
  67. package/src/jsx/hooks/useContext.js +586 -0
  68. package/src/jsx/hooks/useEffect.js +704 -0
  69. package/src/jsx/hooks/useLayoutEffect.js +508 -0
  70. package/src/jsx/hooks/useMemo.js +689 -0
  71. package/src/jsx/hooks/useReducer.js +729 -0
  72. package/src/jsx/hooks/useRef.js +542 -0
  73. package/src/jsx/hooks/useState.js +854 -0
  74. package/src/jsx/runtime/commit.js +903 -0
  75. package/src/jsx/runtime/createElement.js +860 -0
  76. package/src/jsx/runtime/index.js +356 -0
  77. package/src/jsx/runtime/reconcile.js +687 -0
  78. package/src/jsx/runtime/render.js +914 -0
@@ -0,0 +1,299 @@
1
+ /**
2
+ * Typography Component for ElementDrawing Framework
3
+ * Supports Heading (h1-h6), Text, Paragraph, Title, strong, italic, underline, strikethrough, code, mark, delete, keyboard
4
+ */
5
+ const ED = require('../core/element');
6
+
7
+ const HEADING_SIZES = {
8
+ h1: 'ed-text-4xl ed-font-bold ed-leading-tight',
9
+ h2: 'ed-text-3xl ed-font-bold ed-leading-tight',
10
+ h3: 'ed-text-2xl ed-font-semibold ed-leading-snug',
11
+ h4: 'ed-text-xl ed-font-semibold ed-leading-snug',
12
+ h5: 'ed-text-lg ed-font-medium ed-leading-normal',
13
+ h6: 'ed-text-base ed-font-medium ed-leading-normal',
14
+ };
15
+
16
+ const TEXT_COLORS = {
17
+ default: 'ed-text-gray-900',
18
+ secondary: 'ed-text-gray-500',
19
+ success: 'ed-text-green-600',
20
+ warning: 'ed-text-yellow-600',
21
+ danger: 'ed-text-red-600',
22
+ info: 'ed-text-blue-600',
23
+ muted: 'ed-text-gray-400',
24
+ white: 'ed-text-white',
25
+ inherit: '',
26
+ };
27
+
28
+ function Heading(props) {
29
+ const {
30
+ level = 2,
31
+ children,
32
+ className = '',
33
+ style = {},
34
+ color,
35
+ align,
36
+ id,
37
+ weight,
38
+ truncate = false,
39
+ ellipsis = false,
40
+ underline: headingUnderline = false,
41
+ italic = false,
42
+ transform,
43
+ marginTop = true,
44
+ marginBottom = true,
45
+ } = props;
46
+
47
+ const tag = `h${level}`;
48
+ const sizeClass = HEADING_SIZES[tag] || HEADING_SIZES.h2;
49
+
50
+ const headingClasses = [
51
+ sizeClass,
52
+ color ? (TEXT_COLORS[color] || `ed-text-${color}`) : '',
53
+ align ? `ed-text-${align}` : '',
54
+ weight ? `ed-font-${weight}` : '',
55
+ truncate || ellipsis ? 'ed-truncate' : '',
56
+ headingUnderline ? 'ed-underline' : '',
57
+ italic ? 'ed-italic' : '',
58
+ transform ? `ed-${transform}` : '',
59
+ marginTop ? 'ed-mt-6' : '',
60
+ marginBottom ? 'ed-mb-2' : '',
61
+ className,
62
+ ].filter(Boolean).join(' ');
63
+
64
+ return ED.createElement(tag, {
65
+ id,
66
+ className: headingClasses,
67
+ style: { ...(ellipsis ? { maxWidth: '100%' } : {}), ...style },
68
+ children,
69
+ });
70
+ }
71
+
72
+ Heading.displayName = 'Heading';
73
+
74
+ function Text(props) {
75
+ const {
76
+ children,
77
+ className = '',
78
+ style = {},
79
+ size,
80
+ color,
81
+ weight,
82
+ align,
83
+ truncate = false,
84
+ ellipsis = false,
85
+ strong = false,
86
+ italic = false,
87
+ underline = false,
88
+ strikethrough = false,
89
+ delete: isDelete = false,
90
+ mark = false,
91
+ code = false,
92
+ keyboard = false,
93
+ small = false,
94
+ disabled = false,
95
+ copyable = false,
96
+ onCopy,
97
+ editable = false,
98
+ onEdit,
99
+ type,
100
+ transform,
101
+ tag: customTag,
102
+ onClick,
103
+ title,
104
+ } = props;
105
+
106
+ const colorClass = type ? (TEXT_COLORS[type] || '') : color ? (TEXT_COLORS[color] || `ed-text-${color}`) : '';
107
+
108
+ const sizeClasses = {
109
+ xs: 'ed-text-xs',
110
+ sm: 'ed-text-sm',
111
+ md: 'ed-text-base',
112
+ lg: 'ed-text-lg',
113
+ xl: 'ed-text-xl',
114
+ };
115
+
116
+ const textClasses = [
117
+ size ? sizeClasses[size] || `ed-text-${size}` : '',
118
+ colorClass,
119
+ weight ? `ed-font-${weight}` : strong ? 'ed-font-semibold' : '',
120
+ align ? `ed-text-${align}` : '',
121
+ truncate || ellipsis ? 'ed-truncate' : '',
122
+ italic ? 'ed-italic' : '',
123
+ underline ? 'ed-underline' : '',
124
+ strikethrough || isDelete ? 'ed-line-through' : '',
125
+ mark ? 'ed-bg-yellow-200 ed-px-1 ed-rounded' : '',
126
+ code ? 'ed-bg-gray-100 ed-px-1.5 ed-py-0.5 ed-rounded ed-text-sm ed-font-mono ed-text-pink-600' : '',
127
+ keyboard ? 'ed-bg-gray-100 ed-px-1.5 ed-py-0.5 ed-rounded ed-border ed-border-gray-300 ed-shadow-sm ed-text-xs ed-font-mono' : '',
128
+ small ? 'ed-text-xs' : '',
129
+ disabled ? 'ed-text-gray-400 ed-cursor-not-allowed' : '',
130
+ transform ? `ed-${transform}` : '',
131
+ className,
132
+ ].filter(Boolean).join(' ');
133
+
134
+ let content = children;
135
+
136
+ if (mark) {
137
+ content = ED.createElement('mark', {
138
+ className: 'ed-bg-yellow-200 ed-px-1 ed-rounded',
139
+ }, children);
140
+ }
141
+
142
+ if (code) {
143
+ content = ED.createElement('code', {
144
+ className: 'ed-bg-gray-100 ed-px-1.5 ed-py-0.5 ed-rounded ed-text-sm ed-font-mono ed-text-pink-600',
145
+ }, children);
146
+ }
147
+
148
+ if (keyboard) {
149
+ content = ED.createElement('kbd', {
150
+ className: 'ed-bg-gray-100 ed-px-1.5 ed-py-0.5 ed-rounded ed-border ed-border-gray-300 ed-shadow-sm ed-text-xs ed-font-mono',
151
+ }, children);
152
+ }
153
+
154
+ if (isDelete || strikethrough) {
155
+ content = ED.createElement('del', null, content);
156
+ }
157
+
158
+ if (strong && !weight) {
159
+ content = ED.createElement('strong', null, content);
160
+ }
161
+
162
+ const copyButton = copyable
163
+ ? ED.createElement('button', {
164
+ className: 'ed-ml-2 ed-p-0.5 ed-text-gray-400 hover:ed-text-gray-600 ed-transition-colors ed-inline-flex',
165
+ onClick: () => {
166
+ if (typeof navigator !== 'undefined' && navigator.clipboard) {
167
+ navigator.clipboard.writeText(typeof children === 'string' ? children : '');
168
+ onCopy?.();
169
+ }
170
+ },
171
+ 'aria-label': 'Copy text',
172
+ children: ED.createElement('svg', {
173
+ className: 'ed-w-4 ed-h-4',
174
+ fill: 'none', viewBox: '0 0 24 24', stroke: 'currentColor',
175
+ children: ED.createElement('path', { strokeLinecap: 'round', strokeLinejoin: 'round', strokeWidth: 2, d: 'M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z' }),
176
+ }),
177
+ })
178
+ : null;
179
+
180
+ const Tag = customTag || 'span';
181
+
182
+ return ED.createElement(Tag, {
183
+ className: textClasses,
184
+ style: { ...(ellipsis ? { maxWidth: '100%' } : {}), ...style },
185
+ onClick,
186
+ title,
187
+ children: [content, copyButton].filter(Boolean),
188
+ });
189
+ }
190
+
191
+ Text.displayName = 'Text';
192
+
193
+ function Paragraph(props) {
194
+ const {
195
+ children,
196
+ className = '',
197
+ style = {},
198
+ color,
199
+ size,
200
+ weight,
201
+ align,
202
+ truncate = false,
203
+ ellipsis = false,
204
+ strong = false,
205
+ italic = false,
206
+ underline = false,
207
+ mark = false,
208
+ code = false,
209
+ disabled = false,
210
+ type,
211
+ rows,
212
+ expandable = false,
213
+ onExpand,
214
+ copyable = false,
215
+ onCopy,
216
+ editable = false,
217
+ onEdit,
218
+ } = props;
219
+
220
+ const colorClass = type ? (TEXT_COLORS[type] || '') : color ? (TEXT_COLORS[color] || `ed-text-${color}`) : '';
221
+
222
+ const paragraphClasses = [
223
+ 'ed-leading-relaxed ed-mb-4',
224
+ colorClass,
225
+ weight ? `ed-font-${weight}` : strong ? 'ed-font-semibold' : '',
226
+ align ? `ed-text-${align}` : '',
227
+ truncate || ellipsis ? 'ed-truncate' : '',
228
+ italic ? 'ed-italic' : '',
229
+ underline ? 'ed-underline' : '',
230
+ mark ? 'ed-bg-yellow-200 ed-px-1 ed-rounded' : '',
231
+ disabled ? 'ed-text-gray-400' : '',
232
+ rows && !ellipsis ? `ed-line-clamp-${rows}` : '',
233
+ className,
234
+ ].filter(Boolean).join(' ');
235
+
236
+ return ED.createElement('p', {
237
+ className: paragraphClasses,
238
+ style,
239
+ children,
240
+ });
241
+ }
242
+
243
+ Paragraph.displayName = 'Paragraph';
244
+
245
+ function Title(props) {
246
+ const {
247
+ children,
248
+ level = 3,
249
+ className = '',
250
+ style = {},
251
+ color,
252
+ align,
253
+ weight,
254
+ underline = false,
255
+ italic = false,
256
+ truncate = false,
257
+ id,
258
+ } = props;
259
+
260
+ return ED.createElement(Heading, {
261
+ level,
262
+ color,
263
+ align,
264
+ weight,
265
+ underline,
266
+ italic,
267
+ truncate,
268
+ id,
269
+ className,
270
+ style,
271
+ children,
272
+ });
273
+ }
274
+
275
+ Title.displayName = 'Title';
276
+
277
+ function Typography(props) {
278
+ const {
279
+ children,
280
+ className = '',
281
+ style = {},
282
+ } = props;
283
+
284
+ return ED.createElement('div', {
285
+ className: `ed-typography ed-text-gray-900 ${className}`,
286
+ style,
287
+ children,
288
+ });
289
+ }
290
+
291
+ Typography.displayName = 'Typography';
292
+ Typography.Heading = Heading;
293
+ Typography.Text = Text;
294
+ Typography.Paragraph = Paragraph;
295
+ Typography.Title = Title;
296
+ Typography.HEADING_SIZES = HEADING_SIZES;
297
+ Typography.COLORS = TEXT_COLORS;
298
+
299
+ module.exports = Typography;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * ElementDrawing Component Library - Index
3
+ * Exports all UI components
4
+ */
5
+
6
+ const Button = require('./Button');
7
+ const Card = require('./Card');
8
+ const Modal = require('./Modal');
9
+ const Input = require('./Input');
10
+ const Table = require('./Table');
11
+ const Navbar = require('./Navbar');
12
+ const Sidebar = require('./Sidebar');
13
+ const Form = require('./Form');
14
+ const Tabs = require('./Tabs');
15
+ const Accordion = require('./Accordion');
16
+ const Alert = require('./Alert');
17
+ const Avatar = require('./Avatar');
18
+ const Badge = require('./Badge');
19
+ const Breadcrumb = require('./Breadcrumb');
20
+ const Carousel = require('./Carousel');
21
+ const Checkbox = require('./Checkbox');
22
+ const Dialog = require('./Dialog');
23
+ const Drawer = require('./Drawer');
24
+ const Dropdown = require('./Dropdown');
25
+ const Menu = require('./Menu');
26
+ const Pagination = require('./Pagination');
27
+ const Progress = require('./Progress');
28
+ const Radio = require('./Radio');
29
+ const Select = require('./Select');
30
+ const Slider = require('./Slider');
31
+ const Spinner = require('./Spinner');
32
+ const Switch = require('./Switch');
33
+ const Textarea = require('./Textarea');
34
+ const Toast = require('./Toast');
35
+ const Tooltip = require('./Tooltip');
36
+ const Typography = require('./Typography');
37
+
38
+ module.exports = {
39
+ Button,
40
+ Card,
41
+ Modal,
42
+ Input,
43
+ Table,
44
+ Navbar,
45
+ Sidebar,
46
+ Form,
47
+ Tabs,
48
+ Accordion,
49
+ Alert,
50
+ Avatar,
51
+ Badge,
52
+ Breadcrumb,
53
+ Carousel,
54
+ Checkbox,
55
+ Dialog,
56
+ Drawer,
57
+ Dropdown,
58
+ Menu,
59
+ Pagination,
60
+ Progress,
61
+ Radio,
62
+ Select,
63
+ Slider,
64
+ Spinner,
65
+ Switch,
66
+ Textarea,
67
+ Toast,
68
+ Tooltip,
69
+ Typography,
70
+ };
@@ -0,0 +1,3 @@
1
+ export default function element(tag, props = {}, ...children) {
2
+ return { tag, props, children };
3
+ }