ember-primitives 0.34.0 → 0.35.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/declarations/head.d.ts +27 -0
- package/dist/head.js +33 -0
- package/dist/head.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TOC } from "@ember/component/template-only";
|
|
2
|
+
export interface Signature {
|
|
3
|
+
Blocks: {
|
|
4
|
+
/**
|
|
5
|
+
* Content to render in to the `<head>` element
|
|
6
|
+
*/
|
|
7
|
+
default: [];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Utility component to place elements in the document `<head>`
|
|
12
|
+
*
|
|
13
|
+
* When this component is unrendered, its contents will be removed as well.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```js
|
|
17
|
+
* import { InHead } from 'ember-primitives/head';
|
|
18
|
+
*
|
|
19
|
+
* <template>
|
|
20
|
+
* {{#if @useBootstrap}}
|
|
21
|
+
* <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
|
22
|
+
* <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css">
|
|
23
|
+
* {{/if}}
|
|
24
|
+
* </template>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const InHead: TOC<Signature>;
|
package/dist/head.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { precompileTemplate } from '@ember/template-compilation';
|
|
2
|
+
import { setComponentTemplate } from '@ember/component';
|
|
3
|
+
import templateOnly from '@ember/component/template-only';
|
|
4
|
+
|
|
5
|
+
function getHead() {
|
|
6
|
+
return document.head;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Utility component to place elements in the document `<head>`
|
|
10
|
+
*
|
|
11
|
+
* When this component is unrendered, its contents will be removed as well.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```js
|
|
15
|
+
* import { InHead } from 'ember-primitives/head';
|
|
16
|
+
*
|
|
17
|
+
* <template>
|
|
18
|
+
* {{#if @useBootstrap}}
|
|
19
|
+
* <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
|
20
|
+
* <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css">
|
|
21
|
+
* {{/if}}
|
|
22
|
+
* </template>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
const InHead = setComponentTemplate(precompileTemplate("\n {{#in-element (getHead) insertBefore=null}}\n {{yield}}\n {{/in-element}}\n", {
|
|
26
|
+
strictMode: true,
|
|
27
|
+
scope: () => ({
|
|
28
|
+
getHead
|
|
29
|
+
})
|
|
30
|
+
}), templateOnly());
|
|
31
|
+
|
|
32
|
+
export { InHead };
|
|
33
|
+
//# sourceMappingURL=head.js.map
|
package/dist/head.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"head.js","sources":["../src/head.gts"],"sourcesContent":["import type { TOC } from \"@ember/component/template-only\";\n\nexport interface Signature {\n Blocks: {\n /**\n * Content to render in to the `<head>` element\n */\n default: [];\n };\n}\n\nfunction getHead() {\n return document.head;\n}\n\n/**\n * Utility component to place elements in the document `<head>`\n *\n * When this component is unrendered, its contents will be removed as well.\n *\n * @example\n * ```js\n * import { InHead } from 'ember-primitives/head';\n *\n * <template>\n * {{#if @useBootstrap}}\n * <script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js\"></script>\n * <link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css\">\n * {{/if}}\n * </template>\n * ```\n */\nexport const InHead: TOC<Signature> = <template>\n {{#in-element (getHead) insertBefore=null}}\n {{yield}}\n {{/in-element}}\n</template>;\n"],"names":["getHead","document","head","InHead","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly"],"mappings":";;;;AAWA,SAASA,OAAAA,GAAA;EACP,OAAOC,SAASC,IAAI;AACtB;AAEA;;;;;;;;;;;;;;;;AAgBC;MACYC,MAAY,GAAAC,oBAAA,CAAaC,kBAAA,CAAA,qFAAA,EAItC;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAP,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAQ,YAAA,EAAA;;;;"}
|