@woodsportal/hubspot-kit 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +24 -1
- package/dist/cli.js.map +1 -1
- package/examples/greenfield/module-hybrid-cdn/src/assets/css/main.dev.css +3 -0
- package/examples/greenfield/module-hybrid-cdn/src/defaultData.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn/src/hubspot/types.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn/src/main.tsx +4 -2
- package/examples/greenfield/module-monolith/src/defaultData.ts +7 -0
- package/package.json +5 -1
- package/src/dev/bootstrap-greenfield.tsx +51 -0
- package/src/dev/bootstrap.tsx +46 -0
- package/src/dev-module-config/__tests__/fixtures/fields.json +3014 -0
- package/src/dev-module-config/__tests__/fixtures/golden-module.fixture.ts +102 -0
- package/src/dev-module-config/__tests__/module-config-storage.test.ts +40 -0
- package/src/dev-module-config/__tests__/module-config-transform.test.ts +55 -0
- package/src/dev-module-config/__tests__/normalize-repeater-items.test.ts +46 -0
- package/src/dev-module-config/runtime/module-config-bridge.ts +27 -0
- package/src/dev-module-config/runtime/module-config-runtime.ts +185 -0
- package/src/dev-module-config/schema/build-default-item.ts +7 -0
- package/src/dev-module-config/schema/deep-merge.ts +27 -0
- package/src/dev-module-config/schema/extract-defaults.ts +62 -0
- package/src/dev-module-config/schema/normalize-choices.ts +18 -0
- package/src/dev-module-config/schema/normalize-repeater-items.ts +31 -0
- package/src/dev-module-config/schema/parse-fields-json.ts +2 -0
- package/src/dev-module-config/schema/types.ts +75 -0
- package/src/dev-module-config/schema/validate-module-config.ts +81 -0
- package/src/dev-module-config/schema/visibility.ts +130 -0
- package/src/dev-module-config/storage/config-json.ts +46 -0
- package/src/dev-module-config/storage/workspace-store.ts +139 -0
- package/src/dev-module-config/transform/build-hubspot-data.ts +409 -0
- package/src/dev-module-config/ui/FieldRenderer.tsx +353 -0
- package/src/dev-module-config/ui/ModuleConfigAnimatedPresence.tsx +72 -0
- package/src/dev-module-config/ui/ModuleConfigCollapsible.tsx +43 -0
- package/src/dev-module-config/ui/ModuleConfigDockSideIcon.tsx +27 -0
- package/src/dev-module-config/ui/ModuleConfigOverlay.tsx +134 -0
- package/src/dev-module-config/ui/ModuleConfigPersistenceStatus.tsx +89 -0
- package/src/dev-module-config/ui/ModuleConfigShell.tsx +354 -0
- package/src/dev-module-config/ui/ModuleConfigThemeToggle.tsx +32 -0
- package/src/dev-module-config/ui/ModuleConfigUiContext.tsx +65 -0
- package/src/dev-module-config/ui/editors/DeveloperOptionsEditor.tsx +61 -0
- package/src/dev-module-config/ui/editors/MenuOptionsEditor.tsx +103 -0
- package/src/dev-module-config/ui/hubspot/HsColorField.tsx +106 -0
- package/src/dev-module-config/ui/hubspot/HsColorPickerPopover.tsx +210 -0
- package/src/dev-module-config/ui/hubspot/HsFieldLabel.tsx +24 -0
- package/src/dev-module-config/ui/hubspot/HsFieldWidgets.tsx +248 -0
- package/src/dev-module-config/ui/hubspot/HsImageField.tsx +112 -0
- package/src/dev-module-config/ui/hubspot/HsOccurrenceGroupEditor.tsx +243 -0
- package/src/dev-module-config/ui/hubspot/HsRepeaterList.tsx +178 -0
- package/src/dev-module-config/ui/hubspot/HsSectionHeader.tsx +20 -0
- package/src/dev-module-config/ui/hubspot/HsToggle.tsx +39 -0
- package/src/dev-module-config/ui/hubspot/HsToggleRow.tsx +30 -0
- package/src/dev-module-config/ui/hubspot/hs-color-palette.ts +11 -0
- package/src/dev-module-config/ui/hubspot/module-config-typography.ts +26 -0
- package/src/dev-module-config/ui/module-config-motion.css +134 -0
- package/src/dev-module-config/ui/module-config-motion.ts +28 -0
- package/src/dev-module-config/ui/module-config-overlay-side.ts +29 -0
- package/src/dev-module-config/ui/module-config-surfaces.ts +27 -0
- package/src/dev-module-config/ui/module-config-theme.css +483 -0
- package/src/dev-module-config/ui/module-config-toolbar-theme.ts +35 -0
- package/src/dev-module-config/ui/navigation/ModuleConfigNavContext.tsx +188 -0
- package/src/dev-module-config/ui/use-dev-module-config-live-revision.ts +22 -0
- package/src/dev-module-config/ui/use-hubspot-live-exports.ts +27 -0
- package/src/dev-module-config/ui/use-module-config.ts +124 -0
- package/src/routing/build-api-routes.ts +37 -0
- package/src/routing/route-format.ts +19 -0
- package/templates/module-hybrid-cdn/index.html +12 -1
- package/templates/module-hybrid-cdn/package.json +1 -1
- package/templates/module-hybrid-cdn/src/assets/css/main.dev.css +3 -0
- package/templates/module-hybrid-cdn/src/defaultData.ts +7 -0
- package/templates/module-hybrid-cdn/src/hubspot/types.ts +17 -0
- package/templates/module-hybrid-cdn/src/main.tsx +4 -2
- package/templates/module-monolith/index.html +12 -0
- package/templates/module-monolith/package.json +1 -1
- package/templates/module-monolith/src/assets/css/main.dev.css +3 -0
- package/templates/module-monolith/src/defaultData.ts +7 -0
- package/templates/module-monolith/src/hubspot/types.ts +17 -0
- package/templates/module-monolith/src/main.tsx +4 -0
- package/templates/theme-starter/package.json +1 -1
- package/vite/vite.config.dev.mjs +7 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Runtime contract for window.hubSpotData (greenfield stub). */
|
|
2
|
+
export type HubSpotPortalData = {
|
|
3
|
+
dataSourceSet?: unknown
|
|
4
|
+
hubId?: string | number
|
|
5
|
+
apiBaseUrlOption?: string
|
|
6
|
+
userData?: unknown
|
|
7
|
+
objectList?: unknown[]
|
|
8
|
+
isInEditor?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare global {
|
|
12
|
+
interface Window {
|
|
13
|
+
hubSpotData?: HubSpotPortalData
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@woodsportal/hubspot-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "WoodsCLI — HubSpot CMS dev kit by WoodsPortal. wp CLI, Vite presets, module-config overlay, and theme/module build pipelines.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
"vite",
|
|
15
15
|
"templates",
|
|
16
16
|
"examples",
|
|
17
|
+
"src/dev",
|
|
18
|
+
"src/dev-module-config",
|
|
19
|
+
"src/routing",
|
|
17
20
|
"README.md",
|
|
18
21
|
"CHANGELOG.md",
|
|
19
22
|
"SECURITY.md",
|
|
@@ -29,6 +32,7 @@
|
|
|
29
32
|
"import": "./dist/vite/index.js"
|
|
30
33
|
},
|
|
31
34
|
"./dev/bootstrap": "./src/dev/bootstrap.tsx",
|
|
35
|
+
"./dev/bootstrap-greenfield": "./src/dev/bootstrap-greenfield.tsx",
|
|
32
36
|
"./routing/route-format": "./src/routing/route-format.ts",
|
|
33
37
|
"./routing/build-api-routes": "./src/routing/build-api-routes.ts",
|
|
34
38
|
"./scripts/tailwind/prefix.env.js": "./scripts/tailwind/prefix.env.js",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Greenfield / wp init dev shell — module-config overlay only (no full portal app).
|
|
3
|
+
* Use after `wp init`; adopt `dev/bootstrap` when wiring a real WoodsPortal consumer app.
|
|
4
|
+
*/
|
|
5
|
+
import { createRoot } from 'react-dom/client'
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
bindModuleConfigToHubSpotData,
|
|
9
|
+
setModuleConfigAdapter,
|
|
10
|
+
syncHubSpotDataFromModuleState,
|
|
11
|
+
} from '@/dev/module-config/runtime/module-config-bridge'
|
|
12
|
+
import { initModuleConfigRuntime } from '@/dev/module-config/runtime/module-config-runtime'
|
|
13
|
+
import {
|
|
14
|
+
ModuleConfigOverlay,
|
|
15
|
+
registerModuleConfigShortcutHint,
|
|
16
|
+
} from '@/dev/module-config/ui/ModuleConfigOverlay'
|
|
17
|
+
import wphsAdapter from '@wphs/adapter'
|
|
18
|
+
|
|
19
|
+
export async function mountGreenfieldDev(): Promise<void> {
|
|
20
|
+
const rootElement = document.getElementById('app')
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
setModuleConfigAdapter(wphsAdapter)
|
|
24
|
+
bindModuleConfigToHubSpotData()
|
|
25
|
+
const moduleState = await initModuleConfigRuntime()
|
|
26
|
+
syncHubSpotDataFromModuleState(moduleState)
|
|
27
|
+
registerModuleConfigShortcutHint()
|
|
28
|
+
|
|
29
|
+
if (!rootElement) {
|
|
30
|
+
throw new Error('Missing #app element — add index.html with <div id="app">')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
createRoot(rootElement).render(
|
|
34
|
+
<>
|
|
35
|
+
<ModuleConfigOverlay />
|
|
36
|
+
<main style={{ padding: '1.5rem', fontFamily: 'system-ui, sans-serif' }}>
|
|
37
|
+
<h1>WoodsCLI dev</h1>
|
|
38
|
+
<p>
|
|
39
|
+
Edit HubSpot module fields with <kbd>Ctrl+Shift+Z</kbd> (Mac: <kbd>⌃⇧Z</kbd>).
|
|
40
|
+
</p>
|
|
41
|
+
</main>
|
|
42
|
+
</>
|
|
43
|
+
)
|
|
44
|
+
} catch (error) {
|
|
45
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
46
|
+
if (rootElement) {
|
|
47
|
+
rootElement.innerHTML = `<pre style="padding:1rem;font-family:system-ui;color:#b91c1c;white-space:pre-wrap">WoodsCLI dev failed to start:\n${message}</pre>`
|
|
48
|
+
}
|
|
49
|
+
console.error('[woodscli] mountGreenfieldDev failed', error)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kit-owned local dev bootstrap — module-config overlay + live export provider.
|
|
3
|
+
* Never imported in production CDN/HubSpot builds.
|
|
4
|
+
*/
|
|
5
|
+
import { createRoot } from 'react-dom/client'
|
|
6
|
+
|
|
7
|
+
import { mountPortal, router } from '@/portal/mount-portal'
|
|
8
|
+
import {
|
|
9
|
+
bindModuleConfigToHubSpotData,
|
|
10
|
+
setModuleConfigAdapter,
|
|
11
|
+
syncHubSpotDataFromModuleState,
|
|
12
|
+
} from '@/dev/module-config/runtime/module-config-bridge'
|
|
13
|
+
import { initModuleConfigRuntime } from '@/dev/module-config/runtime/module-config-runtime'
|
|
14
|
+
import {
|
|
15
|
+
ModuleConfigOverlay,
|
|
16
|
+
registerModuleConfigShortcutHint,
|
|
17
|
+
} from '@/dev/module-config/ui/ModuleConfigOverlay'
|
|
18
|
+
import { useDevModuleConfigLiveRevision } from '@/dev/module-config/ui/use-dev-module-config-live-revision'
|
|
19
|
+
import { DevHubSpotLiveProvider } from '@/integrations/dev-hubspot-live-provider'
|
|
20
|
+
import { App } from '@/app'
|
|
21
|
+
import wphsAdapter from '@wphs/adapter'
|
|
22
|
+
|
|
23
|
+
export async function mountDevPortal(): Promise<void> {
|
|
24
|
+
setModuleConfigAdapter(wphsAdapter)
|
|
25
|
+
bindModuleConfigToHubSpotData()
|
|
26
|
+
const moduleState = await initModuleConfigRuntime()
|
|
27
|
+
syncHubSpotDataFromModuleState(moduleState)
|
|
28
|
+
registerModuleConfigShortcutHint()
|
|
29
|
+
|
|
30
|
+
await mountPortal({ includeGlobalStyles: true, skipAppRender: true })
|
|
31
|
+
|
|
32
|
+
const rootElement = document.getElementById('app')
|
|
33
|
+
if (!rootElement) return
|
|
34
|
+
|
|
35
|
+
function DevRoot() {
|
|
36
|
+
const revision = useDevModuleConfigLiveRevision()
|
|
37
|
+
return (
|
|
38
|
+
<DevHubSpotLiveProvider revision={revision}>
|
|
39
|
+
<ModuleConfigOverlay />
|
|
40
|
+
<App router={router} />
|
|
41
|
+
</DevHubSpotLiveProvider>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
createRoot(rootElement).render(<DevRoot />)
|
|
46
|
+
}
|