1 | var __spreadArrays = (this && this.__spreadArrays) || function () {
|
2 | for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
3 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
4 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
5 | r[k] = a[j];
|
6 | return r;
|
7 | };
|
8 | import { r as registerInstance, h } from './core-bb3ac537.js';
|
9 | var keys = ['inputs', 'outputs', 'props', 'events', 'methods'];
|
10 | var Api = (function () {
|
11 | function Api(hostRef) {
|
12 | registerInstance(this, hostRef);
|
13 | }
|
14 | Api.prototype.hasApi = function () {
|
15 | if (!this.doc) {
|
16 | return false;
|
17 | }
|
18 | for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
19 | var k = keys_1[_i];
|
20 | if (this.doc[k] && this.doc[k].length > 0) {
|
21 | return true;
|
22 | }
|
23 | }
|
24 | };
|
25 | Api.prototype.angular = function () {
|
26 | return [
|
27 | this.doc.inputs ? this.doc.inputs.map(function (i) { return h("ad-input-def", { input: i }); }) : undefined,
|
28 | this.doc.outputs ? this.doc.outputs.map(function (i) { return h("ad-output-def", { output: i }); }) : undefined,
|
29 | this.doc.props ? this.doc.props.map(function (i) { return h("ad-prop-def", { prop: i }); }) : undefined
|
30 | ];
|
31 | };
|
32 | Api.prototype.stencil = function () {
|
33 | return [
|
34 | this.doc.props ? this.doc.props.map(function (i) { return h("ad-prop-def", { prop: i }); }) : undefined,
|
35 | this.doc.events ? this.doc.events.map(function (i) { return h("ad-event-def", { event: i }); }) : undefined,
|
36 | ];
|
37 | };
|
38 | Api.prototype.render = function () {
|
39 | if (!this.hasApi()) {
|
40 | return undefined;
|
41 | }
|
42 | var isAngular = !this.doc.tag;
|
43 | return (h("article", { id: "api", class: "api" }, h("h2", null, "API"), isAngular ? this.angular() : this.stencil(), this.doc.methods ? this.doc.methods.map(function (i) { return h("ad-method-def", { method: i }); }) : undefined));
|
44 | };
|
45 | Object.defineProperty(Api, "style", {
|
46 | get: function () { return ".sc-ad-api-h{display:block;font-size:.875rem;font-family:var(--anj-font-family);font-weight:400;line-height:1.5;outline:none}.sc-ad-api-h, .sc-ad-api-h:after, .sc-ad-api-h:before{-webkit-box-sizing:border-box;box-sizing:border-box;outline:none}.sc-ad-api-h:active, .sc-ad-api-h .sc-ad-api:active, .sc-ad-api-h:focus, .sc-ad-api-h .sc-ad-api:focus{outline:none}.sc-ad-api-h .api.sc-ad-api{border-bottom:1px solid var(--anj-border);margin-bottom:3rem;padding-bottom:3rem}.sc-ad-api-h .api.sc-ad-api h2.sc-ad-api{margin-bottom:1.5rem}"; },
|
47 | enumerable: true,
|
48 | configurable: true
|
49 | });
|
50 | return Api;
|
51 | }());
|
52 | var ApiName = (function () {
|
53 | function ApiName(hostRef) {
|
54 | registerInstance(this, hostRef);
|
55 | }
|
56 | Object.defineProperty(ApiName, "style", {
|
57 | get: function () { return "ad-api-name{display:inline;font-size:.875rem;font-family:var(--anj-font-family);font-weight:400;line-height:1.5;outline:none}ad-api-name,ad-api-name:after,ad-api-name:before{-webkit-box-sizing:border-box;box-sizing:border-box;outline:none}ad-api-name:active,ad-api-name :active,ad-api-name:focus,ad-api-name :focus{outline:none}ad-api-name:after{color:var(--anj-secondary-dark);content:\":\";margin-right:.5rem}"; },
|
58 | enumerable: true,
|
59 | configurable: true
|
60 | });
|
61 | return ApiName;
|
62 | }());
|
63 | var ArgDef = (function () {
|
64 | function ArgDef(hostRef) {
|
65 | registerInstance(this, hostRef);
|
66 | }
|
67 | ArgDef.prototype.render = function () {
|
68 | return [
|
69 | h("ad-api-name", null, this.arg.name),
|
70 | h("ad-type-def", null, this.arg.type)
|
71 | ];
|
72 | };
|
73 | Object.defineProperty(ArgDef, "style", {
|
74 | get: function () { return "ad-arg-def{display:inline;font-size:.875rem;font-family:var(--anj-font-family);font-weight:400;line-height:1.5;outline:none}ad-arg-def,ad-arg-def:after,ad-arg-def:before{-webkit-box-sizing:border-box;box-sizing:border-box;outline:none}ad-arg-def:active,ad-arg-def :active,ad-arg-def:focus,ad-arg-def :focus{outline:none}ad-arg-def:after{color:var(--anj-secondary-dark);content:\",\";margin-right:.5rem}ad-arg-def:last-child:after{content:none;margin-right:0}"; },
|
75 | enumerable: true,
|
76 | configurable: true
|
77 | });
|
78 | return ArgDef;
|
79 | }());
|
80 | var Decorator = (function () {
|
81 | function Decorator(hostRef) {
|
82 | registerInstance(this, hostRef);
|
83 | }
|
84 | Object.defineProperty(Decorator, "style", {
|
85 | get: function () { return "ad-decorator{color:var(--anj-secondary-dark)}.api.ng ad-method-def ad-decorator,.api.ng ad-prop-def ad-decorator{display:none}"; },
|
86 | enumerable: true,
|
87 | configurable: true
|
88 | });
|
89 | return Decorator;
|
90 | }());
|
91 | var EventDef = (function () {
|
92 | function EventDef(hostRef) {
|
93 | registerInstance(this, hostRef);
|
94 | }
|
95 | EventDef.prototype.render = function () {
|
96 | return [
|
97 | h("h4", null, h("ad-decorator", null, "@Event"), "\u00A0", h("ad-api-name", null, this.event.event), h("ad-type-def", null, "<", this.event.detail, ">")),
|
98 | h("p", null, this.event.docs)
|
99 | ];
|
100 | };
|
101 | Object.defineProperty(EventDef, "style", {
|
102 | get: function () { return "ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"; },
|
103 | enumerable: true,
|
104 | configurable: true
|
105 | });
|
106 | return EventDef;
|
107 | }());
|
108 | var InputDef = (function () {
|
109 | function InputDef(hostRef) {
|
110 | registerInstance(this, hostRef);
|
111 | }
|
112 | InputDef.prototype.render = function () {
|
113 | return [
|
114 | h("h4", null, h("ad-decorator", null, "@Input\u00A0"), h("ad-api-name", null, this.input.name), h("ad-type-def", null, this.input.type)),
|
115 | h("p", null, this.input.docs)
|
116 | ];
|
117 | };
|
118 | Object.defineProperty(InputDef, "style", {
|
119 | get: function () { return "ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"; },
|
120 | enumerable: true,
|
121 | configurable: true
|
122 | });
|
123 | return InputDef;
|
124 | }());
|
125 | var MethodDef = (function () {
|
126 | function MethodDef(hostRef) {
|
127 | registerInstance(this, hostRef);
|
128 | }
|
129 | MethodDef.prototype.nameless = function (name) {
|
130 | return "(" + name.split('(')[1];
|
131 | };
|
132 | MethodDef.prototype.render = function () {
|
133 | return [
|
134 | h("h4", null, h("ad-decorator", null, "@Method\u00A0"), h("ad-api-name", null, this.method.name), h("ad-type-def", null, this.nameless(this.method.signature))),
|
135 | h("p", null, this.method.docs)
|
136 | ];
|
137 | };
|
138 | Object.defineProperty(MethodDef, "style", {
|
139 | get: function () { return "ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"; },
|
140 | enumerable: true,
|
141 | configurable: true
|
142 | });
|
143 | return MethodDef;
|
144 | }());
|
145 | var OutputDef = (function () {
|
146 | function OutputDef(hostRef) {
|
147 | registerInstance(this, hostRef);
|
148 | }
|
149 | OutputDef.prototype.render = function () {
|
150 | return [
|
151 | h("h4", null, h("ad-decorator", null, "@Output\u00A0"), h("ad-api-name", null, this.output.name), h("ad-type-def", null, this.output.type)),
|
152 | h("p", null, this.output.docs)
|
153 | ];
|
154 | };
|
155 | Object.defineProperty(OutputDef, "style", {
|
156 | get: function () { return "ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"; },
|
157 | enumerable: true,
|
158 | configurable: true
|
159 | });
|
160 | return OutputDef;
|
161 | }());
|
162 | var PropDef = (function () {
|
163 | function PropDef(hostRef) {
|
164 | registerInstance(this, hostRef);
|
165 | }
|
166 | PropDef.prototype.render = function () {
|
167 | return [
|
168 | h("h4", null, h("ad-decorator", null, "@Prop\u00A0"), h("ad-api-name", null, this.prop.name), h("ad-type-def", null, this.prop.type)),
|
169 | h("p", null, this.prop.docs)
|
170 | ];
|
171 | };
|
172 | Object.defineProperty(PropDef, "style", {
|
173 | get: function () { return "ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"; },
|
174 | enumerable: true,
|
175 | configurable: true
|
176 | });
|
177 | return PropDef;
|
178 | }());
|
179 | var RealTime = (function () {
|
180 | function RealTime(hostRef) {
|
181 | registerInstance(this, hostRef);
|
182 | }
|
183 | Object.defineProperty(RealTime, "style", {
|
184 | get: function () { return "ad-real-time{border:1px dashed var(--anj-border);border-radius:.25rem;display:block;margin-top:1.5rem;overflow-x:auto;padding:1rem;width:100%}"; },
|
185 | enumerable: true,
|
186 | configurable: true
|
187 | });
|
188 | return RealTime;
|
189 | }());
|
190 | var Toc = (function () {
|
191 | function Toc(hostRef) {
|
192 | registerInstance(this, hostRef);
|
193 | this.activeId = '#overview';
|
194 | |
195 |
|
196 |
|
197 | this.docs = {};
|
198 | |
199 |
|
200 |
|
201 | this.keys = [];
|
202 | }
|
203 | Toc.prototype.onDemosChange = function () {
|
204 | this.sectionIds = ['#overview'].concat(this.keys.map(function (d) { return "#" + d; })).concat('#api');
|
205 | };
|
206 | Toc.prototype.connectedCallback = function () {
|
207 | this.navigate = debounce(this.navigate.bind(this), 100);
|
208 | this.onScroll = debounce(this.onScroll.bind(this), 25);
|
209 | this.onDemosChange();
|
210 | if (window.location.hash) {
|
211 | this.navigate();
|
212 | }
|
213 | };
|
214 | Toc.prototype.onScroll = function () {
|
215 | var els = this.sectionIds.map(function (id) { return document.querySelector(id); });
|
216 | var closest = els[0];
|
217 | els.slice(1).forEach(function (el) {
|
218 | if (el && Math.abs(window.scrollY - el.offsetTop) < Math.abs(window.scrollY - closest.offsetTop)) {
|
219 | closest = el;
|
220 | }
|
221 | });
|
222 | this.activeId = "#" + closest.getAttribute('id');
|
223 | };
|
224 | Toc.prototype.parseTitle = function (id) {
|
225 | var usage = id.replace('#', '');
|
226 | var doc = this.docs[usage];
|
227 | return doc ? doc.split(/##(.*?)\n/).find(function (p) { return p !== ''; }).trim() : usage;
|
228 | };
|
229 | Toc.prototype.anchorClass = function (usage) {
|
230 | return usage === this.activeId ? 'anj-active' : '';
|
231 | };
|
232 | Toc.prototype.navigate = function () {
|
233 | var _this = this;
|
234 | return new Promise(function (resolve) {
|
235 | window.setTimeout(function () {
|
236 | _this.activeId = window.location.hash;
|
237 | var el = document.querySelector(_this.activeId);
|
238 | if (el) {
|
239 | window.scrollTo(0, el.offsetTop);
|
240 | }
|
241 | resolve();
|
242 | }, 500);
|
243 | });
|
244 | };
|
245 | Toc.prototype.render = function () {
|
246 | var _this = this;
|
247 | if (!this.sectionIds) {
|
248 | return;
|
249 | }
|
250 | var path = window.location.pathname;
|
251 | return (h("div", { class: "anj-toc" }, this.sectionIds.map(function (id) { return h("a", { href: "" + path + id, onClick: function () { return _this.activeId = id; }, class: _this.anchorClass(id) }, _this.parseTitle(id)); })));
|
252 | };
|
253 | Object.defineProperty(Toc, "watchers", {
|
254 | get: function () {
|
255 | return {
|
256 | "keys": ["onDemosChange"]
|
257 | };
|
258 | },
|
259 | enumerable: true,
|
260 | configurable: true
|
261 | });
|
262 | Object.defineProperty(Toc, "style", {
|
263 | get: function () { return "ad-toc{display:block;position:relative}ad-toc .anj-toc{padding:1rem 0;position:fixed;top:3rem}ad-toc a{display:block;font-size:.75rem;margin-bottom:.5rem;text-transform:capitalize;-webkit-transition:color .2s ease;transition:color .2s ease}ad-toc a:focus{text-decoration:underline}ad-toc a:active{text-decoration:none}ad-toc a.anj-active,ad-toc a.anj-active:focus,ad-toc a.anj-active:hover{color:var(--anj-primary);text-decoration:none}"; },
|
264 | enumerable: true,
|
265 | configurable: true
|
266 | });
|
267 | return Toc;
|
268 | }());
|
269 | var debounce = function (func, wait) {
|
270 | if (wait === void 0) { wait = 0; }
|
271 | var timer;
|
272 | return function () {
|
273 | var args = [];
|
274 | for (var _i = 0; _i < arguments.length; _i++) {
|
275 | args[_i] = arguments[_i];
|
276 | }
|
277 | clearTimeout(timer);
|
278 | timer = setTimeout.apply(void 0, __spreadArrays([func, wait], args));
|
279 | };
|
280 | };
|
281 | var TypeDef = (function () {
|
282 | function TypeDef(hostRef) {
|
283 | registerInstance(this, hostRef);
|
284 | }
|
285 | Object.defineProperty(TypeDef, "style", {
|
286 | get: function () { return "ad-type-def{color:var(--anj-neutral-dark);font-size:.75rem}"; },
|
287 | enumerable: true,
|
288 | configurable: true
|
289 | });
|
290 | return TypeDef;
|
291 | }());
|
292 | export { Api as ad_api, ApiName as ad_api_name, ArgDef as ad_arg_def, Decorator as ad_decorator, EventDef as ad_event_def, InputDef as ad_input_def, MethodDef as ad_method_def, OutputDef as ad_output_def, PropDef as ad_prop_def, RealTime as ad_real_time, Toc as ad_toc, TypeDef as ad_type_def };
|