limber-ui 1.0.0-beta.0 → 1.0.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/LICENSE +21 -0
- package/declarations/components/button.d.ts +12 -0
- package/declarations/components/button.d.ts.map +1 -0
- package/{dist → declarations}/components/code.d.ts +4 -3
- package/declarations/components/code.d.ts.map +1 -0
- package/declarations/components/external-link.d.ts +16 -0
- package/declarations/components/external-link.d.ts.map +1 -0
- package/declarations/components/frame-messaging.d.ts +23 -0
- package/declarations/components/frame-messaging.d.ts.map +1 -0
- package/{dist → declarations}/components/link.d.ts +4 -3
- package/declarations/components/link.d.ts.map +1 -0
- package/declarations/helpers/service.d.ts +17 -0
- package/declarations/helpers/service.d.ts.map +1 -0
- package/declarations/index.d.ts +6 -0
- package/declarations/index.d.ts.map +1 -0
- package/dist/components/button.js +18 -12
- package/dist/components/button.js.map +1 -1
- package/dist/components/code.js +29 -37
- package/dist/components/code.js.map +1 -1
- package/dist/components/external-link.js +13 -31
- package/dist/components/external-link.js.map +1 -1
- package/dist/components/frame-messaging.js +55 -7
- package/dist/components/frame-messaging.js.map +1 -1
- package/dist/components/link.js +7 -24
- package/dist/components/link.js.map +1 -1
- package/dist/helpers/service.js +1 -1
- package/dist/helpers/service.js.map +1 -1
- package/dist/theme.css +2 -2
- package/package.json +76 -51
- package/dist/components/button.d.ts +0 -9
- package/dist/components/button.d.ts.map +0 -1
- package/dist/components/external-link.d.ts +0 -14
- package/dist/components/frame-messaging.d.ts +0 -0
- package/dist/frame-messaging-5d0ad7c1.d.ts +0 -27
- package/dist/frame-messaging-5d0ad7c1.js +0 -123
- package/dist/frame-messaging-5d0ad7c1.js.map +0 -1
- package/dist/helpers/service.d.ts +0 -13
- package/dist/index.d.ts +0 -5
- package/dist/proper-links.d.ts +0 -55
- package/dist/proper-links.js +0 -63
- package/dist/proper-links.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sources":["../../src/components/link.
|
|
1
|
+
{"version":3,"file":"link.js","sources":["../../src/components/link.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport { htmlSafe } from '@ember/template';\nimport type { TOC } from '@ember/component/template-only';\nconst classList = htmlSafe(`\n inline-block items-center grid-flow-col\n text-white rounded bg-[var(--code-bg)]\n px-3 py-2\n border border-[var(--horizon-border)]\n hover:underline\n focus:outline-none focus:ring\n focus-visible:outline-none focus-visible:ring\n shadow\n grid gap-2\n`);\nexport const Link: TOC<{\n Element: HTMLAnchorElement | HTMLSpanElement;\n Args: {\n /**\n * Link / Anchor tags can't really be disabled,\n * so we need a another way to communicate that the link is inactive.\n *\n * When `@isDisabled` is true, the anchor will be swapped out with a span\n * but with the same styling (except for communicating that the element is disabled).\n */ isDisabled?: boolean;\n };\n Blocks: {\n default: [];\n };\n}> = template(`\n {{#if @isDisabled}}\n\n <span class=\"{{classList}} opacity-30\" ...attributes tabindex=\"0\">\n {{yield}}\n </span>\n\n {{else}}\n\n {{! href attribute should be passed in to Link }}\n {{! The lints maybe need a runtime integration. }}\n {{! template-lint-disable link-href-attributes }}\n <a class={{classList}} ...attributes>\n {{yield}}\n </a>\n\n {{/if}}\n`, {\n eval () {\n return eval(arguments[0]);\n }\n});\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9ob21lL3J1bm5lci93b3JrL2xpbWJlci9saW1iZXIvcGFja2FnZXMvYXBwLXN1cHBvcnQvbGltYmVyLXVpL2FkZG9uL3NyYy9jb21wb25lbnRzL2xpbmsuZ3RzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGh0bWxTYWZlIH0gZnJvbSAnQGVtYmVyL3RlbXBsYXRlJztcblxuaW1wb3J0IHR5cGUgeyBUT0MgfSBmcm9tICdAZW1iZXIvY29tcG9uZW50L3RlbXBsYXRlLW9ubHknO1xuXG5jb25zdCBjbGFzc0xpc3QgPSBodG1sU2FmZShgXG4gIG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,CAiBL,4ZAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;AAAAJ,IAAAA,SAAAA;AAAA,GAAA,CAAA;EAAAK,UAAA,EAAA,IAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
|
package/dist/helpers/service.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sources":["../../src/helpers/service.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"service.js","sources":["../../src/helpers/service.ts"],"sourcesContent":["import Helper from '@ember/component/helper';\nimport { assert } from '@ember/debug';\nimport { getOwner } from '@ember/owner';\n\nimport type { Registry } from '@ember/service';\n\ninterface Signature<Key extends keyof Registry> {\n Args: {\n Positional: [Key];\n };\n Return: Registry[Key];\n}\n\nexport default class GetService<Key extends keyof Registry> extends Helper<Signature<Key>> {\n compute([name]: [Key]): Registry[Key] {\n let owner = getOwner(this);\n\n assert(`Could not get owner.`, owner);\n\n return owner.lookup(`service:${name}`);\n }\n}\n\nexport const service = GetService;\n"],"names":["GetService","Helper","compute","name","owner","getOwner","assert","lookup","service"],"mappings":";;;;AAae,MAAMA,UAAU,SAAqCC,MAAM,CAAiB;AACzFC,EAAAA,OAAOA,CAAC,CAACC,IAAI,CAAQ,EAAiB;AACpC,IAAA,IAAIC,KAAK,GAAGC,QAAQ,CAAC,IAAI,CAAC,CAAA;AAE1BC,IAAAA,MAAM,CAAE,CAAA,oBAAA,CAAqB,EAAEF,KAAK,CAAC,CAAA;AAErC,IAAA,OAAOA,KAAK,CAACG,MAAM,CAAE,CAAUJ,QAAAA,EAAAA,IAAK,EAAC,CAAC,CAAA;AACxC,GAAA;AACF,CAAA;AAEO,MAAMK,OAAO,GAAGR;;;;"}
|
package/dist/theme.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@import url(
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500&display=swap");
|
|
2
2
|
|
|
3
3
|
/* Horizon Theme https://horizontheme.netlify.app/ */
|
|
4
4
|
:root {
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
.hljs {
|
|
131
131
|
background: var(--code-bg);
|
|
132
132
|
display: block;
|
|
133
|
-
font-family:
|
|
133
|
+
font-family: "Source Code Pro", ui-monospace, monospace, sans-serif;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
.hljs-comment {
|
package/package.json
CHANGED
|
@@ -1,77 +1,88 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "limber-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "The default blueprint for Embroider v2 addons.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
7
7
|
],
|
|
8
8
|
"repository": {
|
|
9
|
-
"type": "
|
|
10
|
-
"url": "https://github.com/NullVoxPopuli/limber",
|
|
11
|
-
"directory": "packages/limber-ui/addon"
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/NullVoxPopuli/limber.git",
|
|
11
|
+
"directory": "packages/app-support/limber-ui/addon"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": "NullVoxPopuli",
|
|
15
15
|
"files": [
|
|
16
16
|
"addon-main.cjs",
|
|
17
|
-
"dist"
|
|
17
|
+
"dist",
|
|
18
|
+
"declarations"
|
|
18
19
|
],
|
|
19
20
|
"peerDependencies": {
|
|
21
|
+
"@ember/test-waiters": "^3.1.0",
|
|
20
22
|
"@glimmer/component": "^1.1.2",
|
|
21
23
|
"@glimmer/tracking": "^1.1.2",
|
|
22
|
-
"ember-async-data": "^1.0.
|
|
23
|
-
"ember-
|
|
24
|
+
"ember-async-data": "^1.0.3",
|
|
25
|
+
"ember-modifier": "^4.1.0",
|
|
26
|
+
"ember-primitives": ">= 0.11.0",
|
|
27
|
+
"ember-resources": ">= 6.4.2",
|
|
28
|
+
"ember-source": ">= 5.5.0"
|
|
24
29
|
},
|
|
25
30
|
"dependencies": {
|
|
26
|
-
"@babel/runtime": "^7.
|
|
27
|
-
"@
|
|
28
|
-
"@embroider/
|
|
29
|
-
"@
|
|
30
|
-
"@fortawesome/
|
|
31
|
-
"@fortawesome/
|
|
32
|
-
"@fortawesome/free-
|
|
33
|
-
"@fortawesome/free-
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
31
|
+
"@babel/runtime": "^7.23.9",
|
|
32
|
+
"@embroider/addon-shim": "1.8.7",
|
|
33
|
+
"@embroider/macros": "1.13.5",
|
|
34
|
+
"@fortawesome/ember-fontawesome": "^2.0.0",
|
|
35
|
+
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
|
36
|
+
"@fortawesome/free-brands-svg-icons": "^6.5.1",
|
|
37
|
+
"@fortawesome/free-regular-svg-icons": "^6.5.1",
|
|
38
|
+
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
|
39
|
+
"decorator-transforms": "^1.1.0",
|
|
40
|
+
"penpal": "^6.2.2",
|
|
41
|
+
"reactiveweb": "^1.2.0"
|
|
37
42
|
},
|
|
38
43
|
"devDependencies": {
|
|
39
|
-
"@babel/core": "^7.
|
|
40
|
-
"@babel/eslint-parser": "^7.
|
|
44
|
+
"@babel/core": "^7.23.9",
|
|
45
|
+
"@babel/eslint-parser": "^7.23.10",
|
|
41
46
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
42
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
43
|
-
"@babel/plugin-syntax-decorators": "^7.
|
|
44
|
-
"@
|
|
47
|
+
"@babel/plugin-proposal-decorators": "^7.23.9",
|
|
48
|
+
"@babel/plugin-syntax-decorators": "^7.23.3",
|
|
49
|
+
"@babel/plugin-transform-typescript": "^7.23.6",
|
|
50
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
51
|
+
"@ember/test-waiters": "^3.1.0",
|
|
52
|
+
"@embroider/addon-dev": "4.2.1",
|
|
45
53
|
"@glimmer/component": "^1.1.2",
|
|
46
54
|
"@glimmer/tracking": "^1.1.2",
|
|
47
|
-
"@glint/core": "
|
|
48
|
-
"@glint/environment-ember-loose": "
|
|
49
|
-
"@glint/environment-ember-template-imports": "
|
|
50
|
-
"@glint/template": "
|
|
51
|
-
"@nullvoxpopuli/eslint-configs": "^3.
|
|
52
|
-
"@rollup/plugin-babel": "^6.0.
|
|
53
|
-
"@tsconfig/ember": "^
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
55
|
-
"@typescript-eslint/parser": "^
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"ember-
|
|
59
|
-
"ember-
|
|
60
|
-
"ember-
|
|
55
|
+
"@glint/core": "1.3.0",
|
|
56
|
+
"@glint/environment-ember-loose": "1.3.0",
|
|
57
|
+
"@glint/environment-ember-template-imports": "1.3.0",
|
|
58
|
+
"@glint/template": "1.3.0",
|
|
59
|
+
"@nullvoxpopuli/eslint-configs": "^3.2.2",
|
|
60
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
61
|
+
"@tsconfig/ember": "^3.0.2",
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
63
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
64
|
+
"babel-plugin-ember-template-compilation": "^2.2.1",
|
|
65
|
+
"concurrently": "^8.2.2",
|
|
66
|
+
"ember-async-data": "1.0.3",
|
|
67
|
+
"ember-cli-htmlbars": "^6.3.0",
|
|
68
|
+
"ember-modifier": "^4.1.0",
|
|
69
|
+
"ember-primitives": "^0.11.4",
|
|
70
|
+
"ember-resources": "^7.0.0",
|
|
71
|
+
"ember-source": ">= 5.5.0",
|
|
61
72
|
"ember-template-imports": "^3.4.2",
|
|
62
|
-
"ember-template-lint": "^5.
|
|
63
|
-
"eslint": "^8.
|
|
64
|
-
"eslint-plugin-ember": "^
|
|
73
|
+
"ember-template-lint": "^5.13.0",
|
|
74
|
+
"eslint": "^8.55.0",
|
|
75
|
+
"eslint-plugin-ember": "^12.0.0",
|
|
65
76
|
"eslint-plugin-node": "^11.1.0",
|
|
66
|
-
"eslint-plugin-prettier": "^
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"rollup
|
|
72
|
-
"rollup-plugin-
|
|
73
|
-
"typescript": "^5.
|
|
74
|
-
"@nullvoxpopuli/limber-untyped": "0.0.
|
|
77
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
78
|
+
"execa": "^8.0.1",
|
|
79
|
+
"fix-bad-declaration-output": "^1.1.1",
|
|
80
|
+
"prettier": "^3.2.5",
|
|
81
|
+
"prettier-plugin-ember-template-tag": "^2.0.0",
|
|
82
|
+
"rollup": "^4.9.6",
|
|
83
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
84
|
+
"typescript": "^5.3.3",
|
|
85
|
+
"@nullvoxpopuli/limber-untyped": "0.0.1"
|
|
75
86
|
},
|
|
76
87
|
"publishConfig": {
|
|
77
88
|
"registry": "https://registry.npmjs.org"
|
|
@@ -96,11 +107,25 @@
|
|
|
96
107
|
}
|
|
97
108
|
},
|
|
98
109
|
"exports": {
|
|
99
|
-
".":
|
|
100
|
-
|
|
110
|
+
".": {
|
|
111
|
+
"types": "./declarations/index.d.ts",
|
|
112
|
+
"default": "./dist/index.js"
|
|
113
|
+
},
|
|
114
|
+
"./*": {
|
|
115
|
+
"types": "./declarations/*.d.ts",
|
|
116
|
+
"default": "./dist/*"
|
|
117
|
+
},
|
|
101
118
|
"./theme.css": "./dist/theme.css",
|
|
102
119
|
"./addon-main.js": "./addon-main.cjs"
|
|
103
120
|
},
|
|
121
|
+
"volta": {
|
|
122
|
+
"extends": "../../../../package.json"
|
|
123
|
+
},
|
|
124
|
+
"engines": {
|
|
125
|
+
"node": ">= v16",
|
|
126
|
+
"npm": "use pnpm",
|
|
127
|
+
"yarn": "use pnpm"
|
|
128
|
+
},
|
|
104
129
|
"scripts": {
|
|
105
130
|
"build": "rollup --config",
|
|
106
131
|
"lint:types": "glint",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components/button.d.ts","sourceRoot":"","sources":["../src/components/button.ts"],"names":[],"mappings":"AAAA,OAAO,OAAY,MAAM,gCAAgC,CAAC;AAE1D,QAAO,MAAM,MAAM,EAAE,GAAG,CAAC;IACvB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE;QAAE,OAAO,EAAE,EAAE,CAAA;KAAE,CAAC;CACzB,CAQwB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { TOC } from '@ember/component/template-only';
|
|
2
|
-
declare const DefaultContent: TOC<{
|
|
3
|
-
Blocks: {
|
|
4
|
-
default: [];
|
|
5
|
-
};
|
|
6
|
-
}>;
|
|
7
|
-
declare const ExternalLink: TOC<{
|
|
8
|
-
Element: HTMLAnchorElement;
|
|
9
|
-
Blocks: {
|
|
10
|
-
default: [];
|
|
11
|
-
custom: [typeof DefaultContent];
|
|
12
|
-
};
|
|
13
|
-
}>;
|
|
14
|
-
export { ExternalLink as default, ExternalLink };
|
|
File without changes
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Connection } from 'penpal';
|
|
2
|
-
declare class HostMessaging {
|
|
3
|
-
frameStatus: unknown;
|
|
4
|
-
connection?: Connection<{
|
|
5
|
-
update: (format: string, text: string) => void;
|
|
6
|
-
}>;
|
|
7
|
-
/**
|
|
8
|
-
* We can't post right away, because we might do so before the iframe is ready.
|
|
9
|
-
* We need to wait until the frame initiates contact.
|
|
10
|
-
*/
|
|
11
|
-
postMessage: import("ember-modifier").FunctionBasedModifier<{
|
|
12
|
-
Args: {
|
|
13
|
-
Positional: [string | null];
|
|
14
|
-
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
15
|
-
};
|
|
16
|
-
Element: HTMLIFrameElement;
|
|
17
|
-
}>;
|
|
18
|
-
onMessage: import("ember-modifier").FunctionBasedModifier<{
|
|
19
|
-
Args: {
|
|
20
|
-
Positional: unknown[];
|
|
21
|
-
Named: import("ember-modifier/-private/signature").EmptyObject;
|
|
22
|
-
};
|
|
23
|
-
Element: HTMLIFrameElement;
|
|
24
|
-
}>;
|
|
25
|
-
queuePayload(format: string, text: string): Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
export { HostMessaging };
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { tracked } from '@glimmer/tracking';
|
|
2
|
-
import { isDestroyed, isDestroying } from '@ember/destroyable';
|
|
3
|
-
import { action } from '@ember/object';
|
|
4
|
-
import { waitFor, waitForPromise } from '@ember/test-waiters';
|
|
5
|
-
import { modifier } from 'ember-modifier';
|
|
6
|
-
import { connectToChild } from 'penpal';
|
|
7
|
-
|
|
8
|
-
function _initializerDefineProperty(target, property, descriptor, context) {
|
|
9
|
-
if (!descriptor) return;
|
|
10
|
-
Object.defineProperty(target, property, {
|
|
11
|
-
enumerable: descriptor.enumerable,
|
|
12
|
-
configurable: descriptor.configurable,
|
|
13
|
-
writable: descriptor.writable,
|
|
14
|
-
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _typeof(obj) {
|
|
19
|
-
"@babel/helpers - typeof";
|
|
20
|
-
|
|
21
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
22
|
-
return typeof obj;
|
|
23
|
-
} : function (obj) {
|
|
24
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
25
|
-
}, _typeof(obj);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _toPrimitive(input, hint) {
|
|
29
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
30
|
-
var prim = input[Symbol.toPrimitive];
|
|
31
|
-
if (prim !== undefined) {
|
|
32
|
-
var res = prim.call(input, hint || "default");
|
|
33
|
-
if (_typeof(res) !== "object") return res;
|
|
34
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
35
|
-
}
|
|
36
|
-
return (hint === "string" ? String : Number)(input);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function _toPropertyKey(arg) {
|
|
40
|
-
var key = _toPrimitive(arg, "string");
|
|
41
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _defineProperty(obj, key, value) {
|
|
45
|
-
key = _toPropertyKey(key);
|
|
46
|
-
if (key in obj) {
|
|
47
|
-
Object.defineProperty(obj, key, {
|
|
48
|
-
value: value,
|
|
49
|
-
enumerable: true,
|
|
50
|
-
configurable: true,
|
|
51
|
-
writable: true
|
|
52
|
-
});
|
|
53
|
-
} else {
|
|
54
|
-
obj[key] = value;
|
|
55
|
-
}
|
|
56
|
-
return obj;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
|
|
60
|
-
var desc = {};
|
|
61
|
-
Object.keys(descriptor).forEach(function (key) {
|
|
62
|
-
desc[key] = descriptor[key];
|
|
63
|
-
});
|
|
64
|
-
desc.enumerable = !!desc.enumerable;
|
|
65
|
-
desc.configurable = !!desc.configurable;
|
|
66
|
-
if ('value' in desc || desc.initializer) {
|
|
67
|
-
desc.writable = true;
|
|
68
|
-
}
|
|
69
|
-
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
70
|
-
return decorator(target, property, desc) || desc;
|
|
71
|
-
}, desc);
|
|
72
|
-
if (context && desc.initializer !== void 0) {
|
|
73
|
-
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
74
|
-
desc.initializer = undefined;
|
|
75
|
-
}
|
|
76
|
-
if (desc.initializer === void 0) {
|
|
77
|
-
Object.defineProperty(target, property, desc);
|
|
78
|
-
desc = null;
|
|
79
|
-
}
|
|
80
|
-
return desc;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var _class, _descriptor;
|
|
84
|
-
let HostMessaging = (_class = class HostMessaging {
|
|
85
|
-
constructor() {
|
|
86
|
-
_initializerDefineProperty(this, "frameStatus", _descriptor, this);
|
|
87
|
-
_defineProperty(this, "connection", void 0);
|
|
88
|
-
/**
|
|
89
|
-
* We can't post right away, because we might do so before the iframe is ready.
|
|
90
|
-
* We need to wait until the frame initiates contact.
|
|
91
|
-
*/
|
|
92
|
-
_defineProperty(this, "postMessage", modifier((element, [data]) => {
|
|
93
|
-
if (!element.contentWindow) return;
|
|
94
|
-
if (data) {
|
|
95
|
-
this.queuePayload('gjs', data);
|
|
96
|
-
}
|
|
97
|
-
}));
|
|
98
|
-
_defineProperty(this, "onMessage", modifier(element => {
|
|
99
|
-
this.connection = connectToChild({
|
|
100
|
-
iframe: element,
|
|
101
|
-
methods: {}
|
|
102
|
-
});
|
|
103
|
-
waitForPromise(this.connection.promise).catch(console.error);
|
|
104
|
-
return () => this.connection?.destroy();
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
async queuePayload(format, text) {
|
|
108
|
-
await Promise.resolve();
|
|
109
|
-
if (isDestroyed(this) || isDestroying(this)) return;
|
|
110
|
-
if (!this.connection) return;
|
|
111
|
-
let child = await this.connection.promise;
|
|
112
|
-
if (isDestroyed(this) || isDestroying(this)) return;
|
|
113
|
-
await child.update(format, text);
|
|
114
|
-
}
|
|
115
|
-
}, (_descriptor = _applyDecoratedDescriptor(_class.prototype, "frameStatus", [tracked], {
|
|
116
|
-
configurable: true,
|
|
117
|
-
enumerable: true,
|
|
118
|
-
writable: true,
|
|
119
|
-
initializer: null
|
|
120
|
-
}), _applyDecoratedDescriptor(_class.prototype, "queuePayload", [action, waitFor], Object.getOwnPropertyDescriptor(_class.prototype, "queuePayload"), _class.prototype)), _class);
|
|
121
|
-
|
|
122
|
-
export { HostMessaging as H, _applyDecoratedDescriptor as _, _initializerDefineProperty as a };
|
|
123
|
-
//# sourceMappingURL=frame-messaging-5d0ad7c1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frame-messaging-5d0ad7c1.js","sources":["../../../../node_modules/.pnpm/@babel+runtime@7.21.5/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js","../../../../node_modules/.pnpm/@babel+runtime@7.21.5/node_modules/@babel/runtime/helpers/esm/typeof.js","../../../../node_modules/.pnpm/@babel+runtime@7.21.5/node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../../../../node_modules/.pnpm/@babel+runtime@7.21.5/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../../../../node_modules/.pnpm/@babel+runtime@7.21.5/node_modules/@babel/runtime/helpers/esm/defineProperty.js","../../../../node_modules/.pnpm/@babel+runtime@7.21.5/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js","../src/components/frame-messaging.ts"],"sourcesContent":["export default function _initializerDefineProperty(target, property, descriptor, context) {\n if (!descriptor) return;\n Object.defineProperty(target, property, {\n enumerable: descriptor.enumerable,\n configurable: descriptor.configurable,\n writable: descriptor.writable,\n value: descriptor.initializer ? descriptor.initializer.call(context) : void 0\n });\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {\n var desc = {};\n Object.keys(descriptor).forEach(function (key) {\n desc[key] = descriptor[key];\n });\n desc.enumerable = !!desc.enumerable;\n desc.configurable = !!desc.configurable;\n if ('value' in desc || desc.initializer) {\n desc.writable = true;\n }\n desc = decorators.slice().reverse().reduce(function (desc, decorator) {\n return decorator(target, property, desc) || desc;\n }, desc);\n if (context && desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(context) : void 0;\n desc.initializer = undefined;\n }\n if (desc.initializer === void 0) {\n Object.defineProperty(target, property, desc);\n desc = null;\n }\n return desc;\n}","import { tracked } from '@glimmer/tracking';\nimport { isDestroyed, isDestroying } from '@ember/destroyable';\nimport { action } from '@ember/object';\nimport { waitFor, waitForPromise } from '@ember/test-waiters';\n\nimport { modifier } from 'ember-modifier';\nimport { type Connection, connectToChild } from 'penpal';\n\nexport class HostMessaging {\n @tracked frameStatus: unknown;\n\n connection?: Connection<{\n update: (format: string, text: string) => void;\n }>;\n\n /**\n * We can't post right away, because we might do so before the iframe is ready.\n * We need to wait until the frame initiates contact.\n */\n postMessage = modifier((element: HTMLIFrameElement, [data]: [string | null]) => {\n if (!element.contentWindow) return;\n\n if (data) {\n this.queuePayload('gjs', data);\n }\n });\n onMessage = modifier((element: HTMLIFrameElement) => {\n this.connection = connectToChild({\n iframe: element,\n methods: {},\n });\n\n waitForPromise(this.connection.promise).catch(console.error);\n\n return () => this.connection?.destroy();\n });\n\n @action\n @waitFor\n async queuePayload(format: string, text: string) {\n await Promise.resolve();\n if (isDestroyed(this) || isDestroying(this)) return;\n\n if (!this.connection) return;\n\n let child = await this.connection.promise;\n\n if (isDestroyed(this) || isDestroying(this)) return;\n\n await child.update(format, text);\n }\n}\n"],"names":["_initializerDefineProperty","target","property","descriptor","context","Object","defineProperty","enumerable","configurable","writable","value","initializer","call","_typeof","obj","Symbol","iterator","constructor","prototype","_toPrimitive","input","hint","prim","toPrimitive","undefined","res","TypeError","String","Number","_toPropertyKey","arg","key","_defineProperty","toPropertyKey","_applyDecoratedDescriptor","decorators","desc","keys","forEach","slice","reverse","reduce","decorator","HostMessaging","_class","_descriptor","modifier","element","data","contentWindow","queuePayload","connection","connectToChild","iframe","methods","waitForPromise","promise","catch","console","error","destroy","format","text","Promise","resolve","isDestroyed","isDestroying","child","update","tracked","action","waitFor","getOwnPropertyDescriptor"],"mappings":";;;;;;;AAAe,SAASA,0BAA0BA,CAACC,MAAM,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,OAAO,EAAE;EACxF,IAAI,CAACD,UAAU,EAAE,OAAA;AACjBE,EAAAA,MAAM,CAACC,cAAc,CAACL,MAAM,EAAEC,QAAQ,EAAE;IACtCK,UAAU,EAAEJ,UAAU,CAACI,UAAU;IACjCC,YAAY,EAAEL,UAAU,CAACK,YAAY;IACrCC,QAAQ,EAAEN,UAAU,CAACM,QAAQ;AAC7BC,IAAAA,KAAK,EAAEP,UAAU,CAACQ,WAAW,GAAGR,UAAU,CAACQ,WAAW,CAACC,IAAI,CAACR,OAAO,CAAC,GAAG,KAAK,CAAA;AAC9E,GAAC,CAAC,CAAA;AACJ;;ACRe,SAASS,OAAOA,CAACC,GAAG,EAAE;EACnC,yBAAyB,CAAA;;AAEzB,EAAA,OAAOD,OAAO,GAAG,UAAU,IAAI,OAAOE,MAAM,IAAI,QAAQ,IAAI,OAAOA,MAAM,CAACC,QAAQ,GAAG,UAAUF,GAAG,EAAE;AAClG,IAAA,OAAO,OAAOA,GAAG,CAAA;GAClB,GAAG,UAAUA,GAAG,EAAE;IACjB,OAAOA,GAAG,IAAI,UAAU,IAAI,OAAOC,MAAM,IAAID,GAAG,C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key extends keyof Registry> {
|
|
4
|
-
Args: {
|
|
5
|
-
Positional: [Key];
|
|
6
|
-
};
|
|
7
|
-
Return: Registry[Key];
|
|
8
|
-
}
|
|
9
|
-
declare class GetService<Key extends keyof Registry> extends Helper<Signature<Key>> {
|
|
10
|
-
compute([name]: [Key]): Registry[`${Key}`];
|
|
11
|
-
}
|
|
12
|
-
declare const service: typeof GetService;
|
|
13
|
-
export { GetService as default, service };
|
package/dist/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { Button } from "./components/button.js";
|
|
2
|
-
export { default as Code, default as EditableCode, default as REPL } from "./components/code.js";
|
|
3
|
-
export { ExternalLink } from "./components/external-link.js";
|
|
4
|
-
export { Link } from "./components/link.js";
|
|
5
|
-
export { service } from "./helpers/service.js";
|
package/dist/proper-links.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import EmberRouter from '@ember/routing/router';
|
|
2
|
-
declare function properLinks(klass: typeof EmberRouter): {
|
|
3
|
-
new (...args: object[]): {
|
|
4
|
-
location: "history" | "hash" | "none" | "auto";
|
|
5
|
-
rootURL: string;
|
|
6
|
-
transitionTo(name: string, options?: {} | undefined): import("@ember/routing/transition").default<unknown>;
|
|
7
|
-
transitionTo(name: string, ...models: any[]): import("@ember/routing/transition").default<unknown>;
|
|
8
|
-
transitionTo(name: string, options: {}): import("@ember/routing/transition").default<unknown>;
|
|
9
|
-
_super(...args: any[]): any;
|
|
10
|
-
init(): void;
|
|
11
|
-
concatenatedProperties: string[] | null;
|
|
12
|
-
isDestroyed: boolean;
|
|
13
|
-
isDestroying: boolean;
|
|
14
|
-
destroy(): import("@ember/object/core").default;
|
|
15
|
-
willDestroy(): void;
|
|
16
|
-
toString(): string;
|
|
17
|
-
get<K extends keyof any>(key: K): any[K];
|
|
18
|
-
get(key: string): unknown;
|
|
19
|
-
getProperties<K_1 extends keyof any>(list: K_1[]): Pick<any, K_1>;
|
|
20
|
-
getProperties<K_2 extends keyof any>(...list: K_2[]): Pick<any, K_2>;
|
|
21
|
-
getProperties(list: string[]): Record<string, unknown>;
|
|
22
|
-
getProperties(...list: string[]): Record<string, unknown>;
|
|
23
|
-
set<K_3 extends keyof any>(key: K_3, value: any[K_3]): any[K_3];
|
|
24
|
-
set<T>(key: keyof any, value: T): T;
|
|
25
|
-
set<T_1>(key: string, value: T_1): T_1;
|
|
26
|
-
setProperties<K_4 extends keyof any>(hash: Pick<any, K_4>): Pick<any, K_4>;
|
|
27
|
-
setProperties<K_5 extends keyof any>(hash: Record<K_5, unknown>): Pick<any, K_5>;
|
|
28
|
-
setProperties<R extends Record<string, unknown>>(hash: R): R;
|
|
29
|
-
notifyPropertyChange(keyName: string): any;
|
|
30
|
-
addObserver<Target>(key: keyof any, target: Target, method: import("@ember/object/-private/types").ObserverMethod<Target, any>): any;
|
|
31
|
-
addObserver(key: keyof any, method: import("@ember/object/-private/types").ObserverMethod<any, any>): any;
|
|
32
|
-
removeObserver<Target_1>(key: keyof any, target: Target_1, method: import("@ember/object/-private/types").ObserverMethod<Target_1, any>): any;
|
|
33
|
-
removeObserver(key: keyof any, method: import("@ember/object/-private/types").ObserverMethod<any, any>): any;
|
|
34
|
-
incrementProperty(keyName: keyof any, increment?: number | undefined): number;
|
|
35
|
-
decrementProperty(keyName: keyof any, decrement?: number | undefined): number;
|
|
36
|
-
toggleProperty(keyName: keyof any): boolean;
|
|
37
|
-
cacheFor<K_6 extends keyof any>(key: K_6): any[K_6] | undefined;
|
|
38
|
-
on<T_2>(name: string, target: T_2, method: import("ember/-private/type-utils").EmberMethod<T_2>): any;
|
|
39
|
-
on(name: string, method: import("ember/-private/type-utils").EmberMethod<any>): any;
|
|
40
|
-
one<T_3>(name: string, target: T_3, method: import("ember/-private/type-utils").EmberMethod<T_3>): any;
|
|
41
|
-
one(name: string, method: import("ember/-private/type-utils").EmberMethod<any>): any;
|
|
42
|
-
trigger(name: string, ...args: unknown[]): unknown;
|
|
43
|
-
off<T_4>(name: string, target: T_4, method: import("ember/-private/type-utils").EmberMethod<T_4>): any;
|
|
44
|
-
off(name: string, method: import("ember/-private/type-utils").EmberMethod<any>): any;
|
|
45
|
-
has(name: string): boolean;
|
|
46
|
-
};
|
|
47
|
-
map(callback: (this: import("@ember/routing/-private/router-dsl").default) => void): void;
|
|
48
|
-
create<Class extends typeof import("@ember/object/core").default>(this: Class, ...initialValues: (import("@ember/object/mixin").default | import("@ember/object/core").MembersOf<Class>)[]): InstanceType<Class>;
|
|
49
|
-
extend<Statics, Instance>(this: Statics & (new (properties?: object | undefined) => Instance) & (new (...args: any[]) => Instance), ...mixins: (Record<string, unknown> | import("@ember/object/mixin").default)[]): Readonly<Statics> & (new (properties?: object | undefined) => Instance) & (new (...args: any[]) => Instance);
|
|
50
|
-
reopen<Statics_1, Instance_1>(this: Statics_1 & (new (properties?: object | undefined) => Instance_1) & (new (...args: any[]) => Instance_1), ...mixins: (Record<string, unknown> | import("@ember/object/mixin").default)[]): Readonly<Statics_1> & (new (properties?: object | undefined) => Instance_1) & (new (...args: any[]) => Instance_1);
|
|
51
|
-
reopenClass<Statics_2>(this: Statics_2, ...extraStatics: (Record<string, unknown> | import("@ember/object/mixin").default)[]): Statics_2;
|
|
52
|
-
isClass: boolean;
|
|
53
|
-
isMethod: boolean;
|
|
54
|
-
};
|
|
55
|
-
export { properLinks };
|
package/dist/proper-links.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { getOwner } from '@ember/application';
|
|
2
|
-
import { assert } from '@ember/debug';
|
|
3
|
-
import { registerDestructor } from '@ember/destroyable';
|
|
4
|
-
|
|
5
|
-
function properLinks(klass) {
|
|
6
|
-
return class extends klass {
|
|
7
|
-
constructor(...args) {
|
|
8
|
-
super(...args);
|
|
9
|
-
const handler = event => {
|
|
10
|
-
/**
|
|
11
|
-
* event.target may not be an anchor,
|
|
12
|
-
* it may be a span, svg, img, or any number of elements nested in <a>...</a>
|
|
13
|
-
*/
|
|
14
|
-
let interactive = isLink(event);
|
|
15
|
-
if (!interactive) return;
|
|
16
|
-
let owner = getOwner(this);
|
|
17
|
-
assert('owner is not present', owner);
|
|
18
|
-
let routerService = owner.lookup('service:router');
|
|
19
|
-
handle(routerService, interactive, event);
|
|
20
|
-
return false;
|
|
21
|
-
};
|
|
22
|
-
document.body.addEventListener('click', handler, false);
|
|
23
|
-
registerDestructor(this, () => document.body.removeEventListener('click', handler));
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function isLink(event) {
|
|
28
|
-
/**
|
|
29
|
-
* Using composed path in case the link is removed from the DOM
|
|
30
|
-
* before the event handler evaluates
|
|
31
|
-
*/
|
|
32
|
-
let composedPath = event.composedPath();
|
|
33
|
-
for (let element of composedPath) {
|
|
34
|
-
if (element instanceof HTMLAnchorElement) {
|
|
35
|
-
return element;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function handle(router, element, event) {
|
|
40
|
-
/**
|
|
41
|
-
* The href includes the protocol/host/etc
|
|
42
|
-
* In order to not have the page look like a full page refresh,
|
|
43
|
-
* we need to chop that "origin" off, and just use the path
|
|
44
|
-
*/
|
|
45
|
-
let url = new URL(element.href);
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* If the domains are different, we want to fall back to normal link behavior
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
if (location.origin !== url.origin) return;
|
|
52
|
-
let routeInfo = router.recognize(url.pathname);
|
|
53
|
-
if (routeInfo) {
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
event.stopImmediatePropagation();
|
|
56
|
-
event.stopPropagation();
|
|
57
|
-
router.transitionTo(url.pathname);
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { properLinks };
|
|
63
|
-
//# sourceMappingURL=proper-links.js.map
|
package/dist/proper-links.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proper-links.js","sources":["../src/proper-links.ts"],"sourcesContent":["import { getOwner } from '@ember/application';\nimport { assert } from '@ember/debug';\nimport { registerDestructor } from '@ember/destroyable';\n\nimport type EmberRouter from '@ember/routing/router';\nimport type RouterService from '@ember/routing/router-service';\n\nexport function properLinks(klass: typeof EmberRouter) {\n return class extends klass {\n constructor(...args: object[]) {\n super(...args);\n\n const handler = (event: MouseEvent) => {\n /**\n * event.target may not be an anchor,\n * it may be a span, svg, img, or any number of elements nested in <a>...</a>\n */\n let interactive = isLink(event);\n\n if (!interactive) return;\n\n let owner = getOwner(this);\n\n assert('owner is not present', owner);\n\n let routerService = owner.lookup('service:router');\n\n handle(routerService, interactive, event);\n\n return false;\n };\n\n document.body.addEventListener('click', handler, false);\n\n registerDestructor(this, () => document.body.removeEventListener('click', handler));\n }\n };\n}\n\nfunction isLink(event: Event) {\n /**\n * Using composed path in case the link is removed from the DOM\n * before the event handler evaluates\n */\n let composedPath = event.composedPath();\n\n for (let element of composedPath) {\n if (element instanceof HTMLAnchorElement) {\n return element;\n }\n }\n}\n\nfunction handle(router: RouterService, element: HTMLAnchorElement, event: Event) {\n /**\n * The href includes the protocol/host/etc\n * In order to not have the page look like a full page refresh,\n * we need to chop that \"origin\" off, and just use the path\n */\n let url = new URL(element.href);\n\n /**\n * If the domains are different, we want to fall back to normal link behavior\n *\n */\n if (location.origin !== url.origin) return;\n\n let routeInfo = router.recognize(url.pathname);\n\n if (routeInfo) {\n event.preventDefault();\n event.stopImmediatePropagation();\n event.stopPropagation();\n\n router.transitionTo(url.pathname);\n\n return false;\n }\n}\n"],"names":["properLinks","klass","constructor","args","handler","event","interactive","isLink","owner","getOwner","assert","routerService","lookup","handle","document","body","addEventListener","registerDestructor","removeEventListener","composedPath","element","HTMLAnchorElement","router","url","URL","href","location","origin","routeInfo","recognize","pathname","preventDefault","stopImmediatePropagation","stopPropagation","transitionTo"],"mappings":";;;;AAOO,SAASA,WAAWA,CAACC,KAAyB,EAAE;EACrD,OAAO,cAAcA,KAAK,C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