@twobirds/microcomponents 0.9.0 → 0.10.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/README.md +2 -16
- package/dist/cli/bundle.d.ts +106 -0
- package/dist/cli/bundle.d.ts.map +1 -0
- package/dist/cli/bundler.d.ts +44 -0
- package/dist/cli/bundler.d.ts.map +1 -0
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/dev.d.ts +87 -0
- package/dist/cli/dev.d.ts.map +1 -0
- package/dist/cli/dispatch.d.ts +6 -2
- package/dist/cli/dispatch.d.ts.map +1 -1
- package/dist/cli/index.js +1807 -1
- package/dist/cli/inliner.d.ts +42 -0
- package/dist/cli/inliner.d.ts.map +1 -0
- package/dist/cli/preview.d.ts +48 -0
- package/dist/cli/preview.d.ts.map +1 -0
- package/dist/core/elements.js +1294 -75
- package/dist/core/mcGuards.js +5 -8
- package/dist/mcp/api.json +2 -17
- package/dist/mcp/concepts/project-layout.md +9 -8
- package/dist/mcp/index.js +450 -230
- package/dist/microcomponents.js +2882 -9
- package/dist/state/formValues.js +2236 -281
- package/dist/state/observables.js +1794 -342
- package/dist/utils/events.js +171 -197
- package/package.json +7 -8
- package/dist/cli/create.js +0 -653
- package/dist/cli/dispatch.js +0 -316
- package/dist/cli/scaffold.js +0 -109
- package/dist/cli/writeScaffold.js +0 -114
- package/dist/core/MC.js +0 -837
- package/dist/core/index.js +0 -72
- package/dist/state/index.js +0 -5
- package/dist/state/placeholders.js +0 -187
- package/dist/types/index.js +0 -1
- package/dist/types/mcTypes.js +0 -9
- package/dist/utils/autoload.js +0 -160
- package/dist/utils/helpers.js +0 -532
- package/dist/utils/index.js +0 -12
- package/dist/utils/resolveComponentPath.js +0 -39
- package/dist/vite/index.d.ts +0 -7
- package/dist/vite/index.d.ts.map +0 -1
- package/dist/vite/index.js +0 -6
- package/dist/vite/loadAssets.d.ts +0 -36
- package/dist/vite/loadAssets.d.ts.map +0 -1
- package/dist/vite/loadAssets.js +0 -221
package/dist/core/mcGuards.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// not exist, and a guard must answer false there - never throw.
|
|
5
|
-
typeof HTMLElement !== 'undefined' &&
|
|
6
|
-
element instanceof HTMLElement &&
|
|
7
|
-
'_mc' in element &&
|
|
8
|
-
(key === undefined || key in element._mc));
|
|
1
|
+
//#region src/core/mcGuards.ts
|
|
2
|
+
function isMcHost(element, key) {
|
|
3
|
+
return typeof HTMLElement !== "undefined" && element instanceof HTMLElement && "_mc" in element && (key === void 0 || key in element._mc);
|
|
9
4
|
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { isMcHost };
|
package/dist/mcp/api.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"libraryVersion": "0.
|
|
3
|
-
"exportedCount":
|
|
2
|
+
"libraryVersion": "0.10.1",
|
|
3
|
+
"exportedCount": 41,
|
|
4
4
|
"entries": {
|
|
5
5
|
"MC": {
|
|
6
6
|
"name": "MC",
|
|
@@ -595,21 +595,6 @@
|
|
|
595
595
|
"export type McRemoved<T extends HTMLElement, K extends string> = T extends { _mc: McController } ? { _mc: Record<K, never> } : unknown;"
|
|
596
596
|
],
|
|
597
597
|
"description": "The type `remove()` asserts onto the caller's reference: on an enhanced target the\nremoved key is poisoned to `never` (member access becomes a compile error); a\nplain target is left untouched. A later `add()` re-registers the key cleanly."
|
|
598
|
-
},
|
|
599
|
-
"loadAssetsPlugin": {
|
|
600
|
-
"name": "loadAssetsPlugin",
|
|
601
|
-
"kind": "function",
|
|
602
|
-
"file": "src/vite/loadAssets.ts",
|
|
603
|
-
"signatures": [
|
|
604
|
-
"export function loadAssetsPlugin(rootDir: string): PluginOption {"
|
|
605
|
-
],
|
|
606
|
-
"description": "Vite plugin factory that inlines companion `.css` / `.html` assets into the\nDC classes declaring them through `static assets = [...]`.",
|
|
607
|
-
"examples": [
|
|
608
|
-
{
|
|
609
|
-
"title": "Register the plugin in a Vite config, pointing at the source root.",
|
|
610
|
-
"code": "import { loadAssetsPlugin } from './vite-plugin-load-assets';\nexport default defineConfig({ plugins: [loadAssetsPlugin(__dirname)] });"
|
|
611
|
-
}
|
|
612
|
-
]
|
|
613
598
|
}
|
|
614
599
|
},
|
|
615
600
|
"undocumented": []
|
|
@@ -8,11 +8,11 @@ src/ → (tsc) → build/ → (bundle) → public/
|
|
|
8
8
|
`.target.html` / `.target.css` / `.shadow.css` assets, the dev shell
|
|
9
9
|
(`index-dev.html`) and the production shell (`index.html`).
|
|
10
10
|
- `build/` is the `tsc` output: one `.js` per component at its own autoload path,
|
|
11
|
-
plus the mirrored companion assets and the dev shell.
|
|
11
|
+
plus the mirrored companion assets and the dev shell. `mc dev` serves it, so
|
|
12
12
|
the page loads components on demand through `autoload()` and nothing is bundled.
|
|
13
|
-
- `public/` is the production site: one
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
- `public/` is the production site: one `bundle.js` with every companion asset
|
|
14
|
+
inlined by `mc bundle`, the concatenated `bundle.css`, and the production
|
|
15
|
+
shell. A single script tag loads it; the autoloader is not needed.
|
|
16
16
|
|
|
17
17
|
`build/` and `public/` are generated, so they stay out of git.
|
|
18
18
|
|
|
@@ -28,10 +28,11 @@ entry, so every component must be imported by the barrel `src/<namespace>/bundle
|
|
|
28
28
|
|
|
29
29
|
The two shells are deliberately different:
|
|
30
30
|
|
|
31
|
-
- `index-dev.html` imports the library
|
|
31
|
+
- `index-dev.html` imports the library through an import map (to the served
|
|
32
|
+
`microcomponents.min.js`) and calls `autoload(true)`, so a tag in the markup
|
|
32
33
|
pulls its own `.js` from `build/`.
|
|
33
34
|
- `index.html` loads `bundle.js` and `bundle.css`, which only exist in `public/`.
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
`mc dev` redirects `/` to `index-dev.html`; `mc bundle` copies `index.html` next to
|
|
37
|
+
the bundle. Serving the production shell in dev would request a `bundle.js` that
|
|
38
|
+
was never built.
|