@lucasvu/scope-ui 0.1.0 → 0.1.1
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/AI_SETUP.md +308 -45
- package/README.md +80 -7
- package/bin/copy-theme-assets.mjs +29 -0
- package/bin/scope-ui-init.mjs +74 -15
- package/dist/chunk-CL3F2TWE.js +1039 -0
- package/dist/core/index.cjs +1052 -0
- package/dist/core/index.d.cts +963 -0
- package/dist/core/index.d.ts +963 -0
- package/dist/core/index.js +1 -0
- package/dist/index.cjs +180 -3
- package/dist/index.d.cts +2 -855
- package/dist/index.d.ts +2 -855
- package/dist/index.js +4 -872
- package/dist/themes/theme-default.css +343 -0
- package/dist/themes/theme-ui-citrus-ink.css +364 -0
- package/dist/themes/theme-ui-custom-crisp.css +969 -0
- package/dist/themes/theme-ui-facebook-blue.css +381 -0
- package/dist/themes/theme-ui-neo-slate.css +962 -0
- package/dist/themes/theme-ui-new-main-fe-sunset.css +1316 -0
- package/dist/themes/theme-ui-new-main-fe.css +343 -0
- package/dist/themes/theme-ui-pure-white.css +377 -0
- package/dist/themes/theme-ui-siraya-vii-light.css +603 -0
- package/dist/themes/theme-ui-solstice-pop.css +1020 -0
- package/dist/themes/theme-ui-uat-aurora.css +962 -0
- package/package.json +20 -4
package/bin/scope-ui-init.mjs
CHANGED
|
@@ -391,13 +391,14 @@ function createAgentsTemplate({ themeFile, layoutFile, themePreset, layoutPreset
|
|
|
391
391
|
return `# Agent Rules
|
|
392
392
|
|
|
393
393
|
This repo uses \`${PACKAGE_NAME}\` as the default UI library.
|
|
394
|
+
Use \`${PACKAGE_NAME}\` for React components and \`${PACKAGE_NAME}/core\` for framework-agnostic theme/runtime contracts.
|
|
394
395
|
This repo is locked to the \`${themePreset.label}\` theme preset (\`${themePreset.id}\`).
|
|
395
396
|
This repo uses the \`${layoutPreset.label}\` shell preset (\`${layoutPreset.id}\`) as the shared layout baseline.
|
|
396
397
|
|
|
397
398
|
Primary references:
|
|
398
399
|
- \`node_modules/${PACKAGE_NAME}/README.md\`
|
|
399
400
|
- \`node_modules/${PACKAGE_NAME}/AI_SETUP.md\`
|
|
400
|
-
- \`uiScreenBlueprint\` and \`
|
|
401
|
+
- \`uiScreenBlueprint\`, \`uiAiManifest\`, and \`uiThemeLayerAssets\` from \`${PACKAGE_NAME}/core\`
|
|
401
402
|
- \`${themeFile}\`
|
|
402
403
|
- \`${layoutFile}\`
|
|
403
404
|
|
|
@@ -408,20 +409,47 @@ Theme preset summary:
|
|
|
408
409
|
Layout preset summary:
|
|
409
410
|
${renderMarkdownList(layoutPreset.shellRecipe)}
|
|
410
411
|
|
|
412
|
+
## Workspace Base
|
|
413
|
+
|
|
414
|
+
For Vite + micro frontend repos, keep this structure stable:
|
|
415
|
+
|
|
416
|
+
- \`${PACKAGE_NAME}\` owns the React component surface
|
|
417
|
+
- \`${PACKAGE_NAME}/core\` owns theme contracts, bundled theme layers, color-mode runtime, and framework-agnostic contracts
|
|
418
|
+
- \`apps/shell\` owns the shared app shell, top-level routing, remote mounts, and theme imports
|
|
419
|
+
- \`apps/*-mfe\` owns page-level business screens and feature routes
|
|
420
|
+
|
|
421
|
+
If the repo still has a \`packages/shared\` folder, keep it for business utils or internal loaders, not for the primary theme runtime.
|
|
422
|
+
|
|
423
|
+
Recommended folders:
|
|
424
|
+
|
|
425
|
+
- shell: \`src/app\`, \`src/layouts\`, \`src/routes\`, \`src/remotes\`, \`src/styles/ui-theme.css\`
|
|
426
|
+
- remote: \`src/features\`, \`src/pages\`, \`src/routes\`, \`src/services\`, \`src/styles/index.css\`
|
|
427
|
+
|
|
428
|
+
Theme layers:
|
|
429
|
+
|
|
430
|
+
1. Import \`${PACKAGE_NAME}/styles.css\` first.
|
|
431
|
+
2. If the repo wants a bundled shell/theme layer, import one from \`${PACKAGE_NAME}/themes/*\` next.
|
|
432
|
+
3. Import \`${themeFile}\` after the bundled theme layer.
|
|
433
|
+
4. Keep app-specific overrides thin and token-based.
|
|
434
|
+
|
|
435
|
+
If the bundled theme layer is client-theme-scoped, set \`data-client-theme\` with \`applyDocumentClientTheme(...)\`.
|
|
436
|
+
|
|
411
437
|
## Required Flow
|
|
412
438
|
|
|
413
439
|
When asked to build or edit a screen, follow these steps in order:
|
|
414
440
|
|
|
415
441
|
1. Read \`${themeFile}\`, \`${layoutFile}\`, \`node_modules/${PACKAGE_NAME}/README.md\`, \`node_modules/${PACKAGE_NAME}/AI_SETUP.md\`, and the exported \`uiScreenBlueprint\` contract before generating UI.
|
|
416
|
-
2.
|
|
417
|
-
3.
|
|
418
|
-
4.
|
|
419
|
-
5.
|
|
420
|
-
6.
|
|
421
|
-
7.
|
|
422
|
-
8.
|
|
423
|
-
9.
|
|
424
|
-
10.
|
|
442
|
+
2. If the task touches app bootstrap, shell setup, or micro frontend structure, scaffold the repo around the workspace base above before writing page JSX.
|
|
443
|
+
3. Fill the shell brief and screen brief first. If a required field is missing, stop and ask for that exact value before writing JSX. Only leave TODO placeholders when the user explicitly asks for an incomplete scaffold.
|
|
444
|
+
4. Verify the app entry imports \`${PACKAGE_NAME}/styles.css\` first, then any bundled theme layer from \`${PACKAGE_NAME}/themes/*\`, then \`${themeFile}\`.
|
|
445
|
+
5. Treat \`${layoutFile}\` as the source of truth for the app shell. Keep the dark sidebar, gradient topbar, intro card, and card-based body structure aligned with that preset unless the user explicitly asks for a different shell.
|
|
446
|
+
6. Keep the shell in the host app. Do not let a remote rebuild its own global shell unless the task explicitly asks for a standalone shell.
|
|
447
|
+
7. Identify the page kind (\`list | form | detail | dashboard\`), then map each block to canonical components from \`uiAiManifest\` before writing JSX.
|
|
448
|
+
8. Build the shell in this exact order: \`Sidebar\` -> workspace topbar -> intro card (\`Breadcrumb\` + \`PageTitle\`) -> optional segmented tabs -> toolbar card -> page body cards/grids.
|
|
449
|
+
9. For list pages, build the toolbar card first and then the \`DataTable\`. For form pages, keep the same shell and swap the body into section cards and a bottom action row. For detail pages, keep the shell and render summary/detail cards plus related tables. For dashboard pages, keep the shell and render stat cards plus supporting cards/tables.
|
|
450
|
+
10. If \`${layoutFile}\` says a slot is optional, omit it cleanly when the brief does not request it. Do not invent tabs, workspace labels, filters, or toolbar actions.
|
|
451
|
+
11. Keep all colors, radius, surface, and shadow decisions inside \`${themeFile}\`. If the preset is insufficient, update tokens there instead of styling one page ad hoc.
|
|
452
|
+
12. Before finishing, run the output checklist in this file.
|
|
425
453
|
|
|
426
454
|
## Ask For Missing Input
|
|
427
455
|
|
|
@@ -522,12 +550,18 @@ ${renderMarkdownList(layoutPreset.shellRecipe)}
|
|
|
522
550
|
## Hard Rules
|
|
523
551
|
|
|
524
552
|
- import \`${PACKAGE_NAME}/styles.css\` once at the app entry
|
|
525
|
-
- import
|
|
526
|
-
-
|
|
553
|
+
- import a bundled theme layer from \`${PACKAGE_NAME}/themes/*\` after the package stylesheet when the repo chooses one
|
|
554
|
+
- import the project theme override file after the bundled theme layer
|
|
555
|
+
- use \`applyDocumentClientTheme\` when the chosen bundled theme layer is client-theme-scoped
|
|
556
|
+
- use root exports from \`${PACKAGE_NAME}\` for React components
|
|
557
|
+
- use \`${PACKAGE_NAME}/core\` for theme/runtime utilities in non-React or mixed-framework setup
|
|
527
558
|
- use \`${themeFile}\` as the only source of truth for colors, radius, surfaces, and shadows
|
|
528
559
|
- use \`${layoutFile}\` as the source of truth for the shell layout and shared page frame
|
|
529
560
|
- keep layouts and component choices aligned with the shared preset-driven UI used across projects
|
|
561
|
+
- keep the host shell responsible for sidebar, topbar, remote mount, and theme mode
|
|
562
|
+
- keep remotes focused on feature routes and page business content
|
|
530
563
|
- read \`uiAiManifest\` before choosing components
|
|
564
|
+
- read \`uiThemeLayerAssets\` before choosing a bundled theme layer
|
|
531
565
|
- read \`uiThemeContract\` before changing colors, surfaces, borders, radius, or shadows
|
|
532
566
|
- keep UI token-driven and theme-driven
|
|
533
567
|
|
|
@@ -537,6 +571,7 @@ Do not:
|
|
|
537
571
|
- replace the shared dark-sidebar + gradient-topbar shell with a flat blank layout unless the user explicitly requests it
|
|
538
572
|
- restyle individual pages if the preset tokens can solve it globally
|
|
539
573
|
- create duplicate Button/Input/Select wrappers unless a project-specific behavior is required
|
|
574
|
+
- let each remote define a different shell or a different palette
|
|
540
575
|
|
|
541
576
|
## Component Choice
|
|
542
577
|
|
|
@@ -561,6 +596,8 @@ Before finishing, confirm all of these are true:
|
|
|
561
596
|
- No \`MainFe\` imports were used.
|
|
562
597
|
- No hardcoded brand colors were added in page components.
|
|
563
598
|
- Theme decisions live in \`${themeFile}\`, not in ad hoc JSX styling.
|
|
599
|
+
- The app entry import order is package stylesheet -> bundled theme layer if present -> project theme override.
|
|
600
|
+
- The shell still lives in the host app and remotes only own business screens.
|
|
564
601
|
- Spacing, card structure, and actions are consistent with the shared preset.
|
|
565
602
|
- The layout shell stayed stable even if the page body changed.
|
|
566
603
|
`
|
|
@@ -605,6 +642,24 @@ ${layoutPreset.requiredFields.map((item) => ` '${item}',`).join('\n')}
|
|
|
605
642
|
askBeforeCoding: [
|
|
606
643
|
${layoutPreset.askBeforeCoding.map((item) => ` '${item}',`).join('\n')}
|
|
607
644
|
],
|
|
645
|
+
workspaceStructure: {
|
|
646
|
+
packageUi: ['components', 'theme contracts', 'bundled theme layers', 'color-mode runtime'],
|
|
647
|
+
shellApp: ['src/app', 'src/layouts', 'src/routes', 'src/remotes', 'src/styles/ui-theme.css'],
|
|
648
|
+
remoteApp: ['src/features', 'src/pages', 'src/routes', 'src/services', 'src/styles/index.css'],
|
|
649
|
+
},
|
|
650
|
+
themeLayers: [
|
|
651
|
+
'${PACKAGE_NAME}/styles.css',
|
|
652
|
+
'${PACKAGE_NAME}/themes/theme-ui-new-main-fe.css (optional bundled package layer)',
|
|
653
|
+
'${themeFile}',
|
|
654
|
+
],
|
|
655
|
+
setupSteps: [
|
|
656
|
+
'Import the package stylesheet once at the host app entry.',
|
|
657
|
+
'If the app wants a bundled package theme layer, import it after the package stylesheet.',
|
|
658
|
+
'Import the project themeSource after the bundled theme layer.',
|
|
659
|
+
'If the chosen theme layer is client-theme-scoped, set data-client-theme at the document root.',
|
|
660
|
+
'Initialize color mode at the host app entry and let the host own shell/theme concerns.',
|
|
661
|
+
'Keep remotes focused on feature routes and business screens instead of rebuilding the global shell.',
|
|
662
|
+
],
|
|
608
663
|
shell: {
|
|
609
664
|
sidebar: {
|
|
610
665
|
tone: 'dark',
|
|
@@ -641,6 +696,8 @@ ${layoutPreset.askBeforeCoding.map((item) => ` '${item}',`).join('\n')}
|
|
|
641
696
|
'Keep the dark sidebar and gradient topbar shell stable across screens.',
|
|
642
697
|
'Do not replace the intro card with a bare page title row.',
|
|
643
698
|
'Use the shared theme tokens from the themeSource file for color, border, surface, and shadow decisions.',
|
|
699
|
+
'Import theme layers in this order: package stylesheet, bundled package theme layer when present, then themeSource.',
|
|
700
|
+
'Keep the host app responsible for the global shell and keep remotes page-scoped.',
|
|
644
701
|
'Only omit tabs or toolbar sections when the brief explicitly leaves them out.',
|
|
645
702
|
'Ask for missing required fields before generating JSX instead of guessing from the screenshot.',
|
|
646
703
|
],
|
|
@@ -720,6 +777,8 @@ console.log(`- ${layoutResult.path}: ${layoutResult.status}`)
|
|
|
720
777
|
console.log('')
|
|
721
778
|
console.log('Next steps:')
|
|
722
779
|
console.log(`1. Import \`${PACKAGE_NAME}/styles.css\` once at your app entry.`)
|
|
723
|
-
console.log(`2.
|
|
724
|
-
console.log(`3.
|
|
725
|
-
console.log(`4.
|
|
780
|
+
console.log(`2. If you want a bundled package theme layer, import one from \`${PACKAGE_NAME}/themes/*\` right after the package stylesheet.`)
|
|
781
|
+
console.log(`3. Import \`${options.themeFile}\` after the bundled theme layer.`)
|
|
782
|
+
console.log(`4. Let your agent read \`${options.agentsFile}\` and \`${options.layoutFile}\` before generating UI.`)
|
|
783
|
+
console.log('5. Keep the host app responsible for the global shell and keep remotes page-scoped.')
|
|
784
|
+
console.log(`6. Re-run this command with \`--theme <preset> --force\` if you want another approved preset.`)
|