@loomweaver/devkit 0.7.3 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/recipes/angular-distribution/readme.d.ts +2 -0
- package/src/recipes/angular-distribution/readme.js +215 -0
- package/src/recipes/angular-distribution/readme.js.map +1 -0
- package/src/recipes/angular-distribution/recipe.js +9 -168
- package/src/recipes/angular-distribution/recipe.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomweaver/devkit",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "LoomWeaver scaffolding for Nx workspaces: generators for weavers, distributions, frame plugins and the integration seams, plus the manifest and i18n validators.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"loomweaver",
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readme = readme;
|
|
4
|
+
function stylesNotes(d) {
|
|
5
|
+
if (d.styles === 'precompiled') {
|
|
6
|
+
return [
|
|
7
|
+
'`src/styles.css` imports the stylesheet **we** compiled — tokens, the `.lw-*` class contracts',
|
|
8
|
+
"and every utility the shell's own templates use, 67 KB minified and 11 KB over the wire. There",
|
|
9
|
+
'is nothing to install and nothing to configure: no `tailwindcss`, no `.postcssrc.json`, no',
|
|
10
|
+
'`@source` paths to miscount.',
|
|
11
|
+
'',
|
|
12
|
+
'What you give up is writing Tailwind utilities in *your own* templates. The `--lw-*` tokens stay',
|
|
13
|
+
'available to any CSS you write, so re-theming stays a token remap rather than a fight.',
|
|
14
|
+
'',
|
|
15
|
+
'If you bring a CSS framework of your own, **import it into a cascade layer** — the file says how,',
|
|
16
|
+
'and it is the one decision that determines whether the chrome survives the introduction. Prefer',
|
|
17
|
+
'Tailwind after all? Re-run the scaffold with `--styles tailwind`.',
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
return [
|
|
21
|
+
"`src/styles.css` compiles the shell's source theme with Tailwind 4, which is also what lets you",
|
|
22
|
+
'write Tailwind utilities in your own templates. The scaffold wrote `.postcssrc.json` beside your',
|
|
23
|
+
'`package.json` for you, because without it the stylesheet is read as plain CSS: no utility class',
|
|
24
|
+
'is emitted, the workbench renders unstyled, and the build still reports success. The packages are',
|
|
25
|
+
'the one thing left, because a scaffold does not install:',
|
|
26
|
+
'',
|
|
27
|
+
'```sh',
|
|
28
|
+
'npm install -D tailwindcss @tailwindcss/postcss @tailwindcss/typography',
|
|
29
|
+
'```',
|
|
30
|
+
'',
|
|
31
|
+
'Use **semantic tokens only** in your own templates (`bg-surface`, `text-content`, `text-brand`,',
|
|
32
|
+
'`border-border`), never raw palette colours.',
|
|
33
|
+
'',
|
|
34
|
+
'**Count the `../` hops in the `@source` line.** It is resolved from the stylesheet, not from the',
|
|
35
|
+
'workspace root, and the scaffold derived it from where this project sits. Move the project and',
|
|
36
|
+
"nothing errors — Tailwind simply emits none of the shell's classes and the app renders unstyled.",
|
|
37
|
+
'',
|
|
38
|
+
'Want none of this? Re-run the scaffold with `--styles precompiled` and you get a one-line',
|
|
39
|
+
'stylesheet that needs no Tailwind at all — the right choice if your product is themed with',
|
|
40
|
+
'Bootstrap, Bulma or hand-written CSS.',
|
|
41
|
+
];
|
|
42
|
+
}
|
|
43
|
+
function readme(d) {
|
|
44
|
+
return [
|
|
45
|
+
`# ${d.title} — a LoomWeaver distribution`,
|
|
46
|
+
'',
|
|
47
|
+
`The composition root that assembles the platform into a shippable product. It renders the bare`,
|
|
48
|
+
`shell out of the box; add your weavers and branding below. Your own README is untouched — the`,
|
|
49
|
+
`scaffold writes its notes here so it can never overwrite prose you wrote.`,
|
|
50
|
+
'',
|
|
51
|
+
'## Run it',
|
|
52
|
+
'',
|
|
53
|
+
'In an Nx workspace (the generator wired the project):',
|
|
54
|
+
'',
|
|
55
|
+
'```sh',
|
|
56
|
+
`nx serve ${d.name}`,
|
|
57
|
+
'```',
|
|
58
|
+
'',
|
|
59
|
+
'Scaffolded over the CLI or MCP, these files are sources without build wiring — drop them into',
|
|
60
|
+
"an application you already serve (`ng new`, or an Nx application). They keep Angular's own",
|
|
61
|
+
'shape: `main.ts` bootstraps `App`, `App` renders `<lw-shell />`, and everything this product is',
|
|
62
|
+
'made of lives in `app.config.ts`. Nothing of the generated app is deleted. Over an existing',
|
|
63
|
+
'application `--force` replaces exactly the files above — all of them bootstrap wiring, none of',
|
|
64
|
+
'them content you authored. Under Nx it additionally merges the build targets into that',
|
|
65
|
+
"project's `project.json`, keeping the targets, `implicitDependencies` and tags it already had.",
|
|
66
|
+
'',
|
|
67
|
+
'Two leftovers from `ng new` are no longer referenced and can go: `src/app/app.routes.ts` (the',
|
|
68
|
+
'shell owns content routing via `provideShellRouter()`) and `src/app/app.css`. The generated',
|
|
69
|
+
'`src/app/app.spec.ts` now fails — `App` pulls the whole shell into a bare `TestBed` — so delete',
|
|
70
|
+
'it and test your own components instead of the composition root.',
|
|
71
|
+
'',
|
|
72
|
+
'The project is generated **untagged**: Nx tags belong to your `depConstraints`, and inventing',
|
|
73
|
+
'one would fail a lint policy you never opted this project into. If your workspace enforces',
|
|
74
|
+
'module boundaries, give it tags your constraints allow — `--tags` at generation time, or',
|
|
75
|
+
'`tags` in `project.json` afterwards.',
|
|
76
|
+
'',
|
|
77
|
+
'## Compose weavers + branding (in `src/app/app.config.ts`)',
|
|
78
|
+
'',
|
|
79
|
+
'The layout is already there. Adding a weaver is three providers plus its import — note the',
|
|
80
|
+
'**spread**, since `providePlugins` is variadic and returns an array:',
|
|
81
|
+
'',
|
|
82
|
+
'```ts',
|
|
83
|
+
"import { providePlugins, provideCapabilityGrants, provideTranslationNamespaces } from '@loomweaver/shell';",
|
|
84
|
+
"import { notesPlugin } from '@acme/notes-weaver'; // Nx: the workspace alias; otherwise a relative path",
|
|
85
|
+
'',
|
|
86
|
+
" provideTranslationNamespaces('notes'),",
|
|
87
|
+
" provideCapabilityGrants({ notes: ['contributions', 'ui', 'navigation'] }),",
|
|
88
|
+
' ...providePlugins(notesPlugin),',
|
|
89
|
+
'```',
|
|
90
|
+
'',
|
|
91
|
+
"Grant exactly what the weaver's manifest declares — the broker is default-deny, so an ungranted",
|
|
92
|
+
'plugin throws `CapabilityError` instead of quietly doing less. A weaver also needs its',
|
|
93
|
+
'translations served: add an assets glob for its `src/lib/i18n` under `i18n/<id>` (the Nx',
|
|
94
|
+
'generator does this for you).',
|
|
95
|
+
'',
|
|
96
|
+
'`public/logo.svg` is the LoomWeaver mark, dropped in as a placeholder so the top bar renders',
|
|
97
|
+
'something from the first run instead of a broken image. Replace it with your own — any square',
|
|
98
|
+
'image will do; `logoUrl` resolves against your served root. `tagline` is a',
|
|
99
|
+
'translation key that falls back to rendering itself, so the literal above works but makes',
|
|
100
|
+
'Transloco log a missing-translation warning in dev; point it at a key of your own to silence it.',
|
|
101
|
+
'',
|
|
102
|
+
'That same file is also the **app icon**: the browser tab reads it, and the manifest names it so',
|
|
103
|
+
'the app has an icon at all. One gap is left on purpose, because a scaffold writes text and',
|
|
104
|
+
'cannot invent your artwork: **Chromium only offers installation once the manifest names a 192',
|
|
105
|
+
'and a 512 raster icon**, and iOS ignores manifest icons entirely in favour of',
|
|
106
|
+
'`apple-touch-icon`. Drop `icon-192.png` and `icon-512.png` next to the logo, add them to the',
|
|
107
|
+
"manifest's `icons` and add an `apple-touch-icon` link to `index.html`, and the app becomes",
|
|
108
|
+
'installable. Until then it runs and caches offline, it simply is not offered for installation.',
|
|
109
|
+
'',
|
|
110
|
+
'## The two searches, and the badges that say so',
|
|
111
|
+
'',
|
|
112
|
+
'The shell seeds two searches and binds them itself: `mod+k` opens the command search, `mod+p`',
|
|
113
|
+
'the search over open work (`mod` is ⌘ on macOS, Ctrl elsewhere). Both work whether or not you',
|
|
114
|
+
'do anything. What the generated `app.config.ts` adds is only the way to *see* them: a badge in',
|
|
115
|
+
'the top bar for the command search, one at the leading edge of the status bar for open work,',
|
|
116
|
+
'each printing its own chord in the spelling of the platform it runs on.',
|
|
117
|
+
'',
|
|
118
|
+
'They are placed apart on purpose. Two identical-looking search badges side by side in the top',
|
|
119
|
+
'bar read as a duplicate rather than as two different things.',
|
|
120
|
+
'',
|
|
121
|
+
'```ts',
|
|
122
|
+
'provideCommandPaletteEntry(); // top bar, end slot, order 5',
|
|
123
|
+
"provideQuickOpenEntry({ bar: 'top-bar', order: 4 }); // …or put it wherever you want",
|
|
124
|
+
'```',
|
|
125
|
+
'',
|
|
126
|
+
'A badge never outlives what it opens. Drop the search and its badge goes with it; the same',
|
|
127
|
+
'happens for a session that may not run it. You will not be left with a control that does',
|
|
128
|
+
'nothing. Switching shortcuts off is the one exception: the badge stays and still opens the',
|
|
129
|
+
'search, it simply prints no chord, because nothing here advertises a key that does nothing.',
|
|
130
|
+
'',
|
|
131
|
+
'Four things you may want, and the line for each:',
|
|
132
|
+
'',
|
|
133
|
+
'```ts',
|
|
134
|
+
'// 1. Keep the search, drop only the badge — it then opens by shortcut alone.',
|
|
135
|
+
"provideShell({ omit: ['shell.commandPaletteEntry', 'shell.quickOpenEntry'] }),",
|
|
136
|
+
'',
|
|
137
|
+
'// 2. Drop the search itself. This takes mod+p with it: the chord is derived from the',
|
|
138
|
+
'// registered command, so removing the command unbinds the key. The badge goes too.',
|
|
139
|
+
"provideShell({ omit: ['shell.quickOpen'] }),",
|
|
140
|
+
'',
|
|
141
|
+
'// 3. Make mod+k run something of yours, keeping the shell\'s id. Last registration wins,',
|
|
142
|
+
"// so your command replaces the built-in one and inherits its place everywhere.",
|
|
143
|
+
"// Register it from your own plugin with the id 'shell.commandPalette'.",
|
|
144
|
+
'',
|
|
145
|
+
'// 4. Bind mod+k to a command of your own, under your own id.',
|
|
146
|
+
"provideShell({ omit: ['shell.commandPalette'] }), // …then declare shortcut: 'mod+k' on yours",
|
|
147
|
+
'```',
|
|
148
|
+
'',
|
|
149
|
+
'What not to do is the fifth case: declaring `mod+k` on a command of your own while the',
|
|
150
|
+
'built-in one is still registered. Two commands then hold one chord. The shell warns about it in',
|
|
151
|
+
'the console and the later registration wins, but which registration is later is not something',
|
|
152
|
+
'your composition root decides. Omit the built-in, or take its id. Never race it.',
|
|
153
|
+
'',
|
|
154
|
+
'## Styles',
|
|
155
|
+
'',
|
|
156
|
+
...stylesNotes(d),
|
|
157
|
+
'',
|
|
158
|
+
'## Build wiring',
|
|
159
|
+
'',
|
|
160
|
+
'The scaffold did this. Your build target now names the stylesheet, three asset globs, the',
|
|
161
|
+
'service worker and one production setting, and the run that wrote these files listed each one it',
|
|
162
|
+
'added. Anything you had already set was left exactly as you set it.',
|
|
163
|
+
'',
|
|
164
|
+
'What each is for, so that nobody removes one as clutter. The **`@loomweaver/shell/i18n` glob**',
|
|
165
|
+
'serves the strings the shell fetches at runtime; without it every label in the chrome renders as',
|
|
166
|
+
'its raw translation key and nothing errors. The **frame-kit** glob only matters if you host',
|
|
167
|
+
'sandboxed (iframe) plugins — until you install that package the glob simply matches nothing.',
|
|
168
|
+
'**`serviceWorker`** emits the worker that `provideShell()` already registers for you (inert in',
|
|
169
|
+
'dev) — never add `provideServiceWorker` yourself, and if you would rather ship no worker at all,',
|
|
170
|
+
'drop `ngsw-config.json` and pass `provideShell({ serviceWorker: false })`, because otherwise the',
|
|
171
|
+
'registration 404s in production. **`optimization.styles.inlineCritical: false`** is not optional:',
|
|
172
|
+
"the `index.html` above ships a strict `script-src 'self'`, and Angular's critical-CSS pass loads",
|
|
173
|
+
'the stylesheet with an **inline** `onload` handler that the policy blocks — the app then renders',
|
|
174
|
+
'completely unstyled, and only in production builds.',
|
|
175
|
+
'',
|
|
176
|
+
'One thing is still yours, because the scaffold cannot know your budget: a production build warns',
|
|
177
|
+
"that the initial bundle exceeds Angular's 500 kB default. The shell is a whole application",
|
|
178
|
+
'chrome, so raise the budgets in your build target.',
|
|
179
|
+
'',
|
|
180
|
+
'## Ship less than the whole workbench',
|
|
181
|
+
'',
|
|
182
|
+
'The shell arrives with every capability on: splitting, dragging tabs between panes, pinning,',
|
|
183
|
+
'stacking views, pop-out windows, keyboard shortcuts, the curation checklists. A product whose',
|
|
184
|
+
'users would be overwhelmed by that switches parts off in the same providers array:',
|
|
185
|
+
'',
|
|
186
|
+
'```ts',
|
|
187
|
+
"import { provideShellFeatures } from '@loomweaver/shell';",
|
|
188
|
+
'',
|
|
189
|
+
' provideShellFeatures({',
|
|
190
|
+
' content: { splitRight: false, splitDown: false, moveTabs: false },',
|
|
191
|
+
' sidebar: { stackViews: false },',
|
|
192
|
+
' windows: { popout: false },',
|
|
193
|
+
' }),',
|
|
194
|
+
'```',
|
|
195
|
+
'',
|
|
196
|
+
'A switch takes the **affordance and the gesture**: turning `splitRight` off removes the toolbar',
|
|
197
|
+
'button, the drop edges *and* `mod+\\`, so the capability cannot come back through a second door.',
|
|
198
|
+
'Fields merge group by group, so name only what you turn off. The groups are `content`,',
|
|
199
|
+
'`sidebar`, `rail`, `workspaces`, `windows` and `commands`; everything is on by default except',
|
|
200
|
+
'`content.escalate`, the unlabelled double-click cycle on a tab.',
|
|
201
|
+
'',
|
|
202
|
+
'That provider is for **gestures**. A command, a bar or rail item, a settings row or a menu entry',
|
|
203
|
+
'is a *contribution* and goes instead — by id — into `provideShell({ omit: [...] })`. Where a',
|
|
204
|
+
'capability is both, the feature switch wins and takes the menu entry with it.',
|
|
205
|
+
'',
|
|
206
|
+
'A product backend is optional: implement the settings-store / auth-source ports',
|
|
207
|
+
'(`provideSettingsStore` / `provideAuthSource`, both against the `KeyValueStore` shape)',
|
|
208
|
+
'with your own backend, or keep the local/anonymous defaults for a standalone UI.',
|
|
209
|
+
'Working state stays on `WORKING_STATE_STORE` and never reaches your',
|
|
210
|
+
'settings backend; back it separately with `provideWorkingStateStore` only if',
|
|
211
|
+
'working state should travel across devices.',
|
|
212
|
+
'',
|
|
213
|
+
].join('\n');
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=readme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readme.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/recipes/angular-distribution/readme.ts"],"names":[],"mappings":";;AA0CA,wBA2KC;AAnND,SAAS,WAAW,CAAC,CAAuB;IAC1C,IAAI,CAAC,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;QAC/B,OAAO;YACL,+FAA+F;YAC/F,gGAAgG;YAChG,4FAA4F;YAC5F,8BAA8B;YAC9B,EAAE;YACF,kGAAkG;YAClG,wFAAwF;YACxF,EAAE;YACF,mGAAmG;YACnG,iGAAiG;YACjG,mEAAmE;SACpE,CAAC;IACJ,CAAC;IACD,OAAO;QACL,iGAAiG;QACjG,kGAAkG;QAClG,kGAAkG;QAClG,mGAAmG;QACnG,0DAA0D;QAC1D,EAAE;QACF,OAAO;QACP,yEAAyE;QACzE,KAAK;QACL,EAAE;QACF,iGAAiG;QACjG,8CAA8C;QAC9C,EAAE;QACF,kGAAkG;QAClG,gGAAgG;QAChG,kGAAkG;QAClG,EAAE;QACF,2FAA2F;QAC3F,4FAA4F;QAC5F,uCAAuC;KACxC,CAAC;AACJ,CAAC;AAED,SAAgB,MAAM,CAAC,CAAuB;IAC5C,OAAO;QACL,KAAK,CAAC,CAAC,KAAK,8BAA8B;QAC1C,EAAE;QACF,gGAAgG;QAChG,+FAA+F;QAC/F,2EAA2E;QAC3E,EAAE;QACF,WAAW;QACX,EAAE;QACF,uDAAuD;QACvD,EAAE;QACF,OAAO;QACP,YAAY,CAAC,CAAC,IAAI,EAAE;QACpB,KAAK;QACL,EAAE;QACF,+FAA+F;QAC/F,4FAA4F;QAC5F,iGAAiG;QACjG,6FAA6F;QAC7F,gGAAgG;QAChG,wFAAwF;QACxF,gGAAgG;QAChG,EAAE;QACF,+FAA+F;QAC/F,6FAA6F;QAC7F,iGAAiG;QACjG,kEAAkE;QAClE,EAAE;QACF,+FAA+F;QAC/F,4FAA4F;QAC5F,0FAA0F;QAC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AE;QACF,gGAAgG;QAChG,kGAAkG;QAClG,6FAA6F;QAC7F,8FAA8F;QAC9F,gGAAgG;QAChG,kGAAkG;QAClG,kGAAkG;QAClG,mGAAmG;QACnG,kGAAkG;QAClG,kGAAkG;QAClG,qDAAqD;QACrD,EAAE;QACF,kGAAkG;QAClG,4FAA4F;QAC5F,oDAAoD;QACpD,EAAE;QACF,uCAAuC;QACvC,EAAE;QACF,8FAA8F;QAC9F,+FAA+F;QAC/F,oFAAoF;QACpF,EAAE;QACF,OAAO;QACP,2DAA2D;QAC3D,EAAE;QACF,4BAA4B;QAC5B,0EAA0E;QAC1E,uCAAuC;QACvC,mCAAmC;QACnC,SAAS;QACT,KAAK;QACL,EAAE;QACF,iGAAiG;QACjG,kGAAkG;QAClG,wFAAwF;QACxF,+FAA+F;QAC/F,iEAAiE;QACjE,EAAE;QACF,kGAAkG;QAClG,8FAA8F;QAC9F,+EAA+E;QAC/E,EAAE;QACF,iFAAiF;QACjF,wFAAwF;QACxF,kFAAkF;QAClF,qEAAqE;QACrE,8EAA8E;QAC9E,6CAA6C;QAC7C,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -6,6 +6,7 @@ const amendments_1 = require("./amendments");
|
|
|
6
6
|
const casing_1 = require("../../lib/generate/casing");
|
|
7
7
|
const shell_regions_1 = require("../shell-regions");
|
|
8
8
|
const logo_1 = require("./logo");
|
|
9
|
+
const readme_1 = require("./readme");
|
|
9
10
|
const STYLES = ['tailwind', 'precompiled'];
|
|
10
11
|
function resolveDistributionInput(input) {
|
|
11
12
|
var _a, _b;
|
|
@@ -39,7 +40,9 @@ bootstrapApplication(App, appConfig).catch((err) => console.error(err));
|
|
|
39
40
|
function appConfigTs(d) {
|
|
40
41
|
return `import { ApplicationConfig } from '@angular/core';
|
|
41
42
|
import {
|
|
43
|
+
provideCommandPaletteEntry,
|
|
42
44
|
provideLayout,
|
|
45
|
+
provideQuickOpenEntry,
|
|
43
46
|
provideShell,
|
|
44
47
|
provideShellRouter,
|
|
45
48
|
type ShellLayout,
|
|
@@ -64,6 +67,11 @@ export const appConfig: ApplicationConfig = {
|
|
|
64
67
|
provideShellRouter(),
|
|
65
68
|
provideShell(),
|
|
66
69
|
provideLayout(layout),
|
|
70
|
+
/* The two searches the shell seeds: mod+k over commands, mod+p over open work. Both work
|
|
71
|
+
without these two lines; these put the shortcut on screen for a user who does not know
|
|
72
|
+
it. Delete either one, or pass { bar, slot, order } to place it elsewhere. */
|
|
73
|
+
provideCommandPaletteEntry(),
|
|
74
|
+
provideQuickOpenEntry(),
|
|
67
75
|
provideProductIdentity({
|
|
68
76
|
name: '${d.title}',
|
|
69
77
|
tagline: 'Built on LoomWeaver',
|
|
@@ -212,173 +220,6 @@ function manifest(d) {
|
|
|
212
220
|
icons: [{ src: 'logo.svg', type: 'image/svg+xml', sizes: 'any' }],
|
|
213
221
|
}, null, 2);
|
|
214
222
|
}
|
|
215
|
-
function stylesNotes(d) {
|
|
216
|
-
if (d.styles === 'precompiled') {
|
|
217
|
-
return [
|
|
218
|
-
'`src/styles.css` imports the stylesheet **we** compiled — tokens, the `.lw-*` class contracts',
|
|
219
|
-
"and every utility the shell's own templates use, 67 KB minified and 11 KB over the wire. There",
|
|
220
|
-
'is nothing to install and nothing to configure: no `tailwindcss`, no `.postcssrc.json`, no',
|
|
221
|
-
'`@source` paths to miscount.',
|
|
222
|
-
'',
|
|
223
|
-
'What you give up is writing Tailwind utilities in *your own* templates. The `--lw-*` tokens stay',
|
|
224
|
-
'available to any CSS you write, so re-theming stays a token remap rather than a fight.',
|
|
225
|
-
'',
|
|
226
|
-
'If you bring a CSS framework of your own, **import it into a cascade layer** — the file says how,',
|
|
227
|
-
'and it is the one decision that determines whether the chrome survives the introduction. Prefer',
|
|
228
|
-
'Tailwind after all? Re-run the scaffold with `--styles tailwind`.',
|
|
229
|
-
];
|
|
230
|
-
}
|
|
231
|
-
return [
|
|
232
|
-
"`src/styles.css` compiles the shell's source theme with Tailwind 4, which is also what lets you",
|
|
233
|
-
'write Tailwind utilities in your own templates. The scaffold wrote `.postcssrc.json` beside your',
|
|
234
|
-
'`package.json` for you, because without it the stylesheet is read as plain CSS: no utility class',
|
|
235
|
-
'is emitted, the workbench renders unstyled, and the build still reports success. The packages are',
|
|
236
|
-
'the one thing left, because a scaffold does not install:',
|
|
237
|
-
'',
|
|
238
|
-
'```sh',
|
|
239
|
-
'npm install -D tailwindcss @tailwindcss/postcss @tailwindcss/typography',
|
|
240
|
-
'```',
|
|
241
|
-
'',
|
|
242
|
-
'Use **semantic tokens only** in your own templates (`bg-surface`, `text-content`, `text-brand`,',
|
|
243
|
-
'`border-border`), never raw palette colours.',
|
|
244
|
-
'',
|
|
245
|
-
'**Count the `../` hops in the `@source` line.** It is resolved from the stylesheet, not from the',
|
|
246
|
-
'workspace root, and the scaffold derived it from where this project sits. Move the project and',
|
|
247
|
-
"nothing errors — Tailwind simply emits none of the shell's classes and the app renders unstyled.",
|
|
248
|
-
'',
|
|
249
|
-
'Want none of this? Re-run the scaffold with `--styles precompiled` and you get a one-line',
|
|
250
|
-
'stylesheet that needs no Tailwind at all — the right choice if your product is themed with',
|
|
251
|
-
'Bootstrap, Bulma or hand-written CSS.',
|
|
252
|
-
];
|
|
253
|
-
}
|
|
254
|
-
function readme(d) {
|
|
255
|
-
return [
|
|
256
|
-
`# ${d.title} — a LoomWeaver distribution`,
|
|
257
|
-
'',
|
|
258
|
-
`The composition root that assembles the platform into a shippable product. It renders the bare`,
|
|
259
|
-
`shell out of the box; add your weavers and branding below. Your own README is untouched — the`,
|
|
260
|
-
`scaffold writes its notes here so it can never overwrite prose you wrote.`,
|
|
261
|
-
'',
|
|
262
|
-
'## Run it',
|
|
263
|
-
'',
|
|
264
|
-
'In an Nx workspace (the generator wired the project):',
|
|
265
|
-
'',
|
|
266
|
-
'```sh',
|
|
267
|
-
`nx serve ${d.name}`,
|
|
268
|
-
'```',
|
|
269
|
-
'',
|
|
270
|
-
'Scaffolded over the CLI or MCP, these files are sources without build wiring — drop them into',
|
|
271
|
-
"an application you already serve (`ng new`, or an Nx application). They keep Angular's own",
|
|
272
|
-
'shape: `main.ts` bootstraps `App`, `App` renders `<lw-shell />`, and everything this product is',
|
|
273
|
-
'made of lives in `app.config.ts`. Nothing of the generated app is deleted. Over an existing',
|
|
274
|
-
'application `--force` replaces exactly the files above — all of them bootstrap wiring, none of',
|
|
275
|
-
'them content you authored. Under Nx it additionally merges the build targets into that',
|
|
276
|
-
"project's `project.json`, keeping the targets, `implicitDependencies` and tags it already had.",
|
|
277
|
-
'',
|
|
278
|
-
'Two leftovers from `ng new` are no longer referenced and can go: `src/app/app.routes.ts` (the',
|
|
279
|
-
'shell owns content routing via `provideShellRouter()`) and `src/app/app.css`. The generated',
|
|
280
|
-
'`src/app/app.spec.ts` now fails — `App` pulls the whole shell into a bare `TestBed` — so delete',
|
|
281
|
-
'it and test your own components instead of the composition root.',
|
|
282
|
-
'',
|
|
283
|
-
'The project is generated **untagged**: Nx tags belong to your `depConstraints`, and inventing',
|
|
284
|
-
'one would fail a lint policy you never opted this project into. If your workspace enforces',
|
|
285
|
-
'module boundaries, give it tags your constraints allow — `--tags` at generation time, or',
|
|
286
|
-
'`tags` in `project.json` afterwards.',
|
|
287
|
-
'',
|
|
288
|
-
'## Compose weavers + branding (in `src/app/app.config.ts`)',
|
|
289
|
-
'',
|
|
290
|
-
'The layout is already there. Adding a weaver is three providers plus its import — note the',
|
|
291
|
-
'**spread**, since `providePlugins` is variadic and returns an array:',
|
|
292
|
-
'',
|
|
293
|
-
'```ts',
|
|
294
|
-
"import { providePlugins, provideCapabilityGrants, provideTranslationNamespaces } from '@loomweaver/shell';",
|
|
295
|
-
"import { notesPlugin } from '@acme/notes-weaver'; // Nx: the workspace alias; otherwise a relative path",
|
|
296
|
-
'',
|
|
297
|
-
" provideTranslationNamespaces('notes'),",
|
|
298
|
-
" provideCapabilityGrants({ notes: ['contributions', 'ui', 'navigation'] }),",
|
|
299
|
-
' ...providePlugins(notesPlugin),',
|
|
300
|
-
'```',
|
|
301
|
-
'',
|
|
302
|
-
"Grant exactly what the weaver's manifest declares — the broker is default-deny, so an ungranted",
|
|
303
|
-
'plugin throws `CapabilityError` instead of quietly doing less. A weaver also needs its',
|
|
304
|
-
'translations served: add an assets glob for its `src/lib/i18n` under `i18n/<id>` (the Nx',
|
|
305
|
-
'generator does this for you).',
|
|
306
|
-
'',
|
|
307
|
-
'`public/logo.svg` is the LoomWeaver mark, dropped in as a placeholder so the top bar renders',
|
|
308
|
-
'something from the first run instead of a broken image. Replace it with your own — any square',
|
|
309
|
-
'image will do; `logoUrl` resolves against your served root. `tagline` is a',
|
|
310
|
-
'translation key that falls back to rendering itself, so the literal above works but makes',
|
|
311
|
-
'Transloco log a missing-translation warning in dev; point it at a key of your own to silence it.',
|
|
312
|
-
'',
|
|
313
|
-
'That same file is also the **app icon**: the browser tab reads it, and the manifest names it so',
|
|
314
|
-
'the app has an icon at all. One gap is left on purpose, because a scaffold writes text and',
|
|
315
|
-
'cannot invent your artwork: **Chromium only offers installation once the manifest names a 192',
|
|
316
|
-
'and a 512 raster icon**, and iOS ignores manifest icons entirely in favour of',
|
|
317
|
-
'`apple-touch-icon`. Drop `icon-192.png` and `icon-512.png` next to the logo, add them to the',
|
|
318
|
-
"manifest's `icons` and add an `apple-touch-icon` link to `index.html`, and the app becomes",
|
|
319
|
-
'installable. Until then it runs and caches offline, it simply is not offered for installation.',
|
|
320
|
-
'',
|
|
321
|
-
'## Styles',
|
|
322
|
-
'',
|
|
323
|
-
...stylesNotes(d),
|
|
324
|
-
'',
|
|
325
|
-
'## Build wiring',
|
|
326
|
-
'',
|
|
327
|
-
'The scaffold did this. Your build target now names the stylesheet, three asset globs, the',
|
|
328
|
-
'service worker and one production setting, and the run that wrote these files listed each one it',
|
|
329
|
-
'added. Anything you had already set was left exactly as you set it.',
|
|
330
|
-
'',
|
|
331
|
-
'What each is for, so that nobody removes one as clutter. The **`@loomweaver/shell/i18n` glob**',
|
|
332
|
-
'serves the strings the shell fetches at runtime; without it every label in the chrome renders as',
|
|
333
|
-
'its raw translation key and nothing errors. The **frame-kit** glob only matters if you host',
|
|
334
|
-
'sandboxed (iframe) plugins — until you install that package the glob simply matches nothing.',
|
|
335
|
-
'**`serviceWorker`** emits the worker that `provideShell()` already registers for you (inert in',
|
|
336
|
-
'dev) — never add `provideServiceWorker` yourself, and if you would rather ship no worker at all,',
|
|
337
|
-
'drop `ngsw-config.json` and pass `provideShell({ serviceWorker: false })`, because otherwise the',
|
|
338
|
-
'registration 404s in production. **`optimization.styles.inlineCritical: false`** is not optional:',
|
|
339
|
-
"the `index.html` above ships a strict `script-src 'self'`, and Angular's critical-CSS pass loads",
|
|
340
|
-
'the stylesheet with an **inline** `onload` handler that the policy blocks — the app then renders',
|
|
341
|
-
'completely unstyled, and only in production builds.',
|
|
342
|
-
'',
|
|
343
|
-
'One thing is still yours, because the scaffold cannot know your budget: a production build warns',
|
|
344
|
-
"that the initial bundle exceeds Angular's 500 kB default. The shell is a whole application",
|
|
345
|
-
'chrome, so raise the budgets in your build target.',
|
|
346
|
-
'',
|
|
347
|
-
'## Ship less than the whole workbench',
|
|
348
|
-
'',
|
|
349
|
-
'The shell arrives with every capability on: splitting, dragging tabs between panes, pinning,',
|
|
350
|
-
'stacking views, pop-out windows, keyboard shortcuts, the curation checklists. A product whose',
|
|
351
|
-
'users would be overwhelmed by that switches parts off in the same providers array:',
|
|
352
|
-
'',
|
|
353
|
-
'```ts',
|
|
354
|
-
"import { provideShellFeatures } from '@loomweaver/shell';",
|
|
355
|
-
'',
|
|
356
|
-
' provideShellFeatures({',
|
|
357
|
-
' content: { splitRight: false, splitDown: false, moveTabs: false },',
|
|
358
|
-
' sidebar: { stackViews: false },',
|
|
359
|
-
' windows: { popout: false },',
|
|
360
|
-
' }),',
|
|
361
|
-
'```',
|
|
362
|
-
'',
|
|
363
|
-
'A switch takes the **affordance and the gesture**: turning `splitRight` off removes the toolbar',
|
|
364
|
-
'button, the drop edges *and* `mod+\\`, so the capability cannot come back through a second door.',
|
|
365
|
-
'Fields merge group by group, so name only what you turn off. The groups are `content`,',
|
|
366
|
-
'`sidebar`, `rail`, `workspaces`, `windows` and `commands`; everything is on by default except',
|
|
367
|
-
'`content.escalate`, the unlabelled double-click cycle on a tab.',
|
|
368
|
-
'',
|
|
369
|
-
'That provider is for **gestures**. A command, a bar or rail item, a settings row or a menu entry',
|
|
370
|
-
'is a *contribution* and goes instead — by id — into `provideShell({ omit: [...] })`. Where a',
|
|
371
|
-
'capability is both, the feature switch wins and takes the menu entry with it.',
|
|
372
|
-
'',
|
|
373
|
-
'A product backend is optional: implement the settings-store / auth-source ports',
|
|
374
|
-
'(`provideSettingsStore` / `provideAuthSource`, both against the `KeyValueStore` shape)',
|
|
375
|
-
'with your own backend, or keep the local/anonymous defaults for a standalone UI.',
|
|
376
|
-
'Working state stays on `WORKING_STATE_STORE` and never reaches your',
|
|
377
|
-
'settings backend; back it separately with `provideWorkingStateStore` only if',
|
|
378
|
-
'working state should travel across devices.',
|
|
379
|
-
'',
|
|
380
|
-
].join('\n');
|
|
381
|
-
}
|
|
382
223
|
exports.angularDistribution = {
|
|
383
224
|
id: 'angular-distribution',
|
|
384
225
|
amend(input) {
|
|
@@ -386,7 +227,7 @@ exports.angularDistribution = {
|
|
|
386
227
|
},
|
|
387
228
|
build(input) {
|
|
388
229
|
const d = resolveDistributionInput(input);
|
|
389
|
-
return Object.assign(Object.assign({ 'src/main.ts': mainTs(), 'src/app/app.config.ts': appConfigTs(d) }, (d.withTests ? { 'src/app/app.config.spec.ts': appConfigSpec() } : {})), { 'src/app/app.ts': appTs(), 'src/app/app.html': appHtml(), 'src/index.html': indexHtml(d), 'src/styles.css': stylesCss(d), 'public/logo.svg': logo_1.PLACEHOLDER_LOGO_SVG, 'public/manifest.webmanifest': manifest(d) + '\n', 'ngsw-config.json': ngswConfig() + '\n', 'LOOMWEAVER.md': readme(d) });
|
|
230
|
+
return Object.assign(Object.assign({ 'src/main.ts': mainTs(), 'src/app/app.config.ts': appConfigTs(d) }, (d.withTests ? { 'src/app/app.config.spec.ts': appConfigSpec() } : {})), { 'src/app/app.ts': appTs(), 'src/app/app.html': appHtml(), 'src/index.html': indexHtml(d), 'src/styles.css': stylesCss(d), 'public/logo.svg': logo_1.PLACEHOLDER_LOGO_SVG, 'public/manifest.webmanifest': manifest(d) + '\n', 'ngsw-config.json': ngswConfig() + '\n', 'LOOMWEAVER.md': (0, readme_1.readme)(d) });
|
|
390
231
|
},
|
|
391
232
|
};
|
|
392
233
|
//# sourceMappingURL=recipe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/recipes/angular-distribution/recipe.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"recipe.js","sourceRoot":"","sources":["../../../../../../../libs/tooling/devkit/src/recipes/angular-distribution/recipe.ts"],"names":[],"mappings":";;;AAmCA,4DA0BC;AA5DD,6CAAsD;AAEtD,sDAAmE;AACnE,oDAAiD;AACjD,iCAA8C;AAC9C,qCAAkC;AA2BlC,MAAM,MAAM,GAAkC,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAE1E,SAAgB,wBAAwB,CACtC,KAAwB;;IAExB,IAAI,CAAC,IAAA,kBAAS,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CACb,mEAAmE,KAAK,CAAC,IAAI,IAAI,CAClF,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,UAAU,CAAC;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,0BAA0B,MAAM,sBAAsB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC3E,CAAC;IACJ,CAAC;IACD,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