Skip to content

Commit

Permalink
Add dist directory relocate-living-docs-elements
Browse files Browse the repository at this point in the history
  • Loading branch information
fgervasi committed Dec 23, 2022
1 parent 1179905 commit e7df0e3
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 0 deletions.
2 changes: 2 additions & 0 deletions relocate-living-docs-elements/dist/cjs/Service.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare function relocateLivingDocsElements(elementIdPrefix: string, elementIds: string[], targetElement: HTMLElement): void;
export { relocateLivingDocsElements };
26 changes: 26 additions & 0 deletions relocate-living-docs-elements/dist/cjs/Service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.relocateLivingDocsElements = void 0;
function relocateLivingDocsElements(elementIdPrefix, elementIds, targetElement) {
const updateInterval = 300;
let intervalId;
let intervalLimit = updateInterval * 20;
intervalId = setInterval(() => {
elementIds.forEach((elementId) => {
const element = document.querySelector(`#${elementIdPrefix}-${elementId}`);
if (element) {
element.parentNode.removeChild(element);
targetElement.appendChild(element);
elementIds = elementIds.filter((id) => id !== elementId);
}
else {
console.warn(`Element with Id: ${elementId} not found yet.`);
}
});
if (elementIds.length < 1 || intervalLimit <= 0) {
clearInterval(intervalId);
}
intervalLimit -= updateInterval;
}, updateInterval);
}
exports.relocateLivingDocsElements = relocateLivingDocsElements;
1 change: 1 addition & 0 deletions relocate-living-docs-elements/dist/cjs/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./Service";
19 changes: 19 additions & 0 deletions relocate-living-docs-elements/dist/cjs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"use strict";
// Note: Export all your code in here, that should be exposed to the consumer
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
// e.g. Exports all exports of the Service.ts file
__exportStar(require("./Service"), exports);
3 changes: 3 additions & 0 deletions relocate-living-docs-elements/dist/cjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
2 changes: 2 additions & 0 deletions relocate-living-docs-elements/dist/mjs/Service.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare function relocateLivingDocsElements(elementIdPrefix: string, elementIds: string[], targetElement: HTMLElement): void;
export { relocateLivingDocsElements };
23 changes: 23 additions & 0 deletions relocate-living-docs-elements/dist/mjs/Service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function relocateLivingDocsElements(elementIdPrefix, elementIds, targetElement) {
const updateInterval = 300;
let intervalId;
let intervalLimit = updateInterval * 20;
intervalId = setInterval(() => {
elementIds.forEach((elementId) => {
const element = document.querySelector(`#${elementIdPrefix}-${elementId}`);
if (element) {
element.parentNode.removeChild(element);
targetElement.appendChild(element);
elementIds = elementIds.filter((id) => id !== elementId);
}
else {
console.warn(`Element with Id: ${elementId} not found yet.`);
}
});
if (elementIds.length < 1 || intervalLimit <= 0) {
clearInterval(intervalId);
}
intervalLimit -= updateInterval;
}, updateInterval);
}
export { relocateLivingDocsElements };
1 change: 1 addition & 0 deletions relocate-living-docs-elements/dist/mjs/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./Service";
3 changes: 3 additions & 0 deletions relocate-living-docs-elements/dist/mjs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Note: Export all your code in here, that should be exposed to the consumer
// e.g. Exports all exports of the Service.ts file
export * from "./Service";
3 changes: 3 additions & 0 deletions relocate-living-docs-elements/dist/mjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}

0 comments on commit e7df0e3

Please sign in to comment.