@vyriy/create 0.7.5 → 0.7.7
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/package.json +11 -3
- package/preset/mfe.js +106 -771
package/preset/mfe.js
CHANGED
|
@@ -10,756 +10,201 @@ const agentsPath = [
|
|
|
10
10
|
const agentsContent = agentsPath ? readFileSync(agentsPath, 'utf8') : '';
|
|
11
11
|
const projectFiles = {
|
|
12
12
|
'.browserslistrc': '[development]\nextends @vyriy/browserslist-config\n\n[ssr]\nextends @vyriy/browserslist-config\n\n[production]\nextends @vyriy/browserslist-config\n\n[modern]\nextends @vyriy/browserslist-config\n',
|
|
13
|
-
'.
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'packages/api/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/API\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
17
|
-
'packages/api/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('api public API', () => {\n it('exports API document builders', () => {\n expect(publicApi.demo).toBeDefined();\n expect(publicApi.manifest).toBeDefined();\n expect(publicApi.prerender).toBeDefined();\n expect(publicApi.semantic).toBeDefined();\n });\n});\n",
|
|
18
|
-
'packages/api/index.ts': "export * from './demo.js';\nexport * from './manifest.js';\nexport * from './prerender.js';\nexport * from './semantic.js';\n\nexport type * from './types.js';\n",
|
|
19
|
-
'packages/api/manifest.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { manifest } from './manifest.js';\n\ndescribe('manifest', () => {\n afterEach(() => {\n delete process.env.API;\n delete process.env.CDN;\n delete process.env.UI;\n });\n\n it('builds the OpenMFE manifest YAML', () => {\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.UI = 'http://localhost:3002';\n\n const document = manifest();\n\n expect(document).toContain(\"version: '1.1'\");\n expect(document).toContain(\"source: 'http://localhost:3002/index.js'\");\n expect(document).toContain(\"prerender: 'http://localhost:3000/prerender'\");\n expect(document).toContain(\"icon: 'http://localhost:3001/icon.svg'\");\n expect(document).toContain(\"name: 'vyriy-profile-card.select'\");\n expect(document).toContain(\"name: 'openmfe.analytics'\");\n });\n});\n",
|
|
20
|
-
'packages/api/manifest.ts': "import { getUi, getApi, getCdn } from '@p/env';\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from '@p/event';\n\nimport type { Manifest } from './types.js';\n\n/** Builds the OpenMFE manifest YAML for the profile-card microfrontend. */\nexport const manifest: Manifest = () => `version: '1.1'\nname: 'Vyriy Profile Card'\nsource: '${getUi()}/index.js'\ntag: 'vyriy-profile-card'\nurl:\n frontend: '${getUi()}/index.js'\n prerender: '${getApi()}/prerender'\n semantic: '${getApi()}/semantic'\npublisher:\n name: 'Vyriy'\n email: 'vyriy@vyriy.dev'\nicon: '${getCdn()}/icon.svg'\ndescription: 'A small OpenMFE-oriented profile card starter for Vyriy CLI.'\ndocumentation: 'https://vyriy.dev/'\nattributes:\n - name: 'name'\n description: 'Profile display name.'\n required: true\n schema:\n type: 'string'\n minLength: 1\n - name: 'role'\n description: 'Short profile role or title.'\n required: false\n schema:\n type: 'string'\n default: 'Developer'\n - name: 'avatar-url'\n description: 'Optional avatar image URL.'\n required: false\n schema:\n type: 'string'\n format: 'uri-reference'\n default: '${getCdn()}/avatar.svg'\nevents:\n - name: '${PROFILE_CARD_SELECT_EVENT_NAME}'\n description: 'Emitted when the user selects the profile card.'\n schema:\n type: 'object'\n required:\n - name\n properties:\n name:\n type: 'string'\n description: 'Selected profile display name.'\n role:\n type: 'string'\n description: 'Selected profile role.'\n avatarUrl:\n type:\n - 'string'\n - 'null'\n description: 'Selected profile avatar URL.'\n - name: '${PROFILE_CARD_ANALYTICS_EVENT_NAME}'\n description: 'Standard OpenMFE analytics event emitted for profile card interactions.'\n schema:\n type: 'object'\n required:\n - name\n - origin\n - id\n - variant\n - action\n - category\n - data\n properties:\n name:\n type: 'string'\n description: 'Analytics event name.'\n origin:\n type: 'string'\n description: 'Microfrontend tag name.'\n id:\n type:\n - 'string'\n - 'null'\n description: 'Component instance id or null.'\n variant:\n type:\n - 'string'\n - 'null'\n description: 'Experiment variant or null.'\n action:\n type: 'string'\n description: 'User action.'\n category:\n type:\n - 'string'\n - 'null'\n description: 'Analytics category or null.'\n data:\n type: 'object'\n description: 'Custom analytics payload.'\nfunctions:\n - name: 'refresh'\n description: 'Refreshes the current profile card rendering.'\n async: true\n parameters: []\n return:\n description: 'Refresh result.'\n schema:\n type: 'object'\n properties:\n ok:\n type: 'boolean'\n description: 'Whether refresh completed successfully.'\nsemantic:\n type: 'object'\n required:\n - '@context'\n - '@type'\n - 'name'\n properties:\n '@context':\n type: 'string'\n description: 'JSON-LD context URL.'\n '@type':\n type: 'string'\n description: 'Schema.org entity type.'\n name:\n type: 'string'\n description: 'Profile display name.'\n jobTitle:\n type: 'string'\n description: 'Profile role or title.'\n image:\n type: 'string'\n description: 'Profile avatar URL.'\nscreenshots:\n - url: '${getCdn()}/screenshots/default.svg'\n description: 'Default profile card rendering.'\n - url: '${getCdn()}/screenshots/compact.svg'\n description: 'Compact profile card rendering.'\nexamples:\n - description: 'Default profile card.'\n attributes:\n name: 'Ada Lovelace'\n role: 'Mathematician'\n avatar-url: '${getCdn()}/avatar.svg'\nrepository: 'https://github.com/evheniy/vyriy'`;\n",
|
|
21
|
-
'packages/api/package.json': '{\n "name": "@p/api",\n "type": "module",\n "private": true\n}\n',
|
|
22
|
-
'packages/api/prerender.test.tsx': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { prerender } from './prerender.js';\n\ndescribe('prerender', () => {\n afterEach(() => {\n delete process.env.MODE;\n delete process.env.TAG;\n delete process.env.UI;\n });\n\n it('renders profile card props as custom element attributes', () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n expect(\n prerender({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'A \"quoted\" <description>',\n name: 'Name',\n tags: ['one', 'two'],\n title: 'Title',\n }),\n ).toContain(\n '<vyriy-profile-card name=\"Name\" title=\"Title\" description=\"A "quoted" <description>\" avatarUrl=\"https://example.com/avatar.png\" tags=\"["one","two"]\" rendered>',\n );\n expect(\n prerender({\n name: 'Name',\n }),\n ).toContain('<div data-vyriy-root>');\n });\n\n it('removes React generated resource hints from the hydration root', () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n expect(\n prerender({\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Name',\n }),\n ).not.toContain('rel=\"preload\"');\n });\n});\n",
|
|
23
|
-
'packages/api/prerender.tsx': "import { html } from '@vyriy/render';\n\nimport { ProfileCard } from '@p/components/profile-card';\n\nimport { getTag, getMode, getUi } from '@p/env';\n\nimport type { Prerender } from './types.js';\n\ntype AttributeValue = string | string[] | undefined;\n\nconst escapeAttribute = (value: string): string => {\n return value.replaceAll('&', '&').replaceAll('\"', '"').replaceAll('<', '<').replaceAll('>', '>');\n};\n\nconst getAttributeValue = (value: AttributeValue): string | undefined => {\n if (value === undefined) {\n return undefined;\n }\n\n return Array.isArray(value) ? JSON.stringify(value) : value;\n};\n\nconst getAttribute = (name: string, value: AttributeValue): string => {\n const attributeValue = getAttributeValue(value);\n\n if (attributeValue === undefined) {\n return '';\n }\n\n return ` ${name}=\"${escapeAttribute(attributeValue)}\"`;\n};\n\nconst getProfileCardAttributes = (props: Parameters<Prerender>[0]): string => {\n return [\n getAttribute('name', props.name),\n getAttribute('title', props.title),\n getAttribute('description', props.description),\n getAttribute('avatarUrl', props.avatarUrl),\n getAttribute('tags', props.tags),\n ].join('');\n};\n\nconst removeReactResourceHints = (value: string): string => {\n return value.replaceAll(/<link\\b(?=[^>]*\\brel=\"preload\")[^>]*>/g, '');\n};\n\n/** Renders a profile card custom element with declarative shadow DOM for hydration. */\nexport const prerender: Prerender = (props) => {\n const tag = getTag();\n const mode = getMode();\n const body = removeReactResourceHints(html(<ProfileCard {...props} />));\n\n return [\n `<${tag}${getProfileCardAttributes(props)} rendered>`,\n `<template shadowrootmode=\"${mode}\">`,\n `<link rel=\"stylesheet\" href=\"${getUi()}/main.css\" />`,\n `<div data-vyriy-root>${body}</div>`,\n `</template>`,\n `</${tag}>`,\n ].join('');\n};\n",
|
|
24
|
-
'packages/api/README.md': `# API
|
|
25
|
-
|
|
26
|
-
Server-side document builders for the profile-card microfrontend.
|
|
27
|
-
|
|
28
|
-
## Exports
|
|
29
|
-
|
|
30
|
-
- \`demo()\` returns a standalone HTML demo document.
|
|
31
|
-
- \`prerender(props)\` returns SSR custom element markup with declarative shadow DOM.
|
|
32
|
-
- \`semantic(props)\` returns Schema.org Person JSON-LD.
|
|
33
|
-
- \`manifest()\` returns the OpenMFE manifest YAML.
|
|
34
|
-
- \`Demo\`, \`Prerender\`, \`Semantic\`, and \`Manifest\` describe the public builder signatures.
|
|
35
|
-
|
|
36
|
-
## Props
|
|
37
|
-
|
|
38
|
-
The renderers accept the shared profile-card data model from \`@p/components\`:
|
|
39
|
-
|
|
40
|
-
- \`name\` is required.
|
|
41
|
-
- \`title\`, \`description\`, \`avatarUrl\`, and \`tags\` are optional.
|
|
42
|
-
|
|
43
|
-
\`prerender(props)\` serializes those values onto the configured custom element tag and includes the UI stylesheet inside the declarative shadow root.
|
|
44
|
-
|
|
45
|
-
## Environment
|
|
46
|
-
|
|
47
|
-
The builders read required runtime configuration through \`@p/env\`:
|
|
48
|
-
|
|
49
|
-
- \`TAG\` custom element tag name.
|
|
50
|
-
- \`MODE\` shadow root mode.
|
|
51
|
-
- \`API\` API origin used in the manifest.
|
|
52
|
-
- \`CDN\` static asset origin used in the manifest.
|
|
53
|
-
- \`UI\` UI asset origin used by demo and prerender output.
|
|
54
|
-
|
|
55
|
-
## Example
|
|
56
|
-
|
|
57
|
-
\`\`\`ts
|
|
58
|
-
import { prerender, semantic } from '@p/api';
|
|
59
|
-
|
|
60
|
-
const props = {
|
|
61
|
-
name: 'Ada Lovelace',
|
|
62
|
-
title: 'Mathematician',
|
|
63
|
-
tags: ['math', 'computing'],
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const html = prerender(props);
|
|
67
|
-
const jsonLd = semantic(props);
|
|
68
|
-
\`\`\`
|
|
69
|
-
`,
|
|
70
|
-
'packages/api/semantic.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { semantic } from './semantic.js';\n\ndescribe('semantic', () => {\n it('serializes profile-card props as Schema.org JSON-LD', () => {\n expect(\n JSON.parse(\n semantic({\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n title: 'Mathematician',\n }),\n ),\n ).toEqual({\n '@context': 'https://schema.org',\n '@type': 'Person',\n image: 'https://example.com/avatar.png',\n jobTitle: 'Mathematician',\n name: 'Ada Lovelace',\n });\n });\n});\n",
|
|
71
|
-
'packages/api/semantic.ts': "import type { Semantic } from './types.js';\n\n/** Serializes profile-card props as Schema.org Person JSON-LD. */\nexport const semantic: Semantic = (params) =>\n JSON.stringify({\n '@context': 'https://schema.org',\n '@type': 'Person',\n name: params.name,\n jobTitle: params.title,\n image: params.avatarUrl,\n });\n",
|
|
72
|
-
'packages/api/types.ts': "import type { ProfileCard } from '@p/components/profile-card/types.js';\n\n/** Builds the standalone HTML demo document. */\nexport type Demo = () => string;\n\n/** Builds server-rendered custom element markup from profile-card props. */\nexport type Prerender = (props: ProfileCard) => string;\n\n/** Builds semantic JSON-LD from profile-card props. */\nexport type Semantic = (props: ProfileCard) => string;\n\n/** Builds the OpenMFE manifest YAML document. */\nexport type Manifest = () => string;\n",
|
|
73
|
-
'packages/env/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Env\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
74
|
-
'packages/env/env.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { getApi, getCdn, getMode, getTag, getUi } from './env.js';\n\ndescribe('env getters', () => {\n afterEach(() => {\n delete process.env.API;\n delete process.env.CDN;\n delete process.env.MODE;\n delete process.env.TAG;\n delete process.env.UI;\n });\n\n it('reads required environment values', () => {\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n expect(getApi()).toBe('http://localhost:3000');\n expect(getCdn()).toBe('http://localhost:3001');\n expect(getMode()).toBe('open');\n expect(getTag()).toBe('vyriy-profile-card');\n expect(getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment value is missing', () => {\n expect(() => getUi()).toThrow('Environment variable UI is not defined!');\n });\n});\n",
|
|
75
|
-
'packages/env/env.ts': "import { getEnv } from '@vyriy/env';\n\n/** Reads the configured custom element tag name. */\nexport const getTag = () => getEnv('TAG');\n\n/** Reads the configured shadow DOM mode. */\nexport const getMode = () => getEnv('MODE');\n\n/** Reads the API origin used for server endpoints. */\nexport const getApi = () => getEnv('API');\n\n/** Reads the CDN origin used for static assets. */\nexport const getCdn = () => getEnv('CDN');\n\n/** Reads the UI origin used for browser assets. */\nexport const getUi = () => getEnv('UI');\n",
|
|
76
|
-
'packages/env/index.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\nconst ENV_NAMES = [\n 'TAG',\n 'MODE',\n 'API',\n 'CDN',\n 'UI',\n] as const;\n\nconst clearEnv = () => {\n for (const name of ENV_NAMES) {\n delete process.env[name];\n }\n};\n\ndescribe('env public API', () => {\n afterEach(() => {\n clearEnv();\n });\n\n it('exports env getters', () => {\n expect(publicApi.getTag).toBeDefined();\n expect(publicApi.getMode).toBeDefined();\n expect(publicApi.getApi).toBeDefined();\n expect(publicApi.getCdn).toBeDefined();\n expect(publicApi.getUi).toBeDefined();\n });\n\n it('reads environment variables by public getter name', () => {\n process.env.TAG = 'vyriy-profile-card';\n process.env.MODE = 'open';\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.UI = 'http://localhost:3002';\n\n expect(publicApi.getTag()).toBe('vyriy-profile-card');\n expect(publicApi.getMode()).toBe('open');\n expect(publicApi.getApi()).toBe('http://localhost:3000');\n expect(publicApi.getCdn()).toBe('http://localhost:3001');\n expect(publicApi.getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment variable is missing', () => {\n clearEnv();\n\n expect(() => publicApi.getApi()).toThrow('Environment variable API is not defined!');\n });\n});\n",
|
|
77
|
-
'packages/env/index.ts': "export * from './env.js';\n",
|
|
78
|
-
'packages/env/package.json': '{\n "name": "@p/env",\n "type": "module",\n "private": true\n}\n',
|
|
79
|
-
'packages/env/README.md': `# Env
|
|
80
|
-
|
|
81
|
-
Required environment readers shared by API and UI workspaces.
|
|
82
|
-
|
|
83
|
-
## Exports
|
|
84
|
-
|
|
85
|
-
- \`getTag()\` reads \`TAG\`.
|
|
86
|
-
- \`getMode()\` reads \`MODE\`.
|
|
87
|
-
- \`getApi()\` reads \`API\`.
|
|
88
|
-
- \`getCdn()\` reads \`CDN\`.
|
|
89
|
-
- \`getUi()\` reads \`UI\`.
|
|
90
|
-
|
|
91
|
-
Each getter delegates to \`@vyriy/env\` and throws when its environment variable is missing.
|
|
92
|
-
|
|
93
|
-
## Local Defaults
|
|
94
|
-
|
|
95
|
-
\`workspaces/env.sh\` provides the local development defaults:
|
|
96
|
-
|
|
97
|
-
- \`API=http://localhost:3000\`
|
|
98
|
-
- \`CDN=http://localhost:3001\`
|
|
99
|
-
- \`UI=http://localhost:3002\`
|
|
100
|
-
- \`TAG=vyriy-profile-card\`
|
|
101
|
-
- \`MODE=open\`
|
|
102
|
-
|
|
103
|
-
## Example
|
|
104
|
-
|
|
105
|
-
\`\`\`ts
|
|
106
|
-
import { getCdn, getUi } from '@p/env';
|
|
107
|
-
|
|
108
|
-
const stylesheet = \`\${getUi()}/main.css\`;
|
|
109
|
-
const avatar = \`\${getCdn()}/avatar.svg\`;
|
|
110
|
-
\`\`\`
|
|
111
|
-
`,
|
|
112
|
-
'packages/event/constants.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\n\ndescribe('event constants', () => {\n it('matches the manifest event names', () => {\n expect(PROFILE_CARD_ANALYTICS_EVENT_NAME).toBe('openmfe.analytics');\n expect(PROFILE_CARD_SELECT_EVENT_NAME).toBe('vyriy-profile-card.select');\n });\n});\n",
|
|
113
|
-
'packages/event/constants.ts': "/** Custom event emitted when the profile card is selected. */\nexport const PROFILE_CARD_SELECT_EVENT_NAME = 'vyriy-profile-card.select';\n\n/** Standard OpenMFE analytics event emitted for profile-card interactions. */\nexport const PROFILE_CARD_ANALYTICS_EVENT_NAME = 'openmfe.analytics';\n",
|
|
114
|
-
'packages/event/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Event\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
115
|
-
'packages/event/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('event public API', () => {\n it('exports profile card event helpers', () => {\n expect(publicApi.PROFILE_CARD_ANALYTICS_EVENT_NAME).toBe('openmfe.analytics');\n expect(publicApi.PROFILE_CARD_SELECT_EVENT_NAME).toBe('vyriy-profile-card.select');\n expect(publicApi.dispatchProfileCardAnalyticsEvent).toBeDefined();\n expect(publicApi.dispatchProfileCardSelectEvent).toBeDefined();\n });\n});\n",
|
|
116
|
-
'packages/event/index.ts': "export { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nexport { dispatchProfileCardAnalyticsEvent } from './profile-card-analytics.js';\nexport { dispatchProfileCardSelectEvent } from './profile-card-select.js';\nexport type { ProfileCardAnalyticsData, ProfileCardSelectDetail } from './types.js';\n",
|
|
117
|
-
'packages/event/profile-card-analytics.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\n\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME } from './constants.js';\nimport { dispatchProfileCardAnalyticsEvent } from './profile-card-analytics.js';\n\ndescribe('dispatchProfileCardAnalyticsEvent', () => {\n it('dispatches the standard OpenMFE analytics event from the custom element', () => {\n const target = document.createElement('vyriy-profile-card');\n const listener = jest.fn();\n\n target.id = 'profile-card-1';\n target.addEventListener(PROFILE_CARD_ANALYTICS_EVENT_NAME, listener);\n\n const event = dispatchProfileCardAnalyticsEvent(target, {\n avatarUrl: null,\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n\n expect(event.type).toBe(PROFILE_CARD_ANALYTICS_EVENT_NAME);\n expect(event.bubbles).toBe(true);\n expect(event.composed).toBe(true);\n expect(event.detail).toEqual({\n action: 'select',\n category: 'profile-card',\n data: {\n avatarUrl: null,\n name: 'Ada Lovelace',\n role: 'Mathematician',\n },\n id: 'profile-card-1',\n name: 'profile_card_select',\n origin: 'vyriy-profile-card',\n variant: null,\n });\n expect(listener).toHaveBeenCalledWith(event);\n });\n});\n",
|
|
118
|
-
'packages/event/profile-card-analytics.ts': "import { dispatchAnalyticsEvent } from '@vyriy/event';\n\nimport type { ProfileCardAnalyticsData } from './types.js';\n\n/** Dispatches the standard OpenMFE analytics event for a profile-card selection. */\nexport const dispatchProfileCardAnalyticsEvent = (target: HTMLElement, data: ProfileCardAnalyticsData): CustomEvent => {\n return dispatchAnalyticsEvent(\n target,\n {\n action: 'select',\n category: 'profile-card',\n data,\n name: 'profile_card_select',\n },\n {\n bubbles: true,\n composed: true,\n },\n );\n};\n",
|
|
119
|
-
'packages/event/profile-card-select.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\n\nimport { PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nimport { dispatchProfileCardSelectEvent } from './profile-card-select.js';\n\ndescribe('dispatchProfileCardSelectEvent', () => {\n it('dispatches the profile card select event from the custom element', () => {\n const target = document.createElement('vyriy-profile-card');\n const listener = jest.fn();\n\n target.addEventListener(PROFILE_CARD_SELECT_EVENT_NAME, listener);\n\n const event = dispatchProfileCardSelectEvent(target, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n\n expect(event.type).toBe(PROFILE_CARD_SELECT_EVENT_NAME);\n expect(event.bubbles).toBe(true);\n expect(event.composed).toBe(true);\n expect(event.detail).toEqual({\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n expect(listener).toHaveBeenCalledWith(event);\n });\n});\n",
|
|
120
|
-
'packages/event/profile-card-select.ts': "import { dispatchCustomEvent } from '@vyriy/event';\n\nimport { PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nimport type { ProfileCardSelectDetail } from './types.js';\n\n/** Dispatches the profile-card select custom event from the web component host. */\nexport const dispatchProfileCardSelectEvent = (\n target: HTMLElement,\n detail: ProfileCardSelectDetail,\n): CustomEvent<ProfileCardSelectDetail> => {\n return dispatchCustomEvent(target, PROFILE_CARD_SELECT_EVENT_NAME, detail, {\n bubbles: true,\n composed: true,\n });\n};\n",
|
|
121
|
-
'packages/event/README.md': `# Event
|
|
122
|
-
|
|
123
|
-
Typed profile-card event helpers.
|
|
124
|
-
|
|
125
|
-
## Exports
|
|
126
|
-
|
|
127
|
-
- \`PROFILE_CARD_SELECT_EVENT_NAME\` is \`vyriy-profile-card.select\`.
|
|
128
|
-
- \`PROFILE_CARD_ANALYTICS_EVENT_NAME\` is \`openmfe.analytics\`.
|
|
129
|
-
- \`dispatchProfileCardSelectEvent(target, detail)\` dispatches the profile-card selection event.
|
|
130
|
-
- \`dispatchProfileCardAnalyticsEvent(target, data)\` dispatches the standard OpenMFE analytics event for the same selection.
|
|
131
|
-
- \`ProfileCardSelectDetail\` and \`ProfileCardAnalyticsData\` describe the event payloads.
|
|
132
|
-
|
|
133
|
-
Both dispatch helpers emit bubbling, composed custom events so consumers outside the custom element shadow root can observe them.
|
|
134
|
-
|
|
135
|
-
## Usage
|
|
136
|
-
|
|
137
|
-
\`\`\`ts
|
|
138
|
-
import { dispatchProfileCardAnalyticsEvent, dispatchProfileCardSelectEvent } from '@p/event';
|
|
139
|
-
|
|
140
|
-
const target = document.querySelector('vyriy-profile-card');
|
|
141
|
-
|
|
142
|
-
if (target instanceof HTMLElement) {
|
|
143
|
-
const detail = {
|
|
144
|
-
name: 'Ada Lovelace',
|
|
145
|
-
role: 'Mathematician',
|
|
146
|
-
avatarUrl: '/avatar.svg',
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
dispatchProfileCardSelectEvent(target, detail);
|
|
150
|
-
dispatchProfileCardAnalyticsEvent(target, detail);
|
|
151
|
-
}
|
|
152
|
-
\`\`\`
|
|
153
|
-
|
|
154
|
-
## Payload
|
|
155
|
-
|
|
156
|
-
\`ProfileCardSelectDetail\` requires \`name\` and accepts optional \`role\` and \`avatarUrl\`.
|
|
157
|
-
|
|
158
|
-
The analytics helper wraps the same data in the standard OpenMFE analytics event with \`action: 'select'\` and \`category: 'profile-card'\`.
|
|
159
|
-
`,
|
|
160
|
-
'packages/event/types.ts': '/** Detail payload for the profile-card select custom event. */\nexport type ProfileCardSelectDetail = {\n name: string;\n role?: string;\n avatarUrl?: string | null;\n};\n\n/** Analytics data payload emitted for profile-card selections. */\nexport type ProfileCardAnalyticsData = ProfileCardSelectDetail;\n',
|
|
161
|
-
'packages/query/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Query\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
162
|
-
'packages/query/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('query public API', () => {\n it('exports query parsers', () => {\n expect(publicApi.parseProfileCardQuery).toBeDefined();\n });\n});\n",
|
|
163
|
-
'packages/query/index.ts': "export * from './profile-card.js';\nexport type * from './types.js';\n",
|
|
164
|
-
'packages/query/package.json': '{\n "name": "@p/query",\n "type": "module",\n "private": true\n}\n',
|
|
165
|
-
'packages/query/profile-card.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { parseProfileCardQuery } from './profile-card.js';\n\ndescribe('parseProfileCardQuery', () => {\n it('returns undefined when name is missing', () => {\n expect(parseProfileCardQuery(undefined)).toBeUndefined();\n expect(parseProfileCardQuery({})).toBeUndefined();\n expect(parseProfileCardQuery({ name: '' })).toBeUndefined();\n });\n\n it('parses supported profile card fields', () => {\n expect(\n parseProfileCardQuery({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: 'one, two,, three ',\n title: 'Title',\n }),\n ).toEqual({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: ['one', 'two', 'three'],\n title: 'Title',\n });\n });\n\n it('omits tags when the query list is empty after trimming', () => {\n expect(\n parseProfileCardQuery({\n name: 'Name',\n tags: ', , ',\n }),\n ).toEqual({\n name: 'Name',\n tags: undefined,\n });\n });\n});\n",
|
|
166
|
-
'packages/query/profile-card.ts': "import type { ParseProfileCardQuery, Query } from './types.js';\n\nconst getQueryValue = (query: Query, name: string): string | undefined => {\n const value = query?.[name];\n\n return value === '' ? undefined : value;\n};\n\nconst getQueryList = (query: Query, name: string): string[] | undefined => {\n const value = getQueryValue(query, name);\n\n if (!value) {\n return undefined;\n }\n\n const list = value\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean);\n\n return list.length > 0 ? list : undefined;\n};\n\n/** Parses request query parameters into profile-card props. */\nexport const parseProfileCardQuery: ParseProfileCardQuery = (query) => {\n const name = getQueryValue(query, 'name');\n\n if (!name) {\n return undefined;\n }\n\n return {\n name,\n title: getQueryValue(query, 'title'),\n description: getQueryValue(query, 'description'),\n avatarUrl: getQueryValue(query, 'avatarUrl'),\n tags: getQueryList(query, 'tags'),\n };\n};\n",
|
|
167
|
-
'packages/query/README.md': `# Query
|
|
168
|
-
|
|
169
|
-
Query-string parsers for profile-card API endpoints.
|
|
170
|
-
|
|
171
|
-
## Exports
|
|
172
|
-
|
|
173
|
-
- \`parseProfileCardQuery(query)\` converts router query parameters into profile-card props.
|
|
174
|
-
- \`Query\` describes the router query input shape.
|
|
175
|
-
- \`ParseProfileCardQuery\` describes the parser signature.
|
|
176
|
-
|
|
177
|
-
## Parameters
|
|
178
|
-
|
|
179
|
-
\`name\` is required. When \`name\` is missing or empty, the parser returns \`undefined\`.
|
|
180
|
-
|
|
181
|
-
Supported optional parameters:
|
|
182
|
-
|
|
183
|
-
- \`title\`
|
|
184
|
-
- \`description\`
|
|
185
|
-
- \`avatarUrl\`
|
|
186
|
-
- \`tags\`, as a comma-separated list
|
|
187
|
-
|
|
188
|
-
Empty string values are treated as missing. \`tags\` are split on commas, trimmed, and empty items are removed.
|
|
189
|
-
|
|
190
|
-
## Example
|
|
191
|
-
|
|
192
|
-
\`\`\`ts
|
|
193
|
-
import { parseProfileCardQuery } from '@p/query';
|
|
194
|
-
|
|
195
|
-
const props = parseProfileCardQuery({
|
|
196
|
-
name: 'Ada Lovelace',
|
|
197
|
-
title: 'Mathematician',
|
|
198
|
-
description: 'First computer programmer.',
|
|
199
|
-
tags: 'math, computing',
|
|
200
|
-
});
|
|
201
|
-
\`\`\`
|
|
202
|
-
`,
|
|
203
|
-
'packages/query/types.ts': "import type { ProfileCard } from '@p/components/profile-card/types.js';\n\n/** Query string values provided by the API router. */\nexport type Query = Record<string, string | undefined> | undefined;\n\n/** Converts query string values into profile-card props or rejects incomplete input. */\nexport type ParseProfileCardQuery = (query: Query) => ProfileCard | undefined;\n",
|
|
204
|
-
'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
|
|
205
|
-
'workspaces/api/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack --config $scriptdir/webpack.config.ts\n\ncp $scriptdir/package.json dist/api/package.json\nnpm pkg delete "type" --prefix dist/api\nnpm pkg delete "private" --prefix dist/api\n',
|
|
206
|
-
'workspaces/api/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\necho "Demo:\\n$API/\\n"\necho "Prerender:\\n$API/prerender?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3001/avatar.svg\\n"\necho "Semantic:\\n$API/semantic?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3001/avatar.svg\\n"\necho "Manifest:\\n$API/manifest.yml\\n"\n\nNODE_ENV=production \\\nLOG_LEVEL=info \\\nPORT=$API_PORT \\\ntsx watch $scriptdir/index.ts\n',
|
|
207
|
-
'workspaces/api/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/API\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
208
|
-
'workspaces/api/index.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\nimport type { APIGatewayProxyEvent } from '@vyriy/router';\n\nconst apiMock = jest.fn((handler) => ({\n handler,\n}));\nconst serverMock = jest.fn();\n\njest.mock('@vyriy/handler', () => ({\n api: apiMock,\n}));\n\njest.mock('@vyriy/server', () => ({\n server: serverMock,\n}));\n\ndescribe('workspaces/api/index.ts', () => {\n const getEvent = (\n path: string,\n queryStringParameters: APIGatewayProxyEvent['queryStringParameters'] = null,\n ): APIGatewayProxyEvent =>\n ({\n body: null,\n headers: {},\n httpMethod: 'GET',\n path,\n pathParameters: null,\n queryStringParameters,\n }) as APIGatewayProxyEvent;\n\n it('starts the server with the API router handler', async () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.API = 'http://localhost:3000';\n process.env.CDN = 'http://localhost:3001';\n process.env.UI = 'http://localhost:3002';\n\n await import('./index.js');\n\n expect(apiMock).toHaveBeenCalledTimes(1);\n expect(serverMock).toHaveBeenCalledTimes(1);\n expect(serverMock).toHaveBeenCalledWith(apiMock.mock.results[0]?.value);\n\n const handler = apiMock.mock.calls[0]?.[0] as (event: APIGatewayProxyEvent) => Promise<{\n body: string;\n headers?: Record<string, string>;\n statusCode: number;\n }>;\n\n await expect(handler(getEvent('/'))).resolves.toEqual({\n body: expect.stringContaining('<vyriy-profile-card'),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/html; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/prerender'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Query parameter \"name\" is required.',\n }),\n headers: undefined,\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 400,\n });\n\n const prerenderResponse = await handler(\n getEvent('/prerender', {\n description: 'Profile description',\n name: 'Name',\n tags: 'one, two',\n title: 'Title',\n }),\n );\n\n expect(prerenderResponse).toEqual({\n body: expect.stringContaining('Name'),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/html; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n expect(prerenderResponse.body).toContain('shadowrootmode=\"open\"');\n expect(prerenderResponse.body).toContain('http://localhost:3002/main.css');\n\n await expect(handler(getEvent('/semantic', { name: 'Name' }))).resolves.toEqual({\n body: JSON.stringify({\n '@context': 'https://schema.org',\n '@type': 'Person',\n name: 'Name',\n }),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'application/ld+json; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/semantic'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Query parameter \"name\" is required.',\n }),\n headers: undefined,\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 400,\n });\n\n await expect(handler(getEvent('/manifest.yml'))).resolves.toEqual({\n body: expect.stringContaining(\"name: 'Vyriy Profile Card'\"),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/yaml; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/healthcheck'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Not Found',\n }),\n statusCode: 404,\n });\n });\n});\n",
|
|
209
|
-
'workspaces/api/index.ts': "import { server } from '@vyriy/server';\nimport { api } from '@vyriy/handler';\nimport { createRouter } from '@vyriy/router';\nimport { minify } from '@vyriy/html';\n\nimport { demo, manifest, prerender, semantic } from '@p/api';\nimport { parseProfileCardQuery } from '@p/query';\n\nserver(\n api(async (event) =>\n createRouter()\n .get('/', () => ({\n body: minify(demo()),\n headers: {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n }))\n .get('/prerender', ({ query }) => {\n const profileCard = parseProfileCardQuery(query);\n\n if (!profileCard) {\n return {\n statusCode: 400,\n body: JSON.stringify({ message: 'Query parameter \"name\" is required.' }),\n };\n }\n\n return {\n body: minify(prerender(profileCard)),\n headers: {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n };\n })\n .get('/semantic', ({ query }) => {\n const profileCard = parseProfileCardQuery(query);\n\n if (!profileCard) {\n return {\n statusCode: 400,\n body: JSON.stringify({ message: 'Query parameter \"name\" is required.' }),\n };\n }\n\n return {\n body: semantic(profileCard),\n headers: {\n 'content-type': 'application/ld+json; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n };\n })\n .get('/manifest.yml', () => ({\n body: manifest(),\n headers: {\n 'content-type': 'text/yaml; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n }))\n .route(event),\n ),\n);\n",
|
|
210
|
-
'workspaces/api/package.json': '{\n "name": "@w/api",\n "type": "module",\n "private": true\n}\n',
|
|
211
|
-
'workspaces/api/README.md': `# Api
|
|
212
|
-
|
|
213
|
-
Server workspace for the profile-card microfrontend.
|
|
214
|
-
|
|
215
|
-
## Routes
|
|
216
|
-
|
|
217
|
-
- \`GET /\` returns a standalone HTML demo page.
|
|
218
|
-
- \`GET /prerender\` returns server-rendered custom element HTML.
|
|
219
|
-
- \`GET /semantic\` returns Schema.org Person JSON-LD.
|
|
220
|
-
- \`GET /manifest.yml\` returns the OpenMFE manifest YAML.
|
|
221
|
-
|
|
222
|
-
\`/prerender\` and \`/semantic\` require the \`name\` query parameter. They also accept \`title\`, \`description\`, \`avatarUrl\`, and comma-separated \`tags\`.
|
|
223
|
-
|
|
224
|
-
## Local Development
|
|
225
|
-
|
|
226
|
-
\`\`\`bash
|
|
227
|
-
yarn start:api
|
|
228
|
-
\`\`\`
|
|
229
|
-
|
|
230
|
-
The start script loads \`workspaces/env.sh\`, listens on \`API_PORT\`, and prints example URLs for the demo, prerender, semantic, and manifest endpoints.
|
|
231
|
-
|
|
232
|
-
Default local URL:
|
|
233
|
-
|
|
234
|
-
\`\`\`text
|
|
235
|
-
http://localhost:3000
|
|
236
|
-
\`\`\`
|
|
237
|
-
|
|
238
|
-
## Build
|
|
239
|
-
|
|
240
|
-
\`\`\`bash
|
|
241
|
-
yarn build:api
|
|
242
|
-
\`\`\`
|
|
243
|
-
|
|
244
|
-
The build writes the server bundle to \`dist/api\`.
|
|
245
|
-
`,
|
|
246
|
-
'workspaces/api/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\nimport { path } from '@vyriy/path';\nimport { ssr, external } from '@vyriy/webpack-config';\n\nexport default ssr(\n '@w/api',\n {\n path: path('dist', 'api'),\n filename: 'index.js',\n library: { type: 'commonjs2' },\n },\n (config) => ({\n ...config,\n externals: [external({ allowlist: [/^@p/, /^@w/, /^@vyriy/] })],\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin([\n 'API',\n 'CDN',\n 'MODE',\n 'TAG',\n 'UI',\n ]),\n ],\n }),\n);\n",
|
|
247
|
-
'workspaces/env.sh': '#!/usr/bin/env sh\n\n: "${API_PORT:=3000}"\n: "${CDN_PORT:=3001}"\n: "${UI_PORT:=3002}"\n: "${API:=http://localhost:$API_PORT}"\n: "${CDN:=http://localhost:$CDN_PORT}"\n: "${UI:=http://localhost:$UI_PORT}"\n: "${TAG:=vyriy-profile-card}"\n: "${MODE:=open}"\n\nexport API_PORT\nexport CDN_PORT\nexport UI_PORT\nexport API\nexport CDN\nexport UI\nexport TAG\nexport MODE\n',
|
|
248
|
-
'workspaces/static/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/static";\ndistdir="$PWD/dist/cdn";\n\ncp -R $scriptdir/public/* $distdir/\n',
|
|
249
|
-
'workspaces/static/bin/start.sh': `#!/usr/bin/env sh
|
|
250
|
-
|
|
251
|
-
set -e
|
|
252
|
-
|
|
253
|
-
scriptdir="$PWD/workspaces/static";
|
|
254
|
-
|
|
255
|
-
. "$PWD/workspaces/env.sh"
|
|
256
|
-
|
|
257
|
-
npx vs -p $CDN_PORT $scriptdir/public
|
|
258
|
-
`,
|
|
259
|
-
'workspaces/static/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/Static\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
260
|
-
'workspaces/static/package.json': '{\n "name": "@w/static",\n "type": "module",\n "private": true\n}\n',
|
|
261
|
-
'workspaces/static/public/avatar.svg': '<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800">\r\n<rect width="1200" height="800" fill="#0057B7"/>\r\n<rect width="1200" height="400" y="400" fill="#FFD700"/>\r\n</svg>',
|
|
262
|
-
'workspaces/static/public/icon.svg': '<svg\n width="256"\n height="256"\n viewBox="0 0 256 256"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Vyriy Profile Card icon</title>\n <desc id="description">A calm rounded square icon with a profile card symbol.</desc>\n\n <rect width="256" height="256" rx="56" fill="#111827" />\n <rect x="56" y="48" width="144" height="160" rx="24" fill="#F9FAFB" />\n <circle cx="128" cy="104" r="36" fill="#9CA3AF" />\n <rect x="84" y="156" width="88" height="14" rx="7" fill="#111827" />\n <rect x="96" y="180" width="64" height="10" rx="5" fill="#6B7280" />\n <circle cx="184" cy="184" r="20" fill="#10B981" />\n <path\n d="M175 184L181 190L194 176"\n stroke="white"\n stroke-width="6"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>\n',
|
|
263
|
-
'workspaces/static/public/screenshots/compact.svg': '<svg\n width="1280"\n height="720"\n viewBox="0 0 1280 720"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Default profile card screenshot</title>\n <desc id="description">A profile card microfrontend rendered in a desktop host page.</desc>\n\n <rect width="1280" height="720" fill="#F3F4F6" />\n <rect x="80" y="72" width="1120" height="576" rx="32" fill="white" />\n\n <rect x="128" y="120" width="360" height="480" rx="28" fill="#F9FAFB" stroke="#E5E7EB" />\n <circle cx="308" cy="244" r="72" fill="#9CA3AF" />\n <rect x="188" y="368" width="240" height="28" rx="14" fill="#111827" />\n <rect x="224" y="420" width="168" height="18" rx="9" fill="#6B7280" />\n <rect x="232" y="492" width="152" height="44" rx="22" fill="#10B981" />\n\n <rect x="560" y="152" width="420" height="40" rx="20" fill="#111827" />\n <rect x="560" y="232" width="520" height="20" rx="10" fill="#6B7280" />\n <rect x="560" y="272" width="460" height="20" rx="10" fill="#9CA3AF" />\n <rect x="560" y="312" width="360" height="20" rx="10" fill="#D1D5DB" />\n <rect x="560" y="420" width="520" height="96" rx="24" fill="#F9FAFB" stroke="#E5E7EB" />\n</svg>\n',
|
|
264
|
-
'workspaces/static/public/screenshots/default.svg': '<svg\n width="1280"\n height="720"\n viewBox="0 0 1280 720"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Default profile card screenshot</title>\n <desc id="description">A profile card microfrontend rendered in a desktop host page.</desc>\n\n <rect width="1280" height="720" fill="#F3F4F6" />\n <rect x="80" y="72" width="1120" height="576" rx="32" fill="white" />\n\n <rect x="128" y="120" width="360" height="480" rx="28" fill="#F9FAFB" stroke="#E5E7EB" />\n <circle cx="308" cy="244" r="72" fill="#9CA3AF" />\n <rect x="188" y="368" width="240" height="28" rx="14" fill="#111827" />\n <rect x="224" y="420" width="168" height="18" rx="9" fill="#6B7280" />\n <rect x="232" y="492" width="152" height="44" rx="22" fill="#10B981" />\n\n <rect x="560" y="152" width="420" height="40" rx="20" fill="#111827" />\n <rect x="560" y="232" width="520" height="20" rx="10" fill="#6B7280" />\n <rect x="560" y="272" width="460" height="20" rx="10" fill="#9CA3AF" />\n <rect x="560" y="312" width="360" height="20" rx="10" fill="#D1D5DB" />\n <rect x="560" y="420" width="520" height="96" rx="24" fill="#F9FAFB" stroke="#E5E7EB" />\n</svg>\n',
|
|
265
|
-
'workspaces/static/README.md': `# Static
|
|
266
|
-
|
|
267
|
-
Static asset workspace for the profile-card microfrontend.
|
|
268
|
-
|
|
269
|
-
This workspace uses \`@vyriy/static\` to serve files during local development. The package exposes the \`vs\` command, which can also be installed globally to serve static data from any directory with a simple command.
|
|
270
|
-
|
|
271
|
-
## Assets
|
|
272
|
-
|
|
273
|
-
- \`avatar.svg\` is the default demo avatar.
|
|
274
|
-
- \`icon.svg\` is the manifest icon.
|
|
275
|
-
- \`screenshots/default.svg\` documents the default profile-card state.
|
|
276
|
-
- \`screenshots/compact.svg\` documents the compact profile-card state.
|
|
277
|
-
|
|
278
|
-
The workspace is served as the CDN origin during local development and copied into \`dist/cdn\` for production builds.
|
|
279
|
-
|
|
280
|
-
## Local Development
|
|
281
|
-
|
|
282
|
-
\`\`\`bash
|
|
283
|
-
yarn start:static
|
|
284
|
-
\`\`\`
|
|
285
|
-
|
|
286
|
-
The start script loads \`workspaces/env.sh\` and serves \`workspaces/static/public\` on \`CDN_PORT\`.
|
|
287
|
-
|
|
288
|
-
Internally it runs:
|
|
289
|
-
|
|
290
|
-
\`\`\`bash
|
|
291
|
-
npx vs -p $CDN_PORT workspaces/static/public
|
|
292
|
-
\`\`\`
|
|
293
|
-
|
|
294
|
-
With \`@vyriy/static\` installed globally, the same kind of static preview can be started directly:
|
|
295
|
-
|
|
296
|
-
\`\`\`bash
|
|
297
|
-
vs -p 3001 workspaces/static/public
|
|
298
|
-
\`\`\`
|
|
299
|
-
|
|
300
|
-
Default local URL:
|
|
301
|
-
|
|
302
|
-
\`\`\`text
|
|
303
|
-
http://localhost:3001
|
|
304
|
-
\`\`\`
|
|
305
|
-
|
|
306
|
-
## Build
|
|
307
|
-
|
|
308
|
-
\`\`\`bash
|
|
309
|
-
yarn build:static
|
|
310
|
-
\`\`\`
|
|
311
|
-
`,
|
|
312
|
-
'workspaces/ui/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/ui";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack \\\n--config $scriptdir/webpack.config.ts\n',
|
|
313
|
-
'workspaces/ui/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/ui";\n\n. "$PWD/workspaces/env.sh"\n\nnpx webpack serve \\\n--open \\\n--config $scriptdir/webpack.config.ts \\\n--port $UI_PORT\n',
|
|
314
|
-
'workspaces/ui/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/UI\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
315
|
-
'workspaces/ui/index.test.tsx': `import { beforeAll, describe, expect, it, jest } from '@jest/globals';
|
|
316
|
-
import type { ReactElement } from 'react';
|
|
317
|
-
|
|
318
|
-
type CustomElementOptions = {
|
|
319
|
-
tag: string;
|
|
320
|
-
elements: () => {
|
|
321
|
-
elements: HTMLElement[];
|
|
322
|
-
root: HTMLElement;
|
|
323
|
-
};
|
|
324
|
-
render: (el: HTMLElement) => ReactElement<{
|
|
325
|
-
onClick: () => void;
|
|
326
|
-
tags?: string[];
|
|
327
|
-
}>;
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
const customElementMock = jest.fn();
|
|
331
|
-
const dispatchProfileCardAnalyticsEventMock = jest.fn();
|
|
332
|
-
const dispatchProfileCardSelectEventMock = jest.fn();
|
|
333
|
-
let options: CustomElementOptions;
|
|
334
|
-
|
|
335
|
-
jest.mock('@vyriy/render/custom-element', () => ({
|
|
336
|
-
customElement: customElementMock,
|
|
337
|
-
}));
|
|
338
|
-
|
|
339
|
-
jest.mock('@p/event', () => ({
|
|
340
|
-
dispatchProfileCardAnalyticsEvent: dispatchProfileCardAnalyticsEventMock,
|
|
341
|
-
dispatchProfileCardSelectEvent: dispatchProfileCardSelectEventMock,
|
|
342
|
-
}));
|
|
343
|
-
|
|
344
|
-
describe('workspaces/ui/index.tsx', () => {
|
|
345
|
-
beforeAll(async () => {
|
|
346
|
-
process.env.UI = 'http://localhost:3002';
|
|
347
|
-
|
|
348
|
-
await import('./index.js');
|
|
349
|
-
|
|
350
|
-
[options] = (customElementMock.mock.calls[0] ?? []) as [CustomElementOptions];
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
it('registers the profile-card custom element with event dispatching', () => {
|
|
354
|
-
const renderElements = options.elements();
|
|
355
|
-
const host = document.createElement('vyriy-profile-card');
|
|
356
|
-
|
|
357
|
-
host.setAttribute('avatarUrl', 'https://example.com/avatar.png');
|
|
358
|
-
host.setAttribute('description', 'Profile description');
|
|
359
|
-
host.setAttribute('name', 'Ada Lovelace');
|
|
360
|
-
host.setAttribute('tags', '["math","computing"]');
|
|
361
|
-
host.setAttribute('title', 'Mathematician');
|
|
362
|
-
|
|
363
|
-
const element = options.render(host);
|
|
364
|
-
|
|
365
|
-
element.props.onClick();
|
|
366
|
-
|
|
367
|
-
expect(options.tag).toBe('vyriy-profile-card');
|
|
368
|
-
expect(renderElements.root).toBeInstanceOf(HTMLDivElement);
|
|
369
|
-
expect(renderElements.elements[0]).toBeInstanceOf(HTMLLinkElement);
|
|
370
|
-
expect((renderElements.elements[0] as HTMLLinkElement).href).toBe('http://localhost:3002/main.css');
|
|
371
|
-
expect(element.props.tags).toEqual(['math', 'computing']);
|
|
372
|
-
expect(dispatchProfileCardSelectEventMock).toHaveBeenCalledWith(host, {
|
|
373
|
-
avatarUrl: 'https://example.com/avatar.png',
|
|
374
|
-
name: 'Ada Lovelace',
|
|
375
|
-
role: 'Mathematician',
|
|
376
|
-
});
|
|
377
|
-
expect(dispatchProfileCardAnalyticsEventMock).toHaveBeenCalledWith(host, {
|
|
378
|
-
avatarUrl: 'https://example.com/avatar.png',
|
|
379
|
-
name: 'Ada Lovelace',
|
|
380
|
-
role: 'Mathematician',
|
|
381
|
-
});
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
it('ignores missing and invalid tags attributes', () => {
|
|
385
|
-
const host = document.createElement('vyriy-profile-card');
|
|
386
|
-
|
|
387
|
-
expect(options.render(host).props.tags).toBeUndefined();
|
|
388
|
-
|
|
389
|
-
host.setAttribute('tags', 'not json');
|
|
390
|
-
|
|
391
|
-
expect(options.render(host).props.tags).toBeUndefined();
|
|
392
|
-
|
|
393
|
-
host.setAttribute('tags', '{"tag":"math"}');
|
|
394
|
-
|
|
395
|
-
expect(options.render(host).props.tags).toBeUndefined();
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
it('falls back to empty profile values when attributes are missing', () => {
|
|
399
|
-
const host = document.createElement('vyriy-profile-card');
|
|
400
|
-
const element = options.render(host);
|
|
401
|
-
|
|
402
|
-
element.props.onClick();
|
|
403
|
-
|
|
404
|
-
expect(dispatchProfileCardSelectEventMock).toHaveBeenLastCalledWith(host, {
|
|
405
|
-
avatarUrl: null,
|
|
406
|
-
name: '',
|
|
407
|
-
role: undefined,
|
|
408
|
-
});
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
`,
|
|
412
|
-
'workspaces/ui/index.tsx': `import { customElement } from '@vyriy/render/custom-element';
|
|
413
|
-
|
|
414
|
-
import { dispatchProfileCardAnalyticsEvent, dispatchProfileCardSelectEvent } from '@p/event';
|
|
415
|
-
|
|
416
|
-
import { ProfileCard } from '@p/components/profile-card';
|
|
417
|
-
import '@p/components/styles.scss';
|
|
418
|
-
|
|
419
|
-
const parseJsonAttribute = (value: string | null): string[] | undefined => {
|
|
420
|
-
if (!value) {
|
|
421
|
-
return undefined;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
try {
|
|
425
|
-
const parsedValue: unknown = JSON.parse(value);
|
|
426
|
-
|
|
427
|
-
if (Array.isArray(parsedValue) && parsedValue.every((item) => typeof item === 'string')) {
|
|
428
|
-
return parsedValue;
|
|
429
|
-
}
|
|
430
|
-
} catch {
|
|
431
|
-
return undefined;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
return undefined;
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
const getProfileCardSelectDetail = (el: HTMLElement) => ({
|
|
438
|
-
avatarUrl: el.getAttribute('avatarUrl'),
|
|
439
|
-
name: el.getAttribute('name') ?? '',
|
|
440
|
-
role: el.getAttribute('title') ?? undefined,
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
customElement({
|
|
444
|
-
tag: 'vyriy-profile-card',
|
|
445
|
-
elements: () => {
|
|
446
|
-
const link = document.createElement('link');
|
|
447
|
-
const container = document.createElement('div');
|
|
448
|
-
|
|
449
|
-
link.rel = 'stylesheet';
|
|
450
|
-
link.href = \`\${process.env.UI}/main.css\`;
|
|
451
|
-
|
|
452
|
-
return {
|
|
453
|
-
elements: [link, container],
|
|
454
|
-
root: container,
|
|
455
|
-
};
|
|
456
|
-
},
|
|
457
|
-
render: (el) => (
|
|
458
|
-
<ProfileCard
|
|
459
|
-
avatarUrl={el.getAttribute('avatarUrl') ?? ''}
|
|
460
|
-
description={el.getAttribute('description') ?? ''}
|
|
461
|
-
name={el.getAttribute('name') ?? ''}
|
|
462
|
-
onClick={() => {
|
|
463
|
-
const detail = getProfileCardSelectDetail(el);
|
|
464
|
-
|
|
465
|
-
dispatchProfileCardSelectEvent(el, detail);
|
|
466
|
-
dispatchProfileCardAnalyticsEvent(el, detail);
|
|
467
|
-
}}
|
|
468
|
-
tags={parseJsonAttribute(el.getAttribute('tags'))}
|
|
469
|
-
title={el.getAttribute('title') ?? ''}
|
|
470
|
-
/>
|
|
471
|
-
),
|
|
472
|
-
});
|
|
473
|
-
`,
|
|
474
|
-
'workspaces/ui/package.json': '{\n "name": "@w/ui",\n "type": "module",\n "private": true\n}\n',
|
|
475
|
-
'workspaces/ui/README.md': `# UI
|
|
476
|
-
|
|
477
|
-
Browser workspace for the \`vyriy-profile-card\` custom element.
|
|
478
|
-
|
|
479
|
-
## Runtime
|
|
480
|
-
|
|
481
|
-
The entry point registers the custom element and renders \`ProfileCard\` inside its shadow root. The element reads these attributes:
|
|
482
|
-
|
|
483
|
-
- \`name\`
|
|
484
|
-
- \`title\`
|
|
485
|
-
- \`description\`
|
|
486
|
-
- \`avatarUrl\`
|
|
487
|
-
- \`tags\`, as a JSON string array
|
|
488
|
-
|
|
489
|
-
Clicking the rendered profile card dispatches \`vyriy-profile-card.select\` and \`openmfe.analytics\`.
|
|
490
|
-
|
|
491
|
-
## Local Development
|
|
492
|
-
|
|
493
|
-
\`\`\`bash
|
|
494
|
-
yarn start:ui
|
|
495
|
-
\`\`\`
|
|
496
|
-
|
|
497
|
-
The start script loads \`workspaces/env.sh\`, starts webpack dev server on \`UI_PORT\`, and opens the generated demo page.
|
|
498
|
-
|
|
499
|
-
Default local URL:
|
|
500
|
-
|
|
501
|
-
\`\`\`text
|
|
502
|
-
http://localhost:3002
|
|
503
|
-
\`\`\`
|
|
504
|
-
|
|
505
|
-
## Build
|
|
506
|
-
|
|
507
|
-
\`\`\`bash
|
|
508
|
-
yarn build:ui
|
|
509
|
-
\`\`\`
|
|
510
|
-
|
|
511
|
-
The build writes \`index.js\`, \`main.css\`, and the generated demo HTML into \`dist/cdn\`.
|
|
512
|
-
`,
|
|
513
|
-
'workspaces/ui/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\n\nimport { csr, html } from '@vyriy/webpack-config';\nimport { path } from '@vyriy/path';\n\nexport default csr(\n '@w/ui',\n {\n path: path('dist', 'cdn'),\n filename: 'index.js',\n },\n (config) => ({\n ...config,\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin(['API', 'CDN', 'UI']),\n html(\n {\n htmlAttributes: 'lang=\"en\"',\n title: '<title>Demo</title>',\n meta: '<meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />',\n body: '<vyriy-profile-card name=\"Developer\" title=\"Senior IT Professional\" avatarUrl=\"http://localhost:3001/avatar.svg\"></vyriy-profile-card>',\n script: [\n '<script defer=\"defer\" src=\"/index.js\"></script>',\n [\n '<script type=\"module\">',\n \"const card = document.querySelector('vyriy-profile-card');\",\n \"card.addEventListener('vyriy-profile-card.select', (event) => {\",\n \" console.log('UI demo event:', event.detail);\",\n '});',\n '</scr' + 'ipt>',\n ].join(''),\n ].join(''),\n },\n { inject: false },\n ),\n ],\n }),\n);\n",
|
|
514
|
-
};
|
|
515
|
-
export const mfe = (options) => ({
|
|
516
|
-
'AGENTS.md': agentsContent,
|
|
517
|
-
'.editorconfig': `# https://editorconfig.org
|
|
518
|
-
root = true
|
|
519
|
-
|
|
520
|
-
[*]
|
|
521
|
-
charset = utf-8
|
|
522
|
-
end_of_line = lf
|
|
523
|
-
insert_final_newline = true
|
|
524
|
-
trim_trailing_whitespace = true
|
|
525
|
-
|
|
526
|
-
indent_style = space
|
|
527
|
-
indent_size = 2
|
|
528
|
-
|
|
529
|
-
max_line_length = 100
|
|
530
|
-
|
|
531
|
-
# Markdown
|
|
532
|
-
[*.md]
|
|
533
|
-
trim_trailing_whitespace = false
|
|
534
|
-
max_line_length = off
|
|
535
|
-
|
|
536
|
-
# YAML / YML
|
|
537
|
-
[*.{yml,yaml}]
|
|
538
|
-
indent_size = 2
|
|
539
|
-
|
|
540
|
-
# JSON
|
|
541
|
-
[*.json]
|
|
542
|
-
indent_size = 2
|
|
543
|
-
|
|
544
|
-
# TypeScript / JavaScript
|
|
545
|
-
[*.{ts,tsx,js,jsx}]
|
|
546
|
-
indent_size = 2
|
|
547
|
-
|
|
548
|
-
# Shell / Bash
|
|
549
|
-
[*.sh]
|
|
550
|
-
indent_size = 2
|
|
551
|
-
`,
|
|
552
|
-
'.gitignore': `.yarn/*
|
|
553
|
-
!.yarn/cache
|
|
554
|
-
!.yarn/patches
|
|
555
|
-
!.yarn/plugins
|
|
556
|
-
!.yarn/releases
|
|
557
|
-
!.yarn/sdks
|
|
558
|
-
!.yarn/versions
|
|
559
|
-
|
|
560
|
-
.DS_Store
|
|
561
|
-
.idea
|
|
562
|
-
node_modules
|
|
563
|
-
coverage
|
|
564
|
-
dist
|
|
565
|
-
storybook-static
|
|
566
|
-
*storybook.log
|
|
567
|
-
consumer
|
|
568
|
-
|
|
569
|
-
cdk.out
|
|
570
|
-
cdk.context.json
|
|
571
|
-
|
|
572
|
-
!/**/.gitkeep
|
|
573
|
-
`,
|
|
574
|
-
'.npmrc': 'engine-strict=true\n',
|
|
575
|
-
'.nvmrc': 'lts/krypton\n',
|
|
576
|
-
'.yarnrc.yml': 'nodeLinker: node-modules\nnpmMinimalAgeGate: 0\n',
|
|
13
|
+
'.editorconfig': '# https://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\nindent_style = space\nindent_size = 2\n\nmax_line_length = 100\n\n# Markdown\n[*.md]\ntrim_trailing_whitespace = false\nmax_line_length = off\n\n# YAML / YML\n[*.{yml,yaml}]\nindent_size = 2\n\n# JSON\n[*.json]\nindent_size = 2\n\n# TypeScript / JavaScript\n[*.{ts,tsx,js,jsx}]\nindent_size = 2\n\n# Shell / Bash\n[*.sh]\nindent_size = 2\n',
|
|
14
|
+
'.gitignore': '.yarn/*\n!.yarn/cache\n!.yarn/patches\n!.yarn/plugins\n!.yarn/releases\n!.yarn/sdks\n!.yarn/versions\n\n.DS_Store\n.idea\nnode_modules\ncoverage\ndist\nstorybook-static\n*storybook.log\nconsumer\n\ncdk.out\ncdk.context.json\n\n!/**/.gitkeep\n',
|
|
15
|
+
'.gitlab-ci.yml': 'include:\n - project: vyriy/ci\n ref: main\n file: /ci.yml\n\nvariables:\n JOB_RELEASE_DISABLED: \'1\'\n JOB_E2E_DISABLED: \'1\'\n JOB_AWS_DISABLED: \'1\'\n\ndocker:\n script:\n - |\n set -eu\n\n IMAGE_TAG="${CI_COMMIT_TAG:-$CI_PIPELINE_IID}"\n\n echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"\n\n docker buildx build \\\n --tag "$CI_REGISTRY_IMAGE/api:$IMAGE_TAG" \\\n --tag "$CI_REGISTRY_IMAGE/api:latest" \\\n --file workspaces/api/Dockerfile \\\n --platform linux/arm64 \\\n --provenance=false \\\n --pull \\\n --push \\\n dist\n\n docker buildx build \\\n --tag "$CI_REGISTRY_IMAGE/storybook:$IMAGE_TAG" \\\n --tag "$CI_REGISTRY_IMAGE/storybook:latest" \\\n --file Dockerfile.static \\\n --platform linux/arm64 \\\n --provenance=false \\\n --pull \\\n --push \\\n storybook-static\n\n sshpass \\\n -p "$SSH_PASSWORD" \\\n ssh \\\n -p "$SSH_PORT" \\\n -o StrictHostKeyChecking=no \\\n -o UserKnownHostsFile=/dev/null \\\n "$SSH_USER@$SSH_VYRIY_HOST" \\\n "$SSH_COMMAND"\n',
|
|
577
16
|
'.husky/commit-msg': '#!/bin/sh\n',
|
|
578
17
|
'.husky/post-checkout': '#!/bin/sh\n\nyarn\n',
|
|
579
18
|
'.husky/post-merge': '#!/bin/sh\n\nyarn\n',
|
|
580
19
|
'.husky/pre-commit': '#!/bin/sh\n\nyarn check\n',
|
|
581
20
|
'.husky/pre-push': '#!/bin/sh\n\nyarn check\n',
|
|
582
|
-
'.
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
export default {
|
|
586
|
-
...config,
|
|
587
|
-
stories: [
|
|
588
|
-
path('**/*.mdx'),
|
|
589
|
-
path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
|
|
590
|
-
],
|
|
591
|
-
};
|
|
592
|
-
`,
|
|
593
|
-
'yarn.lock': '',
|
|
594
|
-
'tsconfig.json': JSON.stringify({
|
|
595
|
-
extends: '@vyriy/typescript-config/index.json',
|
|
596
|
-
include: [
|
|
597
|
-
'.storybook/**/*.ts',
|
|
598
|
-
'.storybook/**/*.tsx',
|
|
599
|
-
'packages/**/*.ts',
|
|
600
|
-
'packages/**/*.tsx',
|
|
601
|
-
'workspaces/**/*.ts',
|
|
602
|
-
'workspaces/**/*.tsx',
|
|
603
|
-
'*.ts',
|
|
604
|
-
],
|
|
605
|
-
}, null, 2) + '\n',
|
|
606
|
-
'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
|
|
21
|
+
'.npmrc': 'engine-strict=true\n',
|
|
22
|
+
'.nvmrc': 'lts/krypton\n',
|
|
607
23
|
'.prettierignore': 'node_modules\ndist\ncoverage\nstorybook-static\nconsumer\n',
|
|
24
|
+
'.storybook/main.ts': "import config from '@vyriy/storybook-config';\nimport { path } from '@vyriy/path';\n\nexport default {\n ...config,\n stories: [\n path('**/*.mdx'),\n path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),\n ],\n};\n",
|
|
25
|
+
'.storybook/preview.tsx': "import '../packages/components/styles.scss';\n\nexport { default } from '@vyriy/storybook-config/preview';\n",
|
|
26
|
+
'.yarnrc.yml': 'nodeLinker: node-modules\n\nnpmMinimalAgeGate: 0\n',
|
|
27
|
+
'README.md': '# MFE\n\nProfile-card microfrontend starter for Vyriy and OpenMFE-oriented development.\n\nThe repository is split into reusable packages and runnable workspaces. Packages own typed component, API, event, query, and environment behavior.\nWorkspaces compose those packages into the local API server and browser custom element build.\n\n## Setup\n\n```bash\nyarn install\n```\n\n## Project Structure\n\n- `packages/api` builds demo HTML, prerendered custom element markup, JSON-LD, and the OpenMFE manifest.\n- `packages/components` provides the React profile-card component set.\n- `packages/env` reads required runtime environment values.\n- `packages/event` dispatches typed profile-card selection and analytics events.\n- `packages/query` parses API query strings into profile-card props.\n- `workspaces/api` serves the demo, prerender, semantic, and manifest endpoints.\n- `workspaces/ui` registers the `vyriy-profile-card` custom element and builds browser assets, including public images.\n\n## Start\n\nStart the API and UI dev server together:\n\n```bash\nyarn start\n```\n\nStart individual workspaces:\n\n```bash\nyarn start:api\nyarn start:ui\n```\n\n## Local URLs\n\nDefault ports and origins are defined in `workspaces/env.sh`:\n\n- API: `http://localhost:3000`\n- UI dev server: `http://localhost:3002`\n\nDefault runtime values:\n\n- `TAG=vyriy-profile-card`\n- `MODE=open`\n\nUseful API URLs:\n\n- Demo HTML: `http://localhost:3000/`\n- Prerendered custom element: `http://localhost:3000/prerender?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3002/avatar.svg`\n- Semantic JSON-LD: `http://localhost:3000/semantic?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3002/avatar.svg`\n- Manifest: `http://localhost:3000/manifest.yml`\n\n`/prerender` and `/semantic` require `name` and accept optional `title`, `description`, `avatarUrl`, and comma-separated `tags`.\n\n## Build\n\n```bash\nyarn build\n```\n\nThe build writes server output to `dist` and browser UI output to `dist/ui`.\n\n## Run Built Dist\n\n```bash\nyarn build\nsh start_dist.sh\n```\n\n`start_dist.sh` runs the generated `dist` output as a production-like local\nserver on `http://localhost:3000`. It expects `dist/index.js` and `dist/ui/*`\nto already exist, so run it after `yarn build`. The default runtime URLs are\nsame-origin: API routes are served from `http://localhost:3000`, and UI assets\nare served from `http://localhost:3000/ui`.\n\n## Validation\n\n```bash\nyarn check\n```\n\nFocused validation commands:\n\n```bash\nyarn lint\nyarn test\nyarn build\n```\n\n## Project Guidance\n\nThese articles describe the development approach behind this preset and provide practical guidance for evolving a project on top of it:\n\n- [Calm Development Environment: Node.js, Corepack, Yarn and Static Preview](https://vyriy.dev/blog/calm-development-setup/) - how to keep the local development environment predictable and easy to reproduce.\n- [Calm App Structure for the Vyriy Ecosystem](https://vyriy.dev/blog/vyriy-calm-app-structure/) - a practical project structure for Vyriy applications: shared configs, small packages, thin workspaces, Storybook docs, tests, and deployable entry points.\n- [One Handler, Many Runtimes](https://vyriy.dev/examples/one-handler-many-runtimes/) - how @vyriy/handler, @vyriy/router, and @vyriy/server compose a calm Lambda-compatible API that can run locally, in Docker, Fargate-style HTTP runtimes, and AWS Lambda.\n- [Calm Component Structure](https://vyriy.dev/blog/calm-component-structure/) - how to organize component code, tests, stories, and public exports.\n- [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/) - how to use Storybook as living project documentation and a component playground.\n',
|
|
28
|
+
'doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"MFE\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
608
29
|
'eslint.config.ts': "export { default } from '@vyriy/eslint-config';\n",
|
|
609
30
|
'jest.config.ts': "export { default } from '@vyriy/jest-config';\n",
|
|
610
|
-
'packages/
|
|
31
|
+
'packages/api/README.md': "# API\n\nServer-side document builders for the profile-card microfrontend.\n\n## Exports\n\n- `demo()` returns a standalone HTML demo document.\n- `prerender(props)` returns SSR custom element markup with declarative shadow DOM.\n- `semantic(props)` returns Schema.org Person JSON-LD.\n- `manifest()` returns the OpenMFE manifest YAML.\n- `Demo`, `Prerender`, `Semantic`, and `Manifest` describe the public builder signatures.\n\n## Props\n\nThe renderers accept the shared profile-card data model from `@p/components`:\n\n- `name` is required.\n- `title`, `description`, `avatarUrl`, and `tags` are optional.\n\n`prerender(props)` serializes those values onto the configured custom element tag and includes the UI stylesheet inside the declarative shadow root.\n\n## Environment\n\nThe builders read required runtime configuration through `@p/env`:\n\n- `TAG` custom element tag name.\n- `MODE` shadow root mode.\n- `API` API origin used in the manifest.\n- `UI` UI asset origin used by demo, prerender output, and manifest assets.\n\n## Example\n\n```ts\nimport { prerender, semantic } from '@p/api';\n\nconst props = {\n name: 'Ada Lovelace',\n title: 'Mathematician',\n tags: ['math', 'computing'],\n};\n\nconst html = prerender(props);\nconst jsonLd = semantic(props);\n```\n",
|
|
32
|
+
'packages/api/demo.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { demo } from './demo.js';\n\ndescribe('demo', () => {\n afterEach(() => {\n delete process.env.MODE;\n delete process.env.TAG;\n delete process.env.UI;\n });\n\n it('builds the profile-card demo document', () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n const document = demo();\n\n expect(document).toContain('<!DOCTYPE html>');\n expect(document).toContain('<vyriy-profile-card');\n expect(document).toContain('name=\"Developer\"');\n expect(document).toContain('rendered');\n expect(document).toContain('http://localhost:3002/avatar.svg');\n expect(document).toContain('http://localhost:3002/index.js');\n expect(document).toContain('vyriy-profile-card.select');\n });\n});\n",
|
|
33
|
+
'packages/api/demo.ts': "import { html } from '@vyriy/html';\n\nimport { getUi } from '@p/env';\n\nimport { prerender } from './prerender.js';\nimport type { Demo } from './types.js';\n\n/** Builds the standalone HTML demo page for the profile-card microfrontend. */\nexport const demo: Demo = () =>\n html({\n htmlAttributes: 'lang=\"en\"',\n title: '<title>Demo</title>',\n meta: '<meta charset=\"utf-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />',\n body: prerender({\n name: 'Developer',\n title: 'Senior IT Professional',\n avatarUrl: `${getUi()}/avatar.svg`,\n }),\n script: [\n `<script defer=\"defer\" src=\"${getUi()}/index.js\"></script>`,\n `<script type=\"module\">\n const card = document.querySelector('vyriy-profile-card');\n card.addEventListener('vyriy-profile-card.select', (event) => {\n console.log('UI demo event:', event.detail);\n });\n </script>`,\n ].join(''),\n });\n",
|
|
34
|
+
'packages/api/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/API\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
35
|
+
'packages/api/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('api public API', () => {\n it('exports API document builders', () => {\n expect(publicApi.demo).toBeDefined();\n expect(publicApi.manifest).toBeDefined();\n expect(publicApi.prerender).toBeDefined();\n expect(publicApi.semantic).toBeDefined();\n });\n});\n",
|
|
36
|
+
'packages/api/index.ts': "export * from './demo.js';\nexport * from './manifest.js';\nexport * from './prerender.js';\nexport * from './semantic.js';\n\nexport type * from './types.js';\n",
|
|
37
|
+
'packages/api/manifest.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { manifest } from './manifest.js';\n\ndescribe('manifest', () => {\n afterEach(() => {\n delete process.env.API;\n delete process.env.UI;\n });\n\n it('builds the OpenMFE manifest YAML', () => {\n process.env.API = 'http://localhost:3000';\n process.env.UI = 'http://localhost:3002';\n\n const document = manifest();\n\n expect(document).toContain(\"version: '1.1'\");\n expect(document).toContain(\"source: 'http://localhost:3002/index.js'\");\n expect(document).toContain(\"prerender: 'http://localhost:3000/prerender'\");\n expect(document).toContain(\"icon: 'http://localhost:3002/icon.svg'\");\n expect(document).toContain(\"name: 'vyriy-profile-card.select'\");\n expect(document).toContain(\"name: 'openmfe.analytics'\");\n });\n});\n",
|
|
38
|
+
'packages/api/manifest.ts': "import { getUi, getApi } from '@p/env';\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from '@p/event';\n\nimport type { Manifest } from './types.js';\n\n/** Builds the OpenMFE manifest YAML for the profile-card microfrontend. */\nexport const manifest: Manifest = () => `version: '1.1'\nname: 'Vyriy Profile Card'\nsource: '${getUi()}/index.js'\ntag: 'vyriy-profile-card'\nurl:\n frontend: '${getUi()}/index.js'\n prerender: '${getApi()}/prerender'\n semantic: '${getApi()}/semantic'\npublisher:\n name: 'Vyriy'\n email: 'vyriy@vyriy.dev'\nicon: '${getUi()}/icon.svg'\ndescription: 'A small OpenMFE-oriented profile card starter for Vyriy CLI.'\ndocumentation: 'https://vyriy.dev/'\nattributes:\n - name: 'name'\n description: 'Profile display name.'\n required: true\n schema:\n type: 'string'\n minLength: 1\n - name: 'role'\n description: 'Short profile role or title.'\n required: false\n schema:\n type: 'string'\n default: 'Developer'\n - name: 'avatar-url'\n description: 'Optional avatar image URL.'\n required: false\n schema:\n type: 'string'\n format: 'uri-reference'\n default: '${getUi()}/avatar.svg'\nevents:\n - name: '${PROFILE_CARD_SELECT_EVENT_NAME}'\n description: 'Emitted when the user selects the profile card.'\n schema:\n type: 'object'\n required:\n - name\n properties:\n name:\n type: 'string'\n description: 'Selected profile display name.'\n role:\n type: 'string'\n description: 'Selected profile role.'\n avatarUrl:\n type:\n - 'string'\n - 'null'\n description: 'Selected profile avatar URL.'\n - name: '${PROFILE_CARD_ANALYTICS_EVENT_NAME}'\n description: 'Standard OpenMFE analytics event emitted for profile card interactions.'\n schema:\n type: 'object'\n required:\n - name\n - origin\n - id\n - variant\n - action\n - category\n - data\n properties:\n name:\n type: 'string'\n description: 'Analytics event name.'\n origin:\n type: 'string'\n description: 'Microfrontend tag name.'\n id:\n type:\n - 'string'\n - 'null'\n description: 'Component instance id or null.'\n variant:\n type:\n - 'string'\n - 'null'\n description: 'Experiment variant or null.'\n action:\n type: 'string'\n description: 'User action.'\n category:\n type:\n - 'string'\n - 'null'\n description: 'Analytics category or null.'\n data:\n type: 'object'\n description: 'Custom analytics payload.'\nfunctions:\n - name: 'refresh'\n description: 'Refreshes the current profile card rendering.'\n async: true\n parameters: []\n return:\n description: 'Refresh result.'\n schema:\n type: 'object'\n properties:\n ok:\n type: 'boolean'\n description: 'Whether refresh completed successfully.'\nsemantic:\n type: 'object'\n required:\n - '@context'\n - '@type'\n - 'name'\n properties:\n '@context':\n type: 'string'\n description: 'JSON-LD context URL.'\n '@type':\n type: 'string'\n description: 'Schema.org entity type.'\n name:\n type: 'string'\n description: 'Profile display name.'\n jobTitle:\n type: 'string'\n description: 'Profile role or title.'\n image:\n type: 'string'\n description: 'Profile avatar URL.'\nscreenshots:\n - url: '${getUi()}/screenshots/default.svg'\n description: 'Default profile card rendering.'\n - url: '${getUi()}/screenshots/compact.svg'\n description: 'Compact profile card rendering.'\nexamples:\n - description: 'Default profile card.'\n attributes:\n name: 'Ada Lovelace'\n role: 'Mathematician'\n avatar-url: '${getUi()}/avatar.svg'\nrepository: 'https://github.com/evheniy/vyriy'`;\n",
|
|
39
|
+
'packages/api/package.json': '{\n "name": "@p/api",\n "type": "module",\n "private": true\n}\n',
|
|
40
|
+
'packages/api/prerender.test.tsx': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { prerender } from './prerender.js';\n\ndescribe('prerender', () => {\n afterEach(() => {\n delete process.env.MODE;\n delete process.env.TAG;\n delete process.env.UI;\n });\n\n it('renders profile card props as custom element attributes', () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n expect(\n prerender({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'A & \"quoted\" <description>',\n name: 'Name',\n tags: ['one', 'two'],\n title: 'Title',\n }),\n ).toContain(\n '<vyriy-profile-card name=\"Name\" title=\"Title\" description=\"A & "quoted" <description>\" avatarUrl=\"https://example.com/avatar.png\" tags=\"["one","two"]\" rendered>',\n );\n expect(\n prerender({\n name: 'Name',\n }),\n ).toContain('<div data-vyriy-root>');\n });\n\n it('removes React generated resource hints from the hydration root', () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n expect(\n prerender({\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Name',\n }),\n ).not.toContain('rel=\"preload\"');\n });\n});\n",
|
|
41
|
+
'packages/api/prerender.tsx': "import { html } from '@vyriy/render';\nimport { encode } from 'html-entities';\n\nimport { ProfileCard } from '@p/components/profile-card';\n\nimport { getTag, getMode, getUi } from '@p/env';\n\nimport type { Prerender } from './types.js';\n\ntype AttributeValue = string | string[] | undefined;\n\nconst escapeAttribute = (value: string): string => {\n return encode(value, { mode: 'specialChars' });\n};\n\nconst getAttributeValue = (value: AttributeValue): string | undefined => {\n if (value === undefined) {\n return undefined;\n }\n\n return Array.isArray(value) ? JSON.stringify(value) : value;\n};\n\nconst getAttribute = (name: string, value: AttributeValue): string => {\n const attributeValue = getAttributeValue(value);\n\n if (attributeValue === undefined) {\n return '';\n }\n\n return ` ${name}=\"${escapeAttribute(attributeValue)}\"`;\n};\n\nconst getProfileCardAttributes = (props: Parameters<Prerender>[0]): string => {\n return [\n getAttribute('name', props.name),\n getAttribute('title', props.title),\n getAttribute('description', props.description),\n getAttribute('avatarUrl', props.avatarUrl),\n getAttribute('tags', props.tags),\n ].join('');\n};\n\nconst removeReactResourceHints = (value: string): string => {\n return value.replaceAll(/<link\\b(?=[^>]*\\brel=\"preload\")[^>]*>/g, '');\n};\n\n/** Renders a profile card custom element with declarative shadow DOM for hydration. */\nexport const prerender: Prerender = (props) => {\n const tag = getTag();\n const mode = getMode();\n const body = removeReactResourceHints(html(<ProfileCard {...props} />));\n\n return [\n `<${tag}${getProfileCardAttributes(props)} rendered>`,\n `<template shadowrootmode=\"${mode}\">`,\n `<link rel=\"stylesheet\" href=\"${getUi()}/main.css\" />`,\n `<div data-vyriy-root>${body}</div>`,\n `</template>`,\n `</${tag}>`,\n ].join('');\n};\n",
|
|
42
|
+
'packages/api/semantic.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { semantic } from './semantic.js';\n\ndescribe('semantic', () => {\n it('serializes profile-card props as Schema.org JSON-LD', () => {\n expect(\n JSON.parse(\n semantic({\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n title: 'Mathematician',\n }),\n ),\n ).toEqual({\n '@context': 'https://schema.org',\n '@type': 'Person',\n image: 'https://example.com/avatar.png',\n jobTitle: 'Mathematician',\n name: 'Ada Lovelace',\n });\n });\n});\n",
|
|
43
|
+
'packages/api/semantic.ts': "import type { Semantic } from './types.js';\n\n/** Serializes profile-card props as Schema.org Person JSON-LD. */\nexport const semantic: Semantic = (params) =>\n JSON.stringify({\n '@context': 'https://schema.org',\n '@type': 'Person',\n name: params.name,\n jobTitle: params.title,\n image: params.avatarUrl,\n });\n",
|
|
44
|
+
'packages/api/types.ts': "import type { ProfileCard } from '@p/components/profile-card/types.js';\n\n/** Builds the standalone HTML demo document. */\nexport type Demo = () => string;\n\n/** Builds server-rendered custom element markup from profile-card props. */\nexport type Prerender = (props: ProfileCard) => string;\n\n/** Builds semantic JSON-LD from profile-card props. */\nexport type Semantic = (props: ProfileCard) => string;\n\n/** Builds the OpenMFE manifest YAML document. */\nexport type Manifest = () => string;\n",
|
|
45
|
+
'packages/components/README.md': '# Components\n\nReusable React primitives for the profile-card microfrontend.\n\n## Exports\n\nThe package exports the public profile-card component set:\n\n- `Avatar`\n- `Badge`\n- `ButtonLink`\n- `Card`\n- `IconLink`\n- `ProfileCard`\n- `ProfileDetails`\n- `ProfileHeader`\n- `ProfileLinks`\n- `ProfileMeta`\n- `ProfileTags`\n\nEach component also exports its public prop and component types from its folder entry point.\n\n## Usage\n\n```tsx\nimport { ProfileCard } from \'@p/components\';\nimport \'@p/components/styles.scss\';\n\nexport const Example = () => (\n <ProfileCard\n avatarUrl="/avatar.svg"\n description="First computer programmer."\n name="Ada Lovelace"\n tags={[\'math\', \'computing\']}\n title="Mathematician"\n />\n);\n```\n\n## Component Docs\n\nEach component has a focused README, Storybook docs, stories, and unit tests in its own folder. Use those folder READMEs for prop-level details and supported visual states.\n',
|
|
46
|
+
'packages/components/avatar/README.md': "# Avatar\n\n`Avatar` renders a profile image or deterministic initials fallback.\n\n## Usage\n\n```tsx\nimport { Avatar } from './avatar.js';\n\nexport const Example = () => <Avatar name=\"Ada Lovelace\" />;\n```\n\n## Props\n\n```ts\nexport type AvatarProps = {\n src?: string;\n alt?: string;\n name?: string;\n size?: 'sm' | 'md' | 'lg';\n} & ComponentProps<'div'>;\n```\n\n## Accessibility\n\nImage avatars receive useful alt text. Initials are decorative and hidden from assistive technology.\n\n## Notes\n\n- SSR/SSG-safe.\n- No browser-only APIs.\n- Shared SCSS styles.\n",
|
|
47
|
+
'packages/components/avatar/avatar.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { Avatar } from './avatar.js';\nimport avatar from '../../../workspaces/ui/public/avatar.svg';\n\nconst meta = {\n title: 'Components/Avatar',\n component: Avatar,\n parameters: { docs: { page: null } },\n args: { name: 'Ada Lovelace', size: 'md' },\n} satisfies Meta<typeof Avatar>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Image: Story = {\n args: {\n src: avatar,\n alt: 'Profile portrait',\n },\n};\n\nexport const Large: Story = { args: { size: 'lg' } };\n",
|
|
611
48
|
'packages/components/avatar/avatar.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { Avatar } from './avatar.js';\n\ndescribe('Avatar', () => {\n it('renders an image when src exists', () => {\n render(<Avatar src=\"/avatar.png\" name=\"Ada Lovelace\" />);\n\n expect(screen.getByRole('img', { name: 'Ada Lovelace' })).toBeDefined();\n });\n\n it('uses a generic image alt when name and alt are not provided', () => {\n render(<Avatar src=\"/avatar.png\" />);\n\n expect(screen.getByRole('img', { name: 'Profile avatar' })).toBeDefined();\n });\n\n it('renders initials fallback without exposing decorative text', () => {\n render(<Avatar name=\"Ada Lovelace\" data-testid=\"avatar-root\" />);\n\n expect(screen.getByText('AL')).toBeDefined();\n expect(screen.getByText('AL').getAttribute('aria-hidden')).toBe('true');\n expect(screen.getByTestId('avatar-root')).toBeDefined();\n });\n\n it('renders a stable fallback when name is not provided', () => {\n render(<Avatar />);\n\n expect(screen.getByText('?')).toBeDefined();\n });\n\n it('renders a stable fallback when name has no initials', () => {\n render(<Avatar name=\" \" />);\n\n expect(screen.getByText('?')).toBeDefined();\n });\n});\n",
|
|
612
49
|
'packages/components/avatar/avatar.tsx': "import { cn } from '@vyriy/cn';\n\nimport type { AvatarType } from './types.js';\n\nconst getInitials = (name?: string) => {\n if (!name) {\n return '?';\n }\n\n const initials = name\n .trim()\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, 2)\n .map((part) => part[0]?.toUpperCase())\n .join('');\n\n return initials || '?';\n};\n\n/** Renders either a profile image or deterministic initials fallback. */\nexport const Avatar: AvatarType = ({ src, alt, name, size = 'md', className, ...props }) => {\n return (\n <div className={cn('avatar', `avatar--${size}`, className)} {...props}>\n {src ? (\n <img className=\"avatar__image\" alt={alt ?? name ?? 'Profile avatar'} src={src} />\n ) : (\n <span className=\"avatar__initials\" aria-hidden=\"true\">\n {getInitials(name)}\n </span>\n )}\n </div>\n );\n};\n",
|
|
613
50
|
'packages/components/avatar/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as AvatarStories from './avatar.stories';\n\n<Meta of={AvatarStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={AvatarStories.Default} />\n<Canvas of={AvatarStories.Image} />\n<Canvas of={AvatarStories.Large} />\n",
|
|
614
51
|
'packages/components/avatar/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('avatar public API', () => {\n it('exports Avatar', () => {\n expect(publicApi.Avatar).toBeDefined();\n });\n});\n",
|
|
615
52
|
'packages/components/avatar/index.ts': "export * from './avatar.js';\nexport type * from './types.js';\n",
|
|
616
|
-
'packages/components/avatar/README.md': "# Avatar\n\n`Avatar` renders a profile image or deterministic initials fallback.\n\n## Usage\n\n```tsx\nimport { Avatar } from './avatar.js';\n\nexport const Example = () => <Avatar name=\"Ada Lovelace\" />;\n```\n\n## Props\n\n```ts\nexport type AvatarProps = {\n src?: string;\n alt?: string;\n name?: string;\n size?: 'sm' | 'md' | 'lg';\n} & ComponentProps<'div'>;\n```\n\n## Accessibility\n\nImage avatars receive useful alt text. Initials are decorative and hidden from assistive technology.\n\n## Notes\n\n- SSR/SSG-safe.\n- No browser-only APIs.\n- Shared SCSS styles.\n",
|
|
617
53
|
'packages/components/avatar/styles.scss': '.avatar {\n display: inline-grid;\n flex: 0 0 auto;\n place-items: center;\n overflow: hidden;\n border: 1px solid var(--profile-card-border-color, #e5e7eb);\n border-radius: 999px;\n background: var(--profile-card-muted-background, #f9fafb);\n color: var(--profile-card-color, #111827);\n font-weight: 700;\n letter-spacing: 0;\n line-height: 1;\n}\n\n.avatar--sm {\n width: 2rem;\n height: 2rem;\n font-size: 0.75rem;\n}\n\n.avatar--md {\n width: 3rem;\n height: 3rem;\n font-size: 1rem;\n}\n\n.avatar--lg {\n width: 4rem;\n height: 4rem;\n font-size: 1.25rem;\n}\n\n.avatar__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n\n.avatar__initials {\n display: inline-block;\n}\n',
|
|
618
54
|
'packages/components/avatar/types.ts': "import type { ComponentProps, FC } from 'react';\n\n/** Props for the Avatar component. */\nexport type AvatarProps = {\n src?: string;\n alt?: string;\n name?: string;\n size?: 'sm' | 'md' | 'lg';\n} & ComponentProps<'div'>;\n\n/** Avatar component type. */\nexport type AvatarType = FC<AvatarProps>;\n",
|
|
55
|
+
'packages/components/badge/README.md': "# Badge\n\n`Badge` displays compact labels for tags, roles, and statuses.\n\n## Usage\n\n```tsx\nimport { Badge } from './badge.js';\n\nexport const Example = () => <Badge tone=\"green\">Available</Badge>;\n```\n\n## Props\n\n```ts\nexport type BadgeProps = {\n children: ReactNode;\n tone?: 'neutral' | 'blue' | 'green' | 'amber' | 'red';\n} & ComponentProps<'span'>;\n```\n\n## Notes\n\n- SSR/SSG-safe.\n- Root element accepts regular `span` props.\n- Shared SCSS styles with tone variants.\n",
|
|
619
56
|
'packages/components/badge/badge.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { Badge } from './badge.js';\n\nconst meta = {\n title: 'Components/Badge',\n component: Badge,\n parameters: { docs: { page: null } },\n args: { children: 'React', tone: 'neutral' },\n} satisfies Meta<typeof Badge>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Blue: Story = { args: { tone: 'blue' } };\n\nexport const Green: Story = { args: { tone: 'green', children: 'Available' } };\n\nexport const Amber: Story = { args: { tone: 'amber', children: 'Maintainer' } };\n\nexport const Red: Story = { args: { tone: 'red', children: 'Busy' } };\n",
|
|
620
57
|
'packages/components/badge/badge.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { Badge } from './badge.js';\n\ndescribe('Badge', () => {\n it('renders label content', () => {\n render(<Badge tone=\"green\">Available</Badge>);\n\n expect(screen.getByText('Available')).toBeDefined();\n });\n\n it('passes span props to the root element', () => {\n render(<Badge data-testid=\"badge-root\">React</Badge>);\n\n expect(screen.getByTestId('badge-root')).toBeDefined();\n });\n});\n",
|
|
621
58
|
'packages/components/badge/badge.tsx': "import { cn } from '@vyriy/cn';\n\nimport type { BadgeType } from './types.js';\n\n/** Renders a compact tone-aware label. */\nexport const Badge: BadgeType = ({ children, tone = 'neutral', className, ...props }) => {\n return (\n <span className={cn('badge', `badge--${tone}`, className)} {...props}>\n {children}\n </span>\n );\n};\n",
|
|
622
59
|
'packages/components/badge/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as BadgeStories from './badge.stories';\n\n<Meta of={BadgeStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={BadgeStories.Default} />\n<Canvas of={BadgeStories.Blue} />\n<Canvas of={BadgeStories.Green} />\n<Canvas of={BadgeStories.Amber} />\n<Canvas of={BadgeStories.Red} />\n",
|
|
623
60
|
'packages/components/badge/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('badge public API', () => {\n it('exports Badge', () => {\n expect(publicApi.Badge).toBeDefined();\n });\n});\n",
|
|
624
61
|
'packages/components/badge/index.ts': "export * from './badge.js';\nexport type * from './types.js';\n",
|
|
625
|
-
'packages/components/badge/README.md': "# Badge\n\n`Badge` displays compact labels for tags, roles, and statuses.\n\n## Usage\n\n```tsx\nimport { Badge } from './badge.js';\n\nexport const Example = () => <Badge tone=\"green\">Available</Badge>;\n```\n\n## Props\n\n```ts\nexport type BadgeProps = {\n children: ReactNode;\n tone?: 'neutral' | 'blue' | 'green' | 'amber' | 'red';\n} & ComponentProps<'span'>;\n```\n\n## Notes\n\n- SSR/SSG-safe.\n- Root element accepts regular `span` props.\n- Shared SCSS styles with tone variants.\n",
|
|
626
62
|
'packages/components/badge/styles.scss': '.badge {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n border: 1px solid transparent;\n border-radius: 999px;\n font-size: 0.75rem;\n font-weight: 650;\n letter-spacing: 0;\n line-height: 1.2;\n padding: 0.25rem 0.55rem;\n white-space: nowrap;\n}\n\n.badge--neutral {\n border-color: var(--profile-card-border-color, #e5e7eb);\n background: var(--profile-card-muted-background, #f9fafb);\n color: var(--profile-card-color, #111827);\n}\n\n.badge--blue {\n border-color: #bfdbfe;\n background: #eff6ff;\n color: #1d4ed8;\n}\n\n.badge--green {\n border-color: #bbf7d0;\n background: #f0fdf4;\n color: #15803d;\n}\n\n.badge--amber {\n border-color: #fde68a;\n background: #fffbeb;\n color: #a16207;\n}\n\n.badge--red {\n border-color: #fecaca;\n background: #fef2f2;\n color: #b91c1c;\n}\n',
|
|
627
63
|
'packages/components/badge/types.ts': "import type { ComponentProps, FC, ReactNode } from 'react';\n\n/** Props for the Badge component. */\nexport type BadgeProps = {\n children: ReactNode;\n tone?: 'neutral' | 'blue' | 'green' | 'amber' | 'red';\n} & ComponentProps<'span'>;\n\n/** Badge component type. */\nexport type BadgeType = FC<BadgeProps>;\n",
|
|
64
|
+
'packages/components/button-link/README.md': "# ButtonLink\n\n`ButtonLink` keeps native anchor semantics while using button-like styling.\n\n## Usage\n\n```tsx\nimport { ButtonLink } from './button-link.js';\n\nexport const Example = () => <ButtonLink href=\"/profile\">Open profile</ButtonLink>;\n```\n\n## Props\n\n```ts\nexport type ButtonLinkProps = {\n href: string;\n children: ReactNode;\n variant?: 'primary' | 'secondary' | 'ghost';\n external?: boolean;\n} & ComponentProps<'a'>;\n```\n\n## Accessibility\n\nThe component renders a native `<a>`. External links receive `target=\"_blank\"` and `rel=\"noreferrer\"`.\n\n## Notes\n\n- SSR/SSG-safe.\n- Visible focus style.\n- Shared SCSS styles.\n",
|
|
628
65
|
'packages/components/button-link/button-link.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { ButtonLink } from './button-link.js';\n\nconst meta = {\n title: 'Components/ButtonLink',\n component: ButtonLink,\n parameters: { docs: { page: null } },\n args: { href: '#', children: 'Open profile', variant: 'primary' },\n} satisfies Meta<typeof ButtonLink>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Secondary: Story = { args: { variant: 'secondary' } };\n\nexport const Ghost: Story = { args: { variant: 'ghost' } };\n",
|
|
629
66
|
'packages/components/button-link/button-link.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { ButtonLink } from './button-link.js';\n\ndescribe('ButtonLink', () => {\n it('renders a native link', () => {\n render(<ButtonLink href=\"/profile\">Open profile</ButtonLink>);\n\n expect(screen.getByRole('link', { name: 'Open profile' }).getAttribute('href')).toBe('/profile');\n });\n\n it('adds external link attributes', () => {\n render(\n <ButtonLink external href=\"https://example.com\">\n Website\n </ButtonLink>,\n );\n\n const link = screen.getByRole('link', { name: 'Website' });\n\n expect(link.getAttribute('target')).toBe('_blank');\n expect(link.getAttribute('rel')).toBe('noreferrer');\n });\n});\n",
|
|
630
67
|
'packages/components/button-link/button-link.tsx': "import { cn } from '@vyriy/cn';\n\nimport type { ButtonLinkType } from './types.js';\n\n/** Renders an anchor styled as a button. */\nexport const ButtonLink: ButtonLinkType = ({\n href,\n children,\n variant = 'primary',\n external = false,\n className,\n ...props\n}) => {\n return (\n <a\n className={cn('button-link', `button-link--${variant}`, className)}\n href={href}\n target={external ? '_blank' : props.target}\n rel={external ? 'noreferrer' : props.rel}\n {...props}\n >\n {children}\n </a>\n );\n};\n",
|
|
631
68
|
'packages/components/button-link/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as ButtonLinkStories from './button-link.stories';\n\n<Meta of={ButtonLinkStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={ButtonLinkStories.Default} />\n<Canvas of={ButtonLinkStories.Secondary} />\n<Canvas of={ButtonLinkStories.Ghost} />\n",
|
|
632
69
|
'packages/components/button-link/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('button-link public API', () => {\n it('exports ButtonLink', () => {\n expect(publicApi.ButtonLink).toBeDefined();\n });\n});\n",
|
|
633
70
|
'packages/components/button-link/index.ts': "export * from './button-link.js';\nexport type * from './types.js';\n",
|
|
634
|
-
'packages/components/button-link/README.md': "# ButtonLink\n\n`ButtonLink` keeps native anchor semantics while using button-like styling.\n\n## Usage\n\n```tsx\nimport { ButtonLink } from './button-link.js';\n\nexport const Example = () => <ButtonLink href=\"/profile\">Open profile</ButtonLink>;\n```\n\n## Props\n\n```ts\nexport type ButtonLinkProps = {\n href: string;\n children: ReactNode;\n variant?: 'primary' | 'secondary' | 'ghost';\n external?: boolean;\n} & ComponentProps<'a'>;\n```\n\n## Accessibility\n\nThe component renders a native `<a>`. External links receive `target=\"_blank\"` and `rel=\"noreferrer\"`.\n\n## Notes\n\n- SSR/SSG-safe.\n- Visible focus style.\n- Shared SCSS styles.\n",
|
|
635
71
|
'packages/components/button-link/styles.scss': '.button-link {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-height: 2.25rem;\n border: 1px solid transparent;\n border-radius: 0.6rem;\n font-size: 0.875rem;\n font-weight: 650;\n letter-spacing: 0;\n line-height: 1.2;\n padding: 0.55rem 0.85rem;\n text-decoration: none;\n transition:\n background-color 140ms ease,\n border-color 140ms ease,\n color 140ms ease;\n}\n\n.button-link:focus-visible {\n outline: none;\n box-shadow: var(--profile-card-focus-ring, 0 0 0 3px rgb(59 130 246 / 30%));\n}\n\n.button-link--primary {\n background: var(--profile-card-color, #111827);\n color: var(--profile-card-background, #ffffff);\n}\n\n.button-link--primary:hover {\n background: #374151;\n}\n\n.button-link--secondary {\n border-color: var(--profile-card-border-color, #e5e7eb);\n background: var(--profile-card-background, #ffffff);\n color: var(--profile-card-color, #111827);\n}\n\n.button-link--secondary:hover {\n background: var(--profile-card-muted-background, #f9fafb);\n}\n\n.button-link--ghost {\n background: transparent;\n color: var(--profile-card-color, #111827);\n}\n\n.button-link--ghost:hover {\n background: var(--profile-card-muted-background, #f9fafb);\n}\n',
|
|
636
72
|
'packages/components/button-link/types.ts': "import type { ComponentProps, FC, ReactNode } from 'react';\n\n/** Props for the ButtonLink component. */\nexport type ButtonLinkProps = {\n href: string;\n children: ReactNode;\n variant?: 'primary' | 'secondary' | 'ghost';\n external?: boolean;\n} & ComponentProps<'a'>;\n\n/** ButtonLink component type. */\nexport type ButtonLinkType = FC<ButtonLinkProps>;\n",
|
|
73
|
+
'packages/components/card/README.md': "# Card\n\n`Card` is a small layout primitive for profile-card UI surfaces.\n\n## Usage\n\n```tsx\nimport { Card } from './card.js';\n\nexport const Example = () => (\n <Card title=\"Profile\" subtitle=\"Calm architecture\">\n Content\n </Card>\n);\n```\n\n## Props\n\n```ts\nexport type CardProps = {\n title?: ReactNode;\n subtitle?: ReactNode;\n children?: ReactNode;\n variant?: 'default' | 'muted' | 'highlighted';\n} & ComponentProps<'div'>;\n```\n\n## Notes\n\n- SSR/SSG-safe.\n- Root element accepts regular `div` props.\n- Styles are local to the component.\n",
|
|
637
74
|
'packages/components/card/card.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { Card } from './card.js';\n\nconst meta = {\n title: 'Components/Card',\n component: Card,\n parameters: { docs: { page: null } },\n args: {\n title: 'Profile',\n subtitle: 'Calm reusable UI primitive',\n children: 'Card content',\n },\n} satisfies Meta<typeof Card>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Muted: Story = { args: { variant: 'muted' } };\n\nexport const Highlighted: Story = { args: { variant: 'highlighted' } };\n",
|
|
638
75
|
'packages/components/card/card.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { Card } from './card.js';\n\ndescribe('Card', () => {\n it('renders title, subtitle, and children', () => {\n render(\n <Card title=\"Profile\" subtitle=\"Frontend engineer\">\n <span>Content</span>\n </Card>,\n );\n\n expect(screen.getByRole('heading', { name: 'Profile' })).toBeDefined();\n expect(screen.getByText('Frontend engineer')).toBeDefined();\n expect(screen.getByText('Content')).toBeDefined();\n });\n\n it('passes div props to the root element', () => {\n render(<Card title=\"Profile\" data-testid=\"card-root\" />);\n\n expect(screen.getByTestId('card-root')).toBeDefined();\n });\n});\n",
|
|
639
76
|
'packages/components/card/card.tsx': 'import { cn } from \'@vyriy/cn\';\n\nimport type { CardType } from \'./types.js\';\n\n/** Renders a small content surface with optional heading text. */\nexport const Card: CardType = ({ title, subtitle, children, variant = \'default\', className, ...props }) => {\n return (\n <div className={cn(\'card\', `card--${variant}`, className)} {...props}>\n {(title || subtitle) && (\n <header className="card__header">\n {title && <h2 className="card__title">{title}</h2>}\n {subtitle && <p className="card__subtitle">{subtitle}</p>}\n </header>\n )}\n\n {children && <div className="card__body">{children}</div>}\n </div>\n );\n};\n',
|
|
640
77
|
'packages/components/card/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as CardStories from './card.stories';\n\n<Meta of={CardStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={CardStories.Default} />\n<Canvas of={CardStories.Muted} />\n<Canvas of={CardStories.Highlighted} />\n",
|
|
641
78
|
'packages/components/card/index.test.ts': "import { describe, it, expect } from '@jest/globals';\nimport * as publicApi from './index.js';\n\ndescribe('card public API', () => {\n it('exports Card', () => {\n expect(publicApi.Card).toBeDefined();\n });\n});\n",
|
|
642
79
|
'packages/components/card/index.ts': "export * from './card.js';\nexport type * from './types.js';\n",
|
|
643
|
-
'packages/components/card/README.md': "# Card\n\n`Card` is a small layout primitive for profile-card UI surfaces.\n\n## Usage\n\n```tsx\nimport { Card } from './card.js';\n\nexport const Example = () => (\n <Card title=\"Profile\" subtitle=\"Calm architecture\">\n Content\n </Card>\n);\n```\n\n## Props\n\n```ts\nexport type CardProps = {\n title?: ReactNode;\n subtitle?: ReactNode;\n children?: ReactNode;\n variant?: 'default' | 'muted' | 'highlighted';\n} & ComponentProps<'div'>;\n```\n\n## Notes\n\n- SSR/SSG-safe.\n- Root element accepts regular `div` props.\n- Styles are local to the component.\n",
|
|
644
80
|
'packages/components/card/styles.scss': '.card {\n border: 1px solid var(--profile-card-border-color, #e5e7eb);\n border-radius: var(--profile-card-radius, 1rem);\n background: var(--profile-card-background, #ffffff);\n box-shadow: var(--profile-card-shadow, 0 10px 30px rgb(15 23 42 / 8%));\n color: var(--profile-card-color, #111827);\n padding: var(--profile-card-space, 1rem);\n}\n\n.card--default {\n background: var(--profile-card-background, #ffffff);\n}\n\n.card--muted {\n background: var(--profile-card-muted-background, #f9fafb);\n}\n\n.card--highlighted {\n border-color: var(--profile-card-highlight-border-color, #93c5fd);\n background: var(--profile-card-highlight-background, #eff6ff);\n}\n\n.card__header {\n display: grid;\n gap: 0.25rem;\n margin-block-end: 0.75rem;\n}\n\n.card__title {\n margin: 0;\n font-size: 1rem;\n font-weight: 650;\n letter-spacing: 0;\n line-height: 1.3;\n}\n\n.card__subtitle {\n margin: 0;\n color: var(--profile-card-muted-color, #6b7280);\n font-size: 0.875rem;\n line-height: 1.4;\n}\n\n.card__body {\n display: grid;\n gap: 0.75rem;\n}\n',
|
|
645
81
|
'packages/components/card/types.ts': "import type { ComponentProps, FC, ReactNode } from 'react';\n\n/** Props for the Card component. */\nexport type CardProps = {\n title?: ReactNode;\n subtitle?: ReactNode;\n children?: ReactNode;\n variant?: 'default' | 'muted' | 'highlighted';\n} & ComponentProps<'div'>;\n\n/** Card component type. */\nexport type CardType = FC<CardProps>;\n",
|
|
646
82
|
'packages/components/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Components\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
83
|
+
'packages/components/icon-link/README.md': '# IconLink\n\n`IconLink` renders a compact profile link with optional decorative icon content.\n\n## Usage\n\n```tsx\nimport { IconLink } from \'./icon-link.js\';\n\nexport const Example = () => <IconLink href="/github" label="GitHub" />;\n```\n\n## Props\n\n```ts\nexport type IconLinkProps = {\n href: string;\n label: string;\n icon?: ReactNode;\n external?: boolean;\n} & ComponentProps<\'a\'>;\n```\n\n## Accessibility\n\nThe label remains readable link text. Optional icon content is decorative.\n\n## Notes\n\n- SSR/SSG-safe.\n- External links receive safe target and rel attributes.\n- Shared SCSS styles.\n',
|
|
647
84
|
'packages/components/icon-link/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as IconLinkStories from './icon-link.stories';\n\n<Meta of={IconLinkStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={IconLinkStories.Default} />\n<Canvas of={IconLinkStories.External} />\n",
|
|
648
85
|
'packages/components/icon-link/icon-link.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { IconLink } from './icon-link.js';\n\nconst meta = {\n title: 'Components/IconLink',\n component: IconLink,\n parameters: { docs: { page: null } },\n args: { href: '#', label: 'GitHub', icon: 'GH' },\n} satisfies Meta<typeof IconLink>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const External: Story = {\n args: { href: 'https://example.com', label: 'Website', external: true },\n};\n",
|
|
649
86
|
'packages/components/icon-link/icon-link.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { IconLink } from './icon-link.js';\n\ndescribe('IconLink', () => {\n it('renders readable link label', () => {\n render(<IconLink href=\"/github\" label=\"GitHub\" icon={<span>G</span>} />);\n\n expect(screen.getByRole('link', { name: 'GitHub' })).toBeDefined();\n });\n\n it('adds external link attributes', () => {\n render(<IconLink external href=\"https://example.com\" label=\"Website\" />);\n\n const link = screen.getByRole('link', { name: 'Website' });\n\n expect(link.getAttribute('target')).toBe('_blank');\n expect(link.getAttribute('rel')).toBe('noreferrer');\n });\n});\n",
|
|
650
87
|
'packages/components/icon-link/icon-link.tsx': "import { cn } from '@vyriy/cn';\n\nimport type { IconLinkType } from './types.js';\n\n/** Renders a compact accessible link with an optional decorative icon. */\nexport const IconLink: IconLinkType = ({ href, label, icon, external = false, className, ...props }) => {\n return (\n <a\n className={cn('icon-link', className)}\n href={href}\n target={external ? '_blank' : props.target}\n rel={external ? 'noreferrer' : props.rel}\n {...props}\n >\n {icon && (\n <span className=\"icon-link__icon\" aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <span className=\"icon-link__label\">{label}</span>\n </a>\n );\n};\n",
|
|
651
88
|
'packages/components/icon-link/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('icon-link public API', () => {\n it('exports IconLink', () => {\n expect(publicApi.IconLink).toBeDefined();\n });\n});\n",
|
|
652
89
|
'packages/components/icon-link/index.ts': "export * from './icon-link.js';\nexport type * from './types.js';\n",
|
|
653
|
-
'packages/components/icon-link/README.md': '# IconLink\n\n`IconLink` renders a compact profile link with optional decorative icon content.\n\n## Usage\n\n```tsx\nimport { IconLink } from \'./icon-link.js\';\n\nexport const Example = () => <IconLink href="/github" label="GitHub" />;\n```\n\n## Props\n\n```ts\nexport type IconLinkProps = {\n href: string;\n label: string;\n icon?: ReactNode;\n external?: boolean;\n} & ComponentProps<\'a\'>;\n```\n\n## Accessibility\n\nThe label remains readable link text. Optional icon content is decorative.\n\n## Notes\n\n- SSR/SSG-safe.\n- External links receive safe target and rel attributes.\n- Shared SCSS styles.\n',
|
|
654
90
|
'packages/components/icon-link/styles.scss': '.icon-link {\n display: inline-flex;\n align-items: center;\n gap: 0.4rem;\n min-height: 2rem;\n border-radius: 0.5rem;\n color: var(--profile-card-color, #111827);\n font-size: 0.875rem;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.2;\n text-decoration: none;\n}\n\n.icon-link:hover {\n color: #1d4ed8;\n}\n\n.icon-link:focus-visible {\n outline: none;\n box-shadow: var(--profile-card-focus-ring, 0 0 0 3px rgb(59 130 246 / 30%));\n}\n\n.icon-link__icon {\n display: inline-grid;\n width: 1rem;\n height: 1rem;\n place-items: center;\n}\n\n.icon-link__label {\n overflow-wrap: anywhere;\n}\n',
|
|
655
91
|
'packages/components/icon-link/types.ts': "import type { ComponentProps, FC, ReactNode } from 'react';\n\n/** Props for the IconLink component. */\nexport type IconLinkProps = {\n href: string;\n label: string;\n icon?: ReactNode;\n external?: boolean;\n} & ComponentProps<'a'>;\n\n/** IconLink component type. */\nexport type IconLinkType = FC<IconLinkProps>;\n",
|
|
656
92
|
'packages/components/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('public API', () => {\n it('exports public components', () => {\n expect(publicApi.Avatar).toBeDefined();\n expect(publicApi.Badge).toBeDefined();\n expect(publicApi.ButtonLink).toBeDefined();\n expect(publicApi.Card).toBeDefined();\n expect(publicApi.IconLink).toBeDefined();\n expect(publicApi.ProfileCard).toBeDefined();\n expect(publicApi.ProfileDetails).toBeDefined();\n expect(publicApi.ProfileHeader).toBeDefined();\n expect(publicApi.ProfileLinks).toBeDefined();\n expect(publicApi.ProfileMeta).toBeDefined();\n expect(publicApi.ProfileTags).toBeDefined();\n });\n});\n",
|
|
657
93
|
'packages/components/index.ts': "export * from './avatar/index.js';\nexport * from './badge/index.js';\nexport * from './button-link/index.js';\nexport * from './card/index.js';\nexport * from './icon-link/index.js';\nexport * from './profile-card/index.js';\nexport * from './profile-details/index.js';\nexport * from './profile-header/index.js';\nexport * from './profile-links/index.js';\nexport * from './profile-meta/index.js';\nexport * from './profile-tags/index.js';\n",
|
|
94
|
+
'packages/components/package.json': '{\n "name": "@p/components",\n "type": "module",\n "private": true\n}\n',
|
|
95
|
+
'packages/components/profile-card/README.md': "# ProfileCard\n\n`ProfileCard` composes the profile-card primitives into one semantic article.\n\n## Usage\n\n```tsx\nimport { ProfileCard } from './profile-card.js';\n\nexport const Example = () => (\n <ProfileCard\n name=\"Developer\"\n title=\"Senior IT Professional\"\n description=\"Building calm architecture for cloud-ready applications.\"\n tags={['React', 'TypeScript', 'Vyriy']}\n meta={[{ label: 'Project', value: 'Vyriy' }]}\n links={[{ href: 'https://vyriy.dev', label: 'Website', external: true }]}\n />\n);\n```\n\n## Props\n\n```ts\nexport type ProfileCardProps = {\n name: string;\n title?: string;\n description?: string;\n avatarUrl?: string;\n tags?: string[];\n meta?: ProfileCardMetaItem[];\n links?: ProfileCardLink[];\n children?: ReactNode;\n} & ComponentProps<'article'>;\n```\n\n## Accessibility\n\nThe root element is an `<article>`. Nested metadata, tag, and link sections use semantic markup.\n\n## Notes\n\n- SSR/SSG-safe.\n- Deterministic output.\n- Shared SCSS styles.\n",
|
|
658
96
|
'packages/components/profile-card/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as ProfileCardStories from './profile-card.stories';\n\n<Meta of={ProfileCardStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={ProfileCardStories.Default} />\n<Canvas of={ProfileCardStories.Minimal} />\n",
|
|
659
97
|
'packages/components/profile-card/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('profile-card public API', () => {\n it('exports ProfileCard', () => {\n expect(publicApi.ProfileCard).toBeDefined();\n });\n});\n",
|
|
660
98
|
'packages/components/profile-card/index.ts': "export { ProfileCard } from './profile-card.js';\nexport type {\n ProfileCard as ProfileCardData,\n ProfileCardLink,\n ProfileCardMetaItem,\n ProfileCardProps,\n ProfileCardType,\n} from './types.js';\n",
|
|
661
99
|
'packages/components/profile-card/profile-card.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { ProfileCard } from './profile-card.js';\n\nconst meta = {\n title: 'Components/ProfileCard',\n component: ProfileCard,\n parameters: { docs: { page: null } },\n args: {\n name: 'Developer',\n title: 'Senior IT Professional',\n description: 'Building calm architecture for cloud-ready applications.',\n tags: [\n 'React',\n 'TypeScript',\n 'AWS',\n 'Serverless',\n 'Vyriy',\n ],\n meta: [\n { label: 'Project', value: 'Vyriy' },\n { label: 'Focus', value: 'Calm architecture' },\n ],\n links: [\n { label: 'GitHub', href: 'https://github.com', external: true },\n { label: 'Website', href: 'https://vyriy.dev', external: true },\n ],\n children: <p>Reusable profile UI for MFE preset examples.</p>,\n },\n} satisfies Meta<typeof ProfileCard>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Minimal: Story = {\n args: {\n title: undefined,\n description: undefined,\n tags: [],\n meta: [],\n links: [],\n children: undefined,\n },\n};\n",
|
|
662
100
|
'packages/components/profile-card/profile-card.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { ProfileCard } from './profile-card.js';\n\ndescribe('ProfileCard', () => {\n it('renders composed profile content', () => {\n render(\n <ProfileCard\n name=\"Developer\"\n title=\"Senior IT Professional\"\n description=\"Building calm architecture.\"\n tags={['React', 'TypeScript']}\n meta={[{ label: 'Project', value: 'Vyriy' }]}\n links={[{ href: 'https://vyriy.dev', label: 'Website', external: true }]}\n >\n Custom summary\n </ProfileCard>,\n );\n\n expect(screen.getByRole('article')).toBeDefined();\n expect(screen.getByRole('heading', { name: 'Developer' })).toBeDefined();\n expect(screen.getByText('Senior IT Professional')).toBeDefined();\n expect(screen.getByText('React')).toBeDefined();\n expect(screen.getByText('Vyriy')).toBeDefined();\n expect(screen.getByText('Custom summary')).toBeDefined();\n expect(screen.getByRole('link', { name: 'Website' })).toBeDefined();\n });\n\n it('passes article props to the root element', () => {\n render(<ProfileCard name=\"Developer\" data-testid=\"profile-card\" />);\n\n expect(screen.getByTestId('profile-card')).toBeDefined();\n });\n});\n",
|
|
663
101
|
'packages/components/profile-card/profile-card.tsx': "import { cn } from '@vyriy/cn';\n\nimport { Card } from '../card/index.js';\nimport { ProfileDetails } from '../profile-details/index.js';\nimport { ProfileHeader } from '../profile-header/index.js';\nimport { ProfileLinks } from '../profile-links/index.js';\nimport { ProfileMeta } from '../profile-meta/index.js';\nimport { ProfileTags } from '../profile-tags/index.js';\nimport type { ProfileCardType } from './types.js';\n\n/** Composes the profile-card primitives into one semantic article. */\nexport const ProfileCard: ProfileCardType = ({\n name,\n title,\n description,\n avatarUrl,\n tags = [],\n meta = [],\n links = [],\n children,\n className,\n ...props\n}) => {\n return (\n <article className={cn('profile-card', className)} {...props}>\n <Card>\n <div className=\"profile-card__content\">\n <ProfileHeader avatarUrl={avatarUrl} description={description} name={name} title={title} />\n <ProfileMeta items={meta} />\n <ProfileTags tags={tags} tone=\"blue\" />\n <ProfileDetails>{children}</ProfileDetails>\n <ProfileLinks links={links} />\n </div>\n </Card>\n </article>\n );\n};\n",
|
|
664
|
-
'packages/components/profile-card/README.md': "# ProfileCard\n\n`ProfileCard` composes the profile-card primitives into one semantic article.\n\n## Usage\n\n```tsx\nimport { ProfileCard } from './profile-card.js';\n\nexport const Example = () => (\n <ProfileCard\n name=\"Developer\"\n title=\"Senior IT Professional\"\n description=\"Building calm architecture for cloud-ready applications.\"\n tags={['React', 'TypeScript', 'Vyriy']}\n meta={[{ label: 'Project', value: 'Vyriy' }]}\n links={[{ href: 'https://vyriy.dev', label: 'Website', external: true }]}\n />\n);\n```\n\n## Props\n\n```ts\nexport type ProfileCardProps = {\n name: string;\n title?: string;\n description?: string;\n avatarUrl?: string;\n tags?: string[];\n meta?: ProfileCardMetaItem[];\n links?: ProfileCardLink[];\n children?: ReactNode;\n} & ComponentProps<'article'>;\n```\n\n## Accessibility\n\nThe root element is an `<article>`. Nested metadata, tag, and link sections use semantic markup.\n\n## Notes\n\n- SSR/SSG-safe.\n- Deterministic output.\n- Shared SCSS styles.\n",
|
|
665
102
|
'packages/components/profile-card/styles.scss': '.profile-card {\n max-width: 28rem;\n color: var(--profile-card-color, #111827);\n}\n\n.profile-card__content {\n display: grid;\n gap: 1rem;\n}\n',
|
|
666
103
|
'packages/components/profile-card/types.ts': "import type { ComponentProps, FC, ReactNode } from 'react';\n\n/** Link item rendered in a profile card. */\nexport type ProfileCardLink = {\n href: string;\n label: string;\n external?: boolean;\n};\n\n/** Metadata item rendered in a profile card. */\nexport type ProfileCardMetaItem = {\n label: string;\n value: ReactNode;\n};\n\n/** Data model accepted by the ProfileCard component and API renderers. */\nexport type ProfileCard = {\n name: string;\n title?: string;\n description?: string;\n avatarUrl?: string;\n tags?: string[];\n meta?: ProfileCardMetaItem[];\n links?: ProfileCardLink[];\n children?: ReactNode;\n};\n\n/** Props for the ProfileCard component. */\nexport type ProfileCardProps = ProfileCard & ComponentProps<'article'>;\n\n/** ProfileCard component type. */\nexport type ProfileCardType = FC<ProfileCardProps>;\n",
|
|
104
|
+
'packages/components/profile-details/README.md': "# ProfileDetails\n\n`ProfileDetails` renders optional profile summary, skills, or custom body content.\n\n## Usage\n\n```tsx\nimport { ProfileDetails } from './profile-details.js';\n\nexport const Example = () => <ProfileDetails>Profile summary</ProfileDetails>;\n```\n\n## Props\n\n```ts\nexport type ProfileDetailsProps = {\n children?: ReactNode;\n} & ComponentProps<'section'>;\n```\n\n## Accessibility\n\nThe component renders a semantic `<section>` when content exists.\n\n## Notes\n\n- Empty content renders `null`.\n- SSR/SSG-safe.\n- Shared SCSS styles.\n",
|
|
667
105
|
'packages/components/profile-details/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as ProfileDetailsStories from './profile-details.stories';\n\n<Meta of={ProfileDetailsStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={ProfileDetailsStories.Default} />\n",
|
|
668
106
|
'packages/components/profile-details/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('profile-details public API', () => {\n it('exports ProfileDetails', () => {\n expect(publicApi.ProfileDetails).toBeDefined();\n });\n});\n",
|
|
669
107
|
'packages/components/profile-details/index.ts': "export * from './profile-details.js';\nexport type * from './types.js';\n",
|
|
670
108
|
'packages/components/profile-details/profile-details.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { ProfileDetails } from './profile-details.js';\n\nconst meta = {\n title: 'Components/ProfileDetails',\n component: ProfileDetails,\n parameters: { docs: { page: null } },\n args: { children: <p>Builds typed, deployable systems with calm boundaries.</p> },\n} satisfies Meta<typeof ProfileDetails>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n",
|
|
671
109
|
'packages/components/profile-details/profile-details.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { ProfileDetails } from './profile-details.js';\n\ndescribe('ProfileDetails', () => {\n it('renders body content', () => {\n render(\n <ProfileDetails>\n <p>Profile summary</p>\n </ProfileDetails>,\n );\n\n expect(screen.getByText('Profile summary')).toBeDefined();\n });\n\n it('does not render an empty wrapper', () => {\n const { container } = render(<ProfileDetails />);\n\n expect(container.firstChild).toBeNull();\n });\n});\n",
|
|
672
110
|
'packages/components/profile-details/profile-details.tsx': "import { cn } from '@vyriy/cn';\n\nimport type { ProfileDetailsType } from './types.js';\n\n/** Renders optional long-form profile details. */\nexport const ProfileDetails: ProfileDetailsType = ({ children, className, ...props }) => {\n if (!children) {\n return null;\n }\n\n return (\n <section className={cn('profile-details', className)} {...props}>\n {children}\n </section>\n );\n};\n",
|
|
673
|
-
'packages/components/profile-details/README.md': "# ProfileDetails\n\n`ProfileDetails` renders optional profile summary, skills, or custom body content.\n\n## Usage\n\n```tsx\nimport { ProfileDetails } from './profile-details.js';\n\nexport const Example = () => <ProfileDetails>Profile summary</ProfileDetails>;\n```\n\n## Props\n\n```ts\nexport type ProfileDetailsProps = {\n children?: ReactNode;\n} & ComponentProps<'section'>;\n```\n\n## Accessibility\n\nThe component renders a semantic `<section>` when content exists.\n\n## Notes\n\n- Empty content renders `null`.\n- SSR/SSG-safe.\n- Shared SCSS styles.\n",
|
|
674
111
|
'packages/components/profile-details/styles.scss': '.profile-details {\n color: var(--profile-card-muted-color, #6b7280);\n font-size: 0.9rem;\n line-height: 1.55;\n}\n\n.profile-details > :first-child {\n margin-block-start: 0;\n}\n\n.profile-details > :last-child {\n margin-block-end: 0;\n}\n',
|
|
675
112
|
'packages/components/profile-details/types.ts': "import type { ComponentProps, FC, ReactNode } from 'react';\n\n/** Props for the ProfileDetails component. */\nexport type ProfileDetailsProps = {\n children?: ReactNode;\n} & ComponentProps<'section'>;\n\n/** ProfileDetails component type. */\nexport type ProfileDetailsType = FC<ProfileDetailsProps>;\n",
|
|
113
|
+
'packages/components/profile-header/README.md': '# ProfileHeader\n\n`ProfileHeader` composes an avatar, name, title, and short description.\n\n## Usage\n\n```tsx\nimport { ProfileHeader } from \'./profile-header.js\';\n\nexport const Example = () => <ProfileHeader name="Developer" title="Senior IT Professional" />;\n```\n\n## Props\n\n```ts\nexport type ProfileHeaderProps = {\n name: string;\n title?: string;\n description?: string;\n avatarUrl?: string;\n} & ComponentProps<\'header\'>;\n```\n\n## Accessibility\n\nThe root element is a semantic `<header>`, and avatar alt text is derived from the profile name.\n\n## Notes\n\n- SSR/SSG-safe.\n- Deterministic rendering.\n- Shared SCSS styles.\n',
|
|
676
114
|
'packages/components/profile-header/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as ProfileHeaderStories from './profile-header.stories';\n\n<Meta of={ProfileHeaderStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={ProfileHeaderStories.Default} />\n<Canvas of={ProfileHeaderStories.WithAvatar} />\n",
|
|
677
115
|
'packages/components/profile-header/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('profile-header public API', () => {\n it('exports ProfileHeader', () => {\n expect(publicApi.ProfileHeader).toBeDefined();\n });\n});\n",
|
|
678
116
|
'packages/components/profile-header/index.ts': "export * from './profile-header.js';\nexport type * from './types.js';\n",
|
|
679
117
|
'packages/components/profile-header/profile-header.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { ProfileHeader } from './profile-header.js';\n\nconst meta = {\n title: 'Components/ProfileHeader',\n component: ProfileHeader,\n parameters: { docs: { page: null } },\n args: {\n name: 'Developer',\n title: 'Senior IT Professional',\n description: 'Building calm architecture for cloud-ready applications.',\n },\n} satisfies Meta<typeof ProfileHeader>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const WithAvatar: Story = {\n args: {\n avatarUrl: 'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?auto=format&fit=crop&w=128&q=80',\n },\n};\n",
|
|
680
118
|
'packages/components/profile-header/profile-header.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { ProfileHeader } from './profile-header.js';\n\ndescribe('ProfileHeader', () => {\n it('renders name, title, and description', () => {\n render(\n <ProfileHeader\n name=\"Ada Lovelace\"\n title=\"Computing pioneer\"\n description=\"Wrote early notes about general computation.\"\n />,\n );\n\n expect(screen.getByRole('heading', { name: 'Ada Lovelace' })).toBeDefined();\n expect(screen.getByText('Computing pioneer')).toBeDefined();\n expect(screen.getByText('Wrote early notes about general computation.')).toBeDefined();\n });\n\n it('passes header props to the root element', () => {\n render(<ProfileHeader name=\"Ada Lovelace\" data-testid=\"profile-header\" />);\n\n expect(screen.getByTestId('profile-header')).toBeDefined();\n });\n});\n",
|
|
681
119
|
'packages/components/profile-header/profile-header.tsx': 'import { cn } from \'@vyriy/cn\';\n\nimport { Avatar } from \'../avatar/index.js\';\nimport type { ProfileHeaderType } from \'./types.js\';\n\n/** Renders profile identity, title, description, and avatar. */\nexport const ProfileHeader: ProfileHeaderType = ({ name, title, description, avatarUrl, className, ...props }) => {\n return (\n <header className={cn(\'profile-header\', className)} {...props}>\n <Avatar src={avatarUrl} name={name} alt={`${name} avatar`} size="lg" />\n <div className="profile-header__content">\n <h2 className="profile-header__name">{name}</h2>\n {title && <p className="profile-header__title">{title}</p>}\n {description && <p className="profile-header__description">{description}</p>}\n </div>\n </header>\n );\n};\n',
|
|
682
|
-
'packages/components/profile-header/README.md': '# ProfileHeader\n\n`ProfileHeader` composes an avatar, name, title, and short description.\n\n## Usage\n\n```tsx\nimport { ProfileHeader } from \'./profile-header.js\';\n\nexport const Example = () => <ProfileHeader name="Developer" title="Senior IT Professional" />;\n```\n\n## Props\n\n```ts\nexport type ProfileHeaderProps = {\n name: string;\n title?: string;\n description?: string;\n avatarUrl?: string;\n} & ComponentProps<\'header\'>;\n```\n\n## Accessibility\n\nThe root element is a semantic `<header>`, and avatar alt text is derived from the profile name.\n\n## Notes\n\n- SSR/SSG-safe.\n- Deterministic rendering.\n- Shared SCSS styles.\n',
|
|
683
120
|
'packages/components/profile-header/styles.scss': '.profile-header {\n display: flex;\n align-items: flex-start;\n gap: 0.9rem;\n min-width: 0;\n}\n\n.profile-header__content {\n display: grid;\n min-width: 0;\n gap: 0.25rem;\n}\n\n.profile-header__name {\n margin: 0;\n color: var(--profile-card-color, #111827);\n font-size: 1.2rem;\n font-weight: 750;\n letter-spacing: 0;\n line-height: 1.2;\n}\n\n.profile-header__title {\n margin: 0;\n color: var(--profile-card-color, #111827);\n font-size: 0.925rem;\n font-weight: 650;\n line-height: 1.35;\n}\n\n.profile-header__description {\n margin: 0.25rem 0 0;\n color: var(--profile-card-muted-color, #6b7280);\n font-size: 0.9rem;\n line-height: 1.45;\n}\n',
|
|
684
121
|
'packages/components/profile-header/types.ts': "import type { ComponentProps, FC } from 'react';\n\n/** Props for the ProfileHeader component. */\nexport type ProfileHeaderProps = {\n name: string;\n title?: string;\n description?: string;\n avatarUrl?: string;\n} & ComponentProps<'header'>;\n\n/** ProfileHeader component type. */\nexport type ProfileHeaderType = FC<ProfileHeaderProps>;\n",
|
|
122
|
+
'packages/components/profile-links/README.md': "# ProfileLinks\n\n`ProfileLinks` renders profile links as compact text links or button links.\n\n## Usage\n\n```tsx\nimport { ProfileLinks } from './profile-links.js';\n\nexport const Example = () => <ProfileLinks links={[{ href: '/github', label: 'GitHub' }]} />;\n```\n\n## Props\n\n```ts\nexport type ProfileLink = {\n href: string;\n label: string;\n external?: boolean;\n};\n\nexport type ProfileLinksProps = {\n links: ProfileLink[];\n variant?: 'icons' | 'buttons';\n} & ComponentProps<'nav'>;\n```\n\n## Accessibility\n\nThe component renders `<nav aria-label=\"Profile links\">` by default.\n\n## Notes\n\n- Empty link arrays render `null`.\n- External links receive safe target and rel attributes.\n- SSR/SSG-safe.\n",
|
|
685
123
|
'packages/components/profile-links/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as ProfileLinksStories from './profile-links.stories';\n\n<Meta of={ProfileLinksStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={ProfileLinksStories.Default} />\n<Canvas of={ProfileLinksStories.Buttons} />\n",
|
|
686
124
|
'packages/components/profile-links/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('profile-links public API', () => {\n it('exports ProfileLinks', () => {\n expect(publicApi.ProfileLinks).toBeDefined();\n });\n});\n",
|
|
687
125
|
'packages/components/profile-links/index.ts': "export * from './profile-links.js';\nexport type * from './types.js';\n",
|
|
688
126
|
'packages/components/profile-links/profile-links.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { ProfileLinks } from './profile-links.js';\n\nconst meta = {\n title: 'Components/ProfileLinks',\n component: ProfileLinks,\n parameters: { docs: { page: null } },\n args: {\n links: [\n { label: 'GitHub', href: 'https://github.com', external: true },\n { label: 'Website', href: 'https://vyriy.dev', external: true },\n ],\n },\n} satisfies Meta<typeof ProfileLinks>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Buttons: Story = { args: { variant: 'buttons' } };\n",
|
|
689
127
|
'packages/components/profile-links/profile-links.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { ProfileLinks } from './profile-links.js';\n\ndescribe('ProfileLinks', () => {\n it('renders profile links in navigation', () => {\n render(<ProfileLinks links={[{ href: '/github', label: 'GitHub' }]} />);\n\n expect(screen.getByRole('navigation', { name: 'Profile links' })).toBeDefined();\n expect(screen.getByRole('link', { name: 'GitHub' })).toBeDefined();\n });\n\n it('renders external button links', () => {\n render(\n <ProfileLinks links={[{ href: 'https://example.com', label: 'Website', external: true }]} variant=\"buttons\" />,\n );\n\n const link = screen.getByRole('link', { name: 'Website' });\n\n expect(link.getAttribute('target')).toBe('_blank');\n expect(link.getAttribute('rel')).toBe('noreferrer');\n });\n\n it('does not render an empty wrapper', () => {\n const { container } = render(<ProfileLinks links={[]} />);\n\n expect(container.firstChild).toBeNull();\n });\n});\n",
|
|
690
128
|
'packages/components/profile-links/profile-links.tsx': "import { cn } from '@vyriy/cn';\n\nimport { ButtonLink } from '../button-link/index.js';\nimport { IconLink } from '../icon-link/index.js';\nimport type { ProfileLinksType } from './types.js';\n\n/** Renders profile links as icon links or button-style links. */\nexport const ProfileLinks: ProfileLinksType = ({\n links,\n variant = 'icons',\n className,\n 'aria-label': ariaLabel = 'Profile links',\n ...props\n}) => {\n if (links.length === 0) {\n return null;\n }\n\n return (\n <nav className={cn('profile-links', `profile-links--${variant}`, className)} aria-label={ariaLabel} {...props}>\n {links.map((link) =>\n variant === 'buttons' ? (\n <ButtonLink external={link.external} href={link.href} key={link.href} variant=\"secondary\">\n {link.label}\n </ButtonLink>\n ) : (\n <IconLink external={link.external} href={link.href} key={link.href} label={link.label} />\n ),\n )}\n </nav>\n );\n};\n",
|
|
691
|
-
'packages/components/profile-links/README.md': "# ProfileLinks\n\n`ProfileLinks` renders profile links as compact text links or button links.\n\n## Usage\n\n```tsx\nimport { ProfileLinks } from './profile-links.js';\n\nexport const Example = () => <ProfileLinks links={[{ href: '/github', label: 'GitHub' }]} />;\n```\n\n## Props\n\n```ts\nexport type ProfileLink = {\n href: string;\n label: string;\n external?: boolean;\n};\n\nexport type ProfileLinksProps = {\n links: ProfileLink[];\n variant?: 'icons' | 'buttons';\n} & ComponentProps<'nav'>;\n```\n\n## Accessibility\n\nThe component renders `<nav aria-label=\"Profile links\">` by default.\n\n## Notes\n\n- Empty link arrays render `null`.\n- External links receive safe target and rel attributes.\n- SSR/SSG-safe.\n",
|
|
692
129
|
'packages/components/profile-links/styles.scss': '.profile-links {\n display: flex;\n flex-wrap: wrap;\n gap: 0.55rem;\n}\n\n.profile-links--icons {\n align-items: center;\n}\n\n.profile-links--buttons {\n align-items: stretch;\n}\n',
|
|
693
130
|
'packages/components/profile-links/types.ts': "import type { ComponentProps, FC } from 'react';\n\n/** Link item rendered by ProfileLinks. */\nexport type ProfileLink = {\n href: string;\n label: string;\n external?: boolean;\n};\n\n/** Props for the ProfileLinks component. */\nexport type ProfileLinksProps = {\n links: ProfileLink[];\n variant?: 'icons' | 'buttons';\n} & ComponentProps<'nav'>;\n\n/** ProfileLinks component type. */\nexport type ProfileLinksType = FC<ProfileLinksProps>;\n",
|
|
131
|
+
'packages/components/profile-meta/README.md': "# ProfileMeta\n\n`ProfileMeta` renders compact metadata rows for location, company, availability, and stack.\n\n## Usage\n\n```tsx\nimport { ProfileMeta } from './profile-meta.js';\n\nexport const Example = () => <ProfileMeta items={[{ label: 'Project', value: 'Vyriy' }]} />;\n```\n\n## Props\n\n```ts\nexport type ProfileMetaItem = {\n label: string;\n value: ReactNode;\n};\n\nexport type ProfileMetaProps = {\n items: ProfileMetaItem[];\n} & ComponentProps<'dl'>;\n```\n\n## Accessibility\n\nThe component uses semantic `<dl>`, `<dt>`, and `<dd>` markup.\n\n## Notes\n\n- Empty item arrays render `null`.\n- SSR/SSG-safe.\n- Shared SCSS styles.\n",
|
|
694
132
|
'packages/components/profile-meta/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as ProfileMetaStories from './profile-meta.stories';\n\n<Meta of={ProfileMetaStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={ProfileMetaStories.Default} />\n",
|
|
695
133
|
'packages/components/profile-meta/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('profile-meta public API', () => {\n it('exports ProfileMeta', () => {\n expect(publicApi.ProfileMeta).toBeDefined();\n });\n});\n",
|
|
696
134
|
'packages/components/profile-meta/index.ts': "export * from './profile-meta.js';\nexport type * from './types.js';\n",
|
|
697
135
|
'packages/components/profile-meta/profile-meta.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { ProfileMeta } from './profile-meta.js';\n\nconst meta = {\n title: 'Components/ProfileMeta',\n component: ProfileMeta,\n parameters: { docs: { page: null } },\n args: {\n items: [\n { label: 'Project', value: 'Vyriy' },\n { label: 'Focus', value: 'Calm architecture' },\n ],\n },\n} satisfies Meta<typeof ProfileMeta>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n",
|
|
698
136
|
'packages/components/profile-meta/profile-meta.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { ProfileMeta } from './profile-meta.js';\n\ndescribe('ProfileMeta', () => {\n it('renders metadata in a description list', () => {\n render(<ProfileMeta items={[{ label: 'Location', value: 'Kyiv' }]} />);\n\n expect(screen.getByText('Location')).toBeDefined();\n expect(screen.getByText('Kyiv')).toBeDefined();\n });\n\n it('does not render an empty wrapper', () => {\n const { container } = render(<ProfileMeta items={[]} />);\n\n expect(container.firstChild).toBeNull();\n });\n});\n",
|
|
699
137
|
'packages/components/profile-meta/profile-meta.tsx': 'import { cn } from \'@vyriy/cn\';\n\nimport type { ProfileMetaType } from \'./types.js\';\n\n/** Renders profile metadata as a semantic description list. */\nexport const ProfileMeta: ProfileMetaType = ({ items, className, ...props }) => {\n if (items.length === 0) {\n return null;\n }\n\n return (\n <dl className={cn(\'profile-meta\', className)} {...props}>\n {items.map((item) => (\n <div className="profile-meta__item" key={item.label}>\n <dt className="profile-meta__label">{item.label}</dt>\n <dd className="profile-meta__value">{item.value}</dd>\n </div>\n ))}\n </dl>\n );\n};\n',
|
|
700
|
-
'packages/components/profile-meta/README.md': "# ProfileMeta\n\n`ProfileMeta` renders compact metadata rows for location, company, availability, and stack.\n\n## Usage\n\n```tsx\nimport { ProfileMeta } from './profile-meta.js';\n\nexport const Example = () => <ProfileMeta items={[{ label: 'Project', value: 'Vyriy' }]} />;\n```\n\n## Props\n\n```ts\nexport type ProfileMetaItem = {\n label: string;\n value: ReactNode;\n};\n\nexport type ProfileMetaProps = {\n items: ProfileMetaItem[];\n} & ComponentProps<'dl'>;\n```\n\n## Accessibility\n\nThe component uses semantic `<dl>`, `<dt>`, and `<dd>` markup.\n\n## Notes\n\n- Empty item arrays render `null`.\n- SSR/SSG-safe.\n- Shared SCSS styles.\n",
|
|
701
138
|
'packages/components/profile-meta/styles.scss': '.profile-meta {\n display: grid;\n gap: 0.55rem;\n margin: 0;\n}\n\n.profile-meta__item {\n display: grid;\n grid-template-columns: minmax(5rem, 0.45fr) 1fr;\n gap: 0.75rem;\n min-width: 0;\n}\n\n.profile-meta__label {\n color: var(--profile-card-muted-color, #6b7280);\n font-size: 0.78rem;\n font-weight: 650;\n line-height: 1.35;\n}\n\n.profile-meta__value {\n min-width: 0;\n margin: 0;\n color: var(--profile-card-color, #111827);\n font-size: 0.875rem;\n line-height: 1.35;\n overflow-wrap: anywhere;\n}\n',
|
|
702
139
|
'packages/components/profile-meta/types.ts': "import type { ComponentProps, FC, ReactNode } from 'react';\n\n/** Metadata item rendered by ProfileMeta. */\nexport type ProfileMetaItem = {\n label: string;\n value: ReactNode;\n};\n\n/** Props for the ProfileMeta component. */\nexport type ProfileMetaProps = {\n items: ProfileMetaItem[];\n} & ComponentProps<'dl'>;\n\n/** ProfileMeta component type. */\nexport type ProfileMetaType = FC<ProfileMetaProps>;\n",
|
|
140
|
+
'packages/components/profile-tags/README.md': "# ProfileTags\n\n`ProfileTags` renders a list of profile tags using `Badge`.\n\n## Usage\n\n```tsx\nimport { ProfileTags } from './profile-tags.js';\n\nexport const Example = () => <ProfileTags tags={['React', 'TypeScript']} />;\n```\n\n## Props\n\n```ts\nexport type ProfileTagsProps = {\n tags: string[];\n tone?: BadgeProps['tone'];\n} & ComponentProps<'ul'>;\n```\n\n## Accessibility\n\nTags are rendered as a semantic `<ul>` with one `<li>` per tag.\n\n## Notes\n\n- Empty tag arrays render `null`.\n- SSR/SSG-safe.\n- Shared SCSS styles.\n",
|
|
703
141
|
'packages/components/profile-tags/doc.mdx': "import { Meta, Markdown, Canvas } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\nimport * as ProfileTagsStories from './profile-tags.stories';\n\n<Meta of={ProfileTagsStories} />\n\n<Markdown>{ReadMe}</Markdown>\n\n## Examples\n\n<Canvas of={ProfileTagsStories.Default} />\n<Canvas of={ProfileTagsStories.Neutral} />\n",
|
|
704
142
|
'packages/components/profile-tags/index.test.ts': "import { describe, it, expect } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('profile-tags public API', () => {\n it('exports ProfileTags', () => {\n expect(publicApi.ProfileTags).toBeDefined();\n });\n});\n",
|
|
705
143
|
'packages/components/profile-tags/index.ts': "export * from './profile-tags.js';\nexport type * from './types.js';\n",
|
|
706
144
|
'packages/components/profile-tags/profile-tags.stories.tsx': "import type { Meta, StoryObj } from '@storybook/react-webpack5';\n\nimport { ProfileTags } from './profile-tags.js';\n\nconst meta = {\n title: 'Components/ProfileTags',\n component: ProfileTags,\n parameters: { docs: { page: null } },\n args: {\n tags: [\n 'React',\n 'TypeScript',\n 'AWS',\n 'Serverless',\n ],\n tone: 'blue',\n },\n} satisfies Meta<typeof ProfileTags>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Neutral: Story = { args: { tone: 'neutral' } };\n",
|
|
707
145
|
'packages/components/profile-tags/profile-tags.test.tsx': "import { describe, it, expect } from '@jest/globals';\nimport { render, screen } from '@testing-library/react';\n\nimport { ProfileTags } from './profile-tags.js';\n\ndescribe('ProfileTags', () => {\n it('renders tags as a list', () => {\n render(<ProfileTags tags={['React', 'TypeScript']} />);\n\n expect(screen.getByRole('list')).toBeDefined();\n expect(screen.getByText('React')).toBeDefined();\n expect(screen.getByText('TypeScript')).toBeDefined();\n });\n\n it('does not render an empty wrapper', () => {\n const { container } = render(<ProfileTags tags={[]} />);\n\n expect(container.firstChild).toBeNull();\n });\n});\n",
|
|
708
146
|
'packages/components/profile-tags/profile-tags.tsx': "import { cn } from '@vyriy/cn';\n\nimport { Badge } from '../badge/index.js';\nimport type { ProfileTagsType } from './types.js';\n\n/** Renders profile tags as a semantic list of badges. */\nexport const ProfileTags: ProfileTagsType = ({ tags, tone = 'neutral', className, ...props }) => {\n if (tags.length === 0) {\n return null;\n }\n\n return (\n <ul className={cn('profile-tags', className)} {...props}>\n {tags.map((tag) => (\n <li className=\"profile-tags__item\" key={tag}>\n <Badge tone={tone}>{tag}</Badge>\n </li>\n ))}\n </ul>\n );\n};\n",
|
|
709
|
-
'packages/components/profile-tags/README.md': "# ProfileTags\n\n`ProfileTags` renders a list of profile tags using `Badge`.\n\n## Usage\n\n```tsx\nimport { ProfileTags } from './profile-tags.js';\n\nexport const Example = () => <ProfileTags tags={['React', 'TypeScript']} />;\n```\n\n## Props\n\n```ts\nexport type ProfileTagsProps = {\n tags: string[];\n tone?: BadgeProps['tone'];\n} & ComponentProps<'ul'>;\n```\n\n## Accessibility\n\nTags are rendered as a semantic `<ul>` with one `<li>` per tag.\n\n## Notes\n\n- Empty tag arrays render `null`.\n- SSR/SSG-safe.\n- Shared SCSS styles.\n",
|
|
710
147
|
'packages/components/profile-tags/styles.scss': '.profile-tags {\n display: flex;\n flex-wrap: wrap;\n gap: 0.4rem;\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.profile-tags__item {\n display: inline-flex;\n}\n',
|
|
711
148
|
'packages/components/profile-tags/types.ts': "import type { ComponentProps, FC } from 'react';\n\nimport type { BadgeProps } from '../badge/index.js';\n\n/** Props for the ProfileTags component. */\nexport type ProfileTagsProps = {\n tags: string[];\n tone?: BadgeProps['tone'];\n} & ComponentProps<'ul'>;\n\n/** ProfileTags component type. */\nexport type ProfileTagsType = FC<ProfileTagsProps>;\n",
|
|
712
|
-
'packages/components/README.md': `# Components
|
|
713
|
-
|
|
714
|
-
Reusable React primitives for the profile-card microfrontend.
|
|
715
|
-
|
|
716
|
-
## Exports
|
|
717
|
-
|
|
718
|
-
The package exports the public profile-card component set:
|
|
719
|
-
|
|
720
|
-
- \`Avatar\`
|
|
721
|
-
- \`Badge\`
|
|
722
|
-
- \`ButtonLink\`
|
|
723
|
-
- \`Card\`
|
|
724
|
-
- \`IconLink\`
|
|
725
|
-
- \`ProfileCard\`
|
|
726
|
-
- \`ProfileDetails\`
|
|
727
|
-
- \`ProfileHeader\`
|
|
728
|
-
- \`ProfileLinks\`
|
|
729
|
-
- \`ProfileMeta\`
|
|
730
|
-
- \`ProfileTags\`
|
|
731
|
-
|
|
732
|
-
Each component also exports its public prop and component types from its folder entry point.
|
|
733
|
-
|
|
734
|
-
## Usage
|
|
735
|
-
|
|
736
|
-
\`\`\`tsx
|
|
737
|
-
import { ProfileCard } from '@p/components';
|
|
738
|
-
import '@p/components/styles.scss';
|
|
739
|
-
|
|
740
|
-
export const Example = () => (
|
|
741
|
-
<ProfileCard
|
|
742
|
-
avatarUrl="/avatar.svg"
|
|
743
|
-
description="First computer programmer."
|
|
744
|
-
name="Ada Lovelace"
|
|
745
|
-
tags={['math', 'computing']}
|
|
746
|
-
title="Mathematician"
|
|
747
|
-
/>
|
|
748
|
-
);
|
|
749
|
-
\`\`\`
|
|
750
|
-
|
|
751
|
-
## Component Docs
|
|
752
|
-
|
|
753
|
-
Each component has a focused README, Storybook docs, stories, and unit tests in its own folder. Use those folder READMEs for prop-level details and supported visual states.
|
|
754
|
-
`,
|
|
755
149
|
'packages/components/styles.d.ts': "declare module '*.scss';\ndeclare module '*.scss?inline' {\n const css: string;\n export default css;\n}\ndeclare module '*.svg' {\n const src: string;\n export default src;\n}\n",
|
|
756
150
|
'packages/components/styles.scss': "@use './avatar/styles' as avatar;\n@use './badge/styles' as badge;\n@use './button-link/styles' as button-link;\n@use './card/styles' as card;\n@use './icon-link/styles' as icon-link;\n@use './profile-card/styles' as profile-card;\n@use './profile-details/styles' as profile-details;\n@use './profile-header/styles' as profile-header;\n@use './profile-links/styles' as profile-links;\n@use './profile-meta/styles' as profile-meta;\n@use './profile-tags/styles' as profile-tags;\n",
|
|
757
|
-
'packages/
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
},
|
|
151
|
+
'packages/env/README.md': "# Env\n\nRequired environment readers shared by API and UI workspaces.\n\n## Exports\n\n- `getTag()` reads `TAG`.\n- `getMode()` reads `MODE`.\n- `getApi()` reads `API`.\n- `getUi()` reads `UI`.\n\nEach getter delegates to `@vyriy/env` and throws when its environment variable is missing.\n\n## Local Defaults\n\n`workspaces/env.sh` provides the local development defaults:\n\n- `API=http://localhost:3000`\n- `UI=http://localhost:3002`\n- `TAG=vyriy-profile-card`\n- `MODE=open`\n\n## Example\n\n```ts\nimport { getUi } from '@p/env';\n\nconst stylesheet = `${getUi()}/main.css`;\nconst avatar = `${getUi()}/avatar.svg`;\n```\n",
|
|
152
|
+
'packages/env/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Env\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
153
|
+
'packages/env/env.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport { getApi, getMode, getTag, getUi } from './env.js';\n\ndescribe('env getters', () => {\n afterEach(() => {\n delete process.env.API;\n delete process.env.MODE;\n delete process.env.TAG;\n delete process.env.UI;\n });\n\n it('reads required environment values', () => {\n process.env.API = 'http://localhost:3000';\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.UI = 'http://localhost:3002';\n\n expect(getApi()).toBe('http://localhost:3000');\n expect(getMode()).toBe('open');\n expect(getTag()).toBe('vyriy-profile-card');\n expect(getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment value is missing', () => {\n expect(() => getUi()).toThrow('Environment variable UI is not defined!');\n });\n});\n",
|
|
154
|
+
'packages/env/env.ts': "import { getEnv } from '@vyriy/env';\n\n/** Reads the configured custom element tag name. */\nexport const getTag = () => getEnv('TAG');\n\n/** Reads the configured shadow DOM mode. */\nexport const getMode = () => getEnv('MODE');\n\n/** Reads the API origin used for server endpoints. */\nexport const getApi = () => getEnv('API');\n\n/** Reads the UI origin used for browser assets. */\nexport const getUi = () => getEnv('UI');\n",
|
|
155
|
+
'packages/env/index.test.ts': "import { afterEach, describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\nconst ENV_NAMES = [\n 'TAG',\n 'MODE',\n 'API',\n 'UI',\n] as const;\n\nconst clearEnv = () => {\n for (const name of ENV_NAMES) {\n delete process.env[name];\n }\n};\n\ndescribe('env public API', () => {\n afterEach(() => {\n clearEnv();\n });\n\n it('exports env getters', () => {\n expect(publicApi.getTag).toBeDefined();\n expect(publicApi.getMode).toBeDefined();\n expect(publicApi.getApi).toBeDefined();\n expect(publicApi.getUi).toBeDefined();\n });\n\n it('reads environment variables by public getter name', () => {\n process.env.TAG = 'vyriy-profile-card';\n process.env.MODE = 'open';\n process.env.API = 'http://localhost:3000';\n process.env.UI = 'http://localhost:3002';\n\n expect(publicApi.getTag()).toBe('vyriy-profile-card');\n expect(publicApi.getMode()).toBe('open');\n expect(publicApi.getApi()).toBe('http://localhost:3000');\n expect(publicApi.getUi()).toBe('http://localhost:3002');\n });\n\n it('throws when a required environment variable is missing', () => {\n clearEnv();\n\n expect(() => publicApi.getApi()).toThrow('Environment variable API is not defined!');\n });\n});\n",
|
|
156
|
+
'packages/env/index.ts': "export * from './env.js';\n",
|
|
157
|
+
'packages/env/package.json': '{\n "name": "@p/env",\n "type": "module",\n "private": true\n}\n',
|
|
158
|
+
'packages/event/README.md': "# Event\n\nTyped profile-card event helpers.\n\n## Exports\n\n- `PROFILE_CARD_SELECT_EVENT_NAME` is `vyriy-profile-card.select`.\n- `PROFILE_CARD_ANALYTICS_EVENT_NAME` is `openmfe.analytics`.\n- `dispatchProfileCardSelectEvent(target, detail)` dispatches the profile-card selection event.\n- `dispatchProfileCardAnalyticsEvent(target, data)` dispatches the standard OpenMFE analytics event for the same selection.\n- `ProfileCardSelectDetail` and `ProfileCardAnalyticsData` describe the event payloads.\n\nBoth dispatch helpers emit bubbling, composed custom events so consumers outside the custom element shadow root can observe them.\n\n## Usage\n\n```ts\nimport { dispatchProfileCardAnalyticsEvent, dispatchProfileCardSelectEvent } from '@p/event';\n\nconst target = document.querySelector('vyriy-profile-card');\n\nif (target instanceof HTMLElement) {\n const detail = {\n name: 'Ada Lovelace',\n role: 'Mathematician',\n avatarUrl: '/avatar.svg',\n };\n\n dispatchProfileCardSelectEvent(target, detail);\n dispatchProfileCardAnalyticsEvent(target, detail);\n}\n```\n\n## Payload\n\n`ProfileCardSelectDetail` requires `name` and accepts optional `role` and `avatarUrl`.\n\nThe analytics helper wraps the same data in the standard OpenMFE analytics event with `action: 'select'` and `category: 'profile-card'`.\n",
|
|
159
|
+
'packages/event/constants.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\n\ndescribe('event constants', () => {\n it('matches the manifest event names', () => {\n expect(PROFILE_CARD_ANALYTICS_EVENT_NAME).toBe('openmfe.analytics');\n expect(PROFILE_CARD_SELECT_EVENT_NAME).toBe('vyriy-profile-card.select');\n });\n});\n",
|
|
160
|
+
'packages/event/constants.ts': "/** Custom event emitted when the profile card is selected. */\nexport const PROFILE_CARD_SELECT_EVENT_NAME = 'vyriy-profile-card.select';\n\n/** Standard OpenMFE analytics event emitted for profile-card interactions. */\nexport const PROFILE_CARD_ANALYTICS_EVENT_NAME = 'openmfe.analytics';\n",
|
|
161
|
+
'packages/event/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Event\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
162
|
+
'packages/event/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('event public API', () => {\n it('exports profile card event helpers', () => {\n expect(publicApi.PROFILE_CARD_ANALYTICS_EVENT_NAME).toBe('openmfe.analytics');\n expect(publicApi.PROFILE_CARD_SELECT_EVENT_NAME).toBe('vyriy-profile-card.select');\n expect(publicApi.dispatchProfileCardAnalyticsEvent).toBeDefined();\n expect(publicApi.dispatchProfileCardSelectEvent).toBeDefined();\n });\n});\n",
|
|
163
|
+
'packages/event/index.ts': "export { PROFILE_CARD_ANALYTICS_EVENT_NAME, PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nexport { dispatchProfileCardAnalyticsEvent } from './profile-card-analytics.js';\nexport { dispatchProfileCardSelectEvent } from './profile-card-select.js';\nexport type { ProfileCardAnalyticsData, ProfileCardSelectDetail } from './types.js';\n",
|
|
164
|
+
'packages/event/package.json': '{\n "name": "@p/event",\n "type": "module",\n "private": true\n}\n',
|
|
165
|
+
'packages/event/profile-card-analytics.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\n\nimport { PROFILE_CARD_ANALYTICS_EVENT_NAME } from './constants.js';\nimport { dispatchProfileCardAnalyticsEvent } from './profile-card-analytics.js';\n\ndescribe('dispatchProfileCardAnalyticsEvent', () => {\n it('dispatches the standard OpenMFE analytics event from the custom element', () => {\n const target = document.createElement('vyriy-profile-card');\n const listener = jest.fn();\n\n target.id = 'profile-card-1';\n target.addEventListener(PROFILE_CARD_ANALYTICS_EVENT_NAME, listener);\n\n const event = dispatchProfileCardAnalyticsEvent(target, {\n avatarUrl: null,\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n\n expect(event.type).toBe(PROFILE_CARD_ANALYTICS_EVENT_NAME);\n expect(event.bubbles).toBe(true);\n expect(event.composed).toBe(true);\n expect(event.detail).toEqual({\n action: 'select',\n category: 'profile-card',\n data: {\n avatarUrl: null,\n name: 'Ada Lovelace',\n role: 'Mathematician',\n },\n id: 'profile-card-1',\n name: 'profile_card_select',\n origin: 'vyriy-profile-card',\n variant: null,\n });\n expect(listener).toHaveBeenCalledWith(event);\n });\n});\n",
|
|
166
|
+
'packages/event/profile-card-analytics.ts': "import { dispatchAnalyticsEvent } from '@vyriy/event';\n\nimport type { ProfileCardAnalyticsData } from './types.js';\n\n/** Dispatches the standard OpenMFE analytics event for a profile-card selection. */\nexport const dispatchProfileCardAnalyticsEvent = (target: HTMLElement, data: ProfileCardAnalyticsData): CustomEvent => {\n return dispatchAnalyticsEvent(\n target,\n {\n action: 'select',\n category: 'profile-card',\n data,\n name: 'profile_card_select',\n },\n {\n bubbles: true,\n composed: true,\n },\n );\n};\n",
|
|
167
|
+
'packages/event/profile-card-select.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\n\nimport { PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nimport { dispatchProfileCardSelectEvent } from './profile-card-select.js';\n\ndescribe('dispatchProfileCardSelectEvent', () => {\n it('dispatches the profile card select event from the custom element', () => {\n const target = document.createElement('vyriy-profile-card');\n const listener = jest.fn();\n\n target.addEventListener(PROFILE_CARD_SELECT_EVENT_NAME, listener);\n\n const event = dispatchProfileCardSelectEvent(target, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n\n expect(event.type).toBe(PROFILE_CARD_SELECT_EVENT_NAME);\n expect(event.bubbles).toBe(true);\n expect(event.composed).toBe(true);\n expect(event.detail).toEqual({\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n expect(listener).toHaveBeenCalledWith(event);\n });\n});\n",
|
|
168
|
+
'packages/event/profile-card-select.ts': "import { dispatchCustomEvent } from '@vyriy/event';\n\nimport { PROFILE_CARD_SELECT_EVENT_NAME } from './constants.js';\nimport type { ProfileCardSelectDetail } from './types.js';\n\n/** Dispatches the profile-card select custom event from the web component host. */\nexport const dispatchProfileCardSelectEvent = (\n target: HTMLElement,\n detail: ProfileCardSelectDetail,\n): CustomEvent<ProfileCardSelectDetail> => {\n return dispatchCustomEvent(target, PROFILE_CARD_SELECT_EVENT_NAME, detail, {\n bubbles: true,\n composed: true,\n });\n};\n",
|
|
169
|
+
'packages/event/types.ts': '/** Detail payload for the profile-card select custom event. */\nexport type ProfileCardSelectDetail = {\n name: string;\n role?: string;\n avatarUrl?: string | null;\n};\n\n/** Analytics data payload emitted for profile-card selections. */\nexport type ProfileCardAnalyticsData = ProfileCardSelectDetail;\n',
|
|
170
|
+
'packages/query/README.md': "# Query\n\nQuery-string parsers for profile-card API endpoints.\n\n## Exports\n\n- `parseProfileCardQuery(query)` converts router query parameters into profile-card props.\n- `Query` describes the router query input shape.\n- `ParseProfileCardQuery` describes the parser signature.\n\n## Parameters\n\n`name` is required. When `name` is missing or empty, the parser returns `undefined`.\n\nSupported optional parameters:\n\n- `title`\n- `description`\n- `avatarUrl`\n- `tags`, as a comma-separated list\n\nEmpty string values are treated as missing. `tags` are split on commas, trimmed, and empty items are removed.\n\n## Example\n\n```ts\nimport { parseProfileCardQuery } from '@p/query';\n\nconst props = parseProfileCardQuery({\n name: 'Ada Lovelace',\n title: 'Mathematician',\n description: 'First computer programmer.',\n tags: 'math, computing',\n});\n```\n",
|
|
171
|
+
'packages/query/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Packages/Query\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
172
|
+
'packages/query/index.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport * as publicApi from './index.js';\n\ndescribe('query public API', () => {\n it('exports query parsers', () => {\n expect(publicApi.parseProfileCardQuery).toBeDefined();\n });\n});\n",
|
|
173
|
+
'packages/query/index.ts': "export * from './profile-card.js';\nexport type * from './types.js';\n",
|
|
174
|
+
'packages/query/package.json': '{\n "name": "@p/query",\n "type": "module",\n "private": true\n}\n',
|
|
175
|
+
'packages/query/profile-card.test.ts': "import { describe, expect, it } from '@jest/globals';\n\nimport { parseProfileCardQuery } from './profile-card.js';\n\ndescribe('parseProfileCardQuery', () => {\n it('returns undefined when name is missing', () => {\n expect(parseProfileCardQuery(undefined)).toBeUndefined();\n expect(parseProfileCardQuery({})).toBeUndefined();\n expect(parseProfileCardQuery({ name: '' })).toBeUndefined();\n });\n\n it('parses supported profile card fields', () => {\n expect(\n parseProfileCardQuery({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: 'one, two,, three ',\n title: 'Title',\n }),\n ).toEqual({\n avatarUrl: 'https://example.com/avatar.png',\n description: 'Profile description',\n name: 'Name',\n tags: ['one', 'two', 'three'],\n title: 'Title',\n });\n });\n\n it('omits tags when the query list is empty after trimming', () => {\n expect(\n parseProfileCardQuery({\n name: 'Name',\n tags: ', , ',\n }),\n ).toEqual({\n name: 'Name',\n tags: undefined,\n });\n });\n});\n",
|
|
176
|
+
'packages/query/profile-card.ts': "import type { ParseProfileCardQuery, Query } from './types.js';\n\nconst getQueryValue = (query: Query, name: string): string | undefined => {\n const value = query?.[name];\n\n return value === '' ? undefined : value;\n};\n\nconst getQueryList = (query: Query, name: string): string[] | undefined => {\n const value = getQueryValue(query, name);\n\n if (!value) {\n return undefined;\n }\n\n const list = value\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean);\n\n return list.length > 0 ? list : undefined;\n};\n\n/** Parses request query parameters into profile-card props. */\nexport const parseProfileCardQuery: ParseProfileCardQuery = (query) => {\n const name = getQueryValue(query, 'name');\n\n if (!name) {\n return undefined;\n }\n\n return {\n name,\n title: getQueryValue(query, 'title'),\n description: getQueryValue(query, 'description'),\n avatarUrl: getQueryValue(query, 'avatarUrl'),\n tags: getQueryList(query, 'tags'),\n };\n};\n",
|
|
177
|
+
'packages/query/types.ts': "import type { ProfileCard } from '@p/components/profile-card/types.js';\n\n/** Query string values provided by the API router. */\nexport type Query = Record<string, string | undefined> | undefined;\n\n/** Converts query string values into profile-card props or rejects incomplete input. */\nexport type ParseProfileCardQuery = (query: Query) => ProfileCard | undefined;\n",
|
|
178
|
+
'prettier.config.ts': "export { default } from '@vyriy/prettier-config';\n",
|
|
179
|
+
'start_dist.sh': '#!/usr/bin/env sh\n\nset -e\n\n: "${API:=http://localhost:3000}"\n: "${MODE:=open}"\n: "${TAG:=vyriy-profile-card}"\n: "${UI:=http://localhost:3000/ui}"\n: "${PORT:=3000}"\n\ncd "$PWD/dist"\n\nNODE_ENV=production \\\nTAG="$TAG" \\\nMODE="$MODE" \\\nAPI="$API" \\\nUI="$UI" \\\nLOG_LEVEL=info \\\nPORT="$PORT" \\\nexec node .\n',
|
|
180
|
+
'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
|
|
181
|
+
'tsconfig.json': '{\n "extends": "@vyriy/typescript-config/index.json",\n "include": [\n ".storybook/**/*.ts",\n ".storybook/**/*.tsx",\n "packages/**/*.ts",\n "packages/**/*.tsx",\n "workspaces/**/*.ts",\n "workspaces/**/*.tsx",\n "*.ts"\n ]\n}\n',
|
|
182
|
+
'workspaces/api/Dockerfile': 'FROM node:krypton-alpine\n\nWORKDIR /app\n\nENV PORT=3000\nENV LOG_LEVEL=info\nENV NODE_ENV=production\nENV TAG=vyriy-profile-card\nENV MODE=open\nENV API=.\nENV UI=/ui\n\nCOPY package.json .\n\nRUN npm install\n\nCOPY --chown=node:node . .\n\nUSER node\n\nEXPOSE 3000\n\nHEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 CMD wget -q -O /dev/null "http://127.0.0.1:${PORT}/healthcheck" || exit 1\n\nCMD ["node", "index.js"]\n',
|
|
183
|
+
'workspaces/api/README.md': '# Api\n\nServer workspace for the profile-card microfrontend.\n\n## Routes\n\n- `GET /` returns a standalone HTML demo page.\n- `GET /prerender` returns server-rendered custom element HTML.\n- `GET /semantic` returns Schema.org Person JSON-LD.\n- `GET /manifest.yml` returns the OpenMFE manifest YAML.\n\n`/prerender` and `/semantic` require the `name` query parameter. They also accept `title`, `description`, `avatarUrl`, and comma-separated `tags`.\n\n## Local Development\n\n```bash\nyarn start:api\n```\n\nThe start script loads `workspaces/env.sh`, listens on `API_PORT`, and prints example URLs for the demo, prerender, semantic, and manifest endpoints.\n\nDefault local URL:\n\n```text\nhttp://localhost:3000\n```\n\n## Build\n\n```bash\nyarn build:api\n```\n\nThe build writes the server bundle to `dist/api`.\n\n## Docker Runtime\n\nThe API image listens on the internal `PORT` value, which defaults to `3000`.\nThe image uses same-origin runtime URLs by default: `API=.` and `UI=/ui`.\nBrowser-facing links therefore use whatever host and port served the page.\n\n```bash\ndocker run -p 3003:3000 <image>\n```\n',
|
|
184
|
+
'workspaces/api/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack --config $scriptdir/webpack.config.ts\n\ncp $scriptdir/package.json dist/package.json\nnpm pkg delete "type" --prefix dist\nnpm pkg delete "private" --prefix dist\nnpm install --prefix dist\nrm dist/package-lock.json\n',
|
|
185
|
+
'workspaces/api/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/api";\n\n. "$PWD/workspaces/env.sh"\n\necho "Demo:\\n$API/\\n"\necho "Prerender:\\n$API/prerender?name=Developer&title=Senior%20IT%20Professional&avatarUrl=$UI/avatar.svg\\n"\necho "Semantic:\\n$API/semantic?name=Developer&title=Senior%20IT%20Professional&avatarUrl=$UI/avatar.svg\\n"\necho "Manifest:\\n$API/manifest.yml\\n"\n\nNODE_ENV=production \\\nLOG_LEVEL=info \\\nPORT=$API_PORT \\\ntsx watch $scriptdir/index.ts\n',
|
|
186
|
+
'workspaces/api/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/API\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
187
|
+
'workspaces/api/index.test.ts': "import { describe, expect, it, jest } from '@jest/globals';\nimport type { APIGatewayProxyEvent, RouterHandler } from '@vyriy/router';\n\nconst apiMock = jest.fn(\n (handler: RouterHandler): RouterHandler =>\n (event: APIGatewayProxyEvent) => {\n if (event.path === '/healthcheck') {\n return Promise.resolve({\n body: JSON.stringify({\n message: 'OK',\n }),\n statusCode: 200,\n });\n }\n\n return handler(event);\n },\n);\nconst serverMock = jest.fn();\n\njest.mock('@vyriy/handler', () => ({\n api: apiMock,\n}));\n\njest.mock('@vyriy/server', () => ({\n server: serverMock,\n}));\n\ndescribe('workspaces/api/index.ts', () => {\n const getEvent = (\n path: string,\n queryStringParameters: APIGatewayProxyEvent['queryStringParameters'] = null,\n ): APIGatewayProxyEvent =>\n ({\n body: null,\n headers: {},\n httpMethod: 'GET',\n path,\n pathParameters: null,\n queryStringParameters,\n }) as APIGatewayProxyEvent;\n\n it('starts the server with the API router handler', async () => {\n process.env.MODE = 'open';\n process.env.TAG = 'vyriy-profile-card';\n process.env.API = 'http://localhost:3000';\n process.env.UI = 'http://localhost:3002';\n\n await import('./index.js');\n\n expect(apiMock).toHaveBeenCalledTimes(1);\n expect(serverMock).toHaveBeenCalledTimes(1);\n expect(serverMock).toHaveBeenCalledWith(apiMock.mock.results[0]?.value);\n\n const handler = apiMock.mock.results[0]?.value as RouterHandler;\n\n await expect(handler(getEvent('/'))).resolves.toEqual({\n body: expect.stringContaining('<vyriy-profile-card'),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/html; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/prerender'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Query parameter \"name\" is required.',\n }),\n headers: undefined,\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 400,\n });\n\n const prerenderResponse = await handler(\n getEvent('/prerender', {\n description: 'Profile description',\n name: 'Name',\n tags: 'one, two',\n title: 'Title',\n }),\n );\n\n expect(prerenderResponse).toEqual({\n body: expect.stringContaining('Name'),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/html; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n expect(prerenderResponse.body).toContain('shadowrootmode=\"open\"');\n expect(prerenderResponse.body).toContain('http://localhost:3002/main.css');\n\n await expect(handler(getEvent('/semantic', { name: 'Name' }))).resolves.toEqual({\n body: JSON.stringify({\n '@context': 'https://schema.org',\n '@type': 'Person',\n name: 'Name',\n }),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'application/ld+json; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/semantic'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'Query parameter \"name\" is required.',\n }),\n headers: undefined,\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 400,\n });\n\n await expect(handler(getEvent('/manifest.yml'))).resolves.toEqual({\n body: expect.stringContaining(\"name: 'Vyriy Profile Card'\"),\n headers: {\n 'access-control-allow-origin': '*',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'content-type': 'text/yaml; charset=utf-8',\n 'x-content-type-options': 'nosniff',\n },\n isBase64Encoded: undefined,\n multiValueHeaders: undefined,\n statusCode: 200,\n });\n\n await expect(handler(getEvent('/healthcheck'))).resolves.toEqual({\n body: JSON.stringify({\n message: 'OK',\n }),\n statusCode: 200,\n });\n });\n});\n",
|
|
188
|
+
'workspaces/api/index.ts': "import { server } from '@vyriy/server';\nimport { api } from '@vyriy/handler';\nimport { createRouter } from '@vyriy/router';\nimport { minify } from '@vyriy/html';\nimport { withStatic } from '@vyriy/static';\nimport { path } from '@vyriy/path';\n\nimport { demo, manifest, prerender, semantic } from '@p/api';\nimport { parseProfileCardQuery } from '@p/query';\n\nserver(\n api(async (event) =>\n withStatic(createRouter())\n .get('/', () => ({\n body: minify(demo()),\n headers: {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n }))\n .get('/prerender', ({ query }) => {\n const profileCard = parseProfileCardQuery(query);\n\n if (!profileCard) {\n return {\n statusCode: 400,\n body: JSON.stringify({ message: 'Query parameter \"name\" is required.' }),\n };\n }\n\n return {\n body: minify(prerender(profileCard)),\n headers: {\n 'content-type': 'text/html; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n };\n })\n .get('/semantic', ({ query }) => {\n const profileCard = parseProfileCardQuery(query);\n\n if (!profileCard) {\n return {\n statusCode: 400,\n body: JSON.stringify({ message: 'Query parameter \"name\" is required.' }),\n };\n }\n\n return {\n body: semantic(profileCard),\n headers: {\n 'content-type': 'application/ld+json; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n };\n })\n .get('/manifest.yml', () => ({\n body: manifest(),\n headers: {\n 'content-type': 'text/yaml; charset=utf-8',\n 'cache-control': 'public, max-age=300, s-maxage=3600, stale-while-revalidate=86400',\n 'access-control-allow-origin': '*',\n 'x-content-type-options': 'nosniff',\n },\n }))\n .static('/ui', path('ui'))\n .route(event),\n ),\n);\n",
|
|
189
|
+
'workspaces/api/package.json': '{\n "name": "@w/api",\n "type": "module",\n "private": true,\n "dependencies": {\n "html-entities": "^2.6.0",\n "react": "^19.2.7",\n "react-dom": "^19.2.7"\n }\n}\n',
|
|
190
|
+
'workspaces/api/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\nimport { path } from '@vyriy/path';\nimport { ssr, external } from '@vyriy/webpack-config';\n\nexport default ssr(\n '@w/api',\n {\n path: path('dist'),\n filename: 'index.js',\n library: { type: 'commonjs2' },\n },\n (config) => ({\n ...config,\n externals: [external({ allowlist: [/^@p/, /^@w/, /^@vyriy/] })],\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin([\n 'API',\n 'MODE',\n 'TAG',\n 'UI',\n ]),\n ],\n }),\n);\n",
|
|
191
|
+
'workspaces/env.sh': '#!/usr/bin/env sh\n\n: "${API_PORT:=3000}"\n: "${UI_PORT:=3002}"\n: "${API:=http://localhost:$API_PORT}"\n: "${UI:=http://localhost:$UI_PORT}"\n: "${TAG:=vyriy-profile-card}"\n: "${MODE:=open}"\n\nexport API_PORT\nexport UI_PORT\nexport API\nexport UI\nexport TAG\nexport MODE\n',
|
|
192
|
+
'workspaces/ui/README.md': '# UI\n\nBrowser workspace for the `vyriy-profile-card` custom element.\n\n## Runtime\n\nThe entry point registers the custom element and renders `ProfileCard` inside its shadow root. The element reads these attributes:\n\n- `name`\n- `title`\n- `description`\n- `avatarUrl`\n- `tags`, as a JSON string array\n\nClicking the rendered profile card dispatches `vyriy-profile-card.select` and `openmfe.analytics`.\n\n## Local Development\n\n```bash\nyarn start:ui\n```\n\nThe start script loads `workspaces/env.sh`, starts webpack dev server on `UI_PORT`, and opens the generated demo page.\n\nDefault local URL:\n\n```text\nhttp://localhost:3002\n```\n\n## Build\n\n```bash\nyarn build:ui\n```\n\nThe build writes `index.js`, `main.css`, public UI assets, and the generated demo HTML into `dist/ui`.\n',
|
|
193
|
+
'workspaces/ui/bin/build.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/ui";\ndistdir="$PWD/dist/ui";\n\n. "$PWD/workspaces/env.sh"\n\nNODE_ENV=production \\\nnpx webpack \\\n--config $scriptdir/webpack.config.ts\n\ncp -R $scriptdir/public/* $distdir/\n',
|
|
194
|
+
'workspaces/ui/bin/start.sh': '#!/usr/bin/env sh\n\nset -e\n\nscriptdir="$PWD/workspaces/ui";\n\n. "$PWD/workspaces/env.sh"\n\nnpx webpack serve \\\n--open \\\n--config $scriptdir/webpack.config.ts \\\n--port $UI_PORT\n',
|
|
195
|
+
'workspaces/ui/doc.mdx': "import { Meta, Markdown } from '@storybook/addon-docs/blocks';\nimport ReadMe from './README.md?raw';\n\n<Meta title=\"Workspaces/UI\" />\n\n<Markdown>{ReadMe}</Markdown>\n",
|
|
196
|
+
'workspaces/ui/index.test.tsx': "import { beforeAll, describe, expect, it, jest } from '@jest/globals';\nimport type { ReactElement } from 'react';\n\ntype CustomElementOptions = {\n tag: string;\n elements: () => {\n elements: HTMLElement[];\n root: HTMLElement;\n };\n render: (el: HTMLElement) => ReactElement<{\n onClick: () => void;\n tags?: string[];\n }>;\n};\n\nconst customElementMock = jest.fn();\nconst dispatchProfileCardAnalyticsEventMock = jest.fn();\nconst dispatchProfileCardSelectEventMock = jest.fn();\nlet options: CustomElementOptions;\n\njest.mock('@vyriy/render/custom-element', () => ({\n customElement: customElementMock,\n}));\n\njest.mock('@p/event', () => ({\n dispatchProfileCardAnalyticsEvent: dispatchProfileCardAnalyticsEventMock,\n dispatchProfileCardSelectEvent: dispatchProfileCardSelectEventMock,\n}));\n\ndescribe('workspaces/ui/index.tsx', () => {\n beforeAll(async () => {\n process.env.UI = 'http://localhost:3002';\n\n await import('./index.js');\n\n [options] = (customElementMock.mock.calls[0] ?? []) as [CustomElementOptions];\n });\n\n it('registers the profile-card custom element with event dispatching', () => {\n const renderElements = options.elements();\n const host = document.createElement('vyriy-profile-card');\n\n host.setAttribute('avatarUrl', 'https://example.com/avatar.png');\n host.setAttribute('description', 'Profile description');\n host.setAttribute('name', 'Ada Lovelace');\n host.setAttribute('tags', '[\"math\",\"computing\"]');\n host.setAttribute('title', 'Mathematician');\n\n const element = options.render(host);\n\n element.props.onClick();\n\n expect(options.tag).toBe('vyriy-profile-card');\n expect(renderElements.root).toBeInstanceOf(HTMLDivElement);\n expect(renderElements.elements[0]).toBeInstanceOf(HTMLLinkElement);\n expect((renderElements.elements[0] as HTMLLinkElement).href).toBe('http://localhost:3002/main.css');\n expect(element.props.tags).toEqual(['math', 'computing']);\n expect(dispatchProfileCardSelectEventMock).toHaveBeenCalledWith(host, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n expect(dispatchProfileCardAnalyticsEventMock).toHaveBeenCalledWith(host, {\n avatarUrl: 'https://example.com/avatar.png',\n name: 'Ada Lovelace',\n role: 'Mathematician',\n });\n });\n\n it('loads the stylesheet next to the current UI script when it is available', () => {\n const script = document.createElement('script');\n\n script.src = 'http://localhost:3000/ui/index.js';\n document.body.append(script);\n\n const renderElements = options.elements();\n\n expect((renderElements.elements[0] as HTMLLinkElement).href).toBe('http://localhost:3000/ui/main.css');\n\n script.remove();\n });\n\n it('loads the stylesheet next to document.currentScript when it is available', () => {\n const script = document.createElement('script');\n const currentScriptMock = jest.spyOn(document, 'currentScript', 'get');\n\n script.src = 'http://localhost:3000/ui/index.js';\n currentScriptMock.mockReturnValue(script);\n\n const renderElements = options.elements();\n\n expect((renderElements.elements[0] as HTMLLinkElement).href).toBe('http://localhost:3000/ui/main.css');\n\n currentScriptMock.mockRestore();\n });\n\n it('ignores missing and invalid tags attributes', () => {\n const host = document.createElement('vyriy-profile-card');\n\n expect(options.render(host).props.tags).toBeUndefined();\n\n host.setAttribute('tags', 'not json');\n\n expect(options.render(host).props.tags).toBeUndefined();\n\n host.setAttribute('tags', '{\"tag\":\"math\"}');\n\n expect(options.render(host).props.tags).toBeUndefined();\n });\n\n it('falls back to empty profile values when attributes are missing', () => {\n const host = document.createElement('vyriy-profile-card');\n const element = options.render(host);\n\n element.props.onClick();\n\n expect(dispatchProfileCardSelectEventMock).toHaveBeenLastCalledWith(host, {\n avatarUrl: null,\n name: '',\n role: undefined,\n });\n });\n});\n",
|
|
197
|
+
'workspaces/ui/index.tsx': "import { customElement } from '@vyriy/render/custom-element';\n\nimport { dispatchProfileCardAnalyticsEvent, dispatchProfileCardSelectEvent } from '@p/event';\n\nimport { ProfileCard } from '@p/components/profile-card';\nimport '@p/components/styles.scss';\n\nconst parseJsonAttribute = (value: string | null): string[] | undefined => {\n if (!value) {\n return undefined;\n }\n\n try {\n const parsedValue: unknown = JSON.parse(value);\n\n if (Array.isArray(parsedValue) && parsedValue.every((item) => typeof item === 'string')) {\n return parsedValue;\n }\n } catch {\n return undefined;\n }\n\n return undefined;\n};\n\nconst getProfileCardSelectDetail = (el: HTMLElement) => ({\n avatarUrl: el.getAttribute('avatarUrl'),\n name: el.getAttribute('name') ?? '',\n role: el.getAttribute('title') ?? undefined,\n});\n\nconst getUiAssetUrl = (filename: string): string => {\n const script =\n document.currentScript instanceof HTMLScriptElement\n ? document.currentScript\n : document.querySelector<HTMLScriptElement>('script[src$=\"/index.js\"]');\n\n return script?.src ? new URL(filename, script.src).toString() : `${process.env.UI}/${filename}`;\n};\n\ncustomElement({\n tag: 'vyriy-profile-card',\n elements: () => {\n const link = document.createElement('link');\n const container = document.createElement('div');\n\n link.rel = 'stylesheet';\n link.href = getUiAssetUrl('main.css');\n\n return {\n elements: [link, container],\n root: container,\n };\n },\n render: (el) => (\n <ProfileCard\n avatarUrl={el.getAttribute('avatarUrl') ?? ''}\n description={el.getAttribute('description') ?? ''}\n name={el.getAttribute('name') ?? ''}\n onClick={() => {\n const detail = getProfileCardSelectDetail(el);\n\n dispatchProfileCardSelectEvent(el, detail);\n dispatchProfileCardAnalyticsEvent(el, detail);\n }}\n tags={parseJsonAttribute(el.getAttribute('tags'))}\n title={el.getAttribute('title') ?? ''}\n />\n ),\n});\n",
|
|
198
|
+
'workspaces/ui/package.json': '{\n "name": "@w/ui",\n "type": "module",\n "private": true\n}\n',
|
|
199
|
+
'workspaces/ui/public/avatar.svg': '<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="800">\r\n<rect width="1200" height="800" fill="#0057B7"/>\r\n<rect width="1200" height="400" y="400" fill="#FFD700"/>\r\n</svg>',
|
|
200
|
+
'workspaces/ui/public/icon.svg': '<svg\n width="256"\n height="256"\n viewBox="0 0 256 256"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Vyriy Profile Card icon</title>\n <desc id="description">A calm rounded square icon with a profile card symbol.</desc>\n\n <rect width="256" height="256" rx="56" fill="#111827" />\n <rect x="56" y="48" width="144" height="160" rx="24" fill="#F9FAFB" />\n <circle cx="128" cy="104" r="36" fill="#9CA3AF" />\n <rect x="84" y="156" width="88" height="14" rx="7" fill="#111827" />\n <rect x="96" y="180" width="64" height="10" rx="5" fill="#6B7280" />\n <circle cx="184" cy="184" r="20" fill="#10B981" />\n <path\n d="M175 184L181 190L194 176"\n stroke="white"\n stroke-width="6"\n stroke-linecap="round"\n stroke-linejoin="round"\n />\n</svg>\n',
|
|
201
|
+
'workspaces/ui/public/screenshots/compact.svg': '<svg\n width="1280"\n height="720"\n viewBox="0 0 1280 720"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Default profile card screenshot</title>\n <desc id="description">A profile card microfrontend rendered in a desktop host page.</desc>\n\n <rect width="1280" height="720" fill="#F3F4F6" />\n <rect x="80" y="72" width="1120" height="576" rx="32" fill="white" />\n\n <rect x="128" y="120" width="360" height="480" rx="28" fill="#F9FAFB" stroke="#E5E7EB" />\n <circle cx="308" cy="244" r="72" fill="#9CA3AF" />\n <rect x="188" y="368" width="240" height="28" rx="14" fill="#111827" />\n <rect x="224" y="420" width="168" height="18" rx="9" fill="#6B7280" />\n <rect x="232" y="492" width="152" height="44" rx="22" fill="#10B981" />\n\n <rect x="560" y="152" width="420" height="40" rx="20" fill="#111827" />\n <rect x="560" y="232" width="520" height="20" rx="10" fill="#6B7280" />\n <rect x="560" y="272" width="460" height="20" rx="10" fill="#9CA3AF" />\n <rect x="560" y="312" width="360" height="20" rx="10" fill="#D1D5DB" />\n <rect x="560" y="420" width="520" height="96" rx="24" fill="#F9FAFB" stroke="#E5E7EB" />\n</svg>\n',
|
|
202
|
+
'workspaces/ui/public/screenshots/default.svg': '<svg\n width="1280"\n height="720"\n viewBox="0 0 1280 720"\n fill="none"\n xmlns="http://www.w3.org/2000/svg"\n role="img"\n aria-labelledby="title description"\n>\n <title id="title">Default profile card screenshot</title>\n <desc id="description">A profile card microfrontend rendered in a desktop host page.</desc>\n\n <rect width="1280" height="720" fill="#F3F4F6" />\n <rect x="80" y="72" width="1120" height="576" rx="32" fill="white" />\n\n <rect x="128" y="120" width="360" height="480" rx="28" fill="#F9FAFB" stroke="#E5E7EB" />\n <circle cx="308" cy="244" r="72" fill="#9CA3AF" />\n <rect x="188" y="368" width="240" height="28" rx="14" fill="#111827" />\n <rect x="224" y="420" width="168" height="18" rx="9" fill="#6B7280" />\n <rect x="232" y="492" width="152" height="44" rx="22" fill="#10B981" />\n\n <rect x="560" y="152" width="420" height="40" rx="20" fill="#111827" />\n <rect x="560" y="232" width="520" height="20" rx="10" fill="#6B7280" />\n <rect x="560" y="272" width="460" height="20" rx="10" fill="#9CA3AF" />\n <rect x="560" y="312" width="360" height="20" rx="10" fill="#D1D5DB" />\n <rect x="560" y="420" width="520" height="96" rx="24" fill="#F9FAFB" stroke="#E5E7EB" />\n</svg>\n',
|
|
203
|
+
'workspaces/ui/webpack.config.ts': "import { EnvironmentPlugin } from 'webpack';\n\nimport { csr, html } from '@vyriy/webpack-config';\nimport { path } from '@vyriy/path';\n\ntype ConfigWithDevServer = {\n devServer?: Record<string, unknown>;\n};\n\nexport default csr(\n '@w/ui',\n {\n path: path('dist', 'ui'),\n filename: 'index.js',\n },\n (config) => {\n const configWithDevServer = config as typeof config & ConfigWithDevServer;\n\n return {\n ...config,\n devServer: {\n ...configWithDevServer.devServer,\n static: {\n directory: path('workspaces', 'ui', 'public'),\n },\n },\n plugins: [\n ...(config.plugins ?? []),\n new EnvironmentPlugin(['UI']),\n html(\n {\n htmlAttributes: 'lang=\"en\"',\n title: '<title>Search</title>',\n body: '<vyriy-profile-card name=\"Developer\" title=\"Senior IT Professional\" avatarUrl=\"avatar.svg\"></vyriy-profile-card>',\n script: [\n '<script defer=\"defer\" src=\"index.js\"></script>',\n [\n '<script type=\"module\">',\n \"const card = document.querySelector('vyriy-profile-card');\",\n \"card.addEventListener('vyriy-profile-card.select', (event) => {\",\n \" console.log('UI demo event:', event.detail);\",\n '});',\n '</scr' + 'ipt>',\n ].join(''),\n ].join(''),\n },\n {\n inject: false,\n publicPath: process.env.UI,\n },\n ),\n ],\n };\n },\n);\n",
|
|
204
|
+
};
|
|
205
|
+
export const mfe = (options) => ({
|
|
762
206
|
...projectFiles,
|
|
207
|
+
'AGENTS.md': agentsContent,
|
|
763
208
|
'package.json': JSON.stringify({
|
|
764
209
|
name: options.name,
|
|
765
210
|
version: '0.0.0',
|
|
@@ -777,31 +222,33 @@ Each component has a focused README, Storybook docs, stories, and unit tests in
|
|
|
777
222
|
],
|
|
778
223
|
scripts: {
|
|
779
224
|
storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
|
|
780
|
-
check: 'run-s lint build
|
|
225
|
+
check: 'run-s lint test build ncu',
|
|
781
226
|
fix: "run-s 'fix:*'",
|
|
782
227
|
start: "run-p 'start:*'",
|
|
783
228
|
lint: "run-s 'lint:*'",
|
|
784
|
-
build: "run-s 'build:*'",
|
|
785
229
|
test: "run-s 'test:*'",
|
|
230
|
+
build: "run-s 'build:*'",
|
|
231
|
+
ncu: 'ncu --dep peer,prod,dev --target minor --errorLevel 2',
|
|
232
|
+
'fix:deps': 'ncu --dep peer,prod,dev --target minor -u && yarn',
|
|
786
233
|
'fix:prettier': 'prettier . --write',
|
|
787
234
|
'fix:eslint': 'eslint . --fix',
|
|
788
235
|
'fix:stylelint': "stylelint '**/*.{css,scss}' --fix",
|
|
789
236
|
'start:api': 'sh workspaces/api/bin/start.sh',
|
|
790
|
-
'start:static': 'sh workspaces/static/bin/start.sh',
|
|
791
237
|
'start:ui': 'sh workspaces/ui/bin/start.sh',
|
|
792
238
|
'lint:ts': 'tsc',
|
|
793
239
|
'lint:prettier': 'prettier . --check',
|
|
794
240
|
'lint:eslint': 'eslint .',
|
|
795
241
|
'lint:stylelint': "stylelint '**/*.{css,scss}'",
|
|
242
|
+
'test:jest': 'jest',
|
|
796
243
|
'build:api': 'sh workspaces/api/bin/build.sh',
|
|
797
244
|
'build:ui': 'sh workspaces/ui/bin/build.sh',
|
|
798
|
-
'build:static': 'sh workspaces/static/bin/build.sh',
|
|
799
245
|
'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
|
|
800
|
-
'test:jest': 'jest',
|
|
801
246
|
prebuild: 'rimraf dist',
|
|
802
247
|
postinstall: 'husky',
|
|
803
248
|
},
|
|
804
249
|
dependencies: {
|
|
250
|
+
'@storybook/addon-docs': packageJson.peerDependencies['@storybook/addon-docs'],
|
|
251
|
+
'@storybook/react-webpack5': packageJson.peerDependencies['@storybook/react-webpack5'],
|
|
805
252
|
'@testing-library/dom': packageJson.peerDependencies['@testing-library/dom'],
|
|
806
253
|
'@testing-library/react': packageJson.peerDependencies['@testing-library/react'],
|
|
807
254
|
'@types/jest': packageJson.peerDependencies['@types/jest'],
|
|
@@ -818,16 +265,21 @@ Each component has a focused README, Storybook docs, stories, and unit tests in
|
|
|
818
265
|
'@vyriy/render': `^${packageJson.version}`,
|
|
819
266
|
'@vyriy/router': `^${packageJson.version}`,
|
|
820
267
|
'@vyriy/server': `^${packageJson.version}`,
|
|
268
|
+
'@vyriy/static': `^${packageJson.version}`,
|
|
821
269
|
'@vyriy/storybook-config': `^${packageJson.version}`,
|
|
822
270
|
'@vyriy/stylelint-config': `^${packageJson.version}`,
|
|
823
271
|
'@vyriy/typescript-config': `^${packageJson.version}`,
|
|
824
272
|
'@vyriy/webpack-config': `^${packageJson.version}`,
|
|
825
273
|
'cross-env': packageJson.peerDependencies['cross-env'],
|
|
826
274
|
eslint: packageJson.peerDependencies['eslint'],
|
|
275
|
+
'html-entities': '^2.6.0',
|
|
827
276
|
husky: packageJson.peerDependencies['husky'],
|
|
828
277
|
jest: packageJson.peerDependencies['jest'],
|
|
278
|
+
'npm-check-updates': '^22.2.3',
|
|
829
279
|
'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
|
|
830
280
|
prettier: packageJson.peerDependencies['prettier'],
|
|
281
|
+
react: packageJson.peerDependencies['react'],
|
|
282
|
+
'react-dom': packageJson.peerDependencies['react-dom'],
|
|
831
283
|
rimraf: packageJson.peerDependencies['rimraf'],
|
|
832
284
|
storybook: packageJson.peerDependencies['storybook'],
|
|
833
285
|
stylelint: packageJson.peerDependencies['stylelint'],
|
|
@@ -835,123 +287,6 @@ Each component has a focused README, Storybook docs, stories, and unit tests in
|
|
|
835
287
|
typescript: packageJson.peerDependencies['typescript'],
|
|
836
288
|
webpack: packageJson.peerDependencies['webpack'],
|
|
837
289
|
'webpack-cli': packageJson.peerDependencies['webpack-cli'],
|
|
838
|
-
'@vyriy/static': `^${packageJson.version}`,
|
|
839
290
|
},
|
|
840
291
|
}, null, 2) + '\n',
|
|
841
|
-
'README.md': `# MFE
|
|
842
|
-
|
|
843
|
-
Profile-card microfrontend starter for Vyriy and OpenMFE-oriented development.
|
|
844
|
-
|
|
845
|
-
The repository is split into reusable packages and runnable workspaces. Packages own typed component, API, event, query, and environment behavior.
|
|
846
|
-
Workspaces compose those packages into the local API server, static asset origin, and browser custom element build.
|
|
847
|
-
|
|
848
|
-
## Setup
|
|
849
|
-
|
|
850
|
-
\`\`\`bash
|
|
851
|
-
yarn install
|
|
852
|
-
\`\`\`
|
|
853
|
-
|
|
854
|
-
## Project Structure
|
|
855
|
-
|
|
856
|
-
- \`packages/api\` builds demo HTML, prerendered custom element markup, JSON-LD, and the OpenMFE manifest.
|
|
857
|
-
- \`packages/components\` provides the React profile-card component set.
|
|
858
|
-
- \`packages/env\` reads required runtime environment values.
|
|
859
|
-
- \`packages/event\` dispatches typed profile-card selection and analytics events.
|
|
860
|
-
- \`packages/query\` parses API query strings into profile-card props.
|
|
861
|
-
- \`workspaces/api\` serves the demo, prerender, semantic, and manifest endpoints.
|
|
862
|
-
- \`workspaces/static\` serves CDN assets such as the avatar, manifest icon, and screenshots with \`@vyriy/static\`.
|
|
863
|
-
- \`workspaces/ui\` registers the \`vyriy-profile-card\` custom element and builds browser assets.
|
|
864
|
-
|
|
865
|
-
## Start
|
|
866
|
-
|
|
867
|
-
Start the API, static asset server, and UI dev server together:
|
|
868
|
-
|
|
869
|
-
\`\`\`bash
|
|
870
|
-
yarn start
|
|
871
|
-
\`\`\`
|
|
872
|
-
|
|
873
|
-
Start individual workspaces:
|
|
874
|
-
|
|
875
|
-
\`\`\`bash
|
|
876
|
-
yarn start:api
|
|
877
|
-
yarn start:static
|
|
878
|
-
yarn start:ui
|
|
879
|
-
\`\`\`
|
|
880
|
-
|
|
881
|
-
## Local URLs
|
|
882
|
-
|
|
883
|
-
Default ports and origins are defined in \`workspaces/env.sh\`:
|
|
884
|
-
|
|
885
|
-
- API: \`http://localhost:3000\`
|
|
886
|
-
- Static/CDN assets: \`http://localhost:3001\`
|
|
887
|
-
- UI dev server: \`http://localhost:3002\`
|
|
888
|
-
|
|
889
|
-
Default runtime values:
|
|
890
|
-
|
|
891
|
-
- \`TAG=vyriy-profile-card\`
|
|
892
|
-
- \`MODE=open\`
|
|
893
|
-
|
|
894
|
-
Useful API URLs:
|
|
895
|
-
|
|
896
|
-
- Demo HTML: \`http://localhost:3000/\`
|
|
897
|
-
- Prerendered custom element: \`http://localhost:3000/prerender?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3001/avatar.svg\`
|
|
898
|
-
- Semantic JSON-LD: \`http://localhost:3000/semantic?name=Developer&title=Senior%20IT%20Professional&avatarUrl=http://localhost:3001/avatar.svg\`
|
|
899
|
-
- Manifest: \`http://localhost:3000/manifest.yml\`
|
|
900
|
-
|
|
901
|
-
\`/prerender\` and \`/semantic\` require \`name\` and accept optional \`title\`, \`description\`, \`avatarUrl\`, and comma-separated \`tags\`.
|
|
902
|
-
|
|
903
|
-
## Static Assets
|
|
904
|
-
|
|
905
|
-
Static files are served with \`@vyriy/static\`. The package exposes the \`vs\` command, so a globally installed copy can serve any static directory with a small command:
|
|
906
|
-
|
|
907
|
-
\`\`\`bash
|
|
908
|
-
vs -p 3001 workspaces/static/public
|
|
909
|
-
\`\`\`
|
|
910
|
-
|
|
911
|
-
In this project, \`yarn start:static\` runs the same static server through \`npx vs\` and the \`CDN_PORT\` value from \`workspaces/env.sh\`.
|
|
912
|
-
|
|
913
|
-
## Build
|
|
914
|
-
|
|
915
|
-
\`\`\`bash
|
|
916
|
-
yarn build
|
|
917
|
-
\`\`\`
|
|
918
|
-
|
|
919
|
-
The build writes server output to \`dist/api\` and browser/static CDN output to \`dist/cdn\`.
|
|
920
|
-
|
|
921
|
-
## Validation
|
|
922
|
-
|
|
923
|
-
\`\`\`bash
|
|
924
|
-
yarn check
|
|
925
|
-
\`\`\`
|
|
926
|
-
|
|
927
|
-
Focused validation commands:
|
|
928
|
-
|
|
929
|
-
\`\`\`bash
|
|
930
|
-
yarn lint
|
|
931
|
-
yarn test
|
|
932
|
-
yarn build
|
|
933
|
-
\`\`\`
|
|
934
|
-
|
|
935
|
-
## Project Guidance
|
|
936
|
-
|
|
937
|
-
These articles describe the development approach behind this preset and provide practical guidance for evolving a project on top of it:
|
|
938
|
-
|
|
939
|
-
- [Calm Development Environment: Node.js, Corepack, Yarn and Static Preview](https://vyriy.dev/blog/calm-development-setup/) - how to keep the local development environment predictable and easy to reproduce.
|
|
940
|
-
- [Calm App Structure for the Vyriy Ecosystem](https://vyriy.dev/blog/vyriy-calm-app-structure/) - a practical project structure for Vyriy applications: shared configs, small packages, thin workspaces, Storybook docs, tests, and deployable entry points.
|
|
941
|
-
- [One Handler, Many Runtimes](https://vyriy.dev/examples/one-handler-many-runtimes/) - how @vyriy/handler, @vyriy/router, and @vyriy/server compose a calm Lambda-compatible API that can run locally, in Docker, Fargate-style HTTP runtimes, and AWS Lambda.
|
|
942
|
-
- [Calm Component Structure](https://vyriy.dev/blog/calm-component-structure/) - how to organize component code, tests, stories, and public exports.
|
|
943
|
-
- [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/) - how to use Storybook as living project documentation and a component playground.
|
|
944
|
-
`,
|
|
945
|
-
'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
946
|
-
import ReadMe from './README.md?raw';
|
|
947
|
-
|
|
948
|
-
<Meta title="MFE" />
|
|
949
|
-
|
|
950
|
-
<Markdown>{ReadMe}</Markdown>
|
|
951
|
-
`,
|
|
952
|
-
'packages/event/package.json': JSON.stringify({
|
|
953
|
-
name: '@p/event',
|
|
954
|
-
type: 'module',
|
|
955
|
-
private: true,
|
|
956
|
-
}, null, 2) + '\n',
|
|
957
292
|
});
|