@pie-api/pie-api-live-components
Advanced tools
Comparing version 1.13.0 to 1.13.1-beta.1
@@ -1,1 +0,356 @@ | ||
var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function t(n,e,t){return n(t={path:e,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},t.exports),t.exports}var i=t((function(n,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var t="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;e.default=t}));e(i);var o=t((function(n,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(n){return function n(e,t){switch(r(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var i=[].concat(t,[e]),r=function(n){var e=n[String(o.default)];return"function"==typeof e?e:"function"==typeof n.inspect?n.inspect:void 0}(e);if(void 0!==r){var u=r.call(e);if(u!==e)return"string"==typeof u?u:n(u,i)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var i=Math.min(10,e.length),o=e.length-i,r=[],u=0;u<i;++u)r.push(n(e[u],t));return 1===o?r.push("... 1 more item"):o>1&&r.push("... ".concat(o," more items")),"["+r.join(", ")+"]"}(e,i);return function(e,t){var i=Object.keys(e);return 0===i.length?"{}":t.length>2?"["+function(n){var e=Object.prototype.toString.call(n).replace(/^\[object /,"").replace(/]$/,"");if("Object"===e&&"function"==typeof n.constructor){var t=n.constructor.name;if("string"==typeof t&&""!==t)return t}return e}(e)+"]":"{ "+i.map((function(i){return i+": "+n(e[i],t)})).join(", ")+" }"}(e,i)}(e,t);default:return String(e)}}(n,[])};var t,o=(t=i)&&t.__esModule?t:{default:t};function r(n){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}}));e(o);var r=t((function(n,e){function t(n){for(var e=null,t=1;t<n.length;t++){var o=n[t],r=i(o);if(r!==o.length&&(null===e||r<e)&&0===(e=r))break}return null===e?0:e}function i(n){for(var e=0;e<n.length&&(" "===n[e]||"\t"===n[e]);)e++;return e}function o(n){return i(n)===n.length}Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringValue=function(n){var e=n.split(/\r\n|[\n\r]/g),i=t(e);if(0!==i)for(var r=1;r<e.length;r++)e[r]=e[r].slice(i);for(;e.length>0&&o(e[0]);)e.shift();for(;e.length>0&&o(e[e.length-1]);)e.pop();return e.join("\n")},e.getBlockStringIndentation=t,e.printBlockString=function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=-1===n.indexOf("\n"),o=" "===n[0]||"\t"===n[0],r='"'===n[n.length-1],u=!i||r||t,E="";return!u||i&&o||(E+="\n"+e),E+=e?n.replace(/\n/g,"\n"+e):n,u&&(E+="\n"),'"""'+E.replace(/"""/g,'\\"""')+'"""'}}));e(r);var u=t((function(n,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0;var t=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});e.Kind=t}));e(u);export{n as a,r as b,t as c,o as i,u as k,i as n,e as u} | ||
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
function unwrapExports (x) { | ||
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | ||
} | ||
function createCommonjsModule(fn, basedir, module) { | ||
return module = { | ||
path: basedir, | ||
exports: {}, | ||
require: function (path, base) { | ||
return commonjsRequire(); | ||
} | ||
}, fn(module, module.exports), module.exports; | ||
} | ||
function commonjsRequire () { | ||
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); | ||
} | ||
var nodejsCustomInspectSymbol_1 = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined; | ||
var _default = nodejsCustomInspectSymbol; | ||
exports.default = _default; | ||
}); | ||
unwrapExports(nodejsCustomInspectSymbol_1); | ||
var inspect_1 = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = inspect; | ||
var _nodejsCustomInspectSymbol = _interopRequireDefault(nodejsCustomInspectSymbol_1); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
var MAX_ARRAY_LENGTH = 10; | ||
var MAX_RECURSIVE_DEPTH = 2; | ||
/** | ||
* Used to print values in error messages. | ||
*/ | ||
function inspect(value) { | ||
return formatValue(value, []); | ||
} | ||
function formatValue(value, seenValues) { | ||
switch (_typeof(value)) { | ||
case 'string': | ||
return JSON.stringify(value); | ||
case 'function': | ||
return value.name ? "[function ".concat(value.name, "]") : '[function]'; | ||
case 'object': | ||
if (value === null) { | ||
return 'null'; | ||
} | ||
return formatObjectValue(value, seenValues); | ||
default: | ||
return String(value); | ||
} | ||
} | ||
function formatObjectValue(value, previouslySeenValues) { | ||
if (previouslySeenValues.indexOf(value) !== -1) { | ||
return '[Circular]'; | ||
} | ||
var seenValues = [].concat(previouslySeenValues, [value]); | ||
var customInspectFn = getCustomFn(value); | ||
if (customInspectFn !== undefined) { | ||
// $FlowFixMe(>=0.90.0) | ||
var customValue = customInspectFn.call(value); // check for infinite recursion | ||
if (customValue !== value) { | ||
return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues); | ||
} | ||
} else if (Array.isArray(value)) { | ||
return formatArray(value, seenValues); | ||
} | ||
return formatObject(value, seenValues); | ||
} | ||
function formatObject(object, seenValues) { | ||
var keys = Object.keys(object); | ||
if (keys.length === 0) { | ||
return '{}'; | ||
} | ||
if (seenValues.length > MAX_RECURSIVE_DEPTH) { | ||
return '[' + getObjectTag(object) + ']'; | ||
} | ||
var properties = keys.map(function (key) { | ||
var value = formatValue(object[key], seenValues); | ||
return key + ': ' + value; | ||
}); | ||
return '{ ' + properties.join(', ') + ' }'; | ||
} | ||
function formatArray(array, seenValues) { | ||
if (array.length === 0) { | ||
return '[]'; | ||
} | ||
if (seenValues.length > MAX_RECURSIVE_DEPTH) { | ||
return '[Array]'; | ||
} | ||
var len = Math.min(MAX_ARRAY_LENGTH, array.length); | ||
var remaining = array.length - len; | ||
var items = []; | ||
for (var i = 0; i < len; ++i) { | ||
items.push(formatValue(array[i], seenValues)); | ||
} | ||
if (remaining === 1) { | ||
items.push('... 1 more item'); | ||
} else if (remaining > 1) { | ||
items.push("... ".concat(remaining, " more items")); | ||
} | ||
return '[' + items.join(', ') + ']'; | ||
} | ||
function getCustomFn(object) { | ||
var customInspectFn = object[String(_nodejsCustomInspectSymbol.default)]; | ||
if (typeof customInspectFn === 'function') { | ||
return customInspectFn; | ||
} | ||
if (typeof object.inspect === 'function') { | ||
return object.inspect; | ||
} | ||
} | ||
function getObjectTag(object) { | ||
var tag = Object.prototype.toString.call(object).replace(/^\[object /, '').replace(/]$/, ''); | ||
if (tag === 'Object' && typeof object.constructor === 'function') { | ||
var name = object.constructor.name; | ||
if (typeof name === 'string' && name !== '') { | ||
return name; | ||
} | ||
} | ||
return tag; | ||
} | ||
}); | ||
unwrapExports(inspect_1); | ||
var blockString = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.dedentBlockStringValue = dedentBlockStringValue; | ||
exports.getBlockStringIndentation = getBlockStringIndentation; | ||
exports.printBlockString = printBlockString; | ||
/** | ||
* Produces the value of a block string from its parsed raw value, similar to | ||
* CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. | ||
* | ||
* This implements the GraphQL spec's BlockStringValue() static algorithm. | ||
*/ | ||
function dedentBlockStringValue(rawString) { | ||
// Expand a block string's raw value into independent lines. | ||
var lines = rawString.split(/\r\n|[\n\r]/g); // Remove common indentation from all lines but first. | ||
var commonIndent = getBlockStringIndentation(lines); | ||
if (commonIndent !== 0) { | ||
for (var i = 1; i < lines.length; i++) { | ||
lines[i] = lines[i].slice(commonIndent); | ||
} | ||
} // Remove leading and trailing blank lines. | ||
while (lines.length > 0 && isBlank(lines[0])) { | ||
lines.shift(); | ||
} | ||
while (lines.length > 0 && isBlank(lines[lines.length - 1])) { | ||
lines.pop(); | ||
} // Return a string of the lines joined with U+000A. | ||
return lines.join('\n'); | ||
} // @internal | ||
function getBlockStringIndentation(lines) { | ||
var commonIndent = null; | ||
for (var i = 1; i < lines.length; i++) { | ||
var line = lines[i]; | ||
var indent = leadingWhitespace(line); | ||
if (indent === line.length) { | ||
continue; // skip empty lines | ||
} | ||
if (commonIndent === null || indent < commonIndent) { | ||
commonIndent = indent; | ||
if (commonIndent === 0) { | ||
break; | ||
} | ||
} | ||
} | ||
return commonIndent === null ? 0 : commonIndent; | ||
} | ||
function leadingWhitespace(str) { | ||
var i = 0; | ||
while (i < str.length && (str[i] === ' ' || str[i] === '\t')) { | ||
i++; | ||
} | ||
return i; | ||
} | ||
function isBlank(str) { | ||
return leadingWhitespace(str) === str.length; | ||
} | ||
/** | ||
* Print a block string in the indented block form by adding a leading and | ||
* trailing blank line. However, if a block string starts with whitespace and is | ||
* a single-line, adding a leading blank line would strip that whitespace. | ||
*/ | ||
function printBlockString(value) { | ||
var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; | ||
var isSingleLine = value.indexOf('\n') === -1; | ||
var hasLeadingSpace = value[0] === ' ' || value[0] === '\t'; | ||
var hasTrailingQuote = value[value.length - 1] === '"'; | ||
var printAsMultipleLines = !isSingleLine || hasTrailingQuote || preferMultipleLines; | ||
var result = ''; // Format a multi-line block quote to account for leading space. | ||
if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) { | ||
result += '\n' + indentation; | ||
} | ||
result += indentation ? value.replace(/\n/g, '\n' + indentation) : value; | ||
if (printAsMultipleLines) { | ||
result += '\n'; | ||
} | ||
return '"""' + result.replace(/"""/g, '\\"""') + '"""'; | ||
} | ||
}); | ||
unwrapExports(blockString); | ||
var kinds = createCommonjsModule(function (module, exports) { | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.Kind = void 0; | ||
/** | ||
* The set of allowed kind values for AST nodes. | ||
*/ | ||
var Kind = Object.freeze({ | ||
// Name | ||
NAME: 'Name', | ||
// Document | ||
DOCUMENT: 'Document', | ||
OPERATION_DEFINITION: 'OperationDefinition', | ||
VARIABLE_DEFINITION: 'VariableDefinition', | ||
SELECTION_SET: 'SelectionSet', | ||
FIELD: 'Field', | ||
ARGUMENT: 'Argument', | ||
// Fragments | ||
FRAGMENT_SPREAD: 'FragmentSpread', | ||
INLINE_FRAGMENT: 'InlineFragment', | ||
FRAGMENT_DEFINITION: 'FragmentDefinition', | ||
// Values | ||
VARIABLE: 'Variable', | ||
INT: 'IntValue', | ||
FLOAT: 'FloatValue', | ||
STRING: 'StringValue', | ||
BOOLEAN: 'BooleanValue', | ||
NULL: 'NullValue', | ||
ENUM: 'EnumValue', | ||
LIST: 'ListValue', | ||
OBJECT: 'ObjectValue', | ||
OBJECT_FIELD: 'ObjectField', | ||
// Directives | ||
DIRECTIVE: 'Directive', | ||
// Types | ||
NAMED_TYPE: 'NamedType', | ||
LIST_TYPE: 'ListType', | ||
NON_NULL_TYPE: 'NonNullType', | ||
// Type System Definitions | ||
SCHEMA_DEFINITION: 'SchemaDefinition', | ||
OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition', | ||
// Type Definitions | ||
SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition', | ||
OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition', | ||
FIELD_DEFINITION: 'FieldDefinition', | ||
INPUT_VALUE_DEFINITION: 'InputValueDefinition', | ||
INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition', | ||
UNION_TYPE_DEFINITION: 'UnionTypeDefinition', | ||
ENUM_TYPE_DEFINITION: 'EnumTypeDefinition', | ||
ENUM_VALUE_DEFINITION: 'EnumValueDefinition', | ||
INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition', | ||
// Directive Definitions | ||
DIRECTIVE_DEFINITION: 'DirectiveDefinition', | ||
// Type System Extensions | ||
SCHEMA_EXTENSION: 'SchemaExtension', | ||
// Type Extensions | ||
SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension', | ||
OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension', | ||
INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension', | ||
UNION_TYPE_EXTENSION: 'UnionTypeExtension', | ||
ENUM_TYPE_EXTENSION: 'EnumTypeExtension', | ||
INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension' | ||
}); | ||
/** | ||
* The enum type representing the possible kind values of AST nodes. | ||
*/ | ||
exports.Kind = Kind; | ||
}); | ||
unwrapExports(kinds); | ||
export { commonjsGlobal as a, blockString as b, createCommonjsModule as c, inspect_1 as i, kinds as k, nodejsCustomInspectSymbol_1 as n, unwrapExports as u }; |
@@ -1,1 +0,142 @@ | ||
const e=(e,t,n)=>{if(!t||!(null==t?void 0:t.itemConfig))return!1;const p=t.itemConfig.pie?t.itemConfig.pie:t.itemConfig;p.pies||(p.pies=s(p.elements));let i=0;return p.pies&&p.pies.forEach(s=>{var p;let l=(null!==(p=s.elements)&&void 0!==p?p:{})[e];const o=`${s.tag}-${e}`.toLowerCase();l&&(i++,customElements.whenDefined(o).then(()=>{var e;null===(e=t.itemConfig)||void 0===e||e.models.forEach(e=>{var s;const p=n.shadowRoot,i=null===(s=null==t?void 0:t.data)||void 0===s?void 0:s.find(s=>s.id===e.id);if(!p)return;let l=n.shadowRoot.querySelector(`${o}[id="${e.id}"]`);if(!l){const s=document.createElement(o);s.setAttribute("id",e.id),n.shadowRoot.appendChild(s),l=s}l.model=e,l.session=i})}),customElements.get(o)||import(l).then(e=>{customElements.get(o)||customElements.define(o,e.default)}))}),p.pies&&p.pies.length==i},s=e=>{const s={"@pie-element/categorize":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/CategorizeCell.js"},"@pie-element/charting":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/ChartingCell.js"},"@pie-element/explicit-constructed-response":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/ConstructedCell.js",response:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/ConstructedResponse.js"},"@pie-element/drag-in-the-blank":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/DragInTheBlankCell.js",response:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/DragInTheBlankResponse.js"},"@pie-element/drawing-response":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/DrawingCell.js",response:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/DrawingResponse.js"},"@pie-element/ebsr":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/EBSRCell.js",response:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/EBSRResponse.js"},"@pie-element/graphing":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/GraphingCell.js"},"@pie-element/hotspot":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/HotspotCell.js"},"@pie-element/inline-dropdown":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/InlineDropdownCell.js",response:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/InlineDropdownResponse.js"},"@pie-element/match":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MatchCell.js",response:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MatchResponse.js"},"@pie-element/match-list":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MatchListCell.js"},"@pie-element/math-inline":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MathInlineCell.js",response:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MathInlineResponse.js"},"@pie-element/multiple-choice":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MultipleChoiceCell.js",response:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MultipleChoiceResponse.js"},"@pie-element/number-line":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/NumberLineCell.js"},"@pie-element/placement-ordering":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/OrderingCell.js"},"@pie-element/select-text":{responseCell:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/SelectTextCell.js",response:"https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/SelectTextResponse.js"}};if(e)return Object.keys(e).map(n=>{const{name:p}=t(e[n]);return Object.assign({elements:s[p]},{tag:n})})},t=e=>{if("string"!=typeof e)throw new TypeError("Expected a string");const s="@"===e.charAt(0)?e.match(/^(@[^/]+\/[^/@]+)(?:\/([^@]+))?(?:@([\s\S]+))?/):e.match(/^([^/@]+)(?:\/([^@]+))?(?:@([\s\S]+))?/);if(!s)throw new Error(`[parse-package-name] "${e}" is not a valid string`);return{name:s[1],path:s[2]||"",version:s[3]||""}};export{e as l} | ||
const loadResponseElement = (elementName, sessionData, host) => { | ||
if (!sessionData || !(sessionData === null || sessionData === void 0 ? void 0 : sessionData.itemConfig)) { | ||
return false; | ||
} | ||
// check if tag is defined as custom element, define it if it isn't. | ||
// check if tag is present as a child of host | ||
const pieConfig = sessionData.itemConfig.pie ? sessionData.itemConfig.pie : sessionData.itemConfig; | ||
if (!pieConfig.pies) { | ||
pieConfig.pies = polyfillPieElements(pieConfig.elements); | ||
} | ||
let found = 0; | ||
pieConfig.pies && pieConfig.pies.forEach((pie) => { | ||
var _a; | ||
let elementSpecifier = ((_a = pie.elements) !== null && _a !== void 0 ? _a : {})[elementName]; | ||
const tag = `${pie.tag}-${elementName}`.toLowerCase(); | ||
if (elementSpecifier) { | ||
found++; | ||
customElements.whenDefined(tag).then(() => { | ||
var _a; | ||
(_a = sessionData.itemConfig) === null || _a === void 0 ? void 0 : _a.models.forEach(m => { | ||
var _a; | ||
const hostShadowRoot = host.shadowRoot; | ||
const session = (_a = sessionData === null || sessionData === void 0 ? void 0 : sessionData.data) === null || _a === void 0 ? void 0 : _a.find(s => s.id === m.id); | ||
if (!hostShadowRoot) { | ||
return; | ||
} | ||
let el = host.shadowRoot.querySelector(`${tag}[id="${m.id}"]`); | ||
if (!el) { | ||
const newEl = document.createElement(tag); | ||
newEl.setAttribute('id', m.id); | ||
host.shadowRoot.appendChild(newEl); | ||
el = newEl; | ||
} | ||
el.model = m; | ||
el.session = session; | ||
}); | ||
}); | ||
if (!customElements.get(tag)) { | ||
import(elementSpecifier).then(Module => { | ||
if (!customElements.get(tag)) { | ||
customElements.define(tag, Module.default); | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
return (pieConfig.pies && pieConfig.pies.length == found); | ||
}; | ||
/** | ||
* If `config.pies` definition is missing, this will generate defaults for pies in @pie-element scope | ||
* TODO - this should be deprecated once pie 'installation' is working in pie api, meaning configs shoud | ||
* have the `pies` definitions. | ||
* | ||
* @param elements the elements definitions | ||
*/ | ||
const polyfillPieElements = (elements) => { | ||
const mappings = { | ||
"@pie-element/categorize": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/CategorizeCell.js", | ||
}, | ||
"@pie-element/charting": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/ChartingCell.js", | ||
}, | ||
"@pie-element/explicit-constructed-response": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/ConstructedCell.js", | ||
response: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/ConstructedResponse.js" | ||
}, | ||
"@pie-element/drag-in-the-blank": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/DragInTheBlankCell.js", | ||
response: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/DragInTheBlankResponse.js" | ||
}, | ||
"@pie-element/drawing-response": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/DrawingCell.js", | ||
response: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/DrawingResponse.js" | ||
}, | ||
"@pie-element/ebsr": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/EBSRCell.js", | ||
response: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/EBSRResponse.js" | ||
}, | ||
"@pie-element/graphing": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/GraphingCell.js", | ||
}, | ||
"@pie-element/hotspot": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/HotspotCell.js", | ||
}, | ||
"@pie-element/inline-dropdown": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/InlineDropdownCell.js", | ||
response: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/InlineDropdownResponse.js" | ||
}, | ||
"@pie-element/match": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MatchCell.js", | ||
response: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MatchResponse.js" | ||
}, | ||
"@pie-element/match-list": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MatchListCell.js", | ||
}, | ||
"@pie-element/math-inline": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MathInlineCell.js", | ||
response: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MathInlineResponse.js" | ||
}, | ||
"@pie-element/multiple-choice": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MultipleChoiceCell.js", | ||
response: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/MultipleChoiceResponse.js" | ||
}, | ||
"@pie-element/number-line": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/NumberLineCell.js", | ||
}, | ||
"@pie-element/placement-ordering": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/OrderingCell.js", | ||
}, | ||
"@pie-element/select-text": { | ||
responseCell: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/SelectTextCell.js", | ||
response: "https://unpkg.com/@pie-api/pie-element-extensions@latest/dist/pies/SelectTextResponse.js" | ||
} | ||
}; | ||
if (elements) { | ||
const pieDefs = Object.keys(elements).map(tag => { | ||
const { name } = parsePackage(elements[tag]); | ||
const pieDef = Object.assign({ elements: mappings[name] }, { tag }); | ||
return pieDef; | ||
}); | ||
return pieDefs; | ||
} | ||
}; | ||
const parsePackage = (input) => { | ||
const RE_SCOPED = /^(@[^/]+\/[^/@]+)(?:\/([^@]+))?(?:@([\s\S]+))?/; | ||
const RE_NORMAL = /^([^/@]+)(?:\/([^@]+))?(?:@([\s\S]+))?/; | ||
if (typeof input !== 'string') { | ||
throw new TypeError('Expected a string'); | ||
} | ||
const matched = input.charAt(0) === '@' ? input.match(RE_SCOPED) : input.match(RE_NORMAL); | ||
if (!matched) { | ||
throw new Error(`[parse-package-name] "${input}" is not a valid string`); | ||
} | ||
return { | ||
name: matched[1], | ||
path: matched[2] || '', | ||
version: matched[3] || '' | ||
}; | ||
}; | ||
export { loadResponseElement as l }; |
@@ -1,1 +0,1277 @@ | ||
let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l)},i=e=>Promise.resolve(e),r=(()=>{try{return new CSSStyleSheet,!0}catch(e){}return!1})(),c={},a=(e,t,n)=>{n&&n.map(([n,l,s])=>{const i=e,r=u(t,s),c=f(n);o.ael(i,l,r,c),(t.s=t.s||[]).push(()=>o.rel(i,l,r,c))})},u=(e,t)=>n=>{256&e.t?e.o[t](n):(e.i=e.i||[]).push([t,n])},f=e=>0!=(2&e),d="http://www.w3.org/1999/xlink",$=new WeakMap,p=e=>"sc-"+e.u,h={},y=e=>"object"==(e=typeof e)||"function"===e,m=(e,t,...n)=>{let l=null,s=null,o=!1,i=!1,r=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof e&&!y(l))&&(l+=""),o&&i?r[r.length-1].$+=l:r.push(o?w(null,l):l),i=o)};if(c(n),t){t.key&&(s=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter(t=>e[t]).join(" "))}}const a=w(e,null);return a.p=t,r.length>0&&(a.h=r),a.m=s,a},w=(e,t)=>({t:0,k:e,$:t,g:null,h:null,p:null,m:null}),b={},k=(e,t,n,s,i,r)=>{if(n!==s){let c=Q(e,t),a=t.toLowerCase();if("class"===t){const t=e.classList,l=v(n),o=v(s);t.remove(...l.filter(e=>e&&!o.includes(e))),t.add(...o.filter(e=>e&&!l.includes(e)))}else if("style"===t){for(const t in n)s&&null!=s[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in s)n&&s[t]===n[t]||(t.includes("-")?e.style.setProperty(t,s[t]):e.style[t]=s[t])}else if("key"===t);else if("ref"===t)s&&s(e);else if(c||"o"!==t[0]||"n"!==t[1]){const l=y(s);if((c||l&&null!==s)&&!i)try{if(e.tagName.includes("-"))e[t]=s;else{let l=null==s?"":s;"list"===t?c=!1:null!=n&&e[t]==l||(e[t]=l)}}catch(e){}let o=!1;a!==(a=a.replace(/^xlink\:?/,""))&&(t=a,o=!0),null==s||!1===s?o?e.removeAttributeNS(d,t):e.removeAttribute(t):(!c||4&r||i)&&!l&&(s=!0===s?"":s,o?e.setAttributeNS(d,t,s):e.setAttribute(t,s))}else t="-"===t[2]?t.slice(3):Q(l,a)?a.slice(2):a[2]+t.slice(3),n&&o.rel(e,t,n,!1),s&&o.ael(e,t,s,!1)}},g=/\s/,v=e=>e?e.split(g):[],S=(e,t,n,l)=>{const s=11===t.g.nodeType&&t.g.host?t.g.host:t.g,o=e&&e.p||h,i=t.p||h;for(l in o)l in i||k(s,l,o[l],void 0,n,t.t);for(l in i)k(s,l,o[l],i[l],n,t.t)},j=(t,n,l)=>{let o,i,r=n.h[l],c=0;if(o=r.g=s.createElement(r.k),S(null,r,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),r.h)for(c=0;c<r.h.length;++c)i=j(t,r,c),i&&o.appendChild(i);return o},M=(e,n,l,s,o,i)=>{let r,c=e;for(c.shadowRoot&&c.tagName===t&&(c=c.shadowRoot);o<=i;++o)s[o]&&(r=j(null,l,o),r&&(s[o].g=r,c.insertBefore(r,n)))},C=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.g,U(l),s.remove())},O=(e,t)=>e.k===t.k&&e.m===t.m,P=(e,t)=>{const n=t.g=e.g,l=e.h,s=t.h;"slot"===t.k||S(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o,i=0,r=0,c=0,a=0,u=t.length-1,f=t[0],d=t[u],$=l.length-1,p=l[0],h=l[$];for(;i<=u&&r<=$;)if(null==f)f=t[++i];else if(null==d)d=t[--u];else if(null==p)p=l[++r];else if(null==h)h=l[--$];else if(O(f,p))P(f,p),f=t[++i],p=l[++r];else if(O(d,h))P(d,h),d=t[--u],h=l[--$];else if(O(f,h))P(f,h),e.insertBefore(f.g,d.g.nextSibling),f=t[++i],h=l[--$];else if(O(d,p))P(d,p),e.insertBefore(d.g,f.g),d=t[--u],p=l[++r];else{for(c=-1,a=i;a<=u;++a)if(t[a]&&null!==t[a].m&&t[a].m===p.m){c=a;break}c>=0?(o=t[c],o.k!==p.k?s=j(t&&t[r],n,c):(P(o,p),t[c]=void 0,s=o.g),p=l[++r]):(s=j(t&&t[r],n,r),p=l[++r]),s&&f.g.parentNode.insertBefore(s,f.g)}i>u?M(e,null==l[$+1]?null:l[$+1].g,n,l,r,$):r>$&&C(t,i,u)})(n,l,t,s):null!==s?M(n,null,t,s,0,s.length-1):null!==l&&C(l,0,l.length-1)},U=e=>{e.p&&e.p.ref&&e.p.ref(null),e.h&&e.h.map(U)},x=e=>I(e).v,L=(e,t,n)=>{const l=x(e);return{emit:e=>R(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},R=(e,t,n)=>{const l=new CustomEvent(t,n);return e.dispatchEvent(l),l},E=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.S=t))},T=(e,t)=>{if(e.t|=16,!(4&e.t))return E(e,e.j),ce(()=>W(e,t));e.t|=512},W=(e,t)=>{const n=e.o;let l;return t&&(e.t|=256,e.i&&(e.i.map(([e,t])=>N(n,e,t)),e.i=null),l=N(n,"componentWillLoad")),V(l,()=>q(e,n,t))},q=(n,l,o)=>{const i=n.v,r=i["s-rc"];o&&(e=>{const t=e.M,n=e.v,l=t.t,o=((e,t)=>{let n=p(t),l=ee.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=$.get(e=e.head||e);o||$.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(n),((n,l)=>{const s=n.v,o=n.M,i=n.C||w(null,null),r=(e=>e&&e.k===b)(l)?l:m(null,null,l);t=s.tagName,o.O&&(r.p=r.p||{},o.O.map(([e,t])=>r.p[t]=s[e])),r.k=null,r.t|=4,n.C=r,r.g=i.g=s.shadowRoot||s,e=s["s-sc"],P(i,r)})(n,A(n,l)),r&&(r.map(e=>e()),i["s-rc"]=void 0);{const e=i["s-p"],t=()=>H(n);0===e.length?t():(Promise.all(e).then(t),n.t|=4,e.length=0)}},A=(e,t)=>{try{t=t.render&&t.render(),e.t&=-17,e.t|=2}catch(e){X(e)}return t},H=e=>{const t=e.v,n=e.j;64&e.t||(e.t|=64,_(t),e.P(t),n||F()),e.S&&(e.S(),e.S=void 0),512&e.t&&ie(()=>T(e,!1)),e.t&=-517},F=()=>{_(s.documentElement),ie(()=>R(l,"appload",{detail:{namespace:"pie-api-live"}}))},N=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){X(e)}},V=(e,t)=>e&&e.then?e.then(t):t(),_=e=>e.classList.add("hydrated"),z=(e,t,n)=>{if(t.U){e.watchers&&(t.L=e.watchers);const l=Object.entries(t.U),s=e.prototype;if(l.map(([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>I(this).R.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=I(this),o=s.R.get(t),i=s.t,r=s.o;if(n=((e,t)=>null==e||y(e)?e:1&t?e+"":e)(n,l.U[t][0]),!(8&i&&void 0!==o||n===o)&&(s.R.set(t,n),r)){if(l.L&&128&i){const e=l.L[t];e&&e.map(e=>{try{r[e](n,o,t)}catch(e){X(e)}})}2==(18&i)&&T(s,!1)}})(0,e,n,t)},configurable:!0,enumerable:!0})}),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){o.jmp(()=>{const t=n.get(e);this[t]=(null!==l||"boolean"!=typeof this[t])&&l})},e.observedAttributes=l.filter(([e,t])=>15&t[0]).map(([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.O.push([e,s]),s})}}return e},B=(e,t={})=>{const n=[],i=t.exclude||[],c=l.customElements,u=s.head,f=u.querySelector("meta[charset]"),d=s.createElement("style"),$=[];let h,y=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map(e=>e[1].map(t=>{const l={t:t[0],u:t[1],U:t[2],T:t[3]};l.U=t[2],l.T=t[3],l.O=[],l.L={};const s=l.u,u=class extends HTMLElement{constructor(e){super(e),K(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),y?$.push(this):o.jmp(()=>(e=>{if(0==(1&o.t)){const t=I(e),n=t.M,l=()=>{};if(1&t.t)a(e,t,n.T);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){E(t,t.j=n);break}}n.U&&Object.entries(n.U).map(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}}),ie(()=>(async(e,t,n,l,s)=>{if(0==(32&t.t)){t.t|=32;{if((s=Z(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.L=s.watchers,z(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){X(e)}t.t&=-9,t.t|=128,e()}const e=p(n);if(!ee.has(e)&&s.style){const t=()=>{};((e,t,n)=>{let l=ee.get(e);r&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,ee.set(e,l)})(e,s.style,!!(1&n.t)),t()}}const o=t.j,i=()=>T(t,!0);o&&o["s-rc"]?o["s-rc"].push(i):i()})(0,t,n))}l()}})(this))}disconnectedCallback(){o.jmp(()=>(()=>{if(0==(1&o.t)){const e=I(this),t=e.o;e.s&&(e.s.map(e=>e()),e.s=void 0),N(t,"disconnectedCallback")}})())}forceUpdate(){(()=>{{const e=I(this);e.v.isConnected&&2==(18&e.t)&&T(e,!1)}})()}componentOnReady(){return I(this).W}};l.q=e[0],i.includes(s)||c.get(s)||(n.push(s),c.define(s,z(u,l,1)))})),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),u.insertBefore(d,f?f.nextSibling:u.firstChild),y=!1,$.length?$.map(e=>e.connectedCallback()):o.jmp(()=>h=setTimeout(F,30))},D=(e,t)=>t in c?c[t]:"window"===t?l:"document"===t?s:"isServer"!==t&&"isPrerender"!==t&&("isClient"===t||("resourcesUrl"===t||"publicPath"===t?(()=>{const e=new URL(".",o.l);return e.origin!==l.location.origin?e.href:e.pathname})():"queue"===t?{write:ce,read:re,tick:{then:e=>ie(e)}}:void 0)),G=new WeakMap,I=e=>G.get(e),J=(e,t)=>G.set(t.o=e,t),K=(e,t)=>{const n={t:0,v:e,M:t,R:new Map};return n.W=new Promise(e=>n.P=e),e["s-p"]=[],e["s-rc"]=[],a(e,n,t.T),G.set(e,n)},Q=(e,t)=>t in e,X=e=>console.error(e),Y=new Map,Z=e=>{const t=e.u.replace(/-/g,"_"),n=e.q,l=Y.get(n);return l?l[t]:import(`./${n}.entry.js`).then(e=>(Y.set(n,e),e[t]),X)},ee=new Map,te=[],ne=[],le=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?ie(oe):o.raf(oe))},se=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){X(e)}e.length=0},oe=()=>{se(te),se(ne),(n=te.length>0)&&o.raf(oe)},ie=e=>i().then(e),re=le(te,!1),ce=le(ne,!0),ae=()=>i(),ue=()=>{const e=import.meta.url,t={};return""!==e&&(t.resourcesUrl=new URL(".",e).href),i(t)};export{b as H,ae as a,B as b,L as c,D as d,x as g,m as h,ue as p,J as r} | ||
const NAMESPACE = 'pie-api-live'; | ||
let scopeId; | ||
let hostTagName; | ||
let isSvgMode = false; | ||
let queuePending = false; | ||
const win = typeof window !== 'undefined' ? window : {}; | ||
const doc = win.document || { head: {} }; | ||
const plt = { | ||
$flags$: 0, | ||
$resourcesUrl$: '', | ||
jmp: h => h(), | ||
raf: h => requestAnimationFrame(h), | ||
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts), | ||
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts), | ||
}; | ||
const promiseResolve = (v) => Promise.resolve(v); | ||
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => { | ||
try { | ||
new CSSStyleSheet(); | ||
return true; | ||
} | ||
catch (e) { } | ||
return false; | ||
})() | ||
; | ||
const Context = {}; | ||
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => { | ||
if ( listeners) { | ||
listeners.map(([flags, name, method]) => { | ||
const target = elm; | ||
const handler = hostListenerProxy(hostRef, method); | ||
const opts = hostListenerOpts(flags); | ||
plt.ael(target, name, handler, opts); | ||
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts)); | ||
}); | ||
} | ||
}; | ||
const hostListenerProxy = (hostRef, methodName) => (ev) => { | ||
{ | ||
if (hostRef.$flags$ & 256 /* isListenReady */) { | ||
// instance is ready, let's call it's member method for this event | ||
hostRef.$lazyInstance$[methodName](ev); | ||
} | ||
else { | ||
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]); | ||
} | ||
} | ||
}; | ||
// prettier-ignore | ||
const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0; | ||
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}'; | ||
const XLINK_NS = 'http://www.w3.org/1999/xlink'; | ||
const createTime = (fnName, tagName = '') => { | ||
{ | ||
return () => { | ||
return; | ||
}; | ||
} | ||
}; | ||
const uniqueTime = (key, measureText) => { | ||
{ | ||
return () => { | ||
return; | ||
}; | ||
} | ||
}; | ||
const rootAppliedStyles = new WeakMap(); | ||
const registerStyle = (scopeId, cssText, allowCS) => { | ||
let style = styles.get(scopeId); | ||
if (supportsConstructibleStylesheets && allowCS) { | ||
style = (style || new CSSStyleSheet()); | ||
style.replace(cssText); | ||
} | ||
else { | ||
style = cssText; | ||
} | ||
styles.set(scopeId, style); | ||
}; | ||
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => { | ||
let scopeId = getScopeId(cmpMeta); | ||
let style = styles.get(scopeId); | ||
// if an element is NOT connected then getRootNode() will return the wrong root node | ||
// so the fallback is to always use the document for the root node in those cases | ||
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc; | ||
if (style) { | ||
if (typeof style === 'string') { | ||
styleContainerNode = styleContainerNode.head || styleContainerNode; | ||
let appliedStyles = rootAppliedStyles.get(styleContainerNode); | ||
let styleElm; | ||
if (!appliedStyles) { | ||
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set())); | ||
} | ||
if (!appliedStyles.has(scopeId)) { | ||
{ | ||
{ | ||
styleElm = doc.createElement('style'); | ||
styleElm.innerHTML = style; | ||
} | ||
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link')); | ||
} | ||
if (appliedStyles) { | ||
appliedStyles.add(scopeId); | ||
} | ||
} | ||
} | ||
else if ( !styleContainerNode.adoptedStyleSheets.includes(style)) { | ||
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style]; | ||
} | ||
} | ||
return scopeId; | ||
}; | ||
const attachStyles = (hostRef) => { | ||
const cmpMeta = hostRef.$cmpMeta$; | ||
const elm = hostRef.$hostElement$; | ||
const flags = cmpMeta.$flags$; | ||
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$); | ||
const scopeId = addStyle( elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta); | ||
if ( flags & 10 /* needsScopedEncapsulation */) { | ||
// only required when we're NOT using native shadow dom (slot) | ||
// or this browser doesn't support native shadow dom | ||
// and this host element was NOT created with SSR | ||
// let's pick out the inner content for slot projection | ||
// create a node to represent where the original | ||
// content was first placed, which is useful later on | ||
// DOM WRITE!! | ||
elm['s-sc'] = scopeId; | ||
elm.classList.add(scopeId + '-h'); | ||
} | ||
endAttachStyles(); | ||
}; | ||
const getScopeId = (cmp, mode) => 'sc-' + ( cmp.$tagName$); | ||
/** | ||
* Default style mode id | ||
*/ | ||
/** | ||
* Reusable empty obj/array | ||
* Don't add values to these!! | ||
*/ | ||
const EMPTY_OBJ = {}; | ||
const isDef = (v) => v != null; | ||
const isComplexType = (o) => { | ||
// https://jsperf.com/typeof-fn-object/5 | ||
o = typeof o; | ||
return o === 'object' || o === 'function'; | ||
}; | ||
/** | ||
* Production h() function based on Preact by | ||
* Jason Miller (@developit) | ||
* Licensed under the MIT License | ||
* https://github.com/developit/preact/blob/master/LICENSE | ||
* | ||
* Modified for Stencil's compiler and vdom | ||
*/ | ||
// const stack: any[] = []; | ||
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode; | ||
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode; | ||
const h = (nodeName, vnodeData, ...children) => { | ||
let child = null; | ||
let key = null; | ||
let simple = false; | ||
let lastSimple = false; | ||
let vNodeChildren = []; | ||
const walk = (c) => { | ||
for (let i = 0; i < c.length; i++) { | ||
child = c[i]; | ||
if (Array.isArray(child)) { | ||
walk(child); | ||
} | ||
else if (child != null && typeof child !== 'boolean') { | ||
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) { | ||
child = String(child); | ||
} | ||
if (simple && lastSimple) { | ||
// If the previous child was simple (string), we merge both | ||
vNodeChildren[vNodeChildren.length - 1].$text$ += child; | ||
} | ||
else { | ||
// Append a new vNode, if it's text, we create a text vNode | ||
vNodeChildren.push(simple ? newVNode(null, child) : child); | ||
} | ||
lastSimple = simple; | ||
} | ||
} | ||
}; | ||
walk(children); | ||
if (vnodeData) { | ||
// normalize class / classname attributes | ||
if ( vnodeData.key) { | ||
key = vnodeData.key; | ||
} | ||
{ | ||
const classData = vnodeData.className || vnodeData.class; | ||
if (classData) { | ||
vnodeData.class = | ||
typeof classData !== 'object' | ||
? classData | ||
: Object.keys(classData) | ||
.filter(k => classData[k]) | ||
.join(' '); | ||
} | ||
} | ||
} | ||
const vnode = newVNode(nodeName, null); | ||
vnode.$attrs$ = vnodeData; | ||
if (vNodeChildren.length > 0) { | ||
vnode.$children$ = vNodeChildren; | ||
} | ||
{ | ||
vnode.$key$ = key; | ||
} | ||
return vnode; | ||
}; | ||
const newVNode = (tag, text) => { | ||
const vnode = { | ||
$flags$: 0, | ||
$tag$: tag, | ||
$text$: text, | ||
$elm$: null, | ||
$children$: null, | ||
}; | ||
{ | ||
vnode.$attrs$ = null; | ||
} | ||
{ | ||
vnode.$key$ = null; | ||
} | ||
return vnode; | ||
}; | ||
const Host = {}; | ||
const isHost = (node) => node && node.$tag$ === Host; | ||
/** | ||
* Production setAccessor() function based on Preact by | ||
* Jason Miller (@developit) | ||
* Licensed under the MIT License | ||
* https://github.com/developit/preact/blob/master/LICENSE | ||
* | ||
* Modified for Stencil's compiler and vdom | ||
*/ | ||
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => { | ||
if (oldValue !== newValue) { | ||
let isProp = isMemberInElement(elm, memberName); | ||
let ln = memberName.toLowerCase(); | ||
if ( memberName === 'class') { | ||
const classList = elm.classList; | ||
const oldClasses = parseClassList(oldValue); | ||
const newClasses = parseClassList(newValue); | ||
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c))); | ||
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c))); | ||
} | ||
else if ( memberName === 'style') { | ||
// update style attribute, css properties and values | ||
{ | ||
for (const prop in oldValue) { | ||
if (!newValue || newValue[prop] == null) { | ||
if ( prop.includes('-')) { | ||
elm.style.removeProperty(prop); | ||
} | ||
else { | ||
elm.style[prop] = ''; | ||
} | ||
} | ||
} | ||
} | ||
for (const prop in newValue) { | ||
if (!oldValue || newValue[prop] !== oldValue[prop]) { | ||
if ( prop.includes('-')) { | ||
elm.style.setProperty(prop, newValue[prop]); | ||
} | ||
else { | ||
elm.style[prop] = newValue[prop]; | ||
} | ||
} | ||
} | ||
} | ||
else if ( memberName === 'key') | ||
; | ||
else if ( memberName === 'ref') { | ||
// minifier will clean this up | ||
if (newValue) { | ||
newValue(elm); | ||
} | ||
} | ||
else if ( ( !isProp ) && memberName[0] === 'o' && memberName[1] === 'n') { | ||
// Event Handlers | ||
// so if the member name starts with "on" and the 3rd characters is | ||
// a capital letter, and it's not already a member on the element, | ||
// then we're assuming it's an event listener | ||
if (memberName[2] === '-') { | ||
// on- prefixed events | ||
// allows to be explicit about the dom event to listen without any magic | ||
// under the hood: | ||
// <my-cmp on-click> // listens for "click" | ||
// <my-cmp on-Click> // listens for "Click" | ||
// <my-cmp on-ionChange> // listens for "ionChange" | ||
// <my-cmp on-EVENTS> // listens for "EVENTS" | ||
memberName = memberName.slice(3); | ||
} | ||
else if (isMemberInElement(win, ln)) { | ||
// standard event | ||
// the JSX attribute could have been "onMouseOver" and the | ||
// member name "onmouseover" is on the window's prototype | ||
// so let's add the listener "mouseover", which is all lowercased | ||
memberName = ln.slice(2); | ||
} | ||
else { | ||
// custom event | ||
// the JSX attribute could have been "onMyCustomEvent" | ||
// so let's trim off the "on" prefix and lowercase the first character | ||
// and add the listener "myCustomEvent" | ||
// except for the first character, we keep the event name case | ||
memberName = ln[2] + memberName.slice(3); | ||
} | ||
if (oldValue) { | ||
plt.rel(elm, memberName, oldValue, false); | ||
} | ||
if (newValue) { | ||
plt.ael(elm, memberName, newValue, false); | ||
} | ||
} | ||
else { | ||
// Set property if it exists and it's not a SVG | ||
const isComplex = isComplexType(newValue); | ||
if ((isProp || (isComplex && newValue !== null)) && !isSvg) { | ||
try { | ||
if (!elm.tagName.includes('-')) { | ||
let n = newValue == null ? '' : newValue; | ||
// Workaround for Safari, moving the <input> caret when re-assigning the same valued | ||
if (memberName === 'list') { | ||
isProp = false; | ||
// tslint:disable-next-line: triple-equals | ||
} | ||
else if (oldValue == null || elm[memberName] != n) { | ||
elm[memberName] = n; | ||
} | ||
} | ||
else { | ||
elm[memberName] = newValue; | ||
} | ||
} | ||
catch (e) { } | ||
} | ||
/** | ||
* Need to manually update attribute if: | ||
* - memberName is not an attribute | ||
* - if we are rendering the host element in order to reflect attribute | ||
* - if it's a SVG, since properties might not work in <svg> | ||
* - if the newValue is null/undefined or 'false'. | ||
*/ | ||
let xlink = false; | ||
{ | ||
if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) { | ||
memberName = ln; | ||
xlink = true; | ||
} | ||
} | ||
if (newValue == null || newValue === false) { | ||
if ( xlink) { | ||
elm.removeAttributeNS(XLINK_NS, memberName); | ||
} | ||
else { | ||
elm.removeAttribute(memberName); | ||
} | ||
} | ||
else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) { | ||
newValue = newValue === true ? '' : newValue; | ||
if ( xlink) { | ||
elm.setAttributeNS(XLINK_NS, memberName, newValue); | ||
} | ||
else { | ||
elm.setAttribute(memberName, newValue); | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
const parseClassListRegex = /\s/; | ||
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex)); | ||
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => { | ||
// if the element passed in is a shadow root, which is a document fragment | ||
// then we want to be adding attrs/props to the shadow root's "host" element | ||
// if it's not a shadow root, then we add attrs/props to the same element | ||
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$; | ||
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ; | ||
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ; | ||
{ | ||
// remove attributes no longer present on the vnode by setting them to undefined | ||
for (memberName in oldVnodeAttrs) { | ||
if (!(memberName in newVnodeAttrs)) { | ||
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$); | ||
} | ||
} | ||
} | ||
// add new & update changed attributes | ||
for (memberName in newVnodeAttrs) { | ||
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$); | ||
} | ||
}; | ||
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => { | ||
// tslint:disable-next-line: prefer-const | ||
let newVNode = newParentVNode.$children$[childIndex]; | ||
let i = 0; | ||
let elm; | ||
let childNode; | ||
{ | ||
// create element | ||
elm = newVNode.$elm$ = ( doc.createElement( newVNode.$tag$)); | ||
// add css classes, attrs, props, listeners, etc. | ||
{ | ||
updateElement(null, newVNode, isSvgMode); | ||
} | ||
if ( isDef(scopeId) && elm['s-si'] !== scopeId) { | ||
// if there is a scopeId and this is the initial render | ||
// then let's add the scopeId as a css class | ||
elm.classList.add((elm['s-si'] = scopeId)); | ||
} | ||
if (newVNode.$children$) { | ||
for (i = 0; i < newVNode.$children$.length; ++i) { | ||
// create the node | ||
childNode = createElm(oldParentVNode, newVNode, i); | ||
// return node could have been null | ||
if (childNode) { | ||
// append our new node | ||
elm.appendChild(childNode); | ||
} | ||
} | ||
} | ||
} | ||
return elm; | ||
}; | ||
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => { | ||
let containerElm = ( parentElm); | ||
let childNode; | ||
if ( containerElm.shadowRoot && containerElm.tagName === hostTagName) { | ||
containerElm = containerElm.shadowRoot; | ||
} | ||
for (; startIdx <= endIdx; ++startIdx) { | ||
if (vnodes[startIdx]) { | ||
childNode = createElm(null, parentVNode, startIdx); | ||
if (childNode) { | ||
vnodes[startIdx].$elm$ = childNode; | ||
containerElm.insertBefore(childNode, before); | ||
} | ||
} | ||
} | ||
}; | ||
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => { | ||
for (; startIdx <= endIdx; ++startIdx) { | ||
if ((vnode = vnodes[startIdx])) { | ||
elm = vnode.$elm$; | ||
callNodeRefs(vnode); | ||
// remove the vnode's element from the dom | ||
elm.remove(); | ||
} | ||
} | ||
}; | ||
const updateChildren = (parentElm, oldCh, newVNode, newCh) => { | ||
let oldStartIdx = 0; | ||
let newStartIdx = 0; | ||
let idxInOld = 0; | ||
let i = 0; | ||
let oldEndIdx = oldCh.length - 1; | ||
let oldStartVnode = oldCh[0]; | ||
let oldEndVnode = oldCh[oldEndIdx]; | ||
let newEndIdx = newCh.length - 1; | ||
let newStartVnode = newCh[0]; | ||
let newEndVnode = newCh[newEndIdx]; | ||
let node; | ||
let elmToMove; | ||
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { | ||
if (oldStartVnode == null) { | ||
// Vnode might have been moved left | ||
oldStartVnode = oldCh[++oldStartIdx]; | ||
} | ||
else if (oldEndVnode == null) { | ||
oldEndVnode = oldCh[--oldEndIdx]; | ||
} | ||
else if (newStartVnode == null) { | ||
newStartVnode = newCh[++newStartIdx]; | ||
} | ||
else if (newEndVnode == null) { | ||
newEndVnode = newCh[--newEndIdx]; | ||
} | ||
else if (isSameVnode(oldStartVnode, newStartVnode)) { | ||
patch(oldStartVnode, newStartVnode); | ||
oldStartVnode = oldCh[++oldStartIdx]; | ||
newStartVnode = newCh[++newStartIdx]; | ||
} | ||
else if (isSameVnode(oldEndVnode, newEndVnode)) { | ||
patch(oldEndVnode, newEndVnode); | ||
oldEndVnode = oldCh[--oldEndIdx]; | ||
newEndVnode = newCh[--newEndIdx]; | ||
} | ||
else if (isSameVnode(oldStartVnode, newEndVnode)) { | ||
patch(oldStartVnode, newEndVnode); | ||
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling); | ||
oldStartVnode = oldCh[++oldStartIdx]; | ||
newEndVnode = newCh[--newEndIdx]; | ||
} | ||
else if (isSameVnode(oldEndVnode, newStartVnode)) { | ||
patch(oldEndVnode, newStartVnode); | ||
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$); | ||
oldEndVnode = oldCh[--oldEndIdx]; | ||
newStartVnode = newCh[++newStartIdx]; | ||
} | ||
else { | ||
// createKeyToOldIdx | ||
idxInOld = -1; | ||
{ | ||
for (i = oldStartIdx; i <= oldEndIdx; ++i) { | ||
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) { | ||
idxInOld = i; | ||
break; | ||
} | ||
} | ||
} | ||
if ( idxInOld >= 0) { | ||
elmToMove = oldCh[idxInOld]; | ||
if (elmToMove.$tag$ !== newStartVnode.$tag$) { | ||
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld); | ||
} | ||
else { | ||
patch(elmToMove, newStartVnode); | ||
oldCh[idxInOld] = undefined; | ||
node = elmToMove.$elm$; | ||
} | ||
newStartVnode = newCh[++newStartIdx]; | ||
} | ||
else { | ||
// new element | ||
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx); | ||
newStartVnode = newCh[++newStartIdx]; | ||
} | ||
if (node) { | ||
{ | ||
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$); | ||
} | ||
} | ||
} | ||
} | ||
if (oldStartIdx > oldEndIdx) { | ||
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx); | ||
} | ||
else if ( newStartIdx > newEndIdx) { | ||
removeVnodes(oldCh, oldStartIdx, oldEndIdx); | ||
} | ||
}; | ||
const isSameVnode = (vnode1, vnode2) => { | ||
// compare if two vnode to see if they're "technically" the same | ||
// need to have the same element tag, and same key to be the same | ||
if (vnode1.$tag$ === vnode2.$tag$) { | ||
{ | ||
return vnode1.$key$ === vnode2.$key$; | ||
} | ||
} | ||
return false; | ||
}; | ||
const patch = (oldVNode, newVNode) => { | ||
const elm = (newVNode.$elm$ = oldVNode.$elm$); | ||
const oldChildren = oldVNode.$children$; | ||
const newChildren = newVNode.$children$; | ||
const tag = newVNode.$tag$; | ||
{ | ||
// element node | ||
{ | ||
if ( tag === 'slot') | ||
; | ||
else { | ||
// either this is the first render of an element OR it's an update | ||
// AND we already know it's possible it could have changed | ||
// this updates the element's css classes, attrs, props, listeners, etc. | ||
updateElement(oldVNode, newVNode, isSvgMode); | ||
} | ||
} | ||
if ( oldChildren !== null && newChildren !== null) { | ||
// looks like there's child vnodes for both the old and new vnodes | ||
updateChildren(elm, oldChildren, newVNode, newChildren); | ||
} | ||
else if (newChildren !== null) { | ||
// add the new vnode children | ||
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1); | ||
} | ||
else if ( oldChildren !== null) { | ||
// no new child vnodes, but there are old child vnodes to remove | ||
removeVnodes(oldChildren, 0, oldChildren.length - 1); | ||
} | ||
} | ||
}; | ||
const callNodeRefs = (vNode) => { | ||
{ | ||
vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null); | ||
vNode.$children$ && vNode.$children$.map(callNodeRefs); | ||
} | ||
}; | ||
const renderVdom = (hostRef, renderFnResults) => { | ||
const hostElm = hostRef.$hostElement$; | ||
const cmpMeta = hostRef.$cmpMeta$; | ||
const oldVNode = hostRef.$vnode$ || newVNode(null, null); | ||
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults); | ||
hostTagName = hostElm.tagName; | ||
if ( cmpMeta.$attrsToReflect$) { | ||
rootVnode.$attrs$ = rootVnode.$attrs$ || {}; | ||
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName])); | ||
} | ||
rootVnode.$tag$ = null; | ||
rootVnode.$flags$ |= 4 /* isHost */; | ||
hostRef.$vnode$ = rootVnode; | ||
rootVnode.$elm$ = oldVNode.$elm$ = ( hostElm.shadowRoot || hostElm ); | ||
{ | ||
scopeId = hostElm['s-sc']; | ||
} | ||
// synchronous patch | ||
patch(oldVNode, rootVnode); | ||
}; | ||
const getElement = (ref) => ( getHostRef(ref).$hostElement$ ); | ||
const createEvent = (ref, name, flags) => { | ||
const elm = getElement(ref); | ||
return { | ||
emit: (detail) => { | ||
return emitEvent(elm, name, { | ||
bubbles: !!(flags & 4 /* Bubbles */), | ||
composed: !!(flags & 2 /* Composed */), | ||
cancelable: !!(flags & 1 /* Cancellable */), | ||
detail, | ||
}); | ||
}, | ||
}; | ||
}; | ||
const emitEvent = (elm, name, opts) => { | ||
const ev = new ( CustomEvent)(name, opts); | ||
elm.dispatchEvent(ev); | ||
return ev; | ||
}; | ||
const attachToAncestor = (hostRef, ancestorComponent) => { | ||
if ( ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) { | ||
ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r))); | ||
} | ||
}; | ||
const scheduleUpdate = (hostRef, isInitialLoad) => { | ||
{ | ||
hostRef.$flags$ |= 16 /* isQueuedForUpdate */; | ||
} | ||
if ( hostRef.$flags$ & 4 /* isWaitingForChildren */) { | ||
hostRef.$flags$ |= 512 /* needsRerender */; | ||
return; | ||
} | ||
attachToAncestor(hostRef, hostRef.$ancestorComponent$); | ||
// there is no ancestorc omponent or the ancestor component | ||
// has already fired off its lifecycle update then | ||
// fire off the initial update | ||
const dispatch = () => dispatchHooks(hostRef, isInitialLoad); | ||
return writeTask(dispatch) ; | ||
}; | ||
const dispatchHooks = (hostRef, isInitialLoad) => { | ||
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$); | ||
const instance = hostRef.$lazyInstance$ ; | ||
let promise; | ||
if (isInitialLoad) { | ||
{ | ||
hostRef.$flags$ |= 256 /* isListenReady */; | ||
if (hostRef.$queuedListeners$) { | ||
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event)); | ||
hostRef.$queuedListeners$ = null; | ||
} | ||
} | ||
{ | ||
promise = safeCall(instance, 'componentWillLoad'); | ||
} | ||
} | ||
endSchedule(); | ||
return then(promise, () => updateComponent(hostRef, instance, isInitialLoad)); | ||
}; | ||
const updateComponent = (hostRef, instance, isInitialLoad) => { | ||
// updateComponent | ||
const elm = hostRef.$hostElement$; | ||
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$); | ||
const rc = elm['s-rc']; | ||
if ( isInitialLoad) { | ||
// DOM WRITE! | ||
attachStyles(hostRef); | ||
} | ||
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$); | ||
{ | ||
{ | ||
// looks like we've got child nodes to render into this host element | ||
// or we need to update the css class/attrs on the host element | ||
// DOM WRITE! | ||
renderVdom(hostRef, callRender(hostRef, instance)); | ||
} | ||
} | ||
if ( rc) { | ||
// ok, so turns out there are some child host elements | ||
// waiting on this parent element to load | ||
// let's fire off all update callbacks waiting | ||
rc.map(cb => cb()); | ||
elm['s-rc'] = undefined; | ||
} | ||
endRender(); | ||
endUpdate(); | ||
{ | ||
const childrenPromises = elm['s-p']; | ||
const postUpdate = () => postUpdateComponent(hostRef); | ||
if (childrenPromises.length === 0) { | ||
postUpdate(); | ||
} | ||
else { | ||
Promise.all(childrenPromises).then(postUpdate); | ||
hostRef.$flags$ |= 4 /* isWaitingForChildren */; | ||
childrenPromises.length = 0; | ||
} | ||
} | ||
}; | ||
const callRender = (hostRef, instance) => { | ||
try { | ||
instance = instance.render && instance.render(); | ||
{ | ||
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */; | ||
} | ||
{ | ||
hostRef.$flags$ |= 2 /* hasRendered */; | ||
} | ||
} | ||
catch (e) { | ||
consoleError(e); | ||
} | ||
return instance; | ||
}; | ||
const postUpdateComponent = (hostRef) => { | ||
const tagName = hostRef.$cmpMeta$.$tagName$; | ||
const elm = hostRef.$hostElement$; | ||
const endPostUpdate = createTime('postUpdate', tagName); | ||
const ancestorComponent = hostRef.$ancestorComponent$; | ||
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { | ||
hostRef.$flags$ |= 64 /* hasLoadedComponent */; | ||
{ | ||
// DOM WRITE! | ||
addHydratedFlag(elm); | ||
} | ||
endPostUpdate(); | ||
{ | ||
hostRef.$onReadyResolve$(elm); | ||
if (!ancestorComponent) { | ||
appDidLoad(); | ||
} | ||
} | ||
} | ||
else { | ||
endPostUpdate(); | ||
} | ||
// load events fire from bottom to top | ||
// the deepest elements load first then bubbles up | ||
{ | ||
if (hostRef.$onRenderResolve$) { | ||
hostRef.$onRenderResolve$(); | ||
hostRef.$onRenderResolve$ = undefined; | ||
} | ||
if (hostRef.$flags$ & 512 /* needsRerender */) { | ||
nextTick(() => scheduleUpdate(hostRef, false)); | ||
} | ||
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */); | ||
} | ||
// ( •_•) | ||
// ( •_•)>⌐■-■ | ||
// (⌐■_■) | ||
}; | ||
const forceUpdate = (ref) => { | ||
{ | ||
const hostRef = getHostRef(ref); | ||
const isConnected = hostRef.$hostElement$.isConnected; | ||
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) { | ||
scheduleUpdate(hostRef, false); | ||
} | ||
// Returns "true" when the forced update was successfully scheduled | ||
return isConnected; | ||
} | ||
}; | ||
const appDidLoad = (who) => { | ||
// on appload | ||
// we have finish the first big initial render | ||
{ | ||
addHydratedFlag(doc.documentElement); | ||
} | ||
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } })); | ||
}; | ||
const safeCall = (instance, method, arg) => { | ||
if (instance && instance[method]) { | ||
try { | ||
return instance[method](arg); | ||
} | ||
catch (e) { | ||
consoleError(e); | ||
} | ||
} | ||
return undefined; | ||
}; | ||
const then = (promise, thenFn) => { | ||
return promise && promise.then ? promise.then(thenFn) : thenFn(); | ||
}; | ||
const addHydratedFlag = (elm) => ( elm.classList.add('hydrated') ); | ||
const parsePropertyValue = (propValue, propType) => { | ||
// ensure this value is of the correct prop type | ||
if (propValue != null && !isComplexType(propValue)) { | ||
if ( propType & 1 /* String */) { | ||
// could have been passed as a number or boolean | ||
// but we still want it as a string | ||
return String(propValue); | ||
} | ||
// redundant return here for better minification | ||
return propValue; | ||
} | ||
// not sure exactly what type we want | ||
// so no need to change to a different type | ||
return propValue; | ||
}; | ||
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName); | ||
const setValue = (ref, propName, newVal, cmpMeta) => { | ||
// check our new property value against our internal value | ||
const hostRef = getHostRef(ref); | ||
const oldVal = hostRef.$instanceValues$.get(propName); | ||
const flags = hostRef.$flags$; | ||
const instance = hostRef.$lazyInstance$ ; | ||
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]); | ||
if (( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) { | ||
// gadzooks! the property's value has changed!! | ||
// set our new value! | ||
hostRef.$instanceValues$.set(propName, newVal); | ||
if ( instance) { | ||
// get an array of method names of watch functions to call | ||
if ( cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) { | ||
const watchMethods = cmpMeta.$watchers$[propName]; | ||
if (watchMethods) { | ||
// this instance is watching for when this property changed | ||
watchMethods.map(watchMethodName => { | ||
try { | ||
// fire off each of the watch methods that are watching this property | ||
instance[watchMethodName](newVal, oldVal, propName); | ||
} | ||
catch (e) { | ||
consoleError(e); | ||
} | ||
}); | ||
} | ||
} | ||
if ( (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) { | ||
// looks like this value actually changed, so we've got work to do! | ||
// but only if we've already rendered, otherwise just chill out | ||
// queue that we need to do an update, but don't worry about queuing | ||
// up millions cuz this function ensures it only runs once | ||
scheduleUpdate(hostRef, false); | ||
} | ||
} | ||
} | ||
}; | ||
const proxyComponent = (Cstr, cmpMeta, flags) => { | ||
if ( cmpMeta.$members$) { | ||
if ( Cstr.watchers) { | ||
cmpMeta.$watchers$ = Cstr.watchers; | ||
} | ||
// It's better to have a const than two Object.entries() | ||
const members = Object.entries(cmpMeta.$members$); | ||
const prototype = Cstr.prototype; | ||
members.map(([memberName, [memberFlags]]) => { | ||
if ( (memberFlags & 31 /* Prop */ || (( flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) { | ||
// proxyComponent - prop | ||
Object.defineProperty(prototype, memberName, { | ||
get() { | ||
// proxyComponent, get value | ||
return getValue(this, memberName); | ||
}, | ||
set(newValue) { | ||
// proxyComponent, set value | ||
setValue(this, memberName, newValue, cmpMeta); | ||
}, | ||
configurable: true, | ||
enumerable: true, | ||
}); | ||
} | ||
}); | ||
if ( ( flags & 1 /* isElementConstructor */)) { | ||
const attrNameToPropName = new Map(); | ||
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) { | ||
plt.jmp(() => { | ||
const propName = attrNameToPropName.get(attrName); | ||
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue; | ||
}); | ||
}; | ||
// create an array of attributes to observe | ||
// and also create a map of html attribute name to js property name | ||
Cstr.observedAttributes = members | ||
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes | ||
.map(([propName, m]) => { | ||
const attrName = m[1] || propName; | ||
attrNameToPropName.set(attrName, propName); | ||
if ( m[0] & 512 /* ReflectAttr */) { | ||
cmpMeta.$attrsToReflect$.push([propName, attrName]); | ||
} | ||
return attrName; | ||
}); | ||
} | ||
} | ||
return Cstr; | ||
}; | ||
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => { | ||
// initializeComponent | ||
if ( (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) { | ||
// we haven't initialized this element yet | ||
hostRef.$flags$ |= 32 /* hasInitializedComponent */; | ||
{ | ||
// lazy loaded components | ||
// request the component's implementation to be | ||
// wired up with the host element | ||
Cstr = loadModule(cmpMeta); | ||
if (Cstr.then) { | ||
// Await creates a micro-task avoid if possible | ||
const endLoad = uniqueTime(); | ||
Cstr = await Cstr; | ||
endLoad(); | ||
} | ||
if ( !Cstr.isProxied) { | ||
// we'eve never proxied this Constructor before | ||
// let's add the getters/setters to its prototype before | ||
// the first time we create an instance of the implementation | ||
{ | ||
cmpMeta.$watchers$ = Cstr.watchers; | ||
} | ||
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */); | ||
Cstr.isProxied = true; | ||
} | ||
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$); | ||
// ok, time to construct the instance | ||
// but let's keep track of when we start and stop | ||
// so that the getters/setters don't incorrectly step on data | ||
{ | ||
hostRef.$flags$ |= 8 /* isConstructingInstance */; | ||
} | ||
// construct the lazy-loaded component implementation | ||
// passing the hostRef is very important during | ||
// construction in order to directly wire together the | ||
// host element and the lazy-loaded instance | ||
try { | ||
new Cstr(hostRef); | ||
} | ||
catch (e) { | ||
consoleError(e); | ||
} | ||
{ | ||
hostRef.$flags$ &= ~8 /* isConstructingInstance */; | ||
} | ||
{ | ||
hostRef.$flags$ |= 128 /* isWatchReady */; | ||
} | ||
endNewInstance(); | ||
} | ||
const scopeId = getScopeId(cmpMeta); | ||
if ( !styles.has(scopeId) && Cstr.style) { | ||
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$); | ||
// this component has styles but we haven't registered them yet | ||
let style = Cstr.style; | ||
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)); | ||
endRegisterStyles(); | ||
} | ||
} | ||
// we've successfully created a lazy instance | ||
const ancestorComponent = hostRef.$ancestorComponent$; | ||
const schedule = () => scheduleUpdate(hostRef, true); | ||
if ( ancestorComponent && ancestorComponent['s-rc']) { | ||
// this is the intial load and this component it has an ancestor component | ||
// but the ancestor component has NOT fired its will update lifecycle yet | ||
// so let's just cool our jets and wait for the ancestor to continue first | ||
// this will get fired off when the ancestor component | ||
// finally gets around to rendering its lazy self | ||
// fire off the initial update | ||
ancestorComponent['s-rc'].push(schedule); | ||
} | ||
else { | ||
schedule(); | ||
} | ||
}; | ||
const connectedCallback = (elm) => { | ||
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
const hostRef = getHostRef(elm); | ||
const cmpMeta = hostRef.$cmpMeta$; | ||
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$); | ||
if (!(hostRef.$flags$ & 1 /* hasConnected */)) { | ||
// first time this component has connected | ||
hostRef.$flags$ |= 1 /* hasConnected */; | ||
{ | ||
// find the first ancestor component (if there is one) and register | ||
// this component as one of the actively loading child components for its ancestor | ||
let ancestorComponent = elm; | ||
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) { | ||
// climb up the ancestors looking for the first | ||
// component that hasn't finished its lifecycle update yet | ||
if ( | ||
ancestorComponent['s-p']) { | ||
// we found this components first ancestor component | ||
// keep a reference to this component's ancestor component | ||
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent)); | ||
break; | ||
} | ||
} | ||
} | ||
// Lazy properties | ||
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties | ||
if ( cmpMeta.$members$) { | ||
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => { | ||
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) { | ||
const value = elm[memberName]; | ||
delete elm[memberName]; | ||
elm[memberName] = value; | ||
} | ||
}); | ||
} | ||
{ | ||
// connectedCallback, taskQueue, initialLoad | ||
// angular sets attribute AFTER connectCallback | ||
// https://github.com/angular/angular/issues/18909 | ||
// https://github.com/angular/angular/issues/19940 | ||
nextTick(() => initializeComponent(elm, hostRef, cmpMeta)); | ||
} | ||
} | ||
else { | ||
// not the first time this has connected | ||
// reattach any event listeners to the host | ||
// since they would have been removed when disconnected | ||
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
} | ||
endConnected(); | ||
} | ||
}; | ||
const disconnectedCallback = (elm) => { | ||
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
const hostRef = getHostRef(elm); | ||
const instance = hostRef.$lazyInstance$ ; | ||
{ | ||
if (hostRef.$rmListeners$) { | ||
hostRef.$rmListeners$.map(rmListener => rmListener()); | ||
hostRef.$rmListeners$ = undefined; | ||
} | ||
} | ||
{ | ||
safeCall(instance, 'disconnectedCallback'); | ||
} | ||
} | ||
}; | ||
const bootstrapLazy = (lazyBundles, options = {}) => { | ||
const endBootstrap = createTime(); | ||
const cmpTags = []; | ||
const exclude = options.exclude || []; | ||
const customElements = win.customElements; | ||
const head = doc.head; | ||
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]'); | ||
const visibilityStyle = /*@__PURE__*/ doc.createElement('style'); | ||
const deferredConnectedCallbacks = []; | ||
let appLoadFallback; | ||
let isBootstrapping = true; | ||
Object.assign(plt, options); | ||
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href; | ||
lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => { | ||
const cmpMeta = { | ||
$flags$: compactMeta[0], | ||
$tagName$: compactMeta[1], | ||
$members$: compactMeta[2], | ||
$listeners$: compactMeta[3], | ||
}; | ||
{ | ||
cmpMeta.$members$ = compactMeta[2]; | ||
} | ||
{ | ||
cmpMeta.$listeners$ = compactMeta[3]; | ||
} | ||
{ | ||
cmpMeta.$attrsToReflect$ = []; | ||
} | ||
{ | ||
cmpMeta.$watchers$ = {}; | ||
} | ||
const tagName = cmpMeta.$tagName$; | ||
const HostElement = class extends HTMLElement { | ||
// StencilLazyHost | ||
constructor(self) { | ||
// @ts-ignore | ||
super(self); | ||
self = this; | ||
registerHost(self, cmpMeta); | ||
if ( cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) { | ||
// this component is using shadow dom | ||
// and this browser supports shadow dom | ||
// add the read-only property "shadowRoot" to the host element | ||
// adding the shadow root build conditionals to minimize runtime | ||
{ | ||
{ | ||
self.attachShadow({ mode: 'open' }); | ||
} | ||
} | ||
} | ||
} | ||
connectedCallback() { | ||
if (appLoadFallback) { | ||
clearTimeout(appLoadFallback); | ||
appLoadFallback = null; | ||
} | ||
if (isBootstrapping) { | ||
// connectedCallback will be processed once all components have been registered | ||
deferredConnectedCallbacks.push(this); | ||
} | ||
else { | ||
plt.jmp(() => connectedCallback(this)); | ||
} | ||
} | ||
disconnectedCallback() { | ||
plt.jmp(() => disconnectedCallback(this)); | ||
} | ||
forceUpdate() { | ||
forceUpdate(this); | ||
} | ||
componentOnReady() { | ||
return getHostRef(this).$onReadyPromise$; | ||
} | ||
}; | ||
cmpMeta.$lazyBundleIds$ = lazyBundle[0]; | ||
if (!exclude.includes(tagName) && !customElements.get(tagName)) { | ||
cmpTags.push(tagName); | ||
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)); | ||
} | ||
})); | ||
{ | ||
visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS; | ||
visibilityStyle.setAttribute('data-styles', ''); | ||
head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild); | ||
} | ||
// Process deferred connectedCallbacks now all components have been registered | ||
isBootstrapping = false; | ||
if (deferredConnectedCallbacks.length) { | ||
deferredConnectedCallbacks.map(host => host.connectedCallback()); | ||
} | ||
else { | ||
{ | ||
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30))); | ||
} | ||
} | ||
// Fallback appLoad event | ||
endBootstrap(); | ||
}; | ||
const getAssetPath = (path) => { | ||
const assetUrl = new URL(path, plt.$resourcesUrl$); | ||
return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname; | ||
}; | ||
const getContext = (_elm, context) => { | ||
if (context in Context) { | ||
return Context[context]; | ||
} | ||
else if (context === 'window') { | ||
return win; | ||
} | ||
else if (context === 'document') { | ||
return doc; | ||
} | ||
else if (context === 'isServer' || context === 'isPrerender') { | ||
return false; | ||
} | ||
else if (context === 'isClient') { | ||
return true; | ||
} | ||
else if (context === 'resourcesUrl' || context === 'publicPath') { | ||
return getAssetPath('.'); | ||
} | ||
else if (context === 'queue') { | ||
return { | ||
write: writeTask, | ||
read: readTask, | ||
tick: { | ||
then(cb) { | ||
return nextTick(cb); | ||
}, | ||
}, | ||
}; | ||
} | ||
return undefined; | ||
}; | ||
const hostRefs = new WeakMap(); | ||
const getHostRef = (ref) => hostRefs.get(ref); | ||
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef); | ||
const registerHost = (elm, cmpMeta) => { | ||
const hostRef = { | ||
$flags$: 0, | ||
$hostElement$: elm, | ||
$cmpMeta$: cmpMeta, | ||
$instanceValues$: new Map(), | ||
}; | ||
{ | ||
hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r)); | ||
elm['s-p'] = []; | ||
elm['s-rc'] = []; | ||
} | ||
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
return hostRefs.set(elm, hostRef); | ||
}; | ||
const isMemberInElement = (elm, memberName) => memberName in elm; | ||
const consoleError = (e) => console.error(e); | ||
const cmpModules = /*@__PURE__*/ new Map(); | ||
const loadModule = (cmpMeta, hostRef, hmrVersionId) => { | ||
// loadModuleImport | ||
const exportName = cmpMeta.$tagName$.replace(/-/g, '_'); | ||
const bundleId = ( cmpMeta.$lazyBundleIds$); | ||
const module = cmpModules.get(bundleId) ; | ||
if (module) { | ||
return module[exportName]; | ||
} | ||
return import( | ||
/* webpackInclude: /\.entry\.js$/ */ | ||
/* webpackExclude: /\.system\.entry\.js$/ */ | ||
/* webpackMode: "lazy" */ | ||
`./${bundleId}.entry.js${ ''}`).then(importedModule => { | ||
{ | ||
cmpModules.set(bundleId, importedModule); | ||
} | ||
return importedModule[exportName]; | ||
}, consoleError); | ||
}; | ||
const styles = new Map(); | ||
const queueDomReads = []; | ||
const queueDomWrites = []; | ||
const queueTask = (queue, write) => (cb) => { | ||
queue.push(cb); | ||
if (!queuePending) { | ||
queuePending = true; | ||
if (write && plt.$flags$ & 4 /* queueSync */) { | ||
nextTick(flush); | ||
} | ||
else { | ||
plt.raf(flush); | ||
} | ||
} | ||
}; | ||
const consume = (queue) => { | ||
for (let i = 0; i < queue.length; i++) { | ||
try { | ||
queue[i](performance.now()); | ||
} | ||
catch (e) { | ||
consoleError(e); | ||
} | ||
} | ||
queue.length = 0; | ||
}; | ||
const flush = () => { | ||
// always force a bunch of medium callbacks to run, but still have | ||
// a throttle on how many can run in a certain time | ||
// DOM READS!!! | ||
consume(queueDomReads); | ||
// DOM WRITES!!! | ||
{ | ||
consume(queueDomWrites); | ||
if ((queuePending = queueDomReads.length > 0)) { | ||
// still more to do yet, but we've run out of time | ||
// let's let this thing cool off and try again in the next tick | ||
plt.raf(flush); | ||
} | ||
} | ||
}; | ||
const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb); | ||
const readTask = /*@__PURE__*/ queueTask(queueDomReads, false); | ||
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true); | ||
const patchEsm = () => { | ||
return promiseResolve(); | ||
}; | ||
const patchBrowser = () => { | ||
const importMeta = import.meta.url; | ||
const opts = {}; | ||
if ( importMeta !== '') { | ||
opts.resourcesUrl = new URL('.', importMeta).href; | ||
} | ||
return promiseResolve(opts); | ||
}; | ||
export { Host as H, patchEsm as a, bootstrapLazy as b, createEvent as c, getContext as d, getElement as g, h, patchBrowser as p, registerInstance as r }; |
@@ -1,1 +0,5 @@ | ||
import{p as e,b as s}from"./p-e49ed7e6.js";e().then(e=>s([["p-58e25be0",[[0,"item-metadata",{_key:[1,"key"],attribute:[1]}]]],["p-1171ef00",[[0,"pie-api-live",{metadata:[16],token:[1],host:[1]},[[0,"attachSession","handleLiveSessionAdded"]]]]],["p-e24287e8",[[1,"pie-live-session",{sessionId:[513,"session-id"],token:[1],client:[16],apiUrl:[1,"api-url"],metadata:[16],sessionData:[32]}]]],["p-fab8ae50",[[1,"pie-response",{sessionData:[8,"session-data"]}]]],["p-4ca6587c",[[1,"pie-response-cell",{sessionData:[8,"session-data"]}]]]],e)); | ||
import { p as patchBrowser, b as bootstrapLazy } from './p-e49ed7e6.js'; | ||
patchBrowser().then(options => { | ||
return bootstrapLazy([["p-3d25ae1a",[[0,"item-metadata",{"_key":[1,"key"],"attribute":[1]}]]],["p-3c7d1d07",[[0,"pie-api-live",{"metadata":[16],"token":[1],"host":[1]},[[0,"attachSession","handleLiveSessionAdded"]]]]],["p-19a28bbc",[[1,"pie-live-session",{"sessionId":[513,"session-id"],"token":[1],"client":[16],"apiUrl":[1,"api-url"],"metadata":[16],"sessionData":[32]}]]],["p-a326ef47",[[1,"pie-response",{"sessionData":[8,"session-data"]}]]],["p-d77e412f",[[1,"pie-response-cell",{"sessionData":[8,"session-data"]}]]]], options); | ||
}); |
{ | ||
"name": "@pie-api/pie-api-live-components", | ||
"version": "1.13.0", | ||
"version": "1.13.1-beta.1", | ||
"description": "Custom Elements that work with PIE Api Live services", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -64,2 +64,2 @@ | ||
live-session should retrieve item model directly once using item id (rather than receiving model in every sessionEvent as it is now. For short-term in R&D this is ok, but should be refactored for efficiency | ||
live-session should retrieve item model directly once using item id (rather than receiving model in every sessionEvent as it is now. For short-term in R&D this is ok, but should be refactored for efficiency |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
1983905
49631
65
2