Skip to content

Commit 55739b6

Browse files
committed
scrubbing for InkRegistry
1 parent dcb0ffd commit 55739b6

7 files changed

Lines changed: 29 additions & 29 deletions

File tree

packages/ink-web/src/components/api/types.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,13 +1413,13 @@
14131413
"example": "this.render(); //--> '<p>...</p>'"
14141414
}
14151415
},
1416-
"InkRegistry": {
1416+
"ClientRegistry": {
14171417
"elements": {
14181418
"kind": "property",
14191419
"list": false,
14201420
"type": "Map<Element, InkElement>",
14211421
"description": "Returns a map of elements used in the DOM.",
1422-
"example": "InkAPI.InkRegistry.elements.get(component);"
1422+
"example": "InkAPI.ClientRegistry.elements.get(component);"
14231423
},
14241424
"createComponent": {
14251425
"kind": "function",
@@ -1455,7 +1455,7 @@
14551455
"type": "InkElement"
14561456
},
14571457
"description": "Creates a InkElement from a web component class.",
1458-
"example": "InkAPI.InkRegistry.createComponent('fancy-button', InkComponent, { title: 'Hello' }, children);"
1458+
"example": "InkAPI.ClientRegistry.createComponent('fancy-button', InkComponent, { title: 'Hello' }, children);"
14591459
},
14601460
"createElement": {
14611461
"kind": "function",
@@ -1485,7 +1485,7 @@
14851485
"type": "InkElement"
14861486
},
14871487
"description": "Creates a InkElement from a string tag name.",
1488-
"example": "InkAPI.InkRegistry.createElement('a', { href: '/' }, children);"
1488+
"example": "InkAPI.ClientRegistry.createElement('a', { href: '/' }, children);"
14891489
},
14901490
"createText": {
14911491
"kind": "function",
@@ -1503,7 +1503,7 @@
15031503
"type": "TextNode"
15041504
},
15051505
"description": "Creates a TextNode from a raw string.",
1506-
"example": "InkAPI.InkRegistry.createText('foo');"
1506+
"example": "InkAPI.ClientRegistry.createText('foo');"
15071507
},
15081508
"get": {
15091509
"kind": "function",
@@ -1521,7 +1521,7 @@
15211521
"type": "InkElement"
15221522
},
15231523
"description": "Returns a InkElement given a DOM element.",
1524-
"example": "InkAPI.InkRegistry.get(element)"
1524+
"example": "InkAPI.ClientRegistry.get(element)"
15251525
},
15261526
"has": {
15271527
"kind": "function",
@@ -1539,7 +1539,7 @@
15391539
"type": "boolean"
15401540
},
15411541
"description": "Returns true if the given element exists in the registry",
1542-
"example": "InkAPI.InkRegistry.has(element)"
1542+
"example": "InkAPI.ClientRegistry.has(element)"
15431543
},
15441544
"map": {
15451545
"kind": "function",
@@ -1557,7 +1557,7 @@
15571557
"type": "T"
15581558
},
15591559
"description": "Like array map for registry returns an array of whatever the callback returns.",
1560-
"example": "InkAPI.InkRegistry.map((ink, element) => [ink, element]);"
1560+
"example": "InkAPI.ClientRegistry.map((ink, element) => [ink, element]);"
15611561
},
15621562
"register": {
15631563
"kind": "function",
@@ -1581,7 +1581,7 @@
15811581
"type": "InkElement"
15821582
},
15831583
"description": "Registers a InkElement to the registry.",
1584-
"example": "InkAPI.InkRegistry.register(element, { foo: 'bar' });"
1584+
"example": "InkAPI.ClientRegistry.register(element, { foo: 'bar' });"
15851585
}
15861586
},
15871587
"InkElement": {
@@ -1830,12 +1830,12 @@
18301830
"description": "The Ink exception class used to create custom errors.",
18311831
"example": "throw InkAPI.InkException.for('error message');"
18321832
},
1833-
"InkRegistry": {
1833+
"ClientRegistry": {
18341834
"kind": "property",
18351835
"list": false,
1836-
"type": "InkRegistry",
1836+
"type": "ClientRegistry",
18371837
"description": "The Ink registry class used to store custom elements.",
1838-
"example": "new InkAPI.InkRegistry.createElement('a', { href: '/' });"
1838+
"example": "new InkAPI.ClientRegistry.createElement('a', { href: '/' });"
18391839
},
18401840
"children": {
18411841
"kind": "function",

packages/ink-web/src/pages/docs/index.ink

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
template() {
109109
const { name } = props();
110110
return () => [
111-
InkRegistry.createElement('h1', null, \`Hello \${name}\`)
111+
Registry.createElement('h1', null, \`Hello \${name}\`)
112112
]
113113
}
114114
}

packages/ink/src/client/Component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ export default abstract class ClientComponent extends HTMLElement {
427427
}
428428

429429
/**
430-
* This is used in InkRegistry.createComponent() to
430+
* This is used in Registry.createComponent() to
431431
* create a virtual instance of the component. This is
432432
* used components that are used by other components,
433433
* but not registered in custom elements.

packages/ink/src/client/Document.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import DOMDocument from '../dom/Document';
44
//api
55
import data from './api/data';
66
//local
7-
import InkRegistry from './Registry';
7+
import Registry from './Registry';
88

99
export default abstract class ClientDocument {
1010
/**
@@ -70,14 +70,14 @@ export default abstract class ClientDocument {
7070
])
7171
);
7272
//determine the id of the element by its index in the registry
73-
const id = String(InkRegistry.elements.size);
73+
const id = String(Registry.elements.size);
7474
//if the element has bindings
7575
if (bindings[id]) {
7676
//this is where we need to add the bindings to the attributes
7777
Object.assign(attributes, bindings[id]);
7878
}
7979
//finally add the element to the registry
80-
InkRegistry.register(element, attributes);
80+
Registry.register(element, attributes);
8181
}
8282
return bindings;
8383
}
@@ -101,6 +101,6 @@ export default abstract class ClientDocument {
101101
}
102102
}
103103

104-
return [ InkRegistry.createText(String(value)) ];
104+
return [ Registry.createText(String(value)) ];
105105
}
106106
}

packages/ink/src/client/Registry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export default class ClientRegistry {
5454
}
5555

5656
//NOTE: It's more logical to call this.crateElement()
57-
//but InkComponent will error because it's not
58-
//registered in InkRegistry yet.
57+
//but Component will error because it's not
58+
//registered in Registry yet.
5959

6060
//change the tagname if the component is registered
6161
const name = registered || tagname;
@@ -130,7 +130,7 @@ export default class ClientRegistry {
130130
public static createText(value: string, escape = true) {
131131
//NOTE: TextNode will escape strings by default
132132
// if we allow escape to be false, and the string
133-
// contains HTML, then the InkRegistry count
133+
// contains HTML, then the Registry count
134134
// will be off.. there are also some other edge
135135
// cases that need to be considered before allowing
136136
// escape to be false...

packages/ink/tests/CompilerTranspiler.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ describe('Ink Compiler Transpiler', () => {
1919
const transpiler = new Transpiler(component, tsconfig);
2020
const actual = transpiler.transpile();
2121
// [
22-
// InkRegistry.createElement('div', { }, [
23-
// InkRegistry.createElement('span', { }, [
24-
// InkRegistry.createText(`$`)
22+
// Registry.createElement('div', { }, [
23+
// Registry.createElement('span', { }, [
24+
// Registry.createText(`$`)
2525
// ]).element,
26-
// InkRegistry.createText(`ok`)
26+
// Registry.createText(`ok`)
2727
// ]).element
2828
// ]
2929
expect(toTS(actual)).to.contain('ClientRegistry.createText(`$`, false)');

packages/ink/tests/DocumentTranspiler.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ describe('Ink Document Transpiler', () => {
2020
const server = toTS(transpiler.transpile());
2121
//console.log('--server--', server);
2222
// [
23-
// InkRegistry.createElement('div', { }, [
24-
// InkRegistry.createElement('span', { }, [
25-
// InkRegistry.createText(`$`)
23+
// Registry.createElement('div', { }, [
24+
// Registry.createElement('span', { }, [
25+
// Registry.createText(`$`)
2626
// ]).element,
27-
// InkRegistry.createText(`ok`)
27+
// Registry.createText(`ok`)
2828
// ]).element
2929
// ]
3030
expect(server).to.contain('DOMDocument.createElement(\'div\', { \'title\': title },');

0 commit comments

Comments
 (0)