@pantoken/angular 0.1.0

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 ADDED
@@ -0,0 +1,41 @@
1
+ # @pantoken/angular
2
+
3
+ Angular helpers over `@pantoken/web-components`: register the Instructure custom elements once at
4
+ bootstrap, and read resolved `--instui-*` token values at runtime.
5
+
6
+ ## Install
7
+
8
+ ```sh
9
+ npm i @pantoken/angular
10
+ ```
11
+
12
+ Also available as `pantoken/angular`.
13
+
14
+ ## Usage
15
+
16
+ ```ts
17
+ import { registerPantokenElements, readToken } from "@pantoken/angular";
18
+ import "@pantoken/css";
19
+
20
+ registerPantokenElements(); // during app bootstrap
21
+
22
+ const brand = readToken("--instui-color-background-brand", "#0374B5");
23
+ ```
24
+
25
+ Add `CUSTOM_ELEMENTS_SCHEMA` to any component or module that uses `<instui-icon>` so Angular's
26
+ template compiler accepts the tag.
27
+
28
+ ## API
29
+
30
+ - **`registerPantokenElements(): void`** — register the pantoken custom elements. Call once at bootstrap.
31
+ - **`readToken(name, fallback?): string`** — read a resolved `--instui-*` value. Returns `fallback` on the server.
32
+ - **`register`** — re-exported from `@pantoken/web-components` for direct control over registration timing.
33
+
34
+ ## Related
35
+
36
+ - Pairs with `@pantoken/css` for the base stylesheet that defines the `--instui-*` properties.
37
+ - Wraps `@pantoken/web-components`, which supplies the custom elements.
38
+
39
+ ## License
40
+
41
+ MIT
@@ -0,0 +1 @@
1
+ .pantoken-prose{color:var(--instui-component-text-base-color);font-family:var(--instui-component-text-content-font-family);font-size:var(--instui-component-text-content-font-size);font-weight:var(--instui-component-text-content-font-weight);line-height:var(--instui-component-text-content-line-height)}.pantoken-prose h1,.pantoken-prose h2,.pantoken-prose h3,.pantoken-prose h4,.pantoken-prose h5,.pantoken-prose h6{color:var(--instui-component-heading-base-color);font-family:var(--instui-component-heading-h1-font-family);line-height:var(--instui-component-heading-line-height);margin:var(--instui-spacing-space-lg) 0 var(--instui-spacing-space-sm)}.pantoken-prose h1{font-size:var(--instui-component-heading-h1-font-size);font-weight:var(--instui-component-heading-h1-font-weight)}.pantoken-prose h2{font-size:var(--instui-component-heading-h2-font-size);font-weight:var(--instui-component-heading-h2-font-weight)}.pantoken-prose h3{font-size:var(--instui-component-heading-h3-font-size);font-weight:var(--instui-component-heading-h3-font-weight)}.pantoken-prose h4{font-size:var(--instui-component-heading-h4-font-size);font-weight:var(--instui-component-heading-h4-font-weight)}.pantoken-prose h5{font-size:var(--instui-component-heading-h5-font-size);font-weight:var(--instui-component-heading-h5-font-weight)}.pantoken-prose h6{font-size:var(--instui-component-heading-h6-font-size);font-weight:var(--instui-component-heading-h6-font-weight)}.pantoken-prose p{margin:var(--instui-spacing-space-md) 0}.pantoken-prose a{color:var(--instui-color-text-interactive-navigation-primary-base);text-decoration:underline}.pantoken-prose a:hover{color:var(--instui-color-text-interactive-navigation-primary-hover)}.pantoken-prose strong,.pantoken-prose b{font-weight:var(--instui-component-text-content-important-font-weight)}.pantoken-prose em,.pantoken-prose i{font-style:italic}.pantoken-prose small{font-size:var(--instui-component-text-content-small-font-size)}.pantoken-prose del,.pantoken-prose s{color:var(--instui-color-text-muted);text-decoration:line-through}.pantoken-prose ul,.pantoken-prose ol{margin:var(--instui-spacing-space-md) 0;padding-inline-start:var(--instui-spacing-space-lg)}.pantoken-prose li{margin:var(--instui-spacing-space2xs) 0}.pantoken-prose li.task-list-item{list-style:none}.pantoken-prose input[type=checkbox]{accent-color:var(--instui-color-text-interactive-navigation-primary-base);margin-inline-end:var(--instui-spacing-space-xs)}.pantoken-prose blockquote{margin:var(--instui-spacing-space-md) 0;border-inline-start:var(--instui-border-width-lg) solid var(--instui-color-stroke-base);color:var(--instui-component-text-base-color);font-size:var(--instui-component-text-content-quote-font-size);line-height:var(--instui-component-text-content-quote-line-height);padding-inline-start:var(--instui-spacing-space-md)}.pantoken-prose code{font-family:var(--instui-font-family-code);background:var(--instui-color-background-muted);padding:var(--instui-spacing-space2xs) var(--instui-spacing-space-xs);border-radius:var(--instui-border-radius-sm);font-size:.9em}.pantoken-prose pre{font-family:var(--instui-font-family-code);background:var(--instui-color-background-container);color:var(--instui-color-text-base);padding:var(--instui-spacing-space-md);border:var(--instui-border-width-sm) solid var(--instui-color-stroke-base);border-radius:var(--instui-border-radius-md);overflow-x:auto}.pantoken-prose pre code{font-size:inherit;background:0 0;border-radius:0;padding:0}.pantoken-prose hr{border:none;border-top:var(--instui-border-width-sm) solid var(--instui-color-stroke-base);margin:var(--instui-spacing-space-lg) 0}.pantoken-prose img{border-radius:var(--instui-border-radius-md);max-width:100%}.pantoken-prose table:not([class]){border-collapse:collapse;width:100%;margin:var(--instui-spacing-space-md) 0;background:var(--instui-component-table-background);color:var(--instui-component-table-color);font-family:var(--instui-component-table-font-family);font-size:var(--instui-component-table-font-size)}.pantoken-prose table:not([class]) th{text-align:start;background:var(--instui-component-table-col-header-background);color:var(--instui-component-table-col-header-color);font-weight:var(--instui-component-table-head-font-weight);padding:var(--instui-component-table-col-header-padding-vertical) var(--instui-component-table-col-header-padding-horizontal);border-bottom:var(--instui-border-width-md) solid var(--instui-component-table-row-border-color)}.pantoken-prose table:not([class]) td{color:var(--instui-component-table-cell-color);line-height:var(--instui-component-table-cell-line-height);padding:var(--instui-component-table-cell-padding-vertical) var(--instui-component-table-cell-padding-horizontal);border-bottom:var(--instui-border-width-sm) solid var(--instui-component-table-row-border-color)}
@@ -0,0 +1,29 @@
1
+ import { register } from "@pantoken/web-components";
2
+
3
+ //#region src/index.d.ts
4
+ /**
5
+ * Register the pantoken custom elements (call once during app bootstrap).
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { registerPantokenElements } from "@pantoken/angular";
10
+ * import "@pantoken/css";
11
+ *
12
+ * registerPantokenElements(); // during app bootstrap
13
+ * // Add CUSTOM_ELEMENTS_SCHEMA to the component/module that uses <instui-icon>.
14
+ * ```
15
+ */
16
+ declare function registerPantokenElements(): void;
17
+ /**
18
+ * Read a resolved token value. Returns `fallback` on the server.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { readToken } from "@pantoken/angular";
23
+ *
24
+ * const brand = readToken("--instui-color-background-brand", "#0374B5");
25
+ * ```
26
+ */
27
+ declare function readToken(name: string, fallback?: string): string;
28
+ //#endregion
29
+ export { readToken, register, registerPantokenElements };
package/dist/index.mjs ADDED
@@ -0,0 +1,42 @@
1
+ import { register, register as register$1 } from "@pantoken/web-components";
2
+ //#region src/index.ts
3
+ /**
4
+ * `@pantoken/angular` — Angular helpers over `@pantoken/web-components`.
5
+ *
6
+ * Call {@link registerPantokenElements} during bootstrap, and add `CUSTOM_ELEMENTS_SCHEMA` to the
7
+ * component/module that uses `<instui-icon>`. {@link readToken} reads a resolved `--instui-*` value.
8
+ *
9
+ * @module
10
+ * @experimental
11
+ */
12
+ /**
13
+ * Register the pantoken custom elements (call once during app bootstrap).
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * import { registerPantokenElements } from "@pantoken/angular";
18
+ * import "@pantoken/css";
19
+ *
20
+ * registerPantokenElements(); // during app bootstrap
21
+ * // Add CUSTOM_ELEMENTS_SCHEMA to the component/module that uses <instui-icon>.
22
+ * ```
23
+ */
24
+ function registerPantokenElements() {
25
+ register$1();
26
+ }
27
+ /**
28
+ * Read a resolved token value. Returns `fallback` on the server.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * import { readToken } from "@pantoken/angular";
33
+ *
34
+ * const brand = readToken("--instui-color-background-brand", "#0374B5");
35
+ * ```
36
+ */
37
+ function readToken(name, fallback = "") {
38
+ if (typeof document === "undefined") return fallback;
39
+ return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
40
+ }
41
+ //#endregion
42
+ export { readToken, register, registerPantokenElements };
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@pantoken/angular",
3
+ "version": "0.1.0",
4
+ "description": "Angular helpers for pantoken: register the web components and read tokens.",
5
+ "license": "MIT",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "type": "module",
10
+ "exports": {
11
+ ".": "./dist/index.mjs",
12
+ "./components.css": "./dist/components.css",
13
+ "./package.json": "./package.json"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "dependencies": {
19
+ "@pantoken/web-components": "0.1.0"
20
+ },
21
+ "devDependencies": {
22
+ "@types/node": "^24.13.3",
23
+ "typescript": "^6.0.3",
24
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
25
+ "vite-plus": "0.2.4",
26
+ "@pantoken/components": "0.1.0"
27
+ },
28
+ "peerDependencies": {
29
+ "@angular/core": ">=16"
30
+ },
31
+ "peerDependenciesMeta": {
32
+ "@angular/core": {
33
+ "optional": true
34
+ }
35
+ },
36
+ "pantoken": {
37
+ "key": "angular",
38
+ "kind": "subpath"
39
+ },
40
+ "scripts": {
41
+ "generate": "node scripts/generate.ts",
42
+ "build": "vp run generate && vp pack",
43
+ "dev": "vp run generate && vp pack --watch",
44
+ "test": "vp test",
45
+ "check": "vp check"
46
+ }
47
+ }