astro-tractstack 2.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +110 -0
- package/README.md +56 -0
- package/astro.d.ts +64 -0
- package/bin/create-tractstack.js +483 -0
- package/dist/config.js +80 -0
- package/dist/index.js +2129 -0
- package/package.json +89 -0
- package/templates/artpacks/kCz/captainBreakfast_1080px.webp +0 -0
- package/templates/artpacks/kCz/captainBreakfast_1920px.webp +0 -0
- package/templates/artpacks/kCz/captainBreakfast_600px.webp +0 -0
- package/templates/artpacks/kCz/cleanDrips_1080px.webp +0 -0
- package/templates/artpacks/kCz/cleanDrips_1920px.webp +0 -0
- package/templates/artpacks/kCz/cleanDrips_600px.webp +0 -0
- package/templates/artpacks/kCz/crispwaves_1080px.webp +0 -0
- package/templates/artpacks/kCz/crispwaves_1920px.webp +0 -0
- package/templates/artpacks/kCz/crispwaves_600px.webp +0 -0
- package/templates/artpacks/kCz/dragonSkin_1080px.webp +0 -0
- package/templates/artpacks/kCz/dragonSkin_1920px.webp +0 -0
- package/templates/artpacks/kCz/dragonSkin_600px.webp +0 -0
- package/templates/artpacks/kCz/dragon_1080px.webp +0 -0
- package/templates/artpacks/kCz/dragon_1920px.webp +0 -0
- package/templates/artpacks/kCz/dragon_600px.webp +0 -0
- package/templates/artpacks/kCz/nightcity_1080px.webp +0 -0
- package/templates/artpacks/kCz/nightcity_1920px.webp +0 -0
- package/templates/artpacks/kCz/nightcity_600px.webp +0 -0
- package/templates/artpacks/kCz/pattern1_1080px.webp +0 -0
- package/templates/artpacks/kCz/pattern1_1920px.webp +0 -0
- package/templates/artpacks/kCz/pattern1_600px.webp +0 -0
- package/templates/artpacks/kCz/pattern2_1080px.webp +0 -0
- package/templates/artpacks/kCz/pattern2_1920px.webp +0 -0
- package/templates/artpacks/kCz/pattern2_600px.webp +0 -0
- package/templates/artpacks/kCz/skindrips_1080px.webp +0 -0
- package/templates/artpacks/kCz/skindrips_1920px.webp +0 -0
- package/templates/artpacks/kCz/skindrips_600px.webp +0 -0
- package/templates/artpacks/kCz/slimetime_1080px.webp +0 -0
- package/templates/artpacks/kCz/slimetime_1920px.webp +0 -0
- package/templates/artpacks/kCz/slimetime_600px.webp +0 -0
- package/templates/artpacks/kCz/snake_1080px.webp +0 -0
- package/templates/artpacks/kCz/snake_1920px.webp +0 -0
- package/templates/artpacks/kCz/snake_600px.webp +0 -0
- package/templates/artpacks/kCz/toxicshock_1080px.webp +0 -0
- package/templates/artpacks/kCz/toxicshock_1920px.webp +0 -0
- package/templates/artpacks/kCz/toxicshock_600px.webp +0 -0
- package/templates/artpacks/kCz/tractstack_1080px.webp +0 -0
- package/templates/artpacks/kCz/tractstack_1920px.webp +0 -0
- package/templates/artpacks/kCz/tractstack_600px.webp +0 -0
- package/templates/artpacks/kCz/tripdrips_1080px.webp +0 -0
- package/templates/artpacks/kCz/tripdrips_1920px.webp +0 -0
- package/templates/artpacks/kCz/tripdrips_600px.webp +0 -0
- package/templates/artpacks/kCz/wavedrips_1080px.webp +0 -0
- package/templates/artpacks/kCz/wavedrips_1920px.webp +0 -0
- package/templates/artpacks/kCz/wavedrips_600px.webp +0 -0
- package/templates/artpacks/t8k/beach_1080px.webp +0 -0
- package/templates/artpacks/t8k/beach_1920px.webp +0 -0
- package/templates/artpacks/t8k/beach_600px.webp +0 -0
- package/templates/artpacks/t8k/blast_1080px.webp +0 -0
- package/templates/artpacks/t8k/blast_1920px.webp +0 -0
- package/templates/artpacks/t8k/blast_600px.webp +0 -0
- package/templates/artpacks/t8k/bokeh_1080px.webp +0 -0
- package/templates/artpacks/t8k/bokeh_1920px.webp +0 -0
- package/templates/artpacks/t8k/bokeh_600px.webp +0 -0
- package/templates/artpacks/t8k/cartoon_1080px.webp +0 -0
- package/templates/artpacks/t8k/cartoon_1920px.webp +0 -0
- package/templates/artpacks/t8k/cartoon_600px.webp +0 -0
- package/templates/artpacks/t8k/darkeggshell_1080px.webp +0 -0
- package/templates/artpacks/t8k/darkeggshell_1920px.webp +0 -0
- package/templates/artpacks/t8k/darkeggshell_600px.webp +0 -0
- package/templates/artpacks/t8k/explosion_1080px.webp +0 -0
- package/templates/artpacks/t8k/explosion_1920px.webp +0 -0
- package/templates/artpacks/t8k/explosion_600px.webp +0 -0
- package/templates/artpacks/t8k/floral_1080px.webp +0 -0
- package/templates/artpacks/t8k/floral_1920px.webp +0 -0
- package/templates/artpacks/t8k/floral_600px.webp +0 -0
- package/templates/artpacks/t8k/flower_1080px.webp +0 -0
- package/templates/artpacks/t8k/flower_1920px.webp +0 -0
- package/templates/artpacks/t8k/flower_600px.webp +0 -0
- package/templates/artpacks/t8k/foliage_1080px.webp +0 -0
- package/templates/artpacks/t8k/foliage_1920px.webp +0 -0
- package/templates/artpacks/t8k/foliage_600px.webp +0 -0
- package/templates/artpacks/t8k/mist_1080px.webp +0 -0
- package/templates/artpacks/t8k/mist_1920px.webp +0 -0
- package/templates/artpacks/t8k/mist_600px.webp +0 -0
- package/templates/artpacks/t8k/portal_1080px.webp +0 -0
- package/templates/artpacks/t8k/portal_1920px.webp +0 -0
- package/templates/artpacks/t8k/portal_600px.webp +0 -0
- package/templates/artpacks/t8k/storytime_1080px.webp +0 -0
- package/templates/artpacks/t8k/storytime_1920px.webp +0 -0
- package/templates/artpacks/t8k/storytime_600px.webp +0 -0
- package/templates/artpacks/t8k/tacky_1080px.webp +0 -0
- package/templates/artpacks/t8k/tacky_1920px.webp +0 -0
- package/templates/artpacks/t8k/tacky_600px.webp +0 -0
- package/templates/artpacks/t8k/wallpaper_1080px.webp +0 -0
- package/templates/artpacks/t8k/wallpaper_1920px.webp +0 -0
- package/templates/artpacks/t8k/wallpaper_600px.webp +0 -0
- package/templates/brand/favicon.ico +0 -0
- package/templates/brand/logo.svg +19 -0
- package/templates/brand/static.jpg +0 -0
- package/templates/brand/wordmark.svg +4 -0
- package/templates/css/custom.css +51 -0
- package/templates/css/frontend.css +3519 -0
- package/templates/css/storykeep.css +92872 -0
- package/templates/custom/minimal/CodeHook.astro +53 -0
- package/templates/custom/minimal/CustomRoutes.astro +46 -0
- package/templates/custom/with-examples/CodeHook.astro +49 -0
- package/templates/custom/with-examples/CustomHero.astro +13 -0
- package/templates/custom/with-examples/CustomRoutes.astro +39 -0
- package/templates/custom/with-examples/pages/Collections.astro +110 -0
- package/templates/env.example +8 -0
- package/templates/fonts/Inter-Black.woff2 +0 -0
- package/templates/fonts/Inter-Bold.woff2 +0 -0
- package/templates/fonts/Inter-Regular.woff2 +0 -0
- package/templates/icons/h2.svg +1 -0
- package/templates/icons/h3.svg +1 -0
- package/templates/icons/h4.svg +1 -0
- package/templates/icons/h5.svg +1 -0
- package/templates/icons/image.svg +7 -0
- package/templates/icons/text.svg +6 -0
- package/templates/socials/codepen.svg +1 -0
- package/templates/socials/discord.svg +1 -0
- package/templates/socials/facebook.svg +1 -0
- package/templates/socials/github.svg +1 -0
- package/templates/socials/instagram.svg +1 -0
- package/templates/socials/linkedin.svg +1 -0
- package/templates/socials/mail.svg +1 -0
- package/templates/socials/rumble.svg +1 -0
- package/templates/socials/tiktok.svg +1 -0
- package/templates/socials/twitch.svg +1 -0
- package/templates/socials/twitter.svg +1 -0
- package/templates/socials/x.svg +1 -0
- package/templates/socials/youtube.svg +1 -0
- package/templates/src/client/analytics-events.ts +213 -0
- package/templates/src/client/belief-events.ts +205 -0
- package/templates/src/client/sse.ts +667 -0
- package/templates/src/components/Footer.astro +246 -0
- package/templates/src/components/Fragment.astro +70 -0
- package/templates/src/components/Header.astro +458 -0
- package/templates/src/components/Menu.tsx +196 -0
- package/templates/src/components/codehooks/BunnyVideoSetup.tsx +692 -0
- package/templates/src/components/codehooks/BunnyVideoWrapper.astro +78 -0
- package/templates/src/components/codehooks/EpinetDurationSelector.tsx +1020 -0
- package/templates/src/components/codehooks/EpinetTableView.tsx +594 -0
- package/templates/src/components/codehooks/EpinetWrapper.tsx +424 -0
- package/templates/src/components/codehooks/FeaturedContent.astro +273 -0
- package/templates/src/components/codehooks/FeaturedContentSetup.tsx +738 -0
- package/templates/src/components/codehooks/ListContent.astro +460 -0
- package/templates/src/components/codehooks/ListContentSetup.tsx +649 -0
- package/templates/src/components/codehooks/SankeyDiagram.tsx +359 -0
- package/templates/src/components/compositor/Compositor.tsx +144 -0
- package/templates/src/components/compositor/Node.tsx +415 -0
- package/templates/src/components/compositor/NodeWithGuid.tsx +25 -0
- package/templates/src/components/compositor/PanelVisibilityWrapper.tsx +87 -0
- package/templates/src/components/compositor/elements/Belief.tsx +148 -0
- package/templates/src/components/compositor/elements/BgImage.tsx +118 -0
- package/templates/src/components/compositor/elements/BgVisualBreak.tsx +102 -0
- package/templates/src/components/compositor/elements/BunnyVideo.tsx +63 -0
- package/templates/src/components/compositor/elements/IdentifyAs.tsx +66 -0
- package/templates/src/components/compositor/elements/PlayButton.tsx +19 -0
- package/templates/src/components/compositor/elements/SignUp.tsx +179 -0
- package/templates/src/components/compositor/elements/Svg.tsx +33 -0
- package/templates/src/components/compositor/elements/ToggleBelief.tsx +36 -0
- package/templates/src/components/compositor/elements/YouTubeWrapper.tsx +33 -0
- package/templates/src/components/compositor/nodes/BgPaneWrapper.tsx +35 -0
- package/templates/src/components/compositor/nodes/GhostInsertBlock.tsx +189 -0
- package/templates/src/components/compositor/nodes/Markdown.tsx +179 -0
- package/templates/src/components/compositor/nodes/Pane.tsx +277 -0
- package/templates/src/components/compositor/nodes/Pane_eraser.tsx +69 -0
- package/templates/src/components/compositor/nodes/Pane_layout.tsx +77 -0
- package/templates/src/components/compositor/nodes/RenderChildren.tsx +19 -0
- package/templates/src/components/compositor/nodes/StoryFragment.tsx +35 -0
- package/templates/src/components/compositor/nodes/TagElement.tsx +14 -0
- package/templates/src/components/compositor/nodes/Widget.tsx +115 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeA.tsx +4 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeA_eraser.tsx +26 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeAnchorComponent.tsx +248 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag.tsx +684 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag_eraser.tsx +62 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag_insert.tsx +120 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeBasicTag_settings.tsx +62 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeButton.tsx +5 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeButton_eraser.tsx +26 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeImg.tsx +28 -0
- package/templates/src/components/compositor/nodes/tagElements/NodeText.tsx +18 -0
- package/templates/src/components/compositor/nodes/tagElements/TabIndicator.tsx +51 -0
- package/templates/src/components/compositor/preview/FeaturedContentPreview.tsx +128 -0
- package/templates/src/components/compositor/preview/ListContentPreview.tsx +213 -0
- package/templates/src/components/compositor/preview/OgImagePreview.tsx +223 -0
- package/templates/src/components/compositor/preview/PaneSnapshotGenerator.tsx +199 -0
- package/templates/src/components/compositor/preview/PanesPreviewGenerator.tsx +123 -0
- package/templates/src/components/compositor/preview/VisualBreakPreview.tsx +154 -0
- package/templates/src/components/edit/Header.tsx +181 -0
- package/templates/src/components/edit/PanelSwitch.tsx +446 -0
- package/templates/src/components/edit/SettingsPanel.tsx +70 -0
- package/templates/src/components/edit/ToolBar.tsx +101 -0
- package/templates/src/components/edit/ToolMode.tsx +121 -0
- package/templates/src/components/edit/context/ContextPaneConfig.tsx +91 -0
- package/templates/src/components/edit/context/ContextPaneConfig_slug.tsx +174 -0
- package/templates/src/components/edit/context/ContextPaneConfig_title.tsx +186 -0
- package/templates/src/components/edit/pane/AddPanePanel.tsx +136 -0
- package/templates/src/components/edit/pane/AddPanePanel_break.tsx +470 -0
- package/templates/src/components/edit/pane/AddPanePanel_codehook.tsx +264 -0
- package/templates/src/components/edit/pane/AddPanePanel_new.tsx +623 -0
- package/templates/src/components/edit/pane/AddPanePanel_newAICopy.tsx +107 -0
- package/templates/src/components/edit/pane/AddPanePanel_newAICopy_modal.tsx +217 -0
- package/templates/src/components/edit/pane/AddPanePanel_newCopyMode.tsx +109 -0
- package/templates/src/components/edit/pane/AddPanePanel_newCustomCopy.tsx +39 -0
- package/templates/src/components/edit/pane/AddPanePanel_reuse.tsx +445 -0
- package/templates/src/components/edit/pane/ConfigPanePanel.tsx +245 -0
- package/templates/src/components/edit/pane/PageGen.tsx +485 -0
- package/templates/src/components/edit/pane/PageGenSelector.tsx +238 -0
- package/templates/src/components/edit/pane/PageGenSpecial.tsx +362 -0
- package/templates/src/components/edit/pane/PageGen_preview.tsx +495 -0
- package/templates/src/components/edit/pane/PanePanel_impression.tsx +258 -0
- package/templates/src/components/edit/pane/PanePanel_path.tsx +268 -0
- package/templates/src/components/edit/pane/PanePanel_slug.tsx +219 -0
- package/templates/src/components/edit/pane/PanePanel_title.tsx +142 -0
- package/templates/src/components/edit/panels/StyleBreakPanel.tsx +182 -0
- package/templates/src/components/edit/panels/StyleCodeHookPanel.tsx +439 -0
- package/templates/src/components/edit/panels/StyleElementPanel.tsx +177 -0
- package/templates/src/components/edit/panels/StyleElementPanel_add.tsx +349 -0
- package/templates/src/components/edit/panels/StyleElementPanel_remove.tsx +159 -0
- package/templates/src/components/edit/panels/StyleElementPanel_update.tsx +320 -0
- package/templates/src/components/edit/panels/StyleImagePanel.tsx +460 -0
- package/templates/src/components/edit/panels/StyleImagePanel_add.tsx +296 -0
- package/templates/src/components/edit/panels/StyleImagePanel_remove.tsx +153 -0
- package/templates/src/components/edit/panels/StyleImagePanel_update.tsx +312 -0
- package/templates/src/components/edit/panels/StyleLiElementPanel.tsx +273 -0
- package/templates/src/components/edit/panels/StyleLiElementPanel_add.tsx +301 -0
- package/templates/src/components/edit/panels/StyleLiElementPanel_remove.tsx +132 -0
- package/templates/src/components/edit/panels/StyleLiElementPanel_update.tsx +313 -0
- package/templates/src/components/edit/panels/StyleLinkPanel.tsx +346 -0
- package/templates/src/components/edit/panels/StyleLinkPanel_add.tsx +265 -0
- package/templates/src/components/edit/panels/StyleLinkPanel_config.tsx +240 -0
- package/templates/src/components/edit/panels/StyleLinkPanel_remove.tsx +94 -0
- package/templates/src/components/edit/panels/StyleLinkPanel_update.tsx +110 -0
- package/templates/src/components/edit/panels/StyleParentPanel.tsx +263 -0
- package/templates/src/components/edit/panels/StyleParentPanel_add.tsx +275 -0
- package/templates/src/components/edit/panels/StyleParentPanel_deleteLayer.tsx +112 -0
- package/templates/src/components/edit/panels/StyleParentPanel_remove.tsx +87 -0
- package/templates/src/components/edit/panels/StyleParentPanel_update.tsx +141 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel.tsx +428 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel_add.tsx +292 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel_config.tsx +190 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel_remove.tsx +152 -0
- package/templates/src/components/edit/panels/StyleWidgetPanel_update.tsx +308 -0
- package/templates/src/components/edit/state/SaveModal.tsx +811 -0
- package/templates/src/components/edit/state/StylesMemory.tsx +310 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentConfigPanel.tsx +289 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentPanel_menu.tsx +320 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentPanel_og.tsx +888 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentPanel_slug.tsx +269 -0
- package/templates/src/components/edit/storyfragment/StoryFragmentPanel_title.tsx +190 -0
- package/templates/src/components/edit/widgets/BeliefWidget.tsx +183 -0
- package/templates/src/components/edit/widgets/BunnyWidget.tsx +134 -0
- package/templates/src/components/edit/widgets/IdentifyAsWidget.tsx +193 -0
- package/templates/src/components/edit/widgets/SignupWidget.tsx +177 -0
- package/templates/src/components/edit/widgets/ToggleWidget.tsx +152 -0
- package/templates/src/components/edit/widgets/YouTubeWidget.tsx +65 -0
- package/templates/src/components/fields/ActionBuilderTimeSelector.tsx +353 -0
- package/templates/src/components/fields/ArtpackImage.tsx +480 -0
- package/templates/src/components/fields/BackgroundImage.tsx +530 -0
- package/templates/src/components/fields/BackgroundImageWrapper.tsx +192 -0
- package/templates/src/components/fields/BooleanParam.tsx +67 -0
- package/templates/src/components/fields/BunnyMomentSelector.tsx +56 -0
- package/templates/src/components/fields/ColorPickerCombo.tsx +284 -0
- package/templates/src/components/fields/ImageUpload.tsx +405 -0
- package/templates/src/components/fields/MultiParam.tsx +75 -0
- package/templates/src/components/fields/PaneBreakCollectionSelector.tsx +97 -0
- package/templates/src/components/fields/PaneBreakShapeSelector.tsx +134 -0
- package/templates/src/components/fields/SelectedTailwindClass.tsx +44 -0
- package/templates/src/components/fields/SingleParam.tsx +73 -0
- package/templates/src/components/fields/ViewportComboBox.tsx +252 -0
- package/templates/src/components/form/ActionBuilderField.tsx +282 -0
- package/templates/src/components/form/ActionBuilderSlugSelector.tsx +182 -0
- package/templates/src/components/form/BooleanToggle.tsx +94 -0
- package/templates/src/components/form/ColorPicker.tsx +153 -0
- package/templates/src/components/form/DateTimeInput.tsx +638 -0
- package/templates/src/components/form/EnumSelect.tsx +88 -0
- package/templates/src/components/form/FileUpload.tsx +465 -0
- package/templates/src/components/form/MagicPathBuilder.tsx +546 -0
- package/templates/src/components/form/NumberInput.tsx +101 -0
- package/templates/src/components/form/ParagraphArrayInput.tsx +207 -0
- package/templates/src/components/form/StringArrayInput.tsx +163 -0
- package/templates/src/components/form/StringInput.tsx +88 -0
- package/templates/src/components/form/UnsavedChangesBar.tsx +295 -0
- package/templates/src/components/form/advanced/APIConfigSection.tsx +69 -0
- package/templates/src/components/form/advanced/AuthConfigSection.tsx +97 -0
- package/templates/src/components/form/brand/BrandAssetsSection.tsx +93 -0
- package/templates/src/components/form/brand/BrandColorsSection.tsx +201 -0
- package/templates/src/components/form/brand/SEOSection.tsx +101 -0
- package/templates/src/components/form/brand/SiteConfigSection.tsx +61 -0
- package/templates/src/components/form/brand/SocialLinksSection.tsx +393 -0
- package/templates/src/components/profile/ProfileConsent.tsx +65 -0
- package/templates/src/components/profile/ProfileCreate.tsx +462 -0
- package/templates/src/components/profile/ProfileEdit.tsx +409 -0
- package/templates/src/components/profile/ProfileSwitch.tsx +255 -0
- package/templates/src/components/profile/ProfileUnlock.tsx +221 -0
- package/templates/src/components/storykeep/Dashboard.tsx +160 -0
- package/templates/src/components/storykeep/Dashboard_Activity.tsx +56 -0
- package/templates/src/components/storykeep/Dashboard_Advanced.tsx +165 -0
- package/templates/src/components/storykeep/Dashboard_Analytics.tsx +451 -0
- package/templates/src/components/storykeep/Dashboard_Branding.tsx +95 -0
- package/templates/src/components/storykeep/Dashboard_Content.tsx +191 -0
- package/templates/src/components/storykeep/controls/UsageCell.tsx +71 -0
- package/templates/src/components/storykeep/controls/content/BeliefForm.tsx +378 -0
- package/templates/src/components/storykeep/controls/content/BeliefTable.tsx +329 -0
- package/templates/src/components/storykeep/controls/content/ContentBrowser.tsx +385 -0
- package/templates/src/components/storykeep/controls/content/ContentSummary.tsx +149 -0
- package/templates/src/components/storykeep/controls/content/KnownResourceForm.tsx +397 -0
- package/templates/src/components/storykeep/controls/content/KnownResourceTable.tsx +260 -0
- package/templates/src/components/storykeep/controls/content/ManageContent.tsx +439 -0
- package/templates/src/components/storykeep/controls/content/MenuForm.tsx +239 -0
- package/templates/src/components/storykeep/controls/content/MenuTable.tsx +332 -0
- package/templates/src/components/storykeep/controls/content/ResourceBulkIngest.tsx +724 -0
- package/templates/src/components/storykeep/controls/content/ResourceForm.tsx +355 -0
- package/templates/src/components/storykeep/controls/content/ResourceTable.tsx +222 -0
- package/templates/src/components/storykeep/controls/content/StoryFragmentTable.tsx +482 -0
- package/templates/src/components/storykeep/state/BrandingWrapper.tsx +42 -0
- package/templates/src/components/storykeep/state/FetchAnalytics.tsx +350 -0
- package/templates/src/components/storykeep/widgets/ResponsiveLine.tsx +319 -0
- package/templates/src/components/storykeep/widgets/Wizard.tsx +278 -0
- package/templates/src/components/tenant/RegistrationForm.tsx +447 -0
- package/templates/src/components/widgets/BunnyVideoHero.astro +775 -0
- package/templates/src/components/widgets/Impression.tsx +102 -0
- package/templates/src/components/widgets/ImpressionWrapper.tsx +214 -0
- package/templates/src/constants/beliefs.ts +61 -0
- package/templates/src/constants/brandThemes.ts +133 -0
- package/templates/src/constants/prompts.json +55 -0
- package/templates/src/constants/shapes.ts +556 -0
- package/templates/src/constants/stopWords.ts +116 -0
- package/templates/src/constants/tailwindColors.json +344 -0
- package/templates/src/constants.ts +274 -0
- package/templates/src/hooks/useFormState.ts +203 -0
- package/templates/src/layouts/Layout.astro +290 -0
- package/templates/src/lib/session.ts +126 -0
- package/templates/src/lib/storyData.ts +56 -0
- package/templates/src/middleware.ts +52 -0
- package/templates/src/pages/404.astro +54 -0
- package/templates/src/pages/[...slug]/edit.astro +216 -0
- package/templates/src/pages/[...slug].astro +148 -0
- package/templates/src/pages/api/auth/decode.ts +101 -0
- package/templates/src/pages/api/auth/login.ts +122 -0
- package/templates/src/pages/api/auth/logout.ts +37 -0
- package/templates/src/pages/api/auth/profile.ts +76 -0
- package/templates/src/pages/api/orphan-analysis.ts +106 -0
- package/templates/src/pages/api/tailwind.ts +116 -0
- package/templates/src/pages/collections/[param1].astro +65 -0
- package/templates/src/pages/context/[...contextSlug]/edit.astro +207 -0
- package/templates/src/pages/context/[...contextSlug].astro +161 -0
- package/templates/src/pages/llms.txt.ts +122 -0
- package/templates/src/pages/maint.astro +183 -0
- package/templates/src/pages/media/[...slug].astro +67 -0
- package/templates/src/pages/robots.txt.ts +36 -0
- package/templates/src/pages/sandbox/activate.astro +258 -0
- package/templates/src/pages/sandbox/register.astro +44 -0
- package/templates/src/pages/sandbox/success.astro +179 -0
- package/templates/src/pages/sitemap.xml.ts +119 -0
- package/templates/src/pages/storykeep/advanced.astro +69 -0
- package/templates/src/pages/storykeep/branding.astro +57 -0
- package/templates/src/pages/storykeep/content.astro +71 -0
- package/templates/src/pages/storykeep/init.astro +36 -0
- package/templates/src/pages/storykeep/login.astro +266 -0
- package/templates/src/pages/storykeep/logout.astro +84 -0
- package/templates/src/pages/storykeep/profile.astro +98 -0
- package/templates/src/pages/storykeep.astro +81 -0
- package/templates/src/stores/analytics.ts +171 -0
- package/templates/src/stores/backend.ts +16 -0
- package/templates/src/stores/navigation.ts +149 -0
- package/templates/src/stores/nodes.ts +2390 -0
- package/templates/src/stores/nodesHistory.ts +85 -0
- package/templates/src/stores/notificationSystem.ts +41 -0
- package/templates/src/stores/orphanAnalysis.ts +409 -0
- package/templates/src/stores/storykeep.ts +247 -0
- package/templates/src/types/astro.ts +86 -0
- package/templates/src/types/compositorTypes.ts +456 -0
- package/templates/src/types/formTypes.ts +281 -0
- package/templates/src/types/multiTenant.ts +77 -0
- package/templates/src/types/nodeProps.ts +66 -0
- package/templates/src/types/tractstack.ts +445 -0
- package/templates/src/utils/aai/getTitleSlug.ts +72 -0
- package/templates/src/utils/actions/actionButton.ts +101 -0
- package/templates/src/utils/actions/lispLexer.ts +57 -0
- package/templates/src/utils/actions/preParse_Action.ts +85 -0
- package/templates/src/utils/actions/preParse_Bunny.ts +50 -0
- package/templates/src/utils/actions/preParse_Clicked.ts +87 -0
- package/templates/src/utils/actions/preParse_Impression.ts +71 -0
- package/templates/src/utils/api/advancedConfig.ts +66 -0
- package/templates/src/utils/api/advancedHelpers.ts +134 -0
- package/templates/src/utils/api/beliefConfig.ts +87 -0
- package/templates/src/utils/api/beliefHelpers.ts +196 -0
- package/templates/src/utils/api/brandConfig.ts +126 -0
- package/templates/src/utils/api/brandHelpers.ts +155 -0
- package/templates/src/utils/api/fileHelpers.ts +306 -0
- package/templates/src/utils/api/menuConfig.ts +57 -0
- package/templates/src/utils/api/menuHelpers.ts +156 -0
- package/templates/src/utils/api/resourceConfig.ts +158 -0
- package/templates/src/utils/api/resourceHelpers.ts +72 -0
- package/templates/src/utils/api/tenantConfig.ts +97 -0
- package/templates/src/utils/api/tenantHelpers.ts +172 -0
- package/templates/src/utils/api.ts +183 -0
- package/templates/src/utils/auth.ts +150 -0
- package/templates/src/utils/backend.ts +243 -0
- package/templates/src/utils/compositor/TemplateMarkdowns.ts +118 -0
- package/templates/src/utils/compositor/TemplateNodes.ts +138 -0
- package/templates/src/utils/compositor/TemplatePanes.ts +100 -0
- package/templates/src/utils/compositor/allowInsert.ts +100 -0
- package/templates/src/utils/compositor/domHelpers.ts +37 -0
- package/templates/src/utils/compositor/handleClickEvent.ts +131 -0
- package/templates/src/utils/compositor/nodesHelper.ts +491 -0
- package/templates/src/utils/compositor/nodesMarkdownGenerator.ts +292 -0
- package/templates/src/utils/compositor/processMarkdown.ts +431 -0
- package/templates/src/utils/compositor/reduceNodesClassNames.ts +192 -0
- package/templates/src/utils/compositor/tailwindClasses.ts +1795 -0
- package/templates/src/utils/compositor/tailwindColors.ts +227 -0
- package/templates/src/utils/compositor/templateMarkdownStyles.ts +1265 -0
- package/templates/src/utils/compositor/typeGuards.ts +193 -0
- package/templates/src/utils/etl/extractor.ts +119 -0
- package/templates/src/utils/etl/index.ts +88 -0
- package/templates/src/utils/etl/loader.ts +36 -0
- package/templates/src/utils/etl/transformer.ts +286 -0
- package/templates/src/utils/helpers.ts +435 -0
- package/templates/src/utils/layout.ts +209 -0
- package/templates/src/utils/profileStorage.ts +306 -0
- package/templates/src/utils/useInterval.ts +27 -0
- package/templates/tailwind.config.cjs +169 -0
- package/utils/create-resolver.ts +10 -0
- package/utils/inject-files.ts +2140 -0
- package/utils/validate-config.ts +43 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
2
|
+
import { GOTO_TARGETS } from '@/constants';
|
|
3
|
+
import ActionBuilderSlugSelector from './ActionBuilderSlugSelector';
|
|
4
|
+
import type { FullContentMapItem } from '@/types/tractstack';
|
|
5
|
+
|
|
6
|
+
interface ActionBuilderFieldProps {
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
contentMap: FullContentMapItem[];
|
|
10
|
+
label?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
slug?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default function ActionBuilderField({
|
|
16
|
+
value,
|
|
17
|
+
onChange,
|
|
18
|
+
contentMap,
|
|
19
|
+
label = 'Navigation Action',
|
|
20
|
+
error,
|
|
21
|
+
slug,
|
|
22
|
+
}: ActionBuilderFieldProps) {
|
|
23
|
+
const [selectedTarget, setSelectedTarget] = useState<string>('');
|
|
24
|
+
const [selectedSubcommand, setSelectedSubcommand] = useState<string>('');
|
|
25
|
+
const [param1, setParam1] = useState<string>('');
|
|
26
|
+
const [param2, setParam2] = useState<string>('');
|
|
27
|
+
//const [param3, setParam3] = useState<string>('');
|
|
28
|
+
|
|
29
|
+
// Parse existing value on mount/change
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (value) {
|
|
32
|
+
try {
|
|
33
|
+
const match = value.match(/\(goto\s+\(([^)]+)\)/);
|
|
34
|
+
if (match) {
|
|
35
|
+
const parts = match[1].split(' ').filter(Boolean);
|
|
36
|
+
if (parts.length > 0) {
|
|
37
|
+
setSelectedTarget(parts[0]);
|
|
38
|
+
if (GOTO_TARGETS[parts[0]]?.subcommands) {
|
|
39
|
+
if (parts.length > 1) setSelectedSubcommand(parts[1]);
|
|
40
|
+
} else {
|
|
41
|
+
if (parts.length > 1) setParam1(parts[1]);
|
|
42
|
+
if (parts.length > 2) setParam2(parts[2]);
|
|
43
|
+
//if (parts.length > 3) setParam3(parts[3]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} catch (e) {
|
|
48
|
+
console.error('Error parsing action value:', e);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, [value]);
|
|
52
|
+
|
|
53
|
+
const updateValue = (
|
|
54
|
+
target: string,
|
|
55
|
+
sub: string = '',
|
|
56
|
+
p1: string = '',
|
|
57
|
+
p2: string = '',
|
|
58
|
+
p3: string = ''
|
|
59
|
+
) => {
|
|
60
|
+
let newValue = `(goto (${target}`;
|
|
61
|
+
if (GOTO_TARGETS[target]?.subcommands) {
|
|
62
|
+
if (sub) newValue += ` ${sub}`;
|
|
63
|
+
} else {
|
|
64
|
+
if (p1) newValue += ` ${p1}`;
|
|
65
|
+
if (p2) newValue += ` ${p2}`;
|
|
66
|
+
if (p3) newValue += ` ${p3}`;
|
|
67
|
+
}
|
|
68
|
+
newValue += '))';
|
|
69
|
+
onChange(newValue);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const targetOptions = useMemo(() => {
|
|
73
|
+
return Object.entries(GOTO_TARGETS).map(([key, data]) => ({
|
|
74
|
+
value: key,
|
|
75
|
+
label: data.name,
|
|
76
|
+
}));
|
|
77
|
+
}, []);
|
|
78
|
+
|
|
79
|
+
const subcommandOptions = useMemo(() => {
|
|
80
|
+
if (!selectedTarget || !GOTO_TARGETS[selectedTarget]?.subcommands) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
return GOTO_TARGETS[selectedTarget].subcommands!.map((cmd) => ({
|
|
84
|
+
value: cmd,
|
|
85
|
+
label: cmd,
|
|
86
|
+
}));
|
|
87
|
+
}, [selectedTarget]);
|
|
88
|
+
|
|
89
|
+
const handleTargetChange = (newTarget: string) => {
|
|
90
|
+
setSelectedTarget(newTarget);
|
|
91
|
+
setSelectedSubcommand('');
|
|
92
|
+
setParam1('');
|
|
93
|
+
setParam2('');
|
|
94
|
+
//setParam3('');
|
|
95
|
+
updateValue(newTarget);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const handleSubcommandChange = (newSubcommand: string) => {
|
|
99
|
+
setSelectedSubcommand(newSubcommand);
|
|
100
|
+
updateValue(selectedTarget, newSubcommand);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const renderParamInput = (paramType: 'param1' | 'param2') => {
|
|
104
|
+
const isParam1 = paramType === 'param1';
|
|
105
|
+
const currentValue = isParam1 ? param1 : param2;
|
|
106
|
+
|
|
107
|
+
switch (selectedTarget) {
|
|
108
|
+
case 'context':
|
|
109
|
+
return (
|
|
110
|
+
isParam1 && (
|
|
111
|
+
<ActionBuilderSlugSelector
|
|
112
|
+
type="context"
|
|
113
|
+
value={currentValue}
|
|
114
|
+
onSelect={(newValue) => {
|
|
115
|
+
setParam1(newValue);
|
|
116
|
+
updateValue(selectedTarget, '', newValue, param2);
|
|
117
|
+
}}
|
|
118
|
+
label="Select Context Pane"
|
|
119
|
+
contentMap={contentMap}
|
|
120
|
+
/>
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
case 'storyFragment':
|
|
125
|
+
return (
|
|
126
|
+
isParam1 && (
|
|
127
|
+
<ActionBuilderSlugSelector
|
|
128
|
+
type="storyFragment"
|
|
129
|
+
value={currentValue}
|
|
130
|
+
onSelect={(newValue) => {
|
|
131
|
+
setParam1(newValue);
|
|
132
|
+
updateValue(selectedTarget, '', newValue);
|
|
133
|
+
}}
|
|
134
|
+
label="Select Story Fragment"
|
|
135
|
+
contentMap={contentMap}
|
|
136
|
+
/>
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
case 'storyFragmentPane':
|
|
141
|
+
if (isParam1) {
|
|
142
|
+
return (
|
|
143
|
+
<ActionBuilderSlugSelector
|
|
144
|
+
type="storyFragment"
|
|
145
|
+
value={currentValue}
|
|
146
|
+
onSelect={(newValue) => {
|
|
147
|
+
setParam1(newValue);
|
|
148
|
+
setParam2(''); // Reset pane selection
|
|
149
|
+
updateValue(selectedTarget, '', newValue, '');
|
|
150
|
+
}}
|
|
151
|
+
label="Select Story Fragment"
|
|
152
|
+
contentMap={contentMap}
|
|
153
|
+
/>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
return (
|
|
157
|
+
!isParam1 &&
|
|
158
|
+
param1 && (
|
|
159
|
+
<ActionBuilderSlugSelector
|
|
160
|
+
type="pane"
|
|
161
|
+
value={currentValue}
|
|
162
|
+
onSelect={(newValue) => {
|
|
163
|
+
setParam2(newValue);
|
|
164
|
+
updateValue(selectedTarget, '', param1, newValue);
|
|
165
|
+
}}
|
|
166
|
+
label="Select Pane"
|
|
167
|
+
contentMap={contentMap}
|
|
168
|
+
parentSlug={param1}
|
|
169
|
+
/>
|
|
170
|
+
)
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
case 'bunny':
|
|
174
|
+
if (isParam1 && slug) {
|
|
175
|
+
if (!currentValue) setParam1(slug);
|
|
176
|
+
return (
|
|
177
|
+
<ActionBuilderSlugSelector
|
|
178
|
+
type="storyFragment"
|
|
179
|
+
value={currentValue || slug}
|
|
180
|
+
onSelect={(newValue) => {
|
|
181
|
+
setParam1(newValue);
|
|
182
|
+
setParam2(''); // Reset time selection when story fragment changes
|
|
183
|
+
updateValue(selectedTarget, '', newValue, '');
|
|
184
|
+
}}
|
|
185
|
+
label="Select Story Fragment"
|
|
186
|
+
contentMap={contentMap}
|
|
187
|
+
/>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
|
|
192
|
+
case 'url':
|
|
193
|
+
return (
|
|
194
|
+
isParam1 && (
|
|
195
|
+
<div className="space-y-2">
|
|
196
|
+
<label className="block text-sm font-bold text-gray-700">
|
|
197
|
+
External URL
|
|
198
|
+
</label>
|
|
199
|
+
<input
|
|
200
|
+
type="text"
|
|
201
|
+
value={currentValue}
|
|
202
|
+
onChange={(e) => {
|
|
203
|
+
const newValue = e.target.value;
|
|
204
|
+
setParam1(newValue);
|
|
205
|
+
updateValue(selectedTarget, '', newValue);
|
|
206
|
+
}}
|
|
207
|
+
placeholder="https://..."
|
|
208
|
+
className="w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-cyan-700 focus:ring-cyan-700"
|
|
209
|
+
/>
|
|
210
|
+
</div>
|
|
211
|
+
)
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
default:
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<div className="space-y-4">
|
|
221
|
+
{label && (
|
|
222
|
+
<label className="block text-sm font-bold text-gray-700">{label}</label>
|
|
223
|
+
)}
|
|
224
|
+
|
|
225
|
+
{/* Target Selection */}
|
|
226
|
+
<div className="space-y-2">
|
|
227
|
+
<label className="block text-sm text-gray-700">Navigation Target</label>
|
|
228
|
+
<select
|
|
229
|
+
value={selectedTarget}
|
|
230
|
+
onChange={(e) => handleTargetChange(e.target.value)}
|
|
231
|
+
className="w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-cyan-700 focus:ring-cyan-700"
|
|
232
|
+
>
|
|
233
|
+
<option value="">Select a target...</option>
|
|
234
|
+
{targetOptions.map((option) => (
|
|
235
|
+
<option key={option.value} value={option.value}>
|
|
236
|
+
{option.label}
|
|
237
|
+
</option>
|
|
238
|
+
))}
|
|
239
|
+
</select>
|
|
240
|
+
|
|
241
|
+
{GOTO_TARGETS[selectedTarget] && (
|
|
242
|
+
<p className="mt-1 text-sm text-gray-500">
|
|
243
|
+
{GOTO_TARGETS[selectedTarget].description}
|
|
244
|
+
</p>
|
|
245
|
+
)}
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
{/* Subcommand Selection */}
|
|
249
|
+
{selectedTarget && GOTO_TARGETS[selectedTarget]?.subcommands && (
|
|
250
|
+
<div className="space-y-2">
|
|
251
|
+
<label className="block text-sm text-gray-700">Section</label>
|
|
252
|
+
<select
|
|
253
|
+
value={selectedSubcommand}
|
|
254
|
+
onChange={(e) => handleSubcommandChange(e.target.value)}
|
|
255
|
+
className="w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-cyan-700 focus:ring-cyan-700"
|
|
256
|
+
>
|
|
257
|
+
<option value="">Select a section...</option>
|
|
258
|
+
{subcommandOptions.map((option) => (
|
|
259
|
+
<option key={option.value} value={option.value}>
|
|
260
|
+
{option.label}
|
|
261
|
+
</option>
|
|
262
|
+
))}
|
|
263
|
+
</select>
|
|
264
|
+
</div>
|
|
265
|
+
)}
|
|
266
|
+
|
|
267
|
+
{/* Parameter 1 */}
|
|
268
|
+
{selectedTarget &&
|
|
269
|
+
GOTO_TARGETS[selectedTarget]?.requiresParam &&
|
|
270
|
+
!GOTO_TARGETS[selectedTarget].subcommands &&
|
|
271
|
+
renderParamInput('param1')}
|
|
272
|
+
|
|
273
|
+
{/* Parameter 2 */}
|
|
274
|
+
{selectedTarget &&
|
|
275
|
+
GOTO_TARGETS[selectedTarget]?.requiresSecondParam &&
|
|
276
|
+
param1 &&
|
|
277
|
+
renderParamInput('param2')}
|
|
278
|
+
|
|
279
|
+
{error && <p className="text-sm text-red-600">{error}</p>}
|
|
280
|
+
</div>
|
|
281
|
+
);
|
|
282
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { useMemo, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Combobox } from '@ark-ui/react';
|
|
3
|
+
import { createListCollection } from '@ark-ui/react/collection';
|
|
4
|
+
import ChevronUpDownIcon from '@heroicons/react/24/outline/ChevronUpDownIcon';
|
|
5
|
+
import CheckIcon from '@heroicons/react/24/outline/CheckIcon';
|
|
6
|
+
import type { FullContentMapItem } from '@/types/tractstack';
|
|
7
|
+
|
|
8
|
+
interface ActionBuilderSlugSelectorProps {
|
|
9
|
+
type: 'storyFragment' | 'context' | 'pane';
|
|
10
|
+
value: string;
|
|
11
|
+
onSelect: (value: string) => void;
|
|
12
|
+
query?: string;
|
|
13
|
+
setQuery?: (query: string) => void;
|
|
14
|
+
label: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
contentMap: FullContentMapItem[];
|
|
17
|
+
parentSlug?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const ActionBuilderSlugSelector = ({
|
|
21
|
+
type,
|
|
22
|
+
value,
|
|
23
|
+
onSelect,
|
|
24
|
+
query: externalQuery,
|
|
25
|
+
setQuery: externalSetQuery,
|
|
26
|
+
label,
|
|
27
|
+
placeholder = 'Search...',
|
|
28
|
+
contentMap,
|
|
29
|
+
parentSlug,
|
|
30
|
+
}: ActionBuilderSlugSelectorProps) => {
|
|
31
|
+
// Use internal query state if external query/setQuery not provided
|
|
32
|
+
const [internalQuery, setInternalQuery] = useState('');
|
|
33
|
+
|
|
34
|
+
// Determine which query and setQuery to use
|
|
35
|
+
const query = externalQuery !== undefined ? externalQuery : internalQuery;
|
|
36
|
+
const setQuery = externalSetQuery || setInternalQuery;
|
|
37
|
+
|
|
38
|
+
// Use a ref to track if the initial sync has occurred
|
|
39
|
+
const initialSyncDone = useRef(false);
|
|
40
|
+
|
|
41
|
+
// Filter items based on type and query
|
|
42
|
+
const filteredItems = useMemo(() => {
|
|
43
|
+
let items: FullContentMapItem[] = [];
|
|
44
|
+
switch (type) {
|
|
45
|
+
case 'storyFragment':
|
|
46
|
+
items = contentMap.filter((item) => item.type === 'StoryFragment');
|
|
47
|
+
break;
|
|
48
|
+
case 'context':
|
|
49
|
+
items = contentMap.filter(
|
|
50
|
+
(item) =>
|
|
51
|
+
item.type === 'Pane' && 'isContext' in item && item.isContext
|
|
52
|
+
);
|
|
53
|
+
break;
|
|
54
|
+
case 'pane': {
|
|
55
|
+
if (parentSlug) {
|
|
56
|
+
const parentFragment = contentMap.find(
|
|
57
|
+
(item) => item.type === 'StoryFragment' && item.slug === parentSlug
|
|
58
|
+
) as (FullContentMapItem & { panes?: string[] }) | undefined;
|
|
59
|
+
|
|
60
|
+
if (parentFragment?.panes) {
|
|
61
|
+
items = contentMap.filter(
|
|
62
|
+
(item) =>
|
|
63
|
+
item.type === 'Pane' &&
|
|
64
|
+
'isContext' in item &&
|
|
65
|
+
!item.isContext &&
|
|
66
|
+
parentFragment.panes?.includes(item.id)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return items.filter(
|
|
75
|
+
(item) =>
|
|
76
|
+
item.title.toLowerCase().includes(query.toLowerCase()) ||
|
|
77
|
+
item.slug.toLowerCase().includes(query.toLowerCase())
|
|
78
|
+
);
|
|
79
|
+
}, [contentMap, type, query, parentSlug]);
|
|
80
|
+
|
|
81
|
+
// Create collection
|
|
82
|
+
const collection = useMemo(() => {
|
|
83
|
+
return createListCollection({
|
|
84
|
+
items: filteredItems,
|
|
85
|
+
itemToValue: (item) => item.slug,
|
|
86
|
+
itemToString: (item) => `${item.title} (${item.slug})`,
|
|
87
|
+
});
|
|
88
|
+
}, [filteredItems]);
|
|
89
|
+
|
|
90
|
+
// Perform initial sync of value to query display
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
// Only perform this sync once or when value changes
|
|
93
|
+
if (!initialSyncDone.current || (value && query === '')) {
|
|
94
|
+
initialSyncDone.current = true;
|
|
95
|
+
|
|
96
|
+
if (value) {
|
|
97
|
+
const selectedItem = contentMap.find((item) => item.slug === value);
|
|
98
|
+
if (selectedItem) {
|
|
99
|
+
// This won't cause an infinite loop because we're not including setQuery in dependencies
|
|
100
|
+
setQuery(`${selectedItem.title} (${selectedItem.slug})`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}, [value, contentMap, query]);
|
|
105
|
+
|
|
106
|
+
const comboboxItemStyles = `
|
|
107
|
+
.slug-item[data-highlighted] {
|
|
108
|
+
background-color: #0891b2;
|
|
109
|
+
color: white;
|
|
110
|
+
}
|
|
111
|
+
.slug-item[data-highlighted] .slug-indicator {
|
|
112
|
+
color: white;
|
|
113
|
+
}
|
|
114
|
+
.slug-item[data-state="checked"] .slug-indicator {
|
|
115
|
+
display: flex;
|
|
116
|
+
}
|
|
117
|
+
.slug-item .slug-indicator {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
.slug-item[data-state="checked"] {
|
|
121
|
+
font-weight: bold;
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<div className="space-y-2">
|
|
127
|
+
<style>{comboboxItemStyles}</style>
|
|
128
|
+
<label className="block text-sm text-gray-700">{label}</label>
|
|
129
|
+
<Combobox.Root
|
|
130
|
+
collection={collection}
|
|
131
|
+
value={value ? [value] : []}
|
|
132
|
+
inputValue={query}
|
|
133
|
+
onValueChange={(details) => {
|
|
134
|
+
const selectedValue = details.value[0] || '';
|
|
135
|
+
onSelect(selectedValue);
|
|
136
|
+
}}
|
|
137
|
+
onInputValueChange={(details) => {
|
|
138
|
+
setQuery(details.inputValue);
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
<div className="relative">
|
|
142
|
+
<Combobox.Input
|
|
143
|
+
className="w-full rounded-md border border-gray-300 px-3 py-2 pr-10 shadow-sm focus:border-cyan-700 focus:ring-cyan-700"
|
|
144
|
+
placeholder={placeholder}
|
|
145
|
+
/>
|
|
146
|
+
<Combobox.Trigger className="absolute inset-y-0 right-0 flex items-center pr-2">
|
|
147
|
+
<ChevronUpDownIcon
|
|
148
|
+
className="h-5 w-5 text-gray-400"
|
|
149
|
+
aria-hidden="true"
|
|
150
|
+
/>
|
|
151
|
+
</Combobox.Trigger>
|
|
152
|
+
</div>
|
|
153
|
+
|
|
154
|
+
<Combobox.Content className="absolute z-10 mt-1 max-h-60 w-full max-w-md overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
|
|
155
|
+
{filteredItems.length === 0 ? (
|
|
156
|
+
<div className="relative cursor-default select-none px-4 py-2 text-gray-700">
|
|
157
|
+
{query ? 'No matching items found' : 'No items available'}
|
|
158
|
+
</div>
|
|
159
|
+
) : (
|
|
160
|
+
filteredItems.map((item) => (
|
|
161
|
+
<Combobox.Item
|
|
162
|
+
key={item.id}
|
|
163
|
+
item={item}
|
|
164
|
+
className="slug-item relative cursor-default select-none py-2 pl-10 pr-4 text-gray-900"
|
|
165
|
+
>
|
|
166
|
+
<span className="block truncate">
|
|
167
|
+
{item.title}
|
|
168
|
+
<span className="ml-2 text-sm opacity-60">({item.slug})</span>
|
|
169
|
+
</span>
|
|
170
|
+
<span className="slug-indicator absolute inset-y-0 left-0 flex items-center pl-3 text-cyan-600">
|
|
171
|
+
<CheckIcon className="h-5 w-5" aria-hidden="true" />
|
|
172
|
+
</span>
|
|
173
|
+
</Combobox.Item>
|
|
174
|
+
))
|
|
175
|
+
)}
|
|
176
|
+
</Combobox.Content>
|
|
177
|
+
</Combobox.Root>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export default ActionBuilderSlugSelector;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Switch } from '@ark-ui/react/switch';
|
|
2
|
+
import { classNames } from '@/utils/helpers';
|
|
3
|
+
|
|
4
|
+
interface BooleanToggleProps {
|
|
5
|
+
value: boolean;
|
|
6
|
+
onChange: (value: boolean) => void;
|
|
7
|
+
label?: string;
|
|
8
|
+
error?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
description?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
size?: 'sm' | 'md' | 'lg';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const BooleanToggle = ({
|
|
17
|
+
value,
|
|
18
|
+
onChange,
|
|
19
|
+
label,
|
|
20
|
+
error,
|
|
21
|
+
disabled = false,
|
|
22
|
+
description,
|
|
23
|
+
required = false,
|
|
24
|
+
className,
|
|
25
|
+
size = 'md',
|
|
26
|
+
}: BooleanToggleProps) => {
|
|
27
|
+
const handleCheckedChange = (details: { checked: boolean }) => {
|
|
28
|
+
onChange(details.checked);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Simple inline styles for reliable animation
|
|
32
|
+
const controlStyle = {
|
|
33
|
+
width: size === 'sm' ? '28px' : size === 'lg' ? '44px' : '36px',
|
|
34
|
+
height: size === 'sm' ? '16px' : size === 'lg' ? '24px' : '20px',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const thumbStyle = {
|
|
38
|
+
width: size === 'sm' ? '12px' : size === 'lg' ? '20px' : '16px',
|
|
39
|
+
height: size === 'sm' ? '12px' : size === 'lg' ? '20px' : '16px',
|
|
40
|
+
transform: value
|
|
41
|
+
? `translateX(${size === 'sm' ? '12px' : size === 'lg' ? '20px' : '16px'})`
|
|
42
|
+
: 'translateX(0px)',
|
|
43
|
+
transition: 'transform 0.2s ease-in-out',
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div className={classNames('space-y-2', className || '')}>
|
|
48
|
+
<Switch.Root
|
|
49
|
+
checked={value}
|
|
50
|
+
onCheckedChange={handleCheckedChange}
|
|
51
|
+
disabled={disabled}
|
|
52
|
+
>
|
|
53
|
+
<div className="flex items-center space-x-3">
|
|
54
|
+
<Switch.Control
|
|
55
|
+
className={classNames(
|
|
56
|
+
'relative inline-flex items-center rounded-full border-2 border-transparent focus:outline-none focus:ring-2 focus:ring-cyan-500 focus:ring-offset-2',
|
|
57
|
+
value ? 'bg-cyan-600' : 'bg-gray-200',
|
|
58
|
+
disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'
|
|
59
|
+
)}
|
|
60
|
+
style={controlStyle}
|
|
61
|
+
>
|
|
62
|
+
<Switch.Thumb
|
|
63
|
+
className="rounded-full bg-white shadow-lg"
|
|
64
|
+
style={thumbStyle}
|
|
65
|
+
/>
|
|
66
|
+
</Switch.Control>
|
|
67
|
+
|
|
68
|
+
{(label || description) && (
|
|
69
|
+
<div className="flex-1">
|
|
70
|
+
{label && (
|
|
71
|
+
<Switch.Label className="block cursor-pointer text-sm font-bold text-gray-700">
|
|
72
|
+
{label}
|
|
73
|
+
{required && <span className="ml-1 text-red-500">*</span>}
|
|
74
|
+
</Switch.Label>
|
|
75
|
+
)}
|
|
76
|
+
{description && (
|
|
77
|
+
<p className="mt-1 text-sm text-gray-500">{description}</p>
|
|
78
|
+
)}
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
<Switch.HiddenInput />
|
|
83
|
+
</Switch.Root>
|
|
84
|
+
|
|
85
|
+
{error && (
|
|
86
|
+
<p className="text-sm text-red-600" role="alert">
|
|
87
|
+
{error}
|
|
88
|
+
</p>
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default BooleanToggle;
|