@reqvire-org/ads 0.3.44 → 0.3.45
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/README.md +27 -9
- package/dist/assets.mjs +4 -4
- package/dist/brand-assets.mjs +41 -7
- package/dist/cli.mjs +21 -9
- package/dist/config.mjs +19 -10
- package/dist/create.mjs +48 -0
- package/dist/image-size.mjs +28 -0
- package/dist/index.mjs +1 -0
- package/dist/init.mjs +4 -5
- package/dist/mcp/preview-widget.bundle.js +1 -1
- package/dist/mcp/project-widget.bundle.js +1 -1
- package/dist/mcp/server.mjs +3 -4
- package/dist/mcp/skills.mjs +1 -1
- package/dist/preview-resources.mjs +1 -1
- package/dist/scenario-groups.mjs +2 -2
- package/dist/scenario-registry.mjs +3 -3
- package/dist/scenarios-compiler.mjs +1 -1
- package/dist/scenarios.mjs +6 -11
- package/dist/showcase/client.bundle.js +22 -22
- package/dist/showcase/draft-navigation.js +1 -1
- package/dist/showcase/index.html +1 -0
- package/dist/skills/ads-break-ui/SKILL.md +1 -1
- package/dist/skills/ads-designer/README.md +2 -2
- package/dist/skills/ads-designer/SKILL.md +37 -56
- package/dist/skills/ads-designer/references/branding.md +24 -9
- package/dist/skills/ads-designer/references/cli.md +5 -4
- package/dist/skills/ads-import/SKILL.md +1 -1
- package/dist/skills/ads-import/references/branding.md +4 -3
- package/dist/skills/ads-import/references/cli.md +5 -4
- package/dist/skills/ads-motion/SKILL.md +1 -1
- package/dist/skills/ads-port/SKILL.md +1 -1
- package/dist/skills/ads-port/references/cli.md +5 -4
- package/dist/{bootstrap-ds → starters/react}/README.md +13 -19
- package/dist/{skills/ads-designer/assets/bootstrap-ds → starters/react}/design-system/assets/brand/README.md +1 -1
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +7 -0
- package/dist/{bootstrap-ds/design-system/tokens/Brand.ads.scenario.tsx → starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx} +2 -2
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +7 -0
- package/dist/{skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Brand.ads.scenario.tsx → starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx} +2 -2
- package/dist/{skills/ads-designer/assets/bootstrap-ds → starters/react}/tsconfig.build.json +2 -1
- package/dist/task-cache.mjs +1 -1
- package/dist/token-fixtures.mjs +1 -1
- package/dist/units.mjs +6 -6
- package/dist/validation.mjs +1 -1
- package/docs/ADS.md +4 -4
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CHANGELOG.md +36 -12
- package/docs/GUIDE.md +25 -22
- package/package.json +3 -5
- package/dist/bootstrap-ds/design-system/assets/brand/README.md +0 -36
- package/dist/bootstrap-ds/design-system/tokens/Brand.ads.fixture.ts +0 -12
- package/dist/bootstrap-ds/tsconfig.build.json +0 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +0 -258
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +0 -122
- package/dist/skills/ads-designer/assets/bootstrap-ds/biome.css.json +0 -21
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/app-icon.svg +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/logo.dark.svg +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/logo.svg +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/fonts/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +0 -49
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/README.md +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.scenario.tsx +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.tsx +0 -41
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/README.md +0 -10
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/README.md +0 -14
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +0 -57
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -16
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/controllers/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/index.ts +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -11
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -41
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/brand-preview/BrandPreview.tsx +0 -115
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/index.ts +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +0 -119
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/index.html +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/main.tsx +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/styles.css +0 -5
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Brand.ads.fixture.ts +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +0 -18
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.scenario.tsx +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/base.css +0 -30
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/colors.css +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/elevation.css +0 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/spacing.css +0 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/typography.css +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +0 -20
- package/dist/skills/ads-designer/assets/bootstrap-ds/gitignore.template +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/package-lock.json +0 -4660
- package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +0 -42
- package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +0 -3
- package/dist/skills/ads-designer/assets/bootstrap-ds/src/vite-env.d.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/tsconfig.json +0 -35
- package/dist/skills/ads-designer/assets/bootstrap-ds/vite.config.ts +0 -23
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +0 -119
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/ds.config.json +0 -20
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/package.json +0 -38
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/src/vite-env.d.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/tsconfig.json +0 -36
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/vite.config.ts +0 -23
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/demo-frame/DemoFrame.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/screen-frame/ScreenFrame.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/token-preview/TokenPreview.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/showcase/mcp/main.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/ds.config.json +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/package.json +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/src/vite-env.d.ts +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/tsconfig.json +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/vite.config.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/ADS.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/biome.css.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/brand/app-icon.svg +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/brand/logo.dark.svg +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/brand/logo.svg +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/fonts/.gitkeep +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Content/Logo/Logo.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Content/Logo/Logo.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Content/Logo/Logo.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Content/Logo/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/controllers/.gitkeep +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/index.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/brand-preview/BrandPreview.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/demo-frame/DemoFrame.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/index.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/screen-frame/ScreenFrame.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/token-preview/TokenPreview.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/showcase/mcp/index.html +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/showcase/mcp/main.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/styles.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/Color.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/Color.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/base.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/colors.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/elevation.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/spacing.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/typography.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/ds.config.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/gitignore.template +0 -0
- /package/dist/{bootstrap-ds → starters/react}/package-lock.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/package.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/scripts/build-mcp-previews.mjs +0 -0
- /package/dist/{bootstrap-ds → starters/react}/src/vite-env.d.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/tsconfig.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/vite.config.ts +0 -0
|
@@ -105,7 +105,7 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
105
105
|
- "app": Tool callable by the app from this server only`),csp:vc().optional(),permissions:vc().optional()}),Xz=l({mimeTypes:h(s()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),ev=l({method:u("ui/download-file"),params:l({contents:h(z([qt,At])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),tv=l({method:u("ui/message"),params:l({role:u("user").describe('Message role, currently only "user" is supported.'),content:h(Te).describe("Message content blocks (text, image, etc.).")})}),ov=l({method:u("ui/notifications/sandbox-resource-ready"),params:l({html:s().describe("HTML content to load into the inner iframe."),sandbox:s().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Jc.optional().describe("CSP configuration from resource metadata."),permissions:Bc.optional().describe("Sandbox permissions from resource metadata.")})}),WS=l({method:u("ui/notifications/tool-result"),params:rt.describe("Standard MCP tool execution result.")}),om=l({toolInfo:l({id:ye.optional().describe("JSON-RPC id of the tools/call request."),tool:ot.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:CS.optional().describe("Current color theme preference."),styles:ZS.optional().describe("Style configuration for theming the app."),displayMode:Vs.optional().describe("How the UI is currently displayed."),availableDisplayModes:h(Vs).optional().describe("Display modes the host supports."),containerDimensions:z([l({height:g().describe("Fixed container height in pixels.")}),l({maxHeight:z([g(),zc()]).optional().describe("Maximum container height in pixels.")})]).and(z([l({width:g().describe("Fixed container width in pixels.")}),l({maxWidth:z([g(),zc()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
106
106
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:s().optional().describe("User's language and region preference in BCP 47 format."),timeZone:s().optional().describe("User's timezone in IANA format."),userAgent:s().optional().describe("Host application identifier."),platform:z([u("web"),u("desktop"),u("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({touch:v().optional().describe("Whether the device supports touch input."),hover:v().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l({top:g().describe("Top safe area inset in pixels."),right:g().describe("Right safe area inset in pixels."),bottom:g().describe("Bottom safe area inset in pixels."),left:g().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),GS=l({method:u("ui/notifications/host-context-changed"),params:om.describe("Partial context update containing only changed fields.")}),rv=l({method:u("ui/update-model-context"),params:l({content:h(Te).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:y(s(),R().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),nv=l({method:u("ui/initialize"),params:l({appInfo:xe.describe("App identification (name and version)."),appCapabilities:FS.describe("Features and capabilities this app provides."),protocolVersion:s().describe("Protocol version this app supports.")})}),KS=l({protocolVersion:s().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:xe.describe("Host application identification and version."),hostCapabilities:HS.describe("Features and capabilities provided by the host."),hostContext:om.describe("Rich context about the host environment.")}).passthrough(),YS={target:"draft-2020-12"};async function Yh(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](YS);throw Error(`Schema (vendor: ${o.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function Qh(e,t,o=""){let r=await e["~standard"].validate(t);if(r.issues){let n=r.issues.map((i)=>{let a=i.path?.map((c)=>typeof c==="object"?c.key:c).join(".");return a?`${a}: ${i.message}`:i.message}).join("; ");throw Error(o+n)}return r.value}function QS(e,t){let o={...e,...t};if(t.experimental!==void 0)o.experimental={...e.experimental,...t.experimental};if(t.tools!==void 0)o.tools={...e.tools,...t.tools};return o}class ua extends Fc{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new Xh;_methods=new em;setRequestHandler=(...e)=>{let[t,...o]=Gh("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...o)};setNotificationHandler=(...e)=>{let[t,...o]=Gh("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...o)};removeRequestHandler=(e)=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=(e)=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:AS,toolinputpartial:jS,toolresult:WS,toolcancelled:LS,hostcontextchanged:GS};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!ua.ONE_SHOT_EVENTS.has(e)||this._everHadListener.has(e))return;if(this._everHadListener.add(e),!this._initializedSent)return;let t=`[ext-apps] "${String(e)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(t);console.warn(t)}setEventHandler(e,t){if(t)this._assertHandlerTiming(e);this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(o)=>{let r=o;if(e==="hostcontextchanged")this._hostContext={...this._hostContext,...r};this._events.dispatch(e,r)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,o){if(t&&o)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},o={autoResize:!0}){super(o);if(this._appInfo=e,this._appCapabilities=t,this.options=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!o.allowUnsafeEval)ce({jitless:!0});this.replaceRequestHandler("ping",(r)=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=QS(this._appCapabilities,e)}registerTool(e,t,o){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,n=()=>{if(r._initializedSent&&r._appCapabilities.tools?.listChanged)r.sendToolListChanged()},i=t.inputSchema!==void 0,a={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,n()},disable(){this.enabled=!1,n()},update(c){Object.assign(this,c),n()},remove(){if(r._registeredTools[e]!==a)return;delete r._registeredTools[e],n()},handler:async(c,p)=>{if(!a.enabled)throw Error(`Tool ${e} is disabled`);let d;if(i){let f=a.inputSchema,S=f?await Qh(f,c??{},`Invalid input for tool ${e}: `):c??{};d=await o(S,p)}else d=await o(p);if(a.outputSchema&&!d.isError)d.structuredContent=await Qh(a.outputSchema,d.structuredContent,`Invalid output for tool ${e}: `);return d}};if(this._registeredTools[e]=a,!this._appCapabilities.tools&&!this.transport)this.registerAppCapabilities({tools:{listChanged:!0}});return this.ensureToolHandlersInitialized(),n(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){if(this._toolHandlersInitialized)return;this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let o=this._registeredTools[e.name];if(!o)throw Error(`Tool ${e.name} not found`);return o.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([o,r])=>r.enabled).map(async([o,r])=>{let n={name:o,title:r.title,description:r.description,inputSchema:r.inputSchema?await Yh(r.inputSchema,"input"):{type:"object",properties:{}}};if(r.outputSchema)n.outputSchema=await Yh(r.outputSchema,"output");if(r.annotations)n.annotations=r.annotations;if(r._meta)n._meta=r._meta;return n}))})}async sendToolListChanged(e={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(e){this.setEventHandler("toolinput",e)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(e){this.setEventHandler("toolinputpartial",e)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(e){this.setEventHandler("toolresult",e)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(e){this.setEventHandler("toolcancelled",e)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(e){this.setEventHandler("hostcontextchanged",e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,e),this._onteardown=e,this.replaceRequestHandler("ui/resource-teardown",{params:DS.shape.params,result:VS},(t,o)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(t,o)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",(t,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,o)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler("tools/list",(t,o)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(t.params,o)})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized("callServerTool"),typeof e==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:e},t)}async listServerResources(e,t){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:e},t)}sendMessage(e,t){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:e},qS,t)}sendLog(e){return this.notification({method:"notifications/message",params:e})}updateModelContext(e,t){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:e},tt,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},NS,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},MS,t)}requestTeardown(e={}){return this.notification({method:"ui/notifications/request-teardown",params:e})}requestDisplayMode(e,t){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:e},JS,t)}sendSizeChanged(e){return this.notification({method:"ui/notifications/size-changed",params:e})}setupSizeChangedNotifications(){let e=!1,t=0,o=0,r=()=>{if(e)return;e=!0,requestAnimationFrame(()=>{e=!1;let i=document.documentElement,a=i.style.height;i.style.height="max-content";let c=Math.ceil(i.getBoundingClientRect().height);i.style.height=a;let p=Math.ceil(window.innerWidth);if(p!==t||c!==o)t=p,o=c,this.sendSizeChanged({width:p,height:c})})};r();let n=new ResizeObserver(r);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(e=new tm(window.parent,window.parent),t){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(e);let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:ES}},KS,t);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);if(this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize)this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}}function rm(e){return Array.isArray(e)&&e.length>0&&e.every((t)=>t&&typeof t==="object"&&typeof t.token==="string"&&/^--[\w-]+$/.test(t.token)&&typeof t.property==="string"&&/^-?[a-z][a-z0-9-]*$/.test(t.property)&&typeof t.probe==="string"&&t.probe.trim().length>0)&&new Set(e.map((t)=>`${t.token}:${t.property}`)).size===e.length}function nm(e,t){let o=t.getComputedStyle(e),r=e.getBoundingClientRect();if(o.display==="none"||o.visibility!=="visible"||!e.getClientRects().length||!(r.width||r.height))return!1;for(let n=e;n;n=n.parentElement)if(Number(t.getComputedStyle(n).opacity)===0)return!1;return!0}function sm(e,t){if(!rm(t))return{ok:!1,diagnostics:["Token preview needs explicit { token, property, probe } samples from the project fixture. Rebuild with the current compiler."]};let o=e.ownerDocument,{defaultView:r,documentElement:n}=o,i=[],a=[],c=[...e.querySelectorAll("[data-ads-token], [data-ads-property]")],p=new Set(t.map((d)=>`${d.token}:${d.property}`));for(let d of c)if(!p.has(`${d.dataset.adsToken}:${d.dataset.adsProperty}`))i.push(`Undeclared rendered token sample ${d.dataset.adsToken}:${d.dataset.adsProperty}.`);for(let d of t){if(!r.CSS.supports(d.property,d.probe)){i.push(`${d.token}: the fixture probe is invalid for ${d.property}.`);continue}let f=r.getComputedStyle(n).getPropertyValue(d.token).trim();if(!f||!r.CSS.supports(d.property,f)){i.push(`${d.token}: its current value is invalid for the fixture's ${d.property} binding.`);continue}let S=c.filter((b)=>b.dataset.adsToken===d.token&&b.dataset.adsProperty===d.property);if(!S.length){i.push(`${d.token} needs a rendered ${d.property} sample, not only a name/value label.`);continue}let _=!1;for(let b of S){let P=[];for(let I=b.parentElement;I&&I!==e;I=I.parentElement)if(I.tagName==="DETAILS"&&!I.open)I.open=!0,P.push(I);let k=n.getAttribute("style"),E=b.getAttribute("style");try{if(!/^(?:-[a-z]+-)?transition(?:-|$)/.test(d.property))b.style.setProperty("transition","none","important");let I=r.getComputedStyle(b).getPropertyValue(d.property),D=nm(b,r);n.style.setProperty(d.token,d.probe,"important");let M=r.getComputedStyle(b).getPropertyValue(d.property);_=Boolean(M&&M!==I&&(D||nm(b,r)))}finally{if(k===null)n.removeAttribute("style");else n.setAttribute("style",k);if(E===null)b.removeAttribute("style");else b.setAttribute("style",E);for(let I of P)I.open=!1}if(_)break}if(_)a.push(d);else i.push(`${d.token} has no visible ${d.property} sample that responds to its value. Hardcoded copies do not satisfy coverage.`)}return{ok:!i.length,verified:a,diagnostics:i}}var st=new ua({name:"ADS preview",version:"1.0.0"},{},{autoResize:!0}),im=document.getElementById("ads-preview-seed"),cm;function am(e,t){let o=document.createElement(e);return o.textContent=t,o}function lm(e){if(e==="light"||e==="dark")document.documentElement.dataset.theme=e}st.onhostcontextchanged=(e)=>lm(e.theme);if(im){let n=function(c){let p="";if(!c||c.state==="unreported")p="Preview freshness is unverified. Check the build status before reviewing.";else if(c.state==="error"){let d=c.diagnostics?.[0];if(p=`Build failed. Showing ${e.revision===null?"an earlier preview":`build ${e.revision}`}.`,d)p+=`
|
|
107
107
|
${d.file??""}${d.line?`:${d.line}`:""}${d.file?": ":""}${d.message}`}else if(["building","idle"].includes(c.state))p="Rebuilding. This view is the previous preview.";else if(c.revision!==e.revision||c.session!==e.session)p=`Build ${c.revision} is ready. Reopen this preview to load it.`;t.textContent=[p,r].filter(Boolean).join(`
|
|
108
|
-
`),t.hidden=!t.textContent},e=JSON.parse(im.textContent),t=am("aside","");t.id="ads-preview-build",t.setAttribute("role","status"),t.setAttribute("aria-live","polite");let o=am("style","#ads-preview-build{position:fixed;inset:12px 12px auto;z-index:2147483647;padding:10px 14px;border:1px solid GrayText;border-radius:6px;background:Canvas;color:CanvasText;font:13px system-ui;white-space:pre-wrap;overflow-wrap:anywhere;max-height:30vh;overflow:auto}#ads-preview-build[hidden]{display:none}");document.head.append(o),document.body.append(t);let r="";if(n(e),e.kind==="tokens"
|
|
108
|
+
`),t.hidden=!t.textContent},e=JSON.parse(im.textContent),t=am("aside","");t.id="ads-preview-build",t.setAttribute("role","status"),t.setAttribute("aria-live","polite");let o=am("style","#ads-preview-build{position:fixed;inset:12px 12px auto;z-index:2147483647;padding:10px 14px;border:1px solid GrayText;border-radius:6px;background:Canvas;color:CanvasText;font:13px system-ui;white-space:pre-wrap;overflow-wrap:anywhere;max-height:30vh;overflow:auto}#ads-preview-build[hidden]{display:none}");document.head.append(o),document.body.append(t);let r="";if(n(e),e.kind==="tokens")(async()=>{await new Promise((p)=>requestAnimationFrame(()=>requestAnimationFrame(p))),await document.fonts.ready;let c=sm(document.body,e.samples);if(!c.ok){r=`Token preview verification failed:
|
|
109
109
|
${c.diagnostics.slice(0,20).join(`
|
|
110
110
|
`)}`,t.setAttribute("role","alert"),n(e);try{if(st.getHostCapabilities()?.logging)await st.sendLog({level:"error",logger:"ads-preview",data:{state:"error",id:e.id,message:r}})}catch{}}})();let i=!1,a;st.onteardown=async()=>(clearInterval(a),{}),window.addEventListener("pagehide",()=>clearInterval(a),{once:!0}),cm=()=>{if(!st.getHostCapabilities()?.serverResources)return;async function c(){if(i||document.visibilityState==="hidden")return;i=!0;try{let p=await st.readServerResource({uri:"ads://project/build"},{timeout:5000}),d=JSON.parse(p.contents.find((f)=>("text"in f)).text);n(d.previews.find((f)=>f.id===e.id))}catch{t.textContent=["Build status unavailable. Reopen the preview to verify it.",r].filter(Boolean).join(`
|
|
111
111
|
`),t.hidden=!1}finally{i=!1}}c(),a=setInterval(()=>{c()},2000)}}try{await st.connect(),cm?.(),lm(st.getHostContext()?.theme)}catch{}
|
package/dist/mcp/server.mjs
CHANGED
|
@@ -160,7 +160,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
160
160
|
return { ...registry, revision: previewSourceRevision(current) };
|
|
161
161
|
}
|
|
162
162
|
function captureIndex() { const inventory = captureInventory(); return captures.store.list(inventory.scenarios, inventory.revision, { prune: !inventory.diagnostics.length }); }
|
|
163
|
-
const scenarioApps = (quick = false) => (quick ? quickRegistry() : getRegistry()).scenarios.map(item => ({ id: item.id, title: item.title, kind: item.kind, ...(item.samples ? { samples: item.samples } : {}),
|
|
163
|
+
const scenarioApps = (quick = false) => (quick ? quickRegistry() : getRegistry()).scenarios.map(item => ({ id: item.id, title: item.title, kind: item.kind, ...(item.samples ? { samples: item.samples } : {}), file: item.artifact }));
|
|
164
164
|
const tokenScenarios = () => {
|
|
165
165
|
const references=drafts.list({unit:"tokens",limit:100000}).drafts.map(({id,title,revision,state,preview})=>({id,title,revision,state,preview}));
|
|
166
166
|
return getRegistry().scenarios.filter(item => item.kind === "tokens").map(item => ({ id:item.id,title:item.title,count:item.tokens.length,drafts:references }));
|
|
@@ -461,7 +461,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
461
461
|
const matches = (await getCatalog()).filter((item) => (!kind || item.kind === kind) && item.name.toLowerCase().includes(search.toLowerCase()));
|
|
462
462
|
return json({ total: matches.length, items: annotateDrafts(matches.slice(0, limit)), resourceUri: `${PROJECT_URI}/catalog` });
|
|
463
463
|
} },
|
|
464
|
-
{ name: "ads_scenarios", description: "Find an independently mountable token, component, pattern or composition preview. IDs derive from source filenames. Optional group labels are derived from folder names and searchable; group is discovery output, never scenario metadata. covers lists rendered public UI, exercises lists behavioral APIs and tokens lists the real token inputs. Use ads_show_scenario with an exact returned id. Showcase and MCP use this same registry.", schema: query.extend({ kind: z.enum(["tokens", "components", "patterns", "composition"]).optional(), offset: z.number().int().min(0).default(0) }), call: ({ query: search = "", limit, kind, offset }) => {
|
|
464
|
+
{ name: "ads_scenarios", description: "Find an independently mountable brand, token, component, pattern or composition preview. IDs derive from source filenames. Optional group labels are derived from folder names and searchable; group is discovery output, never scenario metadata. covers lists rendered public UI, exercises lists behavioral APIs and tokens lists the real token inputs. Use ads_show_scenario with an exact returned id. Showcase and MCP use this same registry.", schema: query.extend({ kind: z.enum(["brand", "tokens", "components", "patterns", "composition"]).optional(), offset: z.number().int().min(0).default(0) }), call: ({ query: search = "", limit, kind, offset }) => {
|
|
465
465
|
const registry = getRegistry();
|
|
466
466
|
const matches = registry.scenarios.filter(item => (!kind || item.kind === kind) && `${item.id} ${item.title} ${item.group ?? ""} ${item.covers.join(" ")} ${(item.exercises ?? []).join(" ")} ${item.tokens.join(" ")}`.toLowerCase().includes(search.toLowerCase()));
|
|
467
467
|
const report = builds(), states = new Map(report.previews.map(item => [item.id, item]));
|
|
@@ -500,8 +500,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
500
500
|
} },
|
|
501
501
|
{ name: "ads_show_tokens", title: "Token previews", description: "Render a discovered token scenario with project-owned templates and fixtures. Pass its id as category, or omit for the first token scenario. Default waitFor: verified requires current checks. Interactive browsers may use waitFor: compiled for explicitly unverified feedback or a retained view. Older compilers provide a generic definition inspector.", schema: z.object({ category: z.string().max(256).optional(), waitFor: z.enum(["verified", "compiled"]).default("verified") }).strict(), _meta: { ui: { resourceUri: options.config.mcp.previewManifest ? PREVIEW_APP_URI : TOKENS_APP_URI } }, call: async ({ category, waitFor }, signal) => {
|
|
502
502
|
const registry = await previewRegistry(waitFor);
|
|
503
|
-
|
|
504
|
-
if (!category && options.config.mcp.previewManifest) category = (registry.scenarios.find(item => item.kind === "tokens" && !item.brand) ?? registry.scenarios.find(item => item.kind === "tokens"))?.id;
|
|
503
|
+
if (!category && options.config.mcp.previewManifest) category = registry.scenarios.find(item => item.kind === "tokens")?.id;
|
|
505
504
|
if (!category && options.config.mcp.previewManifest) throw new Error("No token scenario is registered. Colocate a token scenario and fixture before opening the preview; ads_tokens still inspects definitions.");
|
|
506
505
|
if (category) {
|
|
507
506
|
const entry = registry.scenarios.find(item => item.kind === "tokens" && item.id === category);
|
package/dist/mcp/skills.mjs
CHANGED
|
@@ -31,7 +31,7 @@ export function createSkillStore(directory = fileURLToPath(new URL("../skills/",
|
|
|
31
31
|
directories.set(uri, children);
|
|
32
32
|
for (const entry of readdirSync(folder, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
33
33
|
if (entry.isSymbolicLink()) throw new Error(`Skills cannot contain symlinks: ${entry.name}`);
|
|
34
|
-
const name = entry.name
|
|
34
|
+
const name = entry.name;
|
|
35
35
|
const childUri = `${uri}/${encodeURIComponent(name)}`;
|
|
36
36
|
const file = path.join(folder, entry.name);
|
|
37
37
|
if (entry.isDirectory()) {
|
|
@@ -178,7 +178,7 @@ export function createPreviewResources(output, options, entries, {retain, prune
|
|
|
178
178
|
const scenarios = entries.map((entry, index) => {
|
|
179
179
|
const chunk = bundle.find(item => item.type === "chunk" && item.facadeModuleId === `\0ads-preview-entry:${index}`);
|
|
180
180
|
if (!chunk) throw new Error(`Missing compiled scenario entry: ${entry.id}`);
|
|
181
|
-
return retain?.manifest.scenarios.find(previous=>previous.id===entry.id) ?? { id: entry.id, title: entry.title, kind: entry.kind, ...(entry.samples ? { samples: entry.samples } : {}), ...(entry.
|
|
181
|
+
return retain?.manifest.scenarios.find(previous=>previous.id===entry.id) ?? { id: entry.id, title: entry.title, kind: entry.kind, ...(entry.samples ? { samples: entry.samples } : {}), ...(entry.paintBindings?.length ? {paintBindings:entry.paintBindings} : {}), ...(entry.paintAudit?{paintAudit:true}:{}), module: uris.get(chunk.fileName) };
|
|
182
182
|
});
|
|
183
183
|
// Rechunking a growing warm graph must not replace already compiled views.
|
|
184
184
|
// Retain their exact closures for identical source/compiler modes, then prune
|
package/dist/scenario-groups.mjs
CHANGED
|
@@ -10,7 +10,7 @@ export function scenarioGroupFingerprint(options, files) {
|
|
|
10
10
|
const directories = new Set();
|
|
11
11
|
for (const file of (files ?? sourceFiles(dsRoot)).filter(isScenarioFile)) {
|
|
12
12
|
const layer = path.relative(dsRoot, file).split(path.sep)[0];
|
|
13
|
-
if (!["components", "patterns", "composition"].includes(layer)) continue;
|
|
13
|
+
if (!["brand", "components", "patterns", "composition"].includes(layer)) continue;
|
|
14
14
|
const boundary = path.join(dsRoot, layer);
|
|
15
15
|
for (let directory = path.dirname(file); directory !== boundary && isInside(boundary, directory); directory = path.dirname(directory)) directories.add(directory);
|
|
16
16
|
}
|
|
@@ -33,7 +33,7 @@ export function createScenarioGroups({ dsRoot }) {
|
|
|
33
33
|
}
|
|
34
34
|
return (file, owner) => {
|
|
35
35
|
const relative = path.relative(dsRoot, file), layer = relative.split(path.sep)[0];
|
|
36
|
-
if (!["components", "patterns", "composition"].includes(layer)) return undefined;
|
|
36
|
+
if (!["brand", "components", "patterns", "composition"].includes(layer)) return undefined;
|
|
37
37
|
const boundary = path.join(dsRoot, layer);
|
|
38
38
|
let directory = owner ? path.join(dsRoot, owner) : path.dirname(file);
|
|
39
39
|
try { if (!statSync(directory).isDirectory()) directory = path.dirname(directory); }
|
|
@@ -27,7 +27,7 @@ const toolRevision = (() => {
|
|
|
27
27
|
function visit(directory) {
|
|
28
28
|
for (const entry of readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
29
29
|
const file = path.join(directory, entry.name);
|
|
30
|
-
if (entry.isDirectory() && !["skills", "
|
|
30
|
+
if (entry.isDirectory() && !["skills", "starters", "showcase"].includes(entry.name)) visit(file);
|
|
31
31
|
else if (entry.isFile() && /\.(?:mjs|js|cjs|json)$/.test(entry.name)) rows.push([path.relative(root, file), hash(readFileSync(file))]);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -37,9 +37,9 @@ const toolRevision = (() => {
|
|
|
37
37
|
|
|
38
38
|
function validRegistry(value, options) {
|
|
39
39
|
return value && Array.isArray(value.scenarios) && value.scenarios.length <= 10000
|
|
40
|
-
&& value.scenarios.every(item => typeof item?.id === "string" && /^(?:tokens|components|patterns|composition)\/[\w./-]+$/.test(item.id)
|
|
40
|
+
&& value.scenarios.every(item => typeof item?.id === "string" && /^(?:brand|tokens|components|patterns|composition)\/[\w./-]+$/.test(item.id)
|
|
41
41
|
&& path.posix.normalize(item.id) === item.id && typeof item.title === "string"
|
|
42
|
-
&& ["tokens", "components", "patterns", "composition"].includes(item.kind)
|
|
42
|
+
&& ["brand", "tokens", "components", "patterns", "composition"].includes(item.kind)
|
|
43
43
|
&& typeof item.file === "string" && isInside(options.dsRoot, path.resolve(options.root, item.file))
|
|
44
44
|
&& item.artifact === `.ds/scenarios/${item.id}/index.html` && Array.isArray(item.covers) && Array.isArray(item.tokens))
|
|
45
45
|
&& Array.isArray(value.diagnostics) && value.diagnostics.every(item => typeof item?.message === "string" && typeof item.rule === "string");
|
|
@@ -143,7 +143,7 @@ export function createPreviewCache(options, compilerFiles = []) {
|
|
|
143
143
|
recordProduction(stamp) { return recordCurrent(stamp, () => { value.production = { stamp, revision: value.graphRevision }; }); },
|
|
144
144
|
registry(stamp) {
|
|
145
145
|
if(value.validation!==stamp || value.graphInputs!==stamp || !Array.isArray(value.registry) || !value.registry.length || value.registry.length>1000)return null;
|
|
146
|
-
const valid=value.registry.every(entry=>typeof entry?.id==="string" && /^(?:tokens|components|patterns|composition)\/[\w./-]+$/.test(entry.id) && path.posix.normalize(entry.id)===entry.id
|
|
146
|
+
const valid=value.registry.every(entry=>typeof entry?.id==="string" && /^(?:brand|tokens|components|patterns|composition)\/[\w./-]+$/.test(entry.id) && path.posix.normalize(entry.id)===entry.id
|
|
147
147
|
&& typeof entry.file==="string" && isInside(options.dsRoot,path.resolve(root,entry.file))
|
|
148
148
|
&& entry.artifact===`.ds/scenarios/${entry.id}/index.html`);
|
|
149
149
|
return valid && reusableEntries(value.registry,value.graphRevision)?structuredClone(value.registry):null;
|
package/dist/scenarios.mjs
CHANGED
|
@@ -68,7 +68,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
68
68
|
for (const file of files) {
|
|
69
69
|
const relative = path.relative(dsRoot, file).replaceAll("\\", "/");
|
|
70
70
|
let kind = isInside(path.join(dsRoot, options.config.tokenDir), file) ? "tokens" : relative.split("/")[0];
|
|
71
|
-
if (!["tokens", "components", "patterns", "composition"].includes(kind)) { report(file, "Scenarios live beside tokens/components/patterns or under composition/, not inside showcase pages."); continue; }
|
|
71
|
+
if (!["brand", "tokens", "components", "patterns", "composition"].includes(kind)) { report(file, "Scenarios live under brand/, beside tokens/components/patterns or under composition/, not inside showcase pages."); continue; }
|
|
72
72
|
let id = scenarioIdentity(file, dsRoot);
|
|
73
73
|
const source = program.getSourceFile(file);
|
|
74
74
|
if (!source) { report(file, "Cannot inspect scenario source."); continue; }
|
|
@@ -125,7 +125,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
125
125
|
report(file, "Scenario metadata is not statically readable. Render coverage is not established until this prerequisite is repaired.", metadataExpression, {coverage:"not-established",owner:units.owner(relative)});
|
|
126
126
|
continue;
|
|
127
127
|
}
|
|
128
|
-
for(const field of Object.keys(metadata))if(!["id","title","kind","covers","exercises","tokens","samples","captureTargets"
|
|
128
|
+
for(const field of Object.keys(metadata))if(!["id","title","kind","covers","exercises","tokens","samples","captureTargets"].includes(field))report(file,`Unknown scenario field ${field}.`,entryNode(field),{entry:field});
|
|
129
129
|
const group = scenarioGroup(file, units.owner(relative));
|
|
130
130
|
if(typeof metadata.title!=="string"||!metadata.title.trim()) {
|
|
131
131
|
report(file,"Scenario title must be a nonempty static string; independent render evidence is retained.",entryNode("title"),{entry:"title"});
|
|
@@ -138,12 +138,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
138
138
|
if(Object.hasOwn(metadata,"tokens")&&(!Array.isArray(metadata.tokens)||metadata.tokens.some(name=>typeof name!=="string"||!name.startsWith("--")))) {
|
|
139
139
|
report(file,"Scenario tokens must be a static list of real token names.",entryNode("tokens"),{entry:"tokens"});metadata.tokens=[];
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
if(Object.hasOwn(metadata,"brand")&&(metadata.brand!==true||kind!=="tokens"||Object.hasOwn(metadata,"samples"))) {
|
|
143
|
-
report(file,"brand: true marks a token-folder scenario that previews assets/brand artwork; it has no token samples.",entryNode("brand"),{entry:"brand"});delete metadata.brand;
|
|
144
|
-
}
|
|
145
|
-
const brand=metadata.brand===true;
|
|
146
|
-
if(kind==="tokens"&&Object.hasOwn(metadata,"tokens")||kind==="tokens"&&!brand&&!validTokenSamples(metadata.samples)||Object.hasOwn(metadata,"samples")&&!validTokenSamples(metadata.samples)) {
|
|
141
|
+
if(kind==="tokens"&&Object.hasOwn(metadata,"tokens")||kind==="tokens"&&!validTokenSamples(metadata.samples)||Object.hasOwn(metadata,"samples")&&!validTokenSamples(metadata.samples)) {
|
|
147
142
|
report(file,"Token scenarios need samples: fixture.samples, a literal list of { token, property, probe } real CSS bindings. Printing values or covers: [] is incomplete.",entryNode("samples"),{entry:"samples"});delete metadata.samples;
|
|
148
143
|
}
|
|
149
144
|
const covers = [];
|
|
@@ -170,7 +165,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
170
165
|
else exercises.push(name);
|
|
171
166
|
}
|
|
172
167
|
}
|
|
173
|
-
if (!["composition", "tokens"].includes(kind) && metadata.covers.some((name) => known.get(name).kind !== kind)) report(file, "Component scenarios cover primitives; pattern scenarios cover patterns. Use composition/ for larger interfaces.");
|
|
168
|
+
if (!["composition", "tokens", "brand"].includes(kind) && metadata.covers.some((name) => known.get(name).kind !== kind)) report(file, "Component scenarios cover primitives; pattern scenarios cover patterns. Use composition/ for larger interfaces.");
|
|
174
169
|
const tokens = [...new Set([...(metadata.tokens ?? []), ...(metadata.samples ?? []).map(sample => sample.token)])];
|
|
175
170
|
for (const name of tokens) if (!tokenNames.has(name)) diagnostics.push({ file: path.relative(root, file).replaceAll("\\", "/"), rule: "token-scenario-reference", line: 1, column: 1, message: `Scenario references undeclared token ${name}. Use a real token from its defining owner.` });
|
|
176
171
|
if (kind === "tokens") {
|
|
@@ -183,7 +178,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
183
178
|
if(bindingTrace) findBindings(source);
|
|
184
179
|
const paintBindings = inspectRuntimeContracts(options,program).bindings.filter(binding=>reachable.has(binding.scope.apiName)).map(binding=>({owner:binding.unit,name:binding.name,scope:binding.scope.selector,prefix:binding.prefix,suffix:binding.suffix,tokens:tokenInventory.tokens.filter(token=>!token.owner||token.owner==="tokens"||token.owner===binding.unit).map(token=>token.name)}));
|
|
185
180
|
const paintAudit=contractDeclarations.some(contract=>contract.paintInputs?.some(input=>reachable.has(input.apiName)));
|
|
186
|
-
scenarios.push({ id, kind, title: metadata.title, ...(group ? { group } : {}), ...(fixture ? { fixture: path.relative(root, fixture).replaceAll("\\", "/") } : {}), covers: [...new Set(metadata.covers)], ...(captureTargets ? { captureTargets } : {}), ...(Object.hasOwn(metadata, "exercises") ? { exercises: [...new Set(exercises)] } : {}), tokens, ...(metadata.samples ? { samples: metadata.samples } : {}), ...(
|
|
181
|
+
scenarios.push({ id, kind, title: metadata.title, ...(group ? { group } : {}), ...(fixture ? { fixture: path.relative(root, fixture).replaceAll("\\", "/") } : {}), covers: [...new Set(metadata.covers)], ...(captureTargets ? { captureTargets } : {}), ...(Object.hasOwn(metadata, "exercises") ? { exercises: [...new Set(exercises)] } : {}), tokens, ...(metadata.samples ? { samples: metadata.samples } : {}), ...(paintBindings.length?{paintBindings}:{}), ...(paintAudit?{paintAudit:true}:{}), file: path.relative(root, file).replaceAll("\\", "/"), artifact: path.relative(root, scenarioArtifact(root, id)).replaceAll("\\", "/") });
|
|
187
182
|
}
|
|
188
183
|
return { scenarios: scenarios.sort((a, b) => a.id.localeCompare(b.id)), diagnostics };
|
|
189
184
|
}
|
|
@@ -304,7 +299,7 @@ export function inspectScenarioCoverage(options, program, report, advise = () =>
|
|
|
304
299
|
else if (!exercised.has(name)) advise(source.fileName, "scenario-exercise-review", `${name} is referenced dynamically. Verify its invocation in the registered browser/behavior checks; a reference alone does not prove execution.`);
|
|
305
300
|
}
|
|
306
301
|
for (const name of referencedTokens) if (!declaredTokens.has(name)) report(source.fileName, "token-scenario-reference", `Reachable scenario input references undeclared token ${name}.`);
|
|
307
|
-
if (scenario.kind === "tokens" && !
|
|
302
|
+
if (scenario.kind === "tokens" && !samplesPassed) report(source.fileName, "token-scenario-render", "Pass the declared fixture.samples into a rendered review renderer's samples prop. Printing token names or reading unused fixtures is not sample coverage.");
|
|
308
303
|
for (const name of scenario.tokens) {
|
|
309
304
|
if (!referencedTokens.has(name)) report(source.fileName, "token-scenario-render", `${name} is declared in tokens but has no reachable reference from the default scenario entry. Consume the real token fixture; metadata alone does not count.`);
|
|
310
305
|
else if (scenario.kind === "tokens" && samplesPassed && declaredTokens.has(name)) coveredTokens.add(name);
|