You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@webflow/data-types

Package Overview
Dependencies
Maintainers
6
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webflow/data-types - npm Package Compare versions

Comparing version
0.0.2
to
0.0.3
+6
-0
CHANGELOG.md
# @webflow/data-types
## 0.0.3
### Patch Changes
- Added support for more prop types
## 0.0.2

@@ -4,0 +10,0 @@

+1
-1

@@ -1,1 +0,1 @@

'use strict';var s=(o=>(o.FEDERATION="FEDERATION",o))(s||{}),a=(o=>(o.React="React",o))(a||{}),u=(n=>(n.Client="Client",n.Server="Server",n))(u||{}),i=(p=>(p.Text="Text",p.Id="Id",p.Link="Link",p.Image="Image",p.Visibility="Visibility",p.Slot="Slot",p))(i||{});var d={Text:e=>({type:"Text",defaultValue:e?.defaultValue}),Id:()=>({type:"Id"}),Link:()=>({type:"Link"}),Image:()=>({type:"Image"}),Visibility:e=>({type:"Visibility",defaultValue:e?.defaultValue}),Slot:()=>({type:"Slot"})},f=Object.values(i).reduce((e,o)=>({...e,[o]:d[o]}),{});var t=class extends Error{constructor(o){super(`Invalid ComponentData: ${o}`),this.name="InvalidComponentDataError";}};function l(e){return typeof e=="string"&&Object.values(i).includes(e)}function y(e,o){if(e!=null){if(typeof e!="string")throw new t(`prop "${o}" defaultValue must be a string for Text type`);return e}}function m(e,o){if(e!=null){if(typeof e!="boolean")throw new t(`prop "${o}" defaultValue must be a boolean for Visibility type`);return e}}function T(e,o,n){if(e!==void 0)throw new t(`prop "${o}" defaultValue is not supported for ${n} type`)}function P(e,o){let n=e.type;switch(n){case "Text":return {type:"Text",defaultValue:y(e.defaultValue,o)};case "Visibility":return {type:"Visibility",defaultValue:m(e.defaultValue,o)};case "Id":case "Link":case "Image":case "Slot":return {type:n,defaultValue:T(e.defaultValue,o,n)};default:let r=n;throw new t(`prop "${o}" has invalid type: ${r}`)}}function c(e){if(!e||typeof e!="object")throw new t("props must be an object");let o={};for(let[n,r]of Object.entries(e)){if(!r||typeof r!="object")throw new t(`prop "${n}" must be an object`);if(!("type"in r))throw new t(`prop "${n}" is missing required field: type`);if(!l(r.type))throw new t(`prop "${n}" has invalid type: ${String(r.type)}`);o[n]=P(r,n);}return o}function w(e){if(!e||typeof e!="object")throw new t("input must be an object");if(!("name"in e))throw new t("missing required field: 'name'");if(typeof e.name!="string")throw new t("'name' must be a string");if(e.name==="")throw new t("'name' cannot be empty");let o={name:e.name};if("description"in e){if(typeof e.description!="string")throw new t("'description' must be a string when provided");o.description=e.description;}if("group"in e){if(typeof e.group!="string")throw new t("'group' must be a string when provided");o.group=e.group;}return "props"in e&&(o.props=c(e.props)),o}exports.Environment=u;exports.Framework=a;exports.ModuleLoader=s;exports.PropType=i;exports.parseComponentData=w;exports.props=f;
'use strict';var s=(o=>(o.FEDERATION="FEDERATION",o))(s||{}),a=(o=>(o.React="React",o))(a||{}),u=(n=>(n.Client="Client",n.Server="Server",n))(u||{}),i=(p=>(p.Id="Id",p.Text="Text",p.TextBlock="TextBlock",p.RichText="RichText",p.Link="Link",p.Image="Image",p.Visibility="Visibility",p.Slot="Slot",p))(i||{});var l={Text:e=>({type:"Text",defaultValue:e?.defaultValue}),Id:()=>({type:"Id"}),Link:()=>({type:"Link"}),Image:()=>({type:"Image"}),Visibility:e=>({type:"Visibility",defaultValue:e?.defaultValue}),Slot:()=>({type:"Slot"}),TextBlock:()=>({type:"TextBlock"}),RichText:()=>({type:"RichText"})},f=Object.values(i).reduce((e,o)=>({...e,[o]:l[o]}),{});var t=class extends Error{constructor(o){super(`Invalid ComponentData: ${o}`),this.name="InvalidComponentDataError";}};function d(e){return typeof e=="string"&&Object.values(i).includes(e)}function y(e,o){if(e!=null){if(typeof e!="string")throw new t(`prop "${o}" defaultValue must be a string for Text type`);return e}}function m(e,o){if(e!=null){if(typeof e!="boolean")throw new t(`prop "${o}" defaultValue must be a boolean for Visibility type`);return e}}function c(e,o,n){if(e!==void 0)throw new t(`prop "${o}" defaultValue is not supported for ${n} type`)}function T(e,o){let n=e.type;switch(n){case "Text":return {type:"Text",defaultValue:y(e.defaultValue,o)};case "Visibility":return {type:"Visibility",defaultValue:m(e.defaultValue,o)};case "Id":case "Link":case "Image":case "Slot":case "TextBlock":case "RichText":return {type:n,defaultValue:c(e.defaultValue,o,n)};default:let r=n;throw new t(`prop "${o}" has invalid type: ${r}`)}}function P(e){if(!e||typeof e!="object")throw new t("props must be an object");let o={};for(let[n,r]of Object.entries(e)){if(!r||typeof r!="object")throw new t(`prop "${n}" must be an object`);if(!("type"in r))throw new t(`prop "${n}" is missing required field: type`);if(!d(r.type))throw new t(`prop "${n}" has invalid type: ${String(r.type)}`);o[n]=T(r,n);}return o}function w(e){if(!e||typeof e!="object")throw new t("options must be an object");let o={};for(let[n,r]of Object.entries(e))if(n==="applyTagSelectors"){if(typeof r!="boolean")throw new t('option "applyTagSelectors" must be a boolean');o.applyTagSelectors=r;}return o}function x(e){if(!e||typeof e!="object")throw new t("input must be an object");if(!("name"in e))throw new t("missing required field: 'name'");if(typeof e.name!="string")throw new t("'name' must be a string");if(e.name==="")throw new t("'name' cannot be empty");let o={name:e.name};if("description"in e){if(typeof e.description!="string")throw new t("'description' must be a string when provided");o.description=e.description;}if("group"in e){if(typeof e.group!="string")throw new t("'group' must be a string when provided");o.group=e.group;}return "props"in e&&(o.props=P(e.props)),"options"in e&&(o.options=w(e.options)),o}exports.Environment=u;exports.Framework=a;exports.ModuleLoader=s;exports.PropType=i;exports.parseComponentData=x;exports.props=f;

