@vitus-labs/elements 1.4.2 → 1.4.3-alpha.3

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/lib/index.d.ts CHANGED
@@ -270,195 +270,18 @@ type Props = Partial<{
270
270
  */
271
271
  css: ExtendCss;
272
272
  /**
273
- * An additional prop for extending styling of the **content** wrapper element
274
- *
275
- * #### [A] Template literals
276
- *
277
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
278
- *
279
- * ```jsx
280
- * export default () => (
281
- * <Element
282
- * label="This is an element"
283
- * css={`
284
- * text-color: red;
285
- * `}
286
- * />
287
- * )
288
- * ```
289
- *
290
- * #### [B] String
291
- *
292
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
293
- *
294
- * ```jsx
295
- * export default () => (
296
- * <Element
297
- * label="This is an element"
298
- * css="text-color: red;"
299
- * />
300
- * )
301
- * ```
302
- *
303
- * #### [C] Css Function
304
- *
305
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
306
- *
307
- * ```jsx
308
- * import { css } from 'styled-components'
309
- *
310
- * export default () => (
311
- * <Element
312
- * label="This is an element"
313
- * css={css`
314
- * text-color: red;
315
- * `}
316
- * />
317
- * )
318
- * ```
319
- *
320
- * #### [D] Css Callback
321
- *
322
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
323
- *
324
- * ```jsx
325
- * export default () => (
326
- * <Element
327
- * label="This is an element"
328
- * css={css => css`
329
- * text-color: red;
330
- * `}
331
- * />
332
- * )
333
- * ```
273
+ * An additional prop for extending styling of the **content** wrapper element.
274
+ * Accepts the same formats as `css` — template literal, string, css function, or callback.
334
275
  */
335
276
  contentCss: ExtendCss;
336
277
  /**
337
- * An additional prop for extending styling of the **beforeContent** wrapper element
338
- *
339
- * #### [A] Template literals
340
- *
341
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
342
- *
343
- * ```jsx
344
- * export default () => (
345
- * <Element
346
- * label="This is an element"
347
- * css={`
348
- * text-color: red;
349
- * `}
350
- * />
351
- * )
352
- * ```
353
- *
354
- * #### [B] String
355
- *
356
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
357
- *
358
- * ```jsx
359
- * export default () => (
360
- * <Element
361
- * label="This is an element"
362
- * css="text-color: red;"
363
- * />
364
- * )
365
- * ```
366
- *
367
- * #### [C] Css Function
368
- *
369
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
370
- *
371
- * ```jsx
372
- * import { css } from 'styled-components'
373
- *
374
- * export default () => (
375
- * <Element
376
- * label="This is an element"
377
- * css={css`
378
- * text-color: red;
379
- * `}
380
- * />
381
- * )
382
- * ```
383
- *
384
- * #### [D] Css Callback
385
- *
386
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
387
- *
388
- * ```jsx
389
- * export default () => (
390
- * <Element
391
- * label="This is an element"
392
- * css={css => css`
393
- * text-color: red;
394
- * `}
395
- * />
396
- * )
397
- * ```
278
+ * An additional prop for extending styling of the **beforeContent** wrapper element.
279
+ * Accepts the same formats as `css` — template literal, string, css function, or callback.
398
280
  */
399
281
  beforeContentCss: ExtendCss;
400
282
  /**
401
- * An additional prop for extending styling of the **afterContent** wrapper element
402
- *
403
- * #### [A] Template literals
404
- *
405
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
406
- *
407
- * ```jsx
408
- * export default () => (
409
- * <Element
410
- * label="This is an element"
411
- * css={`
412
- * text-color: red;
413
- * `}
414
- * />
415
- * )
416
- * ```
417
- *
418
- * #### [B] String
419
- *
420
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
421
- *
422
- * ```jsx
423
- * export default () => (
424
- * <Element
425
- * label="This is an element"
426
- * css="text-color: red;"
427
- * />
428
- * )
429
- * ```
430
- *
431
- * #### [C] Css Function
432
- *
433
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
434
- *
435
- * ```jsx
436
- * import { css } from 'styled-components'
437
- *
438
- * export default () => (
439
- * <Element
440
- * label="This is an element"
441
- * css={css`
442
- * text-color: red;
443
- * `}
444
- * />
445
- * )
446
- * ```
447
- *
448
- * #### [D] Css Callback
449
- *
450
- * (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)
451
- *
452
- * ```jsx
453
- * export default () => (
454
- * <Element
455
- * label="This is an element"
456
- * css={css => css`
457
- * text-color: red;
458
- * `}
459
- * />
460
- * )
461
- * ```
283
+ * An additional prop for extending styling of the **afterContent** wrapper element.
284
+ * Accepts the same formats as `css` — template literal, string, css function, or callback.
462
285
  */
463
286
  afterContentCss: ExtendCss;
464
287
  }>;
