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,431 @@
|
|
|
1
|
+
import { ulid } from 'ulid';
|
|
2
|
+
import { NodesContext } from '@/stores/nodes';
|
|
3
|
+
import { fullContentMapStore } from '@/stores/storykeep';
|
|
4
|
+
import { findUniqueSlug } from '@/utils/helpers';
|
|
5
|
+
import type {
|
|
6
|
+
PageDesign,
|
|
7
|
+
PaneNode,
|
|
8
|
+
StoryFragmentNode,
|
|
9
|
+
} from '@/types/compositorTypes';
|
|
10
|
+
|
|
11
|
+
interface ProcessedPage {
|
|
12
|
+
sections: PageSection[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type PageSectionType = 'intro' | 'content' | 'subcontent';
|
|
16
|
+
|
|
17
|
+
interface PageSection {
|
|
18
|
+
type: PageSectionType;
|
|
19
|
+
content: string;
|
|
20
|
+
children?: PageSection[]; // Optional because only content sections can have children
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface TitleSlugResponse {
|
|
24
|
+
title: string;
|
|
25
|
+
slug: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generate title and slug using askLemur API
|
|
30
|
+
*/
|
|
31
|
+
async function getTitleSlug(
|
|
32
|
+
markdownContent: string,
|
|
33
|
+
existingSlugs: string[]
|
|
34
|
+
): Promise<TitleSlugResponse | null> {
|
|
35
|
+
if (
|
|
36
|
+
!markdownContent ||
|
|
37
|
+
markdownContent.trim() === '...' ||
|
|
38
|
+
markdownContent.trim().length === 0
|
|
39
|
+
) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
const backendUrl =
|
|
45
|
+
import.meta.env.PUBLIC_GO_BACKEND || 'http://localhost:8080';
|
|
46
|
+
const tenantId = import.meta.env.PUBLIC_TENANTID || 'default';
|
|
47
|
+
|
|
48
|
+
const response = await fetch(`${backendUrl}/api/v1/aai/askLemur`, {
|
|
49
|
+
method: 'POST',
|
|
50
|
+
headers: {
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
'X-Tenant-ID': tenantId,
|
|
53
|
+
},
|
|
54
|
+
credentials: 'include',
|
|
55
|
+
body: JSON.stringify({
|
|
56
|
+
prompt: `Generate a concise title (maximum 40-50 characters) and a URL-friendly slug (lowercase, only letters, numbers, and dashes, no spaces) that captures the essence of this markdown content. Return only a JSON object with "title" and "slug" keys.
|
|
57
|
+
|
|
58
|
+
Example response format:
|
|
59
|
+
{
|
|
60
|
+
"title": "Short Descriptive Title",
|
|
61
|
+
"slug": "short-descriptive-title"
|
|
62
|
+
}`,
|
|
63
|
+
input_text: markdownContent,
|
|
64
|
+
final_model: 'anthropic/claude-3-5-sonnet',
|
|
65
|
+
temperature: 0.3,
|
|
66
|
+
max_tokens: 200,
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (response.ok) {
|
|
71
|
+
const data = await response.json();
|
|
72
|
+
if (data.success && data.data?.response) {
|
|
73
|
+
let titleData;
|
|
74
|
+
try {
|
|
75
|
+
if (typeof data.data.response === 'string') {
|
|
76
|
+
titleData = JSON.parse(data.data.response);
|
|
77
|
+
} else {
|
|
78
|
+
titleData = data.data.response;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (titleData.title && titleData.slug) {
|
|
82
|
+
return {
|
|
83
|
+
title: findUniqueSlug(titleData.title, existingSlugs),
|
|
84
|
+
slug: findUniqueSlug(titleData.slug, existingSlugs),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
} catch (parseError) {
|
|
88
|
+
console.error('Error parsing title data:', parseError);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error('Error generating title:', error);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function parsePageMarkdown(markdown: string): ProcessedPage {
|
|
100
|
+
const lines = markdown.split('\n');
|
|
101
|
+
const sections: PageSection[] = [];
|
|
102
|
+
let currentSection: PageSection | null = null;
|
|
103
|
+
let currentParagraph = '';
|
|
104
|
+
|
|
105
|
+
for (let i = 0; i < lines.length; i++) {
|
|
106
|
+
const line = lines[i].trim();
|
|
107
|
+
|
|
108
|
+
const h2Match = line.match(/^## (.*)/);
|
|
109
|
+
const h3Match = line.match(/^### (.*)/);
|
|
110
|
+
const h4Match = line.match(/^#### (.*)/);
|
|
111
|
+
|
|
112
|
+
if (h2Match && !currentSection) {
|
|
113
|
+
currentSection = {
|
|
114
|
+
type: 'intro',
|
|
115
|
+
content: `## ${h2Match[1]}\n\n`,
|
|
116
|
+
children: [],
|
|
117
|
+
};
|
|
118
|
+
} else if (h3Match) {
|
|
119
|
+
if (currentSection) {
|
|
120
|
+
if (currentParagraph) {
|
|
121
|
+
currentSection.content += currentParagraph.trim() + '\n\n';
|
|
122
|
+
currentParagraph = '';
|
|
123
|
+
}
|
|
124
|
+
sections.push(currentSection);
|
|
125
|
+
}
|
|
126
|
+
currentSection = {
|
|
127
|
+
type: 'content',
|
|
128
|
+
content: `### ${h3Match[1]}\n\n`,
|
|
129
|
+
children: [],
|
|
130
|
+
};
|
|
131
|
+
} else if (h4Match && currentSection) {
|
|
132
|
+
if (currentParagraph) {
|
|
133
|
+
currentSection.content += currentParagraph.trim() + '\n\n';
|
|
134
|
+
currentParagraph = '';
|
|
135
|
+
}
|
|
136
|
+
const subSection: PageSection = {
|
|
137
|
+
type: 'subcontent',
|
|
138
|
+
content: `#### ${h4Match[1]}\n\n`,
|
|
139
|
+
children: [],
|
|
140
|
+
};
|
|
141
|
+
if (!currentSection.children) currentSection.children = [];
|
|
142
|
+
currentSection.children.push(subSection);
|
|
143
|
+
// Reset currentParagraph to start collecting content for the subSection
|
|
144
|
+
currentParagraph = '';
|
|
145
|
+
} else if (currentSection) {
|
|
146
|
+
// This part handles content for both H3 and H4 sections
|
|
147
|
+
if (currentParagraph === '') {
|
|
148
|
+
currentParagraph = line;
|
|
149
|
+
} else {
|
|
150
|
+
currentParagraph += '\n' + line;
|
|
151
|
+
}
|
|
152
|
+
// If we're in a subSection, we need to update its content directly
|
|
153
|
+
if (
|
|
154
|
+
currentSection.children &&
|
|
155
|
+
currentSection.children.length > 0 &&
|
|
156
|
+
currentSection.type === 'content'
|
|
157
|
+
) {
|
|
158
|
+
const lastChild =
|
|
159
|
+
currentSection.children[currentSection.children.length - 1];
|
|
160
|
+
if (lastChild.type === 'subcontent') {
|
|
161
|
+
lastChild.content += line + '\n';
|
|
162
|
+
currentParagraph = ''; // Reset since we've added it directly to subSection
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Handle the last paragraph or section
|
|
169
|
+
if (currentSection) {
|
|
170
|
+
if (currentSection.type === 'intro' && currentParagraph) {
|
|
171
|
+
currentSection.content += currentParagraph.trim() + '\n\n';
|
|
172
|
+
} else if (currentParagraph) {
|
|
173
|
+
if (
|
|
174
|
+
currentSection.children &&
|
|
175
|
+
currentSection.children.length > 0 &&
|
|
176
|
+
currentSection.type === 'content'
|
|
177
|
+
) {
|
|
178
|
+
const lastChild =
|
|
179
|
+
currentSection.children[currentSection.children.length - 1];
|
|
180
|
+
if (lastChild.type === 'subcontent') {
|
|
181
|
+
lastChild.content += currentParagraph.trim() + '\n\n';
|
|
182
|
+
} else {
|
|
183
|
+
currentSection.content += currentParagraph.trim() + '\n\n';
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
currentSection.content += currentParagraph.trim() + '\n\n';
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
sections.push(currentSection);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return { sections };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Creates panes for a processed page using the selected design
|
|
197
|
+
*/
|
|
198
|
+
export async function createPagePanes(
|
|
199
|
+
processedPage: ProcessedPage,
|
|
200
|
+
design: PageDesign,
|
|
201
|
+
ctx: NodesContext,
|
|
202
|
+
generateTitle: boolean,
|
|
203
|
+
nodeId?: string,
|
|
204
|
+
onProgress?: (current: number, total: number) => void
|
|
205
|
+
): Promise<string[]> {
|
|
206
|
+
const ownerId = nodeId || ctx.rootNodeId.get();
|
|
207
|
+
const paneIds: string[] = [];
|
|
208
|
+
let panesCreated = 0;
|
|
209
|
+
|
|
210
|
+
// --- 1. Calculate the total number of panes for the progress bar ---
|
|
211
|
+
const introSection = processedPage.sections.find((s) => s.type === 'intro');
|
|
212
|
+
const contentSections = processedPage.sections.filter(
|
|
213
|
+
(s) => s.type === 'content'
|
|
214
|
+
);
|
|
215
|
+
const subContentSections = contentSections.flatMap((s) => s.children || []);
|
|
216
|
+
let totalPanes = 0;
|
|
217
|
+
if (introSection) totalPanes++;
|
|
218
|
+
totalPanes += contentSections.length;
|
|
219
|
+
totalPanes += subContentSections.length;
|
|
220
|
+
if (design.visualBreaks && contentSections.length > 0) {
|
|
221
|
+
// A break is added between each content section
|
|
222
|
+
totalPanes += contentSections.length - 1;
|
|
223
|
+
}
|
|
224
|
+
onProgress?.(0, totalPanes); // Report initial progress
|
|
225
|
+
|
|
226
|
+
const existingSlugs = generateTitle
|
|
227
|
+
? fullContentMapStore
|
|
228
|
+
.get()
|
|
229
|
+
.filter((item: { type: string }) =>
|
|
230
|
+
['Pane', 'StoryFragment'].includes(item.type)
|
|
231
|
+
)
|
|
232
|
+
.map((item: { slug: string }) => item.slug)
|
|
233
|
+
: [];
|
|
234
|
+
|
|
235
|
+
// --- 2. Create Panes and Report Progress After Each Step ---
|
|
236
|
+
if (introSection) {
|
|
237
|
+
const introPane = design.introDesign();
|
|
238
|
+
introPane.id = ulid();
|
|
239
|
+
introPane.slug = '';
|
|
240
|
+
introPane.title = '';
|
|
241
|
+
introPane.markdown.markdownBody = introSection.content || '';
|
|
242
|
+
|
|
243
|
+
if (generateTitle && introPane.markdown.markdownBody.trim().length > 0) {
|
|
244
|
+
const titleSlugResult = await getTitleSlug(
|
|
245
|
+
introPane.markdown.markdownBody,
|
|
246
|
+
existingSlugs
|
|
247
|
+
);
|
|
248
|
+
if (titleSlugResult) {
|
|
249
|
+
introPane.title = titleSlugResult.title;
|
|
250
|
+
introPane.slug = titleSlugResult.slug;
|
|
251
|
+
existingSlugs.push(titleSlugResult.slug);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const paneId = ctx.addTemplatePane(ownerId, introPane);
|
|
256
|
+
if (paneId) {
|
|
257
|
+
paneIds.push(paneId);
|
|
258
|
+
panesCreated++;
|
|
259
|
+
onProgress?.(panesCreated, totalPanes); // Report progress
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
for (let index = 0; index < contentSections.length; index++) {
|
|
264
|
+
const section = contentSections[index];
|
|
265
|
+
const useOdd = index % 2 === 0;
|
|
266
|
+
|
|
267
|
+
if (design.visualBreaks && index > 0) {
|
|
268
|
+
const isEven = (index - 1) % 2 === 0;
|
|
269
|
+
const breakTemplate = isEven
|
|
270
|
+
? design.visualBreaks.even()
|
|
271
|
+
: design.visualBreaks.odd();
|
|
272
|
+
const lastPaneId = paneIds[paneIds.length - 1];
|
|
273
|
+
|
|
274
|
+
if (lastPaneId) {
|
|
275
|
+
const abovePane = ctx.allNodes.get().get(lastPaneId) as PaneNode;
|
|
276
|
+
const aboveColor = abovePane?.bgColour || 'white';
|
|
277
|
+
const nextContentPane = design.contentDesign(!useOdd);
|
|
278
|
+
const belowColor = nextContentPane.bgColour;
|
|
279
|
+
breakTemplate.bgColour = aboveColor;
|
|
280
|
+
const svgFill = belowColor;
|
|
281
|
+
if (breakTemplate.bgPane) {
|
|
282
|
+
if (breakTemplate.bgPane.breakDesktop) {
|
|
283
|
+
breakTemplate.bgPane.breakDesktop.svgFill = svgFill;
|
|
284
|
+
}
|
|
285
|
+
if (breakTemplate.bgPane.breakTablet) {
|
|
286
|
+
breakTemplate.bgPane.breakTablet.svgFill = svgFill;
|
|
287
|
+
}
|
|
288
|
+
if (breakTemplate.bgPane.breakMobile) {
|
|
289
|
+
breakTemplate.bgPane.breakMobile.svgFill = svgFill;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const breakPaneId = ctx.addTemplatePane(
|
|
293
|
+
ownerId,
|
|
294
|
+
breakTemplate,
|
|
295
|
+
lastPaneId,
|
|
296
|
+
'after'
|
|
297
|
+
);
|
|
298
|
+
if (breakPaneId) {
|
|
299
|
+
paneIds.push(breakPaneId);
|
|
300
|
+
panesCreated++;
|
|
301
|
+
onProgress?.(panesCreated, totalPanes); // Report progress
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const contentPane = design.contentDesign(useOdd);
|
|
307
|
+
contentPane.id = ulid();
|
|
308
|
+
contentPane.slug = '';
|
|
309
|
+
contentPane.title = '';
|
|
310
|
+
contentPane.markdown.markdownBody = section.content || '';
|
|
311
|
+
|
|
312
|
+
if (generateTitle && contentPane.markdown.markdownBody.trim().length > 0) {
|
|
313
|
+
const titleSlugResult = await getTitleSlug(
|
|
314
|
+
contentPane.markdown.markdownBody,
|
|
315
|
+
existingSlugs
|
|
316
|
+
);
|
|
317
|
+
if (titleSlugResult) {
|
|
318
|
+
contentPane.title = titleSlugResult.title;
|
|
319
|
+
contentPane.slug = titleSlugResult.slug;
|
|
320
|
+
existingSlugs.push(titleSlugResult.slug);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const contentPaneId = ctx.addTemplatePane(ownerId, contentPane);
|
|
325
|
+
if (contentPaneId) {
|
|
326
|
+
paneIds.push(contentPaneId);
|
|
327
|
+
panesCreated++;
|
|
328
|
+
onProgress?.(panesCreated, totalPanes); // Report progress
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (section.children && section.children.length > 0) {
|
|
332
|
+
for (const subSection of section.children) {
|
|
333
|
+
const subContentPane = design.contentDesign(!useOdd);
|
|
334
|
+
subContentPane.id = ulid();
|
|
335
|
+
subContentPane.slug = '';
|
|
336
|
+
subContentPane.title = '';
|
|
337
|
+
subContentPane.markdown.markdownBody = subSection.content || '';
|
|
338
|
+
|
|
339
|
+
if (
|
|
340
|
+
generateTitle &&
|
|
341
|
+
subContentPane.markdown.markdownBody.trim().length > 0
|
|
342
|
+
) {
|
|
343
|
+
const titleSlugResult = await getTitleSlug(
|
|
344
|
+
subContentPane.markdown.markdownBody,
|
|
345
|
+
existingSlugs
|
|
346
|
+
);
|
|
347
|
+
if (titleSlugResult) {
|
|
348
|
+
subContentPane.title = titleSlugResult.title;
|
|
349
|
+
subContentPane.slug = titleSlugResult.slug;
|
|
350
|
+
existingSlugs.push(titleSlugResult.slug);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const subContentPaneId = ctx.addTemplatePane(ownerId, subContentPane);
|
|
355
|
+
if (subContentPaneId) {
|
|
356
|
+
paneIds.push(subContentPaneId);
|
|
357
|
+
panesCreated++;
|
|
358
|
+
onProgress?.(panesCreated, totalPanes); // Report progress
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return paneIds;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Builds a complete page preview in the provided context
|
|
369
|
+
*/
|
|
370
|
+
export async function buildPagePreview(
|
|
371
|
+
markdown: string,
|
|
372
|
+
design: PageDesign,
|
|
373
|
+
ctx: NodesContext
|
|
374
|
+
): Promise<void> {
|
|
375
|
+
// Parse markdown into sections
|
|
376
|
+
const processedPage = parsePageMarkdown(markdown);
|
|
377
|
+
|
|
378
|
+
// Create story fragment node - add proper type assertion
|
|
379
|
+
const pageNode = ctx.allNodes.get().get('tmp') as StoryFragmentNode;
|
|
380
|
+
if (!pageNode) return;
|
|
381
|
+
|
|
382
|
+
// Create all panes using design
|
|
383
|
+
const paneIds = await createPagePanes(processedPage, design, ctx, false);
|
|
384
|
+
|
|
385
|
+
// Update story fragment with panes
|
|
386
|
+
pageNode.title = '';
|
|
387
|
+
pageNode.slug = 'preview';
|
|
388
|
+
pageNode.paneIds = paneIds;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Validates markdown structure matches expected page format
|
|
393
|
+
*/
|
|
394
|
+
export function validatePageMarkdown(markdown: string): boolean {
|
|
395
|
+
const { sections } = parsePageMarkdown(markdown);
|
|
396
|
+
|
|
397
|
+
// Must have at least one section
|
|
398
|
+
if (sections.length === 0) return false;
|
|
399
|
+
|
|
400
|
+
// First section should be intro (H2)
|
|
401
|
+
if (sections[0].type !== 'intro') return false;
|
|
402
|
+
|
|
403
|
+
// Should have at least one content section
|
|
404
|
+
if (!sections.some((s) => s.type === 'content')) return false;
|
|
405
|
+
|
|
406
|
+
// All sections should have content
|
|
407
|
+
if (!sections.every((s) => s.content.trim())) return false;
|
|
408
|
+
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Creates preview text of how markdown will be split into panes
|
|
414
|
+
*/
|
|
415
|
+
export function getPagePreview(markdown: string): string {
|
|
416
|
+
const { sections } = parsePageMarkdown(markdown);
|
|
417
|
+
|
|
418
|
+
let preview = ``;
|
|
419
|
+
|
|
420
|
+
sections.forEach((section, i) => {
|
|
421
|
+
preview += `=== Pane ${i + 1} ===\n`;
|
|
422
|
+
preview += `Type: ${section.type}\n`;
|
|
423
|
+
preview += `Content Preview: ${section.content.substring(0, 100)}...\n`;
|
|
424
|
+
if (section.children?.length) {
|
|
425
|
+
preview += `Subsections: ${section.children.length}\n`;
|
|
426
|
+
}
|
|
427
|
+
preview += '\n';
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
return preview;
|
|
431
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { tailwindClasses, tailwindCoreLayoutClasses } from './tailwindClasses';
|
|
2
|
+
import type { TupleValue, ViewportKey } from '@/types/compositorTypes';
|
|
3
|
+
|
|
4
|
+
const tailwindModifier = ['', 'md:', 'xl:'];
|
|
5
|
+
const tailwindCoreModifier = ['xs:', 'md:', 'xl:'];
|
|
6
|
+
|
|
7
|
+
const stripViewportPrefixes = (classes: string[]): string[] => {
|
|
8
|
+
return classes.map((classStr) =>
|
|
9
|
+
classStr
|
|
10
|
+
.split(' ')
|
|
11
|
+
.map((cls) => cls.replace(/^(xs:|md:|xl:)/, ''))
|
|
12
|
+
.join(' ')
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const mergeWithCascade = (
|
|
17
|
+
baseStyles: Partial<Record<ViewportKey, Record<string, string>>>,
|
|
18
|
+
overrideStyles: Partial<Record<ViewportKey, Record<string, string>>>,
|
|
19
|
+
viewport: ViewportKey
|
|
20
|
+
): Record<string, string> => {
|
|
21
|
+
// Skip 'auto' viewport as it's handled elsewhere
|
|
22
|
+
if (viewport === 'auto') {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const viewportOrder: ViewportKey[] = ['mobile', 'tablet', 'desktop'];
|
|
27
|
+
const viewportIndex = viewportOrder.indexOf(viewport);
|
|
28
|
+
let result: Record<string, string> = {};
|
|
29
|
+
|
|
30
|
+
// First, cascade the base styles
|
|
31
|
+
for (let i = 0; i <= viewportIndex; i++) {
|
|
32
|
+
const currentViewport = viewportOrder[i];
|
|
33
|
+
if (baseStyles[currentViewport]) {
|
|
34
|
+
result = { ...result, ...baseStyles[currentViewport] };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Then, cascade the override styles
|
|
39
|
+
for (let i = 0; i <= viewportIndex; i++) {
|
|
40
|
+
const currentViewport = viewportOrder[i];
|
|
41
|
+
if (overrideStyles[currentViewport]) {
|
|
42
|
+
result = { ...result, ...overrideStyles[currentViewport] };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const reduceClassName = (
|
|
50
|
+
selector: string,
|
|
51
|
+
v: TupleValue,
|
|
52
|
+
viewportIndex: number
|
|
53
|
+
): string => {
|
|
54
|
+
if (!selector) return '';
|
|
55
|
+
const modifier =
|
|
56
|
+
viewportIndex === -1
|
|
57
|
+
? tailwindCoreLayoutClasses.includes(selector)
|
|
58
|
+
? tailwindCoreModifier[0]
|
|
59
|
+
: ''
|
|
60
|
+
: tailwindModifier[viewportIndex];
|
|
61
|
+
const { className, prefix, useKeyAsClass } = getTailwindClassInfo(selector);
|
|
62
|
+
const thisSelector = useKeyAsClass ? selector : className;
|
|
63
|
+
const applyPrefix = (value: string) => {
|
|
64
|
+
return value.startsWith(prefix) ? value : `${prefix}${value}`;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
if (typeof v === 'boolean')
|
|
68
|
+
console.log(
|
|
69
|
+
`DEPRECATED STYLE FOUND in classNamesPayload`,
|
|
70
|
+
selector,
|
|
71
|
+
v,
|
|
72
|
+
viewportIndex
|
|
73
|
+
);
|
|
74
|
+
if (v === false || v === null || v === undefined) return '';
|
|
75
|
+
if (typeof v === 'boolean')
|
|
76
|
+
return `${modifier}${applyPrefix(v ? thisSelector : '')}`;
|
|
77
|
+
if (v === 'true') return `${modifier}${applyPrefix(thisSelector)}`;
|
|
78
|
+
if (typeof v === 'string' && v[0] === '!')
|
|
79
|
+
return `${modifier}-${applyPrefix(`${thisSelector}-${v.substring(1)}`)}`;
|
|
80
|
+
if (
|
|
81
|
+
(typeof v === 'string' || typeof v === 'number') &&
|
|
82
|
+
selector === 'animate'
|
|
83
|
+
)
|
|
84
|
+
return `motion-safe:${modifier}${applyPrefix(`${thisSelector}-${v}`)}`;
|
|
85
|
+
if (useKeyAsClass && typeof v === 'string')
|
|
86
|
+
return `${modifier}${applyPrefix(v)}`;
|
|
87
|
+
if (typeof v === 'string' || typeof v === 'number') {
|
|
88
|
+
if (typeof v === 'string' && v.startsWith('-')) {
|
|
89
|
+
return `${modifier}-${applyPrefix(`${thisSelector}${v}`)}`;
|
|
90
|
+
}
|
|
91
|
+
return `${modifier}${applyPrefix(`${thisSelector}-${v}`)}`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return '';
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export const processClassesForViewports = (
|
|
98
|
+
classes: {
|
|
99
|
+
mobile: Record<string, string>;
|
|
100
|
+
tablet: Record<string, string>;
|
|
101
|
+
desktop: Record<string, string>;
|
|
102
|
+
},
|
|
103
|
+
override: {
|
|
104
|
+
mobile?: Record<string, string>;
|
|
105
|
+
tablet?: Record<string, string>;
|
|
106
|
+
desktop?: Record<string, string>;
|
|
107
|
+
},
|
|
108
|
+
count: number = 1
|
|
109
|
+
): [string[], string[], string[], string[]] => {
|
|
110
|
+
const processForViewport = (viewport: ViewportKey): string[] => {
|
|
111
|
+
const results: string[] = [];
|
|
112
|
+
//const viewportOrder: ViewportKey[] = ["mobile", "tablet", "desktop"];
|
|
113
|
+
//const viewportIndex = viewportOrder.indexOf(viewport);
|
|
114
|
+
|
|
115
|
+
for (let i = 0; i < count; i++) {
|
|
116
|
+
// Get cascaded styles for this viewport
|
|
117
|
+
const cascadedStyles = mergeWithCascade(
|
|
118
|
+
classes,
|
|
119
|
+
override as Record<ViewportKey, Record<string, string>>,
|
|
120
|
+
viewport
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const classesForViewport: string[] = [];
|
|
124
|
+
for (const [selector, value] of Object.entries(cascadedStyles)) {
|
|
125
|
+
classesForViewport.push(reduceClassName(selector, value, -1));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
results.push(
|
|
129
|
+
classesForViewport.length > 0 ? classesForViewport.join(' ') : ' '
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
return results;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const mobile = processForViewport('mobile');
|
|
136
|
+
const tablet = processForViewport('tablet');
|
|
137
|
+
const desktop = processForViewport('desktop');
|
|
138
|
+
|
|
139
|
+
// Generate the 'all' classes with proper viewport prefixes
|
|
140
|
+
const all = mobile.map((_, index) => {
|
|
141
|
+
const mobileClasses = mobile[index].split(' ');
|
|
142
|
+
const tabletClasses = tablet[index].split(' ');
|
|
143
|
+
const desktopClasses = desktop[index].split(' ');
|
|
144
|
+
|
|
145
|
+
const combinedClasses = new Set(mobileClasses);
|
|
146
|
+
|
|
147
|
+
tabletClasses.forEach((cls) => {
|
|
148
|
+
const baseClass = cls.replace(/(xs:|md:|xl:)/g, '');
|
|
149
|
+
if (cls.length > 0 && !mobileClasses.includes(baseClass)) {
|
|
150
|
+
combinedClasses.add(`md:${baseClass}`);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
desktopClasses.forEach((cls) => {
|
|
155
|
+
const baseClass = cls.replace(/(xs:|md:|xl:)/g, '');
|
|
156
|
+
if (
|
|
157
|
+
cls.length > 0 &&
|
|
158
|
+
!mobileClasses.includes(baseClass) &&
|
|
159
|
+
!tabletClasses.includes(baseClass)
|
|
160
|
+
) {
|
|
161
|
+
combinedClasses.add(`xl:${baseClass}`);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
return Array.from(combinedClasses).join(' ');
|
|
166
|
+
});
|
|
167
|
+
return [
|
|
168
|
+
all,
|
|
169
|
+
stripViewportPrefixes(mobile),
|
|
170
|
+
stripViewportPrefixes(tablet),
|
|
171
|
+
stripViewportPrefixes(desktop),
|
|
172
|
+
];
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
function getTailwindClassInfo(selector: string): {
|
|
176
|
+
className: string;
|
|
177
|
+
prefix: string;
|
|
178
|
+
values: string[] | 'number';
|
|
179
|
+
useKeyAsClass?: boolean;
|
|
180
|
+
} {
|
|
181
|
+
const classInfo = tailwindClasses[selector];
|
|
182
|
+
if (!classInfo) {
|
|
183
|
+
return { className: selector, prefix: '', values: [] };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
className: classInfo.className,
|
|
188
|
+
prefix: classInfo.prefix,
|
|
189
|
+
values: classInfo.values,
|
|
190
|
+
useKeyAsClass: classInfo.useKeyAsClass,
|
|
191
|
+
};
|
|
192
|
+
}
|