@@ -24,4 +24,6 @@ /**

declare enum PropType {
Id = "Id",
Text = "Text",
Id = "Id",
TextBlock = "TextBlock",
RichText = "RichText",
Link = "Link",

@@ -37,2 +39,6 @@ Image = "Image",

declare const props: {
Id: (opts?: undefined) => {
defaultValue?: undefined;
type: PropType.Id;
};
Text: (opts?: {

@@ -44,6 +50,10 @@ defaultValue?: string | undefined;

};
Id: (opts?: undefined) => {
TextBlock: (opts?: undefined) => {
defaultValue?: undefined;
type: PropType.Id;
type: PropType.TextBlock;
};
RichText: (opts?: undefined) => {
defaultValue?: undefined;
type: PropType.RichText;
};
Link: (opts?: undefined) => {

@@ -70,4 +80,6 @@ defaultValue?: undefined;

type PropValues<NodeType = unknown> = {
[PropType.Id]: string;
[PropType.Text]: string;
[PropType.Id]: string;
[PropType.TextBlock]: NodeType;
[PropType.RichText]: NodeType;
[PropType.Link]: {

@@ -87,3 +99,3 @@ href: string;

type PropTypesWithOptionalDefaultValue = PropType.Text | PropType.Visibility;
type PropTypesWithoutDefaultValue = PropType.Id | PropType.Link | PropType.Image | PropType.Slot;
type PropTypesWithoutDefaultValue = PropType.Id | PropType.Link | PropType.Image | PropType.Slot | PropType.TextBlock | PropType.RichText;
type ComponentProp<T extends PropType = PropType, NodeType = unknown> = T extends PropTypesWithRequiredDefaultValue ? {

@@ -110,2 +122,5 @@ defaultValue: PropValues<NodeType>[T];

};
type ComponentOptions = {
applyTagSelectors?: boolean;
};
type ComponentData<P extends {}, NodeType> = {

@@ -116,2 +131,3 @@ name: string;

props?: ComponentProps<P, NodeType>;
options?: ComponentOptions;
};

@@ -158,2 +174,2 @@ type ComponentDefinition<ComponentType, NodeType, Props extends {}> = ComponentData<Props, NodeType> & {

export { type ComponentClientRendererFactory, type ComponentData, type ComponentDefinition, type ComponentProps, type ComponentRendererInterface, type ComponentRendererRuntimeModule, type ComponentRuntimeProps, type ComponentServerRendererFactory, Environment, Framework, ModuleLoader, PropType, type PropValues, parseComponentData, props };
export { type ComponentClientRendererFactory, type ComponentData, type ComponentDefinition, type ComponentOptions, type ComponentProps, type ComponentRendererInterface, type ComponentRendererRuntimeModule, type ComponentRuntimeProps, type ComponentServerRendererFactory, Environment, Framework, ModuleLoader, PropType, type PropValues, parseComponentData, props };

@@ -1,1 +0,1 @@

var s=(o=>(o.FEDERATION="FEDERATION",o))(s||{}),a=(o=>(o.React="React",o))(a||{}),u=(n=>(n.Client="Client",n.Server="Server",n))(u||{}),i=(p=>(p.Text="Text",p.Id="Id",p.Link="Link",p.Image="Image",p.Visibility="Visibility",p.Slot="Slot",p))(i||{});var d={Text:e=>({type:"Text",defaultValue:e?.defaultValue}),Id:()=>({type:"Id"}),Link:()=>({type:"Link"}),Image:()=>({type:"Image"}),Visibility:e=>({type:"Visibility",defaultValue:e?.defaultValue}),Slot:()=>({type:"Slot"})},f=Object.values(i).reduce((e,o)=>({...e,[o]:d[o]}),{});var t=class extends Error{constructor(o){super(`Invalid ComponentData: ${o}`),this.name="InvalidComponentDataError";}};function l(e){return typeof e=="string"&&Object.values(i).includes(e)}function y(e,o){if(e!=null){if(typeof e!="string")throw new t(`prop "${o}" defaultValue must be a string for Text type`);return e}}function m(e,o){if(e!=null){if(typeof e!="boolean")throw new t(`prop "${o}" defaultValue must be a boolean for Visibility type`);return e}}function T(e,o,n){if(e!==void 0)throw new t(`prop "${o}" defaultValue is not supported for ${n} type`)}function P(e,o){let n=e.type;switch(n){case "Text":return {type:"Text",defaultValue:y(e.defaultValue,o)};case "Visibility":return {type:"Visibility",defaultValue:m(e.defaultValue,o)};case "Id":case "Link":case "Image":case "Slot":return {type:n,defaultValue:T(e.defaultValue,o,n)};default:let r=n;throw new t(`prop "${o}" has invalid type: ${r}`)}}function c(e){if(!e||typeof e!="object")throw new t("props must be an object");let o={};for(let[n,r]of Object.entries(e)){if(!r||typeof r!="object")throw new t(`prop "${n}" must be an object`);if(!("type"in r))throw new t(`prop "${n}" is missing required field: type`);if(!l(r.type))throw new t(`prop "${n}" has invalid type: ${String(r.type)}`);o[n]=P(r,n);}return o}function w(e){if(!e||typeof e!="object")throw new t("input must be an object");if(!("name"in e))throw new t("missing required field: 'name'");if(typeof e.name!="string")throw new t("'name' must be a string");if(e.name==="")throw new t("'name' cannot be empty");let o={name:e.name};if("description"in e){if(typeof e.description!="string")throw new t("'description' must be a string when provided");o.description=e.description;}if("group"in e){if(typeof e.group!="string")throw new t("'group' must be a string when provided");o.group=e.group;}return "props"in e&&(o.props=c(e.props)),o}export{u as Environment,a as Framework,s as ModuleLoader,i as PropType,w as parseComponentData,f as props};
var s=(o=>(o.FEDERATION="FEDERATION",o))(s||{}),a=(o=>(o.React="React",o))(a||{}),u=(n=>(n.Client="Client",n.Server="Server",n))(u||{}),i=(p=>(p.Id="Id",p.Text="Text",p.TextBlock="TextBlock",p.RichText="RichText",p.Link="Link",p.Image="Image",p.Visibility="Visibility",p.Slot="Slot",p))(i||{});var l={Text:e=>({type:"Text",defaultValue:e?.defaultValue}),Id:()=>({type:"Id"}),Link:()=>({type:"Link"}),Image:()=>({type:"Image"}),Visibility:e=>({type:"Visibility",defaultValue:e?.defaultValue}),Slot:()=>({type:"Slot"}),TextBlock:()=>({type:"TextBlock"}),RichText:()=>({type:"RichText"})},f=Object.values(i).reduce((e,o)=>({...e,[o]:l[o]}),{});var t=class extends Error{constructor(o){super(`Invalid ComponentData: ${o}`),this.name="InvalidComponentDataError";}};function d(e){return typeof e=="string"&&Object.values(i).includes(e)}function y(e,o){if(e!=null){if(typeof e!="string")throw new t(`prop "${o}" defaultValue must be a string for Text type`);return e}}function m(e,o){if(e!=null){if(typeof e!="boolean")throw new t(`prop "${o}" defaultValue must be a boolean for Visibility type`);return e}}function c(e,o,n){if(e!==void 0)throw new t(`prop "${o}" defaultValue is not supported for ${n} type`)}function T(e,o){let n=e.type;switch(n){case "Text":return {type:"Text",defaultValue:y(e.defaultValue,o)};case "Visibility":return {type:"Visibility",defaultValue:m(e.defaultValue,o)};case "Id":case "Link":case "Image":case "Slot":case "TextBlock":case "RichText":return {type:n,defaultValue:c(e.defaultValue,o,n)};default:let r=n;throw new t(`prop "${o}" has invalid type: ${r}`)}}function P(e){if(!e||typeof e!="object")throw new t("props must be an object");let o={};for(let[n,r]of Object.entries(e)){if(!r||typeof r!="object")throw new t(`prop "${n}" must be an object`);if(!("type"in r))throw new t(`prop "${n}" is missing required field: type`);if(!d(r.type))throw new t(`prop "${n}" has invalid type: ${String(r.type)}`);o[n]=T(r,n);}return o}function w(e){if(!e||typeof e!="object")throw new t("options must be an object");let o={};for(let[n,r]of Object.entries(e))if(n==="applyTagSelectors"){if(typeof r!="boolean")throw new t('option "applyTagSelectors" must be a boolean');o.applyTagSelectors=r;}return o}function x(e){if(!e||typeof e!="object")throw new t("input must be an object");if(!("name"in e))throw new t("missing required field: 'name'");if(typeof e.name!="string")throw new t("'name' must be a string");if(e.name==="")throw new t("'name' cannot be empty");let o={name:e.name};if("description"in e){if(typeof e.description!="string")throw new t("'description' must be a string when provided");o.description=e.description;}if("group"in e){if(typeof e.group!="string")throw new t("'group' must be a string when provided");o.group=e.group;}return "props"in e&&(o.props=P(e.props)),"options"in e&&(o.options=w(e.options)),o}export{u as Environment,a as Framework,s as ModuleLoader,i as PropType,x as parseComponentData,f as props};
{
"name": "@webflow/data-types",
"version": "0.0.2",
"version": "0.0.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "./dist/index.cjs",