package/lib/index.js CHANGED
@@ -86,11 +86,22 @@ const StyledComponent = styled$2(component$2)`
86
86
 
87
87
  //#endregion
88
88
  //#region src/helpers/Content/component.tsx
89
- const Component$9 = ({ contentType, tag, parentDirection, direction, alignX, alignY, equalCols, gap, extendCss, ...props }) => {
89
+ /**
90
+ * Memoized content area used inside Element to render one of the three
91
+ * layout slots (before, content, after). Passes alignment, direction,
92
+ * gap, and equalCols styling props to the underlying styled component.
93
+ * Adds a `data-vl-element` attribute in development for debugging.
94
+ *
95
+ * Children are passed as raw content and rendered inside the memo boundary
96
+ * via core `render()` — this lets React.memo skip re-renders when the
97
+ * content reference is stable (common for component-type or string content).
98
+ */
99
+ const Component$9 = ({ contentType, tag, parentDirection, direction, alignX, alignY, equalCols, gap, extendCss, children, ...props }) => {
100
+ const debugProps = IS_DEVELOPMENT ? { "data-vl-element": contentType } : {};
90
101
  return /* @__PURE__ */ jsx(StyledComponent, {
91
102
  as: tag,
92
103
  $contentType: contentType,
93
- $element: {
104
+ $element: useMemo(() => ({
94
105
  contentType,
95
106
  parentDirection,
96
107
  direction,
@@ -99,16 +110,26 @@ const Component$9 = ({ contentType, tag, parentDirection, direction, alignX, ali
99
110
  equalCols,
100
111
  gap,
101
112
  extraStyles: extendCss
102
- },
103
- ...IS_DEVELOPMENT ? { "data-vl-element": contentType } : {},
104
- ...props
113
+ }), [
114
+ contentType,
115
+ parentDirection,
116
+ direction,
117
+ alignX,
118
+ alignY,
119
+ equalCols,
120
+ gap,
121
+ extendCss
122
+ ]),
123
+ ...debugProps,
124
+ ...props,
125
+ children: render(children)
105
126
  });
106
127
  };
107
- var component_default = memo(Component$9);
128
+ var component_default$1 = memo(Component$9);
108
129
 
109
130
  //#endregion
110
131
  //#region src/helpers/Content/index.ts
111
- var Content_default = component_default;
132
+ var Content_default = component_default$1;
112
133
 
113
134
  //#endregion
114
135
  //#region src/helpers/Wrapper/styled.ts
@@ -208,36 +229,52 @@ const Component$8 = forwardRef(({ children, tag, block, extendCss, direction, al
208
229
  ref,
209
230
  as: tag
210
231
  };
211
- if (!(!props.dangerouslySetInnerHTML && isWebFixNeeded(tag)) || false) return /* @__PURE__ */ jsx(styled_default$1, {
232
+ const needsFix = !props.dangerouslySetInnerHTML && isWebFixNeeded(tag);
233
+ const normalElement = useMemo(() => ({
234
+ block,
235
+ direction,
236
+ alignX,
237
+ alignY,
238
+ equalCols,
239
+ extraStyles: extendCss
240
+ }), [
241
+ block,
242
+ direction,
243
+ alignX,
244
+ alignY,
245
+ equalCols,
246
+ extendCss
247
+ ]);
248
+ const parentFixElement = useMemo(() => ({
249
+ parentFix: true,
250
+ block,
251
+ extraStyles: extendCss
252
+ }), [block, extendCss]);
253
+ const childFixElement = useMemo(() => ({
254
+ childFix: true,
255
+ direction,
256
+ alignX,
257
+ alignY,
258
+ equalCols
259
+ }), [
260
+ direction,
261
+ alignX,
262
+ alignY,
263
+ equalCols
264
+ ]);
265
+ if (!needsFix || false) return /* @__PURE__ */ jsx(styled_default$1, {
212
266
  ...COMMON_PROPS,
213
- $element: {
214
- block,
215
- direction,
216
- alignX,
217
- alignY,
218
- equalCols,
219
- extraStyles: extendCss
220
- },
267
+ $element: normalElement,
221
268
  children
222
269
  });
223
270
  const asTag = isInline ? "span" : "div";
224
271
  return /* @__PURE__ */ jsx(styled_default$1, {
225
272
  ...COMMON_PROPS,
226
- $element: {
227
- parentFix: true,
228
- block,
229
- extraStyles: extendCss
230
- },
273
+ $element: parentFixElement,
231
274
  children: /* @__PURE__ */ jsx(styled_default$1, {
232
275
  as: asTag,
233
276
  $childFix: true,
234
- $element: {
235
- childFix: true,
236
- direction,
237
- alignX,
238
- alignY,
239
- equalCols
240
- },
277
+ $element: childFixElement,
241
278
  children
242
279
  })
243
280
  });
@@ -380,7 +417,6 @@ const Component$7 = forwardRef(({ innerRef, tag, label, content, children, befor
380
417
  ...props,
381
418
  ...WRAPPER_PROPS
382
419
  });
383
- const contentRenderOutput = render(CHILDREN);
384
420
  return /* @__PURE__ */ jsxs(Wrapper_default, {
385
421
  ...props,
386
422
  ...WRAPPER_PROPS,
@@ -396,9 +432,9 @@ const Component$7 = forwardRef(({ innerRef, tag, label, content, children, befor
396
432
  alignY: beforeContentAlignY,
397
433
  equalCols,
398
434
  gap,
399
- children: render(beforeContent)
435
+ children: beforeContent
400
436
  }),
401
- isSimpleElement ? contentRenderOutput : /* @__PURE__ */ jsx(Content_default, {
437
+ isSimpleElement ? render(CHILDREN) : /* @__PURE__ */ jsx(Content_default, {
402
438
  tag: SUB_TAG,
403
439
  contentType: "content",
404
440
  parentDirection: wrapperDirection,
@@ -407,7 +443,7 @@ const Component$7 = forwardRef(({ innerRef, tag, label, content, children, befor
407
443
  alignX: contentAlignX,
408
444
  alignY: contentAlignY,
409
445
  equalCols,
410
- children: contentRenderOutput
446
+ children: CHILDREN
411
447
  }),
412
448
  afterContent && /* @__PURE__ */ jsx(Content_default, {
413
449
  tag: SUB_TAG,
@@ -419,7 +455,7 @@ const Component$7 = forwardRef(({ innerRef, tag, label, content, children, befor
419
455
  alignY: afterContentAlignY,
420
456
  equalCols,
421
457
  gap,
422
- children: render(afterContent)
458
+ children: afterContent
423
459
  })
424
460
  ]
425
461
  });
@@ -464,7 +500,12 @@ const withEqualBeforeAfter = (WrappedComponent) => {
464
500
  const beforeEl = el.firstElementChild;
465
501
  const afterEl = el.lastElementChild;
466
502
  if (beforeEl && afterEl && beforeEl !== afterEl) equalize(beforeEl, afterEl, direction === "rows" ? "height" : "width");
467
- });
503
+ }, [
504
+ equalBeforeAfter,
505
+ beforeContent,
506
+ afterContent,
507
+ direction
508
+ ]);
468
509
  return /* @__PURE__ */ jsx(WrappedComponent, {
469
510
  ...rest,
470
511
  afterContent,
@@ -633,12 +674,14 @@ const Component$6 = (props) => {
633
674
  };
634
675
  return renderItems();
635
676
  };
636
- Component$6.isIterator = true;
637
- Component$6.RESERVED_PROPS = RESERVED_PROPS;
677
+ var component_default = Object.assign(memo(Component$6), {
678
+ isIterator: true,
679
+ RESERVED_PROPS
680
+ });
638
681
 
639
682
  //#endregion
640
683
  //#region src/helpers/Iterator/index.ts
641
- var Iterator_default = Component$6;
684
+ var Iterator_default = component_default;
642
685
 
643
686
  //#endregion
644
687
  //#region src/List/component.tsx
@@ -86,11 +86,22 @@ const StyledComponent = styled$2(component$2)`
86
86
 
