@bpd-library/utilities 1.2.8-beta.2 → 1.2.8-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- {"version":3,"file":"compose-exclude-string.js","sourceRoot":"","sources":["../../src/api-utilities/compose-exclude-string.ts"],"names":[],"mappings":"AASA,MAAM,oBAAoB,GAAG,CACzB,IAOG,EACL,EAAE;IACA,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import {\n ApartmentBuildingModel,\n AreaProjectModel,\n ConstructionNumberModel,\n DistrictModel,\n ProjectPhaseModel,\n PropertyTypeModel,\n} from '../generated';\n\nconst composeExcludeString = (\n keys: (\n | keyof ConstructionNumberModel\n | keyof PropertyTypeModel\n | keyof ApartmentBuildingModel\n | keyof ProjectPhaseModel\n | keyof DistrictModel\n | keyof AreaProjectModel\n )[],\n) => {\n return keys.join(',');\n};\n\nexport { composeExcludeString };\n"]}
@@ -1,5 +0,0 @@
1
- import { ConstructionNumberModel, ProjectPhaseModel, PropertyTypeModel } from '@/generated';
2
- declare const EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES: (keyof ConstructionNumberModel)[];
3
- declare const EXCLUDED_PROPERTY_TYPE_PROPERTIES: (keyof PropertyTypeModel)[];
4
- declare const EXCLUDED_PROJECT_PHASE_PROPERTIES: (keyof ProjectPhaseModel)[];
5
- export { EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES, EXCLUDED_PROPERTY_TYPE_PROPERTIES, EXCLUDED_PROJECT_PHASE_PROPERTIES, };
@@ -1,35 +0,0 @@
1
- const EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES = [
2
- 'shortDescription',
3
- 'longDescription',
4
- 'resources',
5
- 'gardens',
6
- 'outbuildings',
7
- 'groundLease',
8
- 'floors',
9
- 'outsideSpace',
10
- 'extraSpecifications',
11
- 'landRegistration',
12
- ];
13
- const EXCLUDED_PROPERTY_TYPE_PROPERTIES = [
14
- 'shortDescription',
15
- 'longDescription',
16
- 'environmentTypes',
17
- 'groundLease',
18
- 'resources',
19
- 'constructionStartDate',
20
- 'indicationServiceCosts',
21
- 'indicationSecurity',
22
- 'floors',
23
- 'gardens',
24
- 'outbuildings',
25
- 'usp1Title',
26
- 'usp1Text',
27
- 'usp2Title',
28
- 'usp2Text',
29
- ];
30
- const EXCLUDED_PROJECT_PHASE_PROPERTIES = [
31
- 'longDescription',
32
- 'resources',
33
- ];
34
- export { EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES, EXCLUDED_PROPERTY_TYPE_PROPERTIES, EXCLUDED_PROJECT_PHASE_PROPERTIES, };
35
- //# sourceMappingURL=excluded-properties.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"excluded-properties.js","sourceRoot":"","sources":["../../src/extended-api-models/excluded-properties.ts"],"names":[],"mappings":"AAKA,MAAM,uCAAuC,GAAsC;IAC/E,kBAAkB;IAClB,iBAAiB;IACjB,WAAW;IACX,SAAS;IACT,cAAc;IACd,aAAa;IACb,QAAQ;IACR,cAAc;IACd,qBAAqB;IACrB,kBAAkB;CACrB,CAAC;AAKF,MAAM,iCAAiC,GAAgC;IACnE,kBAAkB;IAClB,iBAAiB;IACjB,kBAAkB;IAClB,aAAa;IACb,WAAW;IACX,uBAAuB;IACvB,wBAAwB;IACxB,oBAAoB;IACpB,QAAQ;IACR,SAAS;IACT,cAAc;IACd,WAAW;IACX,UAAU;IACV,WAAW;IACX,UAAU;CACb,CAAC;AAKF,MAAM,iCAAiC,GAAgC;IACnE,iBAAiB;IACjB,WAAW;CACd,CAAC;AAEF,OAAO,EACH,uCAAuC,EACvC,iCAAiC,EACjC,iCAAiC,GACpC,CAAC","sourcesContent":["import { ConstructionNumberModel, ProjectPhaseModel, PropertyTypeModel } from '@/generated';\n\n/*\n THE EXCLUDED VALUES ALSO NEED TO BE CHANGED IN api-utilitites.types.ts\n*/\nconst EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES: (keyof ConstructionNumberModel)[] = [\n 'shortDescription',\n 'longDescription',\n 'resources',\n 'gardens',\n 'outbuildings',\n 'groundLease',\n 'floors',\n 'outsideSpace',\n 'extraSpecifications',\n 'landRegistration',\n];\n\n/*\n THE EXCLUDED VALUES ALSO NEED TO BE CHANGED IN api-utilitites.types.ts\n*/\nconst EXCLUDED_PROPERTY_TYPE_PROPERTIES: (keyof PropertyTypeModel)[] = [\n 'shortDescription',\n 'longDescription',\n 'environmentTypes',\n 'groundLease',\n 'resources',\n 'constructionStartDate',\n 'indicationServiceCosts',\n 'indicationSecurity',\n 'floors',\n 'gardens',\n 'outbuildings',\n 'usp1Title',\n 'usp1Text',\n 'usp2Title',\n 'usp2Text',\n];\n\n/*\n THE EXCLUDED VALUES ALSO NEED TO BE CHANGED IN api-utilitites.types.ts\n*/\nconst EXCLUDED_PROJECT_PHASE_PROPERTIES: (keyof ProjectPhaseModel)[] = [\n 'longDescription',\n 'resources',\n];\n\nexport {\n EXCLUDED_CONSTRUCTION_NUMBER_PROPERTIES,\n EXCLUDED_PROPERTY_TYPE_PROPERTIES,\n EXCLUDED_PROJECT_PHASE_PROPERTIES,\n};\n"]}
@@ -1,15 +0,0 @@
1
- declare global {
2
- interface Window {
3
- ShadyCSS: any;
4
- }
5
- interface ShadowRoot {
6
- adoptedStyleSheets: CSSStyleSheet[];
7
- }
8
- interface Document {
9
- adoptedStyleSheets: CSSStyleSheet[];
10
- }
11
- interface CSSStyleSheet {
12
- replaceSync(cssText: string): void;
13
- }
14
- }
15
- export declare const useStylesheet: (style: string) => void;
@@ -1,81 +0,0 @@
1
- import { createHook } from '@atomify/hooks';
2
- const supportShadyCSS = window.ShadyCSS && !window.ShadyCSS.nativeShadow;
3
- const CSS_SAVE_TOKEN = Symbol('atomify.cssSaveToken');
4
- const styleCache = new Map();
5
- const APPLIED_STYLES = [];
6
- const supportsAdoptingStyleSheets = () => 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;
7
- function bindShadyRoot(target, template) {
8
- window.ShadyCSS.prepareTemplate(template, target.$cmpMeta$.$tagName$);
9
- window.ShadyCSS.styleElement(target);
10
- }
11
- const applyShadowdomStyles = (component, styles) => {
12
- const container = component.container;
13
- const componentName = component.$cmpMeta$.$tagName$;
14
- let styleTmp;
15
- if (!styleCache.has(componentName)) {
16
- styleTmp = document.createElement('template');
17
- styleTmp.innerHTML = `${component.hasShadowDom && !supportsAdoptingStyleSheets() && styles
18
- ? `<style style-hook>${styles}</style>`
19
- : ''}`;
20
- }
21
- else {
22
- styleTmp = styleCache.get(componentName);
23
- }
24
- if (styleTmp) {
25
- if (supportShadyCSS && component.hasShadowDom) {
26
- bindShadyRoot(component, styleTmp);
27
- }
28
- container.appendChild(document.importNode(styleTmp.content, true));
29
- }
30
- };
31
- const unsafeCSS = (cssString) => createCSSResult(String(cssString), CSS_SAVE_TOKEN);
32
- const createCSSResult = (css, token) => {
33
- if (token !== CSS_SAVE_TOKEN)
34
- throw new Error(`${css} is not supported. Use 'unsafeCSS' if you want to use: ${css}`);
35
- let styleSheet = null;
36
- const cssText = css;
37
- if (supportsAdoptingStyleSheets()) {
38
- styleSheet = new CSSStyleSheet();
39
- styleSheet.replaceSync(cssText);
40
- }
41
- return {
42
- cssText,
43
- styleSheet,
44
- };
45
- };
46
- const adoptStyles = (root, styles) => {
47
- const hasShadowDom = root.hasShadowDom;
48
- const componentName = root.$cmpMeta$.$tagName$;
49
- if (supportsAdoptingStyleSheets() && hasShadowDom) {
50
- const CSSRoot = root.container;
51
- if (!(CSSRoot instanceof HTMLElement))
52
- CSSRoot.adoptedStyleSheets = styles.map((s) => {
53
- return s instanceof StyleSheet ? s : s.styleSheet;
54
- });
55
- }
56
- else if (APPLIED_STYLES.indexOf(componentName) === -1) {
57
- const combinedStyleArray = styles
58
- .map((style) => ('cssText' in style ? style.cssText : null))
59
- .join('');
60
- if (hasShadowDom) {
61
- root.styles = combinedStyleArray;
62
- applyShadowdomStyles(root, combinedStyleArray);
63
- }
64
- else {
65
- const styleElement = document.createElement('style');
66
- styleElement.textContent = combinedStyleArray;
67
- styleElement.setAttribute('scope', componentName);
68
- document.head.appendChild(styleElement);
69
- APPLIED_STYLES.push(componentName);
70
- }
71
- }
72
- };
73
- export const useStylesheet = (style) => {
74
- const css = unsafeCSS(style);
75
- const styles = Array.isArray(css) ? [...css] : [css];
76
- return createHook({
77
- onDidLoad: (element) => adoptStyles(element, styles),
78
- onUpdate: (element) => adoptStyles(element, styles),
79
- });
80
- };
81
- //# sourceMappingURL=use-stylesheet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-stylesheet.js","sourceRoot":"","sources":["../../src/hooks/use-stylesheet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA0BvD,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC;AACzE,MAAM,cAAc,GAAG,MAAM,CAAC,sBAAsB,CAAC,CAAC;AACtD,MAAM,UAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;AAC1D,MAAM,cAAc,GAAa,EAAE,CAAC;AAKpC,MAAM,2BAA2B,GAAG,GAAG,EAAE,CACrC,oBAAoB,IAAI,QAAQ,CAAC,SAAS,IAAI,SAAS,IAAI,aAAa,CAAC,SAAS,CAAC;AAQvF,SAAS,aAAa,CAAC,MAAiB,EAAE,QAA6B;IACnE,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACtE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,oBAAoB,GAAG,CAAC,SAAoB,EAAE,MAAc,EAAE,EAAE;IAClE,MAAM,SAAS,GAAG,SAAS,CAAC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,IAAI,CAAC,aAAa,CAAC,CAAC;SACtC;KACJ;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,EAAE;IAC3C,MAAM,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAErD,OAAO,UAAU,CAAC;QACd,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;QACpD,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;KACtD,CAAC,CAAC;AACP,CAAC,CAAC","sourcesContent":["import { Component, createHook } from '@atomify/hooks';\n\ndeclare global {\n interface Window {\n ShadyCSS: any;\n }\n interface ShadowRoot {\n adoptedStyleSheets: CSSStyleSheet[];\n }\n\n interface Document {\n adoptedStyleSheets: CSSStyleSheet[];\n }\n\n interface CSSStyleSheet {\n replaceSync(cssText: string): void;\n }\n}\n\ninterface CSSResult {\n cssText: string;\n styleSheet: CSSStyleSheet | null;\n}\n\ntype CSSResultOrNative = CSSResult | CSSStyleSheet;\n\nconst supportShadyCSS = window.ShadyCSS && !window.ShadyCSS.nativeShadow;\nconst CSS_SAVE_TOKEN = Symbol('atomify.cssSaveToken');\nconst styleCache = new Map<string, HTMLTemplateElement>();\nconst APPLIED_STYLES: string[] = [];\n\n/**\n * Checks if adopting stylesheet is supported.\n */\nconst supportsAdoptingStyleSheets = () =>\n 'adoptedStyleSheets' in Document.prototype && 'replace' in CSSStyleSheet.prototype;\n\n/**\n * Generates a template based necessary fallbacks needed for browsers that do not support Custom elements or ShadowDom\n * Reference: https://github.com/webcomponents/webcomponentsjs\n * @param {Component} target\n * @param {HTMLTemplateElement} template\n */\nfunction bindShadyRoot(target: Component, template: HTMLTemplateElement) {\n window.ShadyCSS.prepareTemplate(template, target.$cmpMeta$.$tagName$);\n window.ShadyCSS.styleElement(target);\n}\n\nconst applyShadowdomStyles = (component: Component, styles: string) => {\n const container = component.container;\n const componentName = component.$cmpMeta$.$tagName$;\n let styleTmp: HTMLTemplateElement | undefined;\n\n if (!styleCache.has(componentName)) {\n styleTmp = document.createElement('template');\n\n styleTmp.innerHTML = `${\n component.hasShadowDom && !supportsAdoptingStyleSheets() && styles\n ? `<style style-hook>${styles}</style>`\n : ''\n }`;\n } else {\n styleTmp = styleCache.get(componentName);\n }\n\n if (styleTmp) {\n // Apply polyfill when shady polyfill is available and the component has shadowdom\n if (supportShadyCSS && component.hasShadowDom) {\n bindShadyRoot(component, styleTmp);\n }\n\n container.appendChild(document.importNode(styleTmp.content, true));\n }\n};\n\n/**\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n * @param {string} css\n * @returns {StyleObject}\n */\nconst unsafeCSS = (cssString: unknown): CSSResult =>\n createCSSResult(String(cssString), CSS_SAVE_TOKEN);\n\n/**\n * @param {string} css\n * @param {symbol} token\n * @returns {({ cssText: string; styleSheet: CSSStyleSheet | null })}\n */\nconst createCSSResult = (\n css: string,\n token: symbol,\n): { cssText: string; styleSheet: CSSStyleSheet | null } => {\n if (token !== CSS_SAVE_TOKEN)\n throw new Error(`${css} is not supported. Use 'unsafeCSS' if you want to use: ${css}`);\n\n let styleSheet: CSSStyleSheet | null = null;\n const cssText = css;\n\n if (supportsAdoptingStyleSheets()) {\n styleSheet = new CSSStyleSheet();\n styleSheet.replaceSync(cssText);\n }\n\n return {\n cssText,\n styleSheet,\n };\n};\n\n/**\n * Applies adoptedStyleSheets to the Atomify component.\n * @param { Component } root\n * @param { StyleObject } css\n */\nconst adoptStyles = (root: Component, styles: Array<CSSResultOrNative>) => {\n const hasShadowDom = root.hasShadowDom;\n const componentName = root.$cmpMeta$.$tagName$;\n\n // Add addopted stylesheets when it is supported\n if (supportsAdoptingStyleSheets() && hasShadowDom) {\n const CSSRoot = root.container;\n if (!(CSSRoot instanceof HTMLElement))\n CSSRoot.adoptedStyleSheets = styles.map((s) => {\n return s instanceof StyleSheet ? s : s.styleSheet!;\n });\n } else if (APPLIED_STYLES.indexOf(componentName) === -1) {\n const combinedStyleArray = styles\n .map((style) => ('cssText' in style ? style.cssText : null))\n .join('');\n\n // When adopted stylesheet is not supported but shadowdom is apply it to the shadowroot.\n // Else it is being applied to the head.\n if (hasShadowDom) {\n // Cache the styles so it can be reused instead of creating a style tag again.\n root.styles = combinedStyleArray;\n applyShadowdomStyles(root, combinedStyleArray);\n } else {\n const styleElement = document.createElement('style');\n styleElement.textContent = combinedStyleArray;\n styleElement.setAttribute('scope', componentName);\n\n document.head.appendChild(styleElement);\n APPLIED_STYLES.push(componentName);\n }\n }\n};\n\nexport const useStylesheet = (style: string) => {\n const css = unsafeCSS(style);\n const styles = Array.isArray(css) ? [...css] : [css];\n\n return createHook({\n onDidLoad: (element) => adoptStyles(element, styles),\n onUpdate: (element) => adoptStyles(element, styles),\n });\n};\n"]}