@pantoken/vue 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 +37 -0
- package/dist/components.css +1 -0
- package/dist/index.d.mts +39 -0
- package/dist/index.mjs +45 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# @pantoken/vue
|
|
2
|
+
|
|
3
|
+
A Vue plugin over `@pantoken/web-components`. It registers the Instructure custom elements and tells
|
|
4
|
+
Vue's compiler to treat `instui-*` tags as custom elements.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm i @pantoken/vue
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Also available as `pantoken/vue`.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { createApp } from "vue";
|
|
18
|
+
import { PantokenVue } from "@pantoken/vue";
|
|
19
|
+
import "@pantoken/css";
|
|
20
|
+
|
|
21
|
+
createApp(App).use(PantokenVue).mount("#app");
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
- **`PantokenVue`** — the Vue plugin. `app.use(PantokenVue)` registers the custom elements and configures the compiler to accept `instui-*` tags. Also the default export.
|
|
27
|
+
- **`readToken(name, fallback?): string`** — read a resolved `--instui-*` value. Returns `fallback` on the server.
|
|
28
|
+
- **`register`, `iconSvg`** — re-exported from `@pantoken/web-components` for direct registration and icon-SVG lookup.
|
|
29
|
+
|
|
30
|
+
## Related
|
|
31
|
+
|
|
32
|
+
- Pairs with `@pantoken/css` for the base `--instui-*` custom properties.
|
|
33
|
+
- Wraps `@pantoken/web-components`, which supplies the custom elements.
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
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)}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { iconSvg, register } from "@pantoken/web-components";
|
|
2
|
+
|
|
3
|
+
//#region src/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Read a resolved token value. Returns `fallback` on the server.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { readToken } from "@pantoken/vue";
|
|
10
|
+
*
|
|
11
|
+
* const brand = readToken("--instui-color-background-brand", "#0374B5");
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare function readToken(name: string, fallback?: string): string;
|
|
15
|
+
/** The subset of a Vue `App` this plugin touches. */
|
|
16
|
+
interface VueAppLike {
|
|
17
|
+
config: {
|
|
18
|
+
compilerOptions?: {
|
|
19
|
+
isCustomElement?: (tag: string) => boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The pantoken Vue plugin: `app.use(PantokenVue)`.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { createApp } from "vue";
|
|
29
|
+
* import { PantokenVue } from "@pantoken/vue";
|
|
30
|
+
* import "@pantoken/css";
|
|
31
|
+
*
|
|
32
|
+
* createApp(App).use(PantokenVue).mount("#app");
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare const PantokenVue: {
|
|
36
|
+
install(app: VueAppLike): void;
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { PantokenVue, PantokenVue as default, iconSvg, readToken, register };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { iconSvg, register, register as register$1 } from "@pantoken/web-components";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* `@pantoken/vue` — a Vue plugin over `@pantoken/web-components`.
|
|
5
|
+
*
|
|
6
|
+
* `install` registers the custom elements and tells Vue's compiler to treat `instui-*` tags as
|
|
7
|
+
* custom elements. `readToken` reads a resolved `--instui-*` value (SSR-safe).
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Read a resolved token value. Returns `fallback` on the server.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { readToken } from "@pantoken/vue";
|
|
18
|
+
*
|
|
19
|
+
* const brand = readToken("--instui-color-background-brand", "#0374B5");
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function readToken(name, fallback = "") {
|
|
23
|
+
if (typeof document === "undefined") return fallback;
|
|
24
|
+
return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The pantoken Vue plugin: `app.use(PantokenVue)`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { createApp } from "vue";
|
|
32
|
+
* import { PantokenVue } from "@pantoken/vue";
|
|
33
|
+
* import "@pantoken/css";
|
|
34
|
+
*
|
|
35
|
+
* createApp(App).use(PantokenVue).mount("#app");
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
const PantokenVue = { install(app) {
|
|
39
|
+
register$1();
|
|
40
|
+
const options = app.config.compilerOptions ??= {};
|
|
41
|
+
const previous = options.isCustomElement;
|
|
42
|
+
options.isCustomElement = (tag) => tag.startsWith("instui-") || (previous?.(tag) ?? false);
|
|
43
|
+
} };
|
|
44
|
+
//#endregion
|
|
45
|
+
export { PantokenVue, PantokenVue as default, iconSvg, readToken, register };
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pantoken/vue",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Vue plugin for pantoken: registers the web components and reads 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
|
+
"vue": ">=3"
|
|
30
|
+
},
|
|
31
|
+
"peerDependenciesMeta": {
|
|
32
|
+
"vue": {
|
|
33
|
+
"optional": true
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"pantoken": {
|
|
37
|
+
"key": "vue",
|
|
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
|
+
}
|