87
87
  //#endregion
88
88
  //#region src/helpers/Content/component.tsx
89
- const Component$9 = ({ contentType, tag, parentDirection, direction, alignX, alignY, equalCols, gap, extendCss, ...props }) => {
89
+ /**
90
+ * Memoized content area used inside Element to render one of the three
91
+ * layout slots (before, content, after). Passes alignment, direction,
92
+ * gap, and equalCols styling props to the underlying styled component.
93
+ * Adds a `data-vl-element` attribute in development for debugging.
94
+ *
95
+ * Children are passed as raw content and rendered inside the memo boundary
96
+ * via core `render()` — this lets React.memo skip re-renders when the
97
+ * content reference is stable (common for component-type or string content).
98
+ */
99
+ const Component$9 = ({ contentType, tag, parentDirection, direction, alignX, alignY, equalCols, gap, extendCss, children, ...props }) => {
100
+ const debugProps = IS_DEVELOPMENT ? { "data-vl-element": contentType } : {};
90
101
  return /* @__PURE__ */ jsx(StyledComponent, {
91
102
  as: tag,
92
103
  $contentType: contentType,
93
- $element: {
104
+ $element: useMemo(() => ({
94
105
  contentType,
95
106
  parentDirection,
96
107
  direction,
@@ -99,16 +110,26 @@ const Component$9 = ({ contentType, tag, parentDirection, direction, alignX, ali
99
110
  equalCols,
100
111
  gap,
101
112
  extraStyles: extendCss
102
- },
103
- ...IS_DEVELOPMENT ? { "data-vl-element": contentType } : {},
104
- ...props
113
+ }), [
114
+ contentType,
115
+ parentDirection,
116
+ direction,
117
+ alignX,
118
+ alignY,
119
+ equalCols,
120
+ gap,
121
+ extendCss
122
+ ]),
123
+ ...debugProps,
124
+ ...props,
125
+ children: render(children)
105
126
  });
106
127
  };
107
- var component_default = memo(Component$9);
128
+ var component_default$1 = memo(Component$9);
108
129
 
109
130
  //#endregion
110
131
  //#region src/helpers/Content/index.ts
111
- var Content_default = component_default;
132
+ var Content_default = component_default$1;
112
133
 
113
134
  //#endregion
114
135
  //#region src/helpers/Wrapper/styled.ts
@@ -172,19 +193,47 @@ var styled_default$1 = styled$1(component$1)`
172
193
  */
173
194
  const DEV_PROPS = IS_DEVELOPMENT ? { "data-vl-element": "Element" } : {};
174
195
  const Component$8 = forwardRef(({ children, tag, block, extendCss, direction, alignX, alignY, equalCols, isInline, ...props }, ref) => {
175
- return /* @__PURE__ */ jsx(styled_default$1, {
196
+ const COMMON_PROPS = {
176
197
  ...props,
177
198
  ...DEV_PROPS,
178
199
  ref,
179
- as: tag,
180
- $element: {
181
- block,
182
- direction,
183
- alignX,
184
- alignY,
185
- equalCols,
186
- extraStyles: extendCss
187
- },
200
+ as: tag
201
+ };
202
+ const normalElement = useMemo(() => ({
203
+ block,
204
+ direction,
205
+ alignX,
206
+ alignY,
207
+ equalCols,
208
+ extraStyles: extendCss
209
+ }), [
210
+ block,
211
+ direction,
212
+ alignX,
213
+ alignY,
214
+ equalCols,
215
+ extendCss
216
+ ]);
217
+ useMemo(() => ({
218
+ parentFix: true,
219
+ block,
220
+ extraStyles: extendCss
221
+ }), [block, extendCss]);
222
+ useMemo(() => ({
223
+ childFix: true,
224
+ direction,
225
+ alignX,
226
+ alignY,
227
+ equalCols
228
+ }), [
229
+ direction,
230
+ alignX,
231
+ alignY,
232
+ equalCols
233
+ ]);
234
+ return /* @__PURE__ */ jsx(styled_default$1, {
235
+ ...COMMON_PROPS,
236
+ $element: normalElement,
188
237
  children
189
238
  });
190
239
  });
@@ -246,7 +295,6 @@ const Component$7 = forwardRef(({ innerRef, tag, label, content, children, befor
246
295
  alignY: wrapperAlignY,
247
296
  as: void 0
248
297
  };
249
- const contentRenderOutput = render(CHILDREN);
250
298
  return /* @__PURE__ */ jsxs(Wrapper_default, {
251
299
  ...props,
252
300
  ...WRAPPER_PROPS,
@@ -262,9 +310,9 @@ const Component$7 = forwardRef(({ innerRef, tag, label, content, children, befor
262
310
  alignY: beforeContentAlignY,
263
311
  equalCols,
264
312
  gap,
265
- children: render(beforeContent)
313
+ children: beforeContent
266
314
  }),
267
- isSimpleElement ? contentRenderOutput : /* @__PURE__ */ jsx(Content_default, {
315
+ isSimpleElement ? render(CHILDREN) : /* @__PURE__ */ jsx(Content_default, {
268
316
  tag: SUB_TAG,
269
317
  contentType: "content",
270
318
  parentDirection: wrapperDirection,
@@ -273,7 +321,7 @@ const Component$7 = forwardRef(({ innerRef, tag, label, content, children, befor
273
321
  alignX: contentAlignX,
274
322
  alignY: contentAlignY,
275
323
  equalCols,
276
- children: contentRenderOutput
324
+ children: CHILDREN
277
325
  }),
278
326
  afterContent && /* @__PURE__ */ jsx(Content_default, {
279
327
  tag: SUB_TAG,
@@ -285,7 +333,7 @@ const Component$7 = forwardRef(({ innerRef, tag, label, content, children, befor
285
333
  alignY: afterContentAlignY,
286
334
  equalCols,
287
335
  gap,
288
- children: render(afterContent)
336
+ children: afterContent
289
337
  })
290
338
  ]
291
339
  });
@@ -330,7 +378,12 @@ const withEqualBeforeAfter = (WrappedComponent) => {
330
378
  const beforeEl = el.firstElementChild;
331
379
  const afterEl = el.lastElementChild;
332
380
  if (beforeEl && afterEl && beforeEl !== afterEl) equalize(beforeEl, afterEl, direction === "rows" ? "height" : "width");
333
- });
381
+ }, [
382
+ equalBeforeAfter,
383
+ beforeContent,
384
+ afterContent,
385
+ direction
386
+ ]);
334
387
  return /* @__PURE__ */ jsx(WrappedComponent, {
335
388
  ...rest,
336
389
  afterContent,
@@ -499,12 +552,14 @@ const Component$6 = (props) => {
499
552
  };
500
553
  return renderItems();
501
554
  };
502
- Component$6.isIterator = true;
503
- Component$6.RESERVED_PROPS = RESERVED_PROPS;
555
+ var component_default = Object.assign(memo(Component$6), {
556
+ isIterator: true,
557
+ RESERVED_PROPS
558
+ });
504
559
 
505
560
  //#endregion
506
561
  //#region src/helpers/Iterator/index.ts
507
- var Iterator_default = Component$6;
562
+ var Iterator_default = component_default;
508
563
 
509
564
  //#endregion
510
565
  //#region src/List/component.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitus-labs/elements",
3
- "version": "1.4.2",
3
+ "version": "1.4.3-alpha.3+16703b4",
4
4
  "license": "MIT",
5
5
  "author": "Vit Bokisch <vit@bokisch.cz>",
6
6
  "maintainers": [
@@ -9,6 +9,7 @@
9
9
  "type": "module",
10
10
  "sideEffects": false,
11
11
  "exports": {
12
+ "source": "./src/index.ts",
12
13
  "import": "./lib/index.js",
13
14
  "types": "./lib/index.d.ts"
14
15
  },
@@ -57,19 +58,18 @@
57
58
  "@vitus-labs/core": "^1.4.0",
58
59
  "@vitus-labs/unistyle": "^1.4.0",
59
60
  "react": ">= 19",
60
- "react-dom": ">= 19",
61
- "styled-components": ">= 6"
61
+ "react-dom": ">= 19"
62
62
  },
63
63
  "devDependencies": {
64
- "@vitus-labs/core": "1.4.2",
65
- "@vitus-labs/rocketstyle": "1.4.2",
64
+ "@vitus-labs/core": "1.4.3-alpha.3+16703b4",
65
+ "@vitus-labs/rocketstyle": "1.4.3-alpha.3+16703b4",
66
66
  "@vitus-labs/tools-rolldown": "^1.6.0",
67
67
  "@vitus-labs/tools-storybook": "^1.6.0",
68
68
  "@vitus-labs/tools-typescript": "^1.6.0",
69
- "@vitus-labs/unistyle": "1.4.2"
69
+ "@vitus-labs/unistyle": "1.4.3-alpha.3+16703b4"
70
70
  },
71
71
  "dependencies": {
72
72
  "react-is": "^19.2.3"
73
73
  },
74
- "gitHead": "f12f43c61149964ff4f3f4b80cb6f92da2825915"
74
+ "gitHead": "16703b4c8dc0525bd504c531aeb082bf593579cc"
75
75
  }