@umber-style/is-prop-valid 0.0.0 → 0.2.0-alpha.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.
- package/LICENSE +21 -0
- package/README.md +14 -1
- package/dist/propFilter-7gtWunVf.cjs +44 -0
- package/dist/propFilter-D7iezxJT.mjs +39 -0
- package/dist/react-native.cjs +14 -0
- package/dist/react-native.d.cts +9 -0
- package/dist/react-native.d.mts +9 -0
- package/dist/react-native.mjs +10 -0
- package/dist/react.cjs +17 -0
- package/dist/react.d.cts +10 -0
- package/dist/react.d.mts +10 -0
- package/dist/react.mjs +12 -0
- package/dist/vue.cjs +17 -0
- package/dist/vue.d.cts +10 -0
- package/dist/vue.d.mts +10 -0
- package/dist/vue.mjs +12 -0
- package/dist/webNames-BkPQW6ep.mjs +10 -0
- package/dist/webNames-DrNDfeoX.cjs +15 -0
- package/package.json +78 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 soroush.tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
# @umber-style/is-prop-valid
|
|
2
|
+
|
|
3
|
+
Whether a prop is one that an element takes: the attributes of HTML and SVG under React's names (`/react`) or as Vue writes them (`/vue`), and the props of React Native's built-in components (`/react-native`). Each subpath is one function, `(prop: string) => boolean`.
|
|
4
|
+
|
|
5
|
+
Install: `pnpm add @umber-style/is-prop-valid`.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import isPropValid from '@umber-style/is-prop-valid/react'
|
|
9
|
+
|
|
10
|
+
isPropValid('tabIndex') // true
|
|
11
|
+
isPropValid('variant') // false
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Documentation: [docs](../../docs/README.md), and [Prop filters](../../docs/prop-filters.md) for this package.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// src/propFilter.ts
|
|
2
|
+
/**
|
|
3
|
+
* The answers for the names that `groups` stands for, each true. The groups are separated by a space:
|
|
4
|
+
* `head:a,b` stands for `heada` and `headb`, an empty tail for `head` itself, and a name with no colon
|
|
5
|
+
* for itself. The tails follow the last colon, so a name that holds one is written with a second:
|
|
6
|
+
* `xlink::href,role` stands for `xlink:href` and `xlink:role`.
|
|
7
|
+
*/
|
|
8
|
+
function expandNames(groups) {
|
|
9
|
+
const answers = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const group of groups.split(" ")) {
|
|
11
|
+
const split = group.lastIndexOf(":");
|
|
12
|
+
if (split < 0) answers.set(group, true);
|
|
13
|
+
else {
|
|
14
|
+
const head = group.slice(0, split);
|
|
15
|
+
for (const tail of group.slice(split + 1).split(",")) answers.set(head + tail, true);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return answers;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A predicate that is true for the names `groups` stands for (`expandNames`) and for a name that
|
|
22
|
+
* `prefixed` matches, and false for any other. The groups are expanded at its first call, not when its
|
|
23
|
+
* module is loaded. A name it answers false for is kept with the others, so that it is looked up once
|
|
24
|
+
* the next time; a name that `prefixed` matches is not kept, because those are the names an app makes
|
|
25
|
+
* at run time (`data-row-${id}`), and keeping them would grow the map with every one. The names that
|
|
26
|
+
* are kept come from the code of the components, a set that does not grow while the app runs.
|
|
27
|
+
*/
|
|
28
|
+
function createPropFilter(groups, prefixed) {
|
|
29
|
+
let answers;
|
|
30
|
+
return (prop) => {
|
|
31
|
+
answers ??= expandNames(groups);
|
|
32
|
+
const known = answers.get(prop);
|
|
33
|
+
if (known !== void 0) return known;
|
|
34
|
+
if (prefixed.test(prop)) return true;
|
|
35
|
+
answers.set(prop, false);
|
|
36
|
+
return false;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
Object.defineProperty(exports, "createPropFilter", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function() {
|
|
42
|
+
return createPropFilter;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/propFilter.ts
|
|
2
|
+
/**
|
|
3
|
+
* The answers for the names that `groups` stands for, each true. The groups are separated by a space:
|
|
4
|
+
* `head:a,b` stands for `heada` and `headb`, an empty tail for `head` itself, and a name with no colon
|
|
5
|
+
* for itself. The tails follow the last colon, so a name that holds one is written with a second:
|
|
6
|
+
* `xlink::href,role` stands for `xlink:href` and `xlink:role`.
|
|
7
|
+
*/
|
|
8
|
+
function expandNames(groups) {
|
|
9
|
+
const answers = /* @__PURE__ */ new Map();
|
|
10
|
+
for (const group of groups.split(" ")) {
|
|
11
|
+
const split = group.lastIndexOf(":");
|
|
12
|
+
if (split < 0) answers.set(group, true);
|
|
13
|
+
else {
|
|
14
|
+
const head = group.slice(0, split);
|
|
15
|
+
for (const tail of group.slice(split + 1).split(",")) answers.set(head + tail, true);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return answers;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A predicate that is true for the names `groups` stands for (`expandNames`) and for a name that
|
|
22
|
+
* `prefixed` matches, and false for any other. The groups are expanded at its first call, not when its
|
|
23
|
+
* module is loaded. A name it answers false for is kept with the others, so that it is looked up once
|
|
24
|
+
* the next time; a name that `prefixed` matches is not kept, because those are the names an app makes
|
|
25
|
+
* at run time (`data-row-${id}`), and keeping them would grow the map with every one. The names that
|
|
26
|
+
* are kept come from the code of the components, a set that does not grow while the app runs.
|
|
27
|
+
*/
|
|
28
|
+
function createPropFilter(groups, prefixed) {
|
|
29
|
+
let answers;
|
|
30
|
+
return (prop) => {
|
|
31
|
+
answers ??= expandNames(groups);
|
|
32
|
+
const known = answers.get(prop);
|
|
33
|
+
if (known !== void 0) return known;
|
|
34
|
+
if (prefixed.test(prop)) return true;
|
|
35
|
+
answers.set(prop, false);
|
|
36
|
+
return false;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export { createPropFilter as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
/**
|
|
6
|
+
* Whether `prop` is a prop that one of React Native's built-in components takes (`testID`,
|
|
7
|
+
* `numberOfLines`, `hitSlop`, `source`, `keyboardType`), an `aria-*` or `accessibility*` prop, a
|
|
8
|
+
* handler (`onPress`), or `style`, `children`, `ref` and `key`. False for `as`, `theme` and any
|
|
9
|
+
* other name. A native component that is not built in takes the props it declares, which this does not
|
|
10
|
+
* know.
|
|
11
|
+
*/
|
|
12
|
+
const isPropValid = require("./propFilter-7gtWunVf.cjs").createPropFilter("CellRendererComponent ItemSeparatorComponent ListEmptyComponent ListFooterComponent ListFooterComponentStyle ListHeaderComponent ListHeaderComponentStyle ListItemComponent SectionSeparatorComponent StickyHeaderComponent accessible activeOpacity adjustsFontSizeToFit allow:FontScaling,SwipeDismissal alt always:BounceHorizontal,BounceVertical android:_disableSound,_hyphenationFrequency,_ripple animated animating animationType auto:Capitalize,Complete,Correct,Focus automatically:AdjustContentInsets,AdjustKeyboardInsets,AdjustsScrollIndicatorInsets backdropColor barStyle behavior blockNativeResponder blur:OnSubmit,Radius bounces:,Zoom canCancelContentTouches cancelable capInsets caretHidden centerContent children clear:ButtonMode,TextOnFocus collapsable:,Children color colors columnWrapperStyle content:ContainerStyle,Inset,InsetAdjustmentBehavior,Offset contextMenuHidden crossOrigin cursorColor data:,DetectorType,DetectorTypes debug decelerationRate default:Source,Value delay:HoverIn,HoverOut,LongPress,PressIn,PressOut directionalLockEnabled disable:FullscreenUI,IntervalMomentum,KeyboardShortcuts,ScrollViewPanResponder,Virtualization disabled dynamicTypeRamp editable ellipsizeMode enabled enablesReturnKeyAutomatically endFillColor enterKeyHint experimental:_acceptDragAndDropTypes,_accessibilityOrder,_endDraggingSensitivityMultiplier extraData fadeDuration fadingEdgeLength focusable forwardedRef get:Item,ItemCount,ItemLayout hardwareAccelerated hasTVPreferredFocus height hidden hidesWhenStopped hitSlop horizontal hostRef id image:Ref,Style important:ForAccessibility,ForAutofill indicatorStyle initial:NumToRender,ScrollIndex inline:ImageLeft,ImagePadding innerViewRef input:AccessoryViewButtonLabel,AccessoryViewID,Mode internal_analyticTag invertStickyHeaders inverted ios_backgroundColor key:,Extractor keyboard:Appearance,DismissMode,ShouldPersistTaps,Type,VerticalOffset line:BreakModeIOS,BreakStrategyIOS loadingIndicatorSource maintainVisibleContentPosition max:FontSizeMultiplier,Length,ToRenderPerBatch maximumZoomScale minimum:FontScale,ZoomScale modalRef multiline native:BackgroundAndroid,ForegroundAndroid,ID navigationBarTranslucent needsOffscreenAlphaCompositing nestedScrollEnabled next:FocusDown,FocusForward,FocusLeft,FocusRight,FocusUp numColumns numberOfLines overScrollMode pagingEnabled passwordRules persistentScrollbar pinchGestureEnabled placeholder:,TextColor pointerEvents presentationStyle pressRetentionOffset progress:BackgroundColor,ViewOffset progressiveRenderingEnabled readOnly ref referrerPolicy refreshControl refreshing rejectResponderTermination removeClippedSubviews render:Item,ScrollComponent,SectionFooter,SectionHeader,ToHardwareTextureAndroid resize:Method,Mode,Multiplier return:KeyLabel,KeyType role rows screenReaderFocusable scroll:Enabled,EventThrottle,IndicatorInsets,PerfTag,ToOverflowEnabled,ViewRef scrolls:ChildToFocus,ToTop sections secureTextEntry selectTextOnFocus selectable selection:,Color,HandleColor shouldRasterizeIOS show:HideTransition,SoftInputOnFocus shows:HorizontalScrollIndicator,VerticalScrollIndicator size smartInsertDelete snap:ToAlignment,ToEnd,ToInterval,ToOffsets,ToStart source spellCheck src:,Set statusBarTranslucent sticky:HeaderHiddenOnScroll,HeaderIndices,SectionHeadersEnabled strictMode style submitBehavior supportedOrientations suppressHighlighting tabIndex test:ID,Only_pressed text:Align,AlignVertical,BreakStrategy,ContentType thumb:Color,TintColor tintColor title:,Color touchSoundDisabled trackColor transparent underlayColor underlineColorAndroid unstable_pressDelay updateCellsBatchingPeriod value viewability:Config,ConfigCallbackPairs visible width windowSize zoomScale", /^(?:aria-|accessibility[A-Z]|on[A-Z])/);
|
|
13
|
+
exports.default = isPropValid;
|
|
14
|
+
exports.isPropValid = isPropValid;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `prop` is a prop that one of React Native's built-in components takes (`testID`,
|
|
3
|
+
* `numberOfLines`, `hitSlop`, `source`, `keyboardType`), an `aria-*` or `accessibility*` prop, a
|
|
4
|
+
* handler (`onPress`), or `style`, `children`, `ref` and `key`. False for `as`, `theme` and any
|
|
5
|
+
* other name. A native component that is not built in takes the props it declares, which this does not
|
|
6
|
+
* know.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isPropValid: (prop: string) => boolean;
|
|
9
|
+
export { isPropValid as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `prop` is a prop that one of React Native's built-in components takes (`testID`,
|
|
3
|
+
* `numberOfLines`, `hitSlop`, `source`, `keyboardType`), an `aria-*` or `accessibility*` prop, a
|
|
4
|
+
* handler (`onPress`), or `style`, `children`, `ref` and `key`. False for `as`, `theme` and any
|
|
5
|
+
* other name. A native component that is not built in takes the props it declares, which this does not
|
|
6
|
+
* know.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isPropValid: (prop: string) => boolean;
|
|
9
|
+
export { isPropValid as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { t as createPropFilter } from "./propFilter-D7iezxJT.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Whether `prop` is a prop that one of React Native's built-in components takes (`testID`,
|
|
4
|
+
* `numberOfLines`, `hitSlop`, `source`, `keyboardType`), an `aria-*` or `accessibility*` prop, a
|
|
5
|
+
* handler (`onPress`), or `style`, `children`, `ref` and `key`. False for `as`, `theme` and any
|
|
6
|
+
* other name. A native component that is not built in takes the props it declares, which this does not
|
|
7
|
+
* know.
|
|
8
|
+
*/
|
|
9
|
+
const isPropValid = createPropFilter("CellRendererComponent ItemSeparatorComponent ListEmptyComponent ListFooterComponent ListFooterComponentStyle ListHeaderComponent ListHeaderComponentStyle ListItemComponent SectionSeparatorComponent StickyHeaderComponent accessible activeOpacity adjustsFontSizeToFit allow:FontScaling,SwipeDismissal alt always:BounceHorizontal,BounceVertical android:_disableSound,_hyphenationFrequency,_ripple animated animating animationType auto:Capitalize,Complete,Correct,Focus automatically:AdjustContentInsets,AdjustKeyboardInsets,AdjustsScrollIndicatorInsets backdropColor barStyle behavior blockNativeResponder blur:OnSubmit,Radius bounces:,Zoom canCancelContentTouches cancelable capInsets caretHidden centerContent children clear:ButtonMode,TextOnFocus collapsable:,Children color colors columnWrapperStyle content:ContainerStyle,Inset,InsetAdjustmentBehavior,Offset contextMenuHidden crossOrigin cursorColor data:,DetectorType,DetectorTypes debug decelerationRate default:Source,Value delay:HoverIn,HoverOut,LongPress,PressIn,PressOut directionalLockEnabled disable:FullscreenUI,IntervalMomentum,KeyboardShortcuts,ScrollViewPanResponder,Virtualization disabled dynamicTypeRamp editable ellipsizeMode enabled enablesReturnKeyAutomatically endFillColor enterKeyHint experimental:_acceptDragAndDropTypes,_accessibilityOrder,_endDraggingSensitivityMultiplier extraData fadeDuration fadingEdgeLength focusable forwardedRef get:Item,ItemCount,ItemLayout hardwareAccelerated hasTVPreferredFocus height hidden hidesWhenStopped hitSlop horizontal hostRef id image:Ref,Style important:ForAccessibility,ForAutofill indicatorStyle initial:NumToRender,ScrollIndex inline:ImageLeft,ImagePadding innerViewRef input:AccessoryViewButtonLabel,AccessoryViewID,Mode internal_analyticTag invertStickyHeaders inverted ios_backgroundColor key:,Extractor keyboard:Appearance,DismissMode,ShouldPersistTaps,Type,VerticalOffset line:BreakModeIOS,BreakStrategyIOS loadingIndicatorSource maintainVisibleContentPosition max:FontSizeMultiplier,Length,ToRenderPerBatch maximumZoomScale minimum:FontScale,ZoomScale modalRef multiline native:BackgroundAndroid,ForegroundAndroid,ID navigationBarTranslucent needsOffscreenAlphaCompositing nestedScrollEnabled next:FocusDown,FocusForward,FocusLeft,FocusRight,FocusUp numColumns numberOfLines overScrollMode pagingEnabled passwordRules persistentScrollbar pinchGestureEnabled placeholder:,TextColor pointerEvents presentationStyle pressRetentionOffset progress:BackgroundColor,ViewOffset progressiveRenderingEnabled readOnly ref referrerPolicy refreshControl refreshing rejectResponderTermination removeClippedSubviews render:Item,ScrollComponent,SectionFooter,SectionHeader,ToHardwareTextureAndroid resize:Method,Mode,Multiplier return:KeyLabel,KeyType role rows screenReaderFocusable scroll:Enabled,EventThrottle,IndicatorInsets,PerfTag,ToOverflowEnabled,ViewRef scrolls:ChildToFocus,ToTop sections secureTextEntry selectTextOnFocus selectable selection:,Color,HandleColor shouldRasterizeIOS show:HideTransition,SoftInputOnFocus shows:HorizontalScrollIndicator,VerticalScrollIndicator size smartInsertDelete snap:ToAlignment,ToEnd,ToInterval,ToOffsets,ToStart source spellCheck src:,Set statusBarTranslucent sticky:HeaderHiddenOnScroll,HeaderIndices,SectionHeadersEnabled strictMode style submitBehavior supportedOrientations suppressHighlighting tabIndex test:ID,Only_pressed text:Align,AlignVertical,BreakStrategy,ContentType thumb:Color,TintColor tintColor title:,Color touchSoundDisabled trackColor transparent underlayColor underlineColorAndroid unstable_pressDelay updateCellsBatchingPeriod value viewability:Config,ConfigCallbackPairs visible width windowSize zoomScale", /^(?:aria-|accessibility[A-Z]|on[A-Z])/);
|
|
10
|
+
export { isPropValid as default, isPropValid };
|
package/dist/react.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_propFilter = require("./propFilter-7gtWunVf.cjs");
|
|
6
|
+
const require_webNames = require("./webNames-DrNDfeoX.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Whether `prop` is a prop that React writes to an HTML or SVG element, under the name React gives it:
|
|
9
|
+
* an attribute of HTML or SVG (`tabIndex`, `htmlFor`, `className`, `strokeWidth`), a `data-*`,
|
|
10
|
+
* `aria-*` or `x-*` attribute, an event handler (`onClick`: `on` and any character whose code is
|
|
11
|
+
* below 91, a digit, `-` and `:` included), or a prop of React's own (`children`,
|
|
12
|
+
* `ref`, `key`, `style`, `dangerouslySetInnerHTML`, `defaultValue`). False for `as`, `theme` and
|
|
13
|
+
* any other name.
|
|
14
|
+
*/
|
|
15
|
+
const isPropValid = require_propFilter.createPropFilter(`${require_webNames.WEB_NAMES} accentHeight alignmentBaseline allow:FullScreen,PaymentRequest,Transparency,UserMedia arabicForm auto:Capitalize,Complete,Correct,Play,Save baselineShift capHeight charSet children classID clip:Path,Rule color:Interpolation,InterpolationFilters,Profile,Rendering commandFor contextMenu controlsList dangerouslySetInnerHTML dominantBaseline enableBackground encType exportParts fallback fill:Opacity,Rule flood:Color,Opacity font:Family,Size,SizeAdjust,Stretch,Style,Variant,Weight formEncType glyph:Name,OrientationHorizontal,OrientationVertical horiz:AdvX,OriginX hrefLang image:Rendering,SrcSet incremental item:ID,Prop,Ref,Scope,Type key:Params,Type letterSpacing lightingColor marker:End,Mid,Start maskType mediaGroup on option overline:Position,Thickness paintOrder panose1 pointerEvents popoverTarget precedence profile radioGroup shapeRendering spellCheck src:Doc,Lang,Set stop:Color,Opacity strikethrough:Position,Thickness stroke:Dasharray,Dashoffset,Linecap,Linejoin,Miterlimit,Opacity,Width suppress:ContentEditableWarning,HydrationWarning text:Anchor,Decoration,Rendering transformOrigin underline:Position,Thickness unicode:Bidi,Range unitsPerEm v:Alphabetic,Hanging,Ideographic,Mathematical valueLink vectorEffect vert:AdvY,OriginX,OriginY wordSpacing writingMode xHeight xml:Base,Lang,Space`, /^(?:[Dd][Aa][Tt][Aa]-|[Aa][Rr][Ii][Aa]-|x-|on[^\x5b-\uffff])/);
|
|
16
|
+
exports.default = isPropValid;
|
|
17
|
+
exports.isPropValid = isPropValid;
|
package/dist/react.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `prop` is a prop that React writes to an HTML or SVG element, under the name React gives it:
|
|
3
|
+
* an attribute of HTML or SVG (`tabIndex`, `htmlFor`, `className`, `strokeWidth`), a `data-*`,
|
|
4
|
+
* `aria-*` or `x-*` attribute, an event handler (`onClick`: `on` and any character whose code is
|
|
5
|
+
* below 91, a digit, `-` and `:` included), or a prop of React's own (`children`,
|
|
6
|
+
* `ref`, `key`, `style`, `dangerouslySetInnerHTML`, `defaultValue`). False for `as`, `theme` and
|
|
7
|
+
* any other name.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isPropValid: (prop: string) => boolean;
|
|
10
|
+
export { isPropValid as default };
|
package/dist/react.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `prop` is a prop that React writes to an HTML or SVG element, under the name React gives it:
|
|
3
|
+
* an attribute of HTML or SVG (`tabIndex`, `htmlFor`, `className`, `strokeWidth`), a `data-*`,
|
|
4
|
+
* `aria-*` or `x-*` attribute, an event handler (`onClick`: `on` and any character whose code is
|
|
5
|
+
* below 91, a digit, `-` and `:` included), or a prop of React's own (`children`,
|
|
6
|
+
* `ref`, `key`, `style`, `dangerouslySetInnerHTML`, `defaultValue`). False for `as`, `theme` and
|
|
7
|
+
* any other name.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isPropValid: (prop: string) => boolean;
|
|
10
|
+
export { isPropValid as default };
|
package/dist/react.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { t as createPropFilter } from "./propFilter-D7iezxJT.mjs";
|
|
2
|
+
import { t as WEB_NAMES } from "./webNames-BkPQW6ep.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Whether `prop` is a prop that React writes to an HTML or SVG element, under the name React gives it:
|
|
5
|
+
* an attribute of HTML or SVG (`tabIndex`, `htmlFor`, `className`, `strokeWidth`), a `data-*`,
|
|
6
|
+
* `aria-*` or `x-*` attribute, an event handler (`onClick`: `on` and any character whose code is
|
|
7
|
+
* below 91, a digit, `-` and `:` included), or a prop of React's own (`children`,
|
|
8
|
+
* `ref`, `key`, `style`, `dangerouslySetInnerHTML`, `defaultValue`). False for `as`, `theme` and
|
|
9
|
+
* any other name.
|
|
10
|
+
*/
|
|
11
|
+
const isPropValid = createPropFilter(`${WEB_NAMES} accentHeight alignmentBaseline allow:FullScreen,PaymentRequest,Transparency,UserMedia arabicForm auto:Capitalize,Complete,Correct,Play,Save baselineShift capHeight charSet children classID clip:Path,Rule color:Interpolation,InterpolationFilters,Profile,Rendering commandFor contextMenu controlsList dangerouslySetInnerHTML dominantBaseline enableBackground encType exportParts fallback fill:Opacity,Rule flood:Color,Opacity font:Family,Size,SizeAdjust,Stretch,Style,Variant,Weight formEncType glyph:Name,OrientationHorizontal,OrientationVertical horiz:AdvX,OriginX hrefLang image:Rendering,SrcSet incremental item:ID,Prop,Ref,Scope,Type key:Params,Type letterSpacing lightingColor marker:End,Mid,Start maskType mediaGroup on option overline:Position,Thickness paintOrder panose1 pointerEvents popoverTarget precedence profile radioGroup shapeRendering spellCheck src:Doc,Lang,Set stop:Color,Opacity strikethrough:Position,Thickness stroke:Dasharray,Dashoffset,Linecap,Linejoin,Miterlimit,Opacity,Width suppress:ContentEditableWarning,HydrationWarning text:Anchor,Decoration,Rendering transformOrigin underline:Position,Thickness unicode:Bidi,Range unitsPerEm v:Alphabetic,Hanging,Ideographic,Mathematical valueLink vectorEffect vert:AdvY,OriginX,OriginY wordSpacing writingMode xHeight xml:Base,Lang,Space`, /^(?:[Dd][Aa][Tt][Aa]-|[Aa][Rr][Ii][Aa]-|x-|on[^\x5b-\uffff])/);
|
|
12
|
+
export { isPropValid as default, isPropValid };
|
package/dist/vue.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_propFilter = require("./propFilter-7gtWunVf.cjs");
|
|
6
|
+
const require_webNames = require("./webNames-DrNDfeoX.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Whether `prop` is a prop that Vue writes to an HTML or SVG element, as a template or a render
|
|
9
|
+
* function writes it: an attribute in its HTML form (`tabindex`, `for`, `class`, `readonly`), an
|
|
10
|
+
* SVG attribute in its XML form (`stroke-width`, `viewBox`, `xlink:href`), a DOM property that Vue
|
|
11
|
+
* sets by its name (`tabIndex`, `innerHTML`, `textContent`), a `data-*` or `aria-*` attribute, a
|
|
12
|
+
* listener (`onClick`, `onUpdate:modelValue`), or `class`, `style`, `key`, `ref` and `is`. False
|
|
13
|
+
* for `as`, `theme` and any other name.
|
|
14
|
+
*/
|
|
15
|
+
const isPropValid = require_propFilter.createPropFilter(`${require_webNames.WEB_NAMES} accent-height accept-charset acceptcharset accesskey alignment-baseline allowFullscreen allowfullscreen allowtransparency arabic-form autocapitalize autocomplete autocorrect autoplay autosave baseline-shift bgColor cap-height cellpadding cellspacing charset classid clip:-path,-rule color:-interpolation,-interpolation-filters,-profile,-rendering colspan commandfor contenteditable contextmenu controlslist crossorigin datetime dirname disablepictureinpicture disableremoteplayback dominant-baseline enable-background enctype enterkeyhint fill:-opacity,-rule flood:-color,-opacity font:-family,-size,-size-adjust,-stretch,-style,-variant,-weight formEnctype formaction formenctype formmethod formnovalidate formtarget frameborder glyph:-name,-orientation-horizontal,-orientation-vertical horiz:-adv-x,-origin-x hreflang http-equiv httpequiv image:-rendering,Srcset imagesizes imagesrcset indeterminate innerText inputmode ismap itemid itemprop itemref itemscope itemtype keyparams keytype letter-spacing lighting-color marginheight marginwidth marker:-end,-mid,-start mask-type maxlength mediagroup minlength nomodule novalidate overline:-position,-thickness paint-order panose-1 playsinline pointer-events popovertarget popovertargetaction radiogroup readonly ref:_for,_key referrerpolicy rowspan shadowrootclonable shadowrootdelegatesfocus shadowrootmode shadowrootserializable shape-rendering spellcheck srcdoc srclang srcset stop:-color,-opacity strikethrough:-position,-thickness stroke:-dasharray,-dashoffset,-linecap,-linejoin,-miterlimit,-opacity,-width tabindex text:-anchor,-decoration,-rendering,Content transform-origin underline:-position,-thickness unicode:-bidi,-range units:-per-em,Per-em usemap v:-alphabetic,-hanging,-ideographic,-mathematical,Align vector-effect vert:-adv-y,-origin-x,-origin-y word-spacing writing-mode writingsuggestions x-height xlink::actuate,arcrole,href,role,show,title,type xml::base,lang,space xmlns::xlink`, /^(?:data-|aria-|on[A-Z])/);
|
|
16
|
+
exports.default = isPropValid;
|
|
17
|
+
exports.isPropValid = isPropValid;
|
package/dist/vue.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `prop` is a prop that Vue writes to an HTML or SVG element, as a template or a render
|
|
3
|
+
* function writes it: an attribute in its HTML form (`tabindex`, `for`, `class`, `readonly`), an
|
|
4
|
+
* SVG attribute in its XML form (`stroke-width`, `viewBox`, `xlink:href`), a DOM property that Vue
|
|
5
|
+
* sets by its name (`tabIndex`, `innerHTML`, `textContent`), a `data-*` or `aria-*` attribute, a
|
|
6
|
+
* listener (`onClick`, `onUpdate:modelValue`), or `class`, `style`, `key`, `ref` and `is`. False
|
|
7
|
+
* for `as`, `theme` and any other name.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isPropValid: (prop: string) => boolean;
|
|
10
|
+
export { isPropValid as default };
|
package/dist/vue.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether `prop` is a prop that Vue writes to an HTML or SVG element, as a template or a render
|
|
3
|
+
* function writes it: an attribute in its HTML form (`tabindex`, `for`, `class`, `readonly`), an
|
|
4
|
+
* SVG attribute in its XML form (`stroke-width`, `viewBox`, `xlink:href`), a DOM property that Vue
|
|
5
|
+
* sets by its name (`tabIndex`, `innerHTML`, `textContent`), a `data-*` or `aria-*` attribute, a
|
|
6
|
+
* listener (`onClick`, `onUpdate:modelValue`), or `class`, `style`, `key`, `ref` and `is`. False
|
|
7
|
+
* for `as`, `theme` and any other name.
|
|
8
|
+
*/
|
|
9
|
+
export declare const isPropValid: (prop: string) => boolean;
|
|
10
|
+
export { isPropValid as default };
|
package/dist/vue.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { t as createPropFilter } from "./propFilter-D7iezxJT.mjs";
|
|
2
|
+
import { t as WEB_NAMES } from "./webNames-BkPQW6ep.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Whether `prop` is a prop that Vue writes to an HTML or SVG element, as a template or a render
|
|
5
|
+
* function writes it: an attribute in its HTML form (`tabindex`, `for`, `class`, `readonly`), an
|
|
6
|
+
* SVG attribute in its XML form (`stroke-width`, `viewBox`, `xlink:href`), a DOM property that Vue
|
|
7
|
+
* sets by its name (`tabIndex`, `innerHTML`, `textContent`), a `data-*` or `aria-*` attribute, a
|
|
8
|
+
* listener (`onClick`, `onUpdate:modelValue`), or `class`, `style`, `key`, `ref` and `is`. False
|
|
9
|
+
* for `as`, `theme` and any other name.
|
|
10
|
+
*/
|
|
11
|
+
const isPropValid = createPropFilter(`${WEB_NAMES} accent-height accept-charset acceptcharset accesskey alignment-baseline allowFullscreen allowfullscreen allowtransparency arabic-form autocapitalize autocomplete autocorrect autoplay autosave baseline-shift bgColor cap-height cellpadding cellspacing charset classid clip:-path,-rule color:-interpolation,-interpolation-filters,-profile,-rendering colspan commandfor contenteditable contextmenu controlslist crossorigin datetime dirname disablepictureinpicture disableremoteplayback dominant-baseline enable-background enctype enterkeyhint fill:-opacity,-rule flood:-color,-opacity font:-family,-size,-size-adjust,-stretch,-style,-variant,-weight formEnctype formaction formenctype formmethod formnovalidate formtarget frameborder glyph:-name,-orientation-horizontal,-orientation-vertical horiz:-adv-x,-origin-x hreflang http-equiv httpequiv image:-rendering,Srcset imagesizes imagesrcset indeterminate innerText inputmode ismap itemid itemprop itemref itemscope itemtype keyparams keytype letter-spacing lighting-color marginheight marginwidth marker:-end,-mid,-start mask-type maxlength mediagroup minlength nomodule novalidate overline:-position,-thickness paint-order panose-1 playsinline pointer-events popovertarget popovertargetaction radiogroup readonly ref:_for,_key referrerpolicy rowspan shadowrootclonable shadowrootdelegatesfocus shadowrootmode shadowrootserializable shape-rendering spellcheck srcdoc srclang srcset stop:-color,-opacity strikethrough:-position,-thickness stroke:-dasharray,-dashoffset,-linecap,-linejoin,-miterlimit,-opacity,-width tabindex text:-anchor,-decoration,-rendering,Content transform-origin underline:-position,-thickness unicode:-bidi,-range units:-per-em,Per-em usemap v:-alphabetic,-hanging,-ideographic,-mathematical,Align vector-effect vert:-adv-y,-origin-x,-origin-y word-spacing writing-mode writingsuggestions x-height xlink::actuate,arcrole,href,role,show,title,type xml::base,lang,space xmlns::xlink`, /^(?:data-|aria-|on[A-Z])/);
|
|
12
|
+
export { isPropValid as default, isPropValid };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/webNames.ts
|
|
2
|
+
/**
|
|
3
|
+
* The names that React and Vue both write to an HTML or SVG element under the same spelling: the
|
|
4
|
+
* attributes of one word (`alt`, `href`, `d`, `cx`), the SVG attributes that are camelCase in XML
|
|
5
|
+
* (`viewBox`, `preserveAspectRatio`), the DOM properties that React names as the DOM does (`tabIndex`,
|
|
6
|
+
* `readOnly`, `className`, `htmlFor`), and `key`, `ref`, `style`. Written in groups
|
|
7
|
+
* (`expandNames`).
|
|
8
|
+
*/
|
|
9
|
+
const WEB_NAMES = "abbr about accept:,Charset accessKey accumulate action additive align allow:,Reorder allowpopups alphabetic alt amplitude ascent async attribute:Name,Type auto:Focus,Reverse autofocus autosize azimuth base:Frequency,Profile bbox begin bgcolor bias blinkfeatures blocking border by calcMode capture cell:Padding,Spacing challenge checked cite class:,Name clip:,PathUnits closedBy closedby colSpan color cols command content:,Editable,ScriptType,StyleType controls coords crossOrigin cursor cx cy d data datatype dateTime decelerate decoding default:,Checked,Value defer descent diffuseConstant dir:,Name direction disable:PictureInPicture,RemotePlayback disableblinkfeatures disabled disableguestresize disablewebsecurity display divisor download draggable dur dx dy edgeMode elevation end enterKeyHint exponent exportparts externalResourcesRequired fetchPriority fetchpriority fill filter:,Res,Units focusable for form:,Action,Method,NoValidate,Target format fr frame:,Border from fx fy g:1,2 glyphRef gradient:Transform,Units guestinstance hanging headers height hidden high href htmlFor httpEquiv httpreferrer id ideographic imageSizes in:,2 inert inlist innerHTML inputMode integrity intercept is:,Map k:,1,2,3,4 kernel:Matrix,UnitLength kerning key:,Points,Splines,Times kind label lang lengthAdjust limitingConeAngle list loading local loop low manifest margin:Height,Width marker:Height,Units,Width mask:,ContentUnits,Units mathematical max:,Length media method min:,Length mode multiple muted name no:Module,Validate nodeintegration nonce numOctaves offset opacity open operator optimum order orient orientation origin overflow part partition path:,Length pattern:,ContentUnits,Transform,Units ping placeholder playsInline plugins points:,AtX,AtY,AtZ popover:,TargetAction poster prefix preload preserve:Alpha,AspectRatio primitiveUnits property r radius readOnly ref:,X,Y referrerPolicy rel renderingIntent repeat:Count,Dur required:,Extensions,Features resource restart result results rev reversed role rotate rowSpan rows rules rx ry sandbox scale scope scoped scrolling seamless security seed selected shadow:RootClonable,RootDelegatesFocus,RootMode,RootSerializable shape side size sizes slope slot spacing span specular:Constant,Exponent speed spreadMethod src start:,Offset stdDeviation stemh stemv step stitchTiles string stroke style summary surfaceScale systemLanguage tabIndex tableValues target:,X,Y textLength title to transform translate type typeof u:1,2 unicode unselectable useMap useragent valign value values version view:Box,Target visibility vocab webpreferences width widths wmode wrap writingSuggestions x:,1,2,ChannelSelector xlink:Actuate,Arcrole,Href,Role,Show,Title,Type xmlns:,Xlink y:,1,2,ChannelSelector z zoomAndPan";
|
|
10
|
+
export { WEB_NAMES as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/webNames.ts
|
|
2
|
+
/**
|
|
3
|
+
* The names that React and Vue both write to an HTML or SVG element under the same spelling: the
|
|
4
|
+
* attributes of one word (`alt`, `href`, `d`, `cx`), the SVG attributes that are camelCase in XML
|
|
5
|
+
* (`viewBox`, `preserveAspectRatio`), the DOM properties that React names as the DOM does (`tabIndex`,
|
|
6
|
+
* `readOnly`, `className`, `htmlFor`), and `key`, `ref`, `style`. Written in groups
|
|
7
|
+
* (`expandNames`).
|
|
8
|
+
*/
|
|
9
|
+
const WEB_NAMES = "abbr about accept:,Charset accessKey accumulate action additive align allow:,Reorder allowpopups alphabetic alt amplitude ascent async attribute:Name,Type auto:Focus,Reverse autofocus autosize azimuth base:Frequency,Profile bbox begin bgcolor bias blinkfeatures blocking border by calcMode capture cell:Padding,Spacing challenge checked cite class:,Name clip:,PathUnits closedBy closedby colSpan color cols command content:,Editable,ScriptType,StyleType controls coords crossOrigin cursor cx cy d data datatype dateTime decelerate decoding default:,Checked,Value defer descent diffuseConstant dir:,Name direction disable:PictureInPicture,RemotePlayback disableblinkfeatures disabled disableguestresize disablewebsecurity display divisor download draggable dur dx dy edgeMode elevation end enterKeyHint exponent exportparts externalResourcesRequired fetchPriority fetchpriority fill filter:,Res,Units focusable for form:,Action,Method,NoValidate,Target format fr frame:,Border from fx fy g:1,2 glyphRef gradient:Transform,Units guestinstance hanging headers height hidden high href htmlFor httpEquiv httpreferrer id ideographic imageSizes in:,2 inert inlist innerHTML inputMode integrity intercept is:,Map k:,1,2,3,4 kernel:Matrix,UnitLength kerning key:,Points,Splines,Times kind label lang lengthAdjust limitingConeAngle list loading local loop low manifest margin:Height,Width marker:Height,Units,Width mask:,ContentUnits,Units mathematical max:,Length media method min:,Length mode multiple muted name no:Module,Validate nodeintegration nonce numOctaves offset opacity open operator optimum order orient orientation origin overflow part partition path:,Length pattern:,ContentUnits,Transform,Units ping placeholder playsInline plugins points:,AtX,AtY,AtZ popover:,TargetAction poster prefix preload preserve:Alpha,AspectRatio primitiveUnits property r radius readOnly ref:,X,Y referrerPolicy rel renderingIntent repeat:Count,Dur required:,Extensions,Features resource restart result results rev reversed role rotate rowSpan rows rules rx ry sandbox scale scope scoped scrolling seamless security seed selected shadow:RootClonable,RootDelegatesFocus,RootMode,RootSerializable shape side size sizes slope slot spacing span specular:Constant,Exponent speed spreadMethod src start:,Offset stdDeviation stemh stemv step stitchTiles string stroke style summary surfaceScale systemLanguage tabIndex tableValues target:,X,Y textLength title to transform translate type typeof u:1,2 unicode unselectable useMap useragent valign value values version view:Box,Target visibility vocab webpreferences width widths wmode wrap writingSuggestions x:,1,2,ChannelSelector xlink:Actuate,Arcrole,Href,Role,Show,Title,Type xmlns:,Xlink y:,1,2,ChannelSelector z zoomAndPan";
|
|
10
|
+
Object.defineProperty(exports, "WEB_NAMES", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return WEB_NAMES;
|
|
14
|
+
}
|
|
15
|
+
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,84 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umber-style/is-prop-valid",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.2.0-alpha.0",
|
|
4
|
+
"description": "Whether a prop is one that an element takes: the attributes of HTML and SVG under React's names or Vue's, and the props of React Native's built-in components.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"styling",
|
|
7
|
+
"props",
|
|
8
|
+
"attributes",
|
|
9
|
+
"react",
|
|
10
|
+
"react-native",
|
|
11
|
+
"vue",
|
|
12
|
+
"typescript"
|
|
13
|
+
],
|
|
5
14
|
"license": "MIT",
|
|
15
|
+
"author": "Masoud Soroush <masoud@soroush.tech>",
|
|
16
|
+
"homepage": "https://umber-style.soroush.design",
|
|
6
17
|
"repository": {
|
|
7
18
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/soroush-tech/umber-style.git"
|
|
19
|
+
"url": "git+https://github.com/soroush-tech/umber-style.git",
|
|
20
|
+
"directory": "packages/is-prop-valid"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/soroush-tech/umber-style/issues"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"exports": {
|
|
31
|
+
"./react": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/react.d.mts",
|
|
34
|
+
"default": "./dist/react.mjs"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/react.d.cts",
|
|
38
|
+
"default": "./dist/react.cjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"./vue": {
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./dist/vue.d.mts",
|
|
44
|
+
"default": "./dist/vue.mjs"
|
|
45
|
+
},
|
|
46
|
+
"require": {
|
|
47
|
+
"types": "./dist/vue.d.cts",
|
|
48
|
+
"default": "./dist/vue.cjs"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"./react-native": {
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/react-native.d.mts",
|
|
54
|
+
"default": "./dist/react-native.mjs"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/react-native.d.cts",
|
|
58
|
+
"default": "./dist/react-native.cjs"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/node": "^26.6.6",
|
|
67
|
+
"@types/react": "^19.3.0",
|
|
68
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
69
|
+
"oxlint": "^1.93.0",
|
|
70
|
+
"react-native": "^0.88.1",
|
|
71
|
+
"tsdown": "^0.23.7",
|
|
72
|
+
"typescript": "~7.0.2",
|
|
73
|
+
"vitest": "^5.1.0",
|
|
74
|
+
"vue": "^3.5.45",
|
|
75
|
+
"@umber-style/eslint-config": "0.0.0"
|
|
76
|
+
},
|
|
77
|
+
"scripts": {
|
|
78
|
+
"build": "tsdown",
|
|
79
|
+
"lint": "oxlint --deny-warnings",
|
|
80
|
+
"typecheck": "tsc --noEmit",
|
|
81
|
+
"test": "vitest run",
|
|
82
|
+
"test:coverage": "vitest run --coverage"
|
|
9
83
|
}
|
|
10
|
-
}
|
|
84
|
+
}
|