@meonode/ui 0.1.116 → 0.1.117
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/dist/common.helper.js +1 -1
- package/dist/core.node.d.ts +1 -1
- package/dist/core.node.d.ts.map +1 -1
- package/dist/core.node.js +1 -1
- package/dist/html.node.js +1 -1
- package/dist/node.helper.d.ts +52 -12
- package/dist/node.helper.d.ts.map +1 -1
- package/dist/node.helper.js +102 -15
- package/package.json +1 -1
package/dist/common.helper.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}import{isContextConsumer,isContextProvider,isElement,isForwardRef,isFragment,isLazy,isMemo,isPortal,isProfiler,isReactClassComponent,isStrictMode,isSuspense,isSuspenseList}from"./react-is.helper
|
|
1
|
+
function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}import{isContextConsumer,isContextProvider,isElement,isForwardRef,isFragment,isLazy,isMemo,isPortal,isProfiler,isReactClassComponent,isStrictMode,isSuspense,isSuspenseList}from"./react-is.helper";import cssProperties from"./data/css-properties";/**
|
|
2
2
|
* Retrieves a deeply nested value from an object using a dot-separated string path.
|
|
3
3
|
*
|
|
4
4
|
* This function traverses an object based on the provided path, which is a
|
package/dist/core.node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ElementType, type ReactNode, type ReactElement } from 'react';
|
|
2
|
-
import type { FinalNodeProps, HasRequiredProps, NodeElement, NodeInstance, NodeProps, PropsOf, RawNodeProps, Theme } from './node.type
|
|
2
|
+
import type { FinalNodeProps, HasRequiredProps, NodeElement, NodeInstance, NodeProps, PropsOf, RawNodeProps, Theme } from './node.type';
|
|
3
3
|
import { type Root as ReactDOMRoot } from 'react-dom/client';
|
|
4
4
|
/**
|
|
5
5
|
* Represents a node in a React component tree with theme and styling capabilities.
|
package/dist/core.node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAc,EAAgD,KAAK,WAAW,EAA4B,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAC1J,OAAO,KAAK,EACV,cAAc,EAEd,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,EACN,MAAM,
|
|
1
|
+
{"version":3,"file":"core.node.d.ts","sourceRoot":"","sources":["../src/core.node.ts"],"names":[],"mappings":"AACA,OAAc,EAAgD,KAAK,WAAW,EAA4B,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAA;AAC1J,OAAO,KAAK,EACV,cAAc,EAEd,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,OAAO,EACP,YAAY,EACZ,KAAK,EACN,MAAM,gBAAgB,CAAA;AAGvB,OAAO,EAAc,KAAK,IAAI,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGxE;;;;;;;;GAQG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,WAAW,CAAE,YAAW,YAAY,CAAC,CAAC,CAAC;IACrE,+EAA+E;IACxE,OAAO,EAAE,CAAC,CAAA;IAEjB,kFAAkF;IAC3E,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAK;IAErC,wFAAwF;IACjF,KAAK,EAAE,cAAc,CAAA;IAE5B,0CAA0C;IAC1C,SAAgB,UAAU,UAAO;IAEjC,4CAA4C;IAC5C,OAAO,CA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U,CAAC,KACrD,YAAY,CAAC,CAAC,CAAC,CAKvB"}
|
package/dist/core.node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _excluded=["ref","key","children","nodetheme","theme","props"],_excluded2=["style","theme"],_excluded3=["style"],_excluded4=["style"],_excluded5=["children","key"];function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&{}.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}import React,{Fragment,createElement,isValidElement}from"react";import{isNodeInstance,resolveDefaultStyle,resolveObjWithTheme}from"./node.helper
|
|
1
|
+
"use strict";var _excluded=["ref","key","children","nodetheme","theme","props"],_excluded2=["style","theme"],_excluded3=["style"],_excluded4=["style"],_excluded5=["children","key"];function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&{}.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}import React,{Fragment,createElement,isValidElement}from"react";import{isNodeInstance,resolveDefaultStyle,resolveObjWithTheme}from"./node.helper";import{isForwardRef,isFragment,isMemo,isReactClassComponent,isValidElementType}from"./react-is.helper";import{createRoot}from"react-dom/client";import{getComponentType,getCSSProps,getDOMProps,getElementTypeName}from"./common.helper";/**
|
|
2
2
|
* Represents a node in a React component tree with theme and styling capabilities.
|
|
3
3
|
* This class wraps React elements and handles:
|
|
4
4
|
* - Props processing and normalization
|
package/dist/html.node.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";import{createNode,createChildrenFirstNode}from"./core.node
|
|
1
|
+
"use strict";import{createNode,createChildrenFirstNode}from"./core.node";// Layout components
|
|
2
2
|
/**
|
|
3
3
|
* Represents a div element.
|
|
4
4
|
* @param props Optional properties for the div element.
|
package/dist/node.helper.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
import type { NodeInstance } from './node.type
|
|
2
|
+
import type { NodeInstance } from './node.type';
|
|
3
3
|
/**
|
|
4
4
|
* Type guard to check if an object is a NodeInstance.
|
|
5
5
|
*
|
|
@@ -28,18 +28,58 @@ export declare const resolveObjWithTheme: (obj?: Record<string, any>, theme?: Pa
|
|
|
28
28
|
[key: string]: any;
|
|
29
29
|
}> | undefined) => any;
|
|
30
30
|
/**
|
|
31
|
-
* Resolves default styles
|
|
32
|
-
* This method ensures that certain default styles, such as `minHeight`, `minWidth`,
|
|
33
|
-
* and `flexShrink`, are applied based on the provided style properties.
|
|
31
|
+
* Resolves default CSS styles to fix common flexbox layout issues.
|
|
34
32
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
33
|
+
* PRIMARY PURPOSE: Fix the flexbox scrolling problem
|
|
34
|
+
* ================================================
|
|
35
|
+
*
|
|
36
|
+
* THE PROBLEM:
|
|
37
|
+
* By default, flex items have `min-width: auto` and `min-height: auto`, which means they
|
|
38
|
+
* cannot shrink below their content size. This prevents scrollable containers from working
|
|
39
|
+
* properly when they are flex items.
|
|
40
|
+
*
|
|
41
|
+
* THE SOLUTION:
|
|
42
|
+
* 1. Set `minHeight: 0` and `minWidth: 0` to allow flex items to shrink
|
|
43
|
+
* 2. Control `flexShrink` behavior based on context to prevent unwanted shrinking
|
|
44
|
+
* 3. Respect user's explicit values to avoid overriding intentional styling
|
|
45
|
+
*
|
|
46
|
+
* FLEX SHRINK BEHAVIOR RULES:
|
|
47
|
+
* ===========================
|
|
48
|
+
*
|
|
49
|
+
* For FLEX CONTAINERS:
|
|
50
|
+
* - If overflow is NOT handled AND no wrapping → flexShrink: 0 (prevent shrinking)
|
|
51
|
+
* - If overflow is handled OR wrapping enabled → flexShrink: undefined (allow default)
|
|
52
|
+
*
|
|
53
|
+
* For NON-FLEX CONTAINERS (flex items):
|
|
54
|
+
* - Always → flexShrink: 0 (prevent unwanted shrinking)
|
|
55
|
+
*
|
|
56
|
+
* NESTED SCENARIOS:
|
|
57
|
+
* ================
|
|
58
|
+
* An element can be both a flex container AND a flex item simultaneously.
|
|
59
|
+
* This function handles this correctly by checking if the element itself is a container,
|
|
60
|
+
* not whether it's inside a flex context.
|
|
61
|
+
*
|
|
62
|
+
* EXPLICIT VALUE PRESERVATION:
|
|
63
|
+
* ===========================
|
|
64
|
+
* - If user sets `flexShrink` explicitly → never override
|
|
65
|
+
* - If user sets `flex` shorthand → extract and use the shrink value from it
|
|
66
|
+
* - Otherwise → apply smart defaults based on context
|
|
67
|
+
* @param style The input CSSProperties object to process
|
|
68
|
+
* @returns Processed CSSProperties with resolved defaults
|
|
69
|
+
* @example
|
|
70
|
+
* // Fix scrollable flex item
|
|
71
|
+
* resolveDefaultStyle({
|
|
72
|
+
* overflow: 'auto',
|
|
73
|
+
* height: '200px'
|
|
74
|
+
* })
|
|
75
|
+
* // → { overflow: 'auto', height: '200px', flexShrink: 0, minHeight: 0, minWidth: 0 }
|
|
76
|
+
* @example
|
|
77
|
+
* // Flex container with wrapping (allows shrinking)
|
|
78
|
+
* resolveDefaultStyle({
|
|
79
|
+
* display: 'flex',
|
|
80
|
+
* flexWrap: 'wrap'
|
|
81
|
+
* })
|
|
82
|
+
* // → { display: 'flex', flexWrap: 'wrap', minHeight: 0, minWidth: 0 }
|
|
43
83
|
*/
|
|
44
84
|
export declare const resolveDefaultStyle: (style: CSSProperties) => {
|
|
45
85
|
accentColor?: import("csstype").Property.AccentColor | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.helper.d.ts","sourceRoot":"","sources":["../src/node.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"node.helper.d.ts","sourceRoot":"","sources":["../src/node.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAS,MAAM,gBAAgB,CAAA;AAGzD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,4CAS1B,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB;;sBA+G/B,CAAA;AA+DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiE/B,CAAA"}
|
package/dist/node.helper.js
CHANGED
|
@@ -35,18 +35,105 @@ var e=a[n],f=e;if("function"==typeof e||"object"===_typeof(e)&&null!==e&&!Array.
|
|
|
35
35
|
"object"!==_typeof(e)&&"string"!=typeof e)f=e;else if("string"==typeof e&&e.includes("theme.")){var g=e,h=!1;g=g.replace(/theme\.([a-zA-Z0-9_.-]+)/g,function(a,c){var d=getValueByPath(b,c);return void 0!==d&&null!==d?(h=!0,"object"===_typeof(d)&&!Array.isArray(d)&&"default"in d?d["default"]:d):a}),f=h&&g!==e?g:e}else"object"===_typeof(e)&&null!==e&&(// Recursively process nested objects or arrays
|
|
36
36
|
f=c(e,d));f===e?l&&(k[n]=e):(!l&&(k=_objectSpread({},a),l=!0),k[n]=f)};for(var n in a)m();return k};// Initial call, ensure `obj` could be an array as well
|
|
37
37
|
return c(a,new Set)};/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* -
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
38
|
+
* Parsed flex shorthand components for CSS flex property
|
|
39
|
+
* @interface FlexComponents
|
|
40
|
+
* @property grow - The flex-grow value (how much the item should grow)
|
|
41
|
+
* @property shrink - The flex-shrink value (how much the item should shrink)
|
|
42
|
+
* @property basis - The flex-basis value (initial main size before free space is distributed)
|
|
43
|
+
*//**
|
|
44
|
+
* Parses a CSS flex shorthand property into its individual components.
|
|
45
|
+
*
|
|
46
|
+
* The CSS flex property is a shorthand for flex-grow, flex-shrink, and flex-basis.
|
|
47
|
+
* This parser handles the most common flex shorthand patterns to extract the shrink value
|
|
48
|
+
* when it's explicitly set by the user.
|
|
49
|
+
*
|
|
50
|
+
* Supported patterns:
|
|
51
|
+
* - Keywords: 'none' | 'auto' | 'initial'
|
|
52
|
+
* - Single number: '1' → {grow: 1, shrink: 1, basis: '0%'}
|
|
53
|
+
* - Full shorthand: '1 0 auto' → {grow: 1, shrink: 0, basis: 'auto'}
|
|
54
|
+
* @param flex The CSS flex property value to parse
|
|
55
|
+
* @returns FlexComponents object with parsed values, or null if unparseable
|
|
56
|
+
* @example
|
|
57
|
+
* parseFlexShorthand('none') // → {grow: 0, shrink: 0, basis: 'auto'}
|
|
58
|
+
* parseFlexShorthand('1') // → {grow: 1, shrink: 1, basis: '0%'}
|
|
59
|
+
* parseFlexShorthand('1 0 auto') // → {grow: 1, shrink: 0, basis: 'auto'}
|
|
60
|
+
*/function parseFlexShorthand(a){// Early returns for invalid inputs
|
|
61
|
+
if(null===a||a===void 0)return null;// Handle numeric flex values (e.g., flex: 1)
|
|
62
|
+
if("number"==typeof a)return{grow:a,shrink:1,basis:"0%"};// Only process string values
|
|
63
|
+
if("string"!=typeof a)return null;var b=a.trim().toLowerCase();if(!b)return null;// Handle CSS keyword values
|
|
64
|
+
return"none"===b?{grow:0,shrink:0,basis:"auto"}:"auto"===b?{grow:1,shrink:1,basis:"auto"}:"initial"===b?{grow:0,shrink:1,basis:"auto"}:null}/**
|
|
65
|
+
* Resolves default CSS styles to fix common flexbox layout issues.
|
|
66
|
+
*
|
|
67
|
+
* PRIMARY PURPOSE: Fix the flexbox scrolling problem
|
|
68
|
+
* ================================================
|
|
69
|
+
*
|
|
70
|
+
* THE PROBLEM:
|
|
71
|
+
* By default, flex items have `min-width: auto` and `min-height: auto`, which means they
|
|
72
|
+
* cannot shrink below their content size. This prevents scrollable containers from working
|
|
73
|
+
* properly when they are flex items.
|
|
74
|
+
*
|
|
75
|
+
* THE SOLUTION:
|
|
76
|
+
* 1. Set `minHeight: 0` and `minWidth: 0` to allow flex items to shrink
|
|
77
|
+
* 2. Control `flexShrink` behavior based on context to prevent unwanted shrinking
|
|
78
|
+
* 3. Respect user's explicit values to avoid overriding intentional styling
|
|
79
|
+
*
|
|
80
|
+
* FLEX SHRINK BEHAVIOR RULES:
|
|
81
|
+
* ===========================
|
|
82
|
+
*
|
|
83
|
+
* For FLEX CONTAINERS:
|
|
84
|
+
* - If overflow is NOT handled AND no wrapping → flexShrink: 0 (prevent shrinking)
|
|
85
|
+
* - If overflow is handled OR wrapping enabled → flexShrink: undefined (allow default)
|
|
86
|
+
*
|
|
87
|
+
* For NON-FLEX CONTAINERS (flex items):
|
|
88
|
+
* - Always → flexShrink: 0 (prevent unwanted shrinking)
|
|
89
|
+
*
|
|
90
|
+
* NESTED SCENARIOS:
|
|
91
|
+
* ================
|
|
92
|
+
* An element can be both a flex container AND a flex item simultaneously.
|
|
93
|
+
* This function handles this correctly by checking if the element itself is a container,
|
|
94
|
+
* not whether it's inside a flex context.
|
|
95
|
+
*
|
|
96
|
+
* EXPLICIT VALUE PRESERVATION:
|
|
97
|
+
* ===========================
|
|
98
|
+
* - If user sets `flexShrink` explicitly → never override
|
|
99
|
+
* - If user sets `flex` shorthand → extract and use the shrink value from it
|
|
100
|
+
* - Otherwise → apply smart defaults based on context
|
|
101
|
+
* @param style The input CSSProperties object to process
|
|
102
|
+
* @returns Processed CSSProperties with resolved defaults
|
|
103
|
+
* @example
|
|
104
|
+
* // Fix scrollable flex item
|
|
105
|
+
* resolveDefaultStyle({
|
|
106
|
+
* overflow: 'auto',
|
|
107
|
+
* height: '200px'
|
|
108
|
+
* })
|
|
109
|
+
* // → { overflow: 'auto', height: '200px', flexShrink: 0, minHeight: 0, minWidth: 0 }
|
|
110
|
+
* @example
|
|
111
|
+
* // Flex container with wrapping (allows shrinking)
|
|
112
|
+
* resolveDefaultStyle({
|
|
113
|
+
* display: 'flex',
|
|
114
|
+
* flexWrap: 'wrap'
|
|
115
|
+
* })
|
|
116
|
+
* // → { display: 'flex', flexWrap: 'wrap', minHeight: 0, minWidth: 0 }
|
|
117
|
+
*/export var resolveDefaultStyle=function resolveDefaultStyle(a){var b,c=a.flex,d=_objectWithoutProperties(a,_excluded),e="flex"===d.display||"inline-flex"===d.display,f=!!(d.overflow||d.overflowY||d.overflowX),g=(null===(b=d.flexFlow)||void 0===b?void 0:b.includes("wrap"))||"wrap"===d.flexWrap||"wrap-reverse"===d.flexWrap,h="flexShrink"in a&&a.flexShrink!==void 0,i=c?parseFlexShorthand(c):null,j=void 0;// === STEP 1: EXTRACT FLEX PROPERTY ===
|
|
118
|
+
// Extract flex shorthand to handle it separately from individual flex properties
|
|
119
|
+
// === STEP 2: ANALYZE LAYOUT CONTEXT ===
|
|
120
|
+
// Determine what kind of element we're dealing with
|
|
121
|
+
// Check if overflow is set (any overflow value indicates potential scrolling)
|
|
122
|
+
// Check if flex wrapping is enabled (allows items to wrap to new lines)
|
|
123
|
+
// === STEP 3: CHECK FOR EXPLICIT USER VALUES ===
|
|
124
|
+
// Respect user's explicit flexShrink setting
|
|
125
|
+
// Extract shrink value from flex shorthand if provided
|
|
126
|
+
// === STEP 4: DETERMINE FLEX SHRINK BEHAVIOR ===
|
|
127
|
+
// Only set flexShrink if user hasn't explicitly provided it
|
|
128
|
+
if(!h)// If flex shorthand contains a shrink value, use that
|
|
129
|
+
if(i)j=i.shrink;else// Apply context-based defaults
|
|
130
|
+
if(!e)// NON-FLEX CONTAINER LOGIC:
|
|
131
|
+
// Default flex-shrink to 0 to prevent unwanted shrinking of flex items
|
|
132
|
+
j=0;else// FLEX CONTAINER LOGIC:
|
|
133
|
+
// Only prevent shrinking when container is constrained (no overflow handling, no wrapping)
|
|
134
|
+
if(!f){var k="column"===d.flexDirection||"column-reverse"===d.flexDirection,l="row"===d.flexDirection||"row-reverse"===d.flexDirection||!d.flexDirection;k&&!g?j=0:l&&!g&&(j=0)}// === STEP 5: RETURN RESOLVED STYLES ===
|
|
135
|
+
// Combine all processed styles with essential defaults
|
|
136
|
+
return _objectSpread({flex:c,// Preserve original flex shorthand
|
|
137
|
+
flexShrink:j,// Apply computed or explicit flexShrink
|
|
138
|
+
minHeight:0,// Fix flex item scrolling issues
|
|
139
|
+
minWidth:0},d)};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meonode/ui",
|
|
3
3
|
"description": "A structured approach to component composition, direct CSS-first prop styling, built-in theming, smart prop handling (including raw property pass-through), and dynamic children.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.117",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"types": "./dist/main.d.ts",
|