@contember/react-block-repeater 2.1.0-beta.1 → 2.2.0-alpha.1
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/development/src/components/BlockRepeater.cjs.map +1 -1
- package/dist/development/src/components/BlockRepeater.js.map +1 -1
- package/dist/development/src/components/BlockRepeaterAddItemTrigger.cjs.map +1 -1
- package/dist/development/src/components/BlockRepeaterAddItemTrigger.js.map +1 -1
- package/dist/development/src/contexts.cjs.map +1 -1
- package/dist/development/src/contexts.js.map +1 -1
- package/dist/development/src/hooks/useBlockRepeaterCurrentBlock.cjs.map +1 -1
- package/dist/development/src/hooks/useBlockRepeaterCurrentBlock.js.map +1 -1
- package/dist/development/src/internal/helpers/staticAnalyzer.cjs.map +1 -1
- package/dist/development/src/internal/helpers/staticAnalyzer.js.map +1 -1
- package/dist/production/src/components/BlockRepeater.cjs.map +1 -1
- package/dist/production/src/components/BlockRepeater.js.map +1 -1
- package/dist/production/src/components/BlockRepeaterAddItemTrigger.cjs.map +1 -1
- package/dist/production/src/components/BlockRepeaterAddItemTrigger.js.map +1 -1
- package/dist/production/src/contexts.cjs.map +1 -1
- package/dist/production/src/contexts.js.map +1 -1
- package/dist/production/src/hooks/useBlockRepeaterCurrentBlock.cjs.map +1 -1
- package/dist/production/src/hooks/useBlockRepeaterCurrentBlock.js.map +1 -1
- package/dist/production/src/internal/helpers/staticAnalyzer.cjs.map +1 -1
- package/dist/production/src/internal/helpers/staticAnalyzer.js.map +1 -1
- package/dist/types/components/index.d.ts +3 -3
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/contexts.d.ts +1 -1
- package/dist/types/contexts.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +1 -1
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/useBlockRepeaterCurrentBlock.d.ts +1 -1
- package/dist/types/hooks/useBlockRepeaterCurrentBlock.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/internal/helpers/staticAnalyzer.d.ts +1 -1
- package/dist/types/internal/helpers/staticAnalyzer.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/BlockRepeater.tsx +2 -2
- package/src/components/BlockRepeaterAddItemTrigger.tsx +1 -1
- package/src/components/index.ts +3 -3
- package/src/contexts.ts +1 -1
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useBlockRepeaterCurrentBlock.ts +2 -2
- package/src/index.ts +4 -4
- package/src/internal/helpers/staticAnalyzer.ts +1 -1
- package/src/types/index.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockRepeater.cjs","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeater.tsx"],"sourcesContent":["import { Component, Field, SugaredRelativeSingleField } from '@contember/react-binding'\nimport { Repeater, RepeaterProps } from '@contember/react-repeater'\nimport { useState } from 'react'\nimport { extractBlocks } from '../internal/helpers/staticAnalyzer'\nimport { BlockRepeaterConfigContext } from '../contexts'\n\n/**\n * Props for the {@link BlockRepeater} component.\n */\nexport type BlockRepeaterProps =\n\t& {\n\t\t/**\n\t\t * A field that is used to determine the order of the entities.\n\t\t */\n\t\tsortableBy: RepeaterProps['sortableBy']\n\n\t\t/**\n\t\t * Discrimination field is a field that is used to determine which block should be rendered for a given entity.\n\t\t */\n\t\tdiscriminationField: SugaredRelativeSingleField['field']\n\t}\n\t& RepeaterProps\n\n/**\n * A repeater component that renders different blocks based on the value of a discrimination field.\n * This is headless component that does not impose any UI. Check DefaultBlockRepeater in UI library for a styled version.\n *\n * ## Props {@link BlockRepeaterProps}\n * - field or entities, sortableBy, discriminationField, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeater field=\"blocks\" discriminationField=\"type\" sortableBy=\"order\">\n * <Block name=\"text\" label=\"Text\">\n * <Field field=\"content\" />\n * </Block>\n * <Block name=\"image\" label=\"Image\">\n * <ImageField field=\"image\" />\n * </Block>\n * </BlockRepeater>\n * ```\n */\nexport const BlockRepeater = Component<BlockRepeaterProps>(({ children, ...props }, env) => {\n\tconst [blocks] = useState(() => extractBlocks(children, env))\n\tif (Object.keys(blocks).length === 0) {\n\t\tthrow new Error('BlockRepeater must have at least one Block child')\n\t}\n\treturn (\n\t\t<Repeater {...props} initialEntityCount={0}>\n\t\t\t<BlockRepeaterConfigContext.Provider value={{ discriminatedBy: props.discriminationField, blocks }}>\n\t\t\t\t{children}\n\t\t\t</BlockRepeaterConfigContext.Provider>\n\t\t</Repeater>\n\t)\n}, props => {\n\treturn (\n\t\t<Repeater {...props}>\n\t\t\t{props.children}\n\t\t\t<Field field={props.discriminationField} />\n\t\t</Repeater>\n\t)\n})\n"],"names":["Component","useState","extractBlocks","Repeater","jsxDEV","BlockRepeaterConfigContext","this","Field"],"mappings":";;;;;;;;AA0CO,MAAM,gBAAgBA,aAAAA,UAA8B,CAAC,EAAE,UAAU,GAAG,MAAA,GAAS,QAAQ;AAC3F,QAAM,CAAC,MAAM,IAAIC,MAAAA,SAAS,MAAMC,eAAAA,cAAc,UAAU,GAAG,CAAC;AAC5D,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AACrC,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACnE;AACA,8CACEC,wBAAA,EAAU,GAAG,OAAO,oBAAoB,GACxC,UAAAC,8BAAAA,OAACC,oCAA2B,UAA3B,EAAoC,OAAO,EAAE,iBAAiB,MAAM,qBAAqB,OAAA,GACxF,SAAA,GADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA,EAAA,GAHD,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA;AAEF,GAAG,CAAA,UAAS;AACX,SACCF,8BAAAA,OAACD,cAAAA,UAAA,EAAU,GAAG,OACZ,UAAA;AAAA,IAAA,MAAM;AAAA,IACPC,8BAAAA,OAACG,aAAAA,OAAA,EAAM,OAAO,MAAM,oBAAA,GAApB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAD,MAAyC;AAAA,EAAA,EAAA,GAF1C,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAGA;AAEF,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"BlockRepeater.cjs","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeater.tsx"],"sourcesContent":["import { Component, Field, SugaredRelativeSingleField } from '@contember/react-binding'\nimport { Repeater, RepeaterProps } from '@contember/react-repeater'\nimport { useState } from 'react'\nimport { extractBlocks } from '../internal/helpers/staticAnalyzer.js'\nimport { BlockRepeaterConfigContext } from '../contexts.js'\n\n/**\n * Props for the {@link BlockRepeater} component.\n */\nexport type BlockRepeaterProps =\n\t& {\n\t\t/**\n\t\t * A field that is used to determine the order of the entities.\n\t\t */\n\t\tsortableBy: RepeaterProps['sortableBy']\n\n\t\t/**\n\t\t * Discrimination field is a field that is used to determine which block should be rendered for a given entity.\n\t\t */\n\t\tdiscriminationField: SugaredRelativeSingleField['field']\n\t}\n\t& RepeaterProps\n\n/**\n * A repeater component that renders different blocks based on the value of a discrimination field.\n * This is headless component that does not impose any UI. Check DefaultBlockRepeater in UI library for a styled version.\n *\n * ## Props {@link BlockRepeaterProps}\n * - field or entities, sortableBy, discriminationField, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeater field=\"blocks\" discriminationField=\"type\" sortableBy=\"order\">\n * <Block name=\"text\" label=\"Text\">\n * <Field field=\"content\" />\n * </Block>\n * <Block name=\"image\" label=\"Image\">\n * <ImageField field=\"image\" />\n * </Block>\n * </BlockRepeater>\n * ```\n */\nexport const BlockRepeater = Component<BlockRepeaterProps>(({ children, ...props }, env) => {\n\tconst [blocks] = useState(() => extractBlocks(children, env))\n\tif (Object.keys(blocks).length === 0) {\n\t\tthrow new Error('BlockRepeater must have at least one Block child')\n\t}\n\treturn (\n\t\t<Repeater {...props} initialEntityCount={0}>\n\t\t\t<BlockRepeaterConfigContext.Provider value={{ discriminatedBy: props.discriminationField, blocks }}>\n\t\t\t\t{children}\n\t\t\t</BlockRepeaterConfigContext.Provider>\n\t\t</Repeater>\n\t)\n}, props => {\n\treturn (\n\t\t<Repeater {...props}>\n\t\t\t{props.children}\n\t\t\t<Field field={props.discriminationField} />\n\t\t</Repeater>\n\t)\n})\n"],"names":["Component","useState","extractBlocks","Repeater","jsxDEV","BlockRepeaterConfigContext","this","Field"],"mappings":";;;;;;;;AA0CO,MAAM,gBAAgBA,aAAAA,UAA8B,CAAC,EAAE,UAAU,GAAG,MAAA,GAAS,QAAQ;AAC3F,QAAM,CAAC,MAAM,IAAIC,MAAAA,SAAS,MAAMC,eAAAA,cAAc,UAAU,GAAG,CAAC;AAC5D,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AACrC,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACnE;AACA,8CACEC,wBAAA,EAAU,GAAG,OAAO,oBAAoB,GACxC,UAAAC,8BAAAA,OAACC,oCAA2B,UAA3B,EAAoC,OAAO,EAAE,iBAAiB,MAAM,qBAAqB,OAAA,GACxF,SAAA,GADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAEA,EAAA,GAHD,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA;AAEF,GAAG,CAAA,UAAS;AACX,SACCF,8BAAAA,OAACD,cAAAA,UAAA,EAAU,GAAG,OACZ,UAAA;AAAA,IAAA,MAAM;AAAA,IACPC,8BAAAA,OAACG,aAAAA,OAAA,EAAM,OAAO,MAAM,oBAAA,GAApB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAD,MAAyC;AAAA,EAAA,EAAA,GAF1C,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAGA;AAEF,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockRepeater.js","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeater.tsx"],"sourcesContent":["import { Component, Field, SugaredRelativeSingleField } from '@contember/react-binding'\nimport { Repeater, RepeaterProps } from '@contember/react-repeater'\nimport { useState } from 'react'\nimport { extractBlocks } from '../internal/helpers/staticAnalyzer'\nimport { BlockRepeaterConfigContext } from '../contexts'\n\n/**\n * Props for the {@link BlockRepeater} component.\n */\nexport type BlockRepeaterProps =\n\t& {\n\t\t/**\n\t\t * A field that is used to determine the order of the entities.\n\t\t */\n\t\tsortableBy: RepeaterProps['sortableBy']\n\n\t\t/**\n\t\t * Discrimination field is a field that is used to determine which block should be rendered for a given entity.\n\t\t */\n\t\tdiscriminationField: SugaredRelativeSingleField['field']\n\t}\n\t& RepeaterProps\n\n/**\n * A repeater component that renders different blocks based on the value of a discrimination field.\n * This is headless component that does not impose any UI. Check DefaultBlockRepeater in UI library for a styled version.\n *\n * ## Props {@link BlockRepeaterProps}\n * - field or entities, sortableBy, discriminationField, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeater field=\"blocks\" discriminationField=\"type\" sortableBy=\"order\">\n * <Block name=\"text\" label=\"Text\">\n * <Field field=\"content\" />\n * </Block>\n * <Block name=\"image\" label=\"Image\">\n * <ImageField field=\"image\" />\n * </Block>\n * </BlockRepeater>\n * ```\n */\nexport const BlockRepeater = Component<BlockRepeaterProps>(({ children, ...props }, env) => {\n\tconst [blocks] = useState(() => extractBlocks(children, env))\n\tif (Object.keys(blocks).length === 0) {\n\t\tthrow new Error('BlockRepeater must have at least one Block child')\n\t}\n\treturn (\n\t\t<Repeater {...props} initialEntityCount={0}>\n\t\t\t<BlockRepeaterConfigContext.Provider value={{ discriminatedBy: props.discriminationField, blocks }}>\n\t\t\t\t{children}\n\t\t\t</BlockRepeaterConfigContext.Provider>\n\t\t</Repeater>\n\t)\n}, props => {\n\treturn (\n\t\t<Repeater {...props}>\n\t\t\t{props.children}\n\t\t\t<Field field={props.discriminationField} />\n\t\t</Repeater>\n\t)\n})\n"],"names":["this"],"mappings":";;;;;;AA0CO,MAAM,gBAAgB,UAA8B,CAAC,EAAE,UAAU,GAAG,MAAA,GAAS,QAAQ;AAC3F,QAAM,CAAC,MAAM,IAAI,SAAS,MAAM,cAAc,UAAU,GAAG,CAAC;AAC5D,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AACrC,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACnE;AACA,gCACE,UAAA,EAAU,GAAG,OAAO,oBAAoB,GACxC,UAAA,uBAAC,2BAA2B,UAA3B,EAAoC,OAAO,EAAE,iBAAiB,MAAM,qBAAqB,OAAA,GACxF,SAAA,GADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAAA,GAHD,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA;AAEF,GAAG,CAAA,UAAS;AACX,SACC,uBAAC,UAAA,EAAU,GAAG,OACZ,UAAA;AAAA,IAAA,MAAM;AAAA,IACP,uBAAC,OAAA,EAAM,OAAO,MAAM,oBAAA,GAApB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAAyC;AAAA,EAAA,EAAA,GAF1C,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAGA;AAEF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"BlockRepeater.js","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeater.tsx"],"sourcesContent":["import { Component, Field, SugaredRelativeSingleField } from '@contember/react-binding'\nimport { Repeater, RepeaterProps } from '@contember/react-repeater'\nimport { useState } from 'react'\nimport { extractBlocks } from '../internal/helpers/staticAnalyzer.js'\nimport { BlockRepeaterConfigContext } from '../contexts.js'\n\n/**\n * Props for the {@link BlockRepeater} component.\n */\nexport type BlockRepeaterProps =\n\t& {\n\t\t/**\n\t\t * A field that is used to determine the order of the entities.\n\t\t */\n\t\tsortableBy: RepeaterProps['sortableBy']\n\n\t\t/**\n\t\t * Discrimination field is a field that is used to determine which block should be rendered for a given entity.\n\t\t */\n\t\tdiscriminationField: SugaredRelativeSingleField['field']\n\t}\n\t& RepeaterProps\n\n/**\n * A repeater component that renders different blocks based on the value of a discrimination field.\n * This is headless component that does not impose any UI. Check DefaultBlockRepeater in UI library for a styled version.\n *\n * ## Props {@link BlockRepeaterProps}\n * - field or entities, sortableBy, discriminationField, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeater field=\"blocks\" discriminationField=\"type\" sortableBy=\"order\">\n * <Block name=\"text\" label=\"Text\">\n * <Field field=\"content\" />\n * </Block>\n * <Block name=\"image\" label=\"Image\">\n * <ImageField field=\"image\" />\n * </Block>\n * </BlockRepeater>\n * ```\n */\nexport const BlockRepeater = Component<BlockRepeaterProps>(({ children, ...props }, env) => {\n\tconst [blocks] = useState(() => extractBlocks(children, env))\n\tif (Object.keys(blocks).length === 0) {\n\t\tthrow new Error('BlockRepeater must have at least one Block child')\n\t}\n\treturn (\n\t\t<Repeater {...props} initialEntityCount={0}>\n\t\t\t<BlockRepeaterConfigContext.Provider value={{ discriminatedBy: props.discriminationField, blocks }}>\n\t\t\t\t{children}\n\t\t\t</BlockRepeaterConfigContext.Provider>\n\t\t</Repeater>\n\t)\n}, props => {\n\treturn (\n\t\t<Repeater {...props}>\n\t\t\t{props.children}\n\t\t\t<Field field={props.discriminationField} />\n\t\t</Repeater>\n\t)\n})\n"],"names":["this"],"mappings":";;;;;;AA0CO,MAAM,gBAAgB,UAA8B,CAAC,EAAE,UAAU,GAAG,MAAA,GAAS,QAAQ;AAC3F,QAAM,CAAC,MAAM,IAAI,SAAS,MAAM,cAAc,UAAU,GAAG,CAAC;AAC5D,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AACrC,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACnE;AACA,gCACE,UAAA,EAAU,GAAG,OAAO,oBAAoB,GACxC,UAAA,uBAAC,2BAA2B,UAA3B,EAAoC,OAAO,EAAE,iBAAiB,MAAM,qBAAqB,OAAA,GACxF,SAAA,GADF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA,EAAA,GAHD,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAIA;AAEF,GAAG,CAAA,UAAS;AACX,SACC,uBAAC,UAAA,EAAU,GAAG,OACZ,UAAA;AAAA,IAAA,MAAM;AAAA,IACP,uBAAC,OAAA,EAAM,OAAO,MAAM,oBAAA,GAApB,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAA,MAAyC;AAAA,EAAA,EAAA,GAF1C,QAAA,MAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAGA;AAEF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockRepeaterAddItemTrigger.cjs","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeaterAddItemTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport { useBlockRepeaterConfig } from '../contexts'\nimport React, { ReactElement, useCallback, useMemo } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { RepeaterAddItemIndex, useRepeaterMethods } from '@contember/react-repeater'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>\n\n/**\n * Props for the {@link BlockRepeaterAddItemTrigger} component.\n */\nexport interface BlockRepeaterAddItemTriggerProps {\n\t/**\n\t * The type of the item to add.\n\t */\n\ttype: string\n\n\t/**\n\t * The index at which to add the item.\n\t * Can be one of:\n\t * - number: Adds the item at the specified index.\n\t * - `'first'`: Adds the item at the beginning.\n\t * - undefined or `'last'`: Adds the item at the end.\n\t */\n\tindex?: RepeaterAddItemIndex\n\n\t/**\n\t * A function to preprocess the entity.\n\t */\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler\n\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n}\n\n/**\n * A trigger component for adding item of given type to a block repeater.\n *\n * ## Props {@link BlockRepeaterAddItemTriggerProps}\n * - type, ?index, ?preprocess, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeaterAddItemTrigger type=\"image\" index=\"first\">\n * <button>Add Image</button>\n * </BlockRepeaterAddItemTrigger>\n * ```\n */\nexport const BlockRepeaterAddItemTrigger = ({ preprocess, index, type, ...props }: BlockRepeaterAddItemTriggerProps) => {\n\tconst { discriminatedBy } = useBlockRepeaterConfig()\n\n\tconst { addItem } = useRepeaterMethods()\n\tconst doAddItem = useCallback(() =>\n\t\taddItem(index, (it, options) => {\n\t\t\tit().getField(discriminatedBy).updateValue(type)\n\t\t\tpreprocess?.(it, options)\n\t\t}), [addItem, discriminatedBy, index, preprocess, type])\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn <SlotType onClick={composeEventHandlers(onClick, doAddItem)} {...otherProps} />\n}\n"],"names":["Slot","useBlockRepeaterConfig","useRepeaterMethods","useCallback","jsxDEV","composeEventHandlers","this"],"mappings":";;;;;;;;AAOA,MAAM,WAAWA,UAAAA;AA4CV,MAAM,8BAA8B,CAAC,EAAE,YAAY,OAAO,MAAM,GAAG,YAA8C;AACvH,QAAM,EAAE,gBAAA,IAAoBC,gCAAA;AAE5B,QAAM,EAAE,QAAA,IAAYC,iCAAA;AACpB,QAAM,YAAYC,MAAAA,YAAY,MAC7B,QAAQ,OAAO,CAAC,IAAI,YAAY;AAC/B,OAAA,EAAK,SAAS,eAAe,EAAE,YAAY,IAAI;AAC/C,iBAAa,IAAI,OAAO;AAAA,EACzB,CAAC,GAAG,CAAC,SAAS,iBAAiB,OAAO,YAAY,IAAI,CAAC;AAExD,QAAM,EAAE,SAAS,GAAG,WAAA,IAAe;AAEnC,SAAOC,qCAAC,YAAS,SAASC,UAAAA,qBAAqB,SAAS,SAAS,GAAI,GAAG,cAAjE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAA6E;AACrF;;"}
|
|
1
|
+
{"version":3,"file":"BlockRepeaterAddItemTrigger.cjs","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeaterAddItemTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport { useBlockRepeaterConfig } from '../contexts.js'\nimport React, { ReactElement, useCallback, useMemo } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { RepeaterAddItemIndex, useRepeaterMethods } from '@contember/react-repeater'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>\n\n/**\n * Props for the {@link BlockRepeaterAddItemTrigger} component.\n */\nexport interface BlockRepeaterAddItemTriggerProps {\n\t/**\n\t * The type of the item to add.\n\t */\n\ttype: string\n\n\t/**\n\t * The index at which to add the item.\n\t * Can be one of:\n\t * - number: Adds the item at the specified index.\n\t * - `'first'`: Adds the item at the beginning.\n\t * - undefined or `'last'`: Adds the item at the end.\n\t */\n\tindex?: RepeaterAddItemIndex\n\n\t/**\n\t * A function to preprocess the entity.\n\t */\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler\n\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n}\n\n/**\n * A trigger component for adding item of given type to a block repeater.\n *\n * ## Props {@link BlockRepeaterAddItemTriggerProps}\n * - type, ?index, ?preprocess, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeaterAddItemTrigger type=\"image\" index=\"first\">\n * <button>Add Image</button>\n * </BlockRepeaterAddItemTrigger>\n * ```\n */\nexport const BlockRepeaterAddItemTrigger = ({ preprocess, index, type, ...props }: BlockRepeaterAddItemTriggerProps) => {\n\tconst { discriminatedBy } = useBlockRepeaterConfig()\n\n\tconst { addItem } = useRepeaterMethods()\n\tconst doAddItem = useCallback(() =>\n\t\taddItem(index, (it, options) => {\n\t\t\tit().getField(discriminatedBy).updateValue(type)\n\t\t\tpreprocess?.(it, options)\n\t\t}), [addItem, discriminatedBy, index, preprocess, type])\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn <SlotType onClick={composeEventHandlers(onClick, doAddItem)} {...otherProps} />\n}\n"],"names":["Slot","useBlockRepeaterConfig","useRepeaterMethods","useCallback","jsxDEV","composeEventHandlers","this"],"mappings":";;;;;;;;AAOA,MAAM,WAAWA,UAAAA;AA4CV,MAAM,8BAA8B,CAAC,EAAE,YAAY,OAAO,MAAM,GAAG,YAA8C;AACvH,QAAM,EAAE,gBAAA,IAAoBC,gCAAA;AAE5B,QAAM,EAAE,QAAA,IAAYC,iCAAA;AACpB,QAAM,YAAYC,MAAAA,YAAY,MAC7B,QAAQ,OAAO,CAAC,IAAI,YAAY;AAC/B,OAAA,EAAK,SAAS,eAAe,EAAE,YAAY,IAAI;AAC/C,iBAAa,IAAI,OAAO;AAAA,EACzB,CAAC,GAAG,CAAC,SAAS,iBAAiB,OAAO,YAAY,IAAI,CAAC;AAExD,QAAM,EAAE,SAAS,GAAG,WAAA,IAAe;AAEnC,SAAOC,qCAAC,YAAS,SAASC,UAAAA,qBAAqB,SAAS,SAAS,GAAI,GAAG,cAAjE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAA6E;AACrF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockRepeaterAddItemTrigger.js","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeaterAddItemTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport { useBlockRepeaterConfig } from '../contexts'\nimport React, { ReactElement, useCallback, useMemo } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { RepeaterAddItemIndex, useRepeaterMethods } from '@contember/react-repeater'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>\n\n/**\n * Props for the {@link BlockRepeaterAddItemTrigger} component.\n */\nexport interface BlockRepeaterAddItemTriggerProps {\n\t/**\n\t * The type of the item to add.\n\t */\n\ttype: string\n\n\t/**\n\t * The index at which to add the item.\n\t * Can be one of:\n\t * - number: Adds the item at the specified index.\n\t * - `'first'`: Adds the item at the beginning.\n\t * - undefined or `'last'`: Adds the item at the end.\n\t */\n\tindex?: RepeaterAddItemIndex\n\n\t/**\n\t * A function to preprocess the entity.\n\t */\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler\n\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n}\n\n/**\n * A trigger component for adding item of given type to a block repeater.\n *\n * ## Props {@link BlockRepeaterAddItemTriggerProps}\n * - type, ?index, ?preprocess, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeaterAddItemTrigger type=\"image\" index=\"first\">\n * <button>Add Image</button>\n * </BlockRepeaterAddItemTrigger>\n * ```\n */\nexport const BlockRepeaterAddItemTrigger = ({ preprocess, index, type, ...props }: BlockRepeaterAddItemTriggerProps) => {\n\tconst { discriminatedBy } = useBlockRepeaterConfig()\n\n\tconst { addItem } = useRepeaterMethods()\n\tconst doAddItem = useCallback(() =>\n\t\taddItem(index, (it, options) => {\n\t\t\tit().getField(discriminatedBy).updateValue(type)\n\t\t\tpreprocess?.(it, options)\n\t\t}), [addItem, discriminatedBy, index, preprocess, type])\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn <SlotType onClick={composeEventHandlers(onClick, doAddItem)} {...otherProps} />\n}\n"],"names":["this"],"mappings":";;;;;;AAOA,MAAM,WAAW;AA4CV,MAAM,8BAA8B,CAAC,EAAE,YAAY,OAAO,MAAM,GAAG,YAA8C;AACvH,QAAM,EAAE,gBAAA,IAAoB,uBAAA;AAE5B,QAAM,EAAE,QAAA,IAAY,mBAAA;AACpB,QAAM,YAAY,YAAY,MAC7B,QAAQ,OAAO,CAAC,IAAI,YAAY;AAC/B,OAAA,EAAK,SAAS,eAAe,EAAE,YAAY,IAAI;AAC/C,iBAAa,IAAI,OAAO;AAAA,EACzB,CAAC,GAAG,CAAC,SAAS,iBAAiB,OAAO,YAAY,IAAI,CAAC;AAExD,QAAM,EAAE,SAAS,GAAG,WAAA,IAAe;AAEnC,SAAO,uBAAC,YAAS,SAAS,qBAAqB,SAAS,SAAS,GAAI,GAAG,cAAjE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAA6E;AACrF;"}
|
|
1
|
+
{"version":3,"file":"BlockRepeaterAddItemTrigger.js","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeaterAddItemTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport { useBlockRepeaterConfig } from '../contexts.js'\nimport React, { ReactElement, useCallback, useMemo } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { RepeaterAddItemIndex, useRepeaterMethods } from '@contember/react-repeater'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>\n\n/**\n * Props for the {@link BlockRepeaterAddItemTrigger} component.\n */\nexport interface BlockRepeaterAddItemTriggerProps {\n\t/**\n\t * The type of the item to add.\n\t */\n\ttype: string\n\n\t/**\n\t * The index at which to add the item.\n\t * Can be one of:\n\t * - number: Adds the item at the specified index.\n\t * - `'first'`: Adds the item at the beginning.\n\t * - undefined or `'last'`: Adds the item at the end.\n\t */\n\tindex?: RepeaterAddItemIndex\n\n\t/**\n\t * A function to preprocess the entity.\n\t */\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler\n\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n}\n\n/**\n * A trigger component for adding item of given type to a block repeater.\n *\n * ## Props {@link BlockRepeaterAddItemTriggerProps}\n * - type, ?index, ?preprocess, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeaterAddItemTrigger type=\"image\" index=\"first\">\n * <button>Add Image</button>\n * </BlockRepeaterAddItemTrigger>\n * ```\n */\nexport const BlockRepeaterAddItemTrigger = ({ preprocess, index, type, ...props }: BlockRepeaterAddItemTriggerProps) => {\n\tconst { discriminatedBy } = useBlockRepeaterConfig()\n\n\tconst { addItem } = useRepeaterMethods()\n\tconst doAddItem = useCallback(() =>\n\t\taddItem(index, (it, options) => {\n\t\t\tit().getField(discriminatedBy).updateValue(type)\n\t\t\tpreprocess?.(it, options)\n\t\t}), [addItem, discriminatedBy, index, preprocess, type])\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn <SlotType onClick={composeEventHandlers(onClick, doAddItem)} {...otherProps} />\n}\n"],"names":["this"],"mappings":";;;;;;AAOA,MAAM,WAAW;AA4CV,MAAM,8BAA8B,CAAC,EAAE,YAAY,OAAO,MAAM,GAAG,YAA8C;AACvH,QAAM,EAAE,gBAAA,IAAoB,uBAAA;AAE5B,QAAM,EAAE,QAAA,IAAY,mBAAA;AACpB,QAAM,YAAY,YAAY,MAC7B,QAAQ,OAAO,CAAC,IAAI,YAAY;AAC/B,OAAA,EAAK,SAAS,eAAe,EAAE,YAAY,IAAI;AAC/C,iBAAa,IAAI,OAAO;AAAA,EACzB,CAAC,GAAG,CAAC,SAAS,iBAAiB,OAAO,YAAY,IAAI,CAAC;AAExD,QAAM,EAAE,SAAS,GAAG,WAAA,IAAe;AAEnC,SAAO,uBAAC,YAAS,SAAS,qBAAqB,SAAS,SAAS,GAAI,GAAG,cAAjE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAA6E;AACrF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.cjs","sources":["../../../../packages/react-block-repeater/src/contexts.ts"],"sourcesContent":["import { SugaredRelativeSingleField } from '@contember/react-binding'\nimport { createRequiredContext } from '@contember/react-utils'\nimport { BlocksMap } from './types'\n\nconst BlockRepeaterConfigContext_ = createRequiredContext<{\n\tdiscriminatedBy: SugaredRelativeSingleField['field']\n\tblocks: BlocksMap\n}>('BlockRepeaterConfigContext')\n/** @internal */\nexport const BlockRepeaterConfigContext = BlockRepeaterConfigContext_[0]\n\n/**\n * Returns configuration of the block repeater (discrimination field and blocks map).\n */\nexport const useBlockRepeaterConfig = BlockRepeaterConfigContext_[1]\n"],"names":["createRequiredContext"],"mappings":";;;AAIA,MAAM,8BAA8BA,WAAAA,sBAGjC,4BAA4B;AAExB,MAAM,6BAA6B,4BAA4B,CAAC;AAKhE,MAAM,yBAAyB,4BAA4B,CAAC;;;"}
|
|
1
|
+
{"version":3,"file":"contexts.cjs","sources":["../../../../packages/react-block-repeater/src/contexts.ts"],"sourcesContent":["import { SugaredRelativeSingleField } from '@contember/react-binding'\nimport { createRequiredContext } from '@contember/react-utils'\nimport { BlocksMap } from './types/index.js'\n\nconst BlockRepeaterConfigContext_ = createRequiredContext<{\n\tdiscriminatedBy: SugaredRelativeSingleField['field']\n\tblocks: BlocksMap\n}>('BlockRepeaterConfigContext')\n/** @internal */\nexport const BlockRepeaterConfigContext = BlockRepeaterConfigContext_[0]\n\n/**\n * Returns configuration of the block repeater (discrimination field and blocks map).\n */\nexport const useBlockRepeaterConfig = BlockRepeaterConfigContext_[1]\n"],"names":["createRequiredContext"],"mappings":";;;AAIA,MAAM,8BAA8BA,WAAAA,sBAGjC,4BAA4B;AAExB,MAAM,6BAA6B,4BAA4B,CAAC;AAKhE,MAAM,yBAAyB,4BAA4B,CAAC;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.js","sources":["../../../../packages/react-block-repeater/src/contexts.ts"],"sourcesContent":["import { SugaredRelativeSingleField } from '@contember/react-binding'\nimport { createRequiredContext } from '@contember/react-utils'\nimport { BlocksMap } from './types'\n\nconst BlockRepeaterConfigContext_ = createRequiredContext<{\n\tdiscriminatedBy: SugaredRelativeSingleField['field']\n\tblocks: BlocksMap\n}>('BlockRepeaterConfigContext')\n/** @internal */\nexport const BlockRepeaterConfigContext = BlockRepeaterConfigContext_[0]\n\n/**\n * Returns configuration of the block repeater (discrimination field and blocks map).\n */\nexport const useBlockRepeaterConfig = BlockRepeaterConfigContext_[1]\n"],"names":[],"mappings":";AAIA,MAAM,8BAA8B,sBAGjC,4BAA4B;AAExB,MAAM,6BAA6B,4BAA4B,CAAC;AAKhE,MAAM,yBAAyB,4BAA4B,CAAC;"}
|
|
1
|
+
{"version":3,"file":"contexts.js","sources":["../../../../packages/react-block-repeater/src/contexts.ts"],"sourcesContent":["import { SugaredRelativeSingleField } from '@contember/react-binding'\nimport { createRequiredContext } from '@contember/react-utils'\nimport { BlocksMap } from './types/index.js'\n\nconst BlockRepeaterConfigContext_ = createRequiredContext<{\n\tdiscriminatedBy: SugaredRelativeSingleField['field']\n\tblocks: BlocksMap\n}>('BlockRepeaterConfigContext')\n/** @internal */\nexport const BlockRepeaterConfigContext = BlockRepeaterConfigContext_[0]\n\n/**\n * Returns configuration of the block repeater (discrimination field and blocks map).\n */\nexport const useBlockRepeaterConfig = BlockRepeaterConfigContext_[1]\n"],"names":[],"mappings":";AAIA,MAAM,8BAA8B,sBAGjC,4BAA4B;AAExB,MAAM,6BAA6B,4BAA4B,CAAC;AAKhE,MAAM,yBAAyB,4BAA4B,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBlockRepeaterCurrentBlock.cjs","sources":["../../../../../packages/react-block-repeater/src/hooks/useBlockRepeaterCurrentBlock.ts"],"sourcesContent":["import { useEntity } from '@contember/react-binding'\nimport { useBlockRepeaterConfig } from '../contexts'\nimport { BlockProps } from '../components'\n\n/**\n * Returns the current block props (see {@link BlockProps}).\n */\nexport const useBlockRepeaterCurrentBlock = (): BlockProps | undefined => {\n\tconst entity = useEntity()\n\tconst { discriminatedBy, blocks } = useBlockRepeaterConfig()\n\tconst field = entity.getField<string>(discriminatedBy).value\n\treturn field ? blocks[field] : undefined\n}\n"],"names":["useEntity","useBlockRepeaterConfig"],"mappings":";;;;AAOO,MAAM,+BAA+B,MAA8B;AACzE,QAAM,SAASA,aAAAA,UAAA;AACf,QAAM,EAAE,iBAAiB,OAAA,IAAWC,gCAAA;AACpC,QAAM,QAAQ,OAAO,SAAiB,eAAe,EAAE;AACvD,SAAO,QAAQ,OAAO,KAAK,IAAI;AAChC;;"}
|
|
1
|
+
{"version":3,"file":"useBlockRepeaterCurrentBlock.cjs","sources":["../../../../../packages/react-block-repeater/src/hooks/useBlockRepeaterCurrentBlock.ts"],"sourcesContent":["import { useEntity } from '@contember/react-binding'\nimport { useBlockRepeaterConfig } from '../contexts.js'\nimport { BlockProps } from '../components/index.js'\n\n/**\n * Returns the current block props (see {@link BlockProps}).\n */\nexport const useBlockRepeaterCurrentBlock = (): BlockProps | undefined => {\n\tconst entity = useEntity()\n\tconst { discriminatedBy, blocks } = useBlockRepeaterConfig()\n\tconst field = entity.getField<string>(discriminatedBy).value\n\treturn field ? blocks[field] : undefined\n}\n"],"names":["useEntity","useBlockRepeaterConfig"],"mappings":";;;;AAOO,MAAM,+BAA+B,MAA8B;AACzE,QAAM,SAASA,aAAAA,UAAA;AACf,QAAM,EAAE,iBAAiB,OAAA,IAAWC,gCAAA;AACpC,QAAM,QAAQ,OAAO,SAAiB,eAAe,EAAE;AACvD,SAAO,QAAQ,OAAO,KAAK,IAAI;AAChC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBlockRepeaterCurrentBlock.js","sources":["../../../../../packages/react-block-repeater/src/hooks/useBlockRepeaterCurrentBlock.ts"],"sourcesContent":["import { useEntity } from '@contember/react-binding'\nimport { useBlockRepeaterConfig } from '../contexts'\nimport { BlockProps } from '../components'\n\n/**\n * Returns the current block props (see {@link BlockProps}).\n */\nexport const useBlockRepeaterCurrentBlock = (): BlockProps | undefined => {\n\tconst entity = useEntity()\n\tconst { discriminatedBy, blocks } = useBlockRepeaterConfig()\n\tconst field = entity.getField<string>(discriminatedBy).value\n\treturn field ? blocks[field] : undefined\n}\n"],"names":[],"mappings":";;AAOO,MAAM,+BAA+B,MAA8B;AACzE,QAAM,SAAS,UAAA;AACf,QAAM,EAAE,iBAAiB,OAAA,IAAW,uBAAA;AACpC,QAAM,QAAQ,OAAO,SAAiB,eAAe,EAAE;AACvD,SAAO,QAAQ,OAAO,KAAK,IAAI;AAChC;"}
|
|
1
|
+
{"version":3,"file":"useBlockRepeaterCurrentBlock.js","sources":["../../../../../packages/react-block-repeater/src/hooks/useBlockRepeaterCurrentBlock.ts"],"sourcesContent":["import { useEntity } from '@contember/react-binding'\nimport { useBlockRepeaterConfig } from '../contexts.js'\nimport { BlockProps } from '../components/index.js'\n\n/**\n * Returns the current block props (see {@link BlockProps}).\n */\nexport const useBlockRepeaterCurrentBlock = (): BlockProps | undefined => {\n\tconst entity = useEntity()\n\tconst { discriminatedBy, blocks } = useBlockRepeaterConfig()\n\tconst field = entity.getField<string>(discriminatedBy).value\n\treturn field ? blocks[field] : undefined\n}\n"],"names":[],"mappings":";;AAOO,MAAM,+BAA+B,MAA8B;AACzE,QAAM,SAAS,UAAA;AACf,QAAM,EAAE,iBAAiB,OAAA,IAAW,uBAAA;AACpC,QAAM,QAAQ,OAAO,SAAiB,eAAe,EAAE;AACvD,SAAO,QAAQ,OAAO,KAAK,IAAI;AAChC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticAnalyzer.cjs","sources":["../../../../../../packages/react-block-repeater/src/internal/helpers/staticAnalyzer.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { Block, BlockProps } from '../../components'\nimport { Environment } from '@contember/react-binding'\nimport { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'\n\ntype BlocksMap = Record<string, BlockProps>\nexport const extractBlocks = (children: ReactNode, env: Environment): BlocksMap => {\n\tconst blocks = blockAnalyzer.processChildren(children, env)\n\treturn Object.fromEntries(blocks.map(block => [block.name, block]))\n}\n\nconst columnLeaf = new Leaf(node => node.props, Block)\n\nconst blockAnalyzer = new ChildrenAnalyzer<\n\tBlockProps,\n\tnever,\n\tEnvironment\n>([columnLeaf], {\n\tstaticRenderFactoryName: 'staticRender',\n\tstaticContextFactoryName: 'generateEnvironment',\n\tunhandledNodeErrorMessage: 'Only Block children are supported.',\n})\n"],"names":["Leaf","Block","ChildrenAnalyzer"],"mappings":";;;;AAMO,MAAM,gBAAgB,CAAC,UAAqB,QAAgC;AAClF,QAAM,SAAS,cAAc,gBAAgB,UAAU,GAAG;AAC1D,SAAO,OAAO,YAAY,OAAO,IAAI,CAAA,UAAS,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC;AACnE;AAEA,MAAM,aAAa,IAAIA,wBAAAA,KAAK,CAAA,SAAQ,KAAK,OAAOC,WAAK;AAErD,MAAM,gBAAgB,IAAIC,wBAAAA,iBAIxB,CAAC,UAAU,GAAG;AAAA,EACf,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAC5B,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"staticAnalyzer.cjs","sources":["../../../../../../packages/react-block-repeater/src/internal/helpers/staticAnalyzer.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { Block, BlockProps } from '../../components/index.js'\nimport { Environment } from '@contember/react-binding'\nimport { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'\n\ntype BlocksMap = Record<string, BlockProps>\nexport const extractBlocks = (children: ReactNode, env: Environment): BlocksMap => {\n\tconst blocks = blockAnalyzer.processChildren(children, env)\n\treturn Object.fromEntries(blocks.map(block => [block.name, block]))\n}\n\nconst columnLeaf = new Leaf(node => node.props, Block)\n\nconst blockAnalyzer = new ChildrenAnalyzer<\n\tBlockProps,\n\tnever,\n\tEnvironment\n>([columnLeaf], {\n\tstaticRenderFactoryName: 'staticRender',\n\tstaticContextFactoryName: 'generateEnvironment',\n\tunhandledNodeErrorMessage: 'Only Block children are supported.',\n})\n"],"names":["Leaf","Block","ChildrenAnalyzer"],"mappings":";;;;AAMO,MAAM,gBAAgB,CAAC,UAAqB,QAAgC;AAClF,QAAM,SAAS,cAAc,gBAAgB,UAAU,GAAG;AAC1D,SAAO,OAAO,YAAY,OAAO,IAAI,CAAA,UAAS,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC;AACnE;AAEA,MAAM,aAAa,IAAIA,wBAAAA,KAAK,CAAA,SAAQ,KAAK,OAAOC,WAAK;AAErD,MAAM,gBAAgB,IAAIC,wBAAAA,iBAIxB,CAAC,UAAU,GAAG;AAAA,EACf,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAC5B,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticAnalyzer.js","sources":["../../../../../../packages/react-block-repeater/src/internal/helpers/staticAnalyzer.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { Block, BlockProps } from '../../components'\nimport { Environment } from '@contember/react-binding'\nimport { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'\n\ntype BlocksMap = Record<string, BlockProps>\nexport const extractBlocks = (children: ReactNode, env: Environment): BlocksMap => {\n\tconst blocks = blockAnalyzer.processChildren(children, env)\n\treturn Object.fromEntries(blocks.map(block => [block.name, block]))\n}\n\nconst columnLeaf = new Leaf(node => node.props, Block)\n\nconst blockAnalyzer = new ChildrenAnalyzer<\n\tBlockProps,\n\tnever,\n\tEnvironment\n>([columnLeaf], {\n\tstaticRenderFactoryName: 'staticRender',\n\tstaticContextFactoryName: 'generateEnvironment',\n\tunhandledNodeErrorMessage: 'Only Block children are supported.',\n})\n"],"names":[],"mappings":";;AAMO,MAAM,gBAAgB,CAAC,UAAqB,QAAgC;AAClF,QAAM,SAAS,cAAc,gBAAgB,UAAU,GAAG;AAC1D,SAAO,OAAO,YAAY,OAAO,IAAI,CAAA,UAAS,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC;AACnE;AAEA,MAAM,aAAa,IAAI,KAAK,CAAA,SAAQ,KAAK,OAAO,KAAK;AAErD,MAAM,gBAAgB,IAAI,iBAIxB,CAAC,UAAU,GAAG;AAAA,EACf,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAC5B,CAAC;"}
|
|
1
|
+
{"version":3,"file":"staticAnalyzer.js","sources":["../../../../../../packages/react-block-repeater/src/internal/helpers/staticAnalyzer.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { Block, BlockProps } from '../../components/index.js'\nimport { Environment } from '@contember/react-binding'\nimport { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'\n\ntype BlocksMap = Record<string, BlockProps>\nexport const extractBlocks = (children: ReactNode, env: Environment): BlocksMap => {\n\tconst blocks = blockAnalyzer.processChildren(children, env)\n\treturn Object.fromEntries(blocks.map(block => [block.name, block]))\n}\n\nconst columnLeaf = new Leaf(node => node.props, Block)\n\nconst blockAnalyzer = new ChildrenAnalyzer<\n\tBlockProps,\n\tnever,\n\tEnvironment\n>([columnLeaf], {\n\tstaticRenderFactoryName: 'staticRender',\n\tstaticContextFactoryName: 'generateEnvironment',\n\tunhandledNodeErrorMessage: 'Only Block children are supported.',\n})\n"],"names":[],"mappings":";;AAMO,MAAM,gBAAgB,CAAC,UAAqB,QAAgC;AAClF,QAAM,SAAS,cAAc,gBAAgB,UAAU,GAAG;AAC1D,SAAO,OAAO,YAAY,OAAO,IAAI,CAAA,UAAS,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC;AACnE;AAEA,MAAM,aAAa,IAAI,KAAK,CAAA,SAAQ,KAAK,OAAO,KAAK;AAErD,MAAM,gBAAgB,IAAI,iBAIxB,CAAC,UAAU,GAAG;AAAA,EACf,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAC5B,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockRepeater.cjs","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeater.tsx"],"sourcesContent":["import { Component, Field, SugaredRelativeSingleField } from '@contember/react-binding'\nimport { Repeater, RepeaterProps } from '@contember/react-repeater'\nimport { useState } from 'react'\nimport { extractBlocks } from '../internal/helpers/staticAnalyzer'\nimport { BlockRepeaterConfigContext } from '../contexts'\n\n/**\n * Props for the {@link BlockRepeater} component.\n */\nexport type BlockRepeaterProps =\n\t& {\n\t\t/**\n\t\t * A field that is used to determine the order of the entities.\n\t\t */\n\t\tsortableBy: RepeaterProps['sortableBy']\n\n\t\t/**\n\t\t * Discrimination field is a field that is used to determine which block should be rendered for a given entity.\n\t\t */\n\t\tdiscriminationField: SugaredRelativeSingleField['field']\n\t}\n\t& RepeaterProps\n\n/**\n * A repeater component that renders different blocks based on the value of a discrimination field.\n * This is headless component that does not impose any UI. Check DefaultBlockRepeater in UI library for a styled version.\n *\n * ## Props {@link BlockRepeaterProps}\n * - field or entities, sortableBy, discriminationField, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeater field=\"blocks\" discriminationField=\"type\" sortableBy=\"order\">\n * <Block name=\"text\" label=\"Text\">\n * <Field field=\"content\" />\n * </Block>\n * <Block name=\"image\" label=\"Image\">\n * <ImageField field=\"image\" />\n * </Block>\n * </BlockRepeater>\n * ```\n */\nexport const BlockRepeater = Component<BlockRepeaterProps>(({ children, ...props }, env) => {\n\tconst [blocks] = useState(() => extractBlocks(children, env))\n\tif (Object.keys(blocks).length === 0) {\n\t\tthrow new Error('BlockRepeater must have at least one Block child')\n\t}\n\treturn (\n\t\t<Repeater {...props} initialEntityCount={0}>\n\t\t\t<BlockRepeaterConfigContext.Provider value={{ discriminatedBy: props.discriminationField, blocks }}>\n\t\t\t\t{children}\n\t\t\t</BlockRepeaterConfigContext.Provider>\n\t\t</Repeater>\n\t)\n}, props => {\n\treturn (\n\t\t<Repeater {...props}>\n\t\t\t{props.children}\n\t\t\t<Field field={props.discriminationField} />\n\t\t</Repeater>\n\t)\n})\n"],"names":["Component","useState","extractBlocks","Repeater","BlockRepeaterConfigContext","jsxs","jsx","Field"],"mappings":";;;;;;;;AA0CO,MAAM,gBAAgBA,aAAAA,UAA8B,CAAC,EAAE,UAAU,GAAG,MAAA,GAAS,QAAQ;AAC3F,QAAM,CAAC,MAAM,IAAIC,MAAAA,SAAS,MAAMC,eAAAA,cAAc,UAAU,GAAG,CAAC;AAC5D,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AACrC,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACnE;AACA,wCACEC,cAAAA,UAAA,EAAU,GAAG,OAAO,oBAAoB,GACxC,yCAACC,SAAAA,2BAA2B,UAA3B,EAAoC,OAAO,EAAE,iBAAiB,MAAM,qBAAqB,OAAA,GACxF,UACF,GACD;AAEF,GAAG,CAAA,UAAS;AACX,SACCC,2BAAAA,KAACF,cAAAA,UAAA,EAAU,GAAG,OACZ,UAAA;AAAA,IAAA,MAAM;AAAA,IACPG,2BAAAA,IAACC,aAAAA,OAAA,EAAM,OAAO,MAAM,oBAAA,CAAqB;AAAA,EAAA,GAC1C;AAEF,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"BlockRepeater.cjs","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeater.tsx"],"sourcesContent":["import { Component, Field, SugaredRelativeSingleField } from '@contember/react-binding'\nimport { Repeater, RepeaterProps } from '@contember/react-repeater'\nimport { useState } from 'react'\nimport { extractBlocks } from '../internal/helpers/staticAnalyzer.js'\nimport { BlockRepeaterConfigContext } from '../contexts.js'\n\n/**\n * Props for the {@link BlockRepeater} component.\n */\nexport type BlockRepeaterProps =\n\t& {\n\t\t/**\n\t\t * A field that is used to determine the order of the entities.\n\t\t */\n\t\tsortableBy: RepeaterProps['sortableBy']\n\n\t\t/**\n\t\t * Discrimination field is a field that is used to determine which block should be rendered for a given entity.\n\t\t */\n\t\tdiscriminationField: SugaredRelativeSingleField['field']\n\t}\n\t& RepeaterProps\n\n/**\n * A repeater component that renders different blocks based on the value of a discrimination field.\n * This is headless component that does not impose any UI. Check DefaultBlockRepeater in UI library for a styled version.\n *\n * ## Props {@link BlockRepeaterProps}\n * - field or entities, sortableBy, discriminationField, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeater field=\"blocks\" discriminationField=\"type\" sortableBy=\"order\">\n * <Block name=\"text\" label=\"Text\">\n * <Field field=\"content\" />\n * </Block>\n * <Block name=\"image\" label=\"Image\">\n * <ImageField field=\"image\" />\n * </Block>\n * </BlockRepeater>\n * ```\n */\nexport const BlockRepeater = Component<BlockRepeaterProps>(({ children, ...props }, env) => {\n\tconst [blocks] = useState(() => extractBlocks(children, env))\n\tif (Object.keys(blocks).length === 0) {\n\t\tthrow new Error('BlockRepeater must have at least one Block child')\n\t}\n\treturn (\n\t\t<Repeater {...props} initialEntityCount={0}>\n\t\t\t<BlockRepeaterConfigContext.Provider value={{ discriminatedBy: props.discriminationField, blocks }}>\n\t\t\t\t{children}\n\t\t\t</BlockRepeaterConfigContext.Provider>\n\t\t</Repeater>\n\t)\n}, props => {\n\treturn (\n\t\t<Repeater {...props}>\n\t\t\t{props.children}\n\t\t\t<Field field={props.discriminationField} />\n\t\t</Repeater>\n\t)\n})\n"],"names":["Component","useState","extractBlocks","Repeater","BlockRepeaterConfigContext","jsxs","jsx","Field"],"mappings":";;;;;;;;AA0CO,MAAM,gBAAgBA,aAAAA,UAA8B,CAAC,EAAE,UAAU,GAAG,MAAA,GAAS,QAAQ;AAC3F,QAAM,CAAC,MAAM,IAAIC,MAAAA,SAAS,MAAMC,eAAAA,cAAc,UAAU,GAAG,CAAC;AAC5D,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AACrC,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACnE;AACA,wCACEC,cAAAA,UAAA,EAAU,GAAG,OAAO,oBAAoB,GACxC,yCAACC,SAAAA,2BAA2B,UAA3B,EAAoC,OAAO,EAAE,iBAAiB,MAAM,qBAAqB,OAAA,GACxF,UACF,GACD;AAEF,GAAG,CAAA,UAAS;AACX,SACCC,2BAAAA,KAACF,cAAAA,UAAA,EAAU,GAAG,OACZ,UAAA;AAAA,IAAA,MAAM;AAAA,IACPG,2BAAAA,IAACC,aAAAA,OAAA,EAAM,OAAO,MAAM,oBAAA,CAAqB;AAAA,EAAA,GAC1C;AAEF,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockRepeater.js","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeater.tsx"],"sourcesContent":["import { Component, Field, SugaredRelativeSingleField } from '@contember/react-binding'\nimport { Repeater, RepeaterProps } from '@contember/react-repeater'\nimport { useState } from 'react'\nimport { extractBlocks } from '../internal/helpers/staticAnalyzer'\nimport { BlockRepeaterConfigContext } from '../contexts'\n\n/**\n * Props for the {@link BlockRepeater} component.\n */\nexport type BlockRepeaterProps =\n\t& {\n\t\t/**\n\t\t * A field that is used to determine the order of the entities.\n\t\t */\n\t\tsortableBy: RepeaterProps['sortableBy']\n\n\t\t/**\n\t\t * Discrimination field is a field that is used to determine which block should be rendered for a given entity.\n\t\t */\n\t\tdiscriminationField: SugaredRelativeSingleField['field']\n\t}\n\t& RepeaterProps\n\n/**\n * A repeater component that renders different blocks based on the value of a discrimination field.\n * This is headless component that does not impose any UI. Check DefaultBlockRepeater in UI library for a styled version.\n *\n * ## Props {@link BlockRepeaterProps}\n * - field or entities, sortableBy, discriminationField, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeater field=\"blocks\" discriminationField=\"type\" sortableBy=\"order\">\n * <Block name=\"text\" label=\"Text\">\n * <Field field=\"content\" />\n * </Block>\n * <Block name=\"image\" label=\"Image\">\n * <ImageField field=\"image\" />\n * </Block>\n * </BlockRepeater>\n * ```\n */\nexport const BlockRepeater = Component<BlockRepeaterProps>(({ children, ...props }, env) => {\n\tconst [blocks] = useState(() => extractBlocks(children, env))\n\tif (Object.keys(blocks).length === 0) {\n\t\tthrow new Error('BlockRepeater must have at least one Block child')\n\t}\n\treturn (\n\t\t<Repeater {...props} initialEntityCount={0}>\n\t\t\t<BlockRepeaterConfigContext.Provider value={{ discriminatedBy: props.discriminationField, blocks }}>\n\t\t\t\t{children}\n\t\t\t</BlockRepeaterConfigContext.Provider>\n\t\t</Repeater>\n\t)\n}, props => {\n\treturn (\n\t\t<Repeater {...props}>\n\t\t\t{props.children}\n\t\t\t<Field field={props.discriminationField} />\n\t\t</Repeater>\n\t)\n})\n"],"names":[],"mappings":";;;;;;AA0CO,MAAM,gBAAgB,UAA8B,CAAC,EAAE,UAAU,GAAG,MAAA,GAAS,QAAQ;AAC3F,QAAM,CAAC,MAAM,IAAI,SAAS,MAAM,cAAc,UAAU,GAAG,CAAC;AAC5D,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AACrC,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACnE;AACA,6BACE,UAAA,EAAU,GAAG,OAAO,oBAAoB,GACxC,8BAAC,2BAA2B,UAA3B,EAAoC,OAAO,EAAE,iBAAiB,MAAM,qBAAqB,OAAA,GACxF,UACF,GACD;AAEF,GAAG,CAAA,UAAS;AACX,SACC,qBAAC,UAAA,EAAU,GAAG,OACZ,UAAA;AAAA,IAAA,MAAM;AAAA,IACP,oBAAC,OAAA,EAAM,OAAO,MAAM,oBAAA,CAAqB;AAAA,EAAA,GAC1C;AAEF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"BlockRepeater.js","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeater.tsx"],"sourcesContent":["import { Component, Field, SugaredRelativeSingleField } from '@contember/react-binding'\nimport { Repeater, RepeaterProps } from '@contember/react-repeater'\nimport { useState } from 'react'\nimport { extractBlocks } from '../internal/helpers/staticAnalyzer.js'\nimport { BlockRepeaterConfigContext } from '../contexts.js'\n\n/**\n * Props for the {@link BlockRepeater} component.\n */\nexport type BlockRepeaterProps =\n\t& {\n\t\t/**\n\t\t * A field that is used to determine the order of the entities.\n\t\t */\n\t\tsortableBy: RepeaterProps['sortableBy']\n\n\t\t/**\n\t\t * Discrimination field is a field that is used to determine which block should be rendered for a given entity.\n\t\t */\n\t\tdiscriminationField: SugaredRelativeSingleField['field']\n\t}\n\t& RepeaterProps\n\n/**\n * A repeater component that renders different blocks based on the value of a discrimination field.\n * This is headless component that does not impose any UI. Check DefaultBlockRepeater in UI library for a styled version.\n *\n * ## Props {@link BlockRepeaterProps}\n * - field or entities, sortableBy, discriminationField, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeater field=\"blocks\" discriminationField=\"type\" sortableBy=\"order\">\n * <Block name=\"text\" label=\"Text\">\n * <Field field=\"content\" />\n * </Block>\n * <Block name=\"image\" label=\"Image\">\n * <ImageField field=\"image\" />\n * </Block>\n * </BlockRepeater>\n * ```\n */\nexport const BlockRepeater = Component<BlockRepeaterProps>(({ children, ...props }, env) => {\n\tconst [blocks] = useState(() => extractBlocks(children, env))\n\tif (Object.keys(blocks).length === 0) {\n\t\tthrow new Error('BlockRepeater must have at least one Block child')\n\t}\n\treturn (\n\t\t<Repeater {...props} initialEntityCount={0}>\n\t\t\t<BlockRepeaterConfigContext.Provider value={{ discriminatedBy: props.discriminationField, blocks }}>\n\t\t\t\t{children}\n\t\t\t</BlockRepeaterConfigContext.Provider>\n\t\t</Repeater>\n\t)\n}, props => {\n\treturn (\n\t\t<Repeater {...props}>\n\t\t\t{props.children}\n\t\t\t<Field field={props.discriminationField} />\n\t\t</Repeater>\n\t)\n})\n"],"names":[],"mappings":";;;;;;AA0CO,MAAM,gBAAgB,UAA8B,CAAC,EAAE,UAAU,GAAG,MAAA,GAAS,QAAQ;AAC3F,QAAM,CAAC,MAAM,IAAI,SAAS,MAAM,cAAc,UAAU,GAAG,CAAC;AAC5D,MAAI,OAAO,KAAK,MAAM,EAAE,WAAW,GAAG;AACrC,UAAM,IAAI,MAAM,kDAAkD;AAAA,EACnE;AACA,6BACE,UAAA,EAAU,GAAG,OAAO,oBAAoB,GACxC,8BAAC,2BAA2B,UAA3B,EAAoC,OAAO,EAAE,iBAAiB,MAAM,qBAAqB,OAAA,GACxF,UACF,GACD;AAEF,GAAG,CAAA,UAAS;AACX,SACC,qBAAC,UAAA,EAAU,GAAG,OACZ,UAAA;AAAA,IAAA,MAAM;AAAA,IACP,oBAAC,OAAA,EAAM,OAAO,MAAM,oBAAA,CAAqB;AAAA,EAAA,GAC1C;AAEF,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockRepeaterAddItemTrigger.cjs","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeaterAddItemTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport { useBlockRepeaterConfig } from '../contexts'\nimport React, { ReactElement, useCallback, useMemo } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { RepeaterAddItemIndex, useRepeaterMethods } from '@contember/react-repeater'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>\n\n/**\n * Props for the {@link BlockRepeaterAddItemTrigger} component.\n */\nexport interface BlockRepeaterAddItemTriggerProps {\n\t/**\n\t * The type of the item to add.\n\t */\n\ttype: string\n\n\t/**\n\t * The index at which to add the item.\n\t * Can be one of:\n\t * - number: Adds the item at the specified index.\n\t * - `'first'`: Adds the item at the beginning.\n\t * - undefined or `'last'`: Adds the item at the end.\n\t */\n\tindex?: RepeaterAddItemIndex\n\n\t/**\n\t * A function to preprocess the entity.\n\t */\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler\n\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n}\n\n/**\n * A trigger component for adding item of given type to a block repeater.\n *\n * ## Props {@link BlockRepeaterAddItemTriggerProps}\n * - type, ?index, ?preprocess, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeaterAddItemTrigger type=\"image\" index=\"first\">\n * <button>Add Image</button>\n * </BlockRepeaterAddItemTrigger>\n * ```\n */\nexport const BlockRepeaterAddItemTrigger = ({ preprocess, index, type, ...props }: BlockRepeaterAddItemTriggerProps) => {\n\tconst { discriminatedBy } = useBlockRepeaterConfig()\n\n\tconst { addItem } = useRepeaterMethods()\n\tconst doAddItem = useCallback(() =>\n\t\taddItem(index, (it, options) => {\n\t\t\tit().getField(discriminatedBy).updateValue(type)\n\t\t\tpreprocess?.(it, options)\n\t\t}), [addItem, discriminatedBy, index, preprocess, type])\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn <SlotType onClick={composeEventHandlers(onClick, doAddItem)} {...otherProps} />\n}\n"],"names":["Slot","useBlockRepeaterConfig","useRepeaterMethods","useCallback","jsx","composeEventHandlers"],"mappings":";;;;;;;;AAOA,MAAM,WAAWA,UAAAA;AA4CV,MAAM,8BAA8B,CAAC,EAAE,YAAY,OAAO,MAAM,GAAG,YAA8C;AACvH,QAAM,EAAE,gBAAA,IAAoBC,gCAAA;AAE5B,QAAM,EAAE,QAAA,IAAYC,iCAAA;AACpB,QAAM,YAAYC,MAAAA,YAAY,MAC7B,QAAQ,OAAO,CAAC,IAAI,YAAY;AAC/B,OAAA,EAAK,SAAS,eAAe,EAAE,YAAY,IAAI;AAC/C,iBAAa,IAAI,OAAO;AAAA,EACzB,CAAC,GAAG,CAAC,SAAS,iBAAiB,OAAO,YAAY,IAAI,CAAC;AAExD,QAAM,EAAE,SAAS,GAAG,WAAA,IAAe;AAEnC,SAAOC,2BAAAA,IAAC,YAAS,SAASC,UAAAA,qBAAqB,SAAS,SAAS,GAAI,GAAG,YAAY;AACrF;;"}
|
|
1
|
+
{"version":3,"file":"BlockRepeaterAddItemTrigger.cjs","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeaterAddItemTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport { useBlockRepeaterConfig } from '../contexts.js'\nimport React, { ReactElement, useCallback, useMemo } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { RepeaterAddItemIndex, useRepeaterMethods } from '@contember/react-repeater'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>\n\n/**\n * Props for the {@link BlockRepeaterAddItemTrigger} component.\n */\nexport interface BlockRepeaterAddItemTriggerProps {\n\t/**\n\t * The type of the item to add.\n\t */\n\ttype: string\n\n\t/**\n\t * The index at which to add the item.\n\t * Can be one of:\n\t * - number: Adds the item at the specified index.\n\t * - `'first'`: Adds the item at the beginning.\n\t * - undefined or `'last'`: Adds the item at the end.\n\t */\n\tindex?: RepeaterAddItemIndex\n\n\t/**\n\t * A function to preprocess the entity.\n\t */\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler\n\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n}\n\n/**\n * A trigger component for adding item of given type to a block repeater.\n *\n * ## Props {@link BlockRepeaterAddItemTriggerProps}\n * - type, ?index, ?preprocess, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeaterAddItemTrigger type=\"image\" index=\"first\">\n * <button>Add Image</button>\n * </BlockRepeaterAddItemTrigger>\n * ```\n */\nexport const BlockRepeaterAddItemTrigger = ({ preprocess, index, type, ...props }: BlockRepeaterAddItemTriggerProps) => {\n\tconst { discriminatedBy } = useBlockRepeaterConfig()\n\n\tconst { addItem } = useRepeaterMethods()\n\tconst doAddItem = useCallback(() =>\n\t\taddItem(index, (it, options) => {\n\t\t\tit().getField(discriminatedBy).updateValue(type)\n\t\t\tpreprocess?.(it, options)\n\t\t}), [addItem, discriminatedBy, index, preprocess, type])\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn <SlotType onClick={composeEventHandlers(onClick, doAddItem)} {...otherProps} />\n}\n"],"names":["Slot","useBlockRepeaterConfig","useRepeaterMethods","useCallback","jsx","composeEventHandlers"],"mappings":";;;;;;;;AAOA,MAAM,WAAWA,UAAAA;AA4CV,MAAM,8BAA8B,CAAC,EAAE,YAAY,OAAO,MAAM,GAAG,YAA8C;AACvH,QAAM,EAAE,gBAAA,IAAoBC,gCAAA;AAE5B,QAAM,EAAE,QAAA,IAAYC,iCAAA;AACpB,QAAM,YAAYC,MAAAA,YAAY,MAC7B,QAAQ,OAAO,CAAC,IAAI,YAAY;AAC/B,OAAA,EAAK,SAAS,eAAe,EAAE,YAAY,IAAI;AAC/C,iBAAa,IAAI,OAAO;AAAA,EACzB,CAAC,GAAG,CAAC,SAAS,iBAAiB,OAAO,YAAY,IAAI,CAAC;AAExD,QAAM,EAAE,SAAS,GAAG,WAAA,IAAe;AAEnC,SAAOC,2BAAAA,IAAC,YAAS,SAASC,UAAAA,qBAAqB,SAAS,SAAS,GAAI,GAAG,YAAY;AACrF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockRepeaterAddItemTrigger.js","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeaterAddItemTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport { useBlockRepeaterConfig } from '../contexts'\nimport React, { ReactElement, useCallback, useMemo } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { RepeaterAddItemIndex, useRepeaterMethods } from '@contember/react-repeater'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>\n\n/**\n * Props for the {@link BlockRepeaterAddItemTrigger} component.\n */\nexport interface BlockRepeaterAddItemTriggerProps {\n\t/**\n\t * The type of the item to add.\n\t */\n\ttype: string\n\n\t/**\n\t * The index at which to add the item.\n\t * Can be one of:\n\t * - number: Adds the item at the specified index.\n\t * - `'first'`: Adds the item at the beginning.\n\t * - undefined or `'last'`: Adds the item at the end.\n\t */\n\tindex?: RepeaterAddItemIndex\n\n\t/**\n\t * A function to preprocess the entity.\n\t */\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler\n\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n}\n\n/**\n * A trigger component for adding item of given type to a block repeater.\n *\n * ## Props {@link BlockRepeaterAddItemTriggerProps}\n * - type, ?index, ?preprocess, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeaterAddItemTrigger type=\"image\" index=\"first\">\n * <button>Add Image</button>\n * </BlockRepeaterAddItemTrigger>\n * ```\n */\nexport const BlockRepeaterAddItemTrigger = ({ preprocess, index, type, ...props }: BlockRepeaterAddItemTriggerProps) => {\n\tconst { discriminatedBy } = useBlockRepeaterConfig()\n\n\tconst { addItem } = useRepeaterMethods()\n\tconst doAddItem = useCallback(() =>\n\t\taddItem(index, (it, options) => {\n\t\t\tit().getField(discriminatedBy).updateValue(type)\n\t\t\tpreprocess?.(it, options)\n\t\t}), [addItem, discriminatedBy, index, preprocess, type])\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn <SlotType onClick={composeEventHandlers(onClick, doAddItem)} {...otherProps} />\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,WAAW;AA4CV,MAAM,8BAA8B,CAAC,EAAE,YAAY,OAAO,MAAM,GAAG,YAA8C;AACvH,QAAM,EAAE,gBAAA,IAAoB,uBAAA;AAE5B,QAAM,EAAE,QAAA,IAAY,mBAAA;AACpB,QAAM,YAAY,YAAY,MAC7B,QAAQ,OAAO,CAAC,IAAI,YAAY;AAC/B,OAAA,EAAK,SAAS,eAAe,EAAE,YAAY,IAAI;AAC/C,iBAAa,IAAI,OAAO;AAAA,EACzB,CAAC,GAAG,CAAC,SAAS,iBAAiB,OAAO,YAAY,IAAI,CAAC;AAExD,QAAM,EAAE,SAAS,GAAG,WAAA,IAAe;AAEnC,SAAO,oBAAC,YAAS,SAAS,qBAAqB,SAAS,SAAS,GAAI,GAAG,YAAY;AACrF;"}
|
|
1
|
+
{"version":3,"file":"BlockRepeaterAddItemTrigger.js","sources":["../../../../../packages/react-block-repeater/src/components/BlockRepeaterAddItemTrigger.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport { useBlockRepeaterConfig } from '../contexts.js'\nimport React, { ReactElement, useCallback, useMemo } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { RepeaterAddItemIndex, useRepeaterMethods } from '@contember/react-repeater'\nimport { composeEventHandlers } from '@radix-ui/primitive'\n\nconst SlotType = Slot as React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>\n\n/**\n * Props for the {@link BlockRepeaterAddItemTrigger} component.\n */\nexport interface BlockRepeaterAddItemTriggerProps {\n\t/**\n\t * The type of the item to add.\n\t */\n\ttype: string\n\n\t/**\n\t * The index at which to add the item.\n\t * Can be one of:\n\t * - number: Adds the item at the specified index.\n\t * - `'first'`: Adds the item at the beginning.\n\t * - undefined or `'last'`: Adds the item at the end.\n\t */\n\tindex?: RepeaterAddItemIndex\n\n\t/**\n\t * A function to preprocess the entity.\n\t */\n\tpreprocess?: EntityAccessor.BatchUpdatesHandler\n\n\t/**\n\t * The button element.\n\t */\n\tchildren: ReactElement\n}\n\n/**\n * A trigger component for adding item of given type to a block repeater.\n *\n * ## Props {@link BlockRepeaterAddItemTriggerProps}\n * - type, ?index, ?preprocess, children\n *\n * ## Example\n * ```tsx\n * <BlockRepeaterAddItemTrigger type=\"image\" index=\"first\">\n * <button>Add Image</button>\n * </BlockRepeaterAddItemTrigger>\n * ```\n */\nexport const BlockRepeaterAddItemTrigger = ({ preprocess, index, type, ...props }: BlockRepeaterAddItemTriggerProps) => {\n\tconst { discriminatedBy } = useBlockRepeaterConfig()\n\n\tconst { addItem } = useRepeaterMethods()\n\tconst doAddItem = useCallback(() =>\n\t\taddItem(index, (it, options) => {\n\t\t\tit().getField(discriminatedBy).updateValue(type)\n\t\t\tpreprocess?.(it, options)\n\t\t}), [addItem, discriminatedBy, index, preprocess, type])\n\n\tconst { onClick, ...otherProps } = props as React.ButtonHTMLAttributes<HTMLButtonElement>\n\n\treturn <SlotType onClick={composeEventHandlers(onClick, doAddItem)} {...otherProps} />\n}\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,WAAW;AA4CV,MAAM,8BAA8B,CAAC,EAAE,YAAY,OAAO,MAAM,GAAG,YAA8C;AACvH,QAAM,EAAE,gBAAA,IAAoB,uBAAA;AAE5B,QAAM,EAAE,QAAA,IAAY,mBAAA;AACpB,QAAM,YAAY,YAAY,MAC7B,QAAQ,OAAO,CAAC,IAAI,YAAY;AAC/B,OAAA,EAAK,SAAS,eAAe,EAAE,YAAY,IAAI;AAC/C,iBAAa,IAAI,OAAO;AAAA,EACzB,CAAC,GAAG,CAAC,SAAS,iBAAiB,OAAO,YAAY,IAAI,CAAC;AAExD,QAAM,EAAE,SAAS,GAAG,WAAA,IAAe;AAEnC,SAAO,oBAAC,YAAS,SAAS,qBAAqB,SAAS,SAAS,GAAI,GAAG,YAAY;AACrF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.cjs","sources":["../../../../packages/react-block-repeater/src/contexts.ts"],"sourcesContent":["import { SugaredRelativeSingleField } from '@contember/react-binding'\nimport { createRequiredContext } from '@contember/react-utils'\nimport { BlocksMap } from './types'\n\nconst BlockRepeaterConfigContext_ = createRequiredContext<{\n\tdiscriminatedBy: SugaredRelativeSingleField['field']\n\tblocks: BlocksMap\n}>('BlockRepeaterConfigContext')\n/** @internal */\nexport const BlockRepeaterConfigContext = BlockRepeaterConfigContext_[0]\n\n/**\n * Returns configuration of the block repeater (discrimination field and blocks map).\n */\nexport const useBlockRepeaterConfig = BlockRepeaterConfigContext_[1]\n"],"names":["createRequiredContext"],"mappings":";;;AAIA,MAAM,8BAA8BA,WAAAA,sBAGjC,4BAA4B;AAExB,MAAM,6BAA6B,4BAA4B,CAAC;AAKhE,MAAM,yBAAyB,4BAA4B,CAAC;;;"}
|
|
1
|
+
{"version":3,"file":"contexts.cjs","sources":["../../../../packages/react-block-repeater/src/contexts.ts"],"sourcesContent":["import { SugaredRelativeSingleField } from '@contember/react-binding'\nimport { createRequiredContext } from '@contember/react-utils'\nimport { BlocksMap } from './types/index.js'\n\nconst BlockRepeaterConfigContext_ = createRequiredContext<{\n\tdiscriminatedBy: SugaredRelativeSingleField['field']\n\tblocks: BlocksMap\n}>('BlockRepeaterConfigContext')\n/** @internal */\nexport const BlockRepeaterConfigContext = BlockRepeaterConfigContext_[0]\n\n/**\n * Returns configuration of the block repeater (discrimination field and blocks map).\n */\nexport const useBlockRepeaterConfig = BlockRepeaterConfigContext_[1]\n"],"names":["createRequiredContext"],"mappings":";;;AAIA,MAAM,8BAA8BA,WAAAA,sBAGjC,4BAA4B;AAExB,MAAM,6BAA6B,4BAA4B,CAAC;AAKhE,MAAM,yBAAyB,4BAA4B,CAAC;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.js","sources":["../../../../packages/react-block-repeater/src/contexts.ts"],"sourcesContent":["import { SugaredRelativeSingleField } from '@contember/react-binding'\nimport { createRequiredContext } from '@contember/react-utils'\nimport { BlocksMap } from './types'\n\nconst BlockRepeaterConfigContext_ = createRequiredContext<{\n\tdiscriminatedBy: SugaredRelativeSingleField['field']\n\tblocks: BlocksMap\n}>('BlockRepeaterConfigContext')\n/** @internal */\nexport const BlockRepeaterConfigContext = BlockRepeaterConfigContext_[0]\n\n/**\n * Returns configuration of the block repeater (discrimination field and blocks map).\n */\nexport const useBlockRepeaterConfig = BlockRepeaterConfigContext_[1]\n"],"names":[],"mappings":";AAIA,MAAM,8BAA8B,sBAGjC,4BAA4B;AAExB,MAAM,6BAA6B,4BAA4B,CAAC;AAKhE,MAAM,yBAAyB,4BAA4B,CAAC;"}
|
|
1
|
+
{"version":3,"file":"contexts.js","sources":["../../../../packages/react-block-repeater/src/contexts.ts"],"sourcesContent":["import { SugaredRelativeSingleField } from '@contember/react-binding'\nimport { createRequiredContext } from '@contember/react-utils'\nimport { BlocksMap } from './types/index.js'\n\nconst BlockRepeaterConfigContext_ = createRequiredContext<{\n\tdiscriminatedBy: SugaredRelativeSingleField['field']\n\tblocks: BlocksMap\n}>('BlockRepeaterConfigContext')\n/** @internal */\nexport const BlockRepeaterConfigContext = BlockRepeaterConfigContext_[0]\n\n/**\n * Returns configuration of the block repeater (discrimination field and blocks map).\n */\nexport const useBlockRepeaterConfig = BlockRepeaterConfigContext_[1]\n"],"names":[],"mappings":";AAIA,MAAM,8BAA8B,sBAGjC,4BAA4B;AAExB,MAAM,6BAA6B,4BAA4B,CAAC;AAKhE,MAAM,yBAAyB,4BAA4B,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBlockRepeaterCurrentBlock.cjs","sources":["../../../../../packages/react-block-repeater/src/hooks/useBlockRepeaterCurrentBlock.ts"],"sourcesContent":["import { useEntity } from '@contember/react-binding'\nimport { useBlockRepeaterConfig } from '../contexts'\nimport { BlockProps } from '../components'\n\n/**\n * Returns the current block props (see {@link BlockProps}).\n */\nexport const useBlockRepeaterCurrentBlock = (): BlockProps | undefined => {\n\tconst entity = useEntity()\n\tconst { discriminatedBy, blocks } = useBlockRepeaterConfig()\n\tconst field = entity.getField<string>(discriminatedBy).value\n\treturn field ? blocks[field] : undefined\n}\n"],"names":["useEntity","useBlockRepeaterConfig"],"mappings":";;;;AAOO,MAAM,+BAA+B,MAA8B;AACzE,QAAM,SAASA,aAAAA,UAAA;AACf,QAAM,EAAE,iBAAiB,OAAA,IAAWC,gCAAA;AACpC,QAAM,QAAQ,OAAO,SAAiB,eAAe,EAAE;AACvD,SAAO,QAAQ,OAAO,KAAK,IAAI;AAChC;;"}
|
|
1
|
+
{"version":3,"file":"useBlockRepeaterCurrentBlock.cjs","sources":["../../../../../packages/react-block-repeater/src/hooks/useBlockRepeaterCurrentBlock.ts"],"sourcesContent":["import { useEntity } from '@contember/react-binding'\nimport { useBlockRepeaterConfig } from '../contexts.js'\nimport { BlockProps } from '../components/index.js'\n\n/**\n * Returns the current block props (see {@link BlockProps}).\n */\nexport const useBlockRepeaterCurrentBlock = (): BlockProps | undefined => {\n\tconst entity = useEntity()\n\tconst { discriminatedBy, blocks } = useBlockRepeaterConfig()\n\tconst field = entity.getField<string>(discriminatedBy).value\n\treturn field ? blocks[field] : undefined\n}\n"],"names":["useEntity","useBlockRepeaterConfig"],"mappings":";;;;AAOO,MAAM,+BAA+B,MAA8B;AACzE,QAAM,SAASA,aAAAA,UAAA;AACf,QAAM,EAAE,iBAAiB,OAAA,IAAWC,gCAAA;AACpC,QAAM,QAAQ,OAAO,SAAiB,eAAe,EAAE;AACvD,SAAO,QAAQ,OAAO,KAAK,IAAI;AAChC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBlockRepeaterCurrentBlock.js","sources":["../../../../../packages/react-block-repeater/src/hooks/useBlockRepeaterCurrentBlock.ts"],"sourcesContent":["import { useEntity } from '@contember/react-binding'\nimport { useBlockRepeaterConfig } from '../contexts'\nimport { BlockProps } from '../components'\n\n/**\n * Returns the current block props (see {@link BlockProps}).\n */\nexport const useBlockRepeaterCurrentBlock = (): BlockProps | undefined => {\n\tconst entity = useEntity()\n\tconst { discriminatedBy, blocks } = useBlockRepeaterConfig()\n\tconst field = entity.getField<string>(discriminatedBy).value\n\treturn field ? blocks[field] : undefined\n}\n"],"names":[],"mappings":";;AAOO,MAAM,+BAA+B,MAA8B;AACzE,QAAM,SAAS,UAAA;AACf,QAAM,EAAE,iBAAiB,OAAA,IAAW,uBAAA;AACpC,QAAM,QAAQ,OAAO,SAAiB,eAAe,EAAE;AACvD,SAAO,QAAQ,OAAO,KAAK,IAAI;AAChC;"}
|
|
1
|
+
{"version":3,"file":"useBlockRepeaterCurrentBlock.js","sources":["../../../../../packages/react-block-repeater/src/hooks/useBlockRepeaterCurrentBlock.ts"],"sourcesContent":["import { useEntity } from '@contember/react-binding'\nimport { useBlockRepeaterConfig } from '../contexts.js'\nimport { BlockProps } from '../components/index.js'\n\n/**\n * Returns the current block props (see {@link BlockProps}).\n */\nexport const useBlockRepeaterCurrentBlock = (): BlockProps | undefined => {\n\tconst entity = useEntity()\n\tconst { discriminatedBy, blocks } = useBlockRepeaterConfig()\n\tconst field = entity.getField<string>(discriminatedBy).value\n\treturn field ? blocks[field] : undefined\n}\n"],"names":[],"mappings":";;AAOO,MAAM,+BAA+B,MAA8B;AACzE,QAAM,SAAS,UAAA;AACf,QAAM,EAAE,iBAAiB,OAAA,IAAW,uBAAA;AACpC,QAAM,QAAQ,OAAO,SAAiB,eAAe,EAAE;AACvD,SAAO,QAAQ,OAAO,KAAK,IAAI;AAChC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticAnalyzer.cjs","sources":["../../../../../../packages/react-block-repeater/src/internal/helpers/staticAnalyzer.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { Block, BlockProps } from '../../components'\nimport { Environment } from '@contember/react-binding'\nimport { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'\n\ntype BlocksMap = Record<string, BlockProps>\nexport const extractBlocks = (children: ReactNode, env: Environment): BlocksMap => {\n\tconst blocks = blockAnalyzer.processChildren(children, env)\n\treturn Object.fromEntries(blocks.map(block => [block.name, block]))\n}\n\nconst columnLeaf = new Leaf(node => node.props, Block)\n\nconst blockAnalyzer = new ChildrenAnalyzer<\n\tBlockProps,\n\tnever,\n\tEnvironment\n>([columnLeaf], {\n\tstaticRenderFactoryName: 'staticRender',\n\tstaticContextFactoryName: 'generateEnvironment',\n\tunhandledNodeErrorMessage: 'Only Block children are supported.',\n})\n"],"names":["Leaf","Block","ChildrenAnalyzer"],"mappings":";;;;AAMO,MAAM,gBAAgB,CAAC,UAAqB,QAAgC;AAClF,QAAM,SAAS,cAAc,gBAAgB,UAAU,GAAG;AAC1D,SAAO,OAAO,YAAY,OAAO,IAAI,CAAA,UAAS,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC;AACnE;AAEA,MAAM,aAAa,IAAIA,wBAAAA,KAAK,CAAA,SAAQ,KAAK,OAAOC,WAAK;AAErD,MAAM,gBAAgB,IAAIC,wBAAAA,iBAIxB,CAAC,UAAU,GAAG;AAAA,EACf,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAC5B,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"staticAnalyzer.cjs","sources":["../../../../../../packages/react-block-repeater/src/internal/helpers/staticAnalyzer.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { Block, BlockProps } from '../../components/index.js'\nimport { Environment } from '@contember/react-binding'\nimport { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'\n\ntype BlocksMap = Record<string, BlockProps>\nexport const extractBlocks = (children: ReactNode, env: Environment): BlocksMap => {\n\tconst blocks = blockAnalyzer.processChildren(children, env)\n\treturn Object.fromEntries(blocks.map(block => [block.name, block]))\n}\n\nconst columnLeaf = new Leaf(node => node.props, Block)\n\nconst blockAnalyzer = new ChildrenAnalyzer<\n\tBlockProps,\n\tnever,\n\tEnvironment\n>([columnLeaf], {\n\tstaticRenderFactoryName: 'staticRender',\n\tstaticContextFactoryName: 'generateEnvironment',\n\tunhandledNodeErrorMessage: 'Only Block children are supported.',\n})\n"],"names":["Leaf","Block","ChildrenAnalyzer"],"mappings":";;;;AAMO,MAAM,gBAAgB,CAAC,UAAqB,QAAgC;AAClF,QAAM,SAAS,cAAc,gBAAgB,UAAU,GAAG;AAC1D,SAAO,OAAO,YAAY,OAAO,IAAI,CAAA,UAAS,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC;AACnE;AAEA,MAAM,aAAa,IAAIA,wBAAAA,KAAK,CAAA,SAAQ,KAAK,OAAOC,WAAK;AAErD,MAAM,gBAAgB,IAAIC,wBAAAA,iBAIxB,CAAC,UAAU,GAAG;AAAA,EACf,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAC5B,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticAnalyzer.js","sources":["../../../../../../packages/react-block-repeater/src/internal/helpers/staticAnalyzer.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { Block, BlockProps } from '../../components'\nimport { Environment } from '@contember/react-binding'\nimport { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'\n\ntype BlocksMap = Record<string, BlockProps>\nexport const extractBlocks = (children: ReactNode, env: Environment): BlocksMap => {\n\tconst blocks = blockAnalyzer.processChildren(children, env)\n\treturn Object.fromEntries(blocks.map(block => [block.name, block]))\n}\n\nconst columnLeaf = new Leaf(node => node.props, Block)\n\nconst blockAnalyzer = new ChildrenAnalyzer<\n\tBlockProps,\n\tnever,\n\tEnvironment\n>([columnLeaf], {\n\tstaticRenderFactoryName: 'staticRender',\n\tstaticContextFactoryName: 'generateEnvironment',\n\tunhandledNodeErrorMessage: 'Only Block children are supported.',\n})\n"],"names":[],"mappings":";;AAMO,MAAM,gBAAgB,CAAC,UAAqB,QAAgC;AAClF,QAAM,SAAS,cAAc,gBAAgB,UAAU,GAAG;AAC1D,SAAO,OAAO,YAAY,OAAO,IAAI,CAAA,UAAS,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC;AACnE;AAEA,MAAM,aAAa,IAAI,KAAK,CAAA,SAAQ,KAAK,OAAO,KAAK;AAErD,MAAM,gBAAgB,IAAI,iBAIxB,CAAC,UAAU,GAAG;AAAA,EACf,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAC5B,CAAC;"}
|
|
1
|
+
{"version":3,"file":"staticAnalyzer.js","sources":["../../../../../../packages/react-block-repeater/src/internal/helpers/staticAnalyzer.ts"],"sourcesContent":["import { ReactNode } from 'react'\nimport { Block, BlockProps } from '../../components/index.js'\nimport { Environment } from '@contember/react-binding'\nimport { ChildrenAnalyzer, Leaf } from '@contember/react-multipass-rendering'\n\ntype BlocksMap = Record<string, BlockProps>\nexport const extractBlocks = (children: ReactNode, env: Environment): BlocksMap => {\n\tconst blocks = blockAnalyzer.processChildren(children, env)\n\treturn Object.fromEntries(blocks.map(block => [block.name, block]))\n}\n\nconst columnLeaf = new Leaf(node => node.props, Block)\n\nconst blockAnalyzer = new ChildrenAnalyzer<\n\tBlockProps,\n\tnever,\n\tEnvironment\n>([columnLeaf], {\n\tstaticRenderFactoryName: 'staticRender',\n\tstaticContextFactoryName: 'generateEnvironment',\n\tunhandledNodeErrorMessage: 'Only Block children are supported.',\n})\n"],"names":[],"mappings":";;AAMO,MAAM,gBAAgB,CAAC,UAAqB,QAAgC;AAClF,QAAM,SAAS,cAAc,gBAAgB,UAAU,GAAG;AAC1D,SAAO,OAAO,YAAY,OAAO,IAAI,CAAA,UAAS,CAAC,MAAM,MAAM,KAAK,CAAC,CAAC;AACnE;AAEA,MAAM,aAAa,IAAI,KAAK,CAAA,SAAQ,KAAK,OAAO,KAAK;AAErD,MAAM,gBAAgB,IAAI,iBAIxB,CAAC,UAAU,GAAG;AAAA,EACf,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAC5B,CAAC;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './Block';
|
|
2
|
-
export * from './BlockRepeater';
|
|
3
|
-
export * from './BlockRepeaterAddItemTrigger';
|
|
1
|
+
export * from './Block.js';
|
|
2
|
+
export * from './BlockRepeater.js';
|
|
3
|
+
export * from './BlockRepeaterAddItemTrigger.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kCAAkC,CAAA"}
|
package/dist/types/contexts.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SugaredRelativeSingleField } from '@contember/react-binding';
|
|
2
|
-
import { BlocksMap } from './types';
|
|
2
|
+
import { BlocksMap } from './types/index.js';
|
|
3
3
|
/** @internal */
|
|
4
4
|
export declare const BlockRepeaterConfigContext: import("react").Context<{
|
|
5
5
|
discriminatedBy: SugaredRelativeSingleField["field"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../src/contexts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAM5C,gBAAgB;AAChB,eAAO,MAAM,0BAA0B;qBAJrB,0BAA0B,CAAC,OAAO,CAAC;YAC5C,SAAS;EAGsD,CAAA;AAExE;;GAEG;AACH,eAAO,MAAM,sBAAsB;qBATjB,0BAA0B,CAAC,OAAO,CAAC;YAC5C,SAAS;CAQkD,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './useBlockRepeaterCurrentBlock';
|
|
1
|
+
export * from './useBlockRepeaterCurrentBlock.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBlockRepeaterCurrentBlock.d.ts","sourceRoot":"","sources":["../../../src/hooks/useBlockRepeaterCurrentBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useBlockRepeaterCurrentBlock.d.ts","sourceRoot":"","sources":["../../../src/hooks/useBlockRepeaterCurrentBlock.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAEnD;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAO,UAAU,GAAG,SAK5D,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './contexts';
|
|
2
|
-
export * from './components';
|
|
3
|
-
export * from './hooks';
|
|
4
|
-
export * from './types';
|
|
1
|
+
export * from './contexts.js';
|
|
2
|
+
export * from './components/index.js';
|
|
3
|
+
export * from './hooks/index.js';
|
|
4
|
+
export * from './types/index.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { BlockProps } from '../../components';
|
|
2
|
+
import { BlockProps } from '../../components/index.js';
|
|
3
3
|
import { Environment } from '@contember/react-binding';
|
|
4
4
|
type BlocksMap = Record<string, BlockProps>;
|
|
5
5
|
export declare const extractBlocks: (children: ReactNode, env: Environment) => BlocksMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticAnalyzer.d.ts","sourceRoot":"","sources":["../../../../src/internal/helpers/staticAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAS,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"staticAnalyzer.d.ts","sourceRoot":"","sources":["../../../../src/internal/helpers/staticAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EAAS,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAGtD,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAC3C,eAAO,MAAM,aAAa,GAAI,UAAU,SAAS,EAAE,KAAK,WAAW,KAAG,SAGrE,CAAA"}
|