@plitzi/sdk-server 0.32.24 → 0.33.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/CHANGELOG.md +22 -0
- package/README.md +326 -162
- package/dist/adapters/authAdapters.d.ts +21 -0
- package/dist/adapters/authAdapters.js +12 -0
- package/dist/adapters/jsonAdapters.d.ts +15 -0
- package/dist/adapters/jsonAdapters.js +9 -4
- package/dist/core/auth/api.d.ts +148 -0
- package/dist/core/auth/api.js +286 -0
- package/dist/core/auth/authorize.d.ts +96 -0
- package/dist/core/auth/authorize.js +92 -0
- package/dist/core/auth/createAuth.d.ts +165 -0
- package/dist/core/auth/createAuth.js +105 -0
- package/dist/core/auth/credentials.d.ts +29 -0
- package/dist/core/auth/credentials.js +48 -0
- package/dist/core/auth/domains.d.ts +41 -0
- package/dist/core/auth/domains.js +78 -0
- package/dist/core/auth/identity.d.ts +108 -0
- package/dist/core/auth/identity.js +164 -0
- package/dist/core/auth/oauth/client.d.ts +5 -0
- package/dist/core/auth/oauth/client.js +47 -0
- package/dist/core/auth/oauth/index.d.ts +78 -0
- package/dist/core/auth/oauth/index.js +113 -0
- package/dist/core/auth/oauth/providers/github.d.ts +2 -0
- package/dist/core/auth/oauth/providers/github.js +48 -0
- package/dist/core/auth/oauth/providers/google.d.ts +2 -0
- package/dist/core/auth/oauth/providers/google.js +30 -0
- package/dist/core/auth/oauth/state.d.ts +23 -0
- package/dist/core/auth/oauth/state.js +55 -0
- package/dist/core/auth/oauth/types.d.ts +51 -0
- package/dist/core/auth/oauth/types.js +13 -0
- package/dist/core/auth/routes.d.ts +50 -0
- package/dist/core/auth/routes.js +129 -0
- package/dist/core/auth/session.d.ts +128 -0
- package/dist/core/auth/session.js +165 -0
- package/dist/core/auth/spaceTokens.d.ts +137 -0
- package/dist/core/auth/spaceTokens.js +212 -0
- package/dist/core/auth/tokens.d.ts +151 -0
- package/dist/core/auth/tokens.js +221 -0
- package/dist/core/createServer.d.ts +29 -0
- package/dist/core/createServer.js +28 -14
- package/dist/core/handlers/authMiddleware.d.ts +27 -0
- package/dist/core/handlers/authMiddleware.js +38 -0
- package/dist/core/handlers/authRouteHandlers.d.ts +46 -0
- package/dist/core/handlers/authRouteHandlers.js +75 -0
- package/dist/core/handlers/types.d.ts +37 -0
- package/dist/{src/core → core}/http/dispatcher.d.ts +2 -2
- package/dist/core/http/dispatcher.js +8 -6
- package/dist/core/http/navigation.d.ts +11 -0
- package/dist/core/http/navigation.js +16 -0
- package/dist/core/http/securityHeaders.js +6 -4
- package/dist/core/http/stages/authApi.d.ts +17 -0
- package/dist/core/http/stages/authApi.js +66 -0
- package/dist/core/http/stages/authRoutes.js +40 -11
- package/dist/core/http/stages/exchangeRoute.d.ts +15 -0
- package/dist/core/http/stages/exchangeRoute.js +67 -0
- package/dist/core/http/stages/health.d.ts +11 -0
- package/dist/core/http/stages/health.js +25 -3
- package/dist/core/http/stages/middlewares.d.ts +2 -0
- package/dist/core/http/stages/static.d.ts +13 -0
- package/dist/core/http/stages/static.js +21 -6
- package/dist/core/http/types.d.ts +35 -0
- package/dist/{modules/mcp/constants.js → core/previewToken.js} +1 -1
- package/dist/core/sdkAssets.d.ts +16 -0
- package/dist/core/sdkAssets.js +46 -0
- package/dist/core/server/baseServer.js +40 -5
- package/dist/core/server/pageServer.d.ts +7 -0
- package/dist/core/server/pageServer.js +13 -17
- package/dist/core/services/action.d.ts +9 -0
- package/dist/core/services/action.js +21 -0
- package/dist/core/services/registry.d.ts +3 -0
- package/dist/core/services/registry.js +9 -19
- package/dist/{src/core → core}/services/resolve.d.ts +1 -0
- package/dist/core/services/resolve.js +6 -4
- package/dist/core/services/rsc.js +3 -2
- package/dist/core/staticFiles.js +1 -1
- package/dist/{src/core → core}/transports.d.ts +3 -0
- package/dist/core/transports.js +7 -6
- package/dist/handlers.d.ts +58 -0
- package/dist/handlers.js +3 -0
- package/dist/{src/helpers → helpers}/buildResponseHelpers.d.ts +2 -1
- package/dist/helpers/buildResponseHelpers.js +13 -4
- package/dist/helpers/buildServerInfo.d.ts +3 -0
- package/dist/helpers/buildServerInfo.js +25 -3
- package/dist/{src/helpers → helpers}/cache/keys.d.ts +5 -1
- package/dist/helpers/cache/keys.js +1 -1
- package/dist/helpers/compress.d.ts +18 -0
- package/dist/helpers/compress.js +47 -11
- package/dist/helpers/offlineDataLoader.d.ts +11 -0
- package/dist/helpers/offlineDataLoader.js +15 -0
- package/dist/helpers/resolveDebugMode.d.ts +10 -0
- package/dist/helpers/resolveDebugMode.js +13 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +9 -20
- package/dist/kernel.d.ts +41 -0
- package/dist/kernel.js +22 -0
- package/dist/middlewares/spaceDeployment.d.ts +2 -0
- package/dist/middlewares/spaceDeployment.js +2 -1
- package/dist/modules/actions/handler.d.ts +11 -0
- package/dist/modules/actions/handler.js +77 -0
- package/dist/modules/connectors/engine.d.ts +42 -0
- package/dist/modules/connectors/engine.js +221 -0
- package/dist/modules/connectors/getByPath.d.ts +8 -0
- package/dist/modules/connectors/getByPath.js +21 -0
- package/dist/modules/connectors/index.d.ts +7 -0
- package/dist/modules/connectors/projection.d.ts +18 -0
- package/dist/modules/connectors/projection.js +108 -0
- package/dist/modules/connectors/resolver.d.ts +18 -0
- package/dist/modules/connectors/resolver.js +68 -0
- package/dist/modules/connectors/types.d.ts +19 -0
- package/dist/{src/modules → modules}/rsc/handler.d.ts +2 -2
- package/dist/modules/rsc/handler.js +54 -2
- package/dist/modules/rsc/resolveRscData.d.ts +35 -0
- package/dist/modules/rsc/resolveRscData.js +74 -0
- package/dist/{src/modules → modules}/ssr/Component.d.ts +4 -1
- package/dist/modules/ssr/Component.js +10 -3
- package/dist/modules/ssr/buildBody.d.ts +9 -0
- package/dist/modules/ssr/handler.d.ts +4 -0
- package/dist/modules/ssr/handler.js +18 -1
- package/dist/{src/modules → modules}/ssr/loadPluginComponents.d.ts +5 -2
- package/dist/modules/ssr/loadPluginComponents.js +20 -2
- package/dist/{src/modules → modules}/ssr/prepareRender.d.ts +2 -2
- package/dist/modules/ssr/prepareRender.js +24 -7
- package/dist/modules/ssr/preview.d.ts +10 -0
- package/dist/modules/ssr/preview.js +5 -78
- package/dist/modules/ssr/registerExternalPlugins.js +1 -1
- package/dist/modules/ssr/streamBody.d.ts +5 -0
- package/dist/modules/ssr/streamBody.js +1 -1
- package/dist/modules/ssr/template.d.ts +2 -0
- package/dist/modules/ssr/template.js +1 -1
- package/dist/plugins/compile.js +1 -1
- package/dist/plugins/manager.js +12 -8
- package/dist/ssr.d.ts +15 -0
- package/dist/ssr.js +4 -0
- package/package.json +29 -25
- package/dist/.gitkeep +0 -0
- package/dist/core/server/mcpServer.js +0 -29
- package/dist/core/services/mcp.js +0 -27
- package/dist/core/services/oauth.js +0 -116
- package/dist/core/services/preview.js +0 -37
- package/dist/core/services/proxy.js +0 -12
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.js +0 -7
- package/dist/modules/ai/AIEngine.js +0 -120
- package/dist/modules/ai/toolkit.js +0 -59
- package/dist/modules/mcp/apps/example/view/index.tsx +0 -70
- package/dist/modules/mcp/apps/index.js +0 -16
- package/dist/modules/mcp/apps/render/index.js +0 -17
- package/dist/modules/mcp/apps/render/styles.js +0 -54
- package/dist/modules/mcp/apps/render/view/heldBatch.ts +0 -107
- package/dist/modules/mcp/apps/render/view/index.tsx +0 -314
- package/dist/modules/mcp/apps/render/view/streamProgress.ts +0 -137
- package/dist/modules/mcp/apps/shared/assets.js +0 -10
- package/dist/modules/mcp/apps/shared/bundle.js +0 -23
- package/dist/modules/mcp/apps/shared/page.js +0 -34
- package/dist/modules/mcp/apps/shared/registerApp.js +0 -43
- package/dist/modules/mcp/apps/shared/resolve.js +0 -5
- package/dist/modules/mcp/apps/shared/shell.ejs +0 -59
- package/dist/modules/mcp/apps/shared/zodEnglishOnly.js +0 -23
- package/dist/modules/mcp/catalogs/builtinCallbacks.js +0 -204
- package/dist/modules/mcp/catalogs/builtinComponents.js +0 -170
- package/dist/modules/mcp/catalogs/builtinElementCallbacks.js +0 -50
- package/dist/modules/mcp/catalogs/builtinTransformers.js +0 -148
- package/dist/modules/mcp/catalogs/builtinUtilities.js +0 -90
- package/dist/modules/mcp/catalogs/cssCatalog/border.js +0 -30
- package/dist/modules/mcp/catalogs/cssCatalog/box.js +0 -31
- package/dist/modules/mcp/catalogs/cssCatalog/helpers.js +0 -185
- package/dist/modules/mcp/catalogs/cssCatalog/index.js +0 -131
- package/dist/modules/mcp/catalogs/cssCatalog/layout.js +0 -98
- package/dist/modules/mcp/catalogs/cssCatalog/visual.js +0 -144
- package/dist/modules/mcp/catalogs/observed.js +0 -90
- package/dist/modules/mcp/catalogs/paramSpec.js +0 -69
- package/dist/modules/mcp/catalogs/registry.js +0 -89
- package/dist/modules/mcp/handler.js +0 -83
- package/dist/modules/mcp/helpers/agentPrompt.js +0 -104
- package/dist/modules/mcp/helpers/computeVersion.js +0 -16
- package/dist/modules/mcp/helpers/guide.js +0 -467
- package/dist/modules/mcp/helpers/interactions.js +0 -123
- package/dist/modules/mcp/helpers/log.js +0 -64
- package/dist/modules/mcp/helpers/opResult.js +0 -18
- package/dist/modules/mcp/helpers/space.js +0 -300
- package/dist/modules/mcp/helpers/uris.js +0 -44
- package/dist/modules/mcp/previewClient.js +0 -31
- package/dist/modules/mcp/proxy/config.js +0 -46
- package/dist/modules/mcp/proxy/fetch.js +0 -91
- package/dist/modules/mcp/proxy/grant.js +0 -65
- package/dist/modules/mcp/proxy/guard.js +0 -38
- package/dist/modules/mcp/proxy/handler.js +0 -68
- package/dist/modules/mcp/proxy/rewrite.js +0 -72
- package/dist/modules/mcp/proxy/sign.js +0 -15
- package/dist/modules/mcp/proxy/types.js +0 -9
- package/dist/modules/mcp/resources/canonical.js +0 -30
- package/dist/modules/mcp/resources/core.js +0 -18
- package/dist/modules/mcp/resources/envelope.js +0 -14
- package/dist/modules/mcp/resources/primer.js +0 -31
- package/dist/modules/mcp/resources/register.js +0 -190
- package/dist/modules/mcp/resources/renderGuide.js +0 -451
- package/dist/modules/mcp/resources/router.js +0 -37
- package/dist/modules/mcp/resources/schema.js +0 -43
- package/dist/modules/mcp/resources/style.js +0 -34
- package/dist/modules/mcp/screenshotClient.js +0 -47
- package/dist/modules/mcp/server.js +0 -113
- package/dist/modules/mcp/tools/apply/dispatch.js +0 -105
- package/dist/modules/mcp/tools/apply/index.js +0 -150
- package/dist/modules/mcp/tools/apply/writeResult.js +0 -37
- package/dist/modules/mcp/tools/index.js +0 -24
- package/dist/modules/mcp/tools/operations/index.js +0 -45
- package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +0 -32
- package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +0 -36
- package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +0 -47
- package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +0 -29
- package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +0 -41
- package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +0 -58
- package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +0 -148
- package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +0 -65
- package/dist/modules/mcp/tools/operations/schema/folders/deleteFolder.js +0 -30
- package/dist/modules/mcp/tools/operations/schema/folders/upsertFolder.js +0 -49
- package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +0 -52
- package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +0 -47
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +0 -44
- package/dist/modules/mcp/tools/operations/schema/operations.js +0 -41
- package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +0 -25
- package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +0 -75
- package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.js +0 -45
- package/dist/modules/mcp/tools/operations/schema/shared.js +0 -122
- package/dist/modules/mcp/tools/operations/schema/translator.js +0 -215
- package/dist/modules/mcp/tools/operations/schema/variables/deleteVariable.js +0 -18
- package/dist/modules/mcp/tools/operations/schema/variables/upsertVariable.js +0 -42
- package/dist/modules/mcp/tools/operations/schema/write.js +0 -109
- package/dist/modules/mcp/tools/operations/schemaIds.js +0 -54
- package/dist/modules/mcp/tools/operations/style/definitions/deleteDefinition.js +0 -21
- package/dist/modules/mcp/tools/operations/style/definitions/patchDefinition.js +0 -28
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinition.js +0 -24
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinitions.js +0 -40
- package/dist/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.js +0 -21
- package/dist/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.js +0 -28
- package/dist/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.js +0 -24
- package/dist/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.js +0 -21
- package/dist/modules/mcp/tools/operations/style/idStyles/patchIdStyle.js +0 -28
- package/dist/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.js +0 -24
- package/dist/modules/mcp/tools/operations/style/operations.js +0 -29
- package/dist/modules/mcp/tools/operations/style/shared.js +0 -59
- package/dist/modules/mcp/tools/operations/style/translator.js +0 -101
- package/dist/modules/mcp/tools/operations/style/variables/deleteStyleVariable.js +0 -21
- package/dist/modules/mcp/tools/operations/style/variables/upsertStyleVariable.js +0 -22
- package/dist/modules/mcp/tools/operations/style/write.js +0 -108
- package/dist/modules/mcp/tools/preview.js +0 -37
- package/dist/modules/mcp/tools/read.js +0 -51
- package/dist/modules/mcp/tools/render.js +0 -184
- package/dist/modules/mcp/tools/screenshot.js +0 -83
- package/dist/modules/mcp/tools/search.js +0 -115
- package/dist/modules/mcp/tools/shared/expandOperations.js +0 -44
- package/dist/modules/mcp/tools/shared/tool.js +0 -33
- package/dist/modules/mcp/tools/shared/validator/audit.js +0 -124
- package/dist/modules/mcp/tools/shared/validator/batch.js +0 -39
- package/dist/modules/mcp/tools/shared/validator/bindings.js +0 -70
- package/dist/modules/mcp/tools/shared/validator/context.js +0 -35
- package/dist/modules/mcp/tools/shared/validator/css.js +0 -39
- package/dist/modules/mcp/tools/shared/validator/elements.js +0 -68
- package/dist/modules/mcp/tools/shared/validator/index.js +0 -246
- package/dist/modules/mcp/tools/shared/validator/interactions.js +0 -103
- package/dist/modules/mcp/tools/shared/validator/refs.js +0 -28
- package/dist/modules/mcp/tools/validate.js +0 -47
- package/dist/modules/oauth/authorize.js +0 -177
- package/dist/modules/oauth/challenge.js +0 -33
- package/dist/modules/oauth/consentPage.js +0 -118
- package/dist/modules/oauth/metadata.js +0 -69
- package/dist/modules/oauth/params.js +0 -5
- package/dist/modules/oauth/pkce.js +0 -15
- package/dist/modules/oauth/records.js +0 -46
- package/dist/modules/oauth/register.js +0 -55
- package/dist/modules/oauth/respond.js +0 -44
- package/dist/modules/oauth/token.js +0 -100
- package/dist/public/.gitkeep +0 -0
- package/dist/src/adapters/jsonAdapters.d.ts +0 -7
- package/dist/src/core/createServer.d.ts +0 -14
- package/dist/src/core/http/stages/health.d.ts +0 -2
- package/dist/src/core/http/stages/middlewares.d.ts +0 -2
- package/dist/src/core/http/stages/static.d.ts +0 -5
- package/dist/src/core/http/types.d.ts +0 -22
- package/dist/src/core/server/mcpServer.d.ts +0 -2
- package/dist/src/core/server/pageServer.d.ts +0 -10
- package/dist/src/core/services/mcp.d.ts +0 -3
- package/dist/src/core/services/oauth.d.ts +0 -18
- package/dist/src/core/services/preview.d.ts +0 -2
- package/dist/src/core/services/proxy.d.ts +0 -2
- package/dist/src/core/services/registry.d.ts +0 -4
- package/dist/src/helpers/buildServerInfo.d.ts +0 -2
- package/dist/src/helpers/compress.d.ts +0 -3
- package/dist/src/index.d.ts +0 -15
- package/dist/src/mcp.d.ts +0 -14
- package/dist/src/middlewares/spaceDeployment.d.ts +0 -2
- package/dist/src/modules/ai/AIEngine.d.ts +0 -20
- package/dist/src/modules/ai/index.d.ts +0 -4
- package/dist/src/modules/ai/toolkit.d.ts +0 -17
- package/dist/src/modules/mcp/apps/example/index.d.ts +0 -8
- package/dist/src/modules/mcp/apps/index.d.ts +0 -11
- package/dist/src/modules/mcp/apps/render/index.d.ts +0 -4
- package/dist/src/modules/mcp/apps/render/styles.d.ts +0 -10
- package/dist/src/modules/mcp/apps/shared/assets.d.ts +0 -10
- package/dist/src/modules/mcp/apps/shared/bundle.d.ts +0 -4
- package/dist/src/modules/mcp/apps/shared/index.d.ts +0 -3
- package/dist/src/modules/mcp/apps/shared/page.d.ts +0 -2
- package/dist/src/modules/mcp/apps/shared/registerApp.d.ts +0 -5
- package/dist/src/modules/mcp/apps/shared/resolve.d.ts +0 -1
- package/dist/src/modules/mcp/apps/shared/zodEnglishOnly.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/builtinCallbacks.d.ts +0 -23
- package/dist/src/modules/mcp/catalogs/builtinComponents.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/builtinElementCallbacks.d.ts +0 -20
- package/dist/src/modules/mcp/catalogs/builtinTransformers.d.ts +0 -28
- package/dist/src/modules/mcp/catalogs/builtinUtilities.d.ts +0 -18
- package/dist/src/modules/mcp/catalogs/cssCatalog/border.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/cssCatalog/box.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/cssCatalog/helpers.d.ts +0 -34
- package/dist/src/modules/mcp/catalogs/cssCatalog/index.d.ts +0 -19
- package/dist/src/modules/mcp/catalogs/cssCatalog/layout.d.ts +0 -9
- package/dist/src/modules/mcp/catalogs/cssCatalog/visual.d.ts +0 -8
- package/dist/src/modules/mcp/catalogs/index.d.ts +0 -9
- package/dist/src/modules/mcp/catalogs/observed.d.ts +0 -48
- package/dist/src/modules/mcp/catalogs/paramSpec.d.ts +0 -42
- package/dist/src/modules/mcp/catalogs/registry.d.ts +0 -35
- package/dist/src/modules/mcp/e2e/index.d.ts +0 -6
- package/dist/src/modules/mcp/e2e/mcpEndpoint.d.ts +0 -27
- package/dist/src/modules/mcp/e2e/postMessageChannel.d.ts +0 -22
- package/dist/src/modules/mcp/e2e/renderingHost.d.ts +0 -34
- package/dist/src/modules/mcp/handler.d.ts +0 -22
- package/dist/src/modules/mcp/helpers/agentPrompt.d.ts +0 -4
- package/dist/src/modules/mcp/helpers/computeVersion.d.ts +0 -1
- package/dist/src/modules/mcp/helpers/guide.d.ts +0 -4
- package/dist/src/modules/mcp/helpers/index.d.ts +0 -8
- package/dist/src/modules/mcp/helpers/interactions.d.ts +0 -30
- package/dist/src/modules/mcp/helpers/log.d.ts +0 -8
- package/dist/src/modules/mcp/helpers/opResult.d.ts +0 -13
- package/dist/src/modules/mcp/helpers/space.d.ts +0 -115
- package/dist/src/modules/mcp/helpers/uris.d.ts +0 -28
- package/dist/src/modules/mcp/index.d.ts +0 -13
- package/dist/src/modules/mcp/previewClient.d.ts +0 -13
- package/dist/src/modules/mcp/proxy/config.d.ts +0 -17
- package/dist/src/modules/mcp/proxy/fetch.d.ts +0 -18
- package/dist/src/modules/mcp/proxy/grant.d.ts +0 -23
- package/dist/src/modules/mcp/proxy/guard.d.ts +0 -6
- package/dist/src/modules/mcp/proxy/handler.d.ts +0 -8
- package/dist/src/modules/mcp/proxy/index.d.ts +0 -7
- package/dist/src/modules/mcp/proxy/rewrite.d.ts +0 -13
- package/dist/src/modules/mcp/proxy/sign.d.ts +0 -6
- package/dist/src/modules/mcp/proxy/types.d.ts +0 -45
- package/dist/src/modules/mcp/resources/canonical.d.ts +0 -6
- package/dist/src/modules/mcp/resources/core.d.ts +0 -5
- package/dist/src/modules/mcp/resources/envelope.d.ts +0 -10
- package/dist/src/modules/mcp/resources/index.d.ts +0 -8
- package/dist/src/modules/mcp/resources/primer.d.ts +0 -7
- package/dist/src/modules/mcp/resources/register.d.ts +0 -10
- package/dist/src/modules/mcp/resources/renderGuide.d.ts +0 -10
- package/dist/src/modules/mcp/resources/router.d.ts +0 -10
- package/dist/src/modules/mcp/resources/schema.d.ts +0 -5
- package/dist/src/modules/mcp/resources/style.d.ts +0 -5
- package/dist/src/modules/mcp/screenshotClient.d.ts +0 -13
- package/dist/src/modules/mcp/server.d.ts +0 -31
- package/dist/src/modules/mcp/tests/helpers.d.ts +0 -13
- package/dist/src/modules/mcp/tools/apply/dispatch.d.ts +0 -6
- package/dist/src/modules/mcp/tools/apply/index.d.ts +0 -470
- package/dist/src/modules/mcp/tools/apply/writeResult.d.ts +0 -8
- package/dist/src/modules/mcp/tools/index.d.ts +0 -18
- package/dist/src/modules/mcp/tools/operations/index.d.ts +0 -928
- package/dist/src/modules/mcp/tools/operations/schema/bindings/deleteBinding.d.ts +0 -17
- package/dist/src/modules/mcp/tools/operations/schema/bindings/patchBinding.d.ts +0 -25
- package/dist/src/modules/mcp/tools/operations/schema/bindings/upsertBinding.d.ts +0 -27
- package/dist/src/modules/mcp/tools/operations/schema/elements/deleteElement.d.ts +0 -10
- package/dist/src/modules/mcp/tools/operations/schema/elements/moveElement.d.ts +0 -16
- package/dist/src/modules/mcp/tools/operations/schema/elements/patchElement.d.ts +0 -22
- package/dist/src/modules/mcp/tools/operations/schema/elements/repeatElement.d.ts +0 -55
- package/dist/src/modules/mcp/tools/operations/schema/elements/upsertElement.d.ts +0 -16
- package/dist/src/modules/mcp/tools/operations/schema/folders/deleteFolder.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/schema/folders/upsertFolder.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/schema/index.d.ts +0 -21
- package/dist/src/modules/mcp/tools/operations/schema/interactions/deleteInteraction.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.d.ts +0 -18
- package/dist/src/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.d.ts +0 -27
- package/dist/src/modules/mcp/tools/operations/schema/operations.d.ts +0 -229
- package/dist/src/modules/mcp/tools/operations/schema/pages/deletePage.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/schema/pages/upsertPage.d.ts +0 -14
- package/dist/src/modules/mcp/tools/operations/schema/settings/patchSettings.d.ts +0 -34
- package/dist/src/modules/mcp/tools/operations/schema/shared.d.ts +0 -92
- package/dist/src/modules/mcp/tools/operations/schema/translator.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/schema/variables/deleteVariable.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/schema/variables/upsertVariable.d.ts +0 -16
- package/dist/src/modules/mcp/tools/operations/schema/write.d.ts +0 -42
- package/dist/src/modules/mcp/tools/operations/schemaIds.d.ts +0 -6
- package/dist/src/modules/mcp/tools/operations/style/definitions/deleteDefinition.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/style/definitions/patchDefinition.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/definitions/upsertDefinition.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/definitions/upsertDefinitions.d.ts +0 -41
- package/dist/src/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/style/idStyles/patchIdStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/index.d.ts +0 -15
- package/dist/src/modules/mcp/tools/operations/style/operations.d.ts +0 -264
- package/dist/src/modules/mcp/tools/operations/style/shared.d.ts +0 -116
- package/dist/src/modules/mcp/tools/operations/style/translator.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/style/variables/deleteStyleVariable.d.ts +0 -15
- package/dist/src/modules/mcp/tools/operations/style/variables/upsertStyleVariable.d.ts +0 -20
- package/dist/src/modules/mcp/tools/operations/style/write.d.ts +0 -12
- package/dist/src/modules/mcp/tools/preview.d.ts +0 -465
- package/dist/src/modules/mcp/tools/read.d.ts +0 -9
- package/dist/src/modules/mcp/tools/render.d.ts +0 -499
- package/dist/src/modules/mcp/tools/render.test.d.ts +0 -1
- package/dist/src/modules/mcp/tools/screenshot.d.ts +0 -470
- package/dist/src/modules/mcp/tools/search.d.ts +0 -15
- package/dist/src/modules/mcp/tools/shared/expandOperations.d.ts +0 -13
- package/dist/src/modules/mcp/tools/shared/tool.d.ts +0 -72
- package/dist/src/modules/mcp/tools/shared/validator/audit.d.ts +0 -4
- package/dist/src/modules/mcp/tools/shared/validator/batch.d.ts +0 -5
- package/dist/src/modules/mcp/tools/shared/validator/bindings.d.ts +0 -6
- package/dist/src/modules/mcp/tools/shared/validator/context.d.ts +0 -38
- package/dist/src/modules/mcp/tools/shared/validator/css.d.ts +0 -4
- package/dist/src/modules/mcp/tools/shared/validator/elements.d.ts +0 -7
- package/dist/src/modules/mcp/tools/shared/validator/index.d.ts +0 -8
- package/dist/src/modules/mcp/tools/shared/validator/interactions.d.ts +0 -3
- package/dist/src/modules/mcp/tools/shared/validator/refs.d.ts +0 -4
- package/dist/src/modules/mcp/tools/validate.d.ts +0 -467
- package/dist/src/modules/mcp/types/aiSchema.d.ts +0 -218
- package/dist/src/modules/mcp/types/appTypes.d.ts +0 -26
- package/dist/src/modules/mcp/types/index.d.ts +0 -5
- package/dist/src/modules/mcp/types/previewTypes.d.ts +0 -25
- package/dist/src/modules/mcp/types/screenshotTypes.d.ts +0 -29
- package/dist/src/modules/mcp/types/toolTypes.d.ts +0 -138
- package/dist/src/modules/oauth/authorize.d.ts +0 -7
- package/dist/src/modules/oauth/challenge.d.ts +0 -11
- package/dist/src/modules/oauth/consentPage.d.ts +0 -7
- package/dist/src/modules/oauth/metadata.d.ts +0 -40
- package/dist/src/modules/oauth/params.d.ts +0 -5
- package/dist/src/modules/oauth/pkce.d.ts +0 -6
- package/dist/src/modules/oauth/records.d.ts +0 -71
- package/dist/src/modules/oauth/register.d.ts +0 -5
- package/dist/src/modules/oauth/respond.d.ts +0 -13
- package/dist/src/modules/oauth/token.d.ts +0 -5
- package/dist/src/modules/ssr/buildBody.d.ts +0 -9
- package/dist/src/modules/ssr/handler.d.ts +0 -4
- package/dist/src/modules/ssr/preview.d.ts +0 -16
- package/dist/src/modules/ssr/streamBody.d.ts +0 -5
- package/dist/src/modules/ssr/template.d.ts +0 -6
- package/dist/src/standalone/alias-loader.d.mts +0 -2
- package/dist/src/standalone/plugins/ClientInfo.d.ts +0 -2
- package/dist/src/standalone/plugins/ServerInfo.d.ts +0 -2
- package/dist/src/standalone/plugins/SharedInfo.d.ts +0 -2
- package/dist/src/standalone/plugins/styles.d.ts +0 -5
- package/dist/src/standalone/register-alias.d.mts +0 -1
- package/dist/src/standalone/server.d.ts +0 -1
- package/dist/src/standalone/stubs/react-syntax-highlighter.d.mts +0 -31
- package/skills/plitzi-render/SKILL.md +0 -174
- /package/dist/{src/core/http/dispatcher.test.d.ts → core/auth/api.test.d.ts} +0 -0
- /package/dist/{src/core/server/mcpServer.test.d.ts → core/auth/authorize.test.d.ts} +0 -0
- /package/dist/{src/modules/ai/toolkit.test.d.ts → core/auth/createAuth.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/apps/apps.test.d.ts → core/auth/domains.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/apps/render/styles.test.d.ts → core/auth/identity.test.d.ts} +0 -0
- /package/dist/{src/modules → core/auth}/oauth/oauth.test.d.ts +0 -0
- /package/dist/{src/modules/mcp/catalogs/builtinTransformers.test.d.ts → core/auth/routes.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/catalogs/cssCatalog/cssCatalog.test.d.ts → core/auth/session.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/e2e/connector.test.d.ts → core/auth/spaceTokens.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/e2e/host.test.d.ts → core/auth/tokens.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/e2e/oauthConnector.test.d.ts → core/createServer.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/helpers/log.test.d.ts → core/handlers/handlers.test.d.ts} +0 -0
- /package/dist/{src/core → core}/health.d.ts +0 -0
- /package/dist/{src/modules/mcp/mcp.bench.d.ts → core/http/dispatcher.test.d.ts} +0 -0
- /package/dist/{src/core → core}/http/securityHeaders.d.ts +0 -0
- /package/dist/{src/core → core}/http/stages/authRoutes.d.ts +0 -0
- /package/dist/{src/core → core}/http/stages/pluginAssets.d.ts +0 -0
- /package/dist/{src/core → core}/mimeTypes.d.ts +0 -0
- /package/dist/{src/modules/mcp/constants.d.ts → core/previewToken.d.ts} +0 -0
- /package/dist/{src/core → core}/requestParser.d.ts +0 -0
- /package/dist/{src/core → core}/server/baseServer.d.ts +0 -0
- /package/dist/{src/modules/mcp/proxy/endpoint.test.d.ts → core/server/baseServer.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/proxy/proxy.test.d.ts → core/services/resolve.test.d.ts} +0 -0
- /package/dist/{src/core → core}/services/rsc.d.ts +0 -0
- /package/dist/{src/core → core}/services/ssr.d.ts +0 -0
- /package/dist/{src/core → core}/staticFiles.d.ts +0 -0
- /package/dist/{src/modules/mcp/proxy/wiring.test.d.ts → helpers/buildResponseHelpers.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/cache/TtlCache.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/cache/cacheManager.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/cache/defaults.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/cache/index.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/apply.test.d.ts → helpers/cache/keys.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/cache/serverCaches.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/bindings.test.d.ts → helpers/compress.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/escapeJson.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/metrics.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/normalizePlugins.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/css.test.d.ts → helpers/offlineDataLoader.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/readCookie.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/interactions.test.d.ts → helpers/resolveDebugMode.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/runMiddlewares.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/serverLog.d.ts +0 -0
- /package/dist/{src/middlewares → middlewares}/auth.d.ts +0 -0
- /package/dist/{src/middlewares → middlewares}/basicAuth.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/pages.test.d.ts → middlewares/spaceDeployment.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/reads.test.d.ts → modules/actions/handler.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/schemaIds.test.d.ts → modules/connectors/engine.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/search.test.d.ts → modules/connectors/projection.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/skill.test.d.ts → modules/connectors/resolver.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/styles.test.d.ts → modules/rsc/resolveRscData.test.d.ts} +0 -0
- /package/dist/{src/modules → modules}/ssr/applySSRResult.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/tools.test.d.ts → modules/ssr/loadPluginComponents.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/validation.test.d.ts → modules/ssr/metering.test.d.ts} +0 -0
- /package/dist/{src/modules → modules}/ssr/registerExternalPlugins.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/compile.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/copy.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/detect.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/manager.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/validate.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/validate.test.d.ts +0 -0
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { defUri, defsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { upsertCssShape } from "../shared.js";
|
|
4
|
-
import { guardKind, writeStyleItem } from "../write.js";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
//#region src/modules/mcp/tools/operations/style/definitions/upsertDefinition.ts
|
|
7
|
-
var upsertDefinitionOp = z.object({
|
|
8
|
-
type: z.literal("upsertDefinition"),
|
|
9
|
-
ref: z.string().describe("Class name you choose (kebab-case), or an existing class ref to fully replace"),
|
|
10
|
-
...upsertCssShape
|
|
11
|
-
}).describe("Create a reusable style class (CSS), or fully replace it when ref exists. Apply it by attaching ref to an element via its style.base. Use patchDefinition to change only some CSS.");
|
|
12
|
-
var upsertDefinition = (space, env, op) => {
|
|
13
|
-
const { type, ref, slots, ...base } = op;
|
|
14
|
-
const guard = guardKind(space.style, ref, "class");
|
|
15
|
-
if (guard) return guard;
|
|
16
|
-
writeStyleItem(space.style, ref, base, slots, "class", void 0);
|
|
17
|
-
return {
|
|
18
|
-
...empty(),
|
|
19
|
-
updated: 1,
|
|
20
|
-
staleResources: [defUri(env, ref), defsUri(env)]
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
export { upsertDefinition, upsertDefinitionOp };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { defUri, defsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { upsertCssShape } from "../shared.js";
|
|
4
|
-
import { guardKind, writeStyleItem } from "../write.js";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
//#region src/modules/mcp/tools/operations/style/definitions/upsertDefinitions.ts
|
|
7
|
-
var definitionBody = z.object(upsertCssShape);
|
|
8
|
-
var upsertDefinitionsOp = z.object({
|
|
9
|
-
type: z.literal("upsertDefinitions"),
|
|
10
|
-
definitions: z.record(z.string(), definitionBody).describe("Every class keyed by the class name you choose (kebab-case); the value is that class CSS")
|
|
11
|
-
}).describe("Create or fully replace SEVERAL style classes in ONE operation — identical to a run of upsertDefinition, minus the repeated envelope, so prefer it whenever a batch declares more than one class. Apply each by attaching its name to an element via style.base. Use patchDefinition to change only some CSS of one class.");
|
|
12
|
-
/** Writes each entry exactly as {@link upsertDefinition} would. Entries are independent: one bad class reports its
|
|
13
|
-
* own error under `definitions.<ref>` and the rest still write — nothing is persisted while the batch carries
|
|
14
|
-
* errors, so a partial write cannot escape. */
|
|
15
|
-
var upsertDefinitions = (space, env, op) => {
|
|
16
|
-
const result = {
|
|
17
|
-
...empty(),
|
|
18
|
-
staleResources: [defsUri(env)]
|
|
19
|
-
};
|
|
20
|
-
const errors = [];
|
|
21
|
-
for (const [ref, { slots, ...base }] of Object.entries(op.definitions)) {
|
|
22
|
-
const guard = guardKind(space.style, ref, "class");
|
|
23
|
-
if (guard?.errors) {
|
|
24
|
-
errors.push(...guard.errors.map((error) => ({
|
|
25
|
-
...error,
|
|
26
|
-
path: `definitions.${ref}`
|
|
27
|
-
})));
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
writeStyleItem(space.style, ref, base, slots, "class", void 0);
|
|
31
|
-
result.updated += 1;
|
|
32
|
-
result.staleResources.push(defUri(env, ref));
|
|
33
|
-
}
|
|
34
|
-
return errors.length > 0 ? {
|
|
35
|
-
...result,
|
|
36
|
-
errors
|
|
37
|
-
} : result;
|
|
38
|
-
};
|
|
39
|
-
//#endregion
|
|
40
|
-
export { upsertDefinitions, upsertDefinitionsOp };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { globalUri, globalsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { MODES, guardKind } from "../write.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.ts
|
|
6
|
-
var deleteGlobalStyleOp = z.object({
|
|
7
|
-
type: z.literal("deleteGlobalStyle"),
|
|
8
|
-
componentType: z.string().describe("Element type whose site-wide style to remove")
|
|
9
|
-
}).describe("Remove the site-wide style for an element type (elements of that type keep their own classes).");
|
|
10
|
-
var deleteGlobalStyle = (space, env, op) => {
|
|
11
|
-
const guard = guardKind(space.style, op.componentType, "element");
|
|
12
|
-
if (guard) return guard;
|
|
13
|
-
for (const mode of MODES) Reflect.deleteProperty(space.style.platform[mode], op.componentType);
|
|
14
|
-
return {
|
|
15
|
-
...empty(),
|
|
16
|
-
deleted: 1,
|
|
17
|
-
staleResources: [globalUri(env, op.componentType), globalsUri(env)]
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
//#endregion
|
|
21
|
-
export { deleteGlobalStyle, deleteGlobalStyleOp };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { globalUri, globalsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { globalStyleToAI } from "../translator.js";
|
|
4
|
-
import { patchCssShape } from "../shared.js";
|
|
5
|
-
import { guardKind, mergePatch, writeStyleItem } from "../write.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.ts
|
|
8
|
-
var patchGlobalStyleOp = z.object({
|
|
9
|
-
type: z.literal("patchGlobalStyle"),
|
|
10
|
-
componentType: z.string().describe("Element type whose global style to merge into; affects ALL of that type"),
|
|
11
|
-
...patchCssShape
|
|
12
|
-
}).describe("Partially update the site-wide style for an element type: CSS is merged (a null value removes a property). Never creates — use upsertGlobalStyle for that.");
|
|
13
|
-
var patchGlobalStyle = (space, env, op) => {
|
|
14
|
-
const guard = guardKind(space.style, op.componentType, "element");
|
|
15
|
-
if (guard) return guard;
|
|
16
|
-
const existing = globalStyleToAI(space.style, op.componentType);
|
|
17
|
-
if (!existing) return fail("componentType", `No global style for "${op.componentType}"`, "patchGlobalStyle only updates an existing global; use upsertGlobalStyle to create one");
|
|
18
|
-
const { type, componentType, slots: slotsPatch, ...basePatch } = op;
|
|
19
|
-
const { base, slots } = mergePatch(existing, basePatch, slotsPatch);
|
|
20
|
-
writeStyleItem(space.style, componentType, base, slots, "element", componentType);
|
|
21
|
-
return {
|
|
22
|
-
...empty(),
|
|
23
|
-
updated: 1,
|
|
24
|
-
staleResources: [globalUri(env, componentType), globalsUri(env)]
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
//#endregion
|
|
28
|
-
export { patchGlobalStyle, patchGlobalStyleOp };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { globalUri, globalsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { upsertCssShape } from "../shared.js";
|
|
4
|
-
import { guardKind, writeStyleItem } from "../write.js";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
//#region src/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.ts
|
|
7
|
-
var upsertGlobalStyleOp = z.object({
|
|
8
|
-
type: z.literal("upsertGlobalStyle"),
|
|
9
|
-
componentType: z.string().describe("Element type to style site-wide (e.g. \"button\"); affects ALL of that type"),
|
|
10
|
-
...upsertCssShape
|
|
11
|
-
}).describe("Create or fully replace the site-wide style for an element TYPE — its CSS applies to every element of that type. To style one element only, use upsertDefinition + attach it. Use patchGlobalStyle for a partial change.");
|
|
12
|
-
var upsertGlobalStyle = (space, env, op) => {
|
|
13
|
-
const { type, componentType, slots, ...base } = op;
|
|
14
|
-
const guard = guardKind(space.style, componentType, "element");
|
|
15
|
-
if (guard) return guard;
|
|
16
|
-
writeStyleItem(space.style, componentType, base, slots, "element", componentType);
|
|
17
|
-
return {
|
|
18
|
-
...empty(),
|
|
19
|
-
updated: 1,
|
|
20
|
-
staleResources: [globalUri(env, componentType), globalsUri(env)]
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
export { upsertGlobalStyle, upsertGlobalStyleOp };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { idUri, idsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { MODES, guardKind } from "../write.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.ts
|
|
6
|
-
var deleteIdStyleOp = z.object({
|
|
7
|
-
type: z.literal("deleteIdStyle"),
|
|
8
|
-
targetId: z.string().describe("DOM id whose id rule to remove (without the # prefix)")
|
|
9
|
-
}).describe("Remove the id rule (`#id`) for a single element (the element keeps its own classes).");
|
|
10
|
-
var deleteIdStyle = (space, env, op) => {
|
|
11
|
-
const guard = guardKind(space.style, op.targetId, "id");
|
|
12
|
-
if (guard) return guard;
|
|
13
|
-
for (const mode of MODES) Reflect.deleteProperty(space.style.platform[mode], op.targetId);
|
|
14
|
-
return {
|
|
15
|
-
...empty(),
|
|
16
|
-
deleted: 1,
|
|
17
|
-
staleResources: [idUri(env, op.targetId), idsUri(env)]
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
//#endregion
|
|
21
|
-
export { deleteIdStyle, deleteIdStyleOp };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { idUri, idsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { idStyleToAI } from "../translator.js";
|
|
4
|
-
import { patchCssShape } from "../shared.js";
|
|
5
|
-
import { guardKind, mergePatch, writeStyleItem } from "../write.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/modules/mcp/tools/operations/style/idStyles/patchIdStyle.ts
|
|
8
|
-
var patchIdStyleOp = z.object({
|
|
9
|
-
type: z.literal("patchIdStyle"),
|
|
10
|
-
targetId: z.string().describe("DOM id whose id rule to merge into (without the # prefix)"),
|
|
11
|
-
...patchCssShape
|
|
12
|
-
}).describe("Partially update the CSS of an id rule (`#id`): CSS is merged (a null value removes a property). Never creates — use upsertIdStyle for that.");
|
|
13
|
-
var patchIdStyle = (space, env, op) => {
|
|
14
|
-
const guard = guardKind(space.style, op.targetId, "id");
|
|
15
|
-
if (guard) return guard;
|
|
16
|
-
const existing = idStyleToAI(space.style, op.targetId);
|
|
17
|
-
if (!existing) return fail("targetId", `No id rule for "${op.targetId}"`, "patchIdStyle only updates an existing id rule; use upsertIdStyle to create one");
|
|
18
|
-
const { type, targetId, slots: slotsPatch, ...basePatch } = op;
|
|
19
|
-
const { base, slots } = mergePatch(existing, basePatch, slotsPatch);
|
|
20
|
-
writeStyleItem(space.style, targetId, base, slots, "id", void 0);
|
|
21
|
-
return {
|
|
22
|
-
...empty(),
|
|
23
|
-
updated: 1,
|
|
24
|
-
staleResources: [idUri(env, targetId), idsUri(env)]
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
//#endregion
|
|
28
|
-
export { patchIdStyle, patchIdStyleOp };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { idUri, idsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { upsertCssShape } from "../shared.js";
|
|
4
|
-
import { guardKind, writeStyleItem } from "../write.js";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
//#region src/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.ts
|
|
7
|
-
var upsertIdStyleOp = z.object({
|
|
8
|
-
type: z.literal("upsertIdStyle"),
|
|
9
|
-
targetId: z.string().describe("DOM id of the element to style (without the # prefix); matches its `id` attribute"),
|
|
10
|
-
...upsertCssShape
|
|
11
|
-
}).describe("Create or fully replace the CSS for a single element addressed by its DOM id (`#id`). The element must carry that `id` attribute. To style by reusable class instead, use upsertDefinition. Use patchIdStyle for a partial change.");
|
|
12
|
-
var upsertIdStyle = (space, env, op) => {
|
|
13
|
-
const { type, targetId, slots, ...base } = op;
|
|
14
|
-
const guard = guardKind(space.style, targetId, "id");
|
|
15
|
-
if (guard) return guard;
|
|
16
|
-
writeStyleItem(space.style, targetId, base, slots, "id", void 0);
|
|
17
|
-
return {
|
|
18
|
-
...empty(),
|
|
19
|
-
updated: 1,
|
|
20
|
-
staleResources: [idUri(env, targetId), idsUri(env)]
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
//#endregion
|
|
24
|
-
export { upsertIdStyle, upsertIdStyleOp };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { deleteDefinitionOp } from "./definitions/deleteDefinition.js";
|
|
2
|
-
import { patchDefinitionOp } from "./definitions/patchDefinition.js";
|
|
3
|
-
import { upsertDefinitionOp } from "./definitions/upsertDefinition.js";
|
|
4
|
-
import { upsertDefinitionsOp } from "./definitions/upsertDefinitions.js";
|
|
5
|
-
import { deleteGlobalStyleOp } from "./globalStyles/deleteGlobalStyle.js";
|
|
6
|
-
import { patchGlobalStyleOp } from "./globalStyles/patchGlobalStyle.js";
|
|
7
|
-
import { upsertGlobalStyleOp } from "./globalStyles/upsertGlobalStyle.js";
|
|
8
|
-
import { deleteIdStyleOp } from "./idStyles/deleteIdStyle.js";
|
|
9
|
-
import { patchIdStyleOp } from "./idStyles/patchIdStyle.js";
|
|
10
|
-
import { upsertIdStyleOp } from "./idStyles/upsertIdStyle.js";
|
|
11
|
-
import { deleteStyleVariableOp } from "./variables/deleteStyleVariable.js";
|
|
12
|
-
import { upsertStyleVariableOp } from "./variables/upsertStyleVariable.js";
|
|
13
|
-
//#region src/modules/mcp/tools/operations/style/operations.ts
|
|
14
|
-
var styleOps = {
|
|
15
|
-
upsertDefinition: upsertDefinitionOp,
|
|
16
|
-
upsertDefinitions: upsertDefinitionsOp,
|
|
17
|
-
patchDefinition: patchDefinitionOp,
|
|
18
|
-
deleteDefinition: deleteDefinitionOp,
|
|
19
|
-
upsertGlobalStyle: upsertGlobalStyleOp,
|
|
20
|
-
patchGlobalStyle: patchGlobalStyleOp,
|
|
21
|
-
deleteGlobalStyle: deleteGlobalStyleOp,
|
|
22
|
-
upsertIdStyle: upsertIdStyleOp,
|
|
23
|
-
patchIdStyle: patchIdStyleOp,
|
|
24
|
-
deleteIdStyle: deleteIdStyleOp,
|
|
25
|
-
upsertStyleVariable: upsertStyleVariableOp,
|
|
26
|
-
deleteStyleVariable: deleteStyleVariableOp
|
|
27
|
-
};
|
|
28
|
-
//#endregion
|
|
29
|
-
export { styleOps };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
//#region src/modules/mcp/tools/operations/style/shared.ts
|
|
3
|
-
var cssMap = z.record(z.string(), z.union([z.string(), z.number()])).describe("Plain kebab-case CSS. Shorthands are welcome — `border: 1px solid red`, `padding: 8px 16px`, `font: bold 16px/1.5 Arial`, `transition: opacity 200ms ease` — and are stored as their longhands so a breakpoint/state/variant can override each property on its own. Use var(--name) for style tokens and {{name}} for schema vars.");
|
|
4
|
-
var displayModeCss = z.object({
|
|
5
|
-
desktop: cssMap.optional(),
|
|
6
|
-
tablet: cssMap.optional(),
|
|
7
|
-
mobile: cssMap.optional()
|
|
8
|
-
});
|
|
9
|
-
var definitionSlot = displayModeCss.extend({
|
|
10
|
-
states: z.record(z.string(), displayModeCss).optional(),
|
|
11
|
-
variants: z.record(z.string(), displayModeCss).optional()
|
|
12
|
-
});
|
|
13
|
-
var cssPatchMap = z.record(z.string(), z.union([
|
|
14
|
-
z.string(),
|
|
15
|
-
z.number(),
|
|
16
|
-
z.null()
|
|
17
|
-
])).describe("Plain kebab-case CSS merged onto the existing declarations; shorthands are accepted and expanded, so `padding: 8px` replaces all four sides. A value of null removes the property — null on a shorthand (`border: null`) removes every longhand it controls.");
|
|
18
|
-
var displayModeCssPatch = z.object({
|
|
19
|
-
desktop: cssPatchMap.optional(),
|
|
20
|
-
tablet: cssPatchMap.optional(),
|
|
21
|
-
mobile: cssPatchMap.optional()
|
|
22
|
-
});
|
|
23
|
-
var definitionSlotPatch = displayModeCssPatch.extend({
|
|
24
|
-
states: z.record(z.string(), displayModeCssPatch).optional(),
|
|
25
|
-
variants: z.record(z.string(), displayModeCssPatch).optional()
|
|
26
|
-
});
|
|
27
|
-
var styleCategory = z.enum([
|
|
28
|
-
"color",
|
|
29
|
-
"spacing",
|
|
30
|
-
"shadow",
|
|
31
|
-
"custom"
|
|
32
|
-
]);
|
|
33
|
-
var themeValue = z.union([
|
|
34
|
-
z.string(),
|
|
35
|
-
z.number(),
|
|
36
|
-
z.object({
|
|
37
|
-
light: z.string().optional(),
|
|
38
|
-
dark: z.string().optional(),
|
|
39
|
-
default: z.string().optional()
|
|
40
|
-
})
|
|
41
|
-
]);
|
|
42
|
-
var upsertCssShape = {
|
|
43
|
-
desktop: cssMap.optional(),
|
|
44
|
-
tablet: cssMap.optional(),
|
|
45
|
-
mobile: cssMap.optional(),
|
|
46
|
-
states: z.record(z.string(), displayModeCss).optional(),
|
|
47
|
-
variants: z.record(z.string(), displayModeCss).optional(),
|
|
48
|
-
slots: z.record(z.string(), definitionSlot).optional()
|
|
49
|
-
};
|
|
50
|
-
var patchCssShape = {
|
|
51
|
-
desktop: cssPatchMap.optional(),
|
|
52
|
-
tablet: cssPatchMap.optional(),
|
|
53
|
-
mobile: cssPatchMap.optional(),
|
|
54
|
-
states: z.record(z.string(), displayModeCssPatch).optional(),
|
|
55
|
-
variants: z.record(z.string(), displayModeCssPatch).optional(),
|
|
56
|
-
slots: z.record(z.string(), definitionSlotPatch).optional()
|
|
57
|
-
};
|
|
58
|
-
//#endregion
|
|
59
|
-
export { cssMap, cssPatchMap, definitionSlot, definitionSlotPatch, displayModeCss, displayModeCssPatch, patchCssShape, styleCategory, themeValue, upsertCssShape };
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
//#region src/modules/mcp/tools/operations/style/translator.ts
|
|
2
|
-
var DISPLAY_MODES = [
|
|
3
|
-
"desktop",
|
|
4
|
-
"tablet",
|
|
5
|
-
"mobile"
|
|
6
|
-
];
|
|
7
|
-
var isClassDefinition = (item) => item.type === "class";
|
|
8
|
-
var definitionRefs = (style) => {
|
|
9
|
-
const refs = /* @__PURE__ */ new Set();
|
|
10
|
-
for (const mode of DISPLAY_MODES) for (const [name, item] of Object.entries(style.platform[mode])) if (isClassDefinition(item)) refs.add(name);
|
|
11
|
-
return Array.from(refs).sort();
|
|
12
|
-
};
|
|
13
|
-
var fillSlot = (target, mode, block) => {
|
|
14
|
-
if (block.default && Object.keys(block.default).length > 0) target[mode] = block.default;
|
|
15
|
-
if (block.states) {
|
|
16
|
-
for (const [state, obj] of Object.entries(block.states)) if (Object.keys(obj).length > 0) {
|
|
17
|
-
(target.states ??= {})[state] ??= {};
|
|
18
|
-
target.states[state][mode] = obj;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
if (block.variants) {
|
|
22
|
-
for (const [name, variant] of Object.entries(block.variants)) if (variant.default && Object.keys(variant.default).length > 0) {
|
|
23
|
-
(target.variants ??= {})[name] ??= {};
|
|
24
|
-
target.variants[name][mode] = variant.default;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
var projectItem = (style, ref, accept) => {
|
|
29
|
-
const def = { ref };
|
|
30
|
-
let found = false;
|
|
31
|
-
for (const mode of DISPLAY_MODES) {
|
|
32
|
-
const item = style.platform[mode][ref];
|
|
33
|
-
if (!item || !accept(item)) continue;
|
|
34
|
-
found = true;
|
|
35
|
-
for (const [slot, block] of Object.entries(item.attributes)) if (slot === "base") fillSlot(def, mode, block);
|
|
36
|
-
else fillSlot((def.slots ??= {})[slot] ??= {}, mode, block);
|
|
37
|
-
}
|
|
38
|
-
return found ? def : void 0;
|
|
39
|
-
};
|
|
40
|
-
var definitionToAI = (style, ref) => projectItem(style, ref, isClassDefinition);
|
|
41
|
-
var definitionVariantNames = (style, ref) => {
|
|
42
|
-
const def = definitionToAI(style, ref);
|
|
43
|
-
if (!def) return;
|
|
44
|
-
const result = {};
|
|
45
|
-
const baseVariants = Object.keys(def.variants ?? {});
|
|
46
|
-
if (baseVariants.length > 0) result.base = baseVariants.sort();
|
|
47
|
-
for (const [slot, slotDef] of Object.entries(def.slots ?? {})) {
|
|
48
|
-
const variants = Object.keys(slotDef.variants ?? {});
|
|
49
|
-
if (variants.length > 0) result[slot] = variants.sort();
|
|
50
|
-
}
|
|
51
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
52
|
-
};
|
|
53
|
-
var globalStylesForType = (style, componentType) => {
|
|
54
|
-
const isGlobal = (item) => item.type === "element" && item.componentType === componentType;
|
|
55
|
-
const refs = /* @__PURE__ */ new Set();
|
|
56
|
-
for (const mode of DISPLAY_MODES) for (const [name, item] of Object.entries(style.platform[mode])) if (isGlobal(item)) refs.add(name);
|
|
57
|
-
const globals = [];
|
|
58
|
-
for (const ref of Array.from(refs).sort()) {
|
|
59
|
-
const def = projectItem(style, ref, isGlobal);
|
|
60
|
-
if (def) globals.push({
|
|
61
|
-
...def,
|
|
62
|
-
appliesToType: componentType
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return globals;
|
|
66
|
-
};
|
|
67
|
-
var globalStyleToAI = (style, componentType) => {
|
|
68
|
-
const def = projectItem(style, componentType, (item) => item.type === "element" && item.componentType === componentType);
|
|
69
|
-
return def ? {
|
|
70
|
-
...def,
|
|
71
|
-
appliesToType: componentType
|
|
72
|
-
} : void 0;
|
|
73
|
-
};
|
|
74
|
-
var globalStyleTypes = (style) => {
|
|
75
|
-
const types = /* @__PURE__ */ new Set();
|
|
76
|
-
for (const mode of DISPLAY_MODES) for (const item of Object.values(style.platform[mode])) if (item.type === "element" && item.componentType) types.add(item.componentType);
|
|
77
|
-
return Array.from(types).sort();
|
|
78
|
-
};
|
|
79
|
-
var idStyleIds = (style) => {
|
|
80
|
-
const ids = /* @__PURE__ */ new Set();
|
|
81
|
-
for (const mode of DISPLAY_MODES) for (const [name, item] of Object.entries(style.platform[mode])) if (item.type === "id") ids.add(name);
|
|
82
|
-
return Array.from(ids).sort();
|
|
83
|
-
};
|
|
84
|
-
var idStyleToAI = (style, targetId) => {
|
|
85
|
-
const def = projectItem(style, targetId, (item) => item.type === "id");
|
|
86
|
-
return def ? {
|
|
87
|
-
...def,
|
|
88
|
-
targetId
|
|
89
|
-
} : void 0;
|
|
90
|
-
};
|
|
91
|
-
var styleVariablesToAI = (style) => {
|
|
92
|
-
const data = {};
|
|
93
|
-
for (const [category, group] of Object.entries(style.variables)) data[category] = Object.entries(group).map(([name, value]) => ({
|
|
94
|
-
name,
|
|
95
|
-
reference: `var(--${name})`,
|
|
96
|
-
value
|
|
97
|
-
}));
|
|
98
|
-
return data;
|
|
99
|
-
};
|
|
100
|
-
//#endregion
|
|
101
|
-
export { definitionRefs, definitionToAI, definitionVariantNames, globalStyleToAI, globalStyleTypes, globalStylesForType, idStyleIds, idStyleToAI, isClassDefinition, styleVariablesToAI };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { styleVarUri, styleVarsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { styleCategory } from "../shared.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/style/variables/deleteStyleVariable.ts
|
|
6
|
-
var deleteStyleVariableOp = z.object({
|
|
7
|
-
type: z.literal("deleteStyleVariable"),
|
|
8
|
-
category: styleCategory,
|
|
9
|
-
name: z.string().describe("Token name without the -- prefix")
|
|
10
|
-
}).describe("Delete a design token by category + name.");
|
|
11
|
-
var deleteStyleVariable = (space, env, op) => {
|
|
12
|
-
const group = space.style.variables[op.category];
|
|
13
|
-
if (group) Reflect.deleteProperty(group, op.name);
|
|
14
|
-
return {
|
|
15
|
-
...empty(),
|
|
16
|
-
deleted: 1,
|
|
17
|
-
staleResources: [styleVarUri(env, op.category), styleVarsUri(env)]
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
//#endregion
|
|
21
|
-
export { deleteStyleVariable, deleteStyleVariableOp };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { styleVarUri, styleVarsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { styleCategory, themeValue } from "../shared.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/style/variables/upsertStyleVariable.ts
|
|
6
|
-
var upsertStyleVariableOp = z.object({
|
|
7
|
-
type: z.literal("upsertStyleVariable"),
|
|
8
|
-
category: styleCategory,
|
|
9
|
-
name: z.string().describe("Token name without the -- prefix; referenced in CSS as var(--name)"),
|
|
10
|
-
value: themeValue
|
|
11
|
-
}).describe("Create or update a design token (referenced in CSS as var(--name); value may differ per light/dark).");
|
|
12
|
-
var upsertStyleVariable = (space, env, op) => {
|
|
13
|
-
const group = space.style.variables[op.category] ??= {};
|
|
14
|
-
group[op.name] = op.value;
|
|
15
|
-
return {
|
|
16
|
-
...empty(),
|
|
17
|
-
updated: 1,
|
|
18
|
-
staleResources: [styleVarUri(env, op.category), styleVarsUri(env)]
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
//#endregion
|
|
22
|
-
export { upsertStyleVariable, upsertStyleVariableOp };
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { expandShorthand, expandShorthandPatch } from "../../../catalogs/cssCatalog/index.js";
|
|
2
|
-
import { defUri, defsUri, globalUri, globalsUri, idUri, idsUri, styleVarUri, styleVarsUri } from "../../../helpers/uris.js";
|
|
3
|
-
import { fail } from "../../../helpers/opResult.js";
|
|
4
|
-
import processSelector from "@plitzi/sdk-style/helpers/processSelector";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/style/write.ts
|
|
6
|
-
var MODES = [
|
|
7
|
-
"desktop",
|
|
8
|
-
"tablet",
|
|
9
|
-
"mobile"
|
|
10
|
-
];
|
|
11
|
-
var KIND_LABEL = {
|
|
12
|
-
class: "a reusable class definition",
|
|
13
|
-
element: "a global style for an element type",
|
|
14
|
-
id: "an id rule targeting a single element"
|
|
15
|
-
};
|
|
16
|
-
var KIND_TOOL = {
|
|
17
|
-
class: "upsertDefinition/patchDefinition",
|
|
18
|
-
element: "upsertGlobalStyle/patchGlobalStyle",
|
|
19
|
-
id: "upsertIdStyle/patchIdStyle"
|
|
20
|
-
};
|
|
21
|
-
var KIND_FIELD = {
|
|
22
|
-
class: "ref",
|
|
23
|
-
element: "componentType",
|
|
24
|
-
id: "targetId"
|
|
25
|
-
};
|
|
26
|
-
var guardKind = (style, ref, want) => {
|
|
27
|
-
const clash = MODES.map((mode) => style.platform[mode][ref]).find((item) => item !== void 0 && item.type !== want);
|
|
28
|
-
if (!clash) return null;
|
|
29
|
-
return fail(KIND_FIELD[want], `"${ref}" is already ${KIND_LABEL[clash.type]}; it cannot be edited as ${KIND_LABEL[want]}`, `Edit it with ${KIND_TOOL[clash.type]}, or choose a different ${KIND_FIELD[want]}.`);
|
|
30
|
-
};
|
|
31
|
-
var slotToBlocks = (slot) => {
|
|
32
|
-
const perMode = {};
|
|
33
|
-
for (const mode of MODES) {
|
|
34
|
-
const block = {};
|
|
35
|
-
const baseCss = slot[mode];
|
|
36
|
-
if (baseCss && Object.keys(baseCss).length > 0) block.default = expandShorthand(baseCss);
|
|
37
|
-
for (const [state, dm] of Object.entries(slot.states ?? {})) if (dm[mode]) (block.states ??= {})[state] = expandShorthand(dm[mode]);
|
|
38
|
-
for (const [name, dm] of Object.entries(slot.variants ?? {})) if (dm[mode]) (block.variants ??= {})[name] = { default: expandShorthand(dm[mode]) };
|
|
39
|
-
if (Object.keys(block).length > 0) perMode[mode] = block;
|
|
40
|
-
}
|
|
41
|
-
return perMode;
|
|
42
|
-
};
|
|
43
|
-
var writeStyleItem = (style, ref, base, slots, itemType, componentType) => {
|
|
44
|
-
for (const mode of MODES) {
|
|
45
|
-
const attributes = {};
|
|
46
|
-
const baseBlocks = slotToBlocks(base);
|
|
47
|
-
if (baseBlocks[mode]) attributes.base = baseBlocks[mode];
|
|
48
|
-
for (const [slotName, slotDef] of Object.entries(slots ?? {})) {
|
|
49
|
-
const blocks = slotToBlocks(slotDef);
|
|
50
|
-
if (blocks[mode]) attributes[slotName] = blocks[mode];
|
|
51
|
-
}
|
|
52
|
-
if (Object.keys(attributes).length === 0) Reflect.deleteProperty(style.platform[mode], ref);
|
|
53
|
-
else {
|
|
54
|
-
const styleItem = {
|
|
55
|
-
name: ref,
|
|
56
|
-
type: itemType,
|
|
57
|
-
attributes,
|
|
58
|
-
cache: ""
|
|
59
|
-
};
|
|
60
|
-
if (componentType !== void 0) styleItem.componentType = componentType;
|
|
61
|
-
styleItem.cache = processSelector(styleItem);
|
|
62
|
-
style.platform[mode][ref] = styleItem;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var mergeCss = (base, patch) => {
|
|
67
|
-
const merged = { ...base };
|
|
68
|
-
for (const [key, value] of Object.entries(expandShorthandPatch(patch ?? {}))) if (value === null) Reflect.deleteProperty(merged, key);
|
|
69
|
-
else merged[key] = value;
|
|
70
|
-
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
71
|
-
};
|
|
72
|
-
var mergeDisplayMode = (base, patch) => {
|
|
73
|
-
const result = {};
|
|
74
|
-
for (const mode of MODES) {
|
|
75
|
-
const css = mergeCss(base?.[mode], patch?.[mode]);
|
|
76
|
-
if (css) result[mode] = css;
|
|
77
|
-
}
|
|
78
|
-
return result;
|
|
79
|
-
};
|
|
80
|
-
var mergeNamedModes = (base, patch) => {
|
|
81
|
-
const names = /* @__PURE__ */ new Set([...Object.keys(base ?? {}), ...Object.keys(patch ?? {})]);
|
|
82
|
-
const result = {};
|
|
83
|
-
for (const name of names) {
|
|
84
|
-
const dm = mergeDisplayMode(base?.[name], patch?.[name]);
|
|
85
|
-
if (Object.keys(dm).length > 0) result[name] = dm;
|
|
86
|
-
}
|
|
87
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
88
|
-
};
|
|
89
|
-
var mergeSlot = (base, patch) => {
|
|
90
|
-
const merged = mergeDisplayMode(base, patch);
|
|
91
|
-
const states = mergeNamedModes(base?.states, patch.states);
|
|
92
|
-
if (states) merged.states = states;
|
|
93
|
-
const variants = mergeNamedModes(base?.variants, patch.variants);
|
|
94
|
-
if (variants) merged.variants = variants;
|
|
95
|
-
return merged;
|
|
96
|
-
};
|
|
97
|
-
var mergePatch = (existing, basePatch, slotsPatch) => {
|
|
98
|
-
const base = mergeSlot(existing, basePatch);
|
|
99
|
-
const slotNames = /* @__PURE__ */ new Set([...Object.keys(existing.slots ?? {}), ...Object.keys(slotsPatch ?? {})]);
|
|
100
|
-
const slots = {};
|
|
101
|
-
for (const name of slotNames) slots[name] = mergeSlot(existing.slots?.[name], slotsPatch?.[name] ?? {});
|
|
102
|
-
return {
|
|
103
|
-
base,
|
|
104
|
-
slots: Object.keys(slots).length > 0 ? slots : void 0
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
//#endregion
|
|
108
|
-
export { MODES, defUri, defsUri, globalUri, globalsUri, guardKind, idUri, idsUri, mergePatch, styleVarUri, styleVarsUri, writeStyleItem };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { operation } from "./operations/index.js";
|
|
2
|
-
import { defineTool } from "./shared/tool.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
//#region src/modules/mcp/tools/preview.ts
|
|
5
|
-
var previewShape = {
|
|
6
|
-
pageRef: z.string().optional().describe("Page ref or id to preview; defaults to the space default page"),
|
|
7
|
-
operations: z.array(operation).max(100).optional().describe("Unsaved edits to apply to a throwaway clone before rendering, so you can preview a change WITHOUT persisting it (same op vocabulary as plitzi_apply). Omit to preview the current saved state.")
|
|
8
|
-
};
|
|
9
|
-
var previewTool = defineTool({
|
|
10
|
-
name: "plitzi_preview",
|
|
11
|
-
title: "Preview (HTML)",
|
|
12
|
-
description: "Render a page to a full HTML document to inspect the structure of your edits. Pass unsaved `operations` to preview a change before committing (nothing is persisted). Returns the HTML plus the page path and stateVersion. For a real rendered IMAGE that reveals visual issues like overflow, use plitzi_screenshot.",
|
|
13
|
-
inputShape: previewShape,
|
|
14
|
-
access: "read",
|
|
15
|
-
run: async (input, ctx) => {
|
|
16
|
-
if (!ctx.preview || ctx.spaceId === void 0) return {
|
|
17
|
-
error: "PREVIEW_UNAVAILABLE",
|
|
18
|
-
message: "Visual preview is not enabled on this server.",
|
|
19
|
-
hint: "Preview needs the SSR render service; it is unavailable in MCP-only mode."
|
|
20
|
-
};
|
|
21
|
-
const result = await ctx.preview.render({
|
|
22
|
-
spaceId: ctx.spaceId,
|
|
23
|
-
env: ctx.env,
|
|
24
|
-
pageRef: input.pageRef,
|
|
25
|
-
operations: input.operations
|
|
26
|
-
});
|
|
27
|
-
if (!result.ok) return result;
|
|
28
|
-
return {
|
|
29
|
-
pageRef: input.pageRef ?? "default",
|
|
30
|
-
pagePath: result.pagePath,
|
|
31
|
-
stateVersion: result.stateVersion,
|
|
32
|
-
html: result.html
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
//#endregion
|
|
37
|
-
export { previewShape, previewTool };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { noSpaceError, unauthorizedSpaceMessage } from "../helpers/space.js";
|
|
2
|
-
import { resourceErrorMessage } from "../resources/canonical.js";
|
|
3
|
-
import { RENDER_GUIDE_URI, RENDER_TYPES_URI } from "../resources/renderGuide.js";
|
|
4
|
-
import { readPublicResource, readResource } from "../resources/router.js";
|
|
5
|
-
import { defineTool } from "./shared/tool.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/modules/mcp/tools/read.ts
|
|
8
|
-
var readShape = { uris: z.array(z.string()).min(1).max(50).describe("Resource URIs to read in one batch (max 50). Use the ready-made uris from search / write responses.") };
|
|
9
|
-
var read = (input, space, env) => {
|
|
10
|
-
return { results: input.uris.map((uri) => {
|
|
11
|
-
const found = readResource(space, env, uri);
|
|
12
|
-
if (found) return {
|
|
13
|
-
uri,
|
|
14
|
-
stateVersion: found.stateVersion,
|
|
15
|
-
data: found.data
|
|
16
|
-
};
|
|
17
|
-
const parsed = JSON.parse(resourceErrorMessage(env, uri));
|
|
18
|
-
return {
|
|
19
|
-
uri,
|
|
20
|
-
error: parsed.error,
|
|
21
|
-
message: parsed.message,
|
|
22
|
-
hint: parsed.hint
|
|
23
|
-
};
|
|
24
|
-
}) };
|
|
25
|
-
};
|
|
26
|
-
var publicHint = `Readable on this connection: ${RENDER_GUIDE_URI}, ${RENDER_TYPES_URI}, plitzi://guide, plitzi://css-properties. Everything else lives in a space this connection has none of.`;
|
|
27
|
-
var readPublic = (input, env) => ({ results: input.uris.map((uri) => {
|
|
28
|
-
const found = readPublicResource(env, uri);
|
|
29
|
-
if (found) return {
|
|
30
|
-
uri,
|
|
31
|
-
stateVersion: found.stateVersion,
|
|
32
|
-
data: found.data
|
|
33
|
-
};
|
|
34
|
-
return {
|
|
35
|
-
uri,
|
|
36
|
-
error: noSpaceError,
|
|
37
|
-
message: unauthorizedSpaceMessage,
|
|
38
|
-
hint: publicHint
|
|
39
|
-
};
|
|
40
|
-
}) });
|
|
41
|
-
var readTool = defineTool({
|
|
42
|
-
name: "plitzi_read",
|
|
43
|
-
title: "Batch read",
|
|
44
|
-
description: "Batch-fetch resource content for URIs you ALREADY HOLD (from plitzi_search or a write response) — the tool form of opening MCP resources, for many at once. Pass an array of URIs (pages, elements, definitions, variables) and get them all in one call. NOT for finding things: to locate an element by label/type use plitzi_search; to browse what exists, list the plitzi:// resources. Each result is { uri, stateVersion, data } or a teachable error, so one bad URI never fails the batch. Never hand-build a URI to guess your way to an element — search for it.",
|
|
45
|
-
inputShape: readShape,
|
|
46
|
-
access: "read",
|
|
47
|
-
run: (input, ctx) => read(input, ctx.space, ctx.env),
|
|
48
|
-
runPublic: readPublic
|
|
49
|
-
});
|
|
50
|
-
//#endregion
|
|
51
|
-
export { read, readPublic, readShape, readTool };
|