@woodsportal/hubspot-kit 1.0.4 → 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.
Files changed (64) hide show
  1. package/dist/cli.js +24 -1
  2. package/dist/cli.js.map +1 -1
  3. package/package.json +4 -1
  4. package/src/dev/bootstrap-greenfield.tsx +51 -0
  5. package/src/dev/bootstrap.tsx +46 -0
  6. package/src/dev-module-config/__tests__/fixtures/fields.json +3014 -0
  7. package/src/dev-module-config/__tests__/fixtures/golden-module.fixture.ts +102 -0
  8. package/src/dev-module-config/__tests__/module-config-storage.test.ts +40 -0
  9. package/src/dev-module-config/__tests__/module-config-transform.test.ts +55 -0
  10. package/src/dev-module-config/__tests__/normalize-repeater-items.test.ts +46 -0
  11. package/src/dev-module-config/runtime/module-config-bridge.ts +27 -0
  12. package/src/dev-module-config/runtime/module-config-runtime.ts +185 -0
  13. package/src/dev-module-config/schema/build-default-item.ts +7 -0
  14. package/src/dev-module-config/schema/deep-merge.ts +27 -0
  15. package/src/dev-module-config/schema/extract-defaults.ts +62 -0
  16. package/src/dev-module-config/schema/normalize-choices.ts +18 -0
  17. package/src/dev-module-config/schema/normalize-repeater-items.ts +31 -0
  18. package/src/dev-module-config/schema/parse-fields-json.ts +2 -0
  19. package/src/dev-module-config/schema/types.ts +75 -0
  20. package/src/dev-module-config/schema/validate-module-config.ts +81 -0
  21. package/src/dev-module-config/schema/visibility.ts +130 -0
  22. package/src/dev-module-config/storage/config-json.ts +46 -0
  23. package/src/dev-module-config/storage/workspace-store.ts +139 -0
  24. package/src/dev-module-config/transform/build-hubspot-data.ts +409 -0
  25. package/src/dev-module-config/ui/FieldRenderer.tsx +353 -0
  26. package/src/dev-module-config/ui/ModuleConfigAnimatedPresence.tsx +72 -0
  27. package/src/dev-module-config/ui/ModuleConfigCollapsible.tsx +43 -0
  28. package/src/dev-module-config/ui/ModuleConfigDockSideIcon.tsx +27 -0
  29. package/src/dev-module-config/ui/ModuleConfigOverlay.tsx +134 -0
  30. package/src/dev-module-config/ui/ModuleConfigPersistenceStatus.tsx +89 -0
  31. package/src/dev-module-config/ui/ModuleConfigShell.tsx +354 -0
  32. package/src/dev-module-config/ui/ModuleConfigThemeToggle.tsx +32 -0
  33. package/src/dev-module-config/ui/ModuleConfigUiContext.tsx +65 -0
  34. package/src/dev-module-config/ui/editors/DeveloperOptionsEditor.tsx +61 -0
  35. package/src/dev-module-config/ui/editors/MenuOptionsEditor.tsx +103 -0
  36. package/src/dev-module-config/ui/hubspot/HsColorField.tsx +106 -0
  37. package/src/dev-module-config/ui/hubspot/HsColorPickerPopover.tsx +210 -0
  38. package/src/dev-module-config/ui/hubspot/HsFieldLabel.tsx +24 -0
  39. package/src/dev-module-config/ui/hubspot/HsFieldWidgets.tsx +248 -0
  40. package/src/dev-module-config/ui/hubspot/HsImageField.tsx +112 -0
  41. package/src/dev-module-config/ui/hubspot/HsOccurrenceGroupEditor.tsx +243 -0
  42. package/src/dev-module-config/ui/hubspot/HsRepeaterList.tsx +178 -0
  43. package/src/dev-module-config/ui/hubspot/HsSectionHeader.tsx +20 -0
  44. package/src/dev-module-config/ui/hubspot/HsToggle.tsx +39 -0
  45. package/src/dev-module-config/ui/hubspot/HsToggleRow.tsx +30 -0
  46. package/src/dev-module-config/ui/hubspot/hs-color-palette.ts +11 -0
  47. package/src/dev-module-config/ui/hubspot/module-config-typography.ts +26 -0
  48. package/src/dev-module-config/ui/module-config-motion.css +134 -0
  49. package/src/dev-module-config/ui/module-config-motion.ts +28 -0
  50. package/src/dev-module-config/ui/module-config-overlay-side.ts +29 -0
  51. package/src/dev-module-config/ui/module-config-surfaces.ts +27 -0
  52. package/src/dev-module-config/ui/module-config-theme.css +483 -0
  53. package/src/dev-module-config/ui/module-config-toolbar-theme.ts +35 -0
  54. package/src/dev-module-config/ui/navigation/ModuleConfigNavContext.tsx +188 -0
  55. package/src/dev-module-config/ui/use-dev-module-config-live-revision.ts +22 -0
  56. package/src/dev-module-config/ui/use-hubspot-live-exports.ts +27 -0
  57. package/src/dev-module-config/ui/use-module-config.ts +124 -0
  58. package/src/routing/build-api-routes.ts +37 -0
  59. package/src/routing/route-format.ts +19 -0
  60. package/templates/module-hybrid-cdn/index.html +12 -1
  61. package/templates/module-hybrid-cdn/package.json +1 -1
  62. package/templates/module-monolith/index.html +12 -0
  63. package/templates/module-monolith/package.json +1 -1
  64. package/templates/theme-starter/package.json +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woodsportal/hubspot-kit",
3
- "version": "1.0.4",
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",
@@ -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
